diff --git a/shared/types/Issuers.ts b/shared/types/Issuers.ts index df679d90..dfdb4db2 100644 --- a/shared/types/Issuers.ts +++ b/shared/types/Issuers.ts @@ -1,6 +1,6 @@ export enum Issuers { Government = "GOVERNMENT", CompanyHouse = "COMPANY_HOUSE", - Bank = "BANK", - Insurance = "INSURANCE", + // Bank = "BANK", + // Insurance = "INSURANCE", } \ No newline at end of file diff --git a/shared/types/Providers.ts b/shared/types/Providers.ts index db6b5fc2..caf3a9ea 100644 --- a/shared/types/Providers.ts +++ b/shared/types/Providers.ts @@ -1,5 +1,5 @@ export enum Providers { - WaltId = "WALT_ID", + // WaltId = "WALT_ID", Impierce = "IMPIERCE", TangleLabs = "TANGLE_LABS", } \ No newline at end of file diff --git a/shared/types/Scopes.ts b/shared/types/Scopes.ts index 7715b1e8..3eff99cf 100644 --- a/shared/types/Scopes.ts +++ b/shared/types/Scopes.ts @@ -1,6 +1,6 @@ export enum Scopes { Government = "GOVERNMENT", CompanyHouse = "COMPANY_HOUSE", - Bank = "BANK", - Insurance = "INSURANCE", + // Bank = "BANK", + // Insurance = "INSURANCE", } diff --git a/web/public/locales/en/translation.json b/web/public/locales/en/translation.json index 6524fc55..71574eeb 100644 --- a/web/public/locales/en/translation.json +++ b/web/public/locales/en/translation.json @@ -257,6 +257,8 @@ "newlyIncorporatedCompanies": "Newly Incorporated Companies" }, "companyData": { + "businessOwner": "Business Owner", + "companyDetails": "Company Details", "companyName": "Company Name", "companyAddress": "Company Address", "companyType": "Company Type", @@ -266,46 +268,6 @@ } }, - "bank": { - "confirmation": { - "confirmation": "Your Bank Credential Was Sent To Your Wallet", - "title": "🎉", - "success": "Congratulations, You Claimed Your Bank Account!", - "nextStep": "Next, Apply for Insurance" - }, - "bankData": { - "accountTypes": { - "label": "Choose Bank Account Type", - "error": "Please choose an account type", - "accounts1": "Business Checking Account", - "accounts2": "Business Savings Account", - "special": "Brokerage Account" - } - } - }, - "insurance": { - "confirmation": { - "confirmation": "Your Insurance Credential Was Sent To Your Wallet", - "title": "🎉", - "success": "Congratulations, You Claimed Your Insurance!", - "nextStep": "Ready for business" - }, - "insuranceData": { - "openAnAccount": "Open an Account", - "accountType": "Account Type", - "businessOwner": "Business Owner", - "companyDetails": "Company Details", - "bankAccountDetails": "Bank Account Details", - "accountTypes": { - "label": "Choose Liability Insurance Type", - "error": "Please choose a type of liability insurance", - "accounts1": "General Liability", - "accounts2": "Professional Liability", - "accounts3": "Employer Liability", - "special": "Business Liability" - } - } - }, "general": { "proveIdentity": { "waitingForLogin": "Waiting for connection", diff --git a/web/src/context/globalState.tsx b/web/src/context/globalState.tsx index edfa3c7a..1db76f10 100644 --- a/web/src/context/globalState.tsx +++ b/web/src/context/globalState.tsx @@ -162,7 +162,6 @@ const requestPresentation: RequestPresentation = (provider, scope, presentationD } // OIDC4VCI -// TODO: Issuers.Bank type RequestIssuance = (provider: Providers, scope: Scopes, credentials: {type: string, data?: any}[], issuer: Issuers) => void const requestIssuance: RequestIssuance = (provider, scope, credentials, issuer) => { socket.emit('requestIssuance', diff --git a/web/src/pages/Company/CompanyData.tsx b/web/src/pages/Company/CompanyData.tsx index a6a8bb27..aa7dcac3 100644 --- a/web/src/pages/Company/CompanyData.tsx +++ b/web/src/pages/Company/CompanyData.tsx @@ -133,7 +133,7 @@ const CompanyData: React.FC = () => {

{t("pages.company.companyData.setUpPrivateCompany")}

{t("pages.company.companyData.subTitle")}

-

{t("pages.insurance.insuranceData.businessOwner")}

+

{t("pages.company.companyData.businessOwner")}

{relevantCredential && relevantCredential.issuer && <> @@ -163,7 +163,7 @@ const CompanyData: React.FC = () => { }
-

{t("pages.insurance.insuranceData.companyDetails")}

+

{t("pages.company.companyData.companyDetails")}

{issuerDID && <> diff --git a/web/src/pages/Company/ReceiveCredentials.tsx b/web/src/pages/Company/ReceiveCredentials.tsx index bb834430..dcb678bf 100644 --- a/web/src/pages/Company/ReceiveCredentials.tsx +++ b/web/src/pages/Company/ReceiveCredentials.tsx @@ -45,7 +45,7 @@ const ReceiveCredentials: React.FC = () => { provider: Providers.Impierce, scope: Scopes.CompanyHouse, credentials: [{type: CompanyCredentialConfig.template.type.at(-1) as string, data: state.COMPANY_HOUSE?.issuanceData}], - issuer: Issuers.Bank //TODO: should be COMPANY_HOUSE? + issuer: Issuers.CompanyHouse }) }, []); diff --git a/web/src/pages/Insurance/Confirmation.tsx b/web/src/pages/Insurance/Confirmation.tsx deleted file mode 100644 index 26c5032c..00000000 --- a/web/src/pages/Insurance/Confirmation.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { Link } from 'react-router-dom'; -import { Button } from 'antd'; -import { getCompanyId } from '../../utils/helper'; -import useStep from '../../utils/useStep'; -import { Layout, RandomGraphicElement } from '../../components'; -import selv from '../../assets/selvSuccessBordered.svg'; -import { useTranslation } from 'react-i18next'; - -/** - * Component which will display a Confirmation. - */ -const Confirmation: React.FC = () => { - const { nextStep, theme } = useStep(); - - const { t } = useTranslation(); - return ( - - -
-
- Selv app logo -

{t("pages.insurance.confirmation.confirmation")}

-
-

{t("pages.insurance.confirmation.title")}

-

{t("pages.insurance.confirmation.success")}

- - - -
-
-
- ); -}; - -export default Confirmation; diff --git a/web/src/pages/Insurance/InsuranceData.tsx b/web/src/pages/Insurance/InsuranceData.tsx deleted file mode 100644 index 86c45bc3..00000000 --- a/web/src/pages/Insurance/InsuranceData.tsx +++ /dev/null @@ -1,141 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { Button, notification } from 'antd'; -import { flattenObject } from '../../utils/helper'; -import { Layout, Loading, Form, PrefilledForm } from '../../components'; -import { useTranslation } from 'react-i18next'; -import { useGlobalState } from '../../context/globalState'; -import { Link } from 'react-router-dom'; -import useStep from '../../utils/useStep'; -import { Scopes } from '@shared/types/Scopes'; -import CitizenCredentialConfig from '@shared/credentials/CitizenCredential.json'; - -const prefilledFields = [ - 'FirstName', - 'LastName', - 'Date', - 'Nationality', - 'Birthplace', - 'Country', - 'Phone' -]; - -const emptyFields = [ - 'CompanyName', - 'CompanyAddress', - 'CompanyType', - 'CompanyBusiness' -]; - -const labels = { - CompanyName: 'pages.company.companyData.companyName', - CompanyAddress: 'pages.company.companyData.companyAddress', - CompanyType: 'pages.company.companyData.companyType', - CompanyBusiness: 'pages.company.companyData.companyBusiness' -}; - -const messages = { - waiting: 'general.messages.waiting', - connectionError: 'general.messages.connectionError', - missing: 'general.messages.missing', - verifying: 'general.messages.verifying' -}; - -const notify = (type: string, message: string, description: string) => { - return type === 'error' - ? notification.error({ message, description }) - : notification.warning({ message, description }); -}; - -/** - * Component which will display a CompanyData. - */ -const CompanyData: React.FC = ({ history, match }: any) => { - const [fields, setFields] = useState(); - const [status, setStatus] = useState(''); - const [prefilledData, setPrefilledData] = useState({}); - const { state } = useGlobalState(); - const { nextStep } = useStep(); - - const { t } = useTranslation(); - - // useEffect(() => { - // async function getData() { - // const credentialsString: string | null = await localStorage.getItem('credentials'); - // const credentials = credentialsString && await JSON.parse(credentialsString); - // const status = credentials?.status; - // if (!status || Number(status) !== 2) { - // notify('error', 'Error', t(messages.connectionError)); - // history.goBack(); - // } - // const flattenData = flattenObject(credentials?.data); - // const address = { Address: `${flattenData.Street} ${flattenData.House}, ${flattenData.City}, ${flattenData.Country}, ${flattenData.Postcode}` }; - // const result = prefilledFields.reduce((acc: any, entry: string) => - // ({ ...acc, [entry]: flattenData[entry] }), {}); - - // setPrefilledData({ ...result, ...address }); - // } - // getData(); - // }, []); // eslint-disable-line react-hooks/exhaustive-deps - - async function processValues(fields: object) { - setFields(fields); - } - - function setStatusMessage(message: string) { - setStatus(message); - } - - const emptyFormData: any = { dataFields: emptyFields, labels, processValues, status, messages }; - - useEffect(() => { - if(!state[Scopes.Insurance]?.credentials.length) return; - const relevantCredential = state[Scopes.Insurance].credentials.filter((c: any) => c.credential?.type.includes(CitizenCredentialConfig.template.type.pop()))?.[0]?.credential; - console.log(relevantCredential) - if (!relevantCredential) return; - setPrefilledData({ - 'FirstName': relevantCredential.credentialSubject.firstName, - 'LastName': relevantCredential.credentialSubject.lastName, - 'Date': new Date(relevantCredential.credentialSubject.date).toLocaleString(), - 'Nationality': relevantCredential.credentialSubject.nationality, - 'Birthplace': relevantCredential.credentialSubject.birthplace, - 'Country': relevantCredential.credentialSubject.country, - 'Phone': relevantCredential.credentialSubject.phone, - }) - }, [state, setPrefilledData]) - - return ( - -
-

{t("pages.company.companyData.setUpPrivateCompany")}

-

{t("pages.insurance.insuranceData.businessOwner")}

- { - // Object.keys(prefilledFormData.dataFields).length && - - } - -

{t("pages.insurance.insuranceData.companyDetails")}

- {/*
*/} - { - status && ( -
-

{t(status)}

- { - status === messages.waiting && - } -
- ) - } - - - -
- -
- ); -}; - -export default CompanyData; diff --git a/web/src/pages/Insurance/ProveIdentity.tsx b/web/src/pages/Insurance/ProveIdentity.tsx deleted file mode 100644 index 4eea5450..00000000 --- a/web/src/pages/Insurance/ProveIdentity.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'; -import randomstring from 'randomstring'; -import { Layout, Loading, QRCode, RandomGraphicElement } from '../../components'; -import useStep from '../../utils/useStep'; -import { useTranslation, Trans } from 'react-i18next'; -import { Router, useNavigate } from 'react-router'; -import { Actions, useCredentialsDispatch, useGlobalState } from '../../context/globalState'; -import { Providers } from '@shared/types/Providers'; -import { Issuers } from '@shared/types/Issuers'; -import { Scopes } from '@shared/types/Scopes'; -import { copyFile } from 'fs'; - -const ProveIdentity: React.FC = () => { - const { t } = useTranslation(); - - const { nextStep } = useStep(); - const navigate = useNavigate(); - const [loading, setLoading] = useState(true); - const [status, setStatus] = useState("pages.general.proveIdentity.waitingForLogin"); - const dispatch = useCredentialsDispatch(); - const { state } = useGlobalState(); - - const goToNextStep = useCallback(() => { - navigate(nextStep); - }, [nextStep, navigate]); - - useEffect(() => { - dispatch?.({type: Actions.REQUEST_INVITE, provider: Providers.Impierce, scope: Scopes.Insurance}); - }, [dispatch]); - - useEffect(() => { - if(state[Scopes.Insurance]?.connectedDID) { - goToNextStep(); - } - }, [state, goToNextStep]) - - const messages = { - waiting: 'general.messages.waiting', - connectionError: 'general.messages.connectionError', - missing: 'general.messages.missing', - verifying: 'general.messages.verifying' - }; - - function setStatusMessage(message: string) { - setStatus(message); - } - - return ( - - -
-

{t("pages.general.proveIdentity.provideCredentials")}

-

- - Scan this QR code with Selv App to continue - -

-
- {/* TODO: Handle loading state */} - -
-

{t(status)}

- {loading && } -
-
-
- ); -}; - -export default ProveIdentity; diff --git a/web/src/pages/Insurance/ProvideData.tsx b/web/src/pages/Insurance/ProvideData.tsx deleted file mode 100644 index 25f3406d..00000000 --- a/web/src/pages/Insurance/ProvideData.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'; -import randomstring from 'randomstring'; -import { Layout, Loading, QRCode, RandomGraphicElement } from '../../components'; -import useStep from '../../utils/useStep'; -import { useTranslation, Trans } from 'react-i18next'; -import { Router, useNavigate } from 'react-router'; -import { Actions, useCredentialsDispatch, useGlobalState } from '../../context/globalState'; -import { Providers } from '@shared/types/Providers'; -import { Issuers } from '@shared/types/Issuers'; -import { Scopes } from '@shared/types/Scopes'; - -import { v4 as uuidv4 } from 'uuid'; -import CitizenCredentialConfig from '../../../../shared/credentials/CitizenCredential.json' - - -const ProvideData: React.FC = () => { - const { t } = useTranslation(); - - const { nextStep } = useStep(); - const navigate = useNavigate(); - const [loading, setLoading] = useState(true); - const [status, setStatus] = useState("pages.general.proveIdentity.waitingForLogin"); - const dispatch = useCredentialsDispatch(); - const { state } = useGlobalState(); - - const goToNextStep = useCallback(() => { - navigate(nextStep); - }, [nextStep, navigate]); - - useEffect(() => { - - dispatch?.({ - type: Actions.REQUEST_PRESENTATION, - provider: Providers.Impierce, - presentationDefinition: { - id: uuidv4(), - input_descriptors: CitizenCredentialConfig.input_descriptors - }, - scope: Scopes.Insurance, - - }) - - }, [dispatch]); - - useEffect(() => { - if (state[Scopes.Insurance]?.credentials?.length) { - goToNextStep(); - } - }, [state, goToNextStep]) - - const messages = { - waiting: 'general.messages.waiting', - connectionError: 'general.messages.connectionError', - missing: 'general.messages.missing', - verifying: 'general.messages.verifying' - }; - - function setStatusMessage(message: string) { - setStatus(message); - } - - return ( - - -
-

