@lysaab/lysa-pep 1.0.0-1 → 1.0.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 (62) hide show
  1. package/lib/Exports.d.ts +8 -7
  2. package/lib/Exports.js +8 -7
  3. package/lib/components/CountrySelect.d.ts +22 -15
  4. package/lib/components/CountrySelect.js +21 -30
  5. package/lib/components/PepAnswers.d.ts +8 -8
  6. package/lib/components/PepAnswers.js +39 -131
  7. package/lib/components/PepAnswers.scss +7 -7
  8. package/lib/model/Countries.d.ts +4 -4
  9. package/lib/model/Countries.js +1002 -1002
  10. package/lib/model/PepModel.d.ts +7 -7
  11. package/lib/model/PepModel.js +40 -40
  12. package/lib/model/PepTexts.d.ts +380 -322
  13. package/lib/model/PepTexts.js +552 -467
  14. package/lib/pages/PepContext.d.ts +80 -80
  15. package/lib/pages/PepContext.js +88 -88
  16. package/lib/pages/PepIsPepPage.d.ts +15 -6
  17. package/lib/pages/PepIsPepPage.js +59 -57
  18. package/lib/pages/PepRelationPage.d.ts +6 -6
  19. package/lib/pages/PepRelationPage.js +79 -83
  20. package/lib/pages/PepRolePage.d.ts +10 -9
  21. package/lib/pages/PepRolePage.js +127 -127
  22. package/lib/pages/PepStatusPage.d.ts +6 -6
  23. package/lib/pages/PepStatusPage.js +58 -57
  24. package/package.json +53 -56
  25. package/src/Exports.ts +13 -12
  26. package/src/components/CountrySelect.tsx +43 -47
  27. package/src/components/PepAnswers.scss +7 -7
  28. package/src/components/PepAnswers.tsx +120 -252
  29. package/src/demo/Done.tsx +20 -16
  30. package/src/demo/Pep.tsx +106 -112
  31. package/src/model/PepModel.ts +52 -52
  32. package/src/model/PepTexts.ts +607 -0
  33. package/src/pages/PepContext.tsx +144 -144
  34. package/src/pages/PepIsPepPage.tsx +107 -0
  35. package/src/pages/PepRelationPage.tsx +188 -0
  36. package/src/pages/PepRolePage.tsx +272 -0
  37. package/src/pages/PepStatusPage.tsx +157 -0
  38. package/.vscode/settings.json +0 -4
  39. package/lib/pages/IsPep/IsPepMessages.d.ts +0 -32
  40. package/lib/pages/IsPep/IsPepMessages.js +0 -74
  41. package/lib/pages/IsPep/IsPepPage.d.ts +0 -14
  42. package/lib/pages/IsPep/IsPepPage.js +0 -39
  43. package/lib/pages/RelationPage/RelationMessages.d.ts +0 -105
  44. package/lib/pages/RelationPage/RelationMessages.js +0 -282
  45. package/lib/pages/RelationPage/RelationPage.d.ts +0 -6
  46. package/lib/pages/RelationPage/RelationPage.js +0 -142
  47. package/lib/pages/RolePage/RoleMessages.d.ts +0 -185
  48. package/lib/pages/RolePage/RoleMessages.js +0 -381
  49. package/lib/pages/RolePage/RolePage.d.ts +0 -11
  50. package/lib/pages/RolePage/RolePage.js +0 -214
  51. package/lib/pages/StatusPage/StatusMessages.d.ts +0 -72
  52. package/lib/pages/StatusPage/StatusMessages.js +0 -74
  53. package/lib/pages/StatusPage/StatusPage.d.ts +0 -6
  54. package/lib/pages/StatusPage/StatusPage.js +0 -75
  55. package/src/pages/IsPep/IsPepMessages.ts +0 -75
  56. package/src/pages/IsPep/IsPepPage.tsx +0 -94
  57. package/src/pages/RelationPage/RelationMessages.ts +0 -287
  58. package/src/pages/RelationPage/RelationPage.tsx +0 -269
  59. package/src/pages/RolePage/RoleMessages.ts +0 -389
  60. package/src/pages/RolePage/RolePage.tsx +0 -342
  61. package/src/pages/StatusPage/StatusMessages.ts +0 -80
  62. package/src/pages/StatusPage/StatusPage.tsx +0 -172
package/lib/Exports.d.ts CHANGED
@@ -1,7 +1,8 @@
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 "./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";
package/lib/Exports.js CHANGED
@@ -1,7 +1,8 @@
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 "./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,15 +1,22 @@
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
+ 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,30 +1,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
+ 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,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,131 +1,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
+ 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,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
+ }[];