@lysaab/lysa-pep 1.0.0 → 1.0.2-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 (65) hide show
  1. package/.vscode/settings.json +4 -0
  2. package/lib/Exports.d.ts +7 -8
  3. package/lib/Exports.js +7 -8
  4. package/lib/components/CountrySelect.d.ts +15 -22
  5. package/lib/components/CountrySelect.js +30 -21
  6. package/lib/components/PepAnswers.d.ts +8 -8
  7. package/lib/components/PepAnswers.js +131 -39
  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 -0
  16. package/lib/pages/IsPep/IsPepMessages.js +66 -0
  17. package/lib/pages/IsPep/IsPepPage.d.ts +14 -0
  18. package/lib/pages/IsPep/IsPepPage.js +59 -0
  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 -0
  30. package/lib/pages/RelationPage/RelationMessages.js +283 -0
  31. package/lib/pages/RelationPage/RelationPage.d.ts +6 -0
  32. package/lib/pages/RelationPage/RelationPage.js +153 -0
  33. package/lib/pages/RolePage/RoleMessages.d.ts +185 -0
  34. package/lib/pages/RolePage/RoleMessages.js +385 -0
  35. package/lib/pages/RolePage/RolePage.d.ts +11 -0
  36. package/lib/pages/RolePage/RolePage.js +220 -0
  37. package/lib/pages/StatusPage/StatusMessages.d.ts +72 -0
  38. package/lib/pages/StatusPage/StatusMessages.js +266 -0
  39. package/lib/pages/StatusPage/StatusPage.d.ts +6 -0
  40. package/lib/pages/StatusPage/StatusPage.js +95 -0
  41. package/lib/utils/Possession.d.ts +1 -0
  42. package/lib/utils/Possession.js +18 -0
  43. package/package.json +57 -53
  44. package/src/Exports.ts +12 -13
  45. package/src/components/CountrySelect.tsx +47 -43
  46. package/src/components/PepAnswers.scss +7 -7
  47. package/src/components/PepAnswers.tsx +252 -120
  48. package/src/demo/Done.tsx +16 -20
  49. package/src/demo/Pep.tsx +112 -106
  50. package/src/model/PepModel.ts +52 -52
  51. package/src/pages/IsPep/IsPepMessages.ts +67 -0
  52. package/src/pages/IsPep/IsPepPage.tsx +114 -0
  53. package/src/pages/PepContext.tsx +144 -144
  54. package/src/pages/RelationPage/RelationMessages.ts +288 -0
  55. package/src/pages/RelationPage/RelationPage.tsx +299 -0
  56. package/src/pages/RolePage/RoleMessages.ts +393 -0
  57. package/src/pages/RolePage/RolePage.tsx +356 -0
  58. package/src/pages/StatusPage/StatusMessages.ts +272 -0
  59. package/src/pages/StatusPage/StatusPage.tsx +207 -0
  60. package/src/utils/Possession.ts +21 -0
  61. package/src/model/PepTexts.ts +0 -607
  62. package/src/pages/PepIsPepPage.tsx +0 -107
  63. package/src/pages/PepRelationPage.tsx +0 -188
  64. package/src/pages/PepRolePage.tsx +0 -272
  65. package/src/pages/PepStatusPage.tsx +0 -157
