Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/credebl/studio into merg…
Browse files Browse the repository at this point in the history
…e-dev-to-prod-nov24
  • Loading branch information
sanjay-k1910 committed Nov 23, 2023
2 parents 4006fab + c2a9e14 commit 79c60ab
Show file tree
Hide file tree
Showing 46 changed files with 818 additions and 683 deletions.
2 changes: 1 addition & 1 deletion src/api/Agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { apiRoutes } from "../config/apiRoutes";
import { getFromLocalStorage } from "./Auth";
import { storageKeys } from "../config/CommonConstant";

export const getAgentHealth = async (orgId:number) => {
export const getAgentHealth = async (orgId:string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.checkAgentHealth}`,
Expand Down
20 changes: 4 additions & 16 deletions src/api/BulkIssuance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type download from 'downloadjs';
import { apiRoutes } from '../config/apiRoutes';
import { storageKeys } from '../config/CommonConstant';
import {
Expand All @@ -24,9 +23,8 @@ export const getSchemaCredDef = async () => {
}
};

export const DownloadCsvTemplate = async () => {
export const DownloadCsvTemplate = async (credDefId: string) => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
const credDefId = await getFromLocalStorage(storageKeys.CRED_DEF_ID);
const url = `${apiRoutes.organizations.root}/${orgId}/${credDefId}${apiRoutes.Issuance.download}`;

const axiosPayload = {
Expand All @@ -42,14 +40,8 @@ export const DownloadCsvTemplate = async () => {
}
};

// bulk issuance

// upload file

export const uploadCsvFile = async (payload: any) => {
export const uploadCsvFile = async (payload: {file: Uint8Array | Blob, fileName:string}, credefId: string) => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
const credefId = await getFromLocalStorage(storageKeys.CRED_DEF_ID);

const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.bulk.uploadCsv}?credDefId=${credefId}`;

const axiosPayload = {
Expand All @@ -66,8 +58,6 @@ export const uploadCsvFile = async (payload: any) => {
}
};

//get file data

export const getCsvFileData = async (
requestId: any,
pageNumber: number,
Expand Down Expand Up @@ -110,15 +100,13 @@ export const issueBulkCredential = async (requestId: string, clientId: string) =
}
};

export const retryBulkIssuance = async (fileId:string) => {
const socketId= await getFromLocalStorage(storageKeys.SOCKET_ID)

export const retryBulkIssuance = async (fileId:string, clientId:string) => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
const url = `${apiRoutes.organizations.root}/${orgId}/${fileId}${apiRoutes.Issuance.bulk.retry}`;

const axiosPayload = {
url,
payload:{clientId:socketId},
payload:{clientId:clientId},
config: await getHeaderConfigs(),
};

Expand Down
8 changes: 4 additions & 4 deletions src/api/Schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const getAllSchemasByOrgId = async ({ search, itemPerPage, page }: GetAll
}
}

export const addSchema = async (payload: createSchema, orgId: number) => {
export const addSchema = async (payload: createSchema, orgId: string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.create}`,
Expand All @@ -72,7 +72,7 @@ export const addSchema = async (payload: createSchema, orgId: number) => {
}
}

export const getSchemaById = async (schemaId: string, orgId: number) => {
export const getSchemaById = async (schemaId: string, orgId: string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.getSchemaById}/${schemaId}`,
Expand All @@ -94,7 +94,7 @@ export const getSchemaById = async (schemaId: string, orgId: number) => {
}
}

