@lysaab/lysa-pep 7.0.0 → 7.1.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/{src/Exports.ts → Exports.d.ts} +2 -7
- package/{lib/Exports.js → Exports.js} +2 -2
- package/{lib/components → components}/PepAnswers.d.ts +6 -0
- package/components/PepAnswers.js +182 -0
- package/package.json +8 -8
- package/{lib/pages → pages}/IsPep/IsPepPage.d.ts +2 -0
- package/{lib/pages → pages}/IsPep/IsPepPage.js +7 -4
- package/lib/Exports.d.ts +0 -7
- package/lib/README.md +0 -51
- package/lib/components/PepAnswers.js +0 -101
- package/lib/package.json +0 -73
- 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.scss +0 -5
- package/src/App.test.tsx +0 -9
- package/src/App.tsx +0 -17
- package/src/components/PepAnswers.scss +0 -7
- package/src/components/PepAnswers.tsx +0 -218
- package/src/demo/Done.tsx +0 -21
- package/src/demo/Localization.tsx +0 -66
- package/src/demo/LocalizationContext.tsx +0 -61
- package/src/demo/Pep.tsx +0 -172
- package/src/index.css +0 -13
- package/src/index.tsx +0 -13
- package/src/locales/da.json +0 -98
- package/src/locales/de.json +0 -98
- package/src/locales/defaultMessages.json +0 -335
- package/src/locales/en.json +0 -98
- package/src/locales/fi.json +0 -98
- package/src/locales/sv.json +0 -98
- package/src/locales/whitelist_da.json +0 -2
- package/src/locales/whitelist_en.json +0 -2
- package/src/locales/whitelist_fi.json +0 -2
- package/src/locales/whitelist_sv.json +0 -2
- package/src/logo.svg +0 -1
- package/src/model/PepModel.ts +0 -54
- package/src/pages/IsPep/IsPepMessages.ts +0 -11
- package/src/pages/IsPep/IsPepPage.tsx +0 -119
- package/src/pages/PepContext.tsx +0 -150
- package/src/pages/RelationPage/RelationMessages.ts +0 -74
- package/src/pages/RelationPage/RelationPage.tsx +0 -306
- package/src/pages/RolePage/RoleMessages.ts +0 -128
- package/src/pages/RolePage/RolePage.tsx +0 -359
- package/src/pages/StatusPage/StatusMessages.ts +0 -59
- package/src/pages/StatusPage/StatusPage.tsx +0 -237
- package/src/react-app-env.d.ts +0 -1
- package/src/serviceWorker.ts +0 -143
- package/src/utils/Possession.ts +0 -41
- package/translationRunner.js +0 -7
- package/tsconfig.json +0 -26
- package/tsconfig_build.json +0 -19
- /package/{lib/components → components}/PepAnswers.scss +0 -0
- /package/{lib/messages → messages}/src/components/PepAnswers.json +0 -0
- /package/{lib/messages → messages}/src/pages/IsPep/IsPepMessages.json +0 -0
- /package/{lib/messages → messages}/src/pages/IsPep/IsPepPage.json +0 -0
- /package/{lib/messages → messages}/src/pages/RelationPage/RelationMessages.json +0 -0
- /package/{lib/messages → messages}/src/pages/RelationPage/RelationPage.json +0 -0
- /package/{lib/messages → messages}/src/pages/RolePage/RoleMessages.json +0 -0
- /package/{lib/messages → messages}/src/pages/RolePage/RolePage.json +0 -0
- /package/{lib/messages → messages}/src/pages/StatusPage/StatusMessages.json +0 -0
- /package/{lib/messages → messages}/src/pages/StatusPage/StatusPage.json +0 -0
- /package/{lib/model → model}/PepModel.d.ts +0 -0
- /package/{lib/model → model}/PepModel.js +0 -0
- /package/{lib/pages → pages}/IsPep/IsPepMessages.d.ts +0 -0
- /package/{lib/pages → pages}/IsPep/IsPepMessages.js +0 -0
- /package/{lib/pages → pages}/PepContext.d.ts +0 -0
- /package/{lib/pages → pages}/PepContext.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}/RelationPage/RelationPage.js +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}/RolePage/RolePage.js +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/pages → pages}/StatusPage/StatusPage.js +0 -0
- /package/{lib/utils → utils}/Possession.d.ts +0 -0
- /package/{lib/utils → utils}/Possession.js +0 -0
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import React, { FunctionComponent } from "react";
|
|
2
|
-
import "./PepAnswers.scss";
|
|
3
|
-
import { PepRequest } from "../model/PepModel";
|
|
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 {
|
|
9
|
-
relationMessages,
|
|
10
|
-
businessRelationMessages,
|
|
11
|
-
} from "../pages/RelationPage/RelationMessages";
|
|
12
|
-
|
|
13
|
-
interface Props {
|
|
14
|
-
answer: PepRequest;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const messages = defineMessages({
|
|
18
|
-
whoIsPepLabel: {
|
|
19
|
-
id: "pep.answers.who.label",
|
|
20
|
-
},
|
|
21
|
-
relationLabel: {
|
|
22
|
-
id: "pep.answers.relationship.label",
|
|
23
|
-
},
|
|
24
|
-
businessRelationLabel: {
|
|
25
|
-
id: "pep.answers.businessRelationship.label",
|
|
26
|
-
},
|
|
27
|
-
nameOfPepLabel: {
|
|
28
|
-
id: "pep.answers.nameOfPep.label",
|
|
29
|
-
},
|
|
30
|
-
birthdayOfPEPLabel: {
|
|
31
|
-
id: "pep.answers.birthdayOfPEP.label",
|
|
32
|
-
},
|
|
33
|
-
statusLabel: {
|
|
34
|
-
id: "pep.answers.status.label",
|
|
35
|
-
},
|
|
36
|
-
statusEndedValue: {
|
|
37
|
-
id: "pep.answers.statusEnded.value",
|
|
38
|
-
},
|
|
39
|
-
statusOngoingValue: {
|
|
40
|
-
id: "pep.answers.statusOngoing.value",
|
|
41
|
-
},
|
|
42
|
-
endedLabel: {
|
|
43
|
-
id: "pep.answers.endedStatus.label",
|
|
44
|
-
},
|
|
45
|
-
roleLabel: {
|
|
46
|
-
id: "pep.answers.role.label",
|
|
47
|
-
},
|
|
48
|
-
countryLabel: {
|
|
49
|
-
id: "pep.answers.country.label",
|
|
50
|
-
},
|
|
51
|
-
ambassadorCountryLabel: {
|
|
52
|
-
id: "pep.answers.ambassadorCountry.label",
|
|
53
|
-
},
|
|
54
|
-
governmentCompanyNameLabel: {
|
|
55
|
-
id: "pep.answers.governmentCompanyName.label",
|
|
56
|
-
},
|
|
57
|
-
governmentCompanyRoleLabel: {
|
|
58
|
-
id: "pep.answers.governmentCompanyRole.label",
|
|
59
|
-
},
|
|
60
|
-
internationalOrganisationNameLabel: {
|
|
61
|
-
id: "pep.answers.companyName.label",
|
|
62
|
-
},
|
|
63
|
-
internationalOrganisationRoleLabel: {
|
|
64
|
-
id: "pep.answers.companyRole.label",
|
|
65
|
-
},
|
|
66
|
-
militaryGradeLabel: {
|
|
67
|
-
id: "pep.answers.militaryRank.label",
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
export const PepAnswers: FunctionComponent<Props> = ({ answer }) => {
|
|
72
|
-
const intl = useIntl();
|
|
73
|
-
|
|
74
|
-
if (!answer.type || answer.type === PepType.NOT_PEP) {
|
|
75
|
-
return (
|
|
76
|
-
<div>
|
|
77
|
-
<p>
|
|
78
|
-
<FormattedMessage id="pep.answers.notpep" />
|
|
79
|
-
</p>
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const entityType = answer.legalEntityType;
|
|
85
|
-
const role = getRoleAlts(intl).find((alt) => alt.value === answer.role);
|
|
86
|
-
const militaryRank = getMilitaryAlts(intl).find(
|
|
87
|
-
(alt) => alt.value === answer.militaryRank
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<div>
|
|
92
|
-
{answer.type && (
|
|
93
|
-
<StaticInput
|
|
94
|
-
label={intl.formatMessage(messages.whoIsPepLabel)}
|
|
95
|
-
value={intl.formatMessage(isPepMessages[answer.type], {
|
|
96
|
-
entityType,
|
|
97
|
-
name: answer.ownerName,
|
|
98
|
-
})}
|
|
99
|
-
/>
|
|
100
|
-
)}
|
|
101
|
-
{answer.relationToPEP && (
|
|
102
|
-
<StaticInput
|
|
103
|
-
label={intl.formatMessage(messages.relationLabel)}
|
|
104
|
-
value={intl.formatMessage(relationMessages[answer.relationToPEP], {
|
|
105
|
-
entityType,
|
|
106
|
-
name: answer.ownerName,
|
|
107
|
-
})}
|
|
108
|
-
/>
|
|
109
|
-
)}
|
|
110
|
-
{answer.businessRelation && (
|
|
111
|
-
<StaticInput
|
|
112
|
-
label={intl.formatMessage(messages.businessRelationLabel)}
|
|
113
|
-
value={intl.formatMessage(
|
|
114
|
-
businessRelationMessages[answer.businessRelation],
|
|
115
|
-
{ entityType, name: answer.ownerName }
|
|
116
|
-
)}
|
|
117
|
-
/>
|
|
118
|
-
)}
|
|
119
|
-
{answer.nameOfPEP && (
|
|
120
|
-
<StaticInput
|
|
121
|
-
label={intl.formatMessage(messages.nameOfPepLabel)}
|
|
122
|
-
value={answer.nameOfPEP}
|
|
123
|
-
/>
|
|
124
|
-
)}
|
|
125
|
-
{answer.birthdayOfPEP && (
|
|
126
|
-
<StaticInput
|
|
127
|
-
label={intl.formatMessage(messages.birthdayOfPEPLabel)}
|
|
128
|
-
value={answer.birthdayOfPEP}
|
|
129
|
-
/>
|
|
130
|
-
)}
|
|
131
|
-
{answer.ended ? (
|
|
132
|
-
<React.Fragment>
|
|
133
|
-
<StaticInput
|
|
134
|
-
label={intl.formatMessage(messages.statusLabel)}
|
|
135
|
-
value={intl.formatMessage(messages.statusEndedValue)}
|
|
136
|
-
/>
|
|
137
|
-
<StaticInput
|
|
138
|
-
label={intl.formatMessage(messages.endedLabel)}
|
|
139
|
-
value={answer.ended}
|
|
140
|
-
/>
|
|
141
|
-
</React.Fragment>
|
|
142
|
-
) : (
|
|
143
|
-
<StaticInput
|
|
144
|
-
label={intl.formatMessage(messages.statusLabel)}
|
|
145
|
-
value={intl.formatMessage(messages.statusOngoingValue)}
|
|
146
|
-
/>
|
|
147
|
-
)}
|
|
148
|
-
{answer.country && (
|
|
149
|
-
<StaticInput
|
|
150
|
-
label={intl.formatMessage(messages.countryLabel)}
|
|
151
|
-
value={intl.formatDisplayName(answer.country, { type: "region" })}
|
|
152
|
-
/>
|
|
153
|
-
)}
|
|
154
|
-
{role && (
|
|
155
|
-
<StaticInput
|
|
156
|
-
label={intl.formatMessage(messages.roleLabel)}
|
|
157
|
-
value={role.text}
|
|
158
|
-
/>
|
|
159
|
-
)}
|
|
160
|
-
{answer.ambassadorCountry && (
|
|
161
|
-
<StaticInput
|
|
162
|
-
label={intl.formatMessage(messages.ambassadorCountryLabel)}
|
|
163
|
-
value={intl.formatDisplayName(answer.ambassadorCountry, {
|
|
164
|
-
type: "region",
|
|
165
|
-
})}
|
|
166
|
-
/>
|
|
167
|
-
)}
|
|
168
|
-
{answer.governmentCompany && (
|
|
169
|
-
<StaticInput
|
|
170
|
-
label={intl.formatMessage(messages.governmentCompanyNameLabel)}
|
|
171
|
-
value={answer.governmentCompany}
|
|
172
|
-
/>
|
|
173
|
-
)}
|
|
174
|
-
{answer.governmentCompanyRole && (
|
|
175
|
-
<StaticInput
|
|
176
|
-
label={intl.formatMessage(messages.governmentCompanyRoleLabel)}
|
|
177
|
-
value={answer.governmentCompanyRole}
|
|
178
|
-
/>
|
|
179
|
-
)}
|
|
180
|
-
{answer.internationalOrganisation && (
|
|
181
|
-
<StaticInput
|
|
182
|
-
label={intl.formatMessage(
|
|
183
|
-
messages.internationalOrganisationNameLabel
|
|
184
|
-
)}
|
|
185
|
-
value={answer.internationalOrganisation}
|
|
186
|
-
/>
|
|
187
|
-
)}
|
|
188
|
-
{answer.internationalOrganisationRole && (
|
|
189
|
-
<StaticInput
|
|
190
|
-
label={intl.formatMessage(
|
|
191
|
-
messages.internationalOrganisationRoleLabel
|
|
192
|
-
)}
|
|
193
|
-
value={answer.internationalOrganisationRole}
|
|
194
|
-
/>
|
|
195
|
-
)}
|
|
196
|
-
{militaryRank && (
|
|
197
|
-
<StaticInput
|
|
198
|
-
label={intl.formatMessage(messages.militaryGradeLabel)}
|
|
199
|
-
value={militaryRank.text}
|
|
200
|
-
/>
|
|
201
|
-
)}
|
|
202
|
-
</div>
|
|
203
|
-
);
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
interface StaticInputProps {
|
|
207
|
-
label: string;
|
|
208
|
-
value: string | React.ReactNode;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const StaticInput: FunctionComponent<StaticInputProps> = ({ label, value }) => {
|
|
212
|
-
return (
|
|
213
|
-
<div className="static-input">
|
|
214
|
-
<div className="label">{label}</div>
|
|
215
|
-
<div className="value">{value}</div>
|
|
216
|
-
</div>
|
|
217
|
-
);
|
|
218
|
-
};
|
package/src/demo/Done.tsx
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from "react";
|
|
2
|
-
import { PepContext } from "../pages/PepContext";
|
|
3
|
-
import { stateToRequest } from "../model/PepModel";
|
|
4
|
-
import { PepAnswers } from "../components/PepAnswers";
|
|
5
|
-
|
|
6
|
-
export function Done() {
|
|
7
|
-
const pepContext = useContext(PepContext);
|
|
8
|
-
return (
|
|
9
|
-
<div>
|
|
10
|
-
<h2>Taco hej!</h2>
|
|
11
|
-
<p>Leverpastej!</p>
|
|
12
|
-
<PepAnswers
|
|
13
|
-
answer={{
|
|
14
|
-
...stateToRequest(pepContext.state),
|
|
15
|
-
ownerName: pepContext.state.ownerName,
|
|
16
|
-
}}
|
|
17
|
-
/>
|
|
18
|
-
<pre>{JSON.stringify(stateToRequest(pepContext.state), null, 2)}</pre>
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useEffect } from "react";
|
|
2
|
-
import { IntlProvider } from "react-intl";
|
|
3
|
-
import { Language, LocalizationContext } from "./LocalizationContext";
|
|
4
|
-
import svMessages from "../locales/sv.json";
|
|
5
|
-
import enMessages from "../locales/en.json";
|
|
6
|
-
import deMessages from "../locales/de.json";
|
|
7
|
-
import { enGB, sv, de } from "date-fns/esm/locale";
|
|
8
|
-
import { registerLocale, setDefaultLocale } from "react-datepicker";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Setup locales for all datepickers. We use the country code
|
|
12
|
-
* as the key for the datepicker locale data
|
|
13
|
-
*/
|
|
14
|
-
registerLocale(Language.SWEDISH, sv);
|
|
15
|
-
registerLocale(Language.ENGLISH, enGB);
|
|
16
|
-
registerLocale(Language.GERMAN, de);
|
|
17
|
-
|
|
18
|
-
console.log("sv", sv);
|
|
19
|
-
|
|
20
|
-
declare global {
|
|
21
|
-
interface Window {
|
|
22
|
-
setLanguage?: (lang: Language) => void;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const languagePacks = {
|
|
27
|
-
[Language.ENGLISH]: enMessages,
|
|
28
|
-
[Language.SWEDISH]: svMessages,
|
|
29
|
-
[Language.GERMAN]: deMessages,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const DEFAULT_LOCALE = "en";
|
|
33
|
-
|
|
34
|
-
export const Localization: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => {
|
|
35
|
-
const localizationContext = useContext(LocalizationContext);
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
/**
|
|
39
|
-
* Change datepicker locale when language is changed
|
|
40
|
-
*/
|
|
41
|
-
setDefaultLocale(localizationContext.state.language);
|
|
42
|
-
console.log(
|
|
43
|
-
"datepicker locale change to",
|
|
44
|
-
localizationContext.state.language
|
|
45
|
-
);
|
|
46
|
-
}, [localizationContext.state.language]);
|
|
47
|
-
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
window.setLanguage = (lang: Language) => {
|
|
50
|
-
localizationContext.setState({ language: lang });
|
|
51
|
-
};
|
|
52
|
-
return () => {
|
|
53
|
-
delete window.setLanguage;
|
|
54
|
-
};
|
|
55
|
-
}, [localizationContext]);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<IntlProvider
|
|
59
|
-
locale={localizationContext.getLocale()}
|
|
60
|
-
defaultLocale={DEFAULT_LOCALE}
|
|
61
|
-
messages={languagePacks[localizationContext.state.language] as any}
|
|
62
|
-
>
|
|
63
|
-
{children}
|
|
64
|
-
</IntlProvider>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React, { FunctionComponent, useReducer } from "react";
|
|
2
|
-
|
|
3
|
-
export enum Language {
|
|
4
|
-
SWEDISH = "sv",
|
|
5
|
-
ENGLISH = "en",
|
|
6
|
-
GERMAN = "de",
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export enum Country {
|
|
10
|
-
DE = "DE",
|
|
11
|
-
SE = "SE",
|
|
12
|
-
DK = "DK",
|
|
13
|
-
FI = "FI",
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Types for the state
|
|
17
|
-
export interface LocalizationState {
|
|
18
|
-
language: Language;
|
|
19
|
-
country?: Country;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// All types for the context. This includes setter methods
|
|
23
|
-
export interface LocalizationContextProps {
|
|
24
|
-
state: LocalizationState;
|
|
25
|
-
setState: (newState: Partial<LocalizationState>) => void;
|
|
26
|
-
getLocale: () => string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Create the context. (This will just create a template)
|
|
30
|
-
export const LocalizationContext =
|
|
31
|
-
React.createContext<LocalizationContextProps>({} as LocalizationContextProps);
|
|
32
|
-
|
|
33
|
-
function stateReducer(
|
|
34
|
-
state: LocalizationState,
|
|
35
|
-
newState: Partial<LocalizationState>
|
|
36
|
-
) {
|
|
37
|
-
return { ...state, ...newState };
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const LocalizationContextProvider: FunctionComponent<React.PropsWithChildren<unknown>> = ({
|
|
41
|
-
children,
|
|
42
|
-
}) => {
|
|
43
|
-
const [state, setState] = useReducer(stateReducer, {
|
|
44
|
-
language: Language.ENGLISH,
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const getLocale = () => {
|
|
48
|
-
let locale: string = state.language;
|
|
49
|
-
if (state.country) {
|
|
50
|
-
locale = `${state.language}-${state.country}`;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return locale;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<LocalizationContext.Provider value={{ state, setState, getLocale }}>
|
|
58
|
-
{children}
|
|
59
|
-
</LocalizationContext.Provider>
|
|
60
|
-
);
|
|
61
|
-
};
|
package/src/demo/Pep.tsx
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import React, { useState, useContext, useEffect, useRef } from "react";
|
|
2
|
-
import { Story, WorldCountry } from "@lysaab/ui-2";
|
|
3
|
-
import { IsPepPage } from "../pages/IsPep/IsPepPage";
|
|
4
|
-
import { StatusPage } from "../pages/StatusPage/StatusPage";
|
|
5
|
-
import { RolePage } from "../pages/RolePage/RolePage";
|
|
6
|
-
import { PepContext, PepType, EntityType } from "../pages/PepContext";
|
|
7
|
-
import { Done } from "./Done";
|
|
8
|
-
import { RelationPage } from "../pages/RelationPage/RelationPage";
|
|
9
|
-
import { Localization } from "./Localization";
|
|
10
|
-
import { Country, Language, LocalizationContext } from "./LocalizationContext";
|
|
11
|
-
|
|
12
|
-
export function Pep() {
|
|
13
|
-
const [page, setPage] = useState(0);
|
|
14
|
-
const pepContext = useContext(PepContext);
|
|
15
|
-
const localizationContext = useContext(LocalizationContext);
|
|
16
|
-
const type = pepContext.state.type;
|
|
17
|
-
const loaded = useRef(false);
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (!loaded.current) {
|
|
21
|
-
pepContext.setState({
|
|
22
|
-
ownerName: "Sean Banan",
|
|
23
|
-
tin: "191212121212",
|
|
24
|
-
legalEntityType: EntityType.PERSON,
|
|
25
|
-
});
|
|
26
|
-
localizationContext.setState({
|
|
27
|
-
country: Country.DK,
|
|
28
|
-
language: Language.ENGLISH,
|
|
29
|
-
});
|
|
30
|
-
loaded.current = true;
|
|
31
|
-
}
|
|
32
|
-
}, [loaded, pepContext, localizationContext]);
|
|
33
|
-
|
|
34
|
-
const countryCode = localizationContext.state.country || Country.DK;
|
|
35
|
-
const countryNames = {
|
|
36
|
-
[Language.ENGLISH]: {
|
|
37
|
-
[Country.DE]: "Germany",
|
|
38
|
-
[Country.DK]: "Denmark",
|
|
39
|
-
[Country.SE]: "Sweden",
|
|
40
|
-
[Country.FI]: "Finland",
|
|
41
|
-
},
|
|
42
|
-
[Language.SWEDISH]: {
|
|
43
|
-
[Country.DE]: "Tyskland",
|
|
44
|
-
[Country.DK]: "Danmark",
|
|
45
|
-
[Country.SE]: "Sverige",
|
|
46
|
-
[Country.FI]: "Finland",
|
|
47
|
-
},
|
|
48
|
-
[Language.GERMAN]: {
|
|
49
|
-
[Country.DE]: "Deutschland",
|
|
50
|
-
[Country.DK]: "Dänemark",
|
|
51
|
-
[Country.SE]: "Schweden",
|
|
52
|
-
[Country.FI]: "Finnland",
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<div style={{ maxWidth: "1000px", margin: "0 auto" }}>
|
|
58
|
-
<Localization>
|
|
59
|
-
<Story
|
|
60
|
-
header="PEP Lib"
|
|
61
|
-
showBack={page > 0}
|
|
62
|
-
showClose={false}
|
|
63
|
-
onBack={() => {
|
|
64
|
-
if (page === 4 && type === PepType.NOT_PEP) {
|
|
65
|
-
setPage(0);
|
|
66
|
-
} else if (page === 2 && type === PepType.ME) {
|
|
67
|
-
setPage(0);
|
|
68
|
-
} else {
|
|
69
|
-
setPage(page - 1);
|
|
70
|
-
}
|
|
71
|
-
}}
|
|
72
|
-
transitionKey={page.toString()}
|
|
73
|
-
onExit={() => {}}
|
|
74
|
-
ariaLabelProgress={() => "Progress"}
|
|
75
|
-
>
|
|
76
|
-
{page === 0 && (
|
|
77
|
-
<IsPepPage
|
|
78
|
-
next={() => {
|
|
79
|
-
if (type === PepType.ME) {
|
|
80
|
-
setPage(2);
|
|
81
|
-
} else if (type === PepType.NOT_PEP) {
|
|
82
|
-
setPage(4);
|
|
83
|
-
} else {
|
|
84
|
-
setPage(1);
|
|
85
|
-
}
|
|
86
|
-
}}
|
|
87
|
-
/>
|
|
88
|
-
)}
|
|
89
|
-
{page === 1 && <RelationPage next={() => setPage(2)} />}
|
|
90
|
-
{page === 2 && (
|
|
91
|
-
<StatusPage
|
|
92
|
-
countryName={
|
|
93
|
-
countryNames[localizationContext.state.language][countryCode]
|
|
94
|
-
}
|
|
95
|
-
countryCode={countryCode as unknown as WorldCountry}
|
|
96
|
-
language={localizationContext.state.language}
|
|
97
|
-
next={() => setPage(3)}
|
|
98
|
-
/>
|
|
99
|
-
)}
|
|
100
|
-
{page === 3 && (
|
|
101
|
-
<RolePage
|
|
102
|
-
language={localizationContext.state.language}
|
|
103
|
-
next={() => setPage(4)}
|
|
104
|
-
/>
|
|
105
|
-
)}
|
|
106
|
-
{page === 4 && <Done />}
|
|
107
|
-
</Story>
|
|
108
|
-
<hr />
|
|
109
|
-
<fieldset>
|
|
110
|
-
<legend>Konfig</legend>
|
|
111
|
-
<div>
|
|
112
|
-
<label>
|
|
113
|
-
Entitet
|
|
114
|
-
<select
|
|
115
|
-
value={pepContext.state.legalEntityType || EntityType.PERSON}
|
|
116
|
-
onChange={(event) => {
|
|
117
|
-
pepContext.setState({
|
|
118
|
-
legalEntityType: event.currentTarget.value as EntityType,
|
|
119
|
-
});
|
|
120
|
-
}}
|
|
121
|
-
>
|
|
122
|
-
<option value={EntityType.PERSON}>Person</option>
|
|
123
|
-
<option value={EntityType.CORPORATION}>Företag</option>
|
|
124
|
-
</select>
|
|
125
|
-
</label>
|
|
126
|
-
</div>
|
|
127
|
-
<div>
|
|
128
|
-
<label>
|
|
129
|
-
Namnet på den verkliga huvudmannen
|
|
130
|
-
<input
|
|
131
|
-
type="text"
|
|
132
|
-
value={pepContext.state.ownerName || ""}
|
|
133
|
-
onChange={(event) =>
|
|
134
|
-
pepContext.setState({ ownerName: event.currentTarget.value })
|
|
135
|
-
}
|
|
136
|
-
/>
|
|
137
|
-
</label>
|
|
138
|
-
</div>
|
|
139
|
-
<div>
|
|
140
|
-
<label>
|
|
141
|
-
Personnummer på huvudmannen
|
|
142
|
-
<input
|
|
143
|
-
type="text"
|
|
144
|
-
value={pepContext.state.tin || ""}
|
|
145
|
-
onChange={(event) =>
|
|
146
|
-
pepContext.setState({ tin: event.currentTarget.value })
|
|
147
|
-
}
|
|
148
|
-
/>
|
|
149
|
-
</label>
|
|
150
|
-
</div>
|
|
151
|
-
<div>
|
|
152
|
-
<label>
|
|
153
|
-
Språk
|
|
154
|
-
<select
|
|
155
|
-
value={localizationContext.state.language}
|
|
156
|
-
onChange={(event) => {
|
|
157
|
-
localizationContext.setState({
|
|
158
|
-
language: event.currentTarget.value as Language,
|
|
159
|
-
});
|
|
160
|
-
}}
|
|
161
|
-
>
|
|
162
|
-
<option value={Language.ENGLISH}>Engelska</option>
|
|
163
|
-
<option value={Language.SWEDISH}>Svenska</option>
|
|
164
|
-
<option value={Language.GERMAN}>German</option>
|
|
165
|
-
</select>
|
|
166
|
-
</label>
|
|
167
|
-
</div>
|
|
168
|
-
</fieldset>
|
|
169
|
-
</Localization>
|
|
170
|
-
</div>
|
|
171
|
-
);
|
|
172
|
-
}
|
package/src/index.css
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
margin: 0;
|
|
3
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
4
|
-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
5
|
-
sans-serif;
|
|
6
|
-
-webkit-font-smoothing: antialiased;
|
|
7
|
-
-moz-osx-font-smoothing: grayscale;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
code {
|
|
11
|
-
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
|
12
|
-
monospace;
|
|
13
|
-
}
|
package/src/index.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { createRoot } from "react-dom/client";
|
|
3
|
-
import "./index.css";
|
|
4
|
-
import App from "./App";
|
|
5
|
-
import * as serviceWorker from "./serviceWorker";
|
|
6
|
-
|
|
7
|
-
const root = createRoot(document.getElementById("root")!);
|
|
8
|
-
root.render(<App />);
|
|
9
|
-
|
|
10
|
-
// If you want your app to work offline and load faster, you can change
|
|
11
|
-
// unregister() to register() below. Note this comes with some pitfalls.
|
|
12
|
-
// Learn more about service workers: https://bit.ly/CRA-PWA
|
|
13
|
-
serviceWorker.unregister();
|