@lysaab/lysa-pep 1.0.0 → 1.0.2-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 (65) hide show
  1. package/.vscode/settings.json +4 -0
  2. package/lib/Exports.d.ts +7 -8
  3. package/lib/Exports.js +7 -8
  4. package/lib/components/CountrySelect.d.ts +15 -22
  5. package/lib/components/CountrySelect.js +30 -21
  6. package/lib/components/PepAnswers.d.ts +8 -8
  7. package/lib/components/PepAnswers.js +131 -39
  8. package/lib/components/PepAnswers.scss +7 -7
  9. package/lib/model/Countries.d.ts +4 -4
  10. package/lib/model/Countries.js +1002 -1002
  11. package/lib/model/PepModel.d.ts +7 -7
  12. package/lib/model/PepModel.js +40 -40
  13. package/lib/model/PepTexts.d.ts +322 -380
  14. package/lib/model/PepTexts.js +467 -552
  15. package/lib/pages/IsPep/IsPepMessages.d.ts +32 -0
  16. package/lib/pages/IsPep/IsPepMessages.js +66 -0
  17. package/lib/pages/IsPep/IsPepPage.d.ts +14 -0
  18. package/lib/pages/IsPep/IsPepPage.js +59 -0
  19. package/lib/pages/PepContext.d.ts +80 -80
  20. package/lib/pages/PepContext.js +88 -88
  21. package/lib/pages/PepIsPepPage.d.ts +6 -15
  22. package/lib/pages/PepIsPepPage.js +57 -59
  23. package/lib/pages/PepRelationPage.d.ts +6 -6
  24. package/lib/pages/PepRelationPage.js +83 -79
  25. package/lib/pages/PepRolePage.d.ts +9 -10
  26. package/lib/pages/PepRolePage.js +127 -127
  27. package/lib/pages/PepStatusPage.d.ts +6 -6
  28. package/lib/pages/PepStatusPage.js +57 -58
  29. package/lib/pages/RelationPage/RelationMessages.d.ts +105 -0
  30. package/lib/pages/RelationPage/RelationMessages.js +283 -0
  31. package/lib/pages/RelationPage/RelationPage.d.ts +6 -0
  32. package/lib/pages/RelationPage/RelationPage.js +153 -0
  33. package/lib/pages/RolePage/RoleMessages.d.ts +185 -0
  34. package/lib/pages/RolePage/RoleMessages.js +385 -0
  35. package/lib/pages/RolePage/RolePage.d.ts +11 -0
  36. package/lib/pages/RolePage/RolePage.js +220 -0
  37. package/lib/pages/StatusPage/StatusMessages.d.ts +72 -0
  38. package/lib/pages/StatusPage/StatusMessages.js +266 -0
  39. package/lib/pages/StatusPage/StatusPage.d.ts +6 -0
  40. package/lib/pages/StatusPage/StatusPage.js +95 -0
  41. package/lib/utils/Possession.d.ts +1 -0
  42. package/lib/utils/Possession.js +18 -0
  43. package/package.json +57 -53
  44. package/src/Exports.ts +12 -13
  45. package/src/components/CountrySelect.tsx +47 -43
  46. package/src/components/PepAnswers.scss +7 -7
  47. package/src/components/PepAnswers.tsx +252 -120
  48. package/src/demo/Done.tsx +16 -20
  49. package/src/demo/Pep.tsx +112 -106
  50. package/src/model/PepModel.ts +52 -52
  51. package/src/pages/IsPep/IsPepMessages.ts +67 -0
  52. package/src/pages/IsPep/IsPepPage.tsx +114 -0
  53. package/src/pages/PepContext.tsx +144 -144
  54. package/src/pages/RelationPage/RelationMessages.ts +288 -0
  55. package/src/pages/RelationPage/RelationPage.tsx +299 -0
  56. package/src/pages/RolePage/RoleMessages.ts +393 -0
  57. package/src/pages/RolePage/RolePage.tsx +356 -0
  58. package/src/pages/StatusPage/StatusMessages.ts +272 -0
  59. package/src/pages/StatusPage/StatusPage.tsx +207 -0
  60. package/src/utils/Possession.ts +21 -0
  61. package/src/model/PepTexts.ts +0 -607
  62. package/src/pages/PepIsPepPage.tsx +0 -107
  63. package/src/pages/PepRelationPage.tsx +0 -188
  64. package/src/pages/PepRolePage.tsx +0 -272
  65. package/src/pages/PepStatusPage.tsx +0 -157
