Skip to content

Commit 5278ad1

Browse files
Merge pull request #497 from credebl/merge-dev-to-main
merge: develop to main
2 parents 852a390 + 0abc86f commit 5278ad1

108 files changed

Lines changed: 5327 additions & 3250 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 28 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"flowbite": "^1.7.0",
4848
"flowbite-react": "^0.4.10",
4949
"flowbite-typography": "^1.0.3",
50-
"formik": "^2.4.2",
50+
"formik": "^2.4.5",
5151
"html2canvas": "^1.4.1",
5252
"i": "^0.3.7",
5353
"moment": "^2.29.4",
@@ -60,7 +60,7 @@
6060
"react-helmet": "^6.1.0",
6161
"react-icons": "^4.10.1",
6262
"react-qr-code": "^2.0.11",
63-
"react-select": "^5.7.7",
63+
"react-select": "^5.8.0",
6464
"react-toastify": "^9.1.3",
6565
"secure-random-password": "^0.2.3",
6666
"shiki": "^0.14.1",

src/api/Agent.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,28 @@ export const getLedgers = async () => {
3737
},
3838
};
3939

40+
try {
41+
const response = await axiosGet(details)
42+
return response
43+
}
44+
catch (error) {
45+
const err = error as Error
46+
return err?.message
47+
}
48+
}
49+
50+
export const getLedgersPlatformUrl = async (indyNamespace: string) => {
51+
const token = await getFromLocalStorage(storageKeys.TOKEN)
52+
const details = {
53+
url: `${apiRoutes.Platform.getLedgerPlatformUrl}${indyNamespace}`,
54+
config: {
55+
headers: {
56+
'Content-type': 'application/json',
57+
'Authorization': `Bearer ${token}`,
58+
},
59+
},
60+
};
61+
4062
try {
4163
const response = await axiosGet(details)
4264
return response

src/api/Auth.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,16 @@ export const decryptData = (value: any): string => {
188188
}
189189

190190
export const setToLocalStorage = async (key: string, value: any) =>{
191+
// If passed value is object then checked empty object
192+
if (typeof value === 'object' && Boolean(Object.keys(value).length <= 0)) {
193+
return;
194+
}
195+
196+
// If passed value is string then checked if value is falsy
197+
if (typeof value === 'string' && !value?.trim()) {
198+
return;
199+
}
200+
191201
const convertedValue = await encryptData(value)
192202
const setValue = await localStorage.setItem(key, convertedValue as string)
193203
return true
@@ -200,9 +210,16 @@ export const getFromLocalStorage = async (key: string) =>{
200210
}
201211

202212
export const setToCookies = (cookies: AstroCookies, key: string, value: any, option: {[key: string]: any }) =>{
203-
if(!value.trim()){
204-
return
205-
}
213+
// If passed value is object then checked empty object
214+
if (typeof value === 'object' && Boolean(Object.keys(value).length <= 0)) {
215+
return;
216+
}
217+
218+
// If passed value is string then checked if value is falsy
219+
if (typeof value === 'string' && !value?.trim()) {
220+
return;
221+
}
222+
206223
const convertedValue = encryptData(value)
207224
// Set HttpOnly, Secure, and SameSite attributes in the options
208225
const updatedOption: { [key: string]: any }= {

src/api/Schema.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ import { storageKeys } from "../config/CommonConstant";
77

88
export const getAllSchemas = async ({itemPerPage, page, allSearch }: GetAllSchemaListParameter) => {
99
const token = await getFromLocalStorage(storageKeys.TOKEN)
10+
const ledgerId = await getFromLocalStorage(storageKeys.LEDGER_ID)
11+
1012
const details = {
11-
url: `${apiRoutes.Platform.getAllSchemaFromPlatform}?pageSize=${itemPerPage}&searchByText=${allSearch}&pageNumber=${page}`,
13+
url: `${apiRoutes.Platform.getAllSchemaFromPlatform}?pageSize=${itemPerPage}&searchByText=${allSearch}&pageNumber=${page}&ledgerId=${ledgerId}`,
1214
config: {
1315
headers: {
1416
'Content-type': 'application/json',
@@ -49,7 +51,7 @@ export const getAllSchemasByOrgId = async ({ search, itemPerPage, page }: GetAll
4951
}
5052
}
5153

52-
export const addSchema = async (payload: createSchema, orgId: string) => {
54+
export const createSchemas = async (payload: createSchema, orgId: string) => {
5355
const token = await getFromLocalStorage(storageKeys.TOKEN)
5456
const details = {
5557
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.create}`,

src/api/connection.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,24 @@ import { storageKeys } from '../config/CommonConstant';
33
import { getHeaderConfigs } from '../config/GetHeaderConfigs';
44
import { axiosGet } from '../services/apiRequests';
55
import { getFromLocalStorage } from './Auth';
6+
export interface IConnectionListAPIParameter {
7+
itemPerPage: number,
8+
page: number,
9+
search: string,
10+
sortBy: string,
11+
sortingOrder: string,
12+
}
613

7-
export const getConnectionsByOrg = async () => {
14+
export const getConnectionsByOrg = async ({
15+
page,
16+
itemPerPage,
17+
search,
18+
sortBy,
19+
sortingOrder
20+
}: IConnectionListAPIParameter) => {
821
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
9-
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.getAllConnections}`;
22+
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.getAllConnections}?pageSize=${itemPerPage}&pageNumber=${page}&searchByText=${search}&sortByValue=${sortingOrder}&sorting=${sortBy}`;
23+
1024
const axiosPayload = {
1125
url,
1226
config: await getHeaderConfigs(),

src/api/invitations.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,12 @@ export const getEcosystemInvitations = async (pageNumber: number, pageSize: numb
233233
}
234234

235235
// Accept/ Reject Invitations
236-
export const acceptRejectEcosystemInvitations = async (invitationId: string, orgId: string, status: string, orgName: string, orgDid: string) => {
236+
export const acceptRejectEcosystemInvitations = async (invitationId: string, orgId: string, status: string) => {
237237

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

240240
const payload = {
241-
status,
242-
orgName,
243-
orgDid
241+
status
244242
}
245243
const token = await getFromLocalStorage(storageKeys.TOKEN)
246244

src/api/issuance.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@ import axios from 'axios';
22
import { apiRoutes } from '../config/apiRoutes';
33
import { storageKeys } from '../config/CommonConstant';
44
import {
5-
getHeaderConfigs,
6-
getHeaderConfigsForFormData,
5+
getHeaderConfigs
76
} from '../config/GetHeaderConfigs';
87
import { axiosGet, axiosPost } from '../services/apiRequests';
98
import { getFromLocalStorage } from './Auth';
9+
import type { IConnectionListAPIParameter } from './connection';
1010

11-
export const getIssuedCredentials = async () => {
11+
export const getIssuedCredentials = async ({page,
12+
itemPerPage,
13+
search,
14+
sortBy,
15+
sortingOrder}: IConnectionListAPIParameter) => {
1216
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
13-
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.getIssuedCredentials}`;
17+
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.getIssuedCredentials}?pageSize=${itemPerPage}&pageNumber=${page}&searchByText=${search}&sortByValue=${sortingOrder}&sorting=${sortBy}`;
1418

1519
const axiosPayload = {
1620
url,
@@ -60,3 +64,22 @@ export const issueCredential = async (data: object) => {
6064
return err?.message;
6165
}
6266
};
67+
68+
export const issueOobEmailCredential = async (data: object) => {
69+
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
70+
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.issueOobEmailCredential}`;
71+
const payload = data;
72+
73+
const axiosPayload = {
74+
url,
75+
payload,
76+
config: await getHeaderConfigs(),
77+
};
78+
79+
try {
80+
return await axiosPost(axiosPayload);
81+
} catch (error) {
82+
const err = error as Error;
83+
return err?.message;
84+
}
85+
};

src/api/verification.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import { storageKeys } from '../config/CommonConstant';
44
import { getHeaderConfigs } from '../config/GetHeaderConfigs';
55
import { axiosGet, axiosPost } from '../services/apiRequests';
66
import { getFromLocalStorage } from './Auth';
7+
import type { IConnectionListAPIParameter } from './connection';
78

89
export const verifyCredential = async (payload: any) => {
910
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
10-
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Verification.verifyCredential}`; const axiosPayload = {
11+
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Verification.verifyCredential}`;
12+
const axiosPayload = {
1113
url,
1214
payload,
1315
config: await getHeaderConfigs(),
@@ -37,10 +39,16 @@ export const getVerificationCredential = async (state: IssueCredential) => {
3739
}
3840
};
3941

40-
export const getVerificationList = async () => {
42+
export const getVerificationList = async ({
43+
page,
44+
itemPerPage,
45+
search,
46+
sortBy,
47+
sortingOrder,
48+
}: IConnectionListAPIParameter) => {
4149
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
42-
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Verification.verifyCredential}`
43-
50+
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Verification.verifyCredential}?pageSize=${itemPerPage}&pageNumber=${page}&searchByText=${search}&sortByValue=${sortingOrder}&sorting=${sortBy}`;
51+
4452
const axiosPayload = {
4553
url,
4654
config: await getHeaderConfigs(),
@@ -71,8 +79,7 @@ export const verifyPresentation = async (proofId:string) => {
7179
};
7280

7381

74-
export const getProofAttributes=async (proofId:string)=>{
75-
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
82+
export const getProofAttributes=async (proofId:string, orgId: string)=>{
7683
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Verification.proofRequestAttributesVerification}/${proofId}/form`;
7784
const axiosPayload = {
7885
url,

0 commit comments

Comments
 (0)