@@ -0,0 +1,4 @@
1
+ {
2
+ "typescript.tsdk": "node_modules/typescript/lib",
3
+ "editor.formatOnSave": true
4
+ }
package/lib/Exports.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- export * from "./pages/PepContext";
2
- export * from "./model/PepModel";
3
- export * from "./model/PepTexts";
4
- export * from "./pages/PepIsPepPage";
5
- export { PepRelationPage } from "./pages/PepRelationPage";
6
- export { PepRolePage, militaryAlternatives, roleAlternatives } from "./pages/PepRolePage";
7
- export { PepStatusPage } from "./pages/PepStatusPage";
8
- 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/lib/Exports.js CHANGED
@@ -1,8 +1,7 @@
1
- export * from "./pages/PepContext";
2
- export * from "./model/PepModel";
3
- export * from "./model/PepTexts";
4
- export * from "./pages/PepIsPepPage";
5
- export { PepRelationPage } from "./pages/PepRelationPage";
6
- export { PepRolePage, militaryAlternatives, roleAlternatives } from "./pages/PepRolePage";
7
- export { PepStatusPage } from "./pages/PepStatusPage";
8
- 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,22 +1,15 @@
1
- import { FunctionComponent } from "react";
2
- import { Alternative } from "@lysaab/ui-2";
3
- import { ValidationProps } from "@lysaab/ui-2/hooks/useValidation";
4
- declare global {
5
- interface Window {
6
- lysa: {
7
- contentPath: string;
8
- };
9
- }
10
- }
11
- export interface Country {
12
- label: string;
13
- value: string;
14
- }
15
- interface Props extends ValidationProps {
16
- value?: string;
17
- onChange?(value: Alternative<string>): void;
18
- label: string;
19
- removeSweden?: boolean;
20
- }
21
- export declare const CountrySelect: FunctionComponent<Props>;
22
- export {};
1
+ import { FunctionComponent } from "react";
2
+ import { Alternative } from "@lysaab/ui-2";
3
+ import { ValidationProps } from "@lysaab/ui-2/hooks/useValidation";
4
+ export interface Country {
5
+ label: string;
6
+ value: string;
7
+ }
8
+ interface Props extends ValidationProps {
9
+ value?: string;
10
+ onChange?(value: Alternative<string>): void;
11
+ label: string;
12
+ omitCountries?: string[];
13
+ }
14
+ export declare const CountrySelect: FunctionComponent<Props>;
15
+ export {};
@@ -1,21 +1,30 @@
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 React, { useState } from "react";
13
- import { Select } from "@lysaab/ui-2";
14
- import { countries } from "../model/Countries";
15
- export const CountrySelect = (_a) => {
16
- var { value, removeSweden = false } = _a, props = __rest(_a, ["value", "removeSweden"]);
17
- const [countryAlternatives] = useState(countries
18
- .filter(country => !(removeSweden && country.value === "SE"))
19
- .map(country => ({ text: country.label, value: country.value })));
20
- return (React.createElement(Select, Object.assign({ alternatives: countryAlternatives, placeholder: "Välj ett land", value: countryAlternatives.find(country => country.value === value) }, props)));
21
- };
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 React, { useState } from "react";
13
+ import { Select } from "@lysaab/ui-2";
14
+ import { countries } from "../model/Countries";
15
+ import { defineMessages, useIntl } from "react-intl";
16
+ const messages = defineMessages({
17
+ placeholder: {
18
+ id: 'component.select.country',
19
+ description: 'Select a country placeholder',
20
+ defaultMessage: 'Välj ett land'
21
+ }
22
+ });
23
+ export const CountrySelect = (_a) => {
24
+ var { value, omitCountries = [] } = _a, props = __rest(_a, ["value", "omitCountries"]);
25
+ const intl = useIntl();
26
+ const [countryAlternatives] = useState(countries
27
+ .filter(country => !omitCountries.includes(country.value))
28
+ .map(country => ({ text: country.label, value: country.value })));
29
+ return (React.createElement(Select, Object.assign({ alternatives: countryAlternatives, placeholder: intl.formatMessage(messages.placeholder), value: countryAlternatives.find(country => country.value === value) }, props)));
30
+ };
@@ -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 {};
@@ -1,39 +1,131 @@
1
- import React from "react";
2
- import "./PepAnswers.scss";
3
- import { countries } from "../model/Countries";
4
- import { LABELS } from "../model/PepTexts";
5
- import { roleAlternatives, militaryAlternatives } from "../pages/PepRolePage";
6
- import { EntityType, PepType } from "../pages/PepContext";
7
- export const PepAnswers = ({ answer }) => {
8
- if (!answer.type || answer.type === PepType.NOT_PEP) {
9
- return React.createElement("div", null,
10
- React.createElement("p", null, "Personen \u00E4r inte PEP"));
11
- }
12
- const entityType = answer.legalEntityType || EntityType.PERSON;
13
- const labels = LABELS(answer.ownerName);
14
- const country = countries.find(country => country.value === answer.country);
15
- const role = roleAlternatives.find(alt => alt.value === answer.role);
16
- const militaryRank = militaryAlternatives.find(alt => alt.value === answer.militaryRank);
17
- return (React.createElement("div", null,
18
- answer.type && (React.createElement(StaticInput, { label: "Vem \u00E4r pep", value: labels[entityType].GENERIC.IS_PEP[answer.type] })),
19
- answer.relationToPEP && (React.createElement(StaticInput, { label: "Relation", value: labels[entityType][PepType.RELATIVE].RELATION[answer.relationToPEP] })),
20
- answer.businessRelation && (React.createElement(StaticInput, { label: "Relation", value: labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION[answer.businessRelation] })),
21
- answer.nameOfPEP && (React.createElement(StaticInput, { label: "Namn p\u00E5 personen", value: answer.nameOfPEP })),
22
- answer.birthdayOfPEP && (React.createElement(StaticInput, { label: "F\u00F6delsedag f\u00F6r personen", value: answer.birthdayOfPEP })),
23
- answer.ended ? (React.createElement(React.Fragment, null,
24
- React.createElement(StaticInput, { label: "Status", value: "Avslutad" }),
25
- React.createElement(StaticInput, { label: "Avslutades", value: answer.ended }))) : (React.createElement(StaticInput, { label: "Status", value: "P\u00E5g\u00E5ende" })),
26
- answer.country && (React.createElement(StaticInput, { label: "Land", value: country ? country.label : answer.country })),
27
- role && React.createElement(StaticInput, { label: "Roll", value: role.text }),
28
- answer.ambassadorCountry && (React.createElement(StaticInput, { label: "Ambassad\u00F6rsland", value: answer.ambassadorCountry })),
29
- answer.governmentCompany && (React.createElement(StaticInput, { label: "F\u00F6retagets namn", value: answer.governmentCompany })),
30
- answer.governmentCompanyRole && (React.createElement(StaticInput, { label: "Roll p\u00E5 f\u00F6retaget", value: answer.governmentCompanyRole })),
31
- answer.internationalOrganisation && (React.createElement(StaticInput, { label: "Organisationens namn", value: answer.internationalOrganisation })),
32
- answer.internationalOrganisationRole && (React.createElement(StaticInput, { label: "Roll i organisationen", value: answer.internationalOrganisationRole })),
33
- militaryRank && (React.createElement(StaticInput, { label: "Milit\u00E4r grad", value: militaryRank.text }))));
34
- };
35
- const StaticInput = ({ label, value }) => {
36
- return (React.createElement("div", { className: "static-input" },
37
- React.createElement("div", { className: "label" }, label),
38
- React.createElement("div", { className: "value" }, value)));
39
- };
1
+ import React from "react";
2
+ import "./PepAnswers.scss";
3
+ import { countries } from "../model/Countries";
4
+ import { getRoleAlts, getMilitaryAlts } from "../pages/RolePage/RolePage";
5
+ import { EntityType, 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.anwers.who.label",
12
+ description: "Who is pep label",
13
+ defaultMessage: "Vem är pep"
14
+ },
15
+ relationLabel: {
16
+ id: "pep.anwers.relation.label",
17
+ description: "Relation label",
18
+ defaultMessage: "Relation"
19
+ },
20
+ businessRelationLabel: {
21
+ id: "pep.anwers.businessRelation.label",
22
+ description: "Business relation label",
23
+ defaultMessage: "Vem är pep"
24
+ },
25
+ nameOfPepLabel: {
26
+ id: "pep.anwers.nameOfPep.label",
27
+ description: "Name of pep label",
28
+ defaultMessage: "Namn på personen"
29
+ },
30
+ birthdayOfPEPLabel: {
31
+ id: "pep.anwers.birthdayOfPEP.label",
32
+ description: "Birthday of pep label",
33
+ defaultMessage: "Födelsedag för personen"
34
+ },
35
+ statusLabel: {
36
+ id: "pep.anwers.status.label",
37
+ description: "Status label",
38
+ defaultMessage: "Status"
39
+ },
40
+ statusEndedValue: {
41
+ id: "pep.anwers.statusEnded.value",
42
+ description: "Status ended value",
43
+ defaultMessage: "Avslutad"
44
+ },
45
+ statusOngoingValue: {
46
+ id: "pep.anwers.statusOngoing.value",
47
+ description: "Status ongoing value",
48
+ defaultMessage: "Pågående"
49
+ },
50
+ endedLabel: {
51
+ id: "pep.anwers.endedStatus.label",
52
+ description: "Ended label",
53
+ defaultMessage: "Avslutades"
54
+ },
55
+ roleLabel: {
56
+ id: "pep.anwers.role.label",
57
+ description: "Role label",
58
+ defaultMessage: "Roll"
59
+ },
60
+ countryLabel: {
61
+ id: "pep.anwers.country.label",
62
+ description: "Country label",
63
+ defaultMessage: "Land"
64
+ },
65
+ ambassadorCountryLabel: {
66
+ id: "pep.anwers.ambassadorCountry.label",
67
+ description: "Ambassador country label",
68
+ defaultMessage: "Ambassadörsland"
69
+ },
70
+ governmentCompanyNameLabel: {
71
+ id: "pep.anwers.governmentCompanyName.label",
72
+ description: "Government company name label",
73
+ defaultMessage: "Företags namn"
74
+ },
75
+ governmentCompanyRoleLabel: {
76
+ id: "pep.anwers.governmentCompanyRole.label",
77
+ description: "Government company role label",
78
+ defaultMessage: "Roll på företaget"
79
+ },
80
+ internationalOrganisationNameLabel: {
81
+ id: "pep.anwers.companyName.label",
82
+ description: "International organisation name label",
83
+ defaultMessage: "Organisationens namn"
84
+ },
85
+ internationalOrganisationRoleLabel: {
86
+ id: "pep.anwers.companyRole.label",
87
+ description: "International organisation role label",
88
+ defaultMessage: "Roll i organisationen"
89
+ },
90
+ militaryGradeLabel: {
91
+ id: "pep.anwers.militaryRank.label",
92
+ description: "Military rank label",
93
+ defaultMessage: "Roll i organisationen"
94
+ }
95
+ });
96
+ export const PepAnswers = ({ answer }) => {
97
+ var _a;
98
+ const intl = useIntl();
99
+ if (!answer.type || answer.type === PepType.NOT_PEP) {
100
+ return (React.createElement("div", null,
101
+ React.createElement("p", null,
102
+ React.createElement(FormattedMessage, { id: "pep.anwers.notpep", description: "Not pep", defaultMessage: "Personen \u00E4r inte PEP" }))));
103
+ }
104
+ const country = countries.find(country => country.value === answer.country);
105
+ const role = getRoleAlts(intl).find(alt => alt.value === answer.role);
106
+ const militaryRank = getMilitaryAlts(intl).find(alt => alt.value === answer.militaryRank);
107
+ return (React.createElement("div", null,
108
+ answer.type && (React.createElement(StaticInput, { label: intl.formatMessage(messages.whoIsPepLabel), value: intl.formatMessage(isPepMessages[answer.type], {
109
+ entityType: EntityType.PERSON
110
+ }) })),
111
+ answer.relationToPEP && (React.createElement(StaticInput, { label: intl.formatMessage(messages.relationLabel), value: intl.formatMessage(relationMessages[answer.relationToPEP]) })),
112
+ answer.businessRelation && (React.createElement(StaticInput, { label: intl.formatMessage(messages.businessRelationLabel), value: intl.formatMessage(businessRelationMessages[answer.businessRelation]) })),
113
+ answer.nameOfPEP && (React.createElement(StaticInput, { label: intl.formatMessage(messages.nameOfPepLabel), value: answer.nameOfPEP })),
114
+ answer.birthdayOfPEP && (React.createElement(StaticInput, { label: intl.formatMessage(messages.birthdayOfPEPLabel), value: answer.birthdayOfPEP })),
115
+ answer.ended ? (React.createElement(React.Fragment, null,
116
+ React.createElement(StaticInput, { label: intl.formatMessage(messages.statusLabel), value: intl.formatMessage(messages.statusEndedValue) }),
117
+ React.createElement(StaticInput, { label: intl.formatMessage(messages.endedLabel), value: answer.ended }))) : (React.createElement(StaticInput, { label: intl.formatMessage(messages.statusLabel), value: intl.formatMessage(messages.statusOngoingValue) })),
118
+ answer.country && (React.createElement(StaticInput, { label: intl.formatMessage(messages.countryLabel), value: country ? country.label : answer.country })),
119
+ role && (React.createElement(StaticInput, { label: intl.formatMessage(messages.roleLabel), value: role.text })),
120
+ answer.ambassadorCountry && (React.createElement(StaticInput, { label: intl.formatMessage(messages.ambassadorCountryLabel), value: ((_a = countries.find(country => country.value === answer.ambassadorCountry)) === null || _a === void 0 ? void 0 : _a.label) || answer.ambassadorCountry })),
121
+ answer.governmentCompany && (React.createElement(StaticInput, { label: intl.formatMessage(messages.governmentCompanyNameLabel), value: answer.governmentCompany })),
122
+ answer.governmentCompanyRole && (React.createElement(StaticInput, { label: intl.formatMessage(messages.governmentCompanyRoleLabel), value: answer.governmentCompanyRole })),
123
+ answer.internationalOrganisation && (React.createElement(StaticInput, { label: intl.formatMessage(messages.internationalOrganisationNameLabel), value: answer.internationalOrganisation })),
124
+ answer.internationalOrganisationRole && (React.createElement(StaticInput, { label: intl.formatMessage(messages.internationalOrganisationRoleLabel), value: answer.internationalOrganisationRole })),
125
+ militaryRank && (React.createElement(StaticInput, { label: intl.formatMessage(messages.militaryGradeLabel), value: militaryRank.value }))));
126
+ };
127
+ const StaticInput = ({ label, value }) => {
128
+ return (React.createElement("div", { className: "static-input" },
129
+ React.createElement("div", { className: "label" }, label),
130
+ React.createElement("div", { className: "value" }, value)));
131
+ };
@@ -1,7 +1,7 @@
1
- .static-input {
2
- margin-bottom: 8px;
3
-
4
- .label {
5
- font-weight: bold;
6
- }
7
- }
1
+ .static-input {
2
+ margin-bottom: 8px;
3
+
4
+ .label {
5
+ font-weight: bold;
6
+ }
7
+ }
@@ -1,4 +1,4 @@
1
- export declare const countries: {
2
- label: string;
3
- value: string;
4
- }[];
1
+ export declare const countries: {
2
+ label: string;
3
+ value: string;
4
+ }[];