diff --git a/package-lock.json b/package-lock.json index f310511ed..5811ff266 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,8 +28,8 @@ "crypto-js": "^4.1.1", "dom-to-image": "^2.6.0", "downloadjs": "^1.4.7", - "flowbite": "^1.7.0", - "flowbite-react": "^0.4.10", + "flowbite": "^1.8.1", + "flowbite-react": "^0.4.11", "flowbite-typography": "^1.0.3", "formik": "^2.4.5", "html2canvas": "^1.4.1", @@ -4380,9 +4380,9 @@ } }, "node_modules/flowbite-react": { - "version": "0.4.10", - "resolved": "https://registry.npmjs.org/flowbite-react/-/flowbite-react-0.4.10.tgz", - "integrity": "sha512-VGtOJDOSk3VF6MODerKQ9AbP9Um0MdkI8YMJOUkL/Gou4/mnAOYMNuheUqF/tqg6WkxWsqcDybPgl87bYRI4LQ==", + "version": "0.4.11", + "resolved": "https://registry.npmjs.org/flowbite-react/-/flowbite-react-0.4.11.tgz", + "integrity": "sha512-QB0PWB/kiogL0YQlT+X1x4Ue0D3cpd+WaiCbGsMqo2LCYySRsctHxEciRQji3JELGuc6O1OaBtK9ZUSErQkJEg==", "dependencies": { "@floating-ui/react": "^0.24.3", "flowbite": "^1.6.6", @@ -15720,9 +15720,9 @@ } }, "flowbite-react": { - "version": "0.4.10", - "resolved": "https://registry.npmjs.org/flowbite-react/-/flowbite-react-0.4.10.tgz", - "integrity": "sha512-VGtOJDOSk3VF6MODerKQ9AbP9Um0MdkI8YMJOUkL/Gou4/mnAOYMNuheUqF/tqg6WkxWsqcDybPgl87bYRI4LQ==", + "version": "0.4.11", + "resolved": "https://registry.npmjs.org/flowbite-react/-/flowbite-react-0.4.11.tgz", + "integrity": "sha512-QB0PWB/kiogL0YQlT+X1x4Ue0D3cpd+WaiCbGsMqo2LCYySRsctHxEciRQji3JELGuc6O1OaBtK9ZUSErQkJEg==", "requires": { "@floating-ui/react": "^0.24.3", "flowbite": "^1.6.6", diff --git a/package.json b/package.json index 0334396c0..1405581ee 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,8 @@ "crypto-js": "^4.1.1", "dom-to-image": "^2.6.0", "downloadjs": "^1.4.7", - "flowbite": "^1.7.0", - "flowbite-react": "^0.4.10", + "flowbite": "^1.8.1", + "flowbite-react": "^0.4.11", "flowbite-typography": "^1.0.3", "formik": "^2.4.5", "html2canvas": "^1.4.1", diff --git a/public/images/1.svg b/public/images/1.svg new file mode 100644 index 000000000..4f2d072d6 --- /dev/null +++ b/public/images/1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/public/images/2.svg b/public/images/2.svg new file mode 100644 index 000000000..f274a4deb --- /dev/null +++ b/public/images/2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/public/images/Black bg.svg b/public/images/Black bg.svg deleted file mode 100644 index 8045949fe..000000000 --- a/public/images/Black bg.svg +++ /dev/null @@ -1,277 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/public/images/DPG-alliance.png b/public/images/DPG-alliance.png new file mode 100644 index 000000000..5279d9a82 Binary files /dev/null and b/public/images/DPG-alliance.png differ diff --git a/public/images/Frame.svg b/public/images/Frame.svg deleted file mode 100644 index 8e2613e9f..000000000 --- a/public/images/Frame.svg +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/public/images/bg_banner_image.png b/public/images/bg_banner_image.png deleted file mode 100644 index 2181ff0a4..000000000 Binary files a/public/images/bg_banner_image.png and /dev/null differ diff --git a/public/images/blue_line_bg.svg b/public/images/blue_line_bg.svg new file mode 100644 index 000000000..9cd027532 --- /dev/null +++ b/public/images/blue_line_bg.svg @@ -0,0 +1,1828 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/images/credebl-screenshot.png b/public/images/credebl-screenshot.png deleted file mode 100644 index b460748ec..000000000 Binary files a/public/images/credebl-screenshot.png and /dev/null differ diff --git a/public/images/dark-dpg-alliance.svg b/public/images/dark-dpg-alliance.svg new file mode 100644 index 000000000..5c8ffb092 --- /dev/null +++ b/public/images/dark-dpg-alliance.svg @@ -0,0 +1,51 @@ + + + + + + + + + + diff --git a/public/images/half_banner.png b/public/images/half_banner.png deleted file mode 100644 index 22b2e3086..000000000 Binary files a/public/images/half_banner.png and /dev/null differ diff --git a/public/images/mobile_1.svg b/public/images/mobile_1.svg new file mode 100644 index 000000000..84c9177ae --- /dev/null +++ b/public/images/mobile_1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/public/images/mobile_2.svg b/public/images/mobile_2.svg new file mode 100644 index 000000000..1d902cd68 --- /dev/null +++ b/public/images/mobile_2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/public/images/mobile_mockup.svg b/public/images/mobile_mockup.svg new file mode 100644 index 000000000..29d965cde --- /dev/null +++ b/public/images/mobile_mockup.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/public/images/org-dashboard-dark.png b/public/images/org-dashboard-dark.png new file mode 100644 index 000000000..966015297 Binary files /dev/null and b/public/images/org-dashboard-dark.png differ diff --git a/public/images/org-dashboard-light.png b/public/images/org-dashboard-light.png new file mode 100644 index 000000000..6f4eab293 Binary files /dev/null and b/public/images/org-dashboard-light.png differ diff --git a/public/images/sec3-1-dark.png b/public/images/sec3-1-dark.png new file mode 100644 index 000000000..2390a5479 Binary files /dev/null and b/public/images/sec3-1-dark.png differ diff --git a/public/images/sec3-1-light.png b/public/images/sec3-1-light.png new file mode 100644 index 000000000..9ae162171 Binary files /dev/null and b/public/images/sec3-1-light.png differ diff --git a/public/images/sec3-2-dark.png b/public/images/sec3-2-dark.png new file mode 100644 index 000000000..4d95762d4 Binary files /dev/null and b/public/images/sec3-2-dark.png differ diff --git a/public/images/sec3-2-light.png b/public/images/sec3-2-light.png new file mode 100644 index 000000000..a424580ce Binary files /dev/null and b/public/images/sec3-2-light.png differ diff --git a/src/api/issuance.ts b/src/api/issuance.ts index e502b364d..cce5d83fe 100644 --- a/src/api/issuance.ts +++ b/src/api/issuance.ts @@ -1,4 +1,3 @@ -import axios from 'axios'; import { apiRoutes } from '../config/apiRoutes'; import { storageKeys } from '../config/CommonConstant'; import { @@ -14,8 +13,8 @@ export const getIssuedCredentials = async ({page, sortBy, sortingOrder}: IConnectionListAPIParameter) => { const orgId = await getFromLocalStorage(storageKeys.ORG_ID); - const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.getIssuedCredentials}?pageSize=${itemPerPage}&pageNumber=${page}&searchByText=${search}&sortByValue=${sortingOrder}&sorting=${sortBy}`; - + const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.getIssuedCredentials}?pageSize=${itemPerPage}&pageNumber=${page}&searchByText=${search}&sortBy=${sortingOrder}&sortField=${sortBy}`; + const axiosPayload = { url, config: await getHeaderConfigs(), diff --git a/src/api/organization.ts b/src/api/organization.ts index 818be26e5..73cf3ad8b 100644 --- a/src/api/organization.ts +++ b/src/api/organization.ts @@ -1,354 +1,364 @@ -import { axiosGet, axiosPost, axiosPublicOrganisationGet, axiosPut } from "../services/apiRequests" - -import { apiRoutes } from "../config/apiRoutes"; -import { getFromLocalStorage } from "./Auth"; -import { getHeaderConfigs } from "../config/GetHeaderConfigs"; -import { storageKeys } from "../config/CommonConstant"; +import { + axiosDelete, + axiosGet, + axiosPost, + axiosPublicOrganisationGet, + axiosPut, +} from '../services/apiRequests'; + +import { apiRoutes } from '../config/apiRoutes'; +import { getFromLocalStorage } from './Auth'; +import { getHeaderConfigs } from '../config/GetHeaderConfigs'; +import { storageKeys } from '../config/CommonConstant'; export const createOrganization = async (data: object) => { + const url = apiRoutes.organizations.create; + const payload = data; + const token = await getFromLocalStorage(storageKeys.TOKEN); - const url = apiRoutes.organizations.create - 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 updateOrganization = async (data: object, orgId:string) => { - - const url = `${apiRoutes.organizations.update}/${orgId}` - 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 axiosPut(axiosPayload); - } - catch (error) { - const err = error as Error - return err?.message - } -} - - -export const getOrganizations = async (pageNumber: number, pageSize: number, search = '') => { - - const url = `${apiRoutes.organizations.getAll}?pageNumber=${pageNumber}&pageSize=${pageSize}&search=${search}` - - 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 - } -} + const config = { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + }, + }; + const axiosPayload = { + url, + payload, + config, + }; -export const getOrganizationById = async (orgId: string) => { + try { + return await axiosPost(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; + } +}; - const url = `${apiRoutes.organizations.getById}/${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 updateOrganization = async (data: object, orgId: string) => { + const url = `${apiRoutes.organizations.update}/${orgId}`; + const payload = data; + const token = await getFromLocalStorage(storageKeys.TOKEN); -export const getOrgDashboard = async (orgId: string) => { + const config = { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + }, + }; + const axiosPayload = { + url, + payload, + config, + }; - const url = `${apiRoutes.organizations.getOrgDashboard}/${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 spinupDedicatedAgent = async (data: object, orgId:string) => { - - const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.agentDedicatedSpinup}` - 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 - - 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 - } -} + try { + return await axiosPut(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; + } +}; +export const getOrganizations = async ( + pageNumber: number, + pageSize: number, + search = '', +) => { + const url = `${apiRoutes.organizations.getAll}?pageNumber=${pageNumber}&pageSize=${pageSize}&search=${search}`; -export const getOrganizationRoles = async () => { + const token = await getFromLocalStorage(storageKeys.TOKEN); + const config = { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + }, + }; + const axiosPayload = { + url, + config, + }; - const url = `${apiRoutes.organizations.orgRoles}` + try { + return await axiosGet(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; + } +}; - const token = await getFromLocalStorage(storageKeys.TOKEN) +export const getOrganizationById = async (orgId: string) => { + const url = `${apiRoutes.organizations.getById}/${orgId}`; - const config = { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${token}` - } - } - const axiosPayload = { - url, - config - } + const token = await getFromLocalStorage(storageKeys.TOKEN); - try { - return await axiosGet(axiosPayload); - } - catch (error) { - const err = error as Error - return err?.message - } -} + const config = { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + }, + }; + const axiosPayload = { + url, + config, + }; -//Get users of the organization -export const getOrganizationUsers = async (pageNumber: number, pageSize: number, search = '') => { + try { + return await axiosGet(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; + } +}; + +export const getOrgDashboard = async (orgId: string) => { + const url = `${apiRoutes.organizations.getOrgDashboard}/${orgId}`; - const orgId = await getFromLocalStorage(storageKeys.ORG_ID) - if (!orgId) { - return "Organization is required"; - } + const token = await getFromLocalStorage(storageKeys.TOKEN); - const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.users.fetchUsers}?&pageNumber=${pageNumber}&pageSize=${pageSize}&search=${search}` + const config = { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + }, + }; + const axiosPayload = { + url, + config, + }; - const axiosPayload = { - url, - config: await getHeaderConfigs() - } + try { + return await axiosGet(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; + } +}; - try { - return await axiosGet(axiosPayload); - } - catch (error) { - const err = error as Error - return err?.message - } -} +export const spinupDedicatedAgent = async (data: object, orgId: string) => { + const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.agentDedicatedSpinup}`; + const payload = data; -// Edit user roles -export const editOrganizationUserRole = async (userId: string, roles: string[]) => { - - const orgId = await getFromLocalStorage(storageKeys.ORG_ID) - - const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.organizations.editUserROle}/${userId}` - const payload = { - orgId, - userId, - orgRoleId: roles - } - - const axiosPayload = { - url, - payload, - config: await getHeaderConfigs() - } - - try { - return axiosPut(axiosPayload); - } - catch (error) { - const err = error as Error - return err?.message - } -} + const token = await getFromLocalStorage(storageKeys.TOKEN); -//Create Connection + 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 createConnection = async (orgName: string) => { - const orgId = await getFromLocalStorage(storageKeys.ORG_ID) - const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.connection.create}` - - const data = { - label: orgName, - multiUseInvitation: true, - autoAcceptConnection: true, - orgId: orgId - } - const payload = data - - const axiosPayload = { - url, - payload, - config: await getHeaderConfigs() - } - - 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; -// public profile + 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 getPublicOrganizations = async (pageNumber: number, pageSize: number, search :string) => { +export const getOrganizationRoles = async () => { + const url = `${apiRoutes.organizations.orgRoles}`; - const url = `${apiRoutes.Public.organizations}?pageNumber=${pageNumber}&pageSize=${pageSize}&search=${search}` + const token = await getFromLocalStorage(storageKeys.TOKEN); const config = { - headers: { - 'Content-Type': 'application/json', - } + 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; } +}; + +//Get users of the organization +export const getOrganizationUsers = async ( + pageNumber: number, + pageSize: number, + search = '', +) => { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + if (!orgId) { + return 'Organization is required'; + } + + const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.users.fetchUsers}?&pageNumber=${pageNumber}&pageSize=${pageSize}&search=${search}`; + const axiosPayload = { - url, - config + url, + config: await getHeaderConfigs(), + }; + + try { + return await axiosGet(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; } +}; + +// Edit user roles +export const editOrganizationUserRole = async ( + userId: string, + roles: string[], +) => { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + + const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.organizations.editUserROle}/${userId}`; + const payload = { + orgId, + userId, + orgRoleId: roles, + }; + + const axiosPayload = { + url, + payload, + config: await getHeaderConfigs(), + }; try { - return await axiosPublicOrganisationGet(axiosPayload); + return axiosPut(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; } - catch (error) { - const err = error as Error - return err?.message +}; + +//Create Connection + +export const createConnection = async (orgName: string) => { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.connection.create}`; + + const data = { + label: orgName, + multiUseInvitation: true, + autoAcceptConnection: true, + orgId: orgId, + }; + const payload = data; + + const axiosPayload = { + url, + payload, + config: await getHeaderConfigs(), + }; + + try { + return await axiosPost(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; } -} +}; -export const getPublicOrgDetails = async (orgSlug: string) => { +// public profile - const url = `${apiRoutes.Public.organizationDetails}/${orgSlug}` +export const getPublicOrganizations = async ( + pageNumber: number, + pageSize: number, + search: string, +) => { + const url = `${apiRoutes.Public.organizations}?pageNumber=${pageNumber}&pageSize=${pageSize}&search=${search}`; const config = { - headers: { - 'Content-Type': 'application/json', - } - } + headers: { + 'Content-Type': 'application/json', + }, + }; const axiosPayload = { - url, - config - } + url, + config, + }; try { - return await axiosPublicOrganisationGet(axiosPayload); + return await axiosPublicOrganisationGet(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; } - catch (error) { - const err = error as Error - return err?.message +}; + +export const getPublicOrgDetails = async (orgSlug: string) => { + const url = `${apiRoutes.Public.organizationDetails}/${orgSlug}`; + + const config = { + headers: { + 'Content-Type': 'application/json', + }, + }; + const axiosPayload = { + url, + config, + }; + + try { + return await axiosPublicOrganisationGet(axiosPayload); + } catch (error) { + const err = error as Error; + return err?.message; } -} +}; +// Edit user roles +export const deleteOrganizationInvitation = async ( + orgId: string, + invitationId: string, +) => { + const url = `${apiRoutes.organizations.root}/${orgId}/invitations/${invitationId}`; + + 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/app/LayoutCommon.astro b/src/app/LayoutCommon.astro index eaf79c26d..1a1a677ba 100644 --- a/src/app/LayoutCommon.astro +++ b/src/app/LayoutCommon.astro @@ -67,7 +67,7 @@ const supabaseKey =