@lysaab/lysa-pep 1.0.3-0 → 1.0.4-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.vscode/settings.json +4 -0
  2. package/lib/Exports.d.ts +7 -7
  3. package/lib/Exports.js +7 -7
  4. package/lib/components/CountrySelect.d.ts +15 -15
  5. package/lib/components/CountrySelect.js +30 -30
  6. package/lib/components/PepAnswers.d.ts +8 -8
  7. package/lib/components/PepAnswers.js +131 -131
  8. package/lib/components/PepAnswers.scss +7 -7
  9. package/lib/model/Countries.d.ts +4 -4
  10. package/lib/model/Countries.js +1002 -1002
  11. package/lib/model/PepModel.d.ts +7 -7
  12. package/lib/model/PepModel.js +40 -40
  13. package/lib/model/PepTexts.d.ts +322 -380
  14. package/lib/model/PepTexts.js +467 -552
  15. package/lib/pages/IsPep/IsPepMessages.d.ts +32 -32
  16. package/lib/pages/IsPep/IsPepMessages.js +66 -66
  17. package/lib/pages/IsPep/IsPepPage.d.ts +14 -14
  18. package/lib/pages/IsPep/IsPepPage.js +60 -59
  19. package/lib/pages/PepContext.d.ts +80 -80
  20. package/lib/pages/PepContext.js +88 -88
  21. package/lib/pages/PepIsPepPage.d.ts +6 -15
  22. package/lib/pages/PepIsPepPage.js +57 -59
  23. package/lib/pages/PepRelationPage.d.ts +6 -6
  24. package/lib/pages/PepRelationPage.js +83 -79
  25. package/lib/pages/PepRolePage.d.ts +9 -10
  26. package/lib/pages/PepRolePage.js +127 -127
  27. package/lib/pages/PepStatusPage.d.ts +6 -6
  28. package/lib/pages/PepStatusPage.js +57 -58
  29. package/lib/pages/RelationPage/RelationMessages.d.ts +105 -105
  30. package/lib/pages/RelationPage/RelationMessages.js +283 -283
  31. package/lib/pages/RelationPage/RelationPage.d.ts +6 -6
  32. package/lib/pages/RelationPage/RelationPage.js +154 -153
  33. package/lib/pages/RolePage/RoleMessages.d.ts +185 -185
  34. package/lib/pages/RolePage/RoleMessages.js +385 -385
  35. package/lib/pages/RolePage/RolePage.d.ts +11 -11
  36. package/lib/pages/RolePage/RolePage.js +223 -220
  37. package/lib/pages/StatusPage/StatusMessages.d.ts +72 -72
  38. package/lib/pages/StatusPage/StatusMessages.js +266 -266
  39. package/lib/pages/StatusPage/StatusPage.d.ts +6 -6
  40. package/lib/pages/StatusPage/StatusPage.js +98 -95
  41. package/lib/utils/Possession.d.ts +1 -1
  42. package/lib/utils/Possession.js +18 -18
  43. package/package.json +57 -57
  44. package/src/Exports.ts +12 -12
  45. package/src/components/CountrySelect.tsx +47 -47
  46. package/src/components/PepAnswers.scss +7 -7
  47. package/src/components/PepAnswers.tsx +252 -252
  48. package/src/demo/Done.tsx +16 -16
  49. package/src/demo/Pep.tsx +112 -112
  50. package/src/model/PepModel.ts +52 -52
  51. package/src/pages/IsPep/IsPepMessages.ts +67 -67
  52. package/src/pages/IsPep/IsPepPage.tsx +118 -115
  53. package/src/pages/PepContext.tsx +144 -144
  54. package/src/pages/RelationPage/RelationMessages.ts +288 -288
  55. package/src/pages/RelationPage/RelationPage.tsx +304 -299
  56. package/src/pages/RolePage/RoleMessages.ts +393 -393
  57. package/src/pages/RolePage/RolePage.tsx +361 -356
  58. package/src/pages/StatusPage/StatusMessages.ts +272 -272
  59. package/src/pages/StatusPage/StatusPage.tsx +213 -207
