@lysaab/lysa-pep 0.11.0 → 0.13.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.
@@ -1,3 +1,4 @@
1
1
  {
2
- "typescript.tsdk": "node_modules/typescript/lib"
2
+ "typescript.tsdk": "node_modules/typescript/lib",
3
+ "editor.formatOnSave": true
3
4
  }
package/lib/Exports.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export * from "./pages/PepContext";
2
- export * from './model/PepModel';
3
- export * from './model/PepTexts';
4
- export { PepIsPepPage } from './pages/PepIsPepPage';
5
- export { PepRelationPage } from './pages/PepRelationPage';
6
- export { PepRolePage, militaryAlternatives, roleAlternatives } from './pages/PepRolePage';
7
- export { PepStatusPage } from './pages/PepStatusPage';
2
+ export * from "./model/PepModel";
3
+ export * from "./model/PepTexts";
4
+ export { PepIsPepPage } 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
1
  export * from "./pages/PepContext";
2
- export * from './model/PepModel';
3
- export * from './model/PepTexts';
4
- export { PepIsPepPage } from './pages/PepIsPepPage';
5
- export { PepRelationPage } from './pages/PepRelationPage';
6
- export { PepRolePage, militaryAlternatives, roleAlternatives } from './pages/PepRolePage';
7
- export { PepStatusPage } from './pages/PepStatusPage';
2
+ export * from "./model/PepModel";
3
+ export * from "./model/PepTexts";
4
+ export { PepIsPepPage } 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";
@@ -9,20 +9,15 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import React, { useState, useEffect } from "react";
13
- import { API, Select } from "@lysaab/ui-2";
14
- function getCountries() {
15
- return API.get(`${window.lysa.contentPath}/content/files/countries.json`, undefined, { credentials: "omit", headers: {} });
16
- }
12
+ import React, { useState } from "react";
13
+ import { Select } from "@lysaab/ui-2";
14
+ import { countries } from "../model/Countries";
17
15
  export const CountrySelect = (_a) => {
18
16
  var { value, removeSweden = false } = _a, props = __rest(_a, ["value", "removeSweden"]);
19
- const [countries, setCountries] = useState([]);
20
- useEffect(() => {
21
- getCountries().then(response => {
22
- setCountries(response.filter(country => !(removeSweden && country.value === 'SE')).map((country) => {
23
- return { text: country.label, value: country.value };
24
- }));
25
- });
26
- }, [setCountries, removeSweden]);
27
- return (React.createElement(Select, Object.assign({ alternatives: countries, placeholder: "Välj ett land", value: countries.find(country => country.value === value) }, props)));
17
+ const [countryAlternatives] = useState(countries
18
+ .filter(country => !(removeSweden && country.value === "SE"))
19
+ .map((country) => {
20
+ return { text: country.label, value: country.value };
21
+ }));
22
+ return (React.createElement(Select, Object.assign({ alternatives: countryAlternatives, placeholder: "Välj ett land", value: countryAlternatives.find(country => country.value === value) }, props)));
28
23
  };
@@ -0,0 +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 {};
@@ -0,0 +1,38 @@
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, "Inte PEP");
10
+ }
11
+ const labels = LABELS("");
12
+ const country = countries.find(country => country.value === answer.country);
13
+ const role = roleAlternatives.find(alt => alt.value === answer.role);
14
+ const militaryRank = militaryAlternatives.find(alt => alt.value === answer.militaryRank);
15
+ return (React.createElement("div", null,
16
+ answer.type && (React.createElement(StaticInput, { label: "Vem \u00E4r pep", value: labels[EntityType.PERSON].GENERIC.IS_PEP[answer.type] })),
17
+ answer.relationToPEP && (React.createElement(StaticInput, { label: "Relation", value: labels[EntityType.PERSON][PepType.RELATIVE].RELATION[answer.relationToPEP] })),
18
+ answer.businessRelation && (React.createElement(StaticInput, { label: "Relation", value: labels[EntityType.PERSON][PepType.COLLEAGUE].BUSINESS_RELATION[answer.businessRelation] })),
19
+ answer.nameOfPEP && (React.createElement(StaticInput, { label: "Namn p\u00E5 personen", value: answer.nameOfPEP })),
20
+ answer.birthdayOfPEP && (React.createElement(StaticInput, { label: "F\u00F6delsedag f\u00F6r personen", value: answer.birthdayOfPEP })),
21
+ answer.ended ? (React.createElement(React.Fragment, null,
22
+ React.createElement(StaticInput, { label: "Status", value: "Avslutad" }),
23
+ React.createElement(StaticInput, { label: "Avslutades", value: answer.ended }))) : (React.createElement(StaticInput, { label: "Status", value: "P\u00E5g\u00E5ende" })),
24
+ answer.birthdayOfPEP && (React.createElement(StaticInput, { label: "Roll", value: answer.birthdayOfPEP })),
25
+ answer.country && (React.createElement(StaticInput, { label: "Land", value: country ? country.label : answer.country })),
26
+ role && React.createElement(StaticInput, { label: "Roll", value: role.text }),
27
+ answer.ambassadorCountry && (React.createElement(StaticInput, { label: "Ambassad\u00F6rsland", value: answer.ambassadorCountry })),
28
+ answer.governmentCompany && (React.createElement(StaticInput, { label: "F\u00F6retagets namn", value: answer.governmentCompany })),
29
+ answer.governmentCompanyRole && (React.createElement(StaticInput, { label: "Roll p\u00E5 f\u00F6retaget", value: answer.governmentCompanyRole })),
30
+ answer.internationalOrganisation && (React.createElement(StaticInput, { label: "Organisationens namn", value: answer.internationalOrganisation })),
31
+ answer.internationalOrganisationRole && (React.createElement(StaticInput, { label: "Roll i organisationen", value: answer.internationalOrganisationRole })),
32
+ militaryRank && (React.createElement(StaticInput, { label: "Milit\u00E4r grad", value: militaryRank.value }))));
33
+ };
34
+ const StaticInput = ({ label, value }) => {
35
+ return (React.createElement("div", { className: "static-input" },
36
+ React.createElement("div", { className: "label" }, label),
37
+ React.createElement("div", { className: "value" }, value)));
38
+ };
@@ -0,0 +1,4 @@
1
+ export declare const countries: {
2
+ label: string;
3
+ value: string;
4
+ }[];