{t("pages.general.proveIdentity.provideCredentials")}

-

- - Scan this QR code with Selv App to continue - -

-
- {/* TODO: Handle loading state */} - -
-

{t(status)}

- {loading && } -
-
-
- ); -}; - -export default ProvideData; diff --git a/web/src/pages/Insurance/ReceiveCredentials.tsx b/web/src/pages/Insurance/ReceiveCredentials.tsx deleted file mode 100644 index 5f128183..00000000 --- a/web/src/pages/Insurance/ReceiveCredentials.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import React, { useCallback, useEffect, useState } from 'react'; -import { Layout, Loading, QRCode, RandomGraphicElement } from '../../components'; -import useStep from '../../utils/useStep'; -import { useTranslation, Trans } from 'react-i18next'; -import { useNavigate } from 'react-router'; -import { Actions, useCredentialsDispatch, useGlobalState } from '../../context/globalState'; -import { Issuers } from '@shared/types/Issuers'; -import { Providers } from '@shared/types/Providers'; -import { Scopes } from '@shared/types/Scopes'; -import CompanyCredentialConfig from '@shared/credentials/CompanyCredential.json'; - -const ReceiveCredentials: React.FC = () => { - const { t } = useTranslation(); - - const { nextStep } = useStep(); - const navigate = useNavigate(); - const [loading, setLoading] = useState(true); - const [status, setStatus] = useState("pages.general.proveIdentity.waitingForLogin"); - const dispatch = useCredentialsDispatch(); - const { state } = useGlobalState(); - - const goToNextStep = useCallback(() => { - navigate(nextStep); - }, [nextStep, navigate]); - - useEffect(() => { - dispatch?.({ - type: Actions.REQUEST_ISSUANCE, - provider: Providers.Impierce, - scope: Scopes.Insurance, - credentials: [{type: CompanyCredentialConfig.template.type.at(-1) as string}], - issuer: Issuers.Insurance - }) - }, [dispatch]); - - useEffect(() => { - if(state[Scopes.Insurance]?.issuanceComplete) { - goToNextStep(); - } - }, [state, goToNextStep]) - - const messages = { - waiting: 'general.messages.waiting', - connectionError: 'general.messages.connectionError', - missing: 'general.messages.missing', - verifying: 'general.messages.verifying' - }; - - function setStatusMessage(message: string) { - setStatus(message); - } - - return ( - - -
-

{t("pages.general.proveIdentity.provideCredentials")}

-

- - Scan this QR code with Selv App to continue - -

-
- {/* TODO: Handle loading state */} - -
-

{t(status)}

- {loading && } -
-
-
- ); -}; - -export default ReceiveCredentials; diff --git a/web/src/pages/Insurance/SingInConfirmation.tsx b/web/src/pages/Insurance/SingInConfirmation.tsx deleted file mode 100644 index ae83bd97..00000000 --- a/web/src/pages/Insurance/SingInConfirmation.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import React, { useEffect } from 'react'; -import { Link, useNavigate } from 'react-router-dom'; -import { Button } from 'antd'; -import useStep from '../../utils/useStep'; -import { Layout, RandomGraphicElement } from '../../components'; -import selv from '../../assets/selvBordered.svg'; -import { useTranslation } from 'react-i18next'; -import { useGlobalState } from '../../context/globalState'; - -/** - * Component which will display a SingInConfirmation. - */ -const SingInConfirmation: React.FC = () => { - const { nextStep } = useStep(); - const { t } = useTranslation(); - const { state } = useGlobalState(); - - return ( - - -
- Selv app logo -

{t("general.hello")}

-

- {t("pages.company.signInConfirmation.signInSuccess", { - interpolation: { - escapeValue: false - }, test: state.COMPANY_HOUSE?.connectedDID - })} -

- - - -
-
-
- ); -}; - -export default SingInConfirmation; diff --git a/web/src/pages/Insurance/index.tsx b/web/src/pages/Insurance/index.tsx deleted file mode 100644 index 4d2de111..00000000 --- a/web/src/pages/Insurance/index.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import ProveIdentity from './ProveIdentity'; -import SingInConfirmation from './SingInConfirmation'; -import InsuranceData from './InsuranceData'; -import Confirmation from './Confirmation'; -import ProvideData from './ProvideData'; -import ReceiveCredentials from './ReceiveCredentials'; - -export { - ProveIdentity, - SingInConfirmation, - InsuranceData, - Confirmation, - ProvideData, - ReceiveCredentials -}; diff --git a/web/src/steps.tsx b/web/src/steps.tsx index 9893ac3c..9726f507 100644 --- a/web/src/steps.tsx +++ b/web/src/steps.tsx @@ -2,7 +2,6 @@ import * as React from "react"; import * as Company from './pages/Company' import * as Government from './pages/Government' -import * as Insurance from './pages/Insurance' import { Landing, @@ -46,21 +45,6 @@ export const routes: Route[] = [ { path: '/:lng?/company/receive', element: , step: "company", process: "issueCredential", poweredBy: }, { path: '/:lng?/company/confirm', element: , step: "company", process: "issueCredential", poweredBy: }, { path: '/:lng?/demo/success', element: }, - // { path: '/:lng?/insurance/prove', element: , step: "insurance", poweredBy: }, - // { path: '/:lng?/insurance/signin', element: , step: "insurance", poweredBy: }, - // { path: '/:lng?/insurance/provide', element: , step: "insurance", poweredBy: }, - // { path: '/:lng?/insurance/data', element: , step: "insurance", poweredBy: }, - // { path: '/:lng?/insurance/receive', element: , step: "insurance", poweredBy: }, - // { path: '/:lng?/insurance/confirm', element: , step: "insurance", poweredBy: }, - // { path: '/:lng?/company/details/1/:companyId', element: }, - // { path: '/:lng?/bank/prove/1', element: }, - // { path: '/:lng?/bank/data/1', element: }, - // { path: '/:lng?/bank/confirm/2', element: }, - // { path: '/:lng?/company/details/2/:companyId', element: }, - // { path: '/:lng?/insurance/prove/2', element: }, - // { path: '/:lng?/insurance/data/2', element: }, - // { path: '/:lng?/insurance/confirm/3', element: }, - // { path: '/:lng?/company/details/3/:companyId', element: }, { path: '/:lng?/demo/thankyou', element: } ]; @@ -113,7 +97,5 @@ export const mainSteps: MainStep[] = [ }, ] }, - // { id: "bank", title: "steps.company.processes.getBankAccount" }, - // { id: "insurance", title: "steps.company.processes.liabilityInsurance" }, { id: "done", title: "steps.done.title" }, ]; \ No newline at end of file