From 2ffdbaadb41a650e671844f146faa783855bfa80 Mon Sep 17 00:00:00 2001 From: bhavanakarwade <137506897+bhavanakarwade@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:29:56 +0530 Subject: [PATCH] merge: changes from DEV environment to QA environment (#716) * [Deno Deploy] Update .github/workflows/deploy.yml * feat: support no ledger (#689) * wip: implemented ui for method selection Signed-off-by: bhavanakarwade * wip: modified no ledger screen Signed-off-by: bhavanakarwade * feat: modified ui for create did popup Signed-off-by: bhavanakarwade * refactor: worked on error handling Signed-off-by: bhavanakarwade * fix: validations on create did popup Signed-off-by: bhavanakarwade * refactor: mapping function Signed-off-by: bhavanakarwade * fix: resolved sonarlint issues Signed-off-by: bhavanakarwade * fix: input box issues Signed-off-by: bhavanakarwade * refactor: handled role wise conditions Signed-off-by: bhavanakarwade * fix: resolved code duplication errors Signed-off-by: bhavanakarwade * fix: enum values Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade * fixed CSS and avatar issues (#696) * fix:css issues Signed-off-by: pranalidhanavade * fix:sonarcloud issues Signed-off-by: pranalidhanavade --------- Signed-off-by: pranalidhanavade * feat: support no ledger (#697) * wip: implemented ui for method selection Signed-off-by: bhavanakarwade * wip: modified no ledger screen Signed-off-by: bhavanakarwade * feat: modified ui for create did popup Signed-off-by: bhavanakarwade * refactor: worked on error handling Signed-off-by: bhavanakarwade * fix: validations on create did popup Signed-off-by: bhavanakarwade * refactor: mapping function Signed-off-by: bhavanakarwade * fix: resolved sonarlint issues Signed-off-by: bhavanakarwade * fix: input box issues Signed-off-by: bhavanakarwade * refactor: handled role wise conditions Signed-off-by: bhavanakarwade * fix: resolved code duplication errors Signed-off-by: bhavanakarwade * fix: enum values Signed-off-by: bhavanakarwade * fix: added loading chnages Signed-off-by: bhavanakarwade * fix: ledgerconfig object changes Signed-off-by: bhavanakarwade * fix: resolved type errors Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade * refactor: responsiveness of the component (#699) * wip: implemented ui for method selection Signed-off-by: bhavanakarwade * wip: modified no ledger screen Signed-off-by: bhavanakarwade * feat: modified ui for create did popup Signed-off-by: bhavanakarwade * refactor: worked on error handling Signed-off-by: bhavanakarwade * fix: validations on create did popup Signed-off-by: bhavanakarwade * refactor: mapping function Signed-off-by: bhavanakarwade * fix: resolved sonarlint issues Signed-off-by: bhavanakarwade * fix: input box issues Signed-off-by: bhavanakarwade * refactor: handled role wise conditions Signed-off-by: bhavanakarwade * fix: resolved code duplication errors Signed-off-by: bhavanakarwade * fix: enum values Signed-off-by: bhavanakarwade * fix: added loading chnages Signed-off-by: bhavanakarwade * fix: ledgerconfig object changes Signed-off-by: bhavanakarwade * fix: resolved type errors Signed-off-by: bhavanakarwade * refactor: modified responsiveness of the component Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade * feat: manage keycloak client Signed-off-by: bhavanakarwade * refactor: updated env sample file Signed-off-by: bhavanakarwade * fix: error messages issue from create organization and create ecosystem modals. (#698) * fix:css issues Signed-off-by: pranalidhanavade * fix:sonarcloud issues Signed-off-by: pranalidhanavade * fix:clear error on pop-up close Signed-off-by: pranalidhanavade --------- Signed-off-by: pranalidhanavade * fix: css issues (#704) * refactor: parameter name Signed-off-by: bhavanakarwade * refactor: added query parameter Signed-off-by: bhavanakarwade * fix: remove unnecessary code Signed-off-by: bhavanakarwade * fix: query param issue Signed-off-by: bhavanakarwade * fix: css issues Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade * feat: add passkey warning message for unsupported devices (#706) * feat: add passkey warning message for unsupported devices Signed-off-by: pranalidhanavade * feat: add passkey warning message for unsupported devices Signed-off-by: pranalidhanavade * feat: add passkey warning message for unsupported devices Signed-off-by: pranalidhanavade * fix: removed commnets Signed-off-by: pranalidhanavade * feat: add passkey warning message for unsupported devices Signed-off-by: pranalidhanavade * feat: add passkey warning message for unsupported devices Signed-off-by: pranalidhanavade --------- Signed-off-by: pranalidhanavade * Feat/passkey warning messages (#707) * feat: add passkey warning message for unsupported devices Signed-off-by: pranalidhanavade * feat: add passkey warning message for unsupported devices Signed-off-by: pranalidhanavade * feat: add passkey warning message for unsupported devices Signed-off-by: pranalidhanavade * fix: removed commnets Signed-off-by: pranalidhanavade * feat: add passkey warning message for unsupported devices Signed-off-by: pranalidhanavade * feat: add passkey warning message for unsupported devices Signed-off-by: pranalidhanavade * feat: add passkey warning message for unsupported devices Signed-off-by: pranalidhanavade --------- Signed-off-by: pranalidhanavade * feat: dedicated agent workflow (#693) * feat:Working on dedicated agent workflow Signed-off-by: rohit.shitre * feat/dedicated agent ui form Signed-off-by: pranalidhanavade * feat/ conditional rendering of forms Signed-off-by: pranalidhanavade * feat:add support for dedicated agent Signed-off-by: pranalidhanavade * feat:dedicated agent workflow integration Signed-off-by: pranalidhanavade * feat:dedicated agent workflow integration Signed-off-by: pranalidhanavade * feat:dedicated agent workflow integration Signed-off-by: pranalidhanavade * feat:dedicated agent workflow integration Signed-off-by: pranalidhanavade * feat:dedicated agent workflow integration Signed-off-by: pranalidhanavade * fix: sonarcloud issues Signed-off-by: pranalidhanavade * fix: sonarcloud issues Signed-off-by: pranalidhanavade * fix: sonarcloud issues Signed-off-by: pranalidhanavade * fix: sonarcloud issues Signed-off-by: pranalidhanavade * feat:dedicated agent workflow ui Signed-off-by: pranalidhanavade * feat:dedicated agent workflow Signed-off-by: pranalidhanavade * fix:sonarcloud issues Signed-off-by: pranalidhanavade * fix: duplication issue of sonarcloud Signed-off-by: pranalidhanavade * fix: duplication code issue of sonarcloud Signed-off-by: pranalidhanavade * fix: duplication code issue of sonarcloud Signed-off-by: pranalidhanavade * fix: sonarlint issues Signed-off-by: pranalidhanavade * fix: sonarlint duplication issue Signed-off-by: pranalidhanavade * feat:dedicated agent workflow Signed-off-by: pranalidhanavade * fixed:sonarcloud issues Signed-off-by: pranalidhanavade * fixed:sonarcloud issues Signed-off-by: pranalidhanavade * fix: removed consoles Signed-off-by: pranalidhanavade * feat: support for dedicated agent Signed-off-by: pranalidhanavade * fix: removed consoles Signed-off-by: pranalidhanavade * fix: removed consoles Signed-off-by: pranalidhanavade * fix: removed consoles Signed-off-by: pranalidhanavade * fix: formik validations Signed-off-by: pranalidhanavade * fix:dedicated agent formik validations Signed-off-by: pranalidhanavade * fix: yup formik validations Signed-off-by: pranalidhanavade * fix: static values from enum Signed-off-by: pranalidhanavade --------- Signed-off-by: rohit.shitre Signed-off-by: pranalidhanavade Co-authored-by: rohit.shitre * fix: formik validations for dedicated agent workflow (#708) * feat:Working on dedicated agent workflow Signed-off-by: rohit.shitre * feat/dedicated agent ui form Signed-off-by: pranalidhanavade * feat/ conditional rendering of forms Signed-off-by: pranalidhanavade * feat:add support for dedicated agent Signed-off-by: pranalidhanavade * feat:dedicated agent workflow integration Signed-off-by: pranalidhanavade * feat:dedicated agent workflow integration Signed-off-by: pranalidhanavade * feat:dedicated agent workflow integration Signed-off-by: pranalidhanavade * feat:dedicated agent workflow integration Signed-off-by: pranalidhanavade * feat:dedicated agent workflow integration Signed-off-by: pranalidhanavade * fix: sonarcloud issues Signed-off-by: pranalidhanavade * fix: sonarcloud issues Signed-off-by: pranalidhanavade * fix: sonarcloud issues Signed-off-by: pranalidhanavade * fix: sonarcloud issues Signed-off-by: pranalidhanavade * feat:dedicated agent workflow ui Signed-off-by: pranalidhanavade * feat:dedicated agent workflow Signed-off-by: pranalidhanavade * fix:sonarcloud issues Signed-off-by: pranalidhanavade * fix: duplication issue of sonarcloud Signed-off-by: pranalidhanavade * fix: duplication code issue of sonarcloud Signed-off-by: pranalidhanavade * fix: duplication code issue of sonarcloud Signed-off-by: pranalidhanavade * fix: sonarlint issues Signed-off-by: pranalidhanavade * fix: sonarlint duplication issue Signed-off-by: pranalidhanavade * feat:dedicated agent workflow Signed-off-by: pranalidhanavade * fixed:sonarcloud issues Signed-off-by: pranalidhanavade * fixed:sonarcloud issues Signed-off-by: pranalidhanavade * fix: removed consoles Signed-off-by: pranalidhanavade * feat: support for dedicated agent Signed-off-by: pranalidhanavade * fix: removed consoles Signed-off-by: pranalidhanavade * fix: removed consoles Signed-off-by: pranalidhanavade * fix: removed consoles Signed-off-by: pranalidhanavade * fix: formik validations Signed-off-by: pranalidhanavade * fix:dedicated agent formik validations Signed-off-by: pranalidhanavade * fix: yup formik validations Signed-off-by: pranalidhanavade * fix: static values from enum Signed-off-by: pranalidhanavade * fix: polygon formik validation error Signed-off-by: pranalidhanavade * fix: sonarcloud issues Signed-off-by: pranalidhanavade * fix: sonarcloud issues Signed-off-by: pranalidhanavade --------- Signed-off-by: rohit.shitre Signed-off-by: pranalidhanavade Co-authored-by: rohit.shitre * fix: create did button restrictions (#710) * refactor: parameter name Signed-off-by: bhavanakarwade * refactor: added query parameter Signed-off-by: bhavanakarwade * fix: remove unnecessary code Signed-off-by: bhavanakarwade * fix: query param issue Signed-off-by: bhavanakarwade * fix: css issues Signed-off-by: bhavanakarwade * fix: create did button restrictions Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade * feat: changed schema payload (#711) Signed-off-by: tipusinghaw * feat/delete wallet and organization (#712) * feat: delete organization and wallet Signed-off-by: pranalidhanavade * feat: delete org and wallet Signed-off-by: pranalidhanavade * feat: added custom card component for delet card Signed-off-by: pranalidhanavade * fix: removed consoles Signed-off-by: pranalidhanavade * fix: removed unused code Signed-off-by: pranalidhanavade * changes in delete organization svg image Signed-off-by: pranalidhanavade * changes in delete organization svg image Signed-off-by: pranalidhanavade * fix: resolved comments on pull request Signed-off-by: pranalidhanavade * feat: added custom message for ecosystem lead role Signed-off-by: pranalidhanavade * feat: added interfaces into interface file Signed-off-by: pranalidhanavade * fix: resolved comments on pull request Signed-off-by: pranalidhanavade --------- Signed-off-by: pranalidhanavade * fix: custom-avatar-css-issues (#714) Signed-off-by: pranalidhanavade * feat: delete wallet and organization (#715) * feat: delete organization and wallet Signed-off-by: pranalidhanavade * feat: delete org and wallet Signed-off-by: pranalidhanavade * feat: added custom card component for delet card Signed-off-by: pranalidhanavade * fix: removed consoles Signed-off-by: pranalidhanavade * fix: removed unused code Signed-off-by: pranalidhanavade * changes in delete organization svg image Signed-off-by: pranalidhanavade * changes in delete organization svg image Signed-off-by: pranalidhanavade * fix: resolved comments on pull request Signed-off-by: pranalidhanavade * feat: added custom message for ecosystem lead role Signed-off-by: pranalidhanavade * feat: added interfaces into interface file Signed-off-by: pranalidhanavade * fix: resolved comments on pull request Signed-off-by: pranalidhanavade * fix: dark mode css issues Signed-off-by: pranalidhanavade --------- Signed-off-by: pranalidhanavade * refactor: added query parameter in get all schemas API (#713) * refactor: modified bulk issuance payload Signed-off-by: bhavanakarwade * refactor: added query parameter in get all schemas API Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade --------- Signed-off-by: bhavanakarwade Signed-off-by: pranalidhanavade Signed-off-by: rohit.shitre Signed-off-by: tipusinghaw Co-authored-by: deno-deploy[bot] <75045203+deno-deploy[bot]@users.noreply.github.com> Co-authored-by: pranalidhanavade <137780597+pranalidhanavade@users.noreply.github.com> Co-authored-by: shitrerohit <37360542+shitrerohit@users.noreply.github.com> Co-authored-by: rohit.shitre Co-authored-by: tipusinghaw <126460794+tipusinghaw@users.noreply.github.com> --- .env.sample | 3 + package-lock.json | 2 +- public/images/delete_button_image.svg | 3 + public/images/sign-warning-svgrepo-com.svg | 9 + src/api/Agent.ts | 25 +- src/api/Auth.ts | 2 + src/api/Schema.ts | 8 +- src/api/connection.ts | 23 +- src/api/ecosystem.ts | 22 +- src/api/issuance.ts | 23 +- src/api/organization.ts | 80 ++- src/api/verification.ts | 21 +- src/common/enums.ts | 10 + src/commonComponents/ConfirmationModal.tsx | 7 +- src/commonComponents/EcosystemProfileCard.tsx | 9 +- src/commonComponents/PasskeyAlert.tsx | 26 + src/commonComponents/SchemaCard.tsx | 1 + src/components/AddOrganizationInEcosystem.tsx | 1 + .../Authentication/SignInUserPasskey.tsx | 18 +- src/components/Authentication/SignUpUser.tsx | 5 +- .../Authentication/SignUpUserPasskey.tsx | 19 +- .../CreateEcosystemOrgModal/index.tsx | 2 + .../EcosystemInvite/EcoInvitationList.tsx | 4 +- src/components/Profile/AddPasskey.tsx | 12 + src/components/Resources/Schema/Create.tsx | 11 +- .../Resources/Schema/SchemasList.tsx | 3 +- .../Resources/Schema/interfaces/index.ts | 5 +- src/components/RoleViewButton/index.tsx | 6 +- src/components/organization/Dashboard.tsx | 51 +- .../organization/DeleteOrganization.tsx | 377 ++++++++++ .../organization/DeleteOrganizationsCard.tsx | 50 ++ .../organization/OrganizationDetails.tsx | 17 +- .../organization/OrganizationsList.tsx | 6 +- .../configuration-settings/DidList.tsx | 30 +- .../organization/interfaces/index.ts | 34 +- .../invitations/ReceivedInvitations.tsx | 13 +- .../walletCommonComponents/DedicatedAgent.tsx | 680 ++++++++++++++---- .../walletCommonComponents/SharedAgent.tsx | 46 +- .../walletCommonComponents/WalletSpinup.tsx | 116 ++- .../interfaces/index.tsx | 37 +- src/config/apiRoutes.ts | 13 +- src/config/envConfig.ts | 8 +- src/config/pathRoutes.ts | 5 + src/pages/organizations/dashboard/index.astro | 2 +- .../organizations/delete-organizations.astro | 16 + 45 files changed, 1591 insertions(+), 270 deletions(-) create mode 100644 public/images/delete_button_image.svg create mode 100644 public/images/sign-warning-svgrepo-com.svg create mode 100644 src/commonComponents/PasskeyAlert.tsx create mode 100644 src/components/organization/DeleteOrganization.tsx create mode 100644 src/components/organization/DeleteOrganizationsCard.tsx create mode 100644 src/pages/organizations/delete-organizations.astro diff --git a/.env.sample b/.env.sample index f2ba651ea..0fa73ab29 100644 --- a/.env.sample +++ b/.env.sample @@ -3,6 +3,9 @@ PUBLIC_CRYPTO_PRIVATE_KEY= PUBLIC_SHOW_NAME_AS_LOGO= # Please provide true if you want to give platform name with logo +PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_ID= # Please sepcify your client id +PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_SECRETE= # Please specify your client secrete + PUBLIC_PLATFORM_NAME= # Please specify your paltform name PUBLIC_PLATFORM_LOGO= # Please specify your logo file link PUBLIC_POWERED_BY= # Please specify your powered by org name diff --git a/package-lock.json b/package-lock.json index febbda2eb..423c4788b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15934,4 +15934,4 @@ } } } -} +} \ No newline at end of file diff --git a/public/images/delete_button_image.svg b/public/images/delete_button_image.svg new file mode 100644 index 000000000..2b0d81f5e --- /dev/null +++ b/public/images/delete_button_image.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/images/sign-warning-svgrepo-com.svg b/public/images/sign-warning-svgrepo-com.svg new file mode 100644 index 000000000..9d37d18d3 --- /dev/null +++ b/public/images/sign-warning-svgrepo-com.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/api/Agent.ts b/src/api/Agent.ts index e2312aaef..848ebd041 100644 --- a/src/api/Agent.ts +++ b/src/api/Agent.ts @@ -1,7 +1,8 @@ -import { axiosGet, axiosPost } from "../services/apiRequests"; +import { axiosDelete, axiosGet, axiosPost } from "../services/apiRequests"; import { apiRoutes } from "../config/apiRoutes"; import { getFromLocalStorage } from "./Auth"; import { storageKeys } from "../config/CommonConstant"; +import { getHeaderConfigs } from "../config/GetHeaderConfigs"; export const getLedgerConfig = async () => { const token = await getFromLocalStorage(storageKeys.TOKEN) @@ -111,4 +112,24 @@ export const getLedgersPlatformUrl = async (indyNamespace: string) => { const err = error as Error return err?.message } -} \ No newline at end of file +} + + +export const deleteOrganizationWallet = async ( +) => { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + + const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.deleteWallet}`; + + const axiosPayload = { + url, + config: await getHeaderConfigs(), + }; + + try { + return await axiosDelete(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; + } +}; diff --git a/src/api/Auth.ts b/src/api/Auth.ts index 600cdf52c..45e158e80 100644 --- a/src/api/Auth.ts +++ b/src/api/Auth.ts @@ -8,6 +8,8 @@ import type { AstroCookies } from 'astro' export interface UserSignUpData { email: string, + clientId: string, + clientSecret: string } export interface AddPasswordDetails { email:string diff --git a/src/api/Schema.ts b/src/api/Schema.ts index acf1ea9a6..36ba74b59 100644 --- a/src/api/Schema.ts +++ b/src/api/Schema.ts @@ -1,4 +1,4 @@ -import type { GetAllSchemaListParameter, createCredDeffFieldName, createSchema } from "../components/Resources/Schema/interfaces"; +import type { GetAllSchemaListParameter, createCredDeffFieldName } from "../components/Resources/Schema/interfaces"; import { axiosGet, axiosPost } from "../services/apiRequests"; import { apiRoutes } from "../config/apiRoutes"; @@ -6,12 +6,12 @@ import { getFromLocalStorage } from "./Auth"; import { storageKeys } from "../config/CommonConstant"; import { getHeaderConfigs } from "../config/GetHeaderConfigs"; -export const getAllSchemas = async ({itemPerPage, page, allSearch }: GetAllSchemaListParameter) => { +export const getAllSchemas = async ({itemPerPage, page, allSearch }: GetAllSchemaListParameter, schemaType?: string) => { const token = await getFromLocalStorage(storageKeys.TOKEN) const ledgerId = await getFromLocalStorage(storageKeys.LEDGER_ID) const details = { - url: `${apiRoutes.Platform.getAllSchemaFromPlatform}?pageSize=${itemPerPage}&searchByText=${allSearch}&pageNumber=${page}&ledgerId=${ledgerId}`, + url: `${apiRoutes.Platform.getAllSchemaFromPlatform}?pageSize=${itemPerPage}&searchByText=${allSearch}&pageNumber=${page}&ledgerId=${ledgerId}&schemaType=${schemaType}`, config: { headers: { 'Content-type': 'application/json', @@ -52,7 +52,7 @@ export const getAllSchemasByOrgId = async ({ search, itemPerPage, page }: GetAll } } -export const createSchemas = async (payload: createSchema, orgId: string) => { +export const createSchemas = async (payload: any, orgId: string) => { const token = await getFromLocalStorage(storageKeys.TOKEN) const details = { url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.create}`, diff --git a/src/api/connection.ts b/src/api/connection.ts index 1573a6763..11607f0f3 100644 --- a/src/api/connection.ts +++ b/src/api/connection.ts @@ -1,7 +1,7 @@ import { apiRoutes } from '../config/apiRoutes'; import { storageKeys } from '../config/CommonConstant'; import { getHeaderConfigs } from '../config/GetHeaderConfigs'; -import { axiosGet } from '../services/apiRequests'; +import { axiosDelete, axiosGet } from '../services/apiRequests'; import { getFromLocalStorage } from './Auth'; export interface IConnectionListAPIParameter { itemPerPage: number; @@ -34,3 +34,24 @@ export const getConnectionsByOrg = async ({ return err?.message; } }; + + +export const deleteConnectionRecords = async ( +) => { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + + const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.organizations.deleteConnections}`; + + const axiosPayload = { + url, + config: await getHeaderConfigs(), + }; + + try { + return await axiosDelete(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; + } +}; + diff --git a/src/api/ecosystem.ts b/src/api/ecosystem.ts index 7d3445153..47035d566 100644 --- a/src/api/ecosystem.ts +++ b/src/api/ecosystem.ts @@ -1,4 +1,4 @@ -import { axiosGet, axiosPost, axiosPut } from '../services/apiRequests'; +import { axiosDelete, axiosGet, axiosPost, axiosPut } from '../services/apiRequests'; import { apiRoutes } from '../config/apiRoutes'; import { getFromLocalStorage } from './Auth'; @@ -282,3 +282,23 @@ export const addOrganizationInEcosystem = async ( return err?.message; } }; + +export const deleteOrganizationFromEcosystem = async ( +) => { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + + const url = `${apiRoutes.Ecosystem.root}/${orgId}${apiRoutes.Ecosystem.deleteOrgFromEcosystem}`; + + + const axiosPayload = { + url, + config: await getHeaderConfigs(), + }; + + try { + return await axiosDelete(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; + } +}; \ No newline at end of file diff --git a/src/api/issuance.ts b/src/api/issuance.ts index 981702bfd..636d4fe4a 100644 --- a/src/api/issuance.ts +++ b/src/api/issuance.ts @@ -3,7 +3,7 @@ import { storageKeys } from '../config/CommonConstant'; import { getHeaderConfigs } from '../config/GetHeaderConfigs'; -import { axiosGet, axiosPost } from '../services/apiRequests'; +import { axiosDelete, axiosGet, axiosPost } from '../services/apiRequests'; import { getFromLocalStorage } from './Auth'; import type { IConnectionListAPIParameter } from './connection'; @@ -82,3 +82,24 @@ export const issueOobEmailCredential = async (data: object) => { return err?.message; } }; + + + +export const deleteIssuanceRecords = async ( +) => { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + + const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.organizations.deleteIssaunce}`; + + const axiosPayload = { + url, + config: await getHeaderConfigs(), + }; + + try { + return await axiosDelete(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; + } +}; \ No newline at end of file diff --git a/src/api/organization.ts b/src/api/organization.ts index 30f87a683..75eb87d61 100644 --- a/src/api/organization.ts +++ b/src/api/organization.ts @@ -10,7 +10,8 @@ import { apiRoutes } from '../config/apiRoutes'; import { getFromLocalStorage } from './Auth'; import { getHeaderConfigs } from '../config/GetHeaderConfigs'; import { storageKeys } from '../config/CommonConstant'; -import type { IUpdatePrimaryDid } from '../components/organization/interfaces'; +import type { IDedicatedAgentConfig, IUpdatePrimaryDid } from '../components/organization/interfaces'; +import { pathRoutes } from '../config/pathRoutes'; export const createOrganization = async (data: object) => { const url = apiRoutes.organizations.create; @@ -166,6 +167,34 @@ export const spinupDedicatedAgent = async (data: object, orgId: string) => { } }; +export const setAgentConfigDetails = async (data: IDedicatedAgentConfig, orgId: string) => { + const url =`${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.setAgentConfig}` + const payload = data; + + const token = await getFromLocalStorage(storageKeys.TOKEN); + + const config = { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + }, + }; + const axiosPayload = { + url, + payload, + config, + }; + + try { + return await axiosPost(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; + } +}; + + + export const spinupSharedAgent = async (data: object, orgId: string) => { const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.agentSharedSpinup}`; const payload = data; @@ -423,4 +452,51 @@ export const updatePrimaryDid = async (orgId: string, payload: IUpdatePrimaryDid const err = error as Error; return err?.message; } -}; \ No newline at end of file +}; + + +export const getOrganizationReferences = async () => { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + const url = `${apiRoutes.organizations.root}${apiRoutes.organizations.getOrgReferences}/${orgId}`; + + const token = await getFromLocalStorage(storageKeys.TOKEN); + + const config = { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + }, + }; + const axiosPayload = { + url, + config, + }; + + try { + return await axiosGet(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; + } +}; + +export const deleteOrganization = async ( +) => { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + + const url = `${apiRoutes.organizations.root}/${orgId}`; + + const axiosPayload = { + url, + config: await getHeaderConfigs(), + }; + + try { + return await axiosDelete(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; + } +}; + + diff --git a/src/api/verification.ts b/src/api/verification.ts index cf32e8bd2..7a70a8c40 100644 --- a/src/api/verification.ts +++ b/src/api/verification.ts @@ -2,7 +2,7 @@ import type { IssueCredential } from '../common/enums'; import { apiRoutes } from '../config/apiRoutes'; import { storageKeys } from '../config/CommonConstant'; import { getHeaderConfigs } from '../config/GetHeaderConfigs'; -import { axiosGet, axiosPost } from '../services/apiRequests'; +import { axiosDelete, axiosGet, axiosPost } from '../services/apiRequests'; import { getFromLocalStorage } from './Auth'; import type { IConnectionListAPIParameter } from './connection'; @@ -112,3 +112,22 @@ export const getCredentialDefinitionsForVerification = async ( return err?.message; } }; + +export const deleteVerificationRecords = async ( +) => { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + + const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.organizations.deleteVerifications}`; + + const axiosPayload = { + url, + config: await getHeaderConfigs(), + }; + + try { + return await axiosDelete(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; + } +}; diff --git a/src/common/enums.ts b/src/common/enums.ts index 83d5f5c6f..52202d80a 100644 --- a/src/common/enums.ts +++ b/src/common/enums.ts @@ -114,4 +114,14 @@ export enum Network { export enum CommonConstants { BALANCELIMIT = 0.01 +} + +export enum Devices { +Linux = 'linux' +} + +export enum Ledgers { + INDY = 'indy', + POLYGON = 'polygon', + NO_LEDGER = 'noLedger' } \ No newline at end of file diff --git a/src/commonComponents/ConfirmationModal.tsx b/src/commonComponents/ConfirmationModal.tsx index f69ed7d78..ba6d96a97 100644 --- a/src/commonComponents/ConfirmationModal.tsx +++ b/src/commonComponents/ConfirmationModal.tsx @@ -14,9 +14,10 @@ interface IProps { setSuccess: (flag: string | null) => void; buttonTitles: string[]; loading:boolean; + warning?:String } -const ConfirmationModal = ({ openModal, closeModal, onSuccess, message, isProcessing, success, failure, setFailure, setSuccess, buttonTitles, loading }: IProps) => { +const ConfirmationModal = ({ openModal, closeModal, onSuccess, message, isProcessing, success, failure, setFailure, setSuccess, buttonTitles, loading, warning }: IProps) => { return (
@@ -72,6 +73,9 @@ const ConfirmationModal = ({ openModal, closeModal, onSuccess, message, isProces

{message}

+

+ {warning} +

{success && (
@@ -117,6 +121,7 @@ const ConfirmationModal = ({ openModal, closeModal, onSuccess, message, isProces className="sm:min-w-[197px] text-md bg-primary-700 hover:!bg-primary-800 focus:ring-4 focus:outline-none focus:ring-primary-300 sm:w-auto dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800 font-medium rounded-lg text-md inline-flex items-center text-center" > {buttonTitles[1]} +
diff --git a/src/commonComponents/EcosystemProfileCard.tsx b/src/commonComponents/EcosystemProfileCard.tsx index cea73b2f5..51a18fae6 100644 --- a/src/commonComponents/EcosystemProfileCard.tsx +++ b/src/commonComponents/EcosystemProfileCard.tsx @@ -10,6 +10,7 @@ import { RoleTablet } from '../components/Ecosystem/Dashboard' import CustomSpinner from '../components/CustomSpinner'; import { pathRoutes } from '../config/pathRoutes'; import { EmptyListMessage } from '../components/EmptyListComponent'; +import React from 'react'; @@ -86,9 +87,13 @@ const EcosystemProfileCard = ({getEndorsementListData}:IEndorsement) => { >
{ecosystemDetails?.logoUrl ? ( - + ) : ( - + )}
diff --git a/src/commonComponents/PasskeyAlert.tsx b/src/commonComponents/PasskeyAlert.tsx new file mode 100644 index 000000000..fdf3d0722 --- /dev/null +++ b/src/commonComponents/PasskeyAlert.tsx @@ -0,0 +1,26 @@ +import { Alert } from 'flowbite-react'; +import React, { useEffect, useState } from "react"; + +const PasskeyAlert =()=>{ + return ( + +
+ +
+ + + + + + + +

This browser or device partially supports passkey.

+
+
+
+ + + ); +}; +export default PasskeyAlert; \ No newline at end of file diff --git a/src/commonComponents/SchemaCard.tsx b/src/commonComponents/SchemaCard.tsx index 5d9c6dab1..e1128768c 100644 --- a/src/commonComponents/SchemaCard.tsx +++ b/src/commonComponents/SchemaCard.tsx @@ -2,6 +2,7 @@ import { Card } from 'flowbite-react'; import { dateConversion } from '../utils/DateConversion'; import DateTooltip from '../components/Tooltip'; import CopyDid from './CopyDid'; +import React from 'react'; interface IProps { className?: string, diff --git a/src/components/AddOrganizationInEcosystem.tsx b/src/components/AddOrganizationInEcosystem.tsx index 3942880e7..ebfb9b1f1 100644 --- a/src/components/AddOrganizationInEcosystem.tsx +++ b/src/components/AddOrganizationInEcosystem.tsx @@ -408,6 +408,7 @@ const AddOrganizationInEcosystem = () => { + {isDevice && ( + + )} { const VerifyMail = async (email: string) => { try { const payload = { - email: email + email: email, + clientId: envConfig.PLATFORM_DATA.clientId, + clientSecret: envConfig.PLATFORM_DATA.clientSecrete } setVerifyLoader(true) const userRsp = await sendVerificationMail(payload); diff --git a/src/components/Authentication/SignUpUserPasskey.tsx b/src/components/Authentication/SignUpUserPasskey.tsx index 1f4d35a13..18e616501 100644 --- a/src/components/Authentication/SignUpUserPasskey.tsx +++ b/src/components/Authentication/SignUpUserPasskey.tsx @@ -15,6 +15,9 @@ import SignUpUserName from './SignUpUserName.js'; import { v4 as uuidv4 } from 'uuid'; import NavBar from './NavBar.js'; import FooterBar from './FooterBar.js'; +import PasskeyAlert from '../../commonComponents/PasskeyAlert.js'; +import React from 'react'; +import { Devices } from '../../common/enums.js'; interface passwordValues { @@ -33,15 +36,19 @@ const SignUpUserPasskey = ({ email, firstName, lastName }: { email: string, firs const [currentComponent, setCurrentComponent] = useState('email'); const [showSignUpUserName, setShowSignUpUserName] = useState(false); const [showPasskeyComponent, setShowPasskeyComponent] = useState(true); - + const [isDevice, setIsDevice] = useState(false); useEffect(() => { - if (window?.location?.search.length > 7) { setEmailAutoFill(window?.location?.search.split('=')[1]) } - }, []) + const platform = navigator.platform.toLowerCase(); + if (platform.includes(Devices.Linux)) { + setIsDevice(true); + } + }, []); + const showFidoError = (error: unknown): void => { const err = error as AxiosError; if ( @@ -280,7 +287,7 @@ const SignUpUserPasskey = ({ email, firstName, lastName }: { email: string, firs id='signupcreatepasskey' isProcessing={loading} onClick={() => { - registerWithPasskey(true) + registerWithPasskey(true) }} > @@ -290,8 +297,10 @@ const SignUpUserPasskey = ({ email, firstName, lastName }: { email: string, firs Passkey - + {isDevice && ( + + )} { }); props.setOpenModal(false); setImgError(' ') + setErrMsg(null); }} > Create {popupName} @@ -270,6 +271,7 @@ const CreateEcosystemOrgModal = (props: IProps) => { type={'failure'} onAlertClose={() => { setErrMsg(null); + }} /> {
{logoUrl ? ( - + ) : ( - + )}
diff --git a/src/components/Profile/AddPasskey.tsx b/src/components/Profile/AddPasskey.tsx index 56851f044..220f1c3f3 100644 --- a/src/components/Profile/AddPasskey.tsx +++ b/src/components/Profile/AddPasskey.tsx @@ -2,6 +2,8 @@ import { Alert, Button } from 'flowbite-react'; import { useEffect, useState } from 'react'; import DeviceDetails from '../../commonComponents/DeviceDetailsCard'; import PasskeyAddDevice from '../../commonComponents/PasseyAddDevicePopup'; +import PasskeyAlert from '../../commonComponents/PasskeyAlert'; + import { addDeviceDetails, generateRegistrationOption, @@ -21,6 +23,8 @@ import type { } from './interfaces'; import type { AxiosError, AxiosResponse } from 'axios'; import { AlertComponent } from '../AlertComponent'; +import { Devices } from '../../common/enums'; +import React from 'react'; interface IResponseMessages {type: "error" | "success", message: string} @@ -34,6 +38,7 @@ const AddPasskey = ({ responseMessages }: { responseMessages: (value: IResponse const [editFailure, setEditFailure] = useState(null); const [addfailure, setAddFailure] = useState(null); const [disableFlag, setDisableFlag] = useState(false); + const [isDevice, setIsDevice] = useState(false); const [openModel, setOpenModel] = useState(false); @@ -189,6 +194,10 @@ const AddPasskey = ({ responseMessages }: { responseMessages: (value: IResponse } else { setProfile(); } + const platform = navigator.platform.toLowerCase(); + if (platform.includes(Devices.Linux)) { + setIsDevice(true); + } }, [OrgUserEmail]); return ( @@ -282,6 +291,9 @@ const AddPasskey = ({ responseMessages }: { responseMessages: (value: IResponse Add Passkey + {isDevice && ( + + )}
{ const submit = async (values: IFormData) => { setCreateLoader(true); const schemaFieldName: FieldName = { - schemaName: values.schemaName, - schemaVersion: values.schemaVersion, - attributes: values.attribute, - orgId: orgId, + type: SchemaType.INDY, + schemaPayload: { + schemaName: values.schemaName, + schemaVersion: values.schemaVersion, + attributes: values.attribute, + orgId: orgId, + } }; const createSchema = await createSchemas(schemaFieldName, orgId); diff --git a/src/components/Resources/Schema/SchemasList.tsx b/src/components/Resources/Schema/SchemasList.tsx index c8badb367..89dd5dfe8 100644 --- a/src/components/Resources/Schema/SchemasList.tsx +++ b/src/components/Resources/Schema/SchemasList.tsx @@ -23,6 +23,7 @@ import { checkEcosystem } from '../../../config/ecosystem'; import type { ICheckEcosystem } from '../../../config/ecosystem'; import { Create, SchemaEndorsement } from '../../Issuance/Constant'; +import { SchemaType } from '../../../common/enums'; const SchemaList = (props: { schemaSelectionCallback: ( @@ -58,7 +59,7 @@ const SchemaList = (props: { setLoading(true); let schemaList; if (allSchemaFlag) { - schemaList = await getAllSchemas(schemaListAPIParameter); + schemaList = await getAllSchemas(schemaListAPIParameter, SchemaType.INDY); } else { schemaList = await getAllSchemasByOrgId( schemaListAPIParameter, diff --git a/src/components/Resources/Schema/interfaces/index.ts b/src/components/Resources/Schema/interfaces/index.ts index 6288557a5..a29afb0dd 100644 --- a/src/components/Resources/Schema/interfaces/index.ts +++ b/src/components/Resources/Schema/interfaces/index.ts @@ -58,11 +58,14 @@ export interface CredDeffFieldNameType { } export interface FieldName { + type: string, + schemaPayload: schemaDetails + } +export interface schemaDetails { schemaName: string; schemaVersion: string; attributes: IAttributes[] orgId: string; - } export interface createSchema { diff --git a/src/components/RoleViewButton/index.tsx b/src/components/RoleViewButton/index.tsx index 897cb1443..7b0b2b9c5 100644 --- a/src/components/RoleViewButton/index.tsx +++ b/src/components/RoleViewButton/index.tsx @@ -14,10 +14,11 @@ interface RoleViewButtonProps { feature: string, isOutline?: boolean, isPadding?: boolean, + disabled?:boolean } -const RoleViewButton = ({ title, buttonTitle, svgComponent, onClickEvent, feature, isOutline, isPadding }: RoleViewButtonProps) => { +const RoleViewButton = ({ title, buttonTitle, svgComponent, onClickEvent, feature, isOutline, isPadding, disabled }: RoleViewButtonProps) => { const [userRoles, setUserRoles] = useState([]) @@ -75,10 +76,11 @@ const RoleViewButton = ({ title, buttonTitle, svgComponent, onClickEvent, featur ? "!p-0 role-btn group flex h-min items-center justify-center text-center focus:z-10 focus:ring-2 ring-primary-700 bg-white-700 hover:bg-secondary-700 ring-2 text-black font-medium rounded-md text-sm dark:text-white dark:hover:text-primary-700" : `${isPadding ? "!p-0" : ""} text-base font-medium text-center text-white bg-primary-700 hover:!bg-primary-800 rounded-md hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 sm:w-auto dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800` }`} - disabled={!(isRoleAccess())} + disabled={disabled || !isRoleAccess()} > {svgComponent} {buttonTitle} + ) diff --git a/src/components/organization/Dashboard.tsx b/src/components/organization/Dashboard.tsx index 48fc2212e..24ba46201 100644 --- a/src/components/organization/Dashboard.tsx +++ b/src/components/organization/Dashboard.tsx @@ -24,21 +24,34 @@ const Dashboard = () => { const [failure, setFailure] = useState(null); const [loading, setLoading] = useState(true); const [userRoles, setUserRoles] = useState([]); + const [ecosystemUserRoles, setEcosystemUserRoles] = useState(''); const [orgSuccess, setOrgSuccess] = useState(null); const [openModal, setOpenModal] = useState(false); + + const EditOrgDetails = () => { setOpenModal(true); }; + const deleteOrgDetails = () => { + window.location.href = pathRoutes.organizations.deleteOrganization + }; + const getUserRoles = async () => { const orgRoles = await getFromLocalStorage(storageKeys.ORG_ROLES); const roles = orgRoles.split(','); setUserRoles(roles); }; + const getEcosystemRole = async () => { + const ecosysmetmRoles = await getFromLocalStorage(storageKeys.ECOSYSTEM_ROLE); + setEcosystemUserRoles(ecosysmetmRoles) + }; + useEffect(() => { getUserRoles(); + getEcosystemRole(); }, []); const fetchOrganizationDetails = async () => { @@ -48,11 +61,14 @@ const Dashboard = () => { const response = await getOrganizationById(orgId as string); const { data } = response as AxiosResponse; setLoading(false) - if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { - if (data?.data?.org_agents && data?.data?.org_agents?.length > 0) { + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + + if (data?.data?.org_agents?.length > 0 && data?.data?.org_agents[0]?.orgDid) { setWalletStatus(true); } + setOrgData(data?.data); + const organizationData = orgInfoData ? JSON.parse(orgInfoData) : {}; const {id, name, description, logoUrl} = data?.data || {}; const orgInfo = { @@ -63,11 +79,13 @@ const Dashboard = () => { ...logoUrl && { logoUrl } } await setToLocalStorage(storageKeys.ORG_INFO, orgInfo); + } else { setFailure(response as string); } setLoading(false); }; + const fetchOrganizationDashboard = async () => { setLoading(true); @@ -84,7 +102,7 @@ const Dashboard = () => { } } setLoading(false); - }; + }; useEffect(() => { fetchOrganizationDetails(); @@ -112,6 +130,8 @@ const Dashboard = () => { const redirectOrgUsers = () => { window.location.href = pathRoutes.organizations.users; }; + + return (
@@ -165,10 +185,14 @@ const Dashboard = () => { )}
+ +
+ - {(userRoles.includes(Roles.OWNER) || +
+ {(userRoles.includes(Roles.OWNER) || userRoles.includes(Roles.ADMIN)) && ( -
+
)} +
+
+ { + userRoles.includes(Roles.OWNER) && ( +
+ + +
+ ) + } +
+
{ ) : ( walletStatus === true ? ( - + + ) : ( (userRoles.includes(Roles.OWNER) || userRoles.includes(Roles.ADMIN)) && ( diff --git a/src/components/organization/DeleteOrganization.tsx b/src/components/organization/DeleteOrganization.tsx new file mode 100644 index 000000000..87e751bac --- /dev/null +++ b/src/components/organization/DeleteOrganization.tsx @@ -0,0 +1,377 @@ +import { useEffect, useState } from "react"; +import { apiStatusCodes, storageKeys } from "../../config/CommonConstant"; +import type { AxiosResponse } from "axios"; +import { + deleteOrganization, + getOrganizationById, + getOrganizationReferences +} from "../../api/organization"; +import { deleteOrganizationFromEcosystem, getEcosystems } from "../../api/ecosystem"; + +import BreadCrumbs from "../BreadCrumbs"; +import { deleteOrganizationWallet } from "../../api/Agent"; +import ConfirmationModal from "../../commonComponents/ConfirmationModal"; +import { toast, ToastContainer } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; +import { getFromLocalStorage, removeFromLocalStorage } from "../../api/Auth"; +import { EcosystemRoles } from "../../common/enums"; +import { AlertComponent } from "../AlertComponent"; +import { pathRoutes } from "../../config/pathRoutes"; +import DeleteOrganizationsCard from '../../components/organization/DeleteOrganizationsCard' +import React from "react"; +import { deleteVerificationRecords } from '../../api/verification'; +import { deleteIssuanceRecords } from '../../api/issuance'; +import { deleteConnectionRecords} from '../../api/connection' +import type { IEcosystemOrganizations, IOrgCount } from "./interfaces"; + +const DeleteOrganizations = () => { + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + const [organizationData, setOrganizationData] = useState(null); + const [deleteLoading, setDeleteLoading] = useState(false); + const [isWalletPresent, setIsWalletPresent] = useState(false); + const [message, setMessage] = useState(null); + const [showPopup, setShowPopup] = useState(false); + const [ecosystemUserRoles, setEcosystemUserRoles] = useState(''); + const [deleteAction, setDeleteAction] = useState<() => void>(() => {}); + const [confirmMessage, setConfirmMessage] = useState(''); + const [description, setDescription] = useState(""); + const [ecosystemRoles, setEcosystemRoles] = useState([]); + const [orgName, setOrgName] = useState(""); + + + const getAllEcosystems = async () => { + try { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + const response = await getEcosystems(orgId as string); + const { data } = response as AxiosResponse; + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + const ecosystemList = data?.data?.ecosystemList; + + if (ecosystemList && ecosystemList.length > 0) { + const leadEcosystemNames: string[] = []; + ecosystemList.forEach((ecosystem: { name: string; ecosystemOrgs: IEcosystemOrganizations[]; }) => { + ecosystem.ecosystemOrgs.forEach(org => { + const ecosystemRoleName = org.ecosystemRole?.name; + if (ecosystemRoleName === EcosystemRoles.ecosystemLead) { + setEcosystemUserRoles(ecosystemRoleName); + leadEcosystemNames.push(ecosystem.name); + } + }); + }); + setEcosystemRoles(leadEcosystemNames) + } + } + } catch (error) { + console.error('Fetch organization details ERROR::::', error); + } + }; + + const fetchOrganizationDetails = async () => { + try { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + const response = await getOrganizationById(orgId as string); + const { data } = response as AxiosResponse; + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + const walletName = data?.data?.org_agents[0]?.walletName; + const orgName = data?.data?.name; + if(orgName){ + setOrgName(orgName) + } + if (walletName) { + setIsWalletPresent(true); + } + else { + setIsWalletPresent(false); + } + } + } catch (error) { + console.error('Fetch organization details ERROR::::', error); + } + }; + + const fetchOrganizationReferences = async () => { + setLoading(true); + try { + const response = await getOrganizationReferences(); + const { data } = response as AxiosResponse; + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + const orgData = data?.data; + setOrganizationData(orgData); + } else { + setError(response as string); + } + } catch (error) { + console.error('An error occurred:', error); + setError(error as string); + } + setLoading(false); + }; + + useEffect(() => { + fetchOrganizationReferences(); + fetchOrganizationDetails(); + getAllEcosystems(); + }, []); + + const deleteHandler = async (deleteFunc: () => Promise) => { + setDeleteLoading(true); + try { + await deleteFunc(); + await fetchOrganizationReferences(); + + setShowPopup(false); + } catch (error) { + console.error('An error occurred:', error); + setError(error as string); + } + setDeleteLoading(false); + }; + + const deleteVerifications = async () => { + setDeleteLoading(true); + try { + const response = await deleteVerificationRecords(); + const { data } = response as AxiosResponse; + + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + toast.success(data?.message, {autoClose: 3000}) + await fetchOrganizationReferences(); + setShowPopup(false) + } else { + setError(response as string); + } + } catch (error) { + console.error('An error occurred:', error); + setError(error as string); + } + setDeleteLoading(false); + }; + + const deleteIssuance = async () => { + setDeleteLoading(true); + try { + const response = await deleteIssuanceRecords(); + const { data } = response as AxiosResponse; + + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + toast.success(data?.message, {autoClose: 3000}) + await fetchOrganizationReferences(); + setShowPopup(false) + } else { + setError(response as string); + } + } catch (error) { + console.error('An error occurred:', error); + setError(error as string); + } + setDeleteLoading(false); + }; + + const deleteConnection = async () => { + setDeleteLoading(true); + try { + const response = await deleteConnectionRecords(); + const { data } = response as AxiosResponse; + + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + toast.success(data?.message, {autoClose: 3000}) + await fetchOrganizationReferences(); + setShowPopup(false) + } else { + setError(response as string); + } + } catch (error) { + console.error('An error occurred:', error); + setError(error as string); + } + setDeleteLoading(false); + }; + + const deleteOrgFromEcosystem = async () => { + try { + const response = await deleteOrganizationFromEcosystem(); + const { data } = response as AxiosResponse; + + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + toast.success(data?.message, {autoClose: 3000}) + await fetchOrganizationReferences(); + setShowPopup(false) + } else { + setError(response as string); + } + } catch (error) { + console.error('An error occurred:', error); + setError(error as string); + } + }; + + const deleteOrgWallet = async () => { + try { + const response = await deleteOrganizationWallet(); + const { data } = response as AxiosResponse; + + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + toast.success(data?.message, {autoClose: 3000}) + setIsWalletPresent(false) + await fetchOrganizationReferences(); + setShowPopup(false) + } else { + setError(response as string); + } + } catch (error) { + console.error('An error occurred:', error); + setError(error as string); + } + }; + + const deleteOrganizations = async () => { + try { + const response = await deleteOrganization(); + const { data } = response as AxiosResponse; + + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + toast.success(data?.message, {autoClose: 3000}) + await fetchOrganizationReferences(); + setShowPopup(false) + } else { + setError(response as string); + } + } catch (error) { + console.error('An error occurred:', error); + setError(error as string); + } + await removeFromLocalStorage(storageKeys.ORG_INFO); + await removeFromLocalStorage(storageKeys.ORG_DETAILS); + await removeFromLocalStorage(storageKeys.ORG_ROLES); + await removeFromLocalStorage(storageKeys.ORG_ID); + setTimeout(() => { + window.location.href = pathRoutes.organizations.root; + }, 3000); + + }; + + const deleteFunctions = { + deleteVerifications, + deleteIssuance, + deleteConnection, + deleteOrgFromEcosystem, + deleteOrgWallet, + deleteOrganizations + }; + + const cardData = [ + { + title: "Verifications", + description: "Verifications is the list of verification records", + count: organizationData?.verificationRecordsCount ?? 0, + deleteFunc: deleteFunctions.deleteVerifications, + confirmMessage:"Are you sure you want to delete verification records", + isDisabled: false + }, + { + title: "Issuance", + description: "Issuance is the list of credential records", + count: organizationData?.issuanceRecordsCount ?? 0, + deleteFunc: deleteFunctions.deleteIssuance, + confirmMessage:"Are you sure you want to delete credential records", + isDisabled: (organizationData?.verificationRecordsCount ?? 0) > 0 + }, + { + title: "Connections", + description: "Connections is the list of connection records", + count: organizationData?.connectionRecordsCount ?? 0, + deleteFunc: deleteFunctions.deleteConnection, + confirmMessage:"Are you sure you want to delete connection records", + isDisabled: (organizationData?.issuanceRecordsCount ?? 0) > 0 || (organizationData?.verificationRecordsCount ?? 0) > 0 + }, + { + title: "Ecosystem", + description: "Ecosystems your organization has joined as a member", + count: organizationData?.orgEcosystemsCount ?? 0, + deleteFunc: deleteFunctions.deleteOrgFromEcosystem, + confirmMessage:"Are you sure you want to remove your organization from ecoystem", + isDisabled: ecosystemUserRoles.includes(EcosystemRoles.ecosystemLead) || ((organizationData?.connectionRecordsCount ?? 0) > 0 ||(organizationData?.issuanceRecordsCount ?? 0) > 0 || (organizationData?.verificationRecordsCount ?? 0) > 0) + }, + { + title: "Organization wallet", + description: "", + count: isWalletPresent ? 1 : 0, + deleteFunc: deleteFunctions.deleteOrgWallet, + confirmMessage: "Are you sure you want to delete organization wallet", + isDisabled: ecosystemUserRoles.includes(EcosystemRoles.ecosystemLead) || + ((organizationData?.orgEcosystemsCount ?? 0) > 0 || + (organizationData?.connectionRecordsCount ?? 0) > 0 || + (organizationData?.issuanceRecordsCount ?? 0) > 0 || + (organizationData?.verificationRecordsCount ?? 0) > 0) + + }, + { + title: "Organization", + description: "Organization", + deleteFunc: deleteFunctions.deleteOrganizations, + confirmMessage:`Are you sure you want to delete organization ${orgName}`, + isDisabled: isWalletPresent || ecosystemUserRoles.includes(EcosystemRoles.ecosystemLead) + } + ]; + return ( +
+ +

+ Delete Organization +

+ + + { + setMessage(null); + setError(null); + }} + /> +{ecosystemRoles.length > 0 && +

+ You are Ecosystem Lead for {ecosystemRoles.join(', ')}. You cannot remove yourself from the ecosystem, delete the organization's wallet, and delete your organization. +

+ } + {organizationData && ( +
+ {cardData.map((card, index) => ( + { + setShowPopup(true); + setDeleteAction(() => deleteFunc); + setConfirmMessage(card.confirmMessage); + setDescription(card.description) + }} + /> + ))} + + setShowPopup(false)} + onSuccess={() => deleteHandler(deleteAction as () => Promise)} + message={confirmMessage} + buttonTitles={["No, cancel", "Yes, delete"]} + isProcessing={deleteLoading} + setFailure={setError} + setSuccess={setMessage} + warning={description} + /> +
+ )} +
+ ); +}; + +export default DeleteOrganizations; \ No newline at end of file diff --git a/src/components/organization/DeleteOrganizationsCard.tsx b/src/components/organization/DeleteOrganizationsCard.tsx new file mode 100644 index 000000000..a6677dffa --- /dev/null +++ b/src/components/organization/DeleteOrganizationsCard.tsx @@ -0,0 +1,50 @@ +// DeleteOrganizationsCard.tsx + +import React from "react"; +import { Card } from "flowbite-react"; + +interface CardProps { + title?: string; + description?: string; + count?: number; + deleteFunc?: () => void; + confirmMessage?: string; + isDisabled?: boolean; + onDeleteClick: (deleteFunc: () => void, confirmMessage: string) => void; +} + +const DeleteOrganizationsCard: React.FC = ({ + title, + description, + count, + deleteFunc, + confirmMessage, + isDisabled = false, + onDeleteClick +}) => ( + +
+

+

{title}

+

{description}

+ {count &&

Total:{count}

} +

+ +
+
+); + +export default DeleteOrganizationsCard; diff --git a/src/components/organization/OrganizationDetails.tsx b/src/components/organization/OrganizationDetails.tsx index 41918f7b0..9a0779f93 100644 --- a/src/components/organization/OrganizationDetails.tsx +++ b/src/components/organization/OrganizationDetails.tsx @@ -14,10 +14,11 @@ import { Tooltip } from 'flowbite-react'; import DIDList from './configuration-settings/DidList'; const OrganizationDetails = ({ orgData }: { orgData: Organisation | null }) => { + const { org_agents } = orgData as Organisation; const agentData: OrgAgent | null = - org_agents.length > 0 ? org_agents[0] : null; - + org_agents.length > 0 ? org_agents[0] : null; + const [loading, setLoading] = useState(true); const [connectionData, setConnectionData] = useState(null); @@ -43,8 +44,10 @@ const OrganizationDetails = ({ orgData }: { orgData: Organisation | null }) => { }, []); return ( - <> -
+
+ +
+

Web Wallet Details @@ -231,8 +234,10 @@ const OrganizationDetails = ({ orgData }: { orgData: Organisation | null }) => {

- )} - + )}
+ +
+ ); }; diff --git a/src/components/organization/OrganizationsList.tsx b/src/components/organization/OrganizationsList.tsx index 608e6ddb9..82c61c1f6 100644 --- a/src/components/organization/OrganizationsList.tsx +++ b/src/components/organization/OrganizationsList.tsx @@ -26,6 +26,7 @@ const initialPageState = { pageNumber: 1, pageSize: 9, total: 100, + totalCount: 0 }; const OrganizationsList = () => { @@ -59,10 +60,9 @@ const OrganizationsList = () => { searchText, ); const { data } = response as AxiosResponse; - if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { const totalPages = data?.data?.totalPages; - + const totalCount =data?.data?.totalCount; const orgList = data?.data?.organizations.map((userOrg: Organisation) => { const roles: string[] = userOrg.userOrgRoles.map( (role) => role.orgRole.name, @@ -75,6 +75,7 @@ const OrganizationsList = () => { setCurrentPage({ ...currentPage, total: totalPages, + totalCount: totalCount, }); } else { setError(response as string); @@ -248,6 +249,7 @@ const OrganizationsList = () => { = 10} buttonTitle="Create" feature={Features.CRETAE_ORG} svgComponent={ diff --git a/src/components/organization/configuration-settings/DidList.tsx b/src/components/organization/configuration-settings/DidList.tsx index 1205bb1bc..1c7485bad 100644 --- a/src/components/organization/configuration-settings/DidList.tsx +++ b/src/components/organization/configuration-settings/DidList.tsx @@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react" import { Button } from "flowbite-react" import CopyDid from '../../../commonComponents/CopyDid' import CreateDidPopup from "./CreateDid" -import { getDids, getOrganizationById, updatePrimaryDid } from "../../../api/organization" +import { getDids, updatePrimaryDid } from "../../../api/organization" import { getFromLocalStorage } from "../../../api/Auth" import { apiStatusCodes, storageKeys } from "../../../config/CommonConstant" import type { AxiosResponse } from "axios" @@ -15,8 +15,7 @@ const DIDList = () => { const [showPopup, setShowPopup] = useState(false); const [erroMsg, setErrMsg] = useState(null); const [successMsg, setSuccessMsg] = useState(null); - const [roleName, setRoleName] = useState(null); - + const [userRoles, setUserRoles] = useState([]); const setPrimaryDid = async (id: string, did: string) => { try { const orgId = await getFromLocalStorage(storageKeys.ORG_ID); @@ -36,22 +35,6 @@ const DIDList = () => { } } - const fetchOrganizationDetails = async () => { - const orgId = await getFromLocalStorage(storageKeys.ORG_ID); - const response = await getOrganizationById(orgId); - const { data } = response as AxiosResponse; - if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { - - const ownerRole = data?.data?.userOrgRoles.find(role => role?.orgRole.name === "owner"); - - const ownerRoleName = ownerRole ? ownerRole.orgRole.name : null; - setRoleName(ownerRoleName); - - } else { - console.error('Error in fetching organization:::'); - } - }; - const getData = async () => { try { const orgId = await getFromLocalStorage(storageKeys.ORG_ID); @@ -70,9 +53,15 @@ const DIDList = () => { } } + const getUserOrgRoles = async () => { + const orgRoles = await getFromLocalStorage(storageKeys.ORG_ROLES); + const roles = orgRoles.split(','); + setUserRoles(roles); + } + useEffect(() => { getData(); - fetchOrganizationDetails(); + getUserOrgRoles(); }, []) return ( @@ -90,6 +79,7 @@ const DIDList = () => {

DID Details

+ + + )} + +: + + { + + submitDedicatedWallet( + values, + privateKeyValue, + domainValue + ); + }} + + > + + {(formikHandlers):JSX.Element => ( +
+
+ +
+
+
+ - {formikHandlers?.errors?.seed && - formikHandlers?.touched?.seed && ( +
+
+ +
+
+ +
+ + {mappedDetails && + + Object.keys(mappedDetails).map((ledger) => ( + +
+ { + formikHandlers.handleChange(e); + handleLedgerChanges(e); + setSelectedLedger(ledger); + setSelectedMethod(''); + setSeedVal(seeds); + setSelectedDid(''); + }} + className="mr-2" + /> + + + + +
+ + ))} +
+ {formikHandlers.errors.ledger && ( - {formikHandlers?.errors?.seed} + {formikHandlers.errors.ledger} )} -
- {haveDid && ( -
-
-
+
+ +
+ {methodRenderOptions(formikHandlers)}
+ {formikHandlers.errors.method && ( + + {formikHandlers.errors.method} + + )} +
+ - - {formikHandlers?.errors?.did && - formikHandlers?.touched?.did && ( + {selectedLedger !== Ledgers.NO_LEDGER && ( +
+ +
+ {networkRenderOptions(formikHandlers)} +
+ {formikHandlers.errors.network && ( - {formikHandlers?.errors?.did} + {formikHandlers.errors.network} )} -
- )} - +
+ )} -
-
-
- - {formikHandlers?.errors?.walletName && - formikHandlers?.touched?.walletName && ( - - {formikHandlers?.errors?.walletName} - + {selectedLedger !== Ledgers.NO_LEDGER && ( + +
+ +
+ +
+ +
+ )} + +
+ + {selectedMethod === DidMethod.WEB && ( + )} -
-
-
-
- - {formikHandlers?.errors?.password && - formikHandlers?.touched?.password && ( - - {formikHandlers?.errors?.password} - - )}
- - - )} - + + +
+ + + + + + )} + + } + ); }; - export default DedicatedAgentForm; \ No newline at end of file diff --git a/src/components/organization/walletCommonComponents/SharedAgent.tsx b/src/components/organization/walletCommonComponents/SharedAgent.tsx index a66583e32..3df9d96f6 100644 --- a/src/components/organization/walletCommonComponents/SharedAgent.tsx +++ b/src/components/organization/walletCommonComponents/SharedAgent.tsx @@ -1,12 +1,12 @@ import { Button, Label, Checkbox } from "flowbite-react"; -import { Field, Form, Formik } from "formik"; +import { Field, Form, Formik, type FormikHelpers } from "formik"; import { useState, useEffect, type ChangeEvent } from "react"; import { getLedgerConfig, getLedgers } from "../../../api/Agent"; import { apiStatusCodes } from "../../../config/CommonConstant"; import * as yup from 'yup'; import type { AxiosResponse } from 'axios'; import CopyDid from '../../../commonComponents/CopyDid'; -import { DidMethod } from '../../../common/enums'; +import { DidMethod, Ledgers, Network } from '../../../common/enums'; import SetDomainValueInput from './SetDomainValueInput'; import SetPrivateKeyValueInput from './SetPrivateKeyValue'; import type { ISharedAgentForm, IValuesShared } from "./interfaces"; @@ -58,10 +58,10 @@ const SharedAgentForm = ({ if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { const ledgerConfigData: ILedgerConfigData = { indy: { - 'did:indy': {} + [`${DidMethod.INDY}`]: {} }, polygon: { - 'did:polygon': {} + [`${DidMethod.POLYGON}`]: {} }, noLedger: {} }; @@ -69,26 +69,26 @@ const SharedAgentForm = ({ data.data.forEach(({ name, details }: ILedgerItem) => { const lowerName = name.toLowerCase(); - if (lowerName === 'indy' && details) { + if (lowerName === Ledgers.INDY && details) { for (const [key, subDetails] of Object.entries(details)) { if (typeof subDetails === 'object' && subDetails !== null) { for (const [subKey, value] of Object.entries(subDetails)) { - const formattedKey = `${key}:${subKey}`.replace('did:indy:', ''); - ledgerConfigData.indy['did:indy'][formattedKey] = value; + const formattedKey = `${key}:${subKey}`.replace(`${DidMethod.INDY}:`, ''); + ledgerConfigData.indy[`${DidMethod.INDY}`][formattedKey] = value; } } } - } else if (lowerName === 'polygon' && details) { + } else if (lowerName === Ledgers.POLYGON && details) { for (const [key, value] of Object.entries(details)) { if (typeof value === 'object' && value !== null) { for (const [subKey, subValue] of Object.entries(value)) { - ledgerConfigData.polygon['did:polygon'][subKey] = subValue; + ledgerConfigData.polygon[`${DidMethod.POLYGON}`][subKey] = subValue; } } else if (typeof value === 'string') { - ledgerConfigData.polygon['did:polygon'][key] = value; + ledgerConfigData.polygon[`${DidMethod.POLYGON}`][key] = value; } } - } else if (lowerName === 'noledger' && details) { + } else if (lowerName === Ledgers.NO_LEDGER.toLowerCase() && details) { for (const [key, value] of Object.entries(details)) { ledgerConfigData.noLedger[key] = value as string; } @@ -185,6 +185,7 @@ const SharedAgentForm = ({ formikHandlers.handleChange(e); handleMethodChange(e); setSelectedMethod(method); + setDomainValue(''); }} className="mr-2" /> @@ -206,8 +207,13 @@ const SharedAgentForm = ({ return null; } - return Object.keys(networks).map((network) => ( -
+ let filteredNetworks = Object.keys(networks); + if (selectedMethod === DidMethod.POLYGON) { + filteredNetworks = filteredNetworks.filter(network => network === Network.TESTNET); + } + + return filteredNetworks.map((network) => ( +
{ - + onSubmit={(values: IValuesShared, + actions: FormikHelpers + ) => { if (!values.privatekey) { values.privatekey = privateKeyValue; } @@ -278,6 +285,7 @@ const SharedAgentForm = ({ values, domainValue, ); + actions.resetForm(); }} > {(formikHandlers) => ( @@ -387,7 +395,7 @@ const SharedAgentForm = ({ )}
- {selectedLedger !== 'noLedger' && ( + {selectedLedger !== Ledgers.NO_LEDGER && (
)} @@ -460,7 +468,7 @@ const SharedAgentForm = ({
- {selectedMethod === 'did:polygon' && ( + {selectedMethod === DidMethod.POLYGON && ( <>
diff --git a/src/components/organization/walletCommonComponents/WalletSpinup.tsx b/src/components/organization/walletCommonComponents/WalletSpinup.tsx index 855a9db58..091958633 100644 --- a/src/components/organization/walletCommonComponents/WalletSpinup.tsx +++ b/src/components/organization/walletCommonComponents/WalletSpinup.tsx @@ -1,7 +1,8 @@ import { apiStatusCodes, storageKeys } from '../../../config/CommonConstant'; -import { getFromLocalStorage, passwordEncryption } from '../../../api/Auth'; +import { getFromLocalStorage } from '../../../api/Auth'; import { - spinupDedicatedAgent, + createDid, + getOrganizationById, spinupSharedAgent, } from '../../../api/organization'; import { useEffect, useState } from 'react'; @@ -11,10 +12,12 @@ import SOCKET from '../../../config/SocketConfig'; import { nanoid } from 'nanoid'; import { AlertComponent } from '../../AlertComponent'; import { DidMethod } from '../../../common/enums'; -import DedicatedAgentForm from './DedicatedAgent'; +import DedicatedAgentForm from '../walletCommonComponents/DedicatedAgent'; import SharedAgentForm from './SharedAgent'; import WalletSteps from './WalletSteps'; import type { IValuesShared } from './interfaces'; +import OrganizationDetails from '../OrganizationDetails'; +import type { Organisation } from '../interfaces'; interface Values { seed: string; @@ -41,7 +44,10 @@ const WalletSpinup = (props: { const [failure, setFailure] = useState(null); const [seeds, setSeeds] = useState(''); const [maskedSeeds, setMaskedSeeds] = useState(''); - + const [orgData, setOrgData] = useState(null); + const [isShared, setIsShared] = useState(false); + const [isConfiguredDedicated, setIsConfiguredDedicated] = useState(false); + const maskSeeds = (seed: string) => { const visiblePart = seed.slice(0, -10); const maskedPart = seed.slice(-10).replace(/./g, '*'); @@ -54,30 +60,73 @@ const WalletSpinup = (props: { setSeeds(generatedSeeds); setMaskedSeeds(masked); }, []); + + const configureDedicatedWallet = ()=> { + setIsConfiguredDedicated(true); + } + const fetchOrganizationDetails = async () => { + setLoading(true); + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + const response = await getOrganizationById(orgId as string); + const { data } = response as AxiosResponse; + setLoading(false) + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + + const agentData = data?.data?.org_agents + + if (data?.data?.org_agents && data?.data?.org_agents[0]?.org_agent_type?.agent?.toLowerCase() === AgentType.DEDICATED){ + setIsConfiguredDedicated(true) + setAgentType(AgentType.DEDICATED) + } + + if (agentData.length > 0 && agentData?.orgDid) { + setOrgData(data?.data); + } + }; +} + + useEffect(() => { + fetchOrganizationDetails() + }, []); const onRadioSelect = (type: string) => { setAgentType(type); }; - const submitDedicatedWallet = async (values: Values) => { - const payload = { - walletName: values.walletName, - seed: values.seed || seeds, - walletPassword: passwordEncryption(values.password), - did: values.did, - ledgerId: [values.network.toString()], - clientSocketId: SOCKET.id, +const submitDedicatedWallet = async ( + values: IValuesShared, + privatekey: string, + domain: string +) => { + const didData = { + seed:values.method === DidMethod.POLYGON ? '' : seeds, + keyType: values.keyType || 'ed25519', + method: values.method.split(':')[1] || '', + network: + values.method === DidMethod.INDY ? + values.network?.split(':').slice(2).join(':') : + values.method === DidMethod.POLYGON + ? values.network?.split(':').slice(1).join(':') + : '', + domain: values.method === DidMethod.WEB ? domain : '', + role: values.method === DidMethod.INDY ? 'endorser' : '', + privatekey: values.method === DidMethod.POLYGON ? privatekey : '', + did: values.did || '', + endorserDid: values?.endorserDid || '', + isPrimaryDid: true, }; - setLoading(true); const orgId = await getFromLocalStorage(storageKeys.ORG_ID); - const spinupRes = await spinupDedicatedAgent(payload, orgId); + + const spinupRes = await createDid(didData); const { data } = spinupRes as AxiosResponse; - if (data?.statusCode === apiStatusCodes.API_STATUS_CREATED) { - if (data?.data['agentSpinupStatus'] === 1) { - setAgentSpinupCall(true); + + if (data?.data?.did) { + setAgentSpinupCall(true); + window.location.reload(); + } else { setFailure(spinupRes as string); } @@ -121,6 +170,7 @@ const WalletSpinup = (props: { if (data?.data['agentSpinupStatus'] === 1) { setAgentSpinupCall(true); + setIsShared(true) } else { setFailure(spinupRes as string); } @@ -203,20 +253,31 @@ const WalletSpinup = (props: { isCopied={false} /> ); - } else { + } else { formComponent = ( ); } - } else { - formComponent = ( - - ); - } + } + + else { + + if (agentType === AgentType.SHARED) { + formComponent = ( + + ); + } + else { + formComponent = ( + + ); + } + } return (
@@ -249,6 +310,7 @@ const WalletSpinup = (props: {
); -}; +} + export default WalletSpinup; + diff --git a/src/components/organization/walletCommonComponents/interfaces/index.tsx b/src/components/organization/walletCommonComponents/interfaces/index.tsx index 0c957f4b0..902913508 100644 --- a/src/components/organization/walletCommonComponents/interfaces/index.tsx +++ b/src/components/organization/walletCommonComponents/interfaces/index.tsx @@ -9,7 +9,9 @@ export interface IValues { export interface IDedicatedAgentForm { seeds: string; loading: boolean; - submitDedicatedWallet: (values: IValues) => void; + submitDedicatedWallet: (values: IValuesShared, privatekey: string, + domain: string) => void; + onConfigureDedicated:() => void, } export interface IValuesShared { @@ -50,4 +52,37 @@ export interface ISharedAgentForm { ) => void; } +export interface ILedgerConfigData { + indy: { + 'did:indy': { + [key: string]: string; + }; + }; + polygon: { + 'did:polygon': { + [key: string]: string; + }; + }; + noLedger: { + [key: string]: string; + }; +} +export interface ILedgerItem { + name: string; + details: IDetails; +} +interface IDetails { + [key: string]: string | { [subKey: string]: string }; +} + +export interface IDedicatedAgentData { + walletName: string; + agentEndpoint: string; + apiKey: string; + seed:string; + keyType:string; + method:string; + network:string; + role:string; +} \ No newline at end of file diff --git a/src/config/apiRoutes.ts b/src/config/apiRoutes.ts index 1e8f95d11..f2a9b2f33 100644 --- a/src/config/apiRoutes.ts +++ b/src/config/apiRoutes.ts @@ -41,7 +41,12 @@ export const apiRoutes = { editUserROle: '/user-roles', didList: '/dids', createDid: '/agents/did', - primaryDid: '/primary-did' + primaryDid: '/primary-did', + getOrgReferences:'/activity-count', + deleteOrganization:'/organizations/deleteorganizations', + deleteVerifications:'/verification-records', + deleteIssaunce:'/issuance-records', + deleteConnections:'/connections' }, connection: { create: '/connections', @@ -81,7 +86,10 @@ export const apiRoutes = { agentDedicatedSpinup: '/agents/spinup', agentSharedSpinup: '/agents/wallet', getLedgerConfig: '/agents/ledgerConfig', - createPolygonKeys: '/agents/polygon/create-keys' + createPolygonKeys: '/agents/polygon/create-keys', + setAgentConfig:'/agents/configure', + deleteWallet: '/agents/wallet', + }, Platform: { getAllSchemaFromPlatform: '/platform/schemas', @@ -106,6 +114,7 @@ export const apiRoutes = { invitations: '/invitations', usersInvitation: '/users/invitations', members: '/members', + deleteOrgFromEcosystem:'/member-org' }, setting:{ setting: '/client_credentials' diff --git a/src/config/envConfig.ts b/src/config/envConfig.ts index a8ea0b9b6..0b4ff3061 100644 --- a/src/config/envConfig.ts +++ b/src/config/envConfig.ts @@ -17,7 +17,7 @@ if (import.meta.env) { } } -const { PUBLIC_BASE_URL, PUBLIC_POLYGON_TESTNET_URL, PUBLIC_POLYGON_MAINNET_URL, PUBLIC_CRYPTO_PRIVATE_KEY,PUBLIC_SHOW_NAME_AS_LOGO, PUBLIC_PLATFORM_NAME, PUBLIC_PLATFORM_LOGO, PUBLIC_POWERED_BY, PUBLIC_PLATFORM_WEB_URL, PUBLIC_POWERED_BY_URL, PUBLIC_PLATFORM_DOCS_URL, PUBLIC_PLATFORM_GIT, PUBLIC_PLATFORM_SUPPORT_EMAIL, PUBLIC_PLATFORM_TWITTER_URL, PUBLIC_PLATFORM_SUPPORT_INVITE, PUBLIC_PLATFORM_DISCORD_URL, PUBLIC_ALLOW_DOMAIN }: any = envVariables; +const { PUBLIC_BASE_URL, PUBLIC_POLYGON_TESTNET_URL, PUBLIC_POLYGON_MAINNET_URL, PUBLIC_CRYPTO_PRIVATE_KEY,PUBLIC_SHOW_NAME_AS_LOGO, PUBLIC_PLATFORM_NAME, PUBLIC_PLATFORM_LOGO, PUBLIC_POWERED_BY, PUBLIC_PLATFORM_WEB_URL, PUBLIC_POWERED_BY_URL, PUBLIC_PLATFORM_DOCS_URL, PUBLIC_PLATFORM_GIT, PUBLIC_PLATFORM_SUPPORT_EMAIL, PUBLIC_PLATFORM_TWITTER_URL, PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_ID, PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_SECRETE, PUBLIC_PLATFORM_SUPPORT_INVITE, PUBLIC_PLATFORM_DISCORD_URL, PUBLIC_ALLOW_DOMAIN }: any = envVariables; export const envConfig = { PUBLIC_BASE_URL: @@ -62,6 +62,12 @@ export const envConfig = { discord: PUBLIC_PLATFORM_DISCORD_URL || import.meta.env.PUBLIC_PLATFORM_DISCORD_URL, + clientId: + PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_ID || + import.meta.env.PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_ID, + clientSecrete: + PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_SECRETE || + import.meta.env.PUBLIC_KEYCLOAK_MANAGEMENT_CLIENT_SECRETE, }, PUBLIC_ALLOW_DOMAIN: PUBLIC_ALLOW_DOMAIN || import.meta.env.PUBLIC_ALLOW_DOMAIN } \ No newline at end of file diff --git a/src/config/pathRoutes.ts b/src/config/pathRoutes.ts index d4df16e15..932ea78a1 100644 --- a/src/config/pathRoutes.ts +++ b/src/config/pathRoutes.ts @@ -1,3 +1,4 @@ +import { deleteOrganizationInvitation } from "../api/organization"; import { envConfig } from "./envConfig"; export const pathRoutes = { @@ -27,6 +28,10 @@ export const pathRoutes = { issuedCredentials: '/organizations/credentials', credentials: '/organizations/verification', createSchema: '/organizations/schemas/create', + deleteOrganization:'/organizations/delete-organizations', + + + viewSchema: '/organizations/schemas/view-schema', Issuance: { issue: '/organizations/credentials/issue', diff --git a/src/pages/organizations/dashboard/index.astro b/src/pages/organizations/dashboard/index.astro index 3612ea7c9..32d1b96e9 100644 --- a/src/pages/organizations/dashboard/index.astro +++ b/src/pages/organizations/dashboard/index.astro @@ -13,4 +13,4 @@ if (!response.authorized) { - \ No newline at end of file + \ No newline at end of file diff --git a/src/pages/organizations/delete-organizations.astro b/src/pages/organizations/delete-organizations.astro new file mode 100644 index 000000000..5c1f69b7e --- /dev/null +++ b/src/pages/organizations/delete-organizations.astro @@ -0,0 +1,16 @@ +--- +import LayoutSidebar from '../../app/LayoutSidebar.astro'; +import { checkUserSession } from '../../utils/check-session'; +import { pathRoutes } from '../../config/pathRoutes'; +import DeleteOrganization from '../../components/organization/DeleteOrganization'; + +const response = await checkUserSession({cookies: Astro.cookies, currentPath: Astro.url.pathname}); +const route: string = pathRoutes.auth.sinIn +if (!response.authorized) { + return Astro.redirect(response.redirect); +} +--- + + + +