@lysaab/lysa-pep 0.14.0 → 0.14.1

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,79 +1,79 @@
1
- import React, { FunctionComponent } from "react";
2
- export declare enum EntityType {
3
- PERSON = "PERSON",
4
- CORPORATION = "CORPORATION"
5
- }
6
- export declare enum PepType {
7
- NOT_PEP = "NOT_PEP",
8
- ME = "ME",
9
- RELATIVE = "RELATIVE",
10
- COLLEAGUE = "COLLEAGUE"
11
- }
12
- export declare enum PepStatus {
13
- ONGOING = "ONGOING",
14
- ENDED = "ENDED"
15
- }
16
- export declare enum Role {
17
- HEAD_OF_GOVERNMENT = "HEAD_OF_GOVERNMENT",
18
- MINISTER = "MINISTER",
19
- PARLIMENT_MEMBER = "PARLIMENT_MEMBER",
20
- CENTRAL_BANK_MEMBER = "CENTRAL_BANK_MEMBER",
21
- BOARD_MEMBER_POLITICAL_PARTY = "BOARD_MEMBER_POLITICAL_PARTY",
22
- JUDGE_SUPREME_COURT = "JUDGE_SUPREME_COURT",
23
- JUDGE_OTHER_HIGH_COURT = "JUDGE_OTHER_HIGH_COURT",
24
- REVISION_INSTITUTE = "REVISION_INSTITUTE",
25
- AMBASSADOR = "AMBASSADOR",
26
- MILITARY_OFFICER = "MILITARY_OFFICER",
27
- GOVERNMENT_COMPANY = "GOVERNMENT_COMPANY",
28
- EU_HIGH_RANKING_POSITION = "EU_HIGH_RANKING_POSITION",
29
- HIGH_RANKING_POSITION_INTERNALTIONAL_CORP = "HIGH_RANKING_POSITION_INTERNALTIONAL_CORP"
30
- }
31
- export declare enum Relation {
32
- MARRIED_PARTNER = "MARRIED_PARTNER",
33
- COLIVING_PARTNER = "COLIVING_PARTNER",
34
- CHILD = "CHILD",
35
- PARENT = "PARENT",
36
- CHILD_MARRIED_PARTNER = "CHILD_MARRIED_PARTNER",
37
- CHILD_COLIVING_PARTNER = "CHILD_COLIVING_PARTNER"
38
- }
39
- export declare enum BusinessRelation {
40
- CO_OWNERSHIP = "CO_OWNERSHIP",
41
- CLOSE_CONNECTION = "CLOSE_CONNECTION",
42
- COMPANY_FOR_PEP = "COMPANY_FOR_PEP"
43
- }
44
- export declare enum MilitaryRank {
45
- GENERAL = "GENERAL",
46
- LIEUTENANT_GENERAL = "LIEUTENANT_GENERAL",
47
- MAJOR_GENERAL = "MAJOR_GENERAL",
48
- ADMIRAL = "ADMIRAL",
49
- VICE_ADMIRAL = "VICE_ADMIRAL",
50
- REAR_ADMIRAL = "REAR_ADMIRAL"
51
- }
52
- export interface PepState {
53
- legalEntityType?: EntityType;
54
- type?: PepType;
55
- role?: Role;
56
- country?: string;
57
- ended?: Date;
58
- ambassadorCountry?: string;
59
- militaryRank?: MilitaryRank;
60
- governmentCompany?: string;
61
- governmentCompanyRole?: string;
62
- internationalOrganisation?: string;
63
- internationalOrganisationRole?: string;
64
- relationToPEP?: Relation;
65
- nameOfPEP?: string;
66
- birthdayOfPEP?: Date;
67
- tin?: string;
68
- businessRelation?: BusinessRelation;
69
- isOngoing?: PepStatus;
70
- isSweden?: string;
71
- ownerName?: string;
72
- }
73
- export interface PepContextProps {
74
- state: PepState;
75
- setState: (newState: Partial<PepState>) => void;
76
- }
77
- export declare const PepContext: React.Context<PepContextProps>;
78
- export declare const withPep: <P extends object>(Component: React.ComponentType<P>) => React.FC<Pick<P, Exclude<keyof P, "state" | "setState">>>;
79
- export declare const PepContextProvider: FunctionComponent;
1
+ import React, { FunctionComponent } from "react";
2
+ export declare enum EntityType {
3
+ PERSON = "PERSON",
4
+ CORPORATION = "CORPORATION"
5
+ }
6
+ export declare enum PepType {
7
+ NOT_PEP = "NOT_PEP",
8
+ ME = "ME",
9
+ RELATIVE = "RELATIVE",
10
+ COLLEAGUE = "COLLEAGUE"
11
+ }
12
+ export declare enum PepStatus {
13
+ ONGOING = "ONGOING",
14
+ ENDED = "ENDED"
15
+ }
16
+ export declare enum Role {
17
+ HEAD_OF_GOVERNMENT = "HEAD_OF_GOVERNMENT",
18
+ MINISTER = "MINISTER",
19
+ PARLIMENT_MEMBER = "PARLIMENT_MEMBER",
20
+ CENTRAL_BANK_MEMBER = "CENTRAL_BANK_MEMBER",
21
+ BOARD_MEMBER_POLITICAL_PARTY = "BOARD_MEMBER_POLITICAL_PARTY",
22
+ JUDGE_SUPREME_COURT = "JUDGE_SUPREME_COURT",
23
+ JUDGE_OTHER_HIGH_COURT = "JUDGE_OTHER_HIGH_COURT",
24
+ REVISION_INSTITUTE = "REVISION_INSTITUTE",
25
+ AMBASSADOR = "AMBASSADOR",
26
+ MILITARY_OFFICER = "MILITARY_OFFICER",
27
+ GOVERNMENT_COMPANY = "GOVERNMENT_COMPANY",
28
+ EU_HIGH_RANKING_POSITION = "EU_HIGH_RANKING_POSITION",
29
+ HIGH_RANKING_POSITION_INTERNALTIONAL_CORP = "HIGH_RANKING_POSITION_INTERNALTIONAL_CORP"
30
+ }
31
+ export declare enum Relation {
32
+ MARRIED_PARTNER = "MARRIED_PARTNER",
33
+ COLIVING_PARTNER = "COLIVING_PARTNER",
34
+ CHILD = "CHILD",
35
+ PARENT = "PARENT",
36
+ CHILD_MARRIED_PARTNER = "CHILD_MARRIED_PARTNER",
37
+ CHILD_COLIVING_PARTNER = "CHILD_COLIVING_PARTNER"
38
+ }
39
+ export declare enum BusinessRelation {
40
+ CO_OWNERSHIP = "CO_OWNERSHIP",
41
+ CLOSE_CONNECTION = "CLOSE_CONNECTION",
42
+ COMPANY_FOR_PEP = "COMPANY_FOR_PEP"
43
+ }
44
+ export declare enum MilitaryRank {
45
+ GENERAL = "GENERAL",
46
+ LIEUTENANT_GENERAL = "LIEUTENANT_GENERAL",
47
+ MAJOR_GENERAL = "MAJOR_GENERAL",
48
+ ADMIRAL = "ADMIRAL",
49
+ VICE_ADMIRAL = "VICE_ADMIRAL",
50
+ REAR_ADMIRAL = "REAR_ADMIRAL"
51
+ }
52
+ export interface PepState {
53
+ legalEntityType?: EntityType;
54
+ type?: PepType;
55
+ role?: Role;
56
+ country?: string;
57
+ ended?: Date;
58
+ ambassadorCountry?: string;
59
+ militaryRank?: MilitaryRank;
60
+ governmentCompany?: string;
61
+ governmentCompanyRole?: string;
62
+ internationalOrganisation?: string;
63
+ internationalOrganisationRole?: string;
64
+ relationToPEP?: Relation;
65
+ nameOfPEP?: string;
66
+ birthdayOfPEP?: Date;
67
+ tin?: string;
68
+ businessRelation?: BusinessRelation;
69
+ isOngoing?: PepStatus;
70
+ isSweden?: string;
71
+ ownerName?: string;
72
+ }
73
+ export interface PepContextProps {
74
+ state: PepState;
75
+ setState: (newState: Partial<PepState>) => void;
76
+ }
77
+ export declare const PepContext: React.Context<PepContextProps>;
78
+ export declare const withPep: <P extends object>(Component: React.ComponentType<P>) => React.FC<Pick<P, Exclude<keyof P, "state" | "setState">>>;
79
+ export declare const PepContextProvider: FunctionComponent;
@@ -1,67 +1,67 @@
1
- import React, { useReducer } from "react";
2
- export var EntityType;
3
- (function (EntityType) {
4
- EntityType["PERSON"] = "PERSON";
5
- EntityType["CORPORATION"] = "CORPORATION";
6
- })(EntityType || (EntityType = {}));
7
- export var PepType;
8
- (function (PepType) {
9
- PepType["NOT_PEP"] = "NOT_PEP";
10
- PepType["ME"] = "ME";
11
- PepType["RELATIVE"] = "RELATIVE";
12
- PepType["COLLEAGUE"] = "COLLEAGUE";
13
- })(PepType || (PepType = {}));
14
- export var PepStatus;
15
- (function (PepStatus) {
16
- PepStatus["ONGOING"] = "ONGOING";
17
- PepStatus["ENDED"] = "ENDED";
18
- })(PepStatus || (PepStatus = {}));
19
- export var Role;
20
- (function (Role) {
21
- Role["HEAD_OF_GOVERNMENT"] = "HEAD_OF_GOVERNMENT";
22
- Role["MINISTER"] = "MINISTER";
23
- Role["PARLIMENT_MEMBER"] = "PARLIMENT_MEMBER";
24
- Role["CENTRAL_BANK_MEMBER"] = "CENTRAL_BANK_MEMBER";
25
- Role["BOARD_MEMBER_POLITICAL_PARTY"] = "BOARD_MEMBER_POLITICAL_PARTY";
26
- Role["JUDGE_SUPREME_COURT"] = "JUDGE_SUPREME_COURT";
27
- Role["JUDGE_OTHER_HIGH_COURT"] = "JUDGE_OTHER_HIGH_COURT";
28
- Role["REVISION_INSTITUTE"] = "REVISION_INSTITUTE";
29
- Role["AMBASSADOR"] = "AMBASSADOR";
30
- Role["MILITARY_OFFICER"] = "MILITARY_OFFICER";
31
- Role["GOVERNMENT_COMPANY"] = "GOVERNMENT_COMPANY";
32
- Role["EU_HIGH_RANKING_POSITION"] = "EU_HIGH_RANKING_POSITION";
33
- Role["HIGH_RANKING_POSITION_INTERNALTIONAL_CORP"] = "HIGH_RANKING_POSITION_INTERNALTIONAL_CORP";
34
- })(Role || (Role = {}));
35
- export var Relation;
36
- (function (Relation) {
37
- Relation["MARRIED_PARTNER"] = "MARRIED_PARTNER";
38
- Relation["COLIVING_PARTNER"] = "COLIVING_PARTNER";
39
- Relation["CHILD"] = "CHILD";
40
- Relation["PARENT"] = "PARENT";
41
- Relation["CHILD_MARRIED_PARTNER"] = "CHILD_MARRIED_PARTNER";
42
- Relation["CHILD_COLIVING_PARTNER"] = "CHILD_COLIVING_PARTNER";
43
- })(Relation || (Relation = {}));
44
- export var BusinessRelation;
45
- (function (BusinessRelation) {
46
- BusinessRelation["CO_OWNERSHIP"] = "CO_OWNERSHIP";
47
- BusinessRelation["CLOSE_CONNECTION"] = "CLOSE_CONNECTION";
48
- BusinessRelation["COMPANY_FOR_PEP"] = "COMPANY_FOR_PEP";
49
- })(BusinessRelation || (BusinessRelation = {}));
50
- export var MilitaryRank;
51
- (function (MilitaryRank) {
52
- MilitaryRank["GENERAL"] = "GENERAL";
53
- MilitaryRank["LIEUTENANT_GENERAL"] = "LIEUTENANT_GENERAL";
54
- MilitaryRank["MAJOR_GENERAL"] = "MAJOR_GENERAL";
55
- MilitaryRank["ADMIRAL"] = "ADMIRAL";
56
- MilitaryRank["VICE_ADMIRAL"] = "VICE_ADMIRAL";
57
- MilitaryRank["REAR_ADMIRAL"] = "REAR_ADMIRAL";
58
- })(MilitaryRank || (MilitaryRank = {}));
59
- export const PepContext = React.createContext({});
60
- export const withPep = (Component) => props => (React.createElement(PepContext.Consumer, null, contextProps => React.createElement(Component, Object.assign({}, props, contextProps))));
61
- function stateReducer(state, newState) {
62
- return Object.assign(Object.assign({}, state), newState);
63
- }
64
- export const PepContextProvider = ({ children }) => {
65
- const [pep, setPep] = useReducer(stateReducer, {});
66
- return (React.createElement(PepContext.Provider, { value: { state: pep, setState: setPep } }, children));
67
- };
1
+ import React, { useReducer } from "react";
2
+ export var EntityType;
3
+ (function (EntityType) {
4
+ EntityType["PERSON"] = "PERSON";
5
+ EntityType["CORPORATION"] = "CORPORATION";
6
+ })(EntityType || (EntityType = {}));
7
+ export var PepType;
8
+ (function (PepType) {
9
+ PepType["NOT_PEP"] = "NOT_PEP";
10
+ PepType["ME"] = "ME";
11
+ PepType["RELATIVE"] = "RELATIVE";
12
+ PepType["COLLEAGUE"] = "COLLEAGUE";
13
+ })(PepType || (PepType = {}));
14
+ export var PepStatus;
15
+ (function (PepStatus) {
16
+ PepStatus["ONGOING"] = "ONGOING";
17
+ PepStatus["ENDED"] = "ENDED";
18
+ })(PepStatus || (PepStatus = {}));
19
+ export var Role;
20
+ (function (Role) {
21
+ Role["HEAD_OF_GOVERNMENT"] = "HEAD_OF_GOVERNMENT";
22
+ Role["MINISTER"] = "MINISTER";
23
+ Role["PARLIMENT_MEMBER"] = "PARLIMENT_MEMBER";
24
+ Role["CENTRAL_BANK_MEMBER"] = "CENTRAL_BANK_MEMBER";
25
+ Role["BOARD_MEMBER_POLITICAL_PARTY"] = "BOARD_MEMBER_POLITICAL_PARTY";
26
+ Role["JUDGE_SUPREME_COURT"] = "JUDGE_SUPREME_COURT";
27
+ Role["JUDGE_OTHER_HIGH_COURT"] = "JUDGE_OTHER_HIGH_COURT";
28
+ Role["REVISION_INSTITUTE"] = "REVISION_INSTITUTE";
29
+ Role["AMBASSADOR"] = "AMBASSADOR";
30
+ Role["MILITARY_OFFICER"] = "MILITARY_OFFICER";
31
+ Role["GOVERNMENT_COMPANY"] = "GOVERNMENT_COMPANY";
32
+ Role["EU_HIGH_RANKING_POSITION"] = "EU_HIGH_RANKING_POSITION";
33
+ Role["HIGH_RANKING_POSITION_INTERNALTIONAL_CORP"] = "HIGH_RANKING_POSITION_INTERNALTIONAL_CORP";
34
+ })(Role || (Role = {}));
35
+ export var Relation;
36
+ (function (Relation) {
37
+ Relation["MARRIED_PARTNER"] = "MARRIED_PARTNER";
38
+ Relation["COLIVING_PARTNER"] = "COLIVING_PARTNER";
39
+ Relation["CHILD"] = "CHILD";
40
+ Relation["PARENT"] = "PARENT";
41
+ Relation["CHILD_MARRIED_PARTNER"] = "CHILD_MARRIED_PARTNER";
42
+ Relation["CHILD_COLIVING_PARTNER"] = "CHILD_COLIVING_PARTNER";
43
+ })(Relation || (Relation = {}));
44
+ export var BusinessRelation;
45
+ (function (BusinessRelation) {
46
+ BusinessRelation["CO_OWNERSHIP"] = "CO_OWNERSHIP";
47
+ BusinessRelation["CLOSE_CONNECTION"] = "CLOSE_CONNECTION";
48
+ BusinessRelation["COMPANY_FOR_PEP"] = "COMPANY_FOR_PEP";
49
+ })(BusinessRelation || (BusinessRelation = {}));
50
+ export var MilitaryRank;
51
+ (function (MilitaryRank) {
52
+ MilitaryRank["GENERAL"] = "GENERAL";
53
+ MilitaryRank["LIEUTENANT_GENERAL"] = "LIEUTENANT_GENERAL";
54
+ MilitaryRank["MAJOR_GENERAL"] = "MAJOR_GENERAL";
55
+ MilitaryRank["ADMIRAL"] = "ADMIRAL";
56
+ MilitaryRank["VICE_ADMIRAL"] = "VICE_ADMIRAL";
57
+ MilitaryRank["REAR_ADMIRAL"] = "REAR_ADMIRAL";
58
+ })(MilitaryRank || (MilitaryRank = {}));
59
+ export const PepContext = React.createContext({});
60
+ export const withPep = (Component) => props => (React.createElement(PepContext.Consumer, null, contextProps => React.createElement(Component, Object.assign({}, props, contextProps))));
61
+ function stateReducer(state, newState) {
62
+ return Object.assign(Object.assign({}, state), newState);
63
+ }
64
+ export const PepContextProvider = ({ children }) => {
65
+ const [pep, setPep] = useReducer(stateReducer, {});
66
+ return (React.createElement(PepContext.Provider, { value: { state: pep, setState: setPep } }, children));
67
+ };
@@ -1,6 +1,6 @@
1
- import { FunctionComponent } from "react";
2
- interface Props {
3
- next: () => void;
4
- }
5
- export declare const PepIsPepPage: FunctionComponent<Props>;
6
- export {};
1
+ import { FunctionComponent } from "react";
2
+ interface Props {
3
+ next: () => void;
4
+ }
5
+ export declare const PepIsPepPage: FunctionComponent<Props>;
6
+ export {};
@@ -1,57 +1,55 @@
1
- import React, { useRef, useCallback, useContext } from "react";
2
- import { Form, RadioGroup, RequiredValidator, PrimaryButton } from "@lysaab/ui-2";
3
- import { PepType, PepContext, EntityType } from "./PepContext";
4
- import { LABELS } from "../model/PepTexts";
5
- export const PepIsPepPage = ({ next }) => {
6
- const pepContext = useContext(PepContext);
7
- const formRef = useRef();
8
- const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
9
- const labels = LABELS(pepContext.state.ownerName);
10
- const IsPepAlternatives = [
11
- {
12
- text: labels[entityType].GENERIC.IS_PEP[PepType.NOT_PEP],
13
- value: PepType.NOT_PEP
14
- },
15
- { text: labels[entityType].GENERIC.IS_PEP[PepType.ME], value: PepType.ME },
16
- {
17
- text: labels[entityType].GENERIC.IS_PEP[PepType.RELATIVE],
18
- value: PepType.RELATIVE
19
- },
20
- {
21
- text: labels[entityType].GENERIC.IS_PEP[PepType.COLLEAGUE],
22
- value: PepType.COLLEAGUE
23
- }
24
- ];
25
- const nextPage = useCallback(() => {
26
- if (formRef.current && formRef.current.isValid) {
27
- next();
28
- }
29
- }, [formRef, next]);
30
- const resetValues = useCallback(() => {
31
- pepContext.setState({
32
- ambassadorCountry: undefined,
33
- birthdayOfPEP: undefined,
34
- businessRelation: undefined,
35
- country: undefined,
36
- ended: undefined,
37
- governmentCompany: undefined,
38
- governmentCompanyRole: undefined,
39
- internationalOrganisation: undefined,
40
- internationalOrganisationRole: undefined,
41
- isOngoing: undefined,
42
- isSweden: undefined,
43
- militaryRank: undefined,
44
- nameOfPEP: undefined,
45
- relationToPEP: undefined,
46
- role: undefined
47
- });
48
- }, [pepContext]);
49
- return (React.createElement(Form, { onSubmit: () => nextPage(), lysaFormRef: formRef },
50
- React.createElement(RadioGroup, { alternatives: IsPepAlternatives, onChange: event => {
51
- pepContext.setState({
52
- type: event.value ? event.value.value : undefined
53
- });
54
- resetValues();
55
- }, value: IsPepAlternatives.find(alt => alt.value === pepContext.state.type), header: labels[entityType].GENERIC.IS_PEP_HEADER, validators: [RequiredValidator("Du måste välja ett alternativ")] }),
56
- React.createElement(PrimaryButton, { type: "submit" }, "N\u00E4sta")));
57
- };
1
+ import React, { useRef, useCallback, useContext, } from "react";
2
+ import { Form, RadioGroup, RequiredValidator, PrimaryButton, } from "@lysaab/ui-2";
3
+ import { PepType, PepContext, EntityType } from "./PepContext";
4
+ import { LABELS } from "../model/PepTexts";
5
+ export const PepIsPepPage = ({ next }) => {
6
+ const pepContext = useContext(PepContext);
7
+ const formRef = useRef();
8
+ const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
9
+ const labels = LABELS(pepContext.state.ownerName);
10
+ const IsPepAlternatives = [
11
+ {
12
+ text: labels[entityType].GENERIC.IS_PEP[PepType.NOT_PEP],
13
+ value: PepType.NOT_PEP,
14
+ },
15
+ { text: labels[entityType].GENERIC.IS_PEP[PepType.ME], value: PepType.ME },
16
+ {
17
+ text: labels[entityType].GENERIC.IS_PEP[PepType.RELATIVE],
18
+ value: PepType.RELATIVE,
19
+ },
20
+ {
21
+ text: labels[entityType].GENERIC.IS_PEP[PepType.COLLEAGUE],
22
+ value: PepType.COLLEAGUE,
23
+ },
24
+ ];
25
+ const nextPage = useCallback(() => {
26
+ if (formRef.current && formRef.current.isValid) {
27
+ next();
28
+ }
29
+ }, [formRef, next]);
30
+ const resetValues = useCallback(() => {
31
+ pepContext.setState({
32
+ ambassadorCountry: undefined,
33
+ birthdayOfPEP: undefined,
34
+ businessRelation: undefined,
35
+ country: undefined,
36
+ ended: undefined,
37
+ governmentCompany: undefined,
38
+ governmentCompanyRole: undefined,
39
+ internationalOrganisation: undefined,
40
+ internationalOrganisationRole: undefined,
41
+ isOngoing: undefined,
42
+ isSweden: undefined,
43
+ militaryRank: undefined,
44
+ nameOfPEP: undefined,
45
+ relationToPEP: undefined,
46
+ role: undefined,
47
+ });
48
+ }, [pepContext]);
49
+ return (React.createElement(Form, { onSubmit: () => nextPage(), lysaFormRef: formRef },
50
+ React.createElement(RadioGroup, { alternatives: IsPepAlternatives, onChange: alternative => {
51
+ pepContext.setState({ type: alternative.value });
52
+ resetValues();
53
+ }, value: IsPepAlternatives.find(alt => alt.value === pepContext.state.type), header: labels[entityType].GENERIC.IS_PEP_HEADER, validators: [RequiredValidator("Du måste välja ett alternativ")] }),
54
+ React.createElement(PrimaryButton, { type: "submit" }, "N\u00E4sta")));
55
+ };
@@ -1,6 +1,6 @@
1
- import { FunctionComponent } from "react";
2
- interface Props {
3
- next: () => void;
4
- }
5
- export declare const PepRelationPage: FunctionComponent<Props>;
6
- export {};
1
+ import { FunctionComponent } from "react";
2
+ interface Props {
3
+ next: () => void;
4
+ }
5
+ export declare const PepRelationPage: FunctionComponent<Props>;
6
+ export {};
@@ -1,83 +1,79 @@
1
- import React, { useContext, useRef, useCallback } from "react";
2
- import { PepContext, PepType, BusinessRelation, Relation, EntityType } from "./PepContext";
3
- import { RadioGroup, Form, RequiredValidator, TextInput, Datepicker, PrimaryButton } from "@lysaab/ui-2";
4
- import { LABELS } from "../model/PepTexts";
5
- import { DateTime } from "luxon";
6
- const DATEPICKER_START_DATE = DateTime.fromISO("1970-01-01").toJSDate();
7
- export const PepRelationPage = ({ next }) => {
8
- const pepContext = useContext(PepContext);
9
- const formRef = useRef();
10
- const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
11
- const type = pepContext.state.type;
12
- const labels = LABELS(pepContext.state.ownerName);
13
- const businessRelationAlternatives = [
14
- {
15
- text: labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION[BusinessRelation.CO_OWNERSHIP],
16
- value: BusinessRelation.CO_OWNERSHIP
17
- },
18
- {
19
- text: labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION[BusinessRelation.CLOSE_CONNECTION],
20
- value: BusinessRelation.CLOSE_CONNECTION
21
- },
22
- {
23
- text: labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION[BusinessRelation.COMPANY_FOR_PEP],
24
- value: BusinessRelation.COMPANY_FOR_PEP
25
- }
26
- ];
27
- const relationAlternatives = [
28
- {
29
- text: labels[entityType][PepType.RELATIVE].RELATION[Relation.MARRIED_PARTNER],
30
- value: Relation.MARRIED_PARTNER
31
- },
32
- {
33
- text: labels[entityType][PepType.RELATIVE].RELATION[Relation.COLIVING_PARTNER],
34
- value: Relation.COLIVING_PARTNER
35
- },
36
- {
37
- text: labels[entityType][PepType.RELATIVE].RELATION[Relation.CHILD],
38
- value: Relation.CHILD
39
- },
40
- {
41
- text: labels[entityType][PepType.RELATIVE].RELATION[Relation.PARENT],
42
- value: Relation.PARENT
43
- },
44
- {
45
- text: labels[entityType][PepType.RELATIVE].RELATION[Relation.CHILD_MARRIED_PARTNER],
46
- value: Relation.CHILD_MARRIED_PARTNER
47
- },
48
- {
49
- text: labels[entityType][PepType.RELATIVE].RELATION[Relation.CHILD_COLIVING_PARTNER],
50
- value: Relation.CHILD_COLIVING_PARTNER
51
- }
52
- ];
53
- const nextPage = useCallback(() => {
54
- if (formRef.current && formRef.current.isValid) {
55
- next();
56
- }
57
- }, [formRef, next]);
58
- return (React.createElement(Form, { onSubmit: () => nextPage(), lysaFormRef: formRef },
59
- type === PepType.RELATIVE ? (React.createElement(RadioGroup, { alternatives: relationAlternatives, onChange: event => {
60
- pepContext.setState({
61
- relationToPEP: event.value
62
- ? event.value.value
63
- : undefined
64
- });
65
- }, value: relationAlternatives.find(alt => alt.value === pepContext.state.relationToPEP), header: labels[entityType][PepType.RELATIVE].RELATION_LABEL, validators: [RequiredValidator("Du måste välja ett alternativ")] })) : null,
66
- type === PepType.COLLEAGUE ? (React.createElement(RadioGroup, { alternatives: businessRelationAlternatives, onChange: event => {
67
- pepContext.setState({
68
- businessRelation: event.value
69
- ? event.value.value
70
- : undefined
71
- });
72
- }, value: businessRelationAlternatives.find(alt => alt.value === pepContext.state.businessRelation), header: labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION_LABEL, validators: [RequiredValidator("Du måste välja ett alternativ")] })) : null,
73
- pepContext.state.relationToPEP && type === PepType.RELATIVE ? (React.createElement(React.Fragment, null,
74
- React.createElement(TextInput, { label: labels[entityType][type].NAME_LABEL[pepContext.state.relationToPEP], value: pepContext.state.nameOfPEP || "", onChange: event => {
75
- pepContext.setState({ nameOfPEP: event.value });
76
- }, validators: [RequiredValidator("Du måste ange namn")] }),
77
- React.createElement(Datepicker, { label: labels[entityType][type].BIRTH_LABEL[pepContext.state.relationToPEP], selected: pepContext.state.birthdayOfPEP, onChange: event => pepContext.setState({ birthdayOfPEP: event || undefined }), validators: [RequiredValidator("Ange datum")], maxDate: new Date(), openToDate: pepContext.state.birthdayOfPEP || DATEPICKER_START_DATE }))) : null,
78
- pepContext.state.businessRelation && type === PepType.COLLEAGUE ? (React.createElement(React.Fragment, null,
79
- React.createElement(TextInput, { label: labels[entityType][type].NAME_LABEL[pepContext.state.businessRelation], value: pepContext.state.nameOfPEP || "", onChange: event => {
80
- pepContext.setState({ nameOfPEP: event.value });
81
- }, validators: [RequiredValidator("Du måste ange namn")] }))) : null,
82
- React.createElement(PrimaryButton, { type: "submit" }, "N\u00E4sta")));
83
- };
1
+ import React, { useContext, useRef, useCallback, } from "react";
2
+ import { PepContext, PepType, BusinessRelation, Relation, EntityType, } from "./PepContext";
3
+ import { RadioGroup, Form, RequiredValidator, TextInput, Datepicker, PrimaryButton, } from "@lysaab/ui-2";
4
+ import { LABELS } from "../model/PepTexts";
5
+ import { DateTime } from "luxon";
6
+ const DATEPICKER_START_DATE = DateTime.fromISO("1970-01-01").toJSDate();
7
+ export const PepRelationPage = ({ next }) => {
8
+ const pepContext = useContext(PepContext);
9
+ const formRef = useRef();
10
+ const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
11
+ const type = pepContext.state.type;
12
+ const labels = LABELS(pepContext.state.ownerName);
13
+ const businessRelationAlternatives = [
14
+ {
15
+ text: labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION[BusinessRelation.CO_OWNERSHIP],
16
+ value: BusinessRelation.CO_OWNERSHIP,
17
+ },
18
+ {
19
+ text: labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION[BusinessRelation.CLOSE_CONNECTION],
20
+ value: BusinessRelation.CLOSE_CONNECTION,
21
+ },
22
+ {
23
+ text: labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION[BusinessRelation.COMPANY_FOR_PEP],
24
+ value: BusinessRelation.COMPANY_FOR_PEP,
25
+ },
26
+ ];
27
+ const relationAlternatives = [
28
+ {
29
+ text: labels[entityType][PepType.RELATIVE].RELATION[Relation.MARRIED_PARTNER],
30
+ value: Relation.MARRIED_PARTNER,
31
+ },
32
+ {
33
+ text: labels[entityType][PepType.RELATIVE].RELATION[Relation.COLIVING_PARTNER],
34
+ value: Relation.COLIVING_PARTNER,
35
+ },
36
+ {
37
+ text: labels[entityType][PepType.RELATIVE].RELATION[Relation.CHILD],
38
+ value: Relation.CHILD,
39
+ },
40
+ {
41
+ text: labels[entityType][PepType.RELATIVE].RELATION[Relation.PARENT],
42
+ value: Relation.PARENT,
43
+ },
44
+ {
45
+ text: labels[entityType][PepType.RELATIVE].RELATION[Relation.CHILD_MARRIED_PARTNER],
46
+ value: Relation.CHILD_MARRIED_PARTNER,
47
+ },
48
+ {
49
+ text: labels[entityType][PepType.RELATIVE].RELATION[Relation.CHILD_COLIVING_PARTNER],
50
+ value: Relation.CHILD_COLIVING_PARTNER,
51
+ },
52
+ ];
53
+ const nextPage = useCallback(() => {
54
+ if (formRef.current && formRef.current.isValid) {
55
+ next();
56
+ }
57
+ }, [formRef, next]);
58
+ return (React.createElement(Form, { onSubmit: () => nextPage(), lysaFormRef: formRef },
59
+ type === PepType.RELATIVE ? (React.createElement(RadioGroup, { alternatives: relationAlternatives, onChange: alternative => {
60
+ pepContext.setState({
61
+ relationToPEP: alternative.value,
62
+ });
63
+ }, value: relationAlternatives.find(alt => alt.value === pepContext.state.relationToPEP), header: labels[entityType][PepType.RELATIVE].RELATION_LABEL, validators: [RequiredValidator("Du måste välja ett alternativ")] })) : null,
64
+ type === PepType.COLLEAGUE ? (React.createElement(RadioGroup, { alternatives: businessRelationAlternatives, onChange: alternative => {
65
+ pepContext.setState({
66
+ businessRelation: alternative.value,
67
+ });
68
+ }, value: businessRelationAlternatives.find(alt => alt.value === pepContext.state.businessRelation), header: labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION_LABEL, validators: [RequiredValidator("Du måste välja ett alternativ")] })) : null,
69
+ pepContext.state.relationToPEP && type === PepType.RELATIVE ? (React.createElement(React.Fragment, null,
70
+ React.createElement(TextInput, { label: labels[entityType][type].NAME_LABEL[pepContext.state.relationToPEP], value: pepContext.state.nameOfPEP || "", onChange: value => {
71
+ pepContext.setState({ nameOfPEP: value });
72
+ }, validators: [RequiredValidator("Du måste ange namn")] }),
73
+ React.createElement(Datepicker, { label: labels[entityType][type].BIRTH_LABEL[pepContext.state.relationToPEP], selected: pepContext.state.birthdayOfPEP, onChange: event => pepContext.setState({ birthdayOfPEP: event || undefined }), validators: [RequiredValidator("Ange datum")], maxDate: new Date(), openToDate: pepContext.state.birthdayOfPEP || DATEPICKER_START_DATE }))) : null,
74
+ pepContext.state.businessRelation && type === PepType.COLLEAGUE ? (React.createElement(React.Fragment, null,
75
+ React.createElement(TextInput, { label: labels[entityType][type].NAME_LABEL[pepContext.state.businessRelation], value: pepContext.state.nameOfPEP || "", onChange: value => {
76
+ pepContext.setState({ nameOfPEP: value });
77
+ }, validators: [RequiredValidator("Du måste ange namn")] }))) : null,
78
+ React.createElement(PrimaryButton, { type: "submit" }, "N\u00E4sta")));
79
+ };
@@ -1,9 +1,10 @@
1
- import { FunctionComponent } from "react";
2
- import { Alternative } from "@lysaab/ui-2/components/input/InputAPI";
3
- interface Props {
4
- next: () => void;
5
- }
6
- export declare const roleAlternatives: Alternative[];
7
- export declare const militaryAlternatives: Alternative[];
8
- export declare const PepRolePage: FunctionComponent<Props>;
9
- export {};
1
+ import { FunctionComponent } from "react";
2
+ import { Alternative } from "@lysaab/ui-2/components/input/InputAPI";
3
+ import { Role, MilitaryRank } from "./PepContext";
4
+ interface Props {
5
+ next: () => void;
6
+ }
7
+ export declare const roleAlternatives: Alternative<Role>[];
8
+ export declare const militaryAlternatives: Alternative<MilitaryRank>[];
9
+ export declare const PepRolePage: FunctionComponent<Props>;
10
+ export {};