@lysaab/lysa-pep 5.0.0 → 5.0.1
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/PepAnswers.d.ts +8 -8
- package/components/PepAnswers.js +103 -103
- package/model/PepModel.d.ts +7 -7
- package/model/PepModel.js +40 -40
- package/package.json +1 -1
- package/pages/IsPep/IsPepMessages.d.ts +20 -20
- package/pages/IsPep/IsPepMessages.js +10 -10
- 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 +67 -67
- package/pages/RelationPage/RelationMessages.js +69 -69
- package/pages/RelationPage/RelationPage.d.ts +6 -6
- package/pages/RelationPage/RelationPage.js +158 -158
- package/pages/RolePage/RoleMessages.d.ts +119 -119
- package/pages/RolePage/RoleMessages.js +121 -121
- package/pages/RolePage/RolePage.d.ts +13 -13
- package/pages/RolePage/RolePage.js +222 -222
- package/pages/StatusPage/StatusMessages.d.ts +51 -51
- package/pages/StatusPage/StatusMessages.js +53 -53
- package/pages/StatusPage/StatusPage.d.ts +10 -10
- package/pages/StatusPage/StatusPage.js +104 -104
- package/utils/Possession.d.ts +1 -1
- package/utils/Possession.js +27 -27
package/Exports.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./pages/PepContext";
|
|
2
|
-
export * from "./model/PepModel";
|
|
3
|
-
export * from "./pages/IsPep/IsPepPage";
|
|
4
|
-
export { RelationPage } from "./pages/RelationPage/RelationPage";
|
|
5
|
-
export { RolePage as PepRolePage, getMilitaryAlts, getRoleAlts } from "./pages/RolePage/RolePage";
|
|
6
|
-
export { StatusPage as PepStatusPage } from "./pages/StatusPage/StatusPage";
|
|
7
|
-
export { PepAnswers } from "./components/PepAnswers";
|
|
1
|
+
export * from "./pages/PepContext";
|
|
2
|
+
export * from "./model/PepModel";
|
|
3
|
+
export * from "./pages/IsPep/IsPepPage";
|
|
4
|
+
export { RelationPage } from "./pages/RelationPage/RelationPage";
|
|
5
|
+
export { RolePage as PepRolePage, getMilitaryAlts, getRoleAlts } from "./pages/RolePage/RolePage";
|
|
6
|
+
export { StatusPage as PepStatusPage } from "./pages/StatusPage/StatusPage";
|
|
7
|
+
export { PepAnswers } from "./components/PepAnswers";
|
package/Exports.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./pages/PepContext";
|
|
2
|
-
export * from "./model/PepModel";
|
|
3
|
-
export * from "./pages/IsPep/IsPepPage";
|
|
4
|
-
export { RelationPage } from "./pages/RelationPage/RelationPage";
|
|
5
|
-
export { RolePage as PepRolePage, getMilitaryAlts, getRoleAlts } from "./pages/RolePage/RolePage";
|
|
6
|
-
export { StatusPage as PepStatusPage } from "./pages/StatusPage/StatusPage";
|
|
7
|
-
export { PepAnswers } from "./components/PepAnswers";
|
|
1
|
+
export * from "./pages/PepContext";
|
|
2
|
+
export * from "./model/PepModel";
|
|
3
|
+
export * from "./pages/IsPep/IsPepPage";
|
|
4
|
+
export { RelationPage } from "./pages/RelationPage/RelationPage";
|
|
5
|
+
export { RolePage as PepRolePage, getMilitaryAlts, getRoleAlts } from "./pages/RolePage/RolePage";
|
|
6
|
+
export { StatusPage as PepStatusPage } from "./pages/StatusPage/StatusPage";
|
|
7
|
+
export { PepAnswers } from "./components/PepAnswers";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FunctionComponent } from "react";
|
|
2
|
-
import "./PepAnswers.scss";
|
|
3
|
-
import { PepRequest } from "../model/PepModel";
|
|
4
|
-
interface Props {
|
|
5
|
-
answer: PepRequest;
|
|
6
|
-
}
|
|
7
|
-
export declare const PepAnswers: FunctionComponent<Props>;
|
|
8
|
-
export {};
|
|
1
|
+
import { FunctionComponent } from "react";
|
|
2
|
+
import "./PepAnswers.scss";
|
|
3
|
+
import { PepRequest } from "../model/PepModel";
|
|
4
|
+
interface Props {
|
|
5
|
+
answer: PepRequest;
|
|
6
|
+
}
|
|
7
|
+
export declare const PepAnswers: FunctionComponent<Props>;
|
|
8
|
+
export {};
|
package/components/PepAnswers.js
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import "./PepAnswers.scss";
|
|
3
|
-
import countries from "@lysaab/countries";
|
|
4
|
-
import { getRoleAlts, getMilitaryAlts } from "../pages/RolePage/RolePage";
|
|
5
|
-
import { PepType } from "../pages/PepContext";
|
|
6
|
-
import { useIntl, defineMessages, FormattedMessage } from "react-intl";
|
|
7
|
-
import { messages as isPepMessages } from "../pages/IsPep/IsPepMessages";
|
|
8
|
-
import { relationMessages, businessRelationMessages, } from "../pages/RelationPage/RelationMessages";
|
|
9
|
-
const messages = defineMessages({
|
|
10
|
-
whoIsPepLabel: {
|
|
11
|
-
id: "pep.answers.who.label",
|
|
12
|
-
},
|
|
13
|
-
relationLabel: {
|
|
14
|
-
id: "pep.answers.relationship.label",
|
|
15
|
-
},
|
|
16
|
-
businessRelationLabel: {
|
|
17
|
-
id: "pep.answers.businessRelationship.label",
|
|
18
|
-
},
|
|
19
|
-
nameOfPepLabel: {
|
|
20
|
-
id: "pep.answers.nameOfPep.label",
|
|
21
|
-
},
|
|
22
|
-
birthdayOfPEPLabel: {
|
|
23
|
-
id: "pep.answers.birthdayOfPEP.label",
|
|
24
|
-
},
|
|
25
|
-
statusLabel: {
|
|
26
|
-
id: "pep.answers.status.label",
|
|
27
|
-
},
|
|
28
|
-
statusEndedValue: {
|
|
29
|
-
id: "pep.answers.statusEnded.value",
|
|
30
|
-
},
|
|
31
|
-
statusOngoingValue: {
|
|
32
|
-
id: "pep.answers.statusOngoing.value",
|
|
33
|
-
},
|
|
34
|
-
endedLabel: {
|
|
35
|
-
id: "pep.answers.endedStatus.label",
|
|
36
|
-
},
|
|
37
|
-
roleLabel: {
|
|
38
|
-
id: "pep.answers.role.label",
|
|
39
|
-
},
|
|
40
|
-
countryLabel: {
|
|
41
|
-
id: "pep.answers.country.label",
|
|
42
|
-
},
|
|
43
|
-
ambassadorCountryLabel: {
|
|
44
|
-
id: "pep.answers.ambassadorCountry.label",
|
|
45
|
-
},
|
|
46
|
-
governmentCompanyNameLabel: {
|
|
47
|
-
id: "pep.answers.governmentCompanyName.label",
|
|
48
|
-
},
|
|
49
|
-
governmentCompanyRoleLabel: {
|
|
50
|
-
id: "pep.answers.governmentCompanyRole.label",
|
|
51
|
-
},
|
|
52
|
-
internationalOrganisationNameLabel: {
|
|
53
|
-
id: "pep.answers.companyName.label",
|
|
54
|
-
},
|
|
55
|
-
internationalOrganisationRoleLabel: {
|
|
56
|
-
id: "pep.answers.companyRole.label",
|
|
57
|
-
},
|
|
58
|
-
militaryGradeLabel: {
|
|
59
|
-
id: "pep.answers.militaryRank.label",
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
export const PepAnswers = ({ answer }) => {
|
|
63
|
-
var _a;
|
|
64
|
-
const intl = useIntl();
|
|
65
|
-
if (!answer.type || answer.type === PepType.NOT_PEP) {
|
|
66
|
-
return (React.createElement("div", null,
|
|
67
|
-
React.createElement("p", null,
|
|
68
|
-
React.createElement(FormattedMessage, { id: "pep.answers.notpep" }))));
|
|
69
|
-
}
|
|
70
|
-
const entityType = answer.legalEntityType;
|
|
71
|
-
const lang = intl.locale.slice(0, 2);
|
|
72
|
-
const country = (countries[lang] || countries["en"]).find((country) => country.value === answer.country);
|
|
73
|
-
const role = getRoleAlts(intl).find((alt) => alt.value === answer.role);
|
|
74
|
-
const militaryRank = getMilitaryAlts(intl).find((alt) => alt.value === answer.militaryRank);
|
|
75
|
-
return (React.createElement("div", null,
|
|
76
|
-
answer.type && (React.createElement(StaticInput, { label: intl.formatMessage(messages.whoIsPepLabel), value: intl.formatMessage(isPepMessages[answer.type], {
|
|
77
|
-
entityType,
|
|
78
|
-
name: answer.ownerName,
|
|
79
|
-
}) })),
|
|
80
|
-
answer.relationToPEP && (React.createElement(StaticInput, { label: intl.formatMessage(messages.relationLabel), value: intl.formatMessage(relationMessages[answer.relationToPEP], {
|
|
81
|
-
entityType,
|
|
82
|
-
name: answer.ownerName,
|
|
83
|
-
}) })),
|
|
84
|
-
answer.businessRelation && (React.createElement(StaticInput, { label: intl.formatMessage(messages.businessRelationLabel), value: intl.formatMessage(businessRelationMessages[answer.businessRelation], { entityType, name: answer.ownerName }) })),
|
|
85
|
-
answer.nameOfPEP && (React.createElement(StaticInput, { label: intl.formatMessage(messages.nameOfPepLabel), value: answer.nameOfPEP })),
|
|
86
|
-
answer.birthdayOfPEP && (React.createElement(StaticInput, { label: intl.formatMessage(messages.birthdayOfPEPLabel), value: answer.birthdayOfPEP })),
|
|
87
|
-
answer.ended ? (React.createElement(React.Fragment, null,
|
|
88
|
-
React.createElement(StaticInput, { label: intl.formatMessage(messages.statusLabel), value: intl.formatMessage(messages.statusEndedValue) }),
|
|
89
|
-
React.createElement(StaticInput, { label: intl.formatMessage(messages.endedLabel), value: answer.ended }))) : (React.createElement(StaticInput, { label: intl.formatMessage(messages.statusLabel), value: intl.formatMessage(messages.statusOngoingValue) })),
|
|
90
|
-
answer.country && (React.createElement(StaticInput, { label: intl.formatMessage(messages.countryLabel), value: country ? country.label : answer.country })),
|
|
91
|
-
role && (React.createElement(StaticInput, { label: intl.formatMessage(messages.roleLabel), value: role.text })),
|
|
92
|
-
answer.ambassadorCountry && (React.createElement(StaticInput, { label: intl.formatMessage(messages.ambassadorCountryLabel), value: ((_a = (countries[lang] || countries["en"]).find((country) => country.value === answer.ambassadorCountry)) === null || _a === void 0 ? void 0 : _a.label) || answer.ambassadorCountry })),
|
|
93
|
-
answer.governmentCompany && (React.createElement(StaticInput, { label: intl.formatMessage(messages.governmentCompanyNameLabel), value: answer.governmentCompany })),
|
|
94
|
-
answer.governmentCompanyRole && (React.createElement(StaticInput, { label: intl.formatMessage(messages.governmentCompanyRoleLabel), value: answer.governmentCompanyRole })),
|
|
95
|
-
answer.internationalOrganisation && (React.createElement(StaticInput, { label: intl.formatMessage(messages.internationalOrganisationNameLabel), value: answer.internationalOrganisation })),
|
|
96
|
-
answer.internationalOrganisationRole && (React.createElement(StaticInput, { label: intl.formatMessage(messages.internationalOrganisationRoleLabel), value: answer.internationalOrganisationRole })),
|
|
97
|
-
militaryRank && (React.createElement(StaticInput, { label: intl.formatMessage(messages.militaryGradeLabel), value: militaryRank.text }))));
|
|
98
|
-
};
|
|
99
|
-
const StaticInput = ({ label, value }) => {
|
|
100
|
-
return (React.createElement("div", { className: "static-input" },
|
|
101
|
-
React.createElement("div", { className: "label" }, label),
|
|
102
|
-
React.createElement("div", { className: "value" }, value)));
|
|
103
|
-
};
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./PepAnswers.scss";
|
|
3
|
+
import countries from "@lysaab/countries";
|
|
4
|
+
import { getRoleAlts, getMilitaryAlts } from "../pages/RolePage/RolePage";
|
|
5
|
+
import { PepType } from "../pages/PepContext";
|
|
6
|
+
import { useIntl, defineMessages, FormattedMessage } from "react-intl";
|
|
7
|
+
import { messages as isPepMessages } from "../pages/IsPep/IsPepMessages";
|
|
8
|
+
import { relationMessages, businessRelationMessages, } from "../pages/RelationPage/RelationMessages";
|
|
9
|
+
const messages = defineMessages({
|
|
10
|
+
whoIsPepLabel: {
|
|
11
|
+
id: "pep.answers.who.label",
|
|
12
|
+
},
|
|
13
|
+
relationLabel: {
|
|
14
|
+
id: "pep.answers.relationship.label",
|
|
15
|
+
},
|
|
16
|
+
businessRelationLabel: {
|
|
17
|
+
id: "pep.answers.businessRelationship.label",
|
|
18
|
+
},
|
|
19
|
+
nameOfPepLabel: {
|
|
20
|
+
id: "pep.answers.nameOfPep.label",
|
|
21
|
+
},
|
|
22
|
+
birthdayOfPEPLabel: {
|
|
23
|
+
id: "pep.answers.birthdayOfPEP.label",
|
|
24
|
+
},
|
|
25
|
+
statusLabel: {
|
|
26
|
+
id: "pep.answers.status.label",
|
|
27
|
+
},
|
|
28
|
+
statusEndedValue: {
|
|
29
|
+
id: "pep.answers.statusEnded.value",
|
|
30
|
+
},
|
|
31
|
+
statusOngoingValue: {
|
|
32
|
+
id: "pep.answers.statusOngoing.value",
|
|
33
|
+
},
|
|
34
|
+
endedLabel: {
|
|
35
|
+
id: "pep.answers.endedStatus.label",
|
|
36
|
+
},
|
|
37
|
+
roleLabel: {
|
|
38
|
+
id: "pep.answers.role.label",
|
|
39
|
+
},
|
|
40
|
+
countryLabel: {
|
|
41
|
+
id: "pep.answers.country.label",
|
|
42
|
+
},
|
|
43
|
+
ambassadorCountryLabel: {
|
|
44
|
+
id: "pep.answers.ambassadorCountry.label",
|
|
45
|
+
},
|
|
46
|
+
governmentCompanyNameLabel: {
|
|
47
|
+
id: "pep.answers.governmentCompanyName.label",
|
|
48
|
+
},
|
|
49
|
+
governmentCompanyRoleLabel: {
|
|
50
|
+
id: "pep.answers.governmentCompanyRole.label",
|
|
51
|
+
},
|
|
52
|
+
internationalOrganisationNameLabel: {
|
|
53
|
+
id: "pep.answers.companyName.label",
|
|
54
|
+
},
|
|
55
|
+
internationalOrganisationRoleLabel: {
|
|
56
|
+
id: "pep.answers.companyRole.label",
|
|
57
|
+
},
|
|
58
|
+
militaryGradeLabel: {
|
|
59
|
+
id: "pep.answers.militaryRank.label",
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
export const PepAnswers = ({ answer }) => {
|
|
63
|
+
var _a;
|
|
64
|
+
const intl = useIntl();
|
|
65
|
+
if (!answer.type || answer.type === PepType.NOT_PEP) {
|
|
66
|
+
return (React.createElement("div", null,
|
|
67
|
+
React.createElement("p", null,
|
|
68
|
+
React.createElement(FormattedMessage, { id: "pep.answers.notpep" }))));
|
|
69
|
+
}
|
|
70
|
+
const entityType = answer.legalEntityType;
|
|
71
|
+
const lang = intl.locale.slice(0, 2);
|
|
72
|
+
const country = (countries[lang] || countries["en"]).find((country) => country.value === answer.country);
|
|
73
|
+
const role = getRoleAlts(intl).find((alt) => alt.value === answer.role);
|
|
74
|
+
const militaryRank = getMilitaryAlts(intl).find((alt) => alt.value === answer.militaryRank);
|
|
75
|
+
return (React.createElement("div", null,
|
|
76
|
+
answer.type && (React.createElement(StaticInput, { label: intl.formatMessage(messages.whoIsPepLabel), value: intl.formatMessage(isPepMessages[answer.type], {
|
|
77
|
+
entityType,
|
|
78
|
+
name: answer.ownerName,
|
|
79
|
+
}) })),
|
|
80
|
+
answer.relationToPEP && (React.createElement(StaticInput, { label: intl.formatMessage(messages.relationLabel), value: intl.formatMessage(relationMessages[answer.relationToPEP], {
|
|
81
|
+
entityType,
|
|
82
|
+
name: answer.ownerName,
|
|
83
|
+
}) })),
|
|
84
|
+
answer.businessRelation && (React.createElement(StaticInput, { label: intl.formatMessage(messages.businessRelationLabel), value: intl.formatMessage(businessRelationMessages[answer.businessRelation], { entityType, name: answer.ownerName }) })),
|
|
85
|
+
answer.nameOfPEP && (React.createElement(StaticInput, { label: intl.formatMessage(messages.nameOfPepLabel), value: answer.nameOfPEP })),
|
|
86
|
+
answer.birthdayOfPEP && (React.createElement(StaticInput, { label: intl.formatMessage(messages.birthdayOfPEPLabel), value: answer.birthdayOfPEP })),
|
|
87
|
+
answer.ended ? (React.createElement(React.Fragment, null,
|
|
88
|
+
React.createElement(StaticInput, { label: intl.formatMessage(messages.statusLabel), value: intl.formatMessage(messages.statusEndedValue) }),
|
|
89
|
+
React.createElement(StaticInput, { label: intl.formatMessage(messages.endedLabel), value: answer.ended }))) : (React.createElement(StaticInput, { label: intl.formatMessage(messages.statusLabel), value: intl.formatMessage(messages.statusOngoingValue) })),
|
|
90
|
+
answer.country && (React.createElement(StaticInput, { label: intl.formatMessage(messages.countryLabel), value: country ? country.label : answer.country })),
|
|
91
|
+
role && (React.createElement(StaticInput, { label: intl.formatMessage(messages.roleLabel), value: role.text })),
|
|
92
|
+
answer.ambassadorCountry && (React.createElement(StaticInput, { label: intl.formatMessage(messages.ambassadorCountryLabel), value: ((_a = (countries[lang] || countries["en"]).find((country) => country.value === answer.ambassadorCountry)) === null || _a === void 0 ? void 0 : _a.label) || answer.ambassadorCountry })),
|
|
93
|
+
answer.governmentCompany && (React.createElement(StaticInput, { label: intl.formatMessage(messages.governmentCompanyNameLabel), value: answer.governmentCompany })),
|
|
94
|
+
answer.governmentCompanyRole && (React.createElement(StaticInput, { label: intl.formatMessage(messages.governmentCompanyRoleLabel), value: answer.governmentCompanyRole })),
|
|
95
|
+
answer.internationalOrganisation && (React.createElement(StaticInput, { label: intl.formatMessage(messages.internationalOrganisationNameLabel), value: answer.internationalOrganisation })),
|
|
96
|
+
answer.internationalOrganisationRole && (React.createElement(StaticInput, { label: intl.formatMessage(messages.internationalOrganisationRoleLabel), value: answer.internationalOrganisationRole })),
|
|
97
|
+
militaryRank && (React.createElement(StaticInput, { label: intl.formatMessage(messages.militaryGradeLabel), value: militaryRank.text }))));
|
|
98
|
+
};
|
|
99
|
+
const StaticInput = ({ label, value }) => {
|
|
100
|
+
return (React.createElement("div", { className: "static-input" },
|
|
101
|
+
React.createElement("div", { className: "label" }, label),
|
|
102
|
+
React.createElement("div", { className: "value" }, value)));
|
|
103
|
+
};
|
package/model/PepModel.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PepState } from "../pages/PepContext";
|
|
2
|
-
export interface PepRequest extends Omit<PepState, "isLocalCountry" | "isOngoing" | "ended" | "birthdayOfPEP"> {
|
|
3
|
-
ended?: string;
|
|
4
|
-
birthdayOfPEP?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function stateToRequest(pepState: PepState): PepRequest;
|
|
7
|
-
export declare function requestToState({ ended, birthdayOfPEP, ...serverData }: PepRequest, countryCode: string): PepState;
|
|
1
|
+
import { PepState } from "../pages/PepContext";
|
|
2
|
+
export interface PepRequest extends Omit<PepState, "isLocalCountry" | "isOngoing" | "ended" | "birthdayOfPEP"> {
|
|
3
|
+
ended?: string;
|
|
4
|
+
birthdayOfPEP?: string;
|
|
5
|
+
}
|
|
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
|
@@ -1,40 +1,40 @@
|
|
|
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 { PepType, EntityType, PepStatus } from "../pages/PepContext";
|
|
13
|
-
import { DateTime } from "luxon";
|
|
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
|
-
}
|
|
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
|
-
: undefined });
|
|
27
|
-
}
|
|
28
|
-
export function requestToState(_a, countryCode) {
|
|
29
|
-
var { ended, birthdayOfPEP } = _a, serverData = __rest(_a, ["ended", "birthdayOfPEP"]);
|
|
30
|
-
const state = Object.assign({}, serverData);
|
|
31
|
-
if (ended) {
|
|
32
|
-
state.ended = DateTime.fromFormat(ended, "yyyy-MM").toJSDate();
|
|
33
|
-
}
|
|
34
|
-
if (birthdayOfPEP) {
|
|
35
|
-
state.birthdayOfPEP = DateTime.fromFormat(birthdayOfPEP, "yyyy-MM-dd").toJSDate();
|
|
36
|
-
}
|
|
37
|
-
state.isLocalCountry = state.country === countryCode ? "local" : "other";
|
|
38
|
-
state.isOngoing = state.ended ? PepStatus.ENDED : PepStatus.ONGOING;
|
|
39
|
-
return state;
|
|
40
|
-
}
|
|
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 { PepType, EntityType, PepStatus } from "../pages/PepContext";
|
|
13
|
+
import { DateTime } from "luxon";
|
|
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
|
+
}
|
|
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
|
+
: undefined });
|
|
27
|
+
}
|
|
28
|
+
export function requestToState(_a, countryCode) {
|
|
29
|
+
var { ended, birthdayOfPEP } = _a, serverData = __rest(_a, ["ended", "birthdayOfPEP"]);
|
|
30
|
+
const state = Object.assign({}, serverData);
|
|
31
|
+
if (ended) {
|
|
32
|
+
state.ended = DateTime.fromFormat(ended, "yyyy-MM").toJSDate();
|
|
33
|
+
}
|
|
34
|
+
if (birthdayOfPEP) {
|
|
35
|
+
state.birthdayOfPEP = DateTime.fromFormat(birthdayOfPEP, "yyyy-MM-dd").toJSDate();
|
|
36
|
+
}
|
|
37
|
+
state.isLocalCountry = state.country === countryCode ? "local" : "other";
|
|
38
|
+
state.isOngoing = state.ended ? PepStatus.ENDED : PepStatus.ONGOING;
|
|
39
|
+
return state;
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export declare const messages: {
|
|
2
|
-
header: {
|
|
3
|
-
id: string;
|
|
4
|
-
};
|
|
5
|
-
required: {
|
|
6
|
-
id: string;
|
|
7
|
-
};
|
|
8
|
-
NOT_PEP: {
|
|
9
|
-
id: string;
|
|
10
|
-
};
|
|
11
|
-
ME: {
|
|
12
|
-
id: string;
|
|
13
|
-
};
|
|
14
|
-
RELATIVE: {
|
|
15
|
-
id: string;
|
|
16
|
-
};
|
|
17
|
-
COLLEAGUE: {
|
|
18
|
-
id: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
1
|
+
export declare const messages: {
|
|
2
|
+
header: {
|
|
3
|
+
id: string;
|
|
4
|
+
};
|
|
5
|
+
required: {
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
NOT_PEP: {
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
11
|
+
ME: {
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
|
+
RELATIVE: {
|
|
15
|
+
id: string;
|
|
16
|
+
};
|
|
17
|
+
COLLEAGUE: {
|
|
18
|
+
id: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineMessages } from "react-intl";
|
|
2
|
-
import { PepType } from "../PepContext";
|
|
3
|
-
export const messages = defineMessages({
|
|
4
|
-
header: { id: "pep.ispep.header" },
|
|
5
|
-
required: { id: "pep.ispep.required" },
|
|
6
|
-
[PepType.NOT_PEP]: { id: "pep.ispep.NOT_PEP" },
|
|
7
|
-
[PepType.ME]: { id: "pep.ispep.ME" },
|
|
8
|
-
[PepType.RELATIVE]: { id: "pep.ispep.RELATIVE" },
|
|
9
|
-
[PepType.COLLEAGUE]: { id: "pep.ispep.COLLEAGUE" },
|
|
10
|
-
});
|
|
1
|
+
import { defineMessages } from "react-intl";
|
|
2
|
+
import { PepType } from "../PepContext";
|
|
3
|
+
export const messages = defineMessages({
|
|
4
|
+
header: { id: "pep.ispep.header" },
|
|
5
|
+
required: { id: "pep.ispep.required" },
|
|
6
|
+
[PepType.NOT_PEP]: { id: "pep.ispep.NOT_PEP" },
|
|
7
|
+
[PepType.ME]: { id: "pep.ispep.ME" },
|
|
8
|
+
[PepType.RELATIVE]: { id: "pep.ispep.RELATIVE" },
|
|
9
|
+
[PepType.COLLEAGUE]: { id: "pep.ispep.COLLEAGUE" },
|
|
10
|
+
});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React, { FunctionComponent } from "react";
|
|
2
|
-
import { PepType, EntityType } from "../PepContext";
|
|
3
|
-
export interface QuestionsProps {
|
|
4
|
-
ownerName?: string;
|
|
5
|
-
entityType?: EntityType;
|
|
6
|
-
type?: PepType;
|
|
7
|
-
onChange: (type: PepType) => void;
|
|
8
|
-
resetValues?: () => void;
|
|
9
|
-
}
|
|
10
|
-
export declare const IsPepQuestion: React.FC<QuestionsProps>;
|
|
11
|
-
interface Props {
|
|
12
|
-
next: () => void;
|
|
13
|
-
}
|
|
14
|
-
export declare const IsPepPage: FunctionComponent<Props>;
|
|
15
|
-
export {};
|
|
1
|
+
import React, { FunctionComponent } from "react";
|
|
2
|
+
import { PepType, EntityType } from "../PepContext";
|
|
3
|
+
export interface QuestionsProps {
|
|
4
|
+
ownerName?: string;
|
|
5
|
+
entityType?: EntityType;
|
|
6
|
+
type?: PepType;
|
|
7
|
+
onChange: (type: PepType) => void;
|
|
8
|
+
resetValues?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const IsPepQuestion: React.FC<QuestionsProps>;
|
|
11
|
+
interface Props {
|
|
12
|
+
next: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const IsPepPage: FunctionComponent<Props>;
|
|
15
|
+
export {};
|
package/pages/IsPep/IsPepPage.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import React, { useRef, useCallback, useContext, } from "react";
|
|
2
|
-
import { Form, RadioGroup, RequiredValidator, PrimaryButton, Card, } from "@lysaab/ui-2";
|
|
3
|
-
import { PepType, PepContext, EntityType } from "../PepContext";
|
|
4
|
-
import { useIntl, FormattedMessage } from "react-intl";
|
|
5
|
-
import { messages } from "./IsPepMessages";
|
|
6
|
-
export const IsPepQuestion = ({ ownerName, entityType, type, onChange, resetValues, }) => {
|
|
7
|
-
const intl = useIntl();
|
|
8
|
-
const IsPepAlternatives = [
|
|
9
|
-
{
|
|
10
|
-
text: intl.formatMessage(messages[PepType.NOT_PEP], {
|
|
11
|
-
entityType,
|
|
12
|
-
name: ownerName,
|
|
13
|
-
}),
|
|
14
|
-
value: PepType.NOT_PEP,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
text: intl.formatMessage(messages[PepType.ME], {
|
|
18
|
-
entityType,
|
|
19
|
-
name: ownerName,
|
|
20
|
-
}),
|
|
21
|
-
value: PepType.ME,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
text: intl.formatMessage(messages[PepType.RELATIVE], {
|
|
25
|
-
entityType,
|
|
26
|
-
name: ownerName,
|
|
27
|
-
}),
|
|
28
|
-
value: PepType.RELATIVE,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
text: intl.formatMessage(messages[PepType.COLLEAGUE], {
|
|
32
|
-
entityType,
|
|
33
|
-
name: ownerName,
|
|
34
|
-
}),
|
|
35
|
-
value: PepType.COLLEAGUE,
|
|
36
|
-
},
|
|
37
|
-
];
|
|
38
|
-
return (React.createElement(RadioGroup, { alternatives: IsPepAlternatives, onChange: (alternative) => {
|
|
39
|
-
onChange(alternative.value);
|
|
40
|
-
resetValues === null || resetValues === void 0 ? void 0 : resetValues();
|
|
41
|
-
}, value: IsPepAlternatives.find((alt) => alt.value === type), header: intl.formatMessage(messages.header, {
|
|
42
|
-
entityType,
|
|
43
|
-
name: ownerName,
|
|
44
|
-
}), validators: [
|
|
45
|
-
new RequiredValidator(intl.formatMessage(messages.required)),
|
|
46
|
-
], "data-test-id": "pep-ispep" }));
|
|
47
|
-
};
|
|
48
|
-
export const IsPepPage = ({ next }) => {
|
|
49
|
-
const pepContext = useContext(PepContext);
|
|
50
|
-
const formRef = useRef();
|
|
51
|
-
const nextPage = useCallback(() => {
|
|
52
|
-
if (formRef.current && formRef.current.isValid) {
|
|
53
|
-
next();
|
|
54
|
-
}
|
|
55
|
-
}, [formRef, next]);
|
|
56
|
-
return (React.createElement(Form, { onSubmit: nextPage, lysaFormRef: formRef },
|
|
57
|
-
React.createElement(Card, null,
|
|
58
|
-
React.createElement(IsPepQuestion, { ownerName: pepContext.state.ownerName, entityType: pepContext.state.legalEntityType || EntityType.PERSON, type: pepContext.state.type, onChange: (type) => pepContext.setState({ type }) })),
|
|
59
|
-
React.createElement(PrimaryButton, { block: true, type: "submit" },
|
|
60
|
-
React.createElement(FormattedMessage, { id: "pep.ispep.next" }))));
|
|
61
|
-
};
|
|
1
|
+
import React, { useRef, useCallback, useContext, } from "react";
|
|
2
|
+
import { Form, RadioGroup, RequiredValidator, PrimaryButton, Card, } from "@lysaab/ui-2";
|
|
3
|
+
import { PepType, PepContext, EntityType } from "../PepContext";
|
|
4
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
5
|
+
import { messages } from "./IsPepMessages";
|
|
6
|
+
export const IsPepQuestion = ({ ownerName, entityType, type, onChange, resetValues, }) => {
|
|
7
|
+
const intl = useIntl();
|
|
8
|
+
const IsPepAlternatives = [
|
|
9
|
+
{
|
|
10
|
+
text: intl.formatMessage(messages[PepType.NOT_PEP], {
|
|
11
|
+
entityType,
|
|
12
|
+
name: ownerName,
|
|
13
|
+
}),
|
|
14
|
+
value: PepType.NOT_PEP,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
text: intl.formatMessage(messages[PepType.ME], {
|
|
18
|
+
entityType,
|
|
19
|
+
name: ownerName,
|
|
20
|
+
}),
|
|
21
|
+
value: PepType.ME,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
text: intl.formatMessage(messages[PepType.RELATIVE], {
|
|
25
|
+
entityType,
|
|
26
|
+
name: ownerName,
|
|
27
|
+
}),
|
|
28
|
+
value: PepType.RELATIVE,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
text: intl.formatMessage(messages[PepType.COLLEAGUE], {
|
|
32
|
+
entityType,
|
|
33
|
+
name: ownerName,
|
|
34
|
+
}),
|
|
35
|
+
value: PepType.COLLEAGUE,
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
return (React.createElement(RadioGroup, { alternatives: IsPepAlternatives, onChange: (alternative) => {
|
|
39
|
+
onChange(alternative.value);
|
|
40
|
+
resetValues === null || resetValues === void 0 ? void 0 : resetValues();
|
|
41
|
+
}, value: IsPepAlternatives.find((alt) => alt.value === type), header: intl.formatMessage(messages.header, {
|
|
42
|
+
entityType,
|
|
43
|
+
name: ownerName,
|
|
44
|
+
}), validators: [
|
|
45
|
+
new RequiredValidator(intl.formatMessage(messages.required)),
|
|
46
|
+
], "data-test-id": "pep-ispep" }));
|
|
47
|
+
};
|
|
48
|
+
export const IsPepPage = ({ next }) => {
|
|
49
|
+
const pepContext = useContext(PepContext);
|
|
50
|
+
const formRef = useRef();
|
|
51
|
+
const nextPage = useCallback(() => {
|
|
52
|
+
if (formRef.current && formRef.current.isValid) {
|
|
53
|
+
next();
|
|
54
|
+
}
|
|
55
|
+
}, [formRef, next]);
|
|
56
|
+
return (React.createElement(Form, { onSubmit: nextPage, lysaFormRef: formRef },
|
|
57
|
+
React.createElement(Card, null,
|
|
58
|
+
React.createElement(IsPepQuestion, { ownerName: pepContext.state.ownerName, entityType: pepContext.state.legalEntityType || EntityType.PERSON, type: pepContext.state.type, onChange: (type) => pepContext.setState({ type }) })),
|
|
59
|
+
React.createElement(PrimaryButton, { block: true, type: "submit" },
|
|
60
|
+
React.createElement(FormattedMessage, { id: "pep.ispep.next" }))));
|
|
61
|
+
};
|