@lysaab/lysa-pep 0.3.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/README.md +44 -0
- package/package.json +47 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +2 -0
- package/src/App.css +3 -0
- package/src/App.test.tsx +9 -0
- package/src/App.tsx +25 -0
- package/src/components/CountrySelect.tsx +50 -0
- package/src/demo/Done.tsx +14 -0
- package/src/demo/Pep.tsx +105 -0
- package/src/index.css +13 -0
- package/src/index.tsx +12 -0
- package/src/logo.svg +1 -0
- package/src/model/PepModel.ts +29 -0
- package/src/model/PepTexts.ts +513 -0
- package/src/pages/PepContext.tsx +121 -0
- package/src/pages/PepIsPepPage.tsx +88 -0
- package/src/pages/PepRelationPage.tsx +192 -0
- package/src/pages/PepRolePage.tsx +263 -0
- package/src/pages/PepStatusPage.tsx +142 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/serviceWorker.ts +143 -0
- package/tsconfig.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
2
|
+
|
|
3
|
+
## Available Scripts
|
|
4
|
+
|
|
5
|
+
In the project directory, you can run:
|
|
6
|
+
|
|
7
|
+
### `npm start`
|
|
8
|
+
|
|
9
|
+
Runs the app in the development mode.<br />
|
|
10
|
+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
|
11
|
+
|
|
12
|
+
The page will reload if you make edits.<br />
|
|
13
|
+
You will also see any lint errors in the console.
|
|
14
|
+
|
|
15
|
+
### `npm test`
|
|
16
|
+
|
|
17
|
+
Launches the test runner in the interactive watch mode.<br />
|
|
18
|
+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
19
|
+
|
|
20
|
+
### `npm run build`
|
|
21
|
+
|
|
22
|
+
Builds the app for production to the `build` folder.<br />
|
|
23
|
+
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
24
|
+
|
|
25
|
+
The build is minified and the filenames include the hashes.<br />
|
|
26
|
+
Your app is ready to be deployed!
|
|
27
|
+
|
|
28
|
+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
29
|
+
|
|
30
|
+
### `npm run eject`
|
|
31
|
+
|
|
32
|
+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
|
33
|
+
|
|
34
|
+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
35
|
+
|
|
36
|
+
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
|
37
|
+
|
|
38
|
+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
|
39
|
+
|
|
40
|
+
## Learn More
|
|
41
|
+
|
|
42
|
+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
43
|
+
|
|
44
|
+
To learn React, check out the [React documentation](https://reactjs.org/).
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lysaab/lysa-pep",
|
|
3
|
+
"author": "Lysa AB",
|
|
4
|
+
"version": "0.3.0",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@lysaab/ui-2": "^8.7.0",
|
|
7
|
+
"@types/luxon": "^1.15.2",
|
|
8
|
+
"luxon": "^1.21.1"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@lysaab/ui-2": "^8.7.0",
|
|
12
|
+
"@types/jest": "24.0.20",
|
|
13
|
+
"@types/luxon": "^1.15.2",
|
|
14
|
+
"@types/node": "12.11.7",
|
|
15
|
+
"@types/react": "16.9.11",
|
|
16
|
+
"@types/react-dom": "16.9.3",
|
|
17
|
+
"luxon": "^1.21.1",
|
|
18
|
+
"react": "^16.11.0",
|
|
19
|
+
"react-dom": "^16.11.0",
|
|
20
|
+
"react-scripts": "3.2.0",
|
|
21
|
+
"typescript": "^3.7.2"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"start": "react-scripts start",
|
|
25
|
+
"build": "react-scripts build",
|
|
26
|
+
"test": "react-scripts test",
|
|
27
|
+
"eject": "react-scripts eject",
|
|
28
|
+
"release:patch": "npm run build && npm version patch && npm publish",
|
|
29
|
+
"release:minor": "npm run build && npm version minor && npm publish",
|
|
30
|
+
"release:major": "npm run build && npm version major && npm publish"
|
|
31
|
+
},
|
|
32
|
+
"eslintConfig": {
|
|
33
|
+
"extends": "react-app"
|
|
34
|
+
},
|
|
35
|
+
"browserslist": {
|
|
36
|
+
"production": [
|
|
37
|
+
">0.2%",
|
|
38
|
+
"not dead",
|
|
39
|
+
"not op_mini all"
|
|
40
|
+
],
|
|
41
|
+
"development": [
|
|
42
|
+
"last 1 chrome version",
|
|
43
|
+
"last 1 firefox version",
|
|
44
|
+
"last 1 safari version"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<meta name="theme-color" content="#000000" />
|
|
8
|
+
<meta
|
|
9
|
+
name="description"
|
|
10
|
+
content="Web site created using create-react-app"
|
|
11
|
+
/>
|
|
12
|
+
<link rel="apple-touch-icon" href="logo192.png" />
|
|
13
|
+
<!--
|
|
14
|
+
manifest.json provides metadata used when your web app is installed on a
|
|
15
|
+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
16
|
+
-->
|
|
17
|
+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
18
|
+
<!--
|
|
19
|
+
Notice the use of %PUBLIC_URL% in the tags above.
|
|
20
|
+
It will be replaced with the URL of the `public` folder during the build.
|
|
21
|
+
Only files inside the `public` folder can be referenced from the HTML.
|
|
22
|
+
|
|
23
|
+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
24
|
+
work correctly both with client-side routing and a non-root public URL.
|
|
25
|
+
Learn how to configure a non-root public URL by running `npm run build`.
|
|
26
|
+
-->
|
|
27
|
+
<title>React App</title>
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
31
|
+
<div id="root"></div>
|
|
32
|
+
<!--
|
|
33
|
+
This HTML file is a template.
|
|
34
|
+
If you open it directly in the browser, you will see an empty page.
|
|
35
|
+
|
|
36
|
+
You can add webfonts, meta tags, or analytics to this file.
|
|
37
|
+
The build step will place the bundled scripts into the <body> tag.
|
|
38
|
+
|
|
39
|
+
To begin the development, run `npm start` or `yarn start`.
|
|
40
|
+
To create a production bundle, use `npm run build` or `yarn build`.
|
|
41
|
+
-->
|
|
42
|
+
</body>
|
|
43
|
+
</html>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"short_name": "React App",
|
|
3
|
+
"name": "Create React App Sample",
|
|
4
|
+
"icons": [
|
|
5
|
+
{
|
|
6
|
+
"src": "favicon.ico",
|
|
7
|
+
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
+
"type": "image/x-icon"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"src": "logo192.png",
|
|
12
|
+
"type": "image/png",
|
|
13
|
+
"sizes": "192x192"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"src": "logo512.png",
|
|
17
|
+
"type": "image/png",
|
|
18
|
+
"sizes": "512x512"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"start_url": ".",
|
|
22
|
+
"display": "standalone",
|
|
23
|
+
"theme_color": "#000000",
|
|
24
|
+
"background_color": "#ffffff"
|
|
25
|
+
}
|
package/src/App.css
ADDED
package/src/App.test.tsx
ADDED
package/src/App.tsx
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./App.css";
|
|
3
|
+
import { Pep } from "./demo/Pep";
|
|
4
|
+
import { PepContextProvider } from "./pages/PepContext";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
lysa: { contentPath: string };
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
window.lysa = {
|
|
14
|
+
contentPath: 'https://kund.lysa-test.se'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const App: React.FC = () => {
|
|
18
|
+
return (
|
|
19
|
+
<PepContextProvider>
|
|
20
|
+
<Pep />
|
|
21
|
+
</PepContextProvider>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default App;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useState, useEffect, FunctionComponent } from "react";
|
|
2
|
+
import { Alternative, API, Select } from "@lysaab/ui-2";
|
|
3
|
+
import { ValidationProps } from "@lysaab/ui-2/hooks/useValidation";
|
|
4
|
+
|
|
5
|
+
export interface Country {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function getCountries() {
|
|
11
|
+
return API.get<Country[]>(
|
|
12
|
+
`${window.lysa.contentPath}/content/files/countries.json`,
|
|
13
|
+
undefined,
|
|
14
|
+
{ credentials: "omit", headers: {} }
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface Props extends ValidationProps {
|
|
19
|
+
value?: string;
|
|
20
|
+
onChange?(value: Alternative): void;
|
|
21
|
+
label: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const CountrySelect: FunctionComponent<Props> = ({
|
|
25
|
+
value,
|
|
26
|
+
...props
|
|
27
|
+
}) => {
|
|
28
|
+
const [countries, setCountries] = useState<Alternative[]>([]);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
getCountries().then(response => {
|
|
32
|
+
setCountries(
|
|
33
|
+
response.map(
|
|
34
|
+
(country): Alternative => {
|
|
35
|
+
return { text: country.label, value: country.value };
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
}, [setCountries]);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Select
|
|
44
|
+
alternatives={countries}
|
|
45
|
+
placeholder={"Välj ett land"}
|
|
46
|
+
value={countries.find(country => country.value === value)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { PepContext } from "../pages/PepContext";
|
|
3
|
+
import { formatServerRequest } from "../model/PepModel";
|
|
4
|
+
|
|
5
|
+
export function Done() {
|
|
6
|
+
const pepContext = useContext(PepContext);
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
<h2>Taco hej!</h2>
|
|
10
|
+
<p>Leverpastej!</p>
|
|
11
|
+
<pre>{JSON.stringify(formatServerRequest(pepContext.state), null, 2)}</pre>
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
}
|
package/src/demo/Pep.tsx
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React, { useState, useContext, useEffect, useRef } from "react";
|
|
2
|
+
import { Story } from "@lysaab/ui-2";
|
|
3
|
+
import { PepIsPepPage } from "../pages/PepIsPepPage";
|
|
4
|
+
import { PepStatusPage } from "../pages/PepStatusPage";
|
|
5
|
+
import { PepRolePage } from "../pages/PepRolePage";
|
|
6
|
+
import { PepContext, PepType, EntityType } from "../pages/PepContext";
|
|
7
|
+
import { Done } from "./Done";
|
|
8
|
+
import { PepRelationPage } from "../pages/PepRelationPage";
|
|
9
|
+
|
|
10
|
+
export function Pep() {
|
|
11
|
+
const [page, setPage] = useState(0);
|
|
12
|
+
const pepContext = useContext(PepContext);
|
|
13
|
+
const type = pepContext.state.type;
|
|
14
|
+
const loaded = useRef(false);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if(!loaded.current) {
|
|
18
|
+
pepContext.setState({ ownerName: "Sean Banan", tin: '191212121212' });
|
|
19
|
+
loaded.current = true;
|
|
20
|
+
}
|
|
21
|
+
}, [loaded, pepContext]);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div style={{ maxWidth: "1000px", margin: "0 auto" }}>
|
|
25
|
+
<Story
|
|
26
|
+
header="PEP Lib"
|
|
27
|
+
showBack={page > 0}
|
|
28
|
+
showClose={false}
|
|
29
|
+
onBack={() => {
|
|
30
|
+
if (page === 4 && type === PepType.NOT_PEP) {
|
|
31
|
+
setPage(0);
|
|
32
|
+
} else if (page === 3 && type === PepType.ME) {
|
|
33
|
+
setPage(1);
|
|
34
|
+
} else {
|
|
35
|
+
setPage(page - 1);
|
|
36
|
+
}
|
|
37
|
+
}}
|
|
38
|
+
transitionKey={page.toString()}
|
|
39
|
+
onExit={() => {}}
|
|
40
|
+
>
|
|
41
|
+
{page === 0 ? (
|
|
42
|
+
<PepIsPepPage
|
|
43
|
+
next={() =>
|
|
44
|
+
type !== PepType.NOT_PEP ? setPage(page + 1) : setPage(4)
|
|
45
|
+
}
|
|
46
|
+
/>
|
|
47
|
+
) : null}
|
|
48
|
+
{page === 1 ? (
|
|
49
|
+
<PepStatusPage
|
|
50
|
+
next={() =>
|
|
51
|
+
type === PepType.ME ? setPage(page + 2) : setPage(page + 1)
|
|
52
|
+
}
|
|
53
|
+
/>
|
|
54
|
+
) : null}
|
|
55
|
+
{page === 2 ? <PepRelationPage next={() => setPage(page + 1)} /> : null}
|
|
56
|
+
{page === 3 ? <PepRolePage next={() => setPage(page + 1)} /> : null}
|
|
57
|
+
{page === 4 ? <Done /> : null}
|
|
58
|
+
</Story>
|
|
59
|
+
<hr />
|
|
60
|
+
<fieldset>
|
|
61
|
+
<legend>Konfig</legend>
|
|
62
|
+
<div>
|
|
63
|
+
<label>
|
|
64
|
+
Verkligen huvudman
|
|
65
|
+
<input
|
|
66
|
+
type="checkbox"
|
|
67
|
+
value={"true"}
|
|
68
|
+
onChange={event =>
|
|
69
|
+
pepContext.setState({
|
|
70
|
+
legalEntityType: event.currentTarget.checked
|
|
71
|
+
? EntityType.CORPORATION
|
|
72
|
+
: EntityType.PERSON
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
/>
|
|
76
|
+
</label>
|
|
77
|
+
</div>
|
|
78
|
+
<div>
|
|
79
|
+
<label>
|
|
80
|
+
Namnet på den verkliga huvudmannen
|
|
81
|
+
<input
|
|
82
|
+
type="text"
|
|
83
|
+
value={pepContext.state.ownerName || ''}
|
|
84
|
+
onChange={event =>
|
|
85
|
+
pepContext.setState({ ownerName: event.currentTarget.value })
|
|
86
|
+
}
|
|
87
|
+
/>
|
|
88
|
+
</label>
|
|
89
|
+
</div>
|
|
90
|
+
<div>
|
|
91
|
+
<label>
|
|
92
|
+
Personnummer på huvudmannen
|
|
93
|
+
<input
|
|
94
|
+
type="text"
|
|
95
|
+
value={pepContext.state.tin || ''}
|
|
96
|
+
onChange={event =>
|
|
97
|
+
pepContext.setState({ tin: event.currentTarget.value })
|
|
98
|
+
}
|
|
99
|
+
/>
|
|
100
|
+
</label>
|
|
101
|
+
</div>
|
|
102
|
+
</fieldset>
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
}
|
package/src/index.css
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import './index.css';
|
|
4
|
+
import App from './App';
|
|
5
|
+
import * as serviceWorker from './serviceWorker';
|
|
6
|
+
|
|
7
|
+
ReactDOM.render(<App />, document.getElementById('root'));
|
|
8
|
+
|
|
9
|
+
// If you want your app to work offline and load faster, you can change
|
|
10
|
+
// unregister() to register() below. Note this comes with some pitfalls.
|
|
11
|
+
// Learn more about service workers: https://bit.ly/CRA-PWA
|
|
12
|
+
serviceWorker.unregister();
|
package/src/logo.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 170.96 159.93"><defs><style>.cls-1{fill:#09d3ac;}</style></defs><path class="cls-1" d="M141.35,73.27c0-6.89-8.11-13-20.58-16.73,3-12.67,1.69-22.75-4.28-26.16a9.55,9.55,0,0,0-4.79-1.2c-5.57,0-12.61,3.89-19.72,10.62-7.11-6.68-14.13-10.55-19.69-10.55a9.46,9.46,0,0,0-4.86,1.22c-5.94,3.42-7.17,13.44-4.21,26.05-12.41,3.71-20.48,9.77-20.5,16.63s8.12,13,20.59,16.72c-3,12.68-1.7,22.75,4.28,26.16a9.41,9.41,0,0,0,4.78,1.2c5.58,0,12.62-3.89,19.73-10.62,7.1,6.68,14.12,10.55,19.69,10.55a9.59,9.59,0,0,0,4.86-1.22c5.94-3.42,7.16-13.44,4.21-26C133.27,86.18,141.34,80.12,141.35,73.27ZM96.56,42.06c8.19-7.33,13.31-8.12,15.13-8.12h0a4.71,4.71,0,0,1,2.42.58c2.86,1.63,4,7.38,3.09,15a56.73,56.73,0,0,1-1,5.79,97.7,97.7,0,0,0-12.58-2.07,98.47,98.47,0,0,0-8.24-10.08C95.75,42.79,96.15,42.42,96.56,42.06ZM71.77,78.94c.78,1.5,1.61,3,2.47,4.51S76,86.49,77,88c-2.71-.39-5.34-.88-7.84-1.46C69.86,84,70.75,81.5,71.77,78.94ZM69,59.9c2.53-.59,5.18-1.08,7.93-1.46-1,1.48-1.86,3-2.76,4.59s-1.69,3-2.46,4.52Q70.18,63.65,69,59.9Zm5.21,13.34q1.86-3.93,4.09-7.86c1.5-2.62,3.11-5.17,4.77-7.61,2.91-.22,5.91-.34,9-.33s6,.12,8.89.35c1.66,2.42,3.25,5,4.75,7.55s2.88,5.22,4.12,7.83c-1.23,2.62-2.6,5.25-4.08,7.85s-3.11,5.18-4.77,7.62c-2.91.23-5.91.34-9,.34s-6-.13-8.89-.36c-1.66-2.42-3.26-4.94-4.76-7.55S75.5,75.85,74.25,73.24Zm32.86-14.77c2.72.38,5.35.87,7.84,1.45-.74,2.47-1.62,5-2.64,7.55-.79-1.5-1.61-3-2.48-4.51S108,59.93,107.11,58.47Zm2.76,24.92q1.29-2.27,2.46-4.53c1,2.6,2,5.16,2.7,7.66-2.52.59-5.17,1.07-7.92,1.45Q108.52,85.75,109.87,83.39ZM92,46.56c1.8,1.92,3.57,4,5.3,6.23-1.71-.07-3.46-.12-5.23-.12s-3.58,0-5.33.12C88.45,50.57,90.2,48.48,92,46.56Zm-22.18-12A4.82,4.82,0,0,1,72.29,34a13.11,13.11,0,0,1,5.19,1.31,39.07,39.07,0,0,1,10,6.78l1.17,1.07a98.49,98.49,0,0,0-8.16,10,98.88,98.88,0,0,0-12.65,2.06c-.44-1.94-.8-3.84-1-5.67C65.8,42,67,36.24,69.81,34.6ZM64.53,85.26a58.75,58.75,0,0,1-5.54-2c-7.1-3-11.5-6.85-11.5-10.14S51.91,66,59,63.05a57.63,57.63,0,0,1,5.44-1.94A97.93,97.93,0,0,0,69,73.25,98.72,98.72,0,0,0,64.53,85.26Zm23,19.1c-8.19,7.33-13.31,8.11-15.14,8.11a4.69,4.69,0,0,1-2.42-.58c-2.86-1.63-4-7.38-3.09-15a56.07,56.07,0,0,1,1-5.78,99.51,99.51,0,0,0,12.58,2.06,97.17,97.17,0,0,0,8.24,10.08Zm4.57-4.51c-1.8-1.92-3.57-4-5.31-6.23,1.72.08,3.47.12,5.24.12s3.58,0,5.33-.11C95.63,95.85,93.87,97.93,92.09,99.85Zm22.18,12a4.82,4.82,0,0,1-2.48.59c-1.82,0-7-.8-15.16-8.1l-1.17-1.07a98.44,98.44,0,0,0,8.15-10,97,97,0,0,0,12.66-2.06c.44,1.94.79,3.84,1,5.67C118.27,104.42,117.12,110.18,114.27,111.81Zm10.8-28.44c-1.71.7-3.52,1.35-5.44,1.93a98.54,98.54,0,0,0-4.57-12.14,98.1,98.1,0,0,0,4.49-12,58.75,58.75,0,0,1,5.54,2c7.09,3,11.5,6.85,11.49,10.14S132.17,80.42,125.07,83.37ZM92,82.39a9.18,9.18,0,1,0-9.17-9.19A9.17,9.17,0,0,0,92,82.39ZM31,17.88V128.53H153.07V17.88ZM148.3,123.77H35.78V22.65H148.3Zm-85-33.9c-3,12.68-1.7,22.75,4.28,26.16a9.41,9.41,0,0,0,4.78,1.2c5.58,0,12.62-3.89,19.73-10.62,7.1,6.68,14.12,10.55,19.69,10.55a9.59,9.59,0,0,0,4.86-1.22c5.94-3.42,7.16-13.44,4.21-26,12.41-3.72,20.48-9.78,20.49-16.63s-8.11-13-20.58-16.73c3-12.67,1.69-22.75-4.28-26.16a9.55,9.55,0,0,0-4.79-1.2c-5.57,0-12.61,3.89-19.72,10.62-7.11-6.68-14.13-10.55-19.69-10.55a9.46,9.46,0,0,0-4.86,1.22c-5.94,3.42-7.17,13.44-4.21,26.05-12.41,3.71-20.48,9.77-20.5,16.63S50.84,86.13,63.31,89.87Zm24.21,14.49c-8.19,7.33-13.31,8.11-15.14,8.11a4.69,4.69,0,0,1-2.42-.58c-2.86-1.63-4-7.38-3.09-15a56.07,56.07,0,0,1,1-5.78,99.51,99.51,0,0,0,12.58,2.06,97.17,97.17,0,0,0,8.24,10.08Zm24.79-36.89c-.79-1.5-1.61-3-2.48-4.51s-1.8-3-2.72-4.49c2.72.38,5.35.87,7.84,1.45C114.21,62.39,113.33,64.92,112.31,67.47Zm2.72,19c-2.52.59-5.17,1.07-7.92,1.45q1.41-2.22,2.76-4.58t2.46-4.53C113.37,81.46,114.28,84,115,86.52Zm-5.21-13.35c-1.23,2.62-2.6,5.25-4.08,7.85s-3.11,5.18-4.77,7.62c-2.91.23-5.91.34-9,.34s-6-.13-8.89-.36c-1.66-2.42-3.26-4.94-4.76-7.55s-2.87-5.22-4.12-7.83q1.86-3.93,4.09-7.86c1.5-2.62,3.11-5.17,4.77-7.61,2.91-.22,5.91-.34,9-.33s6,.12,8.89.35c1.66,2.42,3.25,5,4.75,7.55S108.58,70.56,109.82,73.17ZM77,88c-2.71-.39-5.34-.88-7.84-1.46.74-2.46,1.63-5,2.65-7.55.78,1.5,1.61,3,2.47,4.51S76,86.49,77,88ZM74.21,63c-.87,1.5-1.69,3-2.46,4.52Q70.18,63.65,69,59.9c2.53-.59,5.18-1.08,7.93-1.46C76,59.92,75.11,61.45,74.21,63ZM92.09,99.85c-1.8-1.92-3.57-4-5.31-6.23,1.72.08,3.47.12,5.24.12s3.58,0,5.33-.11C95.63,95.85,93.87,97.93,92.09,99.85Zm22.18,12a4.82,4.82,0,0,1-2.48.59c-1.82,0-7-.8-15.16-8.1l-1.17-1.07a98.44,98.44,0,0,0,8.15-10,97,97,0,0,0,12.66-2.06c.44,1.94.79,3.84,1,5.67C118.27,104.42,117.12,110.18,114.27,111.81Zm5.28-50.66a58.75,58.75,0,0,1,5.54,2c7.09,3,11.5,6.85,11.49,10.14s-4.41,7.16-11.51,10.11c-1.71.7-3.52,1.35-5.44,1.93a98.54,98.54,0,0,0-4.57-12.14A98.1,98.1,0,0,0,119.55,61.15Zm-23-19.09c8.19-7.33,13.31-8.12,15.13-8.12h0a4.71,4.71,0,0,1,2.42.58c2.86,1.63,4,7.38,3.09,15a56.73,56.73,0,0,1-1,5.79,97.7,97.7,0,0,0-12.58-2.07,98.47,98.47,0,0,0-8.24-10.08C95.75,42.79,96.15,42.42,96.56,42.06ZM92,46.56c1.8,1.92,3.57,4,5.3,6.23-1.71-.07-3.46-.12-5.23-.12s-3.58,0-5.33.12C88.45,50.57,90.2,48.48,92,46.56Zm-22.18-12A4.82,4.82,0,0,1,72.29,34a13.11,13.11,0,0,1,5.19,1.31,39.07,39.07,0,0,1,10,6.78l1.17,1.07a98.49,98.49,0,0,0-8.16,10,98.88,98.88,0,0,0-12.65,2.06c-.44-1.94-.8-3.84-1-5.67C65.8,42,67,36.24,69.81,34.6ZM59,63.05a57.63,57.63,0,0,1,5.44-1.94A97.93,97.93,0,0,0,69,73.25a98.72,98.72,0,0,0-4.49,12,58.75,58.75,0,0,1-5.54-2c-7.1-3-11.5-6.85-11.5-10.14S51.91,66,59,63.05Zm33,1a9.18,9.18,0,1,0,9.17,9.19A9.17,9.17,0,0,0,92,64Zm0,0a9.18,9.18,0,1,0,9.17,9.19A9.17,9.17,0,0,0,92,64Zm0,0a9.18,9.18,0,1,0,9.17,9.19A9.17,9.17,0,0,0,92,64Zm49.35,9.24c0-6.89-8.11-13-20.58-16.73,3-12.67,1.69-22.75-4.28-26.16a9.55,9.55,0,0,0-4.79-1.2c-5.57,0-12.61,3.89-19.72,10.62-7.11-6.68-14.13-10.55-19.69-10.55a9.46,9.46,0,0,0-4.86,1.22c-5.94,3.42-7.17,13.44-4.21,26.05-12.41,3.71-20.48,9.77-20.5,16.63s8.12,13,20.59,16.72c-3,12.68-1.7,22.75,4.28,26.16a9.41,9.41,0,0,0,4.78,1.2c5.58,0,12.62-3.89,19.73-10.62,7.1,6.68,14.12,10.55,19.69,10.55a9.59,9.59,0,0,0,4.86-1.22c5.94-3.42,7.16-13.44,4.21-26C133.27,86.18,141.34,80.12,141.35,73.27ZM96.56,42.06c8.19-7.33,13.31-8.12,15.13-8.12h0a4.71,4.71,0,0,1,2.42.58c2.86,1.63,4,7.38,3.09,15a56.73,56.73,0,0,1-1,5.79,97.7,97.7,0,0,0-12.58-2.07,98.47,98.47,0,0,0-8.24-10.08C95.75,42.79,96.15,42.42,96.56,42.06ZM71.77,78.94c.78,1.5,1.61,3,2.47,4.51S76,86.49,77,88c-2.71-.39-5.34-.88-7.84-1.46C69.86,84,70.75,81.5,71.77,78.94ZM69,59.9c2.53-.59,5.18-1.08,7.93-1.46-1,1.48-1.86,3-2.76,4.59s-1.69,3-2.46,4.52Q70.18,63.65,69,59.9Zm5.21,13.34q1.86-3.93,4.09-7.86c1.5-2.62,3.11-5.17,4.77-7.61,2.91-.22,5.91-.34,9-.33s6,.12,8.89.35c1.66,2.42,3.25,5,4.75,7.55s2.88,5.22,4.12,7.83c-1.23,2.62-2.6,5.25-4.08,7.85s-3.11,5.18-4.77,7.62c-2.91.23-5.91.34-9,.34s-6-.13-8.89-.36c-1.66-2.42-3.26-4.94-4.76-7.55S75.5,75.85,74.25,73.24Zm32.86-14.77c2.72.38,5.35.87,7.84,1.45-.74,2.47-1.62,5-2.64,7.55-.79-1.5-1.61-3-2.48-4.51S108,59.93,107.11,58.47Zm2.76,24.92q1.29-2.27,2.46-4.53c1,2.6,2,5.16,2.7,7.66-2.52.59-5.17,1.07-7.92,1.45Q108.52,85.75,109.87,83.39ZM92,46.56c1.8,1.92,3.57,4,5.3,6.23-1.71-.07-3.46-.12-5.23-.12s-3.58,0-5.33.12C88.45,50.57,90.2,48.48,92,46.56Zm-22.18-12A4.82,4.82,0,0,1,72.29,34a13.11,13.11,0,0,1,5.19,1.31,39.07,39.07,0,0,1,10,6.78l1.17,1.07a98.49,98.49,0,0,0-8.16,10,98.88,98.88,0,0,0-12.65,2.06c-.44-1.94-.8-3.84-1-5.67C65.8,42,67,36.24,69.81,34.6ZM64.53,85.26a58.75,58.75,0,0,1-5.54-2c-7.1-3-11.5-6.85-11.5-10.14S51.91,66,59,63.05a57.63,57.63,0,0,1,5.44-1.94A97.93,97.93,0,0,0,69,73.25,98.72,98.72,0,0,0,64.53,85.26Zm23,19.1c-8.19,7.33-13.31,8.11-15.14,8.11a4.69,4.69,0,0,1-2.42-.58c-2.86-1.63-4-7.38-3.09-15a56.07,56.07,0,0,1,1-5.78,99.51,99.51,0,0,0,12.58,2.06,97.17,97.17,0,0,0,8.24,10.08Zm4.57-4.51c-1.8-1.92-3.57-4-5.31-6.23,1.72.08,3.47.12,5.24.12s3.58,0,5.33-.11C95.63,95.85,93.87,97.93,92.09,99.85Zm22.18,12a4.82,4.82,0,0,1-2.48.59c-1.82,0-7-.8-15.16-8.1l-1.17-1.07a98.44,98.44,0,0,0,8.15-10,97,97,0,0,0,12.66-2.06c.44,1.94.79,3.84,1,5.67C118.27,104.42,117.12,110.18,114.27,111.81Zm10.8-28.44c-1.71.7-3.52,1.35-5.44,1.93a98.54,98.54,0,0,0-4.57-12.14,98.1,98.1,0,0,0,4.49-12,58.75,58.75,0,0,1,5.54,2c7.09,3,11.5,6.85,11.49,10.14S132.17,80.42,125.07,83.37ZM92,82.39a9.18,9.18,0,1,0-9.17-9.19A9.17,9.17,0,0,0,92,82.39Zm-69.32,54.5V26.2L17.89,31V141.66H139.94l4.78-4.77Z"/></svg>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PepState, PepType } from "../pages/PepContext";
|
|
2
|
+
import { DateTime } from "luxon";
|
|
3
|
+
|
|
4
|
+
export interface PepRequest
|
|
5
|
+
extends Omit<PepState, "isSweden" | "isOngoing" | "ended" | "birthdayOfPEP"> {
|
|
6
|
+
ended?: string;
|
|
7
|
+
birthdayOfPEP?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* Do some minor preprocessing before we are ready to sen everything to the server
|
|
13
|
+
*/
|
|
14
|
+
export function formatServerRequest(pepData: PepState): PepRequest {
|
|
15
|
+
const data = { ...pepData };
|
|
16
|
+
delete data.isSweden;
|
|
17
|
+
delete data.isOngoing;
|
|
18
|
+
delete data.ownerName;
|
|
19
|
+
return {
|
|
20
|
+
...data,
|
|
21
|
+
country: data.type !== PepType.NOT_PEP ? data.country || "SE" : undefined,
|
|
22
|
+
ended: data.ended
|
|
23
|
+
? DateTime.fromJSDate(data.ended).toFormat("yyyy-MM")
|
|
24
|
+
: undefined,
|
|
25
|
+
birthdayOfPEP: data.birthdayOfPEP
|
|
26
|
+
? DateTime.fromJSDate(data.birthdayOfPEP).toFormat("yyyy-MM-dd")
|
|
27
|
+
: undefined
|
|
28
|
+
};
|
|
29
|
+
}
|