@@ -1,252 +1,252 @@
1
- import React, { FunctionComponent } from "react";
2
- import "./PepAnswers.scss";
3
- import { PepRequest } from "../model/PepModel";
4
- import { countries } from "../model/Countries";
5
- import { getRoleAlts, getMilitaryAlts } from "../pages/RolePage/RolePage";
6
- import { EntityType, PepType } from "../pages/PepContext";
7
- import { useIntl, defineMessages, FormattedMessage } from "react-intl";
8
- import { messages as isPepMessages } from "../pages/IsPep/IsPepMessages";
9
- import {
10
- relationMessages,
11
- businessRelationMessages
12
- } from "../pages/RelationPage/RelationMessages";
13
-
14
- interface Props {
15
- answer: PepRequest;
16
- }
17
-
18
- const messages = defineMessages({
19
- whoIsPepLabel: {
20
- id: "pep.anwers.who.label",
21
- description: "Who is pep label",
22
- defaultMessage: "Vem är pep"
23
- },
24
- relationLabel: {
25
- id: "pep.anwers.relation.label",
26
- description: "Relation label",
27
- defaultMessage: "Relation"
28
- },
29
- businessRelationLabel: {
30
- id: "pep.anwers.businessRelation.label",
31
- description: "Business relation label",
32
- defaultMessage: "Vem är pep"
33
- },
34
- nameOfPepLabel: {
35
- id: "pep.anwers.nameOfPep.label",
36
- description: "Name of pep label",
37
- defaultMessage: "Namn på personen"
38
- },
39
- birthdayOfPEPLabel: {
40
- id: "pep.anwers.birthdayOfPEP.label",
41
- description: "Birthday of pep label",
42
- defaultMessage: "Födelsedag för personen"
43
- },
44
- statusLabel: {
45
- id: "pep.anwers.status.label",
46
- description: "Status label",
47
- defaultMessage: "Status"
48
- },
49
- statusEndedValue: {
50
- id: "pep.anwers.statusEnded.value",
51
- description: "Status ended value",
52
- defaultMessage: "Avslutad"
53
- },
54
- statusOngoingValue: {
55
- id: "pep.anwers.statusOngoing.value",
56
- description: "Status ongoing value",
57
- defaultMessage: "Pågående"
58
- },
59
- endedLabel: {
60
- id: "pep.anwers.endedStatus.label",
61
- description: "Ended label",
62
- defaultMessage: "Avslutades"
63
- },
64
- roleLabel: {
65
- id: "pep.anwers.role.label",
66
- description: "Role label",
67
- defaultMessage: "Roll"
68
- },
69
- countryLabel: {
70
- id: "pep.anwers.country.label",
71
- description: "Country label",
72
- defaultMessage: "Land"
73
- },
74
- ambassadorCountryLabel: {
75
- id: "pep.anwers.ambassadorCountry.label",
76
- description: "Ambassador country label",
77
- defaultMessage: "Ambassadörsland"
78
- },
79
- governmentCompanyNameLabel: {
80
- id: "pep.anwers.governmentCompanyName.label",
81
- description: "Government company name label",
82
- defaultMessage: "Företags namn"
83
- },
84
- governmentCompanyRoleLabel: {
85
- id: "pep.anwers.governmentCompanyRole.label",
86
- description: "Government company role label",
87
- defaultMessage: "Roll på företaget"
88
- },
89
- internationalOrganisationNameLabel: {
90
- id: "pep.anwers.companyName.label",
91
- description: "International organisation name label",
92
- defaultMessage: "Organisationens namn"
93
- },
94
- internationalOrganisationRoleLabel: {
95
- id: "pep.anwers.companyRole.label",
96
- description: "International organisation role label",
97
- defaultMessage: "Roll i organisationen"
98
- },
99
- militaryGradeLabel: {
100
- id: "pep.anwers.militaryRank.label",
101
- description: "Military rank label",
102
- defaultMessage: "Roll i organisationen"
103
- }
104
- });
105
-
106
- export const PepAnswers: FunctionComponent<Props> = ({ answer }) => {
107
- const intl = useIntl();
108
- if (!answer.type || answer.type === PepType.NOT_PEP) {
109
- return (
110
- <div>
111
- <p>
112
- <FormattedMessage
113
- id="pep.anwers.notpep"
114
- description="Not pep"
115
- defaultMessage="Personen är inte PEP"
116
- />
117
- </p>
118
- </div>
119
- );
120
- }
121
-
122
- const country = countries.find(country => country.value === answer.country);
123
- const role = getRoleAlts(intl).find(alt => alt.value === answer.role);
124
- const militaryRank = getMilitaryAlts(intl).find(
125
- alt => alt.value === answer.militaryRank
126
- );
127
- return (
128
- <div>
129
- {answer.type && (
130
- <StaticInput
131
- label={intl.formatMessage(messages.whoIsPepLabel)}
132
- value={intl.formatMessage(isPepMessages[answer.type], {
133
- entityType: EntityType.PERSON
134
- })}
135
- />
136
- )}
137
- {answer.relationToPEP && (
138
- <StaticInput
139
- label={intl.formatMessage(messages.relationLabel)}
140
- value={intl.formatMessage(relationMessages[answer.relationToPEP])}
141
- />
142
- )}
143
- {answer.businessRelation && (
144
- <StaticInput
145
- label={intl.formatMessage(messages.businessRelationLabel)}
146
- value={intl.formatMessage(
147
- businessRelationMessages[answer.businessRelation]
148
- )}
149
- />
150
- )}
151
- {answer.nameOfPEP && (
152
- <StaticInput
153
- label={intl.formatMessage(messages.nameOfPepLabel)}
154
- value={answer.nameOfPEP}
155
- />
156
- )}
157
- {answer.birthdayOfPEP && (
158
- <StaticInput
159
- label={intl.formatMessage(messages.birthdayOfPEPLabel)}
160
- value={answer.birthdayOfPEP}
161
- />
162
- )}
163
- {answer.ended ? (
164
- <React.Fragment>
165
- <StaticInput
166
- label={intl.formatMessage(messages.statusLabel)}
167
- value={intl.formatMessage(messages.statusEndedValue)}
168
- />
169
- <StaticInput
170
- label={intl.formatMessage(messages.endedLabel)}
171
- value={answer.ended}
172
- />
173
- </React.Fragment>
174
- ) : (
175
- <StaticInput
176
- label={intl.formatMessage(messages.statusLabel)}
177
- value={intl.formatMessage(messages.statusOngoingValue)}
178
- />
179
- )}
180
- {answer.country && (
181
- <StaticInput
182
- label={intl.formatMessage(messages.countryLabel)}
183
- value={country ? country.label : answer.country}
184
- />
185
- )}
186
- {role && (
187
- <StaticInput
188
- label={intl.formatMessage(messages.roleLabel)}
189
- value={role.text}
190
- />
191
- )}
192
- {answer.ambassadorCountry && (
193
- <StaticInput
194
- label={intl.formatMessage(messages.ambassadorCountryLabel)}
195
- value={
196
- countries.find(
197
- country => country.value === answer.ambassadorCountry
198
- )?.label || answer.ambassadorCountry
199
- }
200
- />
201
- )}
202
- {answer.governmentCompany && (
203
- <StaticInput
204
- label={intl.formatMessage(messages.governmentCompanyNameLabel)}
205
- value={answer.governmentCompany}
206
- />
207
- )}
208
- {answer.governmentCompanyRole && (
209
- <StaticInput
210
- label={intl.formatMessage(messages.governmentCompanyRoleLabel)}
211
- value={answer.governmentCompanyRole}
212
- />
213
- )}
214
- {answer.internationalOrganisation && (
215
- <StaticInput
216
- label={intl.formatMessage(
217
- messages.internationalOrganisationNameLabel
218
- )}
219
- value={answer.internationalOrganisation}
220
- />
221
- )}
222
- {answer.internationalOrganisationRole && (
223
- <StaticInput
224
- label={intl.formatMessage(
225
- messages.internationalOrganisationRoleLabel
226
- )}
227
- value={answer.internationalOrganisationRole}
228
- />
229
- )}
230
- {militaryRank && (
231
- <StaticInput
232
- label={intl.formatMessage(messages.militaryGradeLabel)}
233
- value={militaryRank.value}
234
- />
235
- )}
236
- </div>
237
- );
238
- };
239
-
240
- interface StaticInputProps {
241
- label: string;
242
- value: string | React.ReactNode;
243
- }
244
-
245
- const StaticInput: FunctionComponent<StaticInputProps> = ({ label, value }) => {
246
- return (
247
- <div className="static-input">
248
- <div className="label">{label}</div>
249
- <div className="value">{value}</div>
250
- </div>
251
- );
252
- };
1
+ import React, { FunctionComponent } from "react";
2
+ import "./PepAnswers.scss";
3
+ import { PepRequest } from "../model/PepModel";
4
+ import { countries } from "../model/Countries";
5
+ import { getRoleAlts, getMilitaryAlts } from "../pages/RolePage/RolePage";
6
+ import { EntityType, PepType } from "../pages/PepContext";
7
+ import { useIntl, defineMessages, FormattedMessage } from "react-intl";
8
+ import { messages as isPepMessages } from "../pages/IsPep/IsPepMessages";
9
+ import {
10
+ relationMessages,
11
+ businessRelationMessages
12
+ } from "../pages/RelationPage/RelationMessages";
13
+
14
+ interface Props {
15
+ answer: PepRequest;
16
+ }
17
+
18
+ const messages = defineMessages({
19
+ whoIsPepLabel: {
20
+ id: "pep.anwers.who.label",
21
+ description: "Who is pep label",
22
+ defaultMessage: "Vem är pep"
23
+ },
24
+ relationLabel: {
25
+ id: "pep.anwers.relation.label",
26
+ description: "Relation label",
27
+ defaultMessage: "Relation"
28
+ },
29
+ businessRelationLabel: {
30
+ id: "pep.anwers.businessRelation.label",
31
+ description: "Business relation label",
32
+ defaultMessage: "Vem är pep"
33
+ },
34
+ nameOfPepLabel: {
35
+ id: "pep.anwers.nameOfPep.label",
36
+ description: "Name of pep label",
37
+ defaultMessage: "Namn på personen"
38
+ },
39
+ birthdayOfPEPLabel: {
40
+ id: "pep.anwers.birthdayOfPEP.label",
41
+ description: "Birthday of pep label",
42
+ defaultMessage: "Födelsedag för personen"
43
+ },
44
+ statusLabel: {
45
+ id: "pep.anwers.status.label",
46
+ description: "Status label",
47
+ defaultMessage: "Status"
48
+ },
49
+ statusEndedValue: {
50
+ id: "pep.anwers.statusEnded.value",
51
+ description: "Status ended value",
52
+ defaultMessage: "Avslutad"
53
+ },
54
+ statusOngoingValue: {
55
+ id: "pep.anwers.statusOngoing.value",
56
+ description: "Status ongoing value",
57
+ defaultMessage: "Pågående"
58
+ },
59
+ endedLabel: {
60
+ id: "pep.anwers.endedStatus.label",
61
+ description: "Ended label",
62
+ defaultMessage: "Avslutades"
63
+ },
64
+ roleLabel: {
65
+ id: "pep.anwers.role.label",
66
+ description: "Role label",
67
+ defaultMessage: "Roll"
68
+ },
69
+ countryLabel: {
70
+ id: "pep.anwers.country.label",
71
+ description: "Country label",
72
+ defaultMessage: "Land"
73
+ },
74
+ ambassadorCountryLabel: {
75
+ id: "pep.anwers.ambassadorCountry.label",
76
+ description: "Ambassador country label",
77
+ defaultMessage: "Ambassadörsland"
78
+ },
79
+ governmentCompanyNameLabel: {
80
+ id: "pep.anwers.governmentCompanyName.label",
81
+ description: "Government company name label",
82
+ defaultMessage: "Företags namn"
83
+ },
84
+ governmentCompanyRoleLabel: {
85
+ id: "pep.anwers.governmentCompanyRole.label",
86
+ description: "Government company role label",
87
+ defaultMessage: "Roll på företaget"
88
+ },
89
+ internationalOrganisationNameLabel: {
90
+ id: "pep.anwers.companyName.label",
91
+ description: "International organisation name label",
92
+ defaultMessage: "Organisationens namn"
93
+ },
94
+ internationalOrganisationRoleLabel: {
95
+ id: "pep.anwers.companyRole.label",
96
+ description: "International organisation role label",
97
+ defaultMessage: "Roll i organisationen"
98
+ },
99
+ militaryGradeLabel: {
100
+ id: "pep.anwers.militaryRank.label",
101
+ description: "Military rank label",
102
+ defaultMessage: "Roll i organisationen"
103
+ }
104
+ });
105
+
106
+ export const PepAnswers: FunctionComponent<Props> = ({ answer }) => {
107
+ const intl = useIntl();
108
+ if (!answer.type || answer.type === PepType.NOT_PEP) {
109
+ return (
110
+ <div>
111
+ <p>
112
+ <FormattedMessage
113
+ id="pep.anwers.notpep"
114
+ description="Not pep"
115
+ defaultMessage="Personen är inte PEP"
116
+ />
117
+ </p>
118
+ </div>
119
+ );
120
+ }
121
+
122
+ const country = countries.find(country => country.value === answer.country);
123
+ const role = getRoleAlts(intl).find(alt => alt.value === answer.role);
124
+ const militaryRank = getMilitaryAlts(intl).find(
125
+ alt => alt.value === answer.militaryRank
126
+ );
127
+ return (
128
+ <div>
129
+ {answer.type && (
130
+ <StaticInput
131
+ label={intl.formatMessage(messages.whoIsPepLabel)}
132
+ value={intl.formatMessage(isPepMessages[answer.type], {
133
+ entityType: EntityType.PERSON
134
+ })}
135
+ />
136
+ )}
137
+ {answer.relationToPEP && (
138
+ <StaticInput
139
+ label={intl.formatMessage(messages.relationLabel)}
140
+ value={intl.formatMessage(relationMessages[answer.relationToPEP])}
141
+ />
142
+ )}
143
+ {answer.businessRelation && (
144
+ <StaticInput
145
+ label={intl.formatMessage(messages.businessRelationLabel)}
146
+ value={intl.formatMessage(
147
+ businessRelationMessages[answer.businessRelation]
148
+ )}
149
+ />
150
+ )}
151
+ {answer.nameOfPEP && (
152
+ <StaticInput
153
+ label={intl.formatMessage(messages.nameOfPepLabel)}
154
+ value={answer.nameOfPEP}
155
+ />
156
+ )}
157
+ {answer.birthdayOfPEP && (
158
+ <StaticInput
159
+ label={intl.formatMessage(messages.birthdayOfPEPLabel)}
160
+ value={answer.birthdayOfPEP}
161
+ />
162
+ )}
163
+ {answer.ended ? (
164
+ <React.Fragment>
165
+ <StaticInput
166
+ label={intl.formatMessage(messages.statusLabel)}
167
+ value={intl.formatMessage(messages.statusEndedValue)}
168
+ />
169
+ <StaticInput
170
+ label={intl.formatMessage(messages.endedLabel)}
171
+ value={answer.ended}
172
+ />
173
+ </React.Fragment>
174
+ ) : (
175
+ <StaticInput
176
+ label={intl.formatMessage(messages.statusLabel)}
177
+ value={intl.formatMessage(messages.statusOngoingValue)}
178
+ />
179
+ )}
180
+ {answer.country && (
181
+ <StaticInput
182
+ label={intl.formatMessage(messages.countryLabel)}
183
+ value={country ? country.label : answer.country}
184
+ />
185
+ )}
186
+ {role && (
187
+ <StaticInput
188
+ label={intl.formatMessage(messages.roleLabel)}
189
+ value={role.text}
190
+ />
191
+ )}
192
+ {answer.ambassadorCountry && (
193
+ <StaticInput
194
+ label={intl.formatMessage(messages.ambassadorCountryLabel)}
195
+ value={
196
+ countries.find(
197
+ country => country.value === answer.ambassadorCountry
198
+ )?.label || answer.ambassadorCountry
199
+ }
200
+ />
201
+ )}
202
+ {answer.governmentCompany && (
203
+ <StaticInput
204
+ label={intl.formatMessage(messages.governmentCompanyNameLabel)}
205
+ value={answer.governmentCompany}
206
+ />
207
+ )}
208
+ {answer.governmentCompanyRole && (
209
+ <StaticInput
210
+ label={intl.formatMessage(messages.governmentCompanyRoleLabel)}
211
+ value={answer.governmentCompanyRole}
212
+ />
213
+ )}
214
+ {answer.internationalOrganisation && (
215
+ <StaticInput
216
+ label={intl.formatMessage(
217
+ messages.internationalOrganisationNameLabel
218
+ )}
219
+ value={answer.internationalOrganisation}
220
+ />
221
+ )}
222
+ {answer.internationalOrganisationRole && (
223
+ <StaticInput
224
+ label={intl.formatMessage(
225
+ messages.internationalOrganisationRoleLabel
226
+ )}
227
+ value={answer.internationalOrganisationRole}
228
+ />
229
+ )}
230
+ {militaryRank && (
231
+ <StaticInput
232
+ label={intl.formatMessage(messages.militaryGradeLabel)}
233
+ value={militaryRank.value}
234
+ />
235
+ )}
236
+ </div>
237
+ );
238
+ };
239
+
240
+ interface StaticInputProps {
241
+ label: string;
242
+ value: string | React.ReactNode;
243
+ }
244
+
245
+ const StaticInput: FunctionComponent<StaticInputProps> = ({ label, value }) => {
246
+ return (
247
+ <div className="static-input">
248
+ <div className="label">{label}</div>
249
+ <div className="value">{value}</div>
250
+ </div>
251
+ );
252
+ };
package/src/demo/Done.tsx CHANGED
@@ -1,16 +1,16 @@
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 answer={stateToRequest(pepContext.state)} />
13
- <pre>{JSON.stringify(stateToRequest(pepContext.state), null, 2)}</pre>
14
- </div>
15
- );
16
- }
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 answer={stateToRequest(pepContext.state)} />
13
+ <pre>{JSON.stringify(stateToRequest(pepContext.state), null, 2)}</pre>
14
+ </div>
15
+ );
16
+ }