@lysaab/lysa-pep 1.0.3-0 → 1.0.5-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/components/CountrySelect.json +1 -0
- package/messages/src/components/PepAnswers.json +1 -0
- package/messages/src/pages/IsPep/IsPepMessages.json +1 -0
- package/messages/src/pages/IsPep/IsPepPage.json +1 -0
- package/messages/src/pages/RelationPage/RelationMessages.json +1 -0
- package/messages/src/pages/RelationPage/RelationPage.json +1 -0
- package/messages/src/pages/RolePage/RoleMessages.json +1 -0
- package/messages/src/pages/RolePage/RolePage.json +1 -0
- package/messages/src/pages/StatusPage/StatusMessages.json +1 -0
- package/messages/src/pages/StatusPage/StatusPage.json +1 -0
- package/package.json +25 -13
- package/{lib/pages → pages}/IsPep/IsPepMessages.js +13 -13
- package/{lib/pages → pages}/IsPep/IsPepPage.js +7 -6
- package/pages/RelationPage/RelationPage.js +154 -0
- package/pages/RolePage/RolePage.js +223 -0
- package/pages/StatusPage/StatusPage.js +98 -0
- package/lib/pages/RelationPage/RelationPage.js +0 -153
- package/lib/pages/RolePage/RolePage.js +0 -220
- package/lib/pages/StatusPage/StatusPage.js +0 -95
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -2
- package/src/App.css +0 -3
- package/src/App.test.tsx +0 -9
- package/src/App.tsx +0 -25
- package/src/Exports.ts +0 -12
- package/src/components/CountrySelect.tsx +0 -47
- package/src/components/PepAnswers.scss +0 -7
- package/src/components/PepAnswers.tsx +0 -252
- package/src/demo/Done.tsx +0 -16
- package/src/demo/Pep.tsx +0 -112
- package/src/index.css +0 -13
- package/src/index.tsx +0 -12
- package/src/logo.svg +0 -1
- package/src/model/Countries.ts +0 -1002
- package/src/model/PepModel.ts +0 -52
- package/src/pages/IsPep/IsPepMessages.ts +0 -67
- package/src/pages/IsPep/IsPepPage.tsx +0 -115
- package/src/pages/PepContext.tsx +0 -144
- package/src/pages/RelationPage/RelationMessages.ts +0 -288
- package/src/pages/RelationPage/RelationPage.tsx +0 -299
- package/src/pages/RolePage/RoleMessages.ts +0 -393
- package/src/pages/RolePage/RolePage.tsx +0 -356
- package/src/pages/StatusPage/StatusMessages.ts +0 -272
- package/src/pages/StatusPage/StatusPage.tsx +0 -207
- package/src/react-app-env.d.ts +0 -1
- package/src/serviceWorker.ts +0 -143
- package/src/utils/Possession.ts +0 -21
- package/tsconfig.json +0 -25
- package/tsconfig_build.json +0 -19
- /package/{lib/Exports.d.ts → Exports.d.ts} +0 -0
- /package/{lib/Exports.js → Exports.js} +0 -0
- /package/{lib/components → components}/CountrySelect.d.ts +0 -0
- /package/{lib/components → components}/CountrySelect.js +0 -0
- /package/{lib/components → components}/PepAnswers.d.ts +0 -0
- /package/{lib/components → components}/PepAnswers.js +0 -0
- /package/{lib/components → components}/PepAnswers.scss +0 -0
- /package/{lib/model → model}/Countries.d.ts +0 -0
- /package/{lib/model → model}/Countries.js +0 -0
- /package/{lib/model → model}/PepModel.d.ts +0 -0
- /package/{lib/model → model}/PepModel.js +0 -0
- /package/{lib/model → model}/PepTexts.d.ts +0 -0
- /package/{lib/model → model}/PepTexts.js +0 -0
- /package/{lib/pages → pages}/IsPep/IsPepMessages.d.ts +0 -0
- /package/{lib/pages → pages}/IsPep/IsPepPage.d.ts +0 -0
- /package/{lib/pages → pages}/PepContext.d.ts +0 -0
- /package/{lib/pages → pages}/PepContext.js +0 -0
- /package/{lib/pages → pages}/PepIsPepPage.d.ts +0 -0
- /package/{lib/pages → pages}/PepIsPepPage.js +0 -0
- /package/{lib/pages → pages}/PepRelationPage.d.ts +0 -0
- /package/{lib/pages → pages}/PepRelationPage.js +0 -0
- /package/{lib/pages → pages}/PepRolePage.d.ts +0 -0
- /package/{lib/pages → pages}/PepRolePage.js +0 -0
- /package/{lib/pages → pages}/PepStatusPage.d.ts +0 -0
- /package/{lib/pages → pages}/PepStatusPage.js +0 -0
- /package/{lib/pages → pages}/RelationPage/RelationMessages.d.ts +0 -0
- /package/{lib/pages → pages}/RelationPage/RelationMessages.js +0 -0
- /package/{lib/pages → pages}/RelationPage/RelationPage.d.ts +0 -0
- /package/{lib/pages → pages}/RolePage/RoleMessages.d.ts +0 -0
- /package/{lib/pages → pages}/RolePage/RoleMessages.js +0 -0
- /package/{lib/pages → pages}/RolePage/RolePage.d.ts +0 -0
- /package/{lib/pages → pages}/StatusPage/StatusMessages.d.ts +0 -0
- /package/{lib/pages → pages}/StatusPage/StatusMessages.js +0 -0
- /package/{lib/pages → pages}/StatusPage/StatusPage.d.ts +0 -0
- /package/{lib/utils → utils}/Possession.d.ts +0 -0
- /package/{lib/utils → utils}/Possession.js +0 -0
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useCallback, useContext, } from "react";
|
|
2
|
-
import { Form, PrimaryButton, RequiredValidator, TextInput, Select, } from "@lysaab/ui-2";
|
|
3
|
-
import { PepContext, Role, MilitaryRank, PepType, EntityType, } from "../PepContext";
|
|
4
|
-
import { CountrySelect } from "../../components/CountrySelect";
|
|
5
|
-
import { useIntl, FormattedMessage } from "react-intl";
|
|
6
|
-
import { roleMessages, ambassadorMessages, governmentCompanyMessages, intCompanyMessages, militaryMessages, } from "./RoleMessages";
|
|
7
|
-
import { formatPossessive } from "../../utils/Possession";
|
|
8
|
-
export const RolePage = ({ next }) => {
|
|
9
|
-
const pepContext = useContext(PepContext);
|
|
10
|
-
const formRef = useRef();
|
|
11
|
-
const intl = useIntl();
|
|
12
|
-
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
13
|
-
const type = pepContext.state.type;
|
|
14
|
-
const roleAlternatives = getRoleAlts(intl);
|
|
15
|
-
const militaryAlternatives = getMilitaryAlts(intl);
|
|
16
|
-
const nextPage = useCallback(() => {
|
|
17
|
-
if (formRef.current && formRef.current.isValid) {
|
|
18
|
-
next();
|
|
19
|
-
}
|
|
20
|
-
}, [formRef, next]);
|
|
21
|
-
const resetRoleFields = useCallback(() => {
|
|
22
|
-
pepContext.setState({
|
|
23
|
-
ambassadorCountry: undefined,
|
|
24
|
-
governmentCompany: undefined,
|
|
25
|
-
governmentCompanyRole: undefined,
|
|
26
|
-
internationalOrganisation: undefined,
|
|
27
|
-
internationalOrganisationRole: undefined,
|
|
28
|
-
militaryRank: undefined,
|
|
29
|
-
});
|
|
30
|
-
}, [pepContext]);
|
|
31
|
-
if (!type || type === PepType.NOT_PEP) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
return (React.createElement(Form, { onSubmit: () => nextPage(), lysaFormRef: formRef },
|
|
35
|
-
React.createElement(Select, { label: intl.formatMessage(roleMessages.header, {
|
|
36
|
-
entityType,
|
|
37
|
-
pepType: type,
|
|
38
|
-
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
39
|
-
? pepContext.state.businessRelation
|
|
40
|
-
: pepContext.state.relationToPEP,
|
|
41
|
-
name: pepContext.state.ownerName,
|
|
42
|
-
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
43
|
-
}), placeholder: intl.formatMessage(roleMessages.placeholder), alternatives: roleAlternatives, value: roleAlternatives.find((alt) => alt.value === pepContext.state.role), onChange: (event) => {
|
|
44
|
-
pepContext.setState({ role: event.value });
|
|
45
|
-
resetRoleFields();
|
|
46
|
-
}, validators: [
|
|
47
|
-
new RequiredValidator(intl.formatMessage(roleMessages.required)),
|
|
48
|
-
] }),
|
|
49
|
-
pepContext.state.role && pepContext.state.role === Role.AMBASSADOR ? (React.createElement(CountrySelect, { label: intl.formatMessage(ambassadorMessages.header, {
|
|
50
|
-
entityType,
|
|
51
|
-
pepType: type,
|
|
52
|
-
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
53
|
-
? pepContext.state.businessRelation
|
|
54
|
-
: pepContext.state.relationToPEP,
|
|
55
|
-
name: pepContext.state.ownerName,
|
|
56
|
-
}), onChange: (event) => pepContext.setState({
|
|
57
|
-
ambassadorCountry: event.value
|
|
58
|
-
? event.value.toString()
|
|
59
|
-
: undefined,
|
|
60
|
-
}), value: pepContext.state.ambassadorCountry, validators: [
|
|
61
|
-
new RequiredValidator(intl.formatMessage(ambassadorMessages.required)),
|
|
62
|
-
] })) : null,
|
|
63
|
-
pepContext.state.role &&
|
|
64
|
-
pepContext.state.role === Role.GOVERNMENT_COMPANY ? (React.createElement(React.Fragment, null,
|
|
65
|
-
React.createElement(TextInput, { label: intl.formatMessage(governmentCompanyMessages.nameHeader, {
|
|
66
|
-
entityType,
|
|
67
|
-
pepType: type,
|
|
68
|
-
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
69
|
-
? pepContext.state.businessRelation
|
|
70
|
-
: pepContext.state.relationToPEP,
|
|
71
|
-
name: pepContext.state.ownerName,
|
|
72
|
-
}), value: pepContext.state.governmentCompany || "", onChange: (value) => {
|
|
73
|
-
pepContext.setState({ governmentCompany: value });
|
|
74
|
-
}, validators: [
|
|
75
|
-
new RequiredValidator(intl.formatMessage(governmentCompanyMessages.nameRequired)),
|
|
76
|
-
] }),
|
|
77
|
-
React.createElement(TextInput, { label: intl.formatMessage(governmentCompanyMessages.roleHeader, {
|
|
78
|
-
entityType,
|
|
79
|
-
pepType: type,
|
|
80
|
-
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
81
|
-
? pepContext.state.businessRelation
|
|
82
|
-
: pepContext.state.relationToPEP,
|
|
83
|
-
name: pepContext.state.ownerName,
|
|
84
|
-
}), value: pepContext.state.governmentCompanyRole || "", onChange: (value) => {
|
|
85
|
-
pepContext.setState({
|
|
86
|
-
governmentCompanyRole: value,
|
|
87
|
-
});
|
|
88
|
-
}, validators: [
|
|
89
|
-
new RequiredValidator(intl.formatMessage(governmentCompanyMessages.roleRequired)),
|
|
90
|
-
] }))) : null,
|
|
91
|
-
pepContext.state.role &&
|
|
92
|
-
pepContext.state.role ===
|
|
93
|
-
Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP ? (React.createElement(React.Fragment, null,
|
|
94
|
-
React.createElement(TextInput, { label: intl.formatMessage(intCompanyMessages.nameHeader, {
|
|
95
|
-
entityType,
|
|
96
|
-
pepType: type,
|
|
97
|
-
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
98
|
-
? pepContext.state.businessRelation
|
|
99
|
-
: pepContext.state.relationToPEP,
|
|
100
|
-
name: pepContext.state.ownerName,
|
|
101
|
-
}), value: pepContext.state.internationalOrganisation || "", onChange: (value) => {
|
|
102
|
-
pepContext.setState({ internationalOrganisation: value });
|
|
103
|
-
}, validators: [
|
|
104
|
-
new RequiredValidator(intl.formatMessage(intCompanyMessages.nameRequired)),
|
|
105
|
-
] }),
|
|
106
|
-
React.createElement(TextInput, { label: intl.formatMessage(intCompanyMessages.roleHeader, {
|
|
107
|
-
entityType,
|
|
108
|
-
pepType: type,
|
|
109
|
-
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
110
|
-
? pepContext.state.businessRelation
|
|
111
|
-
: pepContext.state.relationToPEP,
|
|
112
|
-
name: pepContext.state.ownerName,
|
|
113
|
-
}), value: pepContext.state.internationalOrganisationRole || "", onChange: (value) => {
|
|
114
|
-
pepContext.setState({
|
|
115
|
-
internationalOrganisationRole: value,
|
|
116
|
-
});
|
|
117
|
-
}, validators: [
|
|
118
|
-
new RequiredValidator(intl.formatMessage(intCompanyMessages.roleRequired)),
|
|
119
|
-
] }))) : null,
|
|
120
|
-
pepContext.state.role &&
|
|
121
|
-
pepContext.state.role === Role.MILITARY_OFFICER ? (React.createElement(Select, { label: intl.formatMessage(militaryMessages.header, {
|
|
122
|
-
entityType,
|
|
123
|
-
pepType: type,
|
|
124
|
-
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
125
|
-
? pepContext.state.businessRelation
|
|
126
|
-
: pepContext.state.relationToPEP,
|
|
127
|
-
name: pepContext.state.ownerName,
|
|
128
|
-
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
129
|
-
}), placeholder: intl.formatMessage(militaryMessages.placeholder), alternatives: militaryAlternatives, value: militaryAlternatives.find((alt) => alt.value === pepContext.state.militaryRank), onChange: (event) => {
|
|
130
|
-
pepContext.setState({ militaryRank: event.value });
|
|
131
|
-
}, validators: [
|
|
132
|
-
new RequiredValidator(intl.formatMessage(militaryMessages.required)),
|
|
133
|
-
] })) : null,
|
|
134
|
-
React.createElement(PrimaryButton, { type: "submit" },
|
|
135
|
-
React.createElement(FormattedMessage, { id: "pep.role.next", description: "Next button", defaultMessage: "G\u00E5 vidare" }))));
|
|
136
|
-
};
|
|
137
|
-
export function getRoleAlts(intl) {
|
|
138
|
-
return [
|
|
139
|
-
{
|
|
140
|
-
text: intl.formatMessage(roleMessages[Role.HEAD_OF_GOVERNMENT]),
|
|
141
|
-
value: Role.HEAD_OF_GOVERNMENT,
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
text: intl.formatMessage(roleMessages[Role.MINISTER]),
|
|
145
|
-
value: Role.MINISTER,
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
text: intl.formatMessage(roleMessages[Role.PARLIMENT_MEMBER]),
|
|
149
|
-
value: Role.PARLIMENT_MEMBER,
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
text: intl.formatMessage(roleMessages[Role.CENTRAL_BANK_MEMBER]),
|
|
153
|
-
value: Role.CENTRAL_BANK_MEMBER,
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
text: intl.formatMessage(roleMessages[Role.BOARD_MEMBER_POLITICAL_PARTY]),
|
|
157
|
-
value: Role.BOARD_MEMBER_POLITICAL_PARTY,
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
text: intl.formatMessage(roleMessages[Role.JUDGE_SUPREME_COURT]),
|
|
161
|
-
value: Role.JUDGE_SUPREME_COURT,
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
text: intl.formatMessage(roleMessages[Role.JUDGE_OTHER_HIGH_COURT]),
|
|
165
|
-
value: Role.JUDGE_OTHER_HIGH_COURT,
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
text: intl.formatMessage(roleMessages[Role.REVISION_INSTITUTE]),
|
|
169
|
-
value: Role.REVISION_INSTITUTE,
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
text: intl.formatMessage(roleMessages[Role.AMBASSADOR]),
|
|
173
|
-
value: Role.AMBASSADOR,
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
text: intl.formatMessage(roleMessages[Role.MILITARY_OFFICER]),
|
|
177
|
-
value: Role.MILITARY_OFFICER,
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
text: intl.formatMessage(roleMessages[Role.GOVERNMENT_COMPANY]),
|
|
181
|
-
value: Role.GOVERNMENT_COMPANY,
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
text: intl.formatMessage(roleMessages[Role.EU_HIGH_RANKING_POSITION]),
|
|
185
|
-
value: Role.EU_HIGH_RANKING_POSITION,
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
text: intl.formatMessage(roleMessages[Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP]),
|
|
189
|
-
value: Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP,
|
|
190
|
-
},
|
|
191
|
-
];
|
|
192
|
-
}
|
|
193
|
-
export function getMilitaryAlts(intl) {
|
|
194
|
-
return [
|
|
195
|
-
{
|
|
196
|
-
text: intl.formatMessage(militaryMessages[MilitaryRank.GENERAL]),
|
|
197
|
-
value: MilitaryRank.GENERAL,
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
text: intl.formatMessage(militaryMessages[MilitaryRank.LIEUTENANT_GENERAL]),
|
|
201
|
-
value: MilitaryRank.LIEUTENANT_GENERAL,
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
text: intl.formatMessage(militaryMessages[MilitaryRank.MAJOR_GENERAL]),
|
|
205
|
-
value: MilitaryRank.MAJOR_GENERAL,
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
text: intl.formatMessage(militaryMessages[MilitaryRank.ADMIRAL]),
|
|
209
|
-
value: MilitaryRank.ADMIRAL,
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
text: intl.formatMessage(militaryMessages[MilitaryRank.VICE_ADMIRAL]),
|
|
213
|
-
value: MilitaryRank.VICE_ADMIRAL,
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
text: intl.formatMessage(militaryMessages[MilitaryRank.REAR_ADMIRAL]),
|
|
217
|
-
value: MilitaryRank.REAR_ADMIRAL,
|
|
218
|
-
},
|
|
219
|
-
];
|
|
220
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useCallback, useContext, } from "react";
|
|
2
|
-
import { Form, RadioGroup, RequiredValidator, PrimaryButton, Datepicker, } 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 = ({ next }) => {
|
|
9
|
-
const pepContext = useContext(PepContext);
|
|
10
|
-
const formRef = useRef();
|
|
11
|
-
const intl = useIntl();
|
|
12
|
-
const stateAlternatives = getStateAlternatives(intl);
|
|
13
|
-
const isSwedenAlternatives = getIsLocalCountryAlternatives(intl);
|
|
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 updateIsSweden = useCallback((alternative) => {
|
|
21
|
-
pepContext.setState({ isSweden: alternative.value });
|
|
22
|
-
if (alternative.value === "other") {
|
|
23
|
-
pepContext.setState({ country: undefined });
|
|
24
|
-
}
|
|
25
|
-
}, [pepContext]);
|
|
26
|
-
const updateIsOngoing = useCallback((alternative) => {
|
|
27
|
-
pepContext.setState({ isOngoing: alternative.value });
|
|
28
|
-
if (alternative.value === PepStatus.ONGOING) {
|
|
29
|
-
pepContext.setState({ ended: undefined });
|
|
30
|
-
}
|
|
31
|
-
}, [pepContext]);
|
|
32
|
-
return (React.createElement("div", null,
|
|
33
|
-
React.createElement(Form, { lysaFormRef: formRef, onSubmit: () => {
|
|
34
|
-
nextPage();
|
|
35
|
-
} },
|
|
36
|
-
React.createElement(RadioGroup, { alternatives: stateAlternatives, header: intl.formatMessage(isOngoingMessages.header, {
|
|
37
|
-
entityType,
|
|
38
|
-
name: pepContext.state.ownerName,
|
|
39
|
-
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
40
|
-
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
41
|
-
? pepContext.state.businessRelation
|
|
42
|
-
: pepContext.state.relationToPEP,
|
|
43
|
-
pepType: pepContext.state.type,
|
|
44
|
-
}), onChange: updateIsOngoing, value: stateAlternatives.find((alt) => alt.value === pepContext.state.isOngoing), validators: [
|
|
45
|
-
new RequiredValidator(intl.formatMessage(isOngoingMessages.required)),
|
|
46
|
-
] }),
|
|
47
|
-
pepContext.state.isOngoing &&
|
|
48
|
-
pepContext.state.isOngoing === PepStatus.ENDED ? (React.createElement(Datepicker, { label: intl.formatMessage(endedMessages.header), selected: pepContext.state.ended, onChange: (event) => pepContext.setState({ ended: event || undefined }), validators: [
|
|
49
|
-
new RequiredValidator(intl.formatMessage(isOngoingMessages.required)),
|
|
50
|
-
], showMonthYearPicker: true, dateFormat: "yyyy-MM", maxDate: new Date() })) : null,
|
|
51
|
-
React.createElement(RadioGroup, { alternatives: isSwedenAlternatives, header: intl.formatMessage(isLocalCountryMessages.header, {
|
|
52
|
-
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
53
|
-
}), onChange: updateIsSweden, value: isSwedenAlternatives.find((alt) => alt.value === pepContext.state.isSweden), validators: [
|
|
54
|
-
new RequiredValidator(intl.formatMessage(isLocalCountryMessages.required)),
|
|
55
|
-
] }),
|
|
56
|
-
pepContext.state.isSweden && pepContext.state.isSweden === "other" ? (React.createElement(CountrySelect, { label: intl.formatMessage(countrySelectionMessages.header, {
|
|
57
|
-
entityType,
|
|
58
|
-
name: pepContext.state.ownerName,
|
|
59
|
-
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
60
|
-
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
61
|
-
? pepContext.state.businessRelation
|
|
62
|
-
: pepContext.state.relationToPEP,
|
|
63
|
-
pepType: pepContext.state.type,
|
|
64
|
-
}), onChange: (event) => pepContext.setState({
|
|
65
|
-
country: event.value ? event.value.toString() : undefined,
|
|
66
|
-
}), validators: [
|
|
67
|
-
new RequiredValidator(intl.formatMessage(countrySelectionMessages.required)),
|
|
68
|
-
], value: pepContext.state.country, omitCountries: ["SE"] })) : null,
|
|
69
|
-
React.createElement(PrimaryButton, { type: "submit" },
|
|
70
|
-
React.createElement(FormattedMessage, { id: "pep.status.next", description: "Next button", defaultMessage: "G\u00E5 vidare" })))));
|
|
71
|
-
};
|
|
72
|
-
function getIsLocalCountryAlternatives(intl) {
|
|
73
|
-
return [
|
|
74
|
-
{
|
|
75
|
-
text: intl.formatMessage(localCountryAltMessages.localCountry),
|
|
76
|
-
value: "sweden",
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
text: intl.formatMessage(localCountryAltMessages.otherCountry),
|
|
80
|
-
value: "other",
|
|
81
|
-
},
|
|
82
|
-
];
|
|
83
|
-
}
|
|
84
|
-
function getStateAlternatives(intl) {
|
|
85
|
-
return [
|
|
86
|
-
{
|
|
87
|
-
text: intl.formatMessage(stateAltMessages[PepStatus.ONGOING]),
|
|
88
|
-
value: PepStatus.ONGOING,
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
text: intl.formatMessage(stateAltMessages[PepStatus.ENDED]),
|
|
92
|
-
value: PepStatus.ENDED,
|
|
93
|
-
},
|
|
94
|
-
];
|
|
95
|
-
}
|
package/public/favicon.ico
DELETED
|
Binary file
|
package/public/index.html
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
-
<meta name="theme-color" content="#000000" />
|
|
8
|
-
<meta
|
|
9
|
-
name="description"
|
|
10
|
-
content="Web site created using create-react-app"
|
|
11
|
-
/>
|
|
12
|
-
<link rel="apple-touch-icon" href="logo192.png" />
|
|
13
|
-
<!--
|
|
14
|
-
manifest.json provides metadata used when your web app is installed on a
|
|
15
|
-
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
16
|
-
-->
|
|
17
|
-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
18
|
-
<!--
|
|
19
|
-
Notice the use of %PUBLIC_URL% in the tags above.
|
|
20
|
-
It will be replaced with the URL of the `public` folder during the build.
|
|
21
|
-
Only files inside the `public` folder can be referenced from the HTML.
|
|
22
|
-
|
|
23
|
-
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
24
|
-
work correctly both with client-side routing and a non-root public URL.
|
|
25
|
-
Learn how to configure a non-root public URL by running `npm run build`.
|
|
26
|
-
-->
|
|
27
|
-
<title>React App</title>
|
|
28
|
-
</head>
|
|
29
|
-
<body>
|
|
30
|
-
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
31
|
-
<div id="root"></div>
|
|
32
|
-
<!--
|
|
33
|
-
This HTML file is a template.
|
|
34
|
-
If you open it directly in the browser, you will see an empty page.
|
|
35
|
-
|
|
36
|
-
You can add webfonts, meta tags, or analytics to this file.
|
|
37
|
-
The build step will place the bundled scripts into the <body> tag.
|
|
38
|
-
|
|
39
|
-
To begin the development, run `npm start` or `yarn start`.
|
|
40
|
-
To create a production bundle, use `npm run build` or `yarn build`.
|
|
41
|
-
-->
|
|
42
|
-
</body>
|
|
43
|
-
</html>
|
package/public/logo192.png
DELETED
|
Binary file
|
package/public/logo512.png
DELETED
|
Binary file
|
package/public/manifest.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"short_name": "React App",
|
|
3
|
-
"name": "Create React App Sample",
|
|
4
|
-
"icons": [
|
|
5
|
-
{
|
|
6
|
-
"src": "favicon.ico",
|
|
7
|
-
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
-
"type": "image/x-icon"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"src": "logo192.png",
|
|
12
|
-
"type": "image/png",
|
|
13
|
-
"sizes": "192x192"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"src": "logo512.png",
|
|
17
|
-
"type": "image/png",
|
|
18
|
-
"sizes": "512x512"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"start_url": ".",
|
|
22
|
-
"display": "standalone",
|
|
23
|
-
"theme_color": "#000000",
|
|
24
|
-
"background_color": "#ffffff"
|
|
25
|
-
}
|
package/public/robots.txt
DELETED
package/src/App.css
DELETED
package/src/App.test.tsx
DELETED
package/src/App.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import "./App.css";
|
|
3
|
-
import { Pep } from "./demo/Pep";
|
|
4
|
-
import { PepContextProvider } from "./pages/PepContext";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare global {
|
|
8
|
-
interface Window {
|
|
9
|
-
lysa: { contentPath: string };
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
window.lysa = {
|
|
14
|
-
contentPath: 'https://kund.lysa-test.se'
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const App: React.FC = () => {
|
|
18
|
-
return (
|
|
19
|
-
<PepContextProvider>
|
|
20
|
-
<Pep />
|
|
21
|
-
</PepContextProvider>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default App;
|
package/src/Exports.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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 {
|
|
6
|
-
RolePage as PepRolePage,
|
|
7
|
-
getMilitaryAlts,
|
|
8
|
-
getRoleAlts
|
|
9
|
-
} from "./pages/RolePage/RolePage";
|
|
10
|
-
export { StatusPage as PepStatusPage } from "./pages/StatusPage/StatusPage";
|
|
11
|
-
|
|
12
|
-
export { PepAnswers } from "./components/PepAnswers";
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React, { useState, FunctionComponent } from "react";
|
|
2
|
-
import { Alternative, Select } from "@lysaab/ui-2";
|
|
3
|
-
import { ValidationProps } from "@lysaab/ui-2/hooks/useValidation";
|
|
4
|
-
import { countries } from "../model/Countries";
|
|
5
|
-
import { defineMessages, useIntl } from "react-intl";
|
|
6
|
-
|
|
7
|
-
export interface Country {
|
|
8
|
-
label: string;
|
|
9
|
-
value: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface Props extends ValidationProps {
|
|
13
|
-
value?: string;
|
|
14
|
-
onChange?(value: Alternative<string>): void;
|
|
15
|
-
label: string;
|
|
16
|
-
omitCountries?: string[];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const messages = defineMessages({
|
|
20
|
-
placeholder: {
|
|
21
|
-
id: 'component.select.country',
|
|
22
|
-
description: 'Select a country placeholder',
|
|
23
|
-
defaultMessage: 'Välj ett land'
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
export const CountrySelect: FunctionComponent<Props> = ({
|
|
28
|
-
value,
|
|
29
|
-
omitCountries = [],
|
|
30
|
-
...props
|
|
31
|
-
}) => {
|
|
32
|
-
const intl = useIntl();
|
|
33
|
-
const [countryAlternatives] = useState(
|
|
34
|
-
countries
|
|
35
|
-
.filter(country => !omitCountries.includes(country.value))
|
|
36
|
-
.map(country => ({ text: country.label, value: country.value }))
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<Select
|
|
41
|
-
alternatives={countryAlternatives}
|
|
42
|
-
placeholder={intl.formatMessage(messages.placeholder)}
|
|
43
|
-
value={countryAlternatives.find(country => country.value === value)}
|
|
44
|
-
{...props}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
47
|
-
};
|