@lysaab/lysa-pep 0.3.0 → 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.
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@lysaab/lysa-pep",
3
3
  "author": "Lysa AB",
4
- "version": "0.3.0",
4
+ "version": "0.4.0",
5
+ "main": "./lib/Exports.js",
5
6
  "dependencies": {
6
7
  "@lysaab/ui-2": "^8.7.0",
7
8
  "@types/luxon": "^1.15.2",
@@ -14,6 +15,7 @@
14
15
  "@types/node": "12.11.7",
15
16
  "@types/react": "16.9.11",
16
17
  "@types/react-dom": "16.9.3",
18
+ "copyfiles": "^2.1.1",
17
19
  "luxon": "^1.21.1",
18
20
  "react": "^16.11.0",
19
21
  "react-dom": "^16.11.0",
@@ -25,9 +27,11 @@
25
27
  "build": "react-scripts build",
26
28
  "test": "react-scripts test",
27
29
  "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"
30
+ "build:lib": "tsc -p ./tsconfig_build.json ",
31
+ "copyscss": "copyfiles -u 1 \"src/components/**/*.scss\" lib/",
32
+ "release:patch": "npm run build:lib && npm version patch && npm publish",
33
+ "release:minor": "npm run build:lib && npm version minor && npm publish",
34
+ "release:major": "npm run build:lib && npm version major && npm publish"
31
35
  },
32
36
  "eslintConfig": {
33
37
  "extends": "react-app"
package/src/Exports.ts ADDED
@@ -0,0 +1,18 @@
1
+ export {
2
+ BusinessRelation,
3
+ EntityType,
4
+ MilitaryRank,
5
+ PepContext,
6
+ PepContextProps,
7
+ PepContextProvider,
8
+ PepState,
9
+ PepStatus,
10
+ PepType,
11
+ Relation,
12
+ Role
13
+ } from "./pages/PepContext";
14
+
15
+ export { PepIsPepPage } from './pages/PepIsPepPage';
16
+ export { PepRelationPage } from './pages/PepRelationPage';
17
+ export { PepRolePage } from './pages/PepRolePage';
18
+ export { PepStatusPage } from './pages/PepStatusPage';
@@ -2,6 +2,12 @@ import React, { useState, useEffect, FunctionComponent } from "react";
2
2
  import { Alternative, API, Select } from "@lysaab/ui-2";
3
3
  import { ValidationProps } from "@lysaab/ui-2/hooks/useValidation";
4
4
 
5
+ declare global {
6
+ interface Window {
7
+ lysa: { contentPath: string };
8
+ }
9
+ }
10
+
5
11
  export interface Country {
6
12
  label: string;
7
13
  value: string;
package/src/demo/Pep.tsx CHANGED
@@ -15,7 +15,7 @@ export function Pep() {
15
15
 
16
16
  useEffect(() => {
17
17
  if(!loaded.current) {
18
- pepContext.setState({ ownerName: "Sean Banan", tin: '191212121212' });
18
+ pepContext.setState({ ownerName: "Sean Banan", tin: '191212121212', legalEntityType: EntityType.PERSON });
19
19
  loaded.current = true;
20
20
  }
21
21
  }, [loaded, pepContext]);
@@ -1,4 +1,4 @@
1
- import { PepState, PepType } from "../pages/PepContext";
1
+ import { PepState, PepType, EntityType } from "../pages/PepContext";
2
2
  import { DateTime } from "luxon";
3
3
 
4
4
  export interface PepRequest
@@ -16,6 +16,9 @@ export function formatServerRequest(pepData: PepState): PepRequest {
16
16
  delete data.isSweden;
17
17
  delete data.isOngoing;
18
18
  delete data.ownerName;
19
+ if(data.legalEntityType === EntityType.PERSON) {
20
+ delete data.tin;
21
+ }
19
22
  return {
20
23
  ...data,
21
24
  country: data.type !== PepType.NOT_PEP ? data.country || "SE" : undefined,
@@ -173,9 +173,9 @@ export const PepRolePage: FunctionComponent<Props> = ({ next }) => {
173
173
  pepContext.state.businessRelation,
174
174
  pepContext.state.ownerName
175
175
  )}
176
- value={pepContext.state.internationalOrganisation || ""}
176
+ value={pepContext.state.governmentCompany || ""}
177
177
  onChange={event => {
178
- pepContext.setState({ internationalOrganisation: event.value });
178
+ pepContext.setState({ governmentCompany: event.value });
179
179
  }}
180
180
  validators={[RequiredValidator("Du måste ange ett namn")]}
181
181
  />
@@ -187,10 +187,10 @@ export const PepRolePage: FunctionComponent<Props> = ({ next }) => {
187
187
  pepContext.state.businessRelation,
188
188
  pepContext.state.ownerName
189
189
  )}
190
- value={pepContext.state.internationalOrganisationRole || ""}
190
+ value={pepContext.state.governmentCompanyRole || ""}
191
191
  onChange={event => {
192
192
  pepContext.setState({
193
- internationalOrganisationRole: event.value
193
+ governmentCompanyRole: event.value
194
194
  });
195
195
  }}
196
196
  validators={[RequiredValidator("Du måste ange roll")]}
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["dom", "dom.iterable", "esnext"],
4
+ "skipLibCheck": true,
5
+ "esModuleInterop": true,
6
+ "target": "ES2015",
7
+ "module": "esnext",
8
+ "declaration": true,
9
+ "outDir": "lib",
10
+ "strict": true,
11
+ "removeComments": true,
12
+ "jsx": "react",
13
+ "allowSyntheticDefaultImports": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "moduleResolution": "node",
16
+ "resolveJsonModule": true
17
+ },
18
+ "include": ["src/Exports.ts"]
19
+ }