@lysaab/lysa-pep 1.0.5-0 → 1.0.7-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/messages/src/pages/StatusPage/StatusMessages.json +1 -1
- package/messages/src/pages/StatusPage/StatusPage.json +1 -1
- package/model/PepModel.d.ts +3 -3
- package/model/PepModel.js +13 -13
- package/package.json +4 -2
- package/pages/PepContext.d.ts +1 -1
- package/pages/PepContext.js +1 -1
- package/pages/StatusPage/StatusMessages.js +6 -6
- package/pages/StatusPage/StatusPage.d.ts +2 -0
- package/pages/StatusPage/StatusPage.js +19 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"id":"pep.status.isongoing.header","description":"Is ongoing header","defaultMessage":"{ \n entityType, select,\n PERSON {\n { \n pepType, select, \n ME { \n
|
|
1
|
+
[{"id":"pep.status.isongoing.header","description":"Is ongoing header","defaultMessage":"{ \n entityType, select,\n PERSON {\n { \n pepType, select, \n ME { \n Is your position ongoing or terminated?\n }\n RELATIVE { \n {\n relation, select,\n MARRIED_PARTNER { \n Är din make/maka/registrerade partners befattning pågående eller avslutad?\n }\n COLIVING_PARTNER { \n Är din sambos befattning pågående eller avslutad?\n }\n CHILD { \n Är din förälders befattning pågående eller avslutad?\n }\n PARENT { \n Är ditt barns befattning pågående eller avslutad?\n }\n CHILD_MARRIED_PARTNER { \n Är din make/makas förälders befattning pågående eller avslutad?\n }\n CHILD_COLIVING_PARTNER { \n Är din sambos förälders befattning pågående eller avslutad?\n }\n }\n }\n COLLEAGUE { \n {\n relation, select,\n CO_OWNERSHIP { \n Är befattningen för personen i politisk utsatt ställning, som är verklig huvudman till ett företag tillsammans med dig, pågående eller avslutad?\n }\n CLOSE_CONNECTION { \n Är befattningen för personen i politisk utsatt ställning, som du har eller har haft nära förbindelse med, pågående eller avslutad?\n }\n COMPANY_FOR_PEP { \n Är befattningen för personen i politisk utsatt ställning, som du har en relation till, pågående eller avslutad?\n }\n }\n }\n other {}\n }\n }\n CORPORATION {\n { \n pepType, select, \n ME { \n Är {possessiveName} befattning pågående eller avslutad?\n \n }\n RELATIVE { \n {\n relation, select,\n MARRIED_PARTNER { \n Är {possessiveName} make/maka/registrerade partners befattning pågående eller avslutad?\n }\n COLIVING_PARTNER { \n Är {possessiveName} sambos befattning pågående eller avslutad?\n }\n CHILD { \n Är {possessiveName} förälders befattning pågående eller avslutad?\n }\n PARENT { \n Är {possessiveName} barns befattning pågående eller avslutad?\n }\n CHILD_MARRIED_PARTNER { \n Är {possessiveName} make/makas förälders befattning pågående eller avslutad?\n }\n CHILD_COLIVING_PARTNER { \n Är {possessiveName} sambos förälders befattning pågående eller avslutad?\n }\n }\n }\n COLLEAGUE { \n {\n relation, select,\n CO_OWNERSHIP { \n Är befattningen för personen i politisk utsatt ställning, som är verklig huvudman till ett företag tillsammans med {name}, pågående eller avslutad?\n }\n CLOSE_CONNECTION { \n Är befattningen för personen i politisk utsatt ställning, som {name} har eller har haft nära förbindelse med, pågående eller avslutad?\n }\n COMPANY_FOR_PEP { \n Är befattningen för personen i politisk utsatt ställning, som {name} har en relation till, pågående eller avslutad?\n }\n }\n }\n other {}\n }\n }\n other {}\n }"},{"id":"pep.status.isongoing.required","description":"Is ongoing required error","defaultMessage":"Du måste välja ett alternativ"},{"id":"pep.status.ended.header","description":"When did it end header","defaultMessage":"När avslutades uppdraget?"},{"id":"pep.status.ended.required","description":"When did it end required error","defaultMessage":"Du måste ange ett slutdatum"},{"id":"pep.status.localcountry.header","description":"What country header","defaultMessage":"What country is the position in?"},{"id":"pep.status.localcountry.required","description":"Is local country required error","defaultMessage":"Du måste välja ett alternativ"},{"id":"pep.status.countryselecton.header","description":"Country selection header","defaultMessage":"{ \n entityType, select,\n PERSON {\n { \n pepType, select, \n ME { \n I vilket land är/var din befattning?\n }\n RELATIVE { \n {\n relation, select,\n MARRIED_PARTNER { \n I vilket land är/var din make/maka/registrerade partners befattning?\n }\n COLIVING_PARTNER { \n I vilket land är/var din sambos befattning?\n }\n CHILD { \n I vilket land är/var din förälders befattning?\n }\n PARENT { \n I vilket land är/var ditt barns befattning?\n }\n CHILD_MARRIED_PARTNER { \n I vilket land är/var din make/makas förälders befattning?\n }\n CHILD_COLIVING_PARTNER { \n I vilket land är/var din sambos förälders befattning?\n }\n }\n }\n COLLEAGUE { \n {\n relation, select,\n CO_OWNERSHIP { \n I vilket land har/hade personen som har bestämmande rätt över företaget som du har en relation till sin befattning?\n }\n CLOSE_CONNECTION { \n I vilket land har/hade personen som du har eller har haft nära förbindelse med sin befattning?\n }\n COMPANY_FOR_PEP { \n I vilket land har/hade personen i politisk utsatt ställning som du har en relation till sin befattning?\n }\n }\n }\n other {}\n }\n }\n CORPORATION {\n { \n pepType, select, \n ME { \n I vilket land är/var {possessiveName} befattning?\n \n }\n RELATIVE { \n {\n relation, select,\n MARRIED_PARTNER { \n I vilket land är/var {possessiveName} make/maka/registrerade partners befattning?\n }\n COLIVING_PARTNER { \n I vilket land är/var {possessiveName} sambos befattning?\n }\n CHILD { \n I vilket land är/var {possessiveName} förälders befattning?\n }\n PARENT { \n I vilket land är/var {possessiveName} barns befattning?\n }\n CHILD_MARRIED_PARTNER { \n I vilket land är/var {possessiveName} make/makas förälders befattning?\n }\n CHILD_COLIVING_PARTNER { \n I vilket land är/var {possessiveName} sambos förälders befattning?\n }\n }\n }\n COLLEAGUE { \n {\n relation, select,\n CO_OWNERSHIP { \n I vilket land har/hade personen som har bestämmande rätt över företaget som {name} har en relation till sin befattning?\n }\n CLOSE_CONNECTION { \n I vilket land har/hade personen som {name} har eller har haft nära förbindelse med sin befattning?\n }\n COMPANY_FOR_PEP { \n I vilket land har/hade personen i politisk utsatt ställning som {name} har en relation till sin befattning?\n }\n }\n }\n other {}\n }\n }\n other {}\n }"},{"id":"pep.status.countryselecton.required","description":"Country selection required error","defaultMessage":"Du måste välja ett land"},{"id":"pep.status.localcountryalt.required","description":"Local country name","defaultMessage":"{countryName}"},{"id":"pep.status.othercountryalt.required","description":"Other country","defaultMessage":"Other"},{"id":"pep.status.state.ONGOING","description":"Ongoing alt","defaultMessage":"Pågående"},{"id":"pep.status.state.ENDED","description":"Ended alt","defaultMessage":"Avslutad"}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"id":"pep.status.next","description":"Next button","defaultMessage":"
|
|
1
|
+
[{"id":"pep.status.next","description":"Next button","defaultMessage":"Next"}]
|
package/model/PepModel.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PepState } from "../pages/PepContext";
|
|
2
|
-
export interface PepRequest extends Omit<PepState, "
|
|
2
|
+
export interface PepRequest extends Omit<PepState, "isLocalCountry" | "isOngoing" | "ended" | "birthdayOfPEP"> {
|
|
3
3
|
ended?: string;
|
|
4
4
|
birthdayOfPEP?: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function stateToRequest(
|
|
7
|
-
export declare function requestToState({ ended, birthdayOfPEP, ...serverData }: PepRequest): PepState;
|
|
6
|
+
export declare function stateToRequest(pepState: PepState): PepRequest;
|
|
7
|
+
export declare function requestToState({ ended, birthdayOfPEP, ...serverData }: PepRequest, countryCode: string): PepState;
|
package/model/PepModel.js
CHANGED
|
@@ -11,21 +11,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { PepType, EntityType, PepStatus } from "../pages/PepContext";
|
|
13
13
|
import { DateTime } from "luxon";
|
|
14
|
-
export function stateToRequest(
|
|
15
|
-
const
|
|
16
|
-
delete
|
|
17
|
-
delete
|
|
18
|
-
delete
|
|
19
|
-
if (
|
|
20
|
-
delete
|
|
14
|
+
export function stateToRequest(pepState) {
|
|
15
|
+
const state = Object.assign({}, pepState);
|
|
16
|
+
delete state.isLocalCountry;
|
|
17
|
+
delete state.isOngoing;
|
|
18
|
+
delete state.ownerName;
|
|
19
|
+
if (state.legalEntityType === EntityType.PERSON) {
|
|
20
|
+
delete state.tin;
|
|
21
21
|
}
|
|
22
|
-
return Object.assign(Object.assign({},
|
|
23
|
-
? DateTime.fromJSDate(
|
|
24
|
-
: undefined, birthdayOfPEP:
|
|
25
|
-
? DateTime.fromJSDate(
|
|
22
|
+
return Object.assign(Object.assign({}, state), { country: state.type === PepType.NOT_PEP ? undefined : state.country, ended: state.ended
|
|
23
|
+
? DateTime.fromJSDate(state.ended).toFormat("yyyy-MM")
|
|
24
|
+
: undefined, birthdayOfPEP: state.birthdayOfPEP
|
|
25
|
+
? DateTime.fromJSDate(state.birthdayOfPEP).toFormat("yyyy-MM-dd")
|
|
26
26
|
: undefined });
|
|
27
27
|
}
|
|
28
|
-
export function requestToState(_a) {
|
|
28
|
+
export function requestToState(_a, countryCode) {
|
|
29
29
|
var { ended, birthdayOfPEP } = _a, serverData = __rest(_a, ["ended", "birthdayOfPEP"]);
|
|
30
30
|
const state = Object.assign({}, serverData);
|
|
31
31
|
if (ended) {
|
|
@@ -34,7 +34,7 @@ export function requestToState(_a) {
|
|
|
34
34
|
if (birthdayOfPEP) {
|
|
35
35
|
state.birthdayOfPEP = DateTime.fromFormat(birthdayOfPEP, "yyyy-MM-dd").toJSDate();
|
|
36
36
|
}
|
|
37
|
-
state.
|
|
37
|
+
state.isLocalCountry = state.country === countryCode ? "local" : "other";
|
|
38
38
|
state.isOngoing = state.ended ? PepStatus.ENDED : PepStatus.ONGOING;
|
|
39
39
|
return state;
|
|
40
40
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lysaab/lysa-pep",
|
|
3
3
|
"author": "Lysa AB",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.7-0",
|
|
5
5
|
"main": "./Exports.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@types/luxon": "^1.15.2",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"luxon": "^1.21.1",
|
|
23
23
|
"react": "^16.13.1",
|
|
24
24
|
"react-dom": "^16.13.0",
|
|
25
|
+
"react-router-dom": "^5.2.0",
|
|
25
26
|
"react-intl": "^4.5.12",
|
|
26
27
|
"react-intl-translations-manager": "^5.0.3",
|
|
27
28
|
"react-scripts": "^3.4.0",
|
|
@@ -30,7 +31,8 @@
|
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"@lysaab/ui-2": "^20.13.0",
|
|
32
33
|
"react": "^16.13.1",
|
|
33
|
-
"react-intl": "^4.5.12"
|
|
34
|
+
"react-intl": "^4.5.12",
|
|
35
|
+
"react-router-dom": "^5.2.0"
|
|
34
36
|
},
|
|
35
37
|
"scripts": {
|
|
36
38
|
"start": "react-scripts start",
|
package/pages/PepContext.d.ts
CHANGED
package/pages/PepContext.js
CHANGED
|
@@ -10,7 +10,7 @@ export const isOngoingMessages = defineMessages({
|
|
|
10
10
|
{
|
|
11
11
|
pepType, select,
|
|
12
12
|
ME {
|
|
13
|
-
|
|
13
|
+
Is your position ongoing or terminated?
|
|
14
14
|
}
|
|
15
15
|
RELATIVE {
|
|
16
16
|
{
|
|
@@ -122,9 +122,9 @@ export const endedMessages = defineMessages({
|
|
|
122
122
|
});
|
|
123
123
|
export const isLocalCountryMessages = defineMessages({
|
|
124
124
|
header: {
|
|
125
|
-
id: "pep.status.localcountry.
|
|
126
|
-
description: "
|
|
127
|
-
defaultMessage: "
|
|
125
|
+
id: "pep.status.localcountry.header",
|
|
126
|
+
description: "What country header",
|
|
127
|
+
defaultMessage: "What country is the position in?",
|
|
128
128
|
},
|
|
129
129
|
required: {
|
|
130
130
|
id: "pep.status.localcountry.required",
|
|
@@ -244,12 +244,12 @@ export const localCountryAltMessages = defineMessages({
|
|
|
244
244
|
localCountry: {
|
|
245
245
|
id: "pep.status.localcountryalt.required",
|
|
246
246
|
description: "Local country name",
|
|
247
|
-
defaultMessage: "
|
|
247
|
+
defaultMessage: "{countryName}",
|
|
248
248
|
},
|
|
249
249
|
otherCountry: {
|
|
250
250
|
id: "pep.status.othercountryalt.required",
|
|
251
251
|
description: "Other country",
|
|
252
|
-
defaultMessage: "
|
|
252
|
+
defaultMessage: "Other",
|
|
253
253
|
},
|
|
254
254
|
});
|
|
255
255
|
export const stateAltMessages = defineMessages({
|
|
@@ -5,24 +5,27 @@ import { CountrySelect } from "../../components/CountrySelect";
|
|
|
5
5
|
import { useIntl, FormattedMessage } from "react-intl";
|
|
6
6
|
import { isOngoingMessages, endedMessages, isLocalCountryMessages, countrySelectionMessages, localCountryAltMessages, stateAltMessages, } from "./StatusMessages";
|
|
7
7
|
import { formatPossessive } from "../../utils/Possession";
|
|
8
|
-
export const StatusPage = ({ next }) => {
|
|
8
|
+
export const StatusPage = ({ countryName, countryCode, next, }) => {
|
|
9
9
|
const pepContext = useContext(PepContext);
|
|
10
10
|
const formRef = useRef();
|
|
11
11
|
const intl = useIntl();
|
|
12
12
|
const stateAlternatives = getStateAlternatives(intl);
|
|
13
|
-
const
|
|
13
|
+
const isLocalCountryAlternatives = getIsLocalCountryAlternatives(intl, countryName);
|
|
14
14
|
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
15
15
|
const nextPage = useCallback(() => {
|
|
16
16
|
if (formRef.current && formRef.current.isValid) {
|
|
17
17
|
next();
|
|
18
18
|
}
|
|
19
19
|
}, [formRef, next]);
|
|
20
|
-
const
|
|
21
|
-
pepContext.setState({
|
|
20
|
+
const updateIsLocalCountry = useCallback((alternative) => {
|
|
21
|
+
pepContext.setState({ isLocalCountry: alternative.value });
|
|
22
22
|
if (alternative.value === "other") {
|
|
23
23
|
pepContext.setState({ country: undefined });
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
else {
|
|
26
|
+
pepContext.setState({ country: countryCode });
|
|
27
|
+
}
|
|
28
|
+
}, [pepContext, countryCode]);
|
|
26
29
|
const updateIsOngoing = useCallback((alternative) => {
|
|
27
30
|
pepContext.setState({ isOngoing: alternative.value });
|
|
28
31
|
if (alternative.value === PepStatus.ONGOING) {
|
|
@@ -50,13 +53,13 @@ export const StatusPage = ({ next }) => {
|
|
|
50
53
|
new RequiredValidator(intl.formatMessage(isOngoingMessages.required)),
|
|
51
54
|
], showMonthYearPicker: true, dateFormat: "yyyy-MM", maxDate: new Date() })) : null),
|
|
52
55
|
React.createElement(Card, null,
|
|
53
|
-
React.createElement(RadioGroup, { alternatives:
|
|
56
|
+
React.createElement(RadioGroup, { alternatives: isLocalCountryAlternatives, header: intl.formatMessage(isLocalCountryMessages.header, {
|
|
54
57
|
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
55
|
-
}), onChange:
|
|
58
|
+
}), onChange: updateIsLocalCountry, value: isLocalCountryAlternatives.find((alt) => alt.value === pepContext.state.isLocalCountry), validators: [
|
|
56
59
|
new RequiredValidator(intl.formatMessage(isLocalCountryMessages.required)),
|
|
57
60
|
] }),
|
|
58
|
-
pepContext.state.
|
|
59
|
-
pepContext.state.
|
|
61
|
+
pepContext.state.isLocalCountry &&
|
|
62
|
+
pepContext.state.isLocalCountry === "other" ? (React.createElement(CountrySelect, { label: intl.formatMessage(countrySelectionMessages.header, {
|
|
60
63
|
entityType,
|
|
61
64
|
name: pepContext.state.ownerName,
|
|
62
65
|
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
@@ -68,15 +71,17 @@ export const StatusPage = ({ next }) => {
|
|
|
68
71
|
country: event.value ? event.value.toString() : undefined,
|
|
69
72
|
}), validators: [
|
|
70
73
|
new RequiredValidator(intl.formatMessage(countrySelectionMessages.required)),
|
|
71
|
-
], value: pepContext.state.country, omitCountries: [
|
|
74
|
+
], value: pepContext.state.country, omitCountries: [countryCode] })) : null),
|
|
72
75
|
React.createElement(PrimaryButton, { block: true, type: "submit" },
|
|
73
|
-
React.createElement(FormattedMessage, { id: "pep.status.next", description: "Next button", defaultMessage: "
|
|
76
|
+
React.createElement(FormattedMessage, { id: "pep.status.next", description: "Next button", defaultMessage: "Next" })))));
|
|
74
77
|
};
|
|
75
|
-
function getIsLocalCountryAlternatives(intl) {
|
|
78
|
+
function getIsLocalCountryAlternatives(intl, countryName) {
|
|
76
79
|
return [
|
|
77
80
|
{
|
|
78
|
-
text: intl.formatMessage(localCountryAltMessages.localCountry
|
|
79
|
-
|
|
81
|
+
text: intl.formatMessage(localCountryAltMessages.localCountry, {
|
|
82
|
+
countryName,
|
|
83
|
+
}),
|
|
84
|
+
value: "local",
|
|
80
85
|
},
|
|
81
86
|
{
|
|
82
87
|
text: intl.formatMessage(localCountryAltMessages.otherCountry),
|