diff --git a/packages/legacy/core/App/components/misc/CredentialCard.tsx b/packages/legacy/core/App/components/misc/CredentialCard.tsx index 807304c68..f2ad99a00 100644 --- a/packages/legacy/core/App/components/misc/CredentialCard.tsx +++ b/packages/legacy/core/App/components/misc/CredentialCard.tsx @@ -49,7 +49,7 @@ const CredentialCard: React.FC = ({ const { ColorPallet } = useTheme() const [overlay, setOverlay] = useState>({}) const { resolveBundleForCredential } = useOpenIDCredentials() - const [extraOverlayAttribute, setExtraOverlayAttribute] = useState() + const [extraOverlayAttribute, setExtraOverlayAttribute] = useState() useEffect(() => { if (brandingOverlay) { @@ -70,10 +70,7 @@ const CredentialCard: React.FC = ({ resolveOverlay(credential) const credentialDisplay = getCredentialForDisplay(credential) if (credentialDisplay.display.primary_overlay_attribute) { - const attributeValue = getAttributeField( - credentialDisplay, - credentialDisplay.display.primary_overlay_attribute - )?.value + const attributeValue = getAttributeField(credentialDisplay, credentialDisplay.display.primary_overlay_attribute) setExtraOverlayAttribute(attributeValue) } } diff --git a/packages/legacy/core/App/components/misc/CredentialCard11.tsx b/packages/legacy/core/App/components/misc/CredentialCard11.tsx index 89f560cd6..c94f0687a 100644 --- a/packages/legacy/core/App/components/misc/CredentialCard11.tsx +++ b/packages/legacy/core/App/components/misc/CredentialCard11.tsx @@ -65,7 +65,7 @@ interface CredentialCard11Props { handleAltCredChange?: () => void brandingOverlay?: CredentialOverlay hideSlice?: boolean - extraOverlayParameter?: string | number | null | undefined + extraOverlayParameter?: Attribute | undefined brandingOverlayType?: BrandingOverlayType } @@ -451,7 +451,8 @@ const CredentialCard11: React.FC = ({ }, ]} > - {extraOverlayParameter} + {extraOverlayParameter.label ?? startCase(extraOverlayParameter.name || '')}:{' '} + {extraOverlayParameter.value} )} diff --git a/packages/legacy/core/App/modules/openid/components/OpenIDCredentialCard.tsx b/packages/legacy/core/App/modules/openid/components/OpenIDCredentialCard.tsx index 5fc467a74..982ee4643 100644 --- a/packages/legacy/core/App/modules/openid/components/OpenIDCredentialCard.tsx +++ b/packages/legacy/core/App/modules/openid/components/OpenIDCredentialCard.tsx @@ -22,6 +22,8 @@ import { getCredentialForDisplay } from '../display' import { BifoldError } from '../../../types/error' import { EventTypes } from '../../../constants' import { getAttributeField } from '../utils/utils' +import { Attribute } from '@hyperledger/aries-oca/build/legacy' +import startCase from 'lodash.startcase' interface CredentialCardProps { credentialDisplay?: W3cCredentialDisplay @@ -62,9 +64,9 @@ const OpenIDCredentialCard: React.FC = ({ return result.display }, [credentialDisplay, credentialRecord, t]) - const overlayAttribute = useMemo((): string | number | null | undefined => { + const overlayAttributeField = useMemo((): Attribute | undefined => { if (!display?.primary_overlay_attribute || !credentialDisplay) return undefined - return getAttributeField(credentialDisplay, display.primary_overlay_attribute)?.value + return getAttributeField(credentialDisplay, display.primary_overlay_attribute) }, [display, credentialDisplay]) const { width } = useWindowDimensions() @@ -213,7 +215,7 @@ const OpenIDCredentialCard: React.FC = ({ } const CardFooter: React.FC = () => { - if (!overlayAttribute) return null + if (!overlayAttributeField) return null return ( = ({ testID={testIdWithKey('CredentialIssued')} maxFontSizeMultiplier={1} > - {overlayAttribute} + {overlayAttributeField.label ?? startCase(overlayAttributeField.name || '')}: {overlayAttributeField.value} ) diff --git a/packages/legacy/core/App/modules/openid/hooks/openid.tsx b/packages/legacy/core/App/modules/openid/hooks/openid.tsx index 9cb58321b..198c1db78 100644 --- a/packages/legacy/core/App/modules/openid/hooks/openid.tsx +++ b/packages/legacy/core/App/modules/openid/hooks/openid.tsx @@ -50,8 +50,8 @@ export const useOpenID = ({ } catch (err: unknown) { //TODO: Sppecify different error const error = new BifoldError( - t('Error.Title1043'), - t('Error.Message1043'), + t('Error.Title1024'), + t('Error.Message1024'), (err as Error)?.message ?? err, 1043 ) diff --git a/packages/legacy/core/App/modules/openid/screens/OpenIDProofPresentation.tsx b/packages/legacy/core/App/modules/openid/screens/OpenIDProofPresentation.tsx index c24c8264d..1cefbf353 100644 --- a/packages/legacy/core/App/modules/openid/screens/OpenIDProofPresentation.tsx +++ b/packages/legacy/core/App/modules/openid/screens/OpenIDProofPresentation.tsx @@ -197,11 +197,11 @@ const OpenIDProofPresentation: React.FC = ({ ) } - const selectAltCredentail = () => {} - const renderCard = ( sub: FormattedSubmissionEntry, selectedCredential: FormattedSelectedCredentialEntry, + //TODO: Support multiplae credentials + // eslint-disable-next-line @typescript-eslint/no-unused-vars hasMultipleCreds: boolean ) => { const credential = credentialsRequested.find((c) => c.id === selectedCredential.id) @@ -216,8 +216,9 @@ const OpenIDProofPresentation: React.FC = ({ ) }