Skip to content

Commit

Permalink
resolved conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: bhavanakarwade <[email protected]>
  • Loading branch information
bhavanakarwade committed Mar 27, 2024
2 parents 26458d7 + e36f4f4 commit e4ca9bd
Show file tree
Hide file tree
Showing 16 changed files with 202 additions and 161 deletions.
28 changes: 15 additions & 13 deletions src/api/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,29 +229,31 @@ export const encryptData = (value: any): string => {
const CRYPTO_PRIVATE_KEY: string = `${envConfig.PUBLIC_CRYPTO_PRIVATE_KEY}`

try {
const encJson: string = CryptoJS.AES.encrypt(JSON.stringify(value), CRYPTO_PRIVATE_KEY).toString();
let encData = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(encJson))

return encData;
if (typeof (value) !== 'string') {
value = JSON.stringify(value)
}
return CryptoJS.AES.encrypt(value, CRYPTO_PRIVATE_KEY).toString();
} catch (error) {
// Handle encryption error
console.error('Encryption error:', error);
return '';
}
}

const parsedData = (value: any) => {
try {
return JSON.parse(value.toString(CryptoJS.enc.Utf8));
} catch (error) {
return value.toString(CryptoJS.enc.Utf8);
}
}

export const decryptData = (value: any): string => {
const CRYPTO_PRIVATE_KEY: string = `${envConfig.PUBLIC_CRYPTO_PRIVATE_KEY}`

try {

let decData = CryptoJS.enc.Base64.parse(value).toString(CryptoJS.enc.Utf8)
let bytes = CryptoJS.AES.decrypt(decData, CRYPTO_PRIVATE_KEY).toString(CryptoJS.enc.Utf8)
const parsedData = JSON.parse(bytes);
if (typeof parsedData !== 'string') {
return JSON.stringify(parsedData);
}
return parsedData;
let bytes = CryptoJS.AES.decrypt(value, CRYPTO_PRIVATE_KEY);
return parsedData(bytes);
} catch (error) {
// Handle decryption error or invalid input
console.error('Decryption error:', error);
Expand Down Expand Up @@ -312,4 +314,4 @@ export const getFromCookies = (cookies: AstroCookies, key: string) =>{
export const removeFromLocalStorage = async (key: string) => {
await localStorage.removeItem(key);
return true;
};
};
6 changes: 3 additions & 3 deletions src/api/ecosystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ export const updateEcosystem = async (dataPayload: CreateEcosystemPayload) => {

export const getEcosystems = async (
orgId: string,
pageNumber?: number,
pageSize?: number,
pageNumber: number = 1,
pageSize: number = 10,
search = '',
) => {
const url = `${apiRoutes.Ecosystem.root}/${orgId}`;
const url = `${apiRoutes.Ecosystem.root}/${orgId}?pageNumber=${pageNumber}&pageSize=${pageSize}&search=${search}`;
const axiosPayload = {
url,
config: await getHeaderConfigs(),
Expand Down
4 changes: 2 additions & 2 deletions src/commonComponents/EcosystemProfileCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ const EcosystemProfileCard = ({getEndorsementListData}:IEndorsement) => {
setLoading(false)
const { data } = response as AxiosResponse;
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
setEcosystemList(data?.data.ecosystemDetails
setEcosystemList(data?.data.ecosystemList
)
const ecosystemData = data?.data?.ecosystemDetails?.find((item: { id: string }) => item.id === ecosystemId);
const ecosystemData = data?.data?.ecosystemList?.find((item: { id: string }) => item.id === ecosystemId);
if (ecosystemData) {
setEcosystemId(ecosystemData?.id)
const ecosystemOrg =
Expand Down
12 changes: 5 additions & 7 deletions src/components/Authentication/SignInUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,11 @@ const SignInUser = () => {

const saveEmail = async (values: emailValue) => {
setEmail(values);
await removeFromLocalStorage(storageKeys.TOKEN)
await removeFromLocalStorage(storageKeys.USER_EMAIL)
await removeFromLocalStorage(storageKeys.ORG_ID)
await removeFromLocalStorage(storageKeys.ORG_ROLES)
await removeFromLocalStorage(storageKeys.ECOSYSTEM_ID)
await removeFromLocalStorage(storageKeys.ECOSYSTEM_ROLE)
await removeFromLocalStorage(storageKeys.USER_PROFILE)

for await (const value of Object.values(storageKeys)){
await removeFromLocalStorage(value)
}

setCurrentComponent('password');
await setToLocalStorage(storageKeys.LOGIN_USER_EMAIL, values.email);
setIsPasskeySuccess(true);
Expand Down
3 changes: 1 addition & 2 deletions src/components/Ecosystem/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const Dashboard = () => {
const response = await getEcosystems(id);
const { data } = response as AxiosResponse;
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
const ecosystemData = data?.data?.ecosystemDetails?.find(
const ecosystemData = data?.data?.ecosystemList?.find(
(item: { id: string }) => item.id === ecosystemId,
);
if (ecosystemData) {
Expand Down Expand Up @@ -165,7 +165,6 @@ const Dashboard = () => {

if (ecosystemId && orgId) {
const response = await getEcosystemDashboard(ecosystemId, orgId);

const { data } = response as AxiosResponse;

if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Ecosystem/EcosystemList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const EcosystemList = () => {
const { data } = response as AxiosResponse;

if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
const ecosystemData = data?.data.ecosystemDetails;
const ecosystemData = data?.data.ecosystemList;
if (ecosystemData) {

setEcosystemList(ecosystemData);
Expand Down
8 changes: 4 additions & 4 deletions src/components/Ecosystem/Endorsement/EndorsementPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ const EndorsementPopup = (props: {
>
<path
d="M20.4848 3.51515C18.2172 1.24747 15.2071 0 12 0C8.79293 0 5.78283 1.24747 3.51515 3.51515C1.24747 5.78283 0 8.79293 0 12C0 15.2071 1.24747 18.2172 3.51515 20.4848C5.78283 22.7525 8.79293 24 12 24C15.2071 24 18.2172 22.7525 20.4848 20.4848C22.7525 18.2172 24 15.2071 24 12C24 8.79293 22.7525 5.78283 20.4848 3.51515ZM19.5202 19.5202C17.5101 21.5303 14.8384 22.6364 12 22.6364C9.16162 22.6364 6.4899 21.5303 4.4798 19.5202C0.333333 15.3737 0.333333 8.62626 4.4798 4.4798C6.4899 2.4697 9.16162 1.36364 12 1.36364C14.8384 1.36364 17.5101 2.4697 19.5202 4.4798C23.6667 8.62626 23.6667 15.3737 19.5202 19.5202Z"
fill="#1F4EAD"
fill="currentColor"
/>
<path
d="M17.2882 6.71248C17.0206 6.4448 16.5913 6.4448 16.3236 6.71248L12.0004 11.0357L7.67712 6.71248C7.40945 6.4448 6.98015 6.4448 6.71248 6.71248C6.4448 6.98015 6.4448 7.40945 6.71248 7.67712L11.0357 12.0004L6.71248 16.3236C6.4448 16.5913 6.4448 17.0206 6.71248 17.2882C6.84379 17.4195 7.02056 17.4903 7.19227 17.4903C7.36399 17.4903 7.54076 17.4246 7.67207 17.2882L11.9953 12.965L16.3185 17.2882C16.4499 17.4195 16.6266 17.4903 16.7983 17.4903C16.9751 17.4903 17.1468 17.4246 17.2781 17.2882C17.5458 17.0206 17.5458 16.5913 17.2781 16.3236L12.965 12.0004L17.2882 7.67712C17.5559 7.40945 17.5559 6.98015 17.2882 6.71248Z"
fill="#1F4EAD"
fill="currentColor"
/>
</svg>
<span className="ml-2 mr-2">Decline</span>
Expand All @@ -202,13 +202,13 @@ const EndorsementPopup = (props: {
isProcessing={loading}
color="bg-primary-800"
disabled={loading || !isAccess || loadingReject}
className={`${isAccess ? "hover:bg-primary-800 dark:hover:text-primary-700 dark:hover:bg-primary-700" : ""} text-base font-medium text-center text-white bg-primary-700 rounded-lg focus:ring-4 focus:ring-primary-300 sm:w-auto dark:bg-primary-600 dark:focus:ring-primary-800 mr-3`}
className={`${isAccess ? "hover:bg-secondary-700 hover:!bg-secondary-700 dark:hover:text-primary-700 dark:hover:bg-secondary-700" : ""} text-base font-medium text-center text-white bg-primary-700 rounded-lg focus:ring-4 focus:ring-primary-300 sm:w-auto dark:bg-primary-600 dark:focus:ring-primary-800 mr-3`}
onClick={() => {
SignEndorsement(props.endorsementData.id);
}}
>
<svg
className="h-8 w-8 text-white"
className="h-8 w-8"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
Expand Down
12 changes: 9 additions & 3 deletions src/components/Resources/Schema/SchemasList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const SchemaList = (props: {
const [walletStatus, setWalletStatus] = useState(false);
const [totalItem, setTotalItem] = useState(0);
const [isEcosystemData, setIsEcosystemData] = useState<ICheckEcosystem>();
const [searchValue, setSearchValue] = useState('');

const getSchemaList = async (
schemaListAPIParameter: GetAllSchemaListParameter,
Expand Down Expand Up @@ -97,14 +98,18 @@ const SchemaList = (props: {
getSchemaList(schemaListAPIParameter, false);
}, [schemaListAPIParameter, allSchemaFlag]);


const onSearch = async (
event: ChangeEvent<HTMLInputElement>,
): Promise<void> => {
event.preventDefault();
const inputValue = event.target.value;
setSearchValue(inputValue);

getSchemaList(
{
...schemaListAPIParameter,
search: event.target.value,
search: inputValue,
},
false,
);
Expand All @@ -113,7 +118,7 @@ const SchemaList = (props: {
getSchemaList(
{
...schemaListAPIParameter,
allSearch: event.target.value,
allSearch: inputValue,
},
false,
);
Expand Down Expand Up @@ -169,6 +174,7 @@ const SchemaList = (props: {
console.log(error);
}
})();
setSearchValue('');
}, []);

const createSchemaTitle = isEcosystemData?.isEcosystemMember
Expand All @@ -191,7 +197,7 @@ const SchemaList = (props: {
<h1 className="ml-1 text-xl font-semibold text-gray-900 sm:text-2xl dark:text-white mr-auto">
Schemas
</h1>
<SearchInput onInputChange={onSearch} />
<SearchInput onInputChange={onSearch} value={searchValue}/>

<select
onChange={handleFilter}
Expand Down
3 changes: 2 additions & 1 deletion src/components/SearchInput/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const SearchInput = ({ onInputChange }: any) => {
const SearchInput = ({ onInputChange, value }: any) => {
return (
<div>
<label className="sr-only">Search</label>
Expand All @@ -22,6 +22,7 @@ const SearchInput = ({ onInputChange }: any) => {
name="email"
id="topbar-search"
onChange={onInputChange}
value={value}
className="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-500 focus:border-primary-500 block w-full pl-10 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500"
placeholder="Search"
/>
Expand Down
14 changes: 7 additions & 7 deletions src/components/User/UserDashBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const UserDashBoard = () => {
allSearch: '',
});
const [ecoCount, setEcoCount] = useState(0);
const [ecosystemList, setEcosystemList] = useState([]);
const [ecosystemListDetails, setEcosystemListDetails] = useState([]);
const [credDefList, setCredDefList] = useState([]);
const [credDefCount, setCredDefCount] = useState(0);
const [walletData, setWalletData] = useState([]);
Expand Down Expand Up @@ -245,12 +245,12 @@ const UserDashBoard = () => {
);
const { data } = response as AxiosResponse;
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
setEcoCount(data?.data?.totalCount);
const ecosystemData = data?.data?.ecosystemDetails.filter(
setEcoCount(data?.data?.totalItems);
const ecosystemData = data?.data?.ecosystemList.filter(
(ecosystem: Organisation, index: number) => index < 3,
);
if (ecosystemData) {
setEcosystemList(ecosystemData);
setEcosystemListDetails(ecosystemData);
} else {
setError(response as string);
}
Expand Down Expand Up @@ -1092,9 +1092,9 @@ const UserDashBoard = () => {

{!ecoLoading ? (
<>
{ecosystemList && ecosystemList.length > 0 ? (
{ecosystemListDetails && ecosystemListDetails.length > 0 ? (
<>
{ecosystemList?.map((ecosystem: any) => {
{ecosystemListDetails?.map((ecosystem: any) => {
return (
<button
className="flex justify-between w-full mt-2 items-center"
Expand Down Expand Up @@ -1212,7 +1212,7 @@ const UserDashBoard = () => {
);
})}

{ecosystemList && ecosystemList?.length > 0 && (
{ecosystemListDetails && ecosystemListDetails?.length > 0 && (
<a
href="/ecosystems"
className="absolute bottom-0 sm:bottom-[-13px] right-0 float-right inline-flex items-center text-sm font-medium rounded-lg text-primary-700 hover:bg-gray-100 dark:text-primary-500 dark:hover:bg-gray-700"
Expand Down
20 changes: 10 additions & 10 deletions src/components/organization/OrganizationDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { dateConversion } from '../../utils/DateConversion';
import DateTooltip from '../Tooltip';
import CopyDid from '../../commonComponents/CopyDid';
import { setToLocalStorage } from '../../api/Auth';
import Tooltip from '../Tooltip';
import { Tooltip } from 'flowbite-react';

const OrganizationDetails = ({ orgData }: { orgData: Organisation | null }) => {
const { org_agents } = orgData as Organisation;
Expand Down Expand Up @@ -180,8 +180,7 @@ const OrganizationDetails = ({ orgData }: { orgData: Organisation | null }) => {
<div className="flex justify-between w-full">
<div className="relative flex w-full">
<div
className="mb-4 sm:mb-0 px-0 sm:px-4 py-4"
style={{ width: '100%' }}
className="mb-4 sm:mb-0 px-0 sm:px-4 py-4 w-full"
>
<h3 className="mb-1 mt-1 text-2xl font-bold text-gray-900 dark:text-white">
DID Document
Expand Down Expand Up @@ -210,16 +209,17 @@ const OrganizationDetails = ({ orgData }: { orgData: Organisation | null }) => {
</pre>
</div>
<div className="flex items-start mt-4 mr-4">
<CopyDid
className="block text-sm truncate"
value={JSON.stringify(agentData?.didDocument)}
hideValue={true}
/>
<Tooltip
content={'Copy DID Document'}
placement="bottom"
className="items-center text-center dark:text-white"
></Tooltip>
>
<CopyDid
className="block text-sm truncate"
value={JSON.stringify(agentData?.didDocument)}
hideValue={true}
/>
</Tooltip>
</div>
</div>
</div>
Expand All @@ -231,4 +231,4 @@ const OrganizationDetails = ({ orgData }: { orgData: Organisation | null }) => {
);
};

export default OrganizationDetails;
export default OrganizationDetails;
Loading

0 comments on commit e4ca9bd

Please sign in to comment.