Skip to content

Commit

Permalink
Merge remote-tracking branch 'v4/main' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
moritzkirstein committed Aug 2, 2023
2 parents 9c17a12 + f533166 commit 85a7115
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 35 deletions.
2 changes: 1 addition & 1 deletion app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {

complianceUri:
process.env.NEXT_PUBLIC_COMPLIANCE_URI ||
'https://compliance.lab.gaia-x.eu/develop',
'https://compliance.lab.gaia-x.eu',

complianceApiVersion:
process.env.NEXT_PUBLIC_COMPLIANCE_API_VERSION || '2210',
Expand Down
4 changes: 1 addition & 3 deletions src/@context/Asset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,7 @@ function AssetProvider({

setIsServiceSDVerified(verified && !!serviceSDContent)
setServiceSDVersion(complianceApiVersion)
const serviceProviderName = await getPublisherFromServiceSD(
serviceSDContent
)
const serviceProviderName = getPublisherFromServiceSD(serviceSDContent)
setVerifiedServiceProviderName(serviceProviderName)
} catch (error) {
setIsServiceSDVerified(false)
Expand Down
6 changes: 6 additions & 0 deletions src/components/Asset/AssetContent/Nft/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,9 @@
.nftImage .tooltip svg {
fill: var(--nft-refresh-icon-fill);
}

.placeholder {
width: 100%;
height: 100%;
background: var(--nft-placeholder-background);
}
3 changes: 1 addition & 2 deletions src/components/Asset/AssetContent/Nft/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { decodeTokenURI } from '@utils/nft'
import { useFormikContext } from 'formik'
import React from 'react'
import { FormPublishData } from '@components/Publish/_types'
import OceanLogo from '@shared/atoms/OceanLogo'
import NftTooltip from './NftTooltip'
import styles from './index.module.css'
import classNames from 'classnames/bind'
Expand Down Expand Up @@ -42,7 +41,7 @@ export default function Nft({
{nftImage ? (
<img src={nftImage} alt={asset?.nft?.name} />
) : (
<OceanLogo noWordmark white />
<div className={styles.placeholder} />
)}

{(nftMetadata || asset?.nftAddress) && (
Expand Down
43 changes: 14 additions & 29 deletions src/components/Publish/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export async function verifyRawServiceSD(rawServiceSD: string): Promise<{
// parsedServiceSD?.selfDescriptionCredential?.['@context']
// )

const baseUrl = `${complianceUri}/api/service-offering/verify/raw`
const baseUrl = `${complianceUri}/v1/api/credential-offers`

try {
const response = await axios.post(baseUrl, parsedServiceSD)
Expand All @@ -411,7 +411,7 @@ export async function verifyRawServiceSD(rawServiceSD: string): Promise<{
responseBody: response.data.body
}
}
if (response?.status === 200) {
if (response?.status === 201) {
return { verified: true, complianceApiVersion }
}

Expand Down Expand Up @@ -451,33 +451,18 @@ export function updateServiceSelfDescription(
return ddo
}

export async function getPublisherFromServiceSD(
serviceSD: any
): Promise<string> {
export function getPublisherFromServiceSD(serviceSD: any): string {
if (!serviceSD) return

try {
const parsedServiceSD =
typeof serviceSD === 'string' ? JSON.parse(serviceSD) : serviceSD
const providedBy =
parsedServiceSD?.selfDescriptionCredential?.credentialSubject?.[
'gx-service-offering:providedBy'
]
const providedByUrl =
typeof providedBy === 'string' ? providedBy : providedBy?.['@value']

const response = await axios.get(sanitizeUrl(providedByUrl))
if (!response || response.status !== 200 || !response?.data) return

const legalName =
response.data?.selfDescriptionCredential?.credentialSubject?.[
'gx-participant:legalName'
]
const publisher =
typeof legalName === 'string' ? legalName : legalName?.['@value']

return publisher
} catch (error) {
LoggerInstance.error(error.message)
}
const parsedServiceSD =
typeof serviceSD === 'string' ? JSON.parse(serviceSD) : serviceSD

const legalName =
parsedServiceSD?.verifiableCredential?.[0]?.credentialSubject?.[
'gx:legalName'
]
const publisher =
typeof legalName === 'string' ? legalName : legalName?.['@value']

return publisher
}
5 changes: 5 additions & 0 deletions src/stylesGlobal/_variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
--link-font-color: var(--color-primary);
--link-font-color-hover: var(--color-highlight);
--nft-refresh-icon-fill: var(--brand-white);
--nft-placeholder-background: linear-gradient(
to left top,
var(--brand-blue-dark),
var(--brand-yellow)
);
--badge-background-color: var(--color-primary);
--asset-view-icon-fill: var(--brand-grey-light);
--asset-view-icon-selected-fill: var(--color-primary);
Expand Down

1 comment on commit 85a7115

@vercel
Copy link

@vercel vercel bot commented on 85a7115 Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.