export const createCredentialDefinition = async (payload: createCredDeffFieldName, orgId:number) => {
export const createCredentialDefinition = async (payload: createCredDeffFieldName, orgId:string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.createCredentialDefinition}`,
Expand All @@ -118,7 +118,7 @@ export const createCredentialDefinition = async (payload: createCredDeffFieldNam
}
}

export const getCredDeffById = async (schemaId: string, orgId: number) => {
export const getCredDeffById = async (schemaId: string, orgId: string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.getCredDefBySchemaId}/${schemaId}/cred-defs`,
Expand Down
6 changes: 3 additions & 3 deletions src/api/ecosystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface CreateEcosystemPayload {
description: string;
logo: string;
tags?: string;
userId: number;
userId: string;
autoEndorsement: boolean;
}

Expand Down Expand Up @@ -105,7 +105,7 @@ export const getEndorsementList = async (
export const createSchemaRequest = async (
data: object,
endorsementId: string,
orgId: number,
orgId: string,
) => {
const url = `${apiRoutes.Ecosystem.root}/${endorsementId}/${orgId}${apiRoutes.Ecosystem.endorsements.createSchemaRequest}`;
const payload = data;
Expand All @@ -126,7 +126,7 @@ export const createSchemaRequest = async (
export const createCredDefRequest = async (
data: object,
ecosystemId: string,
orgId: number,
orgId: string,
) => {
const url = `${apiRoutes.Ecosystem.root}/${ecosystemId}/${orgId}${apiRoutes.Ecosystem.endorsements.createCredDefRequest}`;
const payload = data;
Expand Down
10 changes: 5 additions & 5 deletions src/api/invitations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const createInvitations = async (invitationList: Array<object>) => {
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.organizations.invitations}`
const payload = {
invitations: invitationList,
orgId: Number(orgId)
orgId: orgId
}
const token = await getFromLocalStorage(storageKeys.TOKEN)

Expand Down Expand Up @@ -233,7 +233,7 @@ export const getEcosystemInvitations = async (pageNumber: number, pageSize: numb
}

// Accept/ Reject Invitations
export const acceptRejectEcosystemInvitations = async (invitationId: string, orgId: number, status: string, orgName: string, orgDid: string) => {
export const acceptRejectEcosystemInvitations = async (invitationId: string, orgId: string, status: string, orgName: string, orgDid: string) => {

const url = `${apiRoutes.Ecosystem.root}/${orgId}${apiRoutes.Ecosystem.invitations}/${invitationId}`

Expand Down Expand Up @@ -265,12 +265,12 @@ export const acceptRejectEcosystemInvitations = async (invitationId: string, org
}
}

export const acceptRejectInvitations = async (invitationId: number, orgId: number, status: string) => {
export const acceptRejectInvitations = async (invitationId: string, orgId: string, status: string) => {

const url = `${apiRoutes.users.invitations}/${invitationId}`

const payload = {
orgId: Number(orgId),
orgId: orgId,
status
}
const token = await getFromLocalStorage(storageKeys.TOKEN)
Expand All @@ -296,7 +296,7 @@ export const acceptRejectInvitations = async (invitationId: number, orgId: numbe
}
}

export const deleteEcosystemInvitations = async (invitationId: number) => {
export const deleteEcosystemInvitations = async (invitationId: string) => {

const ecosystemId = await getFromLocalStorage(storageKeys.ECOSYSTEM_ID);
const orgId = await getFromLocalStorage(storageKeys.ORG_ID)
Expand Down
8 changes: 4 additions & 4 deletions src/api/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const getOrgDashboard = async (orgId: string) => {
}
}

export const spinupDedicatedAgent = async (data: object, orgId:number) => {
export const spinupDedicatedAgent = async (data: object, orgId:string) => {

const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.agentDedicatedSpinup}`
const payload = data
Expand Down Expand Up @@ -166,7 +166,7 @@ export const spinupDedicatedAgent = async (data: object, orgId:number) => {
}
}

export const spinupSharedAgent = async (data: object, orgId:number) => {
export const spinupSharedAgent = async (data: object, orgId:string) => {

const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.agentSharedSpinup}`
const payload = data
Expand Down Expand Up @@ -247,7 +247,7 @@ export const getOrganizationUsers = async (pageNumber: number, pageSize: number,
}

// Edit user roles
export const editOrganizationUserRole = async (userId: number, roles: number[]) => {
export const editOrganizationUserRole = async (userId: string, roles: string[]) => {

const orgId = await getFromLocalStorage(storageKeys.ORG_ID)

Expand Down Expand Up @@ -284,7 +284,7 @@ export const createConnection = async (orgName: string) => {
label: orgName,
multiUseInvitation: true,
autoAcceptConnection: true,
orgId: Number(orgId)
orgId: orgId
}
const payload = data

Expand Down
22 changes: 22 additions & 0 deletions src/common/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,25 @@ export enum EcosystemRoles {
export enum PlatformRoles {
platformAdmin = "platform_admin"
}

export enum BulkIssuanceHistory {
started = 'PROCESS_STARTED',
completed = 'PROCESS_COMPLETED',
interrupted= 'PROCESS_INTERRUPTED',
retry= 'PROCESS_REINITIATED',
partially_completed= 'PARTIALLY_COMPLETED'

}

export enum BulkIssuanceHistoryData {
started = 'Process Started',
completed = 'Process Completed',
interrupted= 'Process Interrupted',
retry= 'Process Reinitiated',
partially_completed= "Process Failed"
}

export enum BulkIssuanceStatus {
successful= 'Successful',
failed= 'Failed'
}
16 changes: 13 additions & 3 deletions src/common/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ ul[role="tablist"] li[role="presentation"] button[aria-selected="true"] {
@apply text-primary-700 border-primary-700;
}

button.role-btn span {
@apply overflow-hidden;
border-radius: 8px;
padding-top: 6.5px;
padding-bottom: 6.5px;
}

.word-break-word{
word-break: break-word !important;
}
Expand Down Expand Up @@ -103,7 +110,7 @@ ul.timelinestatic {
}

.search-dropdown .select__control .select__placeholder {
@apply absolute flex items-start;
@apply absolute flex items-start ml-2;
}

.search-dropdown .select__control .select__value-container{
Expand All @@ -112,8 +119,11 @@ ul.timelinestatic {
}

.select__single-value{
@apply !text-primary-700;
width: calc(100% - 5px);
@apply dark:!text-white !text-primary-700 w-fit;
}

.select__value-container .select__value-container--has-value .select__single-value {
@apply w-fit;
}

.search-dropdown{
Expand Down
2 changes: 1 addition & 1 deletion src/commonComponents/AgentHealth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const AgentHealth = () => {
const organizationId = await getFromLocalStorage(storageKeys.ORG_ID);
setCheckOrgExist(Number(organizationId))
if (Number(organizationId) !== 0) {
const agentData = await getAgentHealth(Number(organizationId));
const agentData = await getAgentHealth(organizationId);
const { data } = agentData as AxiosResponse;
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
setAgentHealthDetails(data?.data);
Expand Down
6 changes: 3 additions & 3 deletions src/components/CreateEcosystemOrgModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
storageKeys,
} from '../../config/CommonConstant';
import { calculateSize, dataURItoBlob } from '../../utils/CompressImage';
import { useEffect, useState } from 'react';
import React, { useEffect, useState } from 'react';
import { AlertComponent } from '../AlertComponent';
import type { AxiosResponse } from 'axios';
import { asset } from '../../lib/data.js';
Expand Down Expand Up @@ -186,7 +186,7 @@ const CreateEcosystemOrgModal = (props: IProps) => {
description: values.description,
logo: (logoImage?.imagePreviewUrl as string) || '',
tags: '',
userId: Number(user_data?.id),
userId: user_data?.id,
orgName: orgDetails?.orgName,
orgDid: orgDetails?.orgDid,
autoEndorsement: autoEndorse,
Expand Down Expand Up @@ -516,4 +516,4 @@ const CreateEcosystemOrgModal = (props: IProps) => {
return <>{renderEcosystemModal()}</>;
};

export default CreateEcosystemOrgModal;
export default CreateEcosystemOrgModal;
2 changes: 1 addition & 1 deletion src/components/Ecosystem/Endorsement/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ interface IEndorsementList {
status: string;
type: string;
ecosystemOrgs: {
orgId: number;
orgId: string;
};
requestPayload: string;
responsePayload: string;
Expand Down
6 changes: 3 additions & 3 deletions src/components/Ecosystem/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export interface IEcosystem {
}

export interface Ecosystem {
id: number
id: string
createDateTime: string
createdBy: number
createdBy: string
lastChangedDateTime: string
lastChangedBy: string
autoEndorsement:boolean
lastChangedBy: number
name: string
description: string
logoUrl: string
Expand Down
10 changes: 5 additions & 5 deletions src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export interface EcosystemInvitation {
ecosystem: { name: string; logoUrl: string; };
id: string
createDateTime: string
createdBy: number
createdBy: string
lastChangedDateTime: string
lastChangedBy: number
lastChangedBy: string
deletedAt: any
userId: string
orgId: string
Expand All @@ -60,7 +60,7 @@ const ReceivedInvitations = () => {
const [error, setError] = useState<string | null>(null);
const [organizationsList, setOrganizationsList] = useState<Array<Organisation> | null>(null);
const [currentPage, setCurrentPage] = useState(initialPageState);
const [selectedId, setSelectedId] = useState<number>();
const [selectedId, setSelectedId] = useState<string>('');
const [searchText, setSearchText] = useState('');
const [invitationsData, setInvitationsData] = useState<Array<EcosystemInvitation> | null>(null);
const [getOrgError, setGetOrgError] = useState<string | null>(null);
Expand Down Expand Up @@ -154,7 +154,7 @@ const ReceivedInvitations = () => {
if (orgDid) {
const response = await acceptRejectEcosystemInvitations(
invite.id,
Number(selectedId),
selectedId,
status,
orgName,
orgDid
Expand Down Expand Up @@ -222,7 +222,7 @@ const ReceivedInvitations = () => {
const getOrgId = async () => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
if (orgId) {
setSelectedId(Number(orgId));
setSelectedId(orgId);
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/EcosystemInvite/SentInvitations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const SentInvitations = () => {
setLoading(false);
};

const deletInvitations = async (invitationId: number) => {
const deletInvitations = async (invitationId: string) => {
const response = await deleteEcosystemInvitations(invitationId);
const { data } = response as AxiosResponse;

Expand Down
Loading

0 comments on commit 79c60ab

Please sign in to comment.