@@ -0,0 +1,32 @@
1
+ export declare const messages: {
2
+ header: {
3
+ id: string;
4
+ description: string;
5
+ defaultMessage: string;
6
+ };
7
+ required: {
8
+ id: string;
9
+ description: string;
10
+ defaultMessage: string;
11
+ };
12
+ NOT_PEP: {
13
+ id: string;
14
+ description: string;
15
+ defaultMessage: string;
16
+ };
17
+ ME: {
18
+ id: string;
19
+ description: string;
20
+ defaultMessage: string;
21
+ };
22
+ RELATIVE: {
23
+ id: string;
24
+ description: string;
25
+ defaultMessage: string;
26
+ };
27
+ COLLEAGUE: {
28
+ id: string;
29
+ description: string;
30
+ defaultMessage: string;
31
+ };
32
+ };
@@ -0,0 +1,66 @@
1
+ import { defineMessages } from "react-intl";
2
+ import { PepType } from "../PepContext";
3
+ export const messages = defineMessages({
4
+ header: {
5
+ id: "pep.ispep.header",
6
+ description: "Not pep",
7
+ defaultMessage: `{
8
+ entityType, select,
9
+ PERSON {
10
+ Är du eller en närstående till dig en person i politisk utsatt ställning? (PEP)
11
+ }
12
+ CORPORATION {
13
+ Är {name} eller en närstående till {name} en person i politisk utsatt ställning? (PEP)
14
+ }
15
+ }`,
16
+ },
17
+ required: {
18
+ id: "pep.ispep.required",
19
+ description: "Not pep",
20
+ defaultMessage: "Du måste välja ett alternativ",
21
+ },
22
+ [PepType.NOT_PEP]: {
23
+ id: "pep.ispep.NOT_PEP",
24
+ description: "Not pep",
25
+ defaultMessage: "Nej",
26
+ },
27
+ [PepType.ME]: {
28
+ id: "pep.ispep.ME",
29
+ description: "The person is pep",
30
+ defaultMessage: `{
31
+ entityType, select,
32
+ PERSON {
33
+ Jag har en funktion som gör mig till PEP
34
+ }
35
+ CORPORATION {
36
+ På grund av sin funktion är {name} PEP
37
+ }
38
+ }`,
39
+ },
40
+ [PepType.RELATIVE]: {
41
+ id: "pep.ispep.RELATIVE",
42
+ description: "Jag har en relation med en person som är PEP",
43
+ defaultMessage: `{
44
+ entityType, select,
45
+ PERSON {
46
+ Jag har en relation med en person som är PEP
47
+ }
48
+ CORPORATION {
49
+ {name} är medarbetare till, eller har en affärsrelation med, en person som är PEP
50
+ }
51
+ }`,
52
+ },
53
+ [PepType.COLLEAGUE]: {
54
+ id: "pep.ispep.COLLEAGUE",
55
+ description: "The person has a colleague that is pep",
56
+ defaultMessage: `{
57
+ entityType, select,
58
+ PERSON {
59
+ Jag är medarbetare till, eller har en affärsrelation med, en person som är PEP
60
+ }
61
+ CORPORATION {
62
+ På grund av sin funktion är {name} PEP
63
+ }
64
+ }`,
65
+ },
66
+ });
@@ -0,0 +1,14 @@
1
+ import { FunctionComponent } from "react";
2
+ import { PepType, EntityType } from "../PepContext";
3
+ export interface ExternalIsPepState {
4
+ ownerName: string;
5
+ entityType: EntityType;
6
+ type?: PepType;
7
+ onChange: (type: PepType) => void;
8
+ }
9
+ interface Props {
10
+ next?: () => void;
11
+ }
12
+ export declare const IsPepRadioGroup: FunctionComponent<ExternalIsPepState>;
13
+ export declare const IsPepPage: FunctionComponent<Props>;
14
+ export {};
@@ -0,0 +1,59 @@
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 { useIntl, FormattedMessage } from "react-intl";
5
+ import { messages } from "./IsPepMessages";
6
+ export const IsPepRadioGroup = ({ ownerName, entityType, type, onChange, }) => {
7
+ const intl = useIntl();
8
+ const IsPepAlternatives = [
9
+ {
10
+ text: intl.formatMessage(messages[PepType.NOT_PEP], {
11
+ entityType,
12
+ name: ownerName,
13
+ }),
14
+ value: PepType.NOT_PEP,
15
+ },
16
+ {
17
+ text: intl.formatMessage(messages[PepType.ME], {
18
+ entityType,
19
+ name: ownerName,
20
+ }),
21
+ value: PepType.ME,
22
+ },
23
+ {
24
+ text: intl.formatMessage(messages[PepType.RELATIVE], {
25
+ entityType,
26
+ name: ownerName,
27
+ }),
28
+ value: PepType.RELATIVE,
29
+ },
30
+ {
31
+ text: intl.formatMessage(messages[PepType.COLLEAGUE], {
32
+ entityType,
33
+ name: ownerName,
34
+ }),
35
+ value: PepType.COLLEAGUE,
36
+ },
37
+ ];
38
+ return (React.createElement(RadioGroup, { alternatives: IsPepAlternatives, onChange: (alt) => onChange(alt.value), value: IsPepAlternatives.find((alt) => alt.value === type), header: intl.formatMessage(messages.header, {
39
+ entityType,
40
+ name: ownerName,
41
+ }), validators: [
42
+ new RequiredValidator(intl.formatMessage(messages.required)),
43
+ ] }));
44
+ };
45
+ export const IsPepPage = ({ next }) => {
46
+ const pepContext = useContext(PepContext);
47
+ const formRef = useRef();
48
+ const nextPage = useCallback(() => {
49
+ if (formRef.current && formRef.current.isValid && next) {
50
+ next();
51
+ }
52
+ }, [formRef, next]);
53
+ return (React.createElement(Form, { onSubmit: nextPage, lysaFormRef: formRef },
54
+ React.createElement(IsPepRadioGroup, { entityType: pepContext.state.legalEntityType || EntityType.PERSON, ownerName: pepContext.state.ownerName || "", type: pepContext.state.type, onChange: (type) => {
55
+ pepContext.setState({ type });
56
+ } }),
57
+ React.createElement(PrimaryButton, { type: "submit" },
58
+ React.createElement(FormattedMessage, { id: "pep.ispep.next", description: "Next button", defaultMessage: "G\u00E5 vidare" }))));
59
+ };
@@ -1,80 +1,80 @@
1
- import React 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 declare const EMPTY_PEP_STATE: PepState;
74
- export interface PepContextProps {
75
- state: PepState;
76
- setState: (newState: Partial<PepState>) => void;
77
- }
78
- export declare const PepContext: React.Context<PepContextProps>;
79
- export declare const withPep: <P extends object>(Component: React.ComponentType<P>) => React.FC<Pick<P, Exclude<keyof P, "state" | "setState">>>;
80
- export declare const PepContextProvider: React.FC;
1
+ import React 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 declare const EMPTY_PEP_STATE: PepState;
74
+ export interface PepContextProps {
75
+ state: PepState;
76
+ setState: (newState: Partial<PepState>) => void;
77
+ }
78
+ export declare const PepContext: React.Context<PepContextProps>;
79
+ export declare const withPep: <P extends object>(Component: React.ComponentType<P>) => React.FC<Pick<P, Exclude<keyof P, "state" | "setState">>>;
80
+ export declare const PepContextProvider: React.FC;
@@ -1,88 +1,88 @@
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 EMPTY_PEP_STATE = {
60
- legalEntityType: undefined,
61
- type: undefined,
62
- role: undefined,
63
- country: undefined,
64
- ended: undefined,
65
- ambassadorCountry: undefined,
66
- militaryRank: undefined,
67
- governmentCompany: undefined,
68
- governmentCompanyRole: undefined,
69
- internationalOrganisation: undefined,
70
- internationalOrganisationRole: undefined,
71
- relationToPEP: undefined,
72
- nameOfPEP: undefined,
73
- birthdayOfPEP: undefined,
74
- tin: undefined,
75
- businessRelation: undefined,
76
- isOngoing: undefined,
77
- isSweden: undefined,
78
- ownerName: undefined,
79
- };
80
- export const PepContext = React.createContext({});
81
- export const withPep = (Component) => props => (React.createElement(PepContext.Consumer, null, contextProps => React.createElement(Component, Object.assign({}, props, contextProps))));
82
- function stateReducer(state, newState) {
83
- return Object.assign(Object.assign({}, state), newState);
84
- }
85
- export const PepContextProvider = ({ children }) => {
86
- const [pep, setPep] = useReducer(stateReducer, {});
87
- return (React.createElement(PepContext.Provider, { value: { state: pep, setState: setPep } }, children));
88
- };
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 EMPTY_PEP_STATE = {
60
+ legalEntityType: undefined,
61
+ type: undefined,
62
+ role: undefined,
63
+ country: undefined,
64
+ ended: undefined,
65
+ ambassadorCountry: undefined,
66
+ militaryRank: undefined,
67
+ governmentCompany: undefined,
68
+ governmentCompanyRole: undefined,
69
+ internationalOrganisation: undefined,
70
+ internationalOrganisationRole: undefined,
71
+ relationToPEP: undefined,
72
+ nameOfPEP: undefined,
73
+ birthdayOfPEP: undefined,
74
+ tin: undefined,
75
+ businessRelation: undefined,
76
+ isOngoing: undefined,
77
+ isSweden: undefined,
78
+ ownerName: undefined,
79
+ };
80
+ export const PepContext = React.createContext({});
81
+ export const withPep = (Component) => props => (React.createElement(PepContext.Consumer, null, contextProps => React.createElement(Component, Object.assign({}, props, contextProps))));
82
+ function stateReducer(state, newState) {
83
+ return Object.assign(Object.assign({}, state), newState);
84
+ }
85
+ export const PepContextProvider = ({ children }) => {
86
+ const [pep, setPep] = useReducer(stateReducer, {});
87
+ return (React.createElement(PepContext.Provider, { value: { state: pep, setState: setPep } }, children));
88
+ };
@@ -1,15 +1,6 @@
1
- import React from "react";
2
- import { PepType, EntityType } from "./PepContext";
3
- interface QuestionsProps {
4
- ownerName?: string;
5
- legalEntityType?: EntityType;
6
- type?: PepType;
7
- onChange: (type: PepType) => void;
8
- resetValues?: () => void;
9
- }
10
- export declare const PepIsPepQuestions: React.FC<QuestionsProps>;
11
- interface Props {
12
- next: () => void;
13
- }
14
- export declare const PepIsPepPage: React.FC<Props>;
15
- export {};
1
+ import { FunctionComponent } from "react";
2
+ interface Props {
3
+ next: () => void;
4
+ }
5
+ export declare const PepIsPepPage: FunctionComponent<Props>;
6
+ export {};
@@ -1,59 +1,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 PepIsPepQuestions = ({ ownerName, legalEntityType, type, onChange, resetValues, }) => {
6
- const labels = LABELS(ownerName);
7
- const entityType = legalEntityType || EntityType.PERSON;
8
- const IsPepAlternatives = [
9
- {
10
- text: labels[entityType].GENERIC.IS_PEP[PepType.NOT_PEP],
11
- value: PepType.NOT_PEP,
12
- },
13
- { text: labels[entityType].GENERIC.IS_PEP[PepType.ME], value: PepType.ME },
14
- {
15
- text: labels[entityType].GENERIC.IS_PEP[PepType.RELATIVE],
16
- value: PepType.RELATIVE,
17
- },
18
- {
19
- text: labels[entityType].GENERIC.IS_PEP[PepType.COLLEAGUE],
20
- value: PepType.COLLEAGUE,
21
- },
22
- ];
23
- return (React.createElement(RadioGroup, { alternatives: IsPepAlternatives, onChange: (alternative) => {
24
- var _a;
25
- onChange(alternative.value);
26
- (_a = resetValues) === null || _a === void 0 ? void 0 : _a();
27
- }, value: IsPepAlternatives.find((alt) => alt.value === type), header: labels[entityType].GENERIC.IS_PEP_HEADER, validators: [new RequiredValidator("Du måste välja ett alternativ")] }));
28
- };
29
- export const PepIsPepPage = ({ next }) => {
30
- const pepContext = useContext(PepContext);
31
- const formRef = useRef();
32
- const nextPage = useCallback(() => {
33
- if (formRef.current && formRef.current.isValid) {
34
- next();
35
- }
36
- }, [formRef, next]);
37
- const resetValues = useCallback(() => {
38
- pepContext.setState({
39
- ambassadorCountry: undefined,
40
- birthdayOfPEP: undefined,
41
- businessRelation: undefined,
42
- country: undefined,
43
- ended: undefined,
44
- governmentCompany: undefined,
45
- governmentCompanyRole: undefined,
46
- internationalOrganisation: undefined,
47
- internationalOrganisationRole: undefined,
48
- isOngoing: undefined,
49
- isSweden: undefined,
50
- militaryRank: undefined,
51
- nameOfPEP: undefined,
52
- relationToPEP: undefined,
53
- role: undefined,
54
- });
55
- }, [pepContext]);
56
- return (React.createElement(Form, { onSubmit: nextPage, lysaFormRef: formRef },
57
- React.createElement(PepIsPepQuestions, { ownerName: pepContext.state.ownerName, legalEntityType: pepContext.state.legalEntityType, type: pepContext.state.type, onChange: (type) => pepContext.setState({ type }), resetValues: resetValues }),
58
- React.createElement(PrimaryButton, { type: "submit" }, "N\u00E4sta")));
59
- };
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
+ };