@procivis/one-react-native-components 0.3.47 → 0.3.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"names":["OneError","useCallback","useMutation","useQuery","useQueryClient","reportException","useHTTPClient","useONECore","OneErrorCode","HISTORY_LIST_QUERY_KEY","useIdentifierDetails","TRUST_ENTITY_DETAIL_QUERY_KEY","REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY","useCreateTrustAnchor","publisherReference","httpClient","core","trustAnchors","getTrustAnchors","page","pageSize","values","length","response","get","ok","data","trustAnchor","createTrustAnchor","isPublisher","name","type","TrustManagementEnum","SimpleTrustList","catch","err","useTrustEntity","identifierId","identifierDetail","_identifierDetail$cer","resolveTrustEntityByIdentifier","identifiers","certificateId","certificates","id","undefined","then","result","e","code","NoTrustEntityFound","enabled","Boolean","keepPreviousData","useRemoteTrustEntity","did","getRemoteTrustEntity","useCreateRemoteTrustEntity","queryClient","request","didId","entityDidId","_identifierDetail$did","getIdentifier","createRemoteTrustEntity","onSuccess","invalidateQueries","useUpdateRemoteTrustEntity","_identifierDetail$did2","updateRemoteTrustEntity"],"sources":["trust-entity.ts"],"sourcesContent":["import {\n CreateRemoteTrustEntityRequest,\n ONECore,\n OneError,\n TrustAnchor,\n UpdateRemoteTrustEntityRequest,\n} from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { reportException } from '../../reporting';\nimport { useHTTPClient } from '../http/client';\nimport { useONECore } from './core-context';\nimport { OneErrorCode } from './error-code';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\nimport { useIdentifierDetails } from './identifiers';\n\nexport const TRUST_ENTITY_DETAIL_QUERY_KEY = 'trust-entity-detail';\nexport const REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY = 'remote-trust-entity-detail';\n\nexport const useCreateTrustAnchor = (publisherReference: string) => {\n const httpClient = useHTTPClient();\n\n return useCallback(\n async (core: ONECore) => {\n const trustAnchors = await core.getTrustAnchors({\n page: 0,\n pageSize: 1,\n });\n if (trustAnchors.values.length > 0) {\n return;\n }\n const response = await httpClient.get<TrustAnchor>(publisherReference);\n if (!response.ok || !response.data) {\n return;\n }\n const trustAnchor = response.data;\n await core\n .createTrustAnchor({\n isPublisher: false,\n name: trustAnchor.name,\n publisherReference,\n type: TrustManagementEnum.SimpleTrustList,\n })\n .catch((err) => {\n reportException(err, 'Failed to create trust anchor');\n throw err;\n });\n },\n [publisherReference, httpClient],\n );\n};\n\nexport const useTrustEntity = (identifierId: string | undefined) => {\n const { core } = useONECore();\n\n const { data: identifierDetail } = useIdentifierDetails(identifierId);\n\n return useQuery(\n [TRUST_ENTITY_DETAIL_QUERY_KEY, identifierId],\n () => identifierId && identifierDetail\n ? core.resolveTrustEntityByIdentifier({\n identifiers: [{\n certificateId: identifierDetail.type === 'CERTIFICATE' ? identifierDetail.certificates?.[0]?.id : undefined,\n id: identifierId,\n }],\n }).then((result) => {\n return result[identifierId];\n }).catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.NoTrustEntityFound) {\n return null;\n }\n throw e;\n })\n : undefined,\n {\n enabled: Boolean(identifierDetail),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useRemoteTrustEntity = (identifierId: string | undefined) => {\n const { core } = useONECore();\n\n const { data: identifierDetail } = useIdentifierDetails(identifierId);\n\n return useQuery(\n [REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY, identifierId],\n () => (identifierDetail?.did ? core.getRemoteTrustEntity(identifierDetail.did.id) : undefined),\n {\n enabled: Boolean(identifierDetail?.did),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useCreateRemoteTrustEntity = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (request: Omit<CreateRemoteTrustEntityRequest, 'didId'> & { identifierId?: string, didId?: string }) => {\n const { identifierId, didId } = request\n\n let entityDidId = didId;\n\n if (identifierId) {\n const identifierDetail = await core.getIdentifier(identifierId);\n entityDidId = identifierDetail?.did?.id;\n }\n\n return core.createRemoteTrustEntity({\n ...request,\n didId: entityDidId!,\n })\n }, {\n onSuccess: async () => {\n await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useUpdateRemoteTrustEntity = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (request: Omit<UpdateRemoteTrustEntityRequest, 'didId'> & { identifierId?: string, didId?: string }) => {\n const { identifierId, didId } = request\n\n let entityDidId = didId;\n if (identifierId) {\n const identifierDetail = await core.getIdentifier(identifierId);\n entityDidId = identifierDetail?.did?.id;\n }\n\n return core.updateRemoteTrustEntity({\n ...request,\n didId: entityDidId!,\n })\n }, {\n onSuccess: async () => {\n await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport enum TrustManagementEnum {\n SimpleTrustList = 'SIMPLE_TRUST_LIST',\n}\n"],"mappings":"AAAA,SAGEA,QAAQ,QAGH,iCAAiC;AACxC,SAASC,WAAW,QAAQ,OAAO;AACnC,SAASC,WAAW,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,aAAa;AAEnE,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,aAAa,QAAQ,gBAAgB;AAC9C,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,YAAY,QAAQ,cAAc;AAC3C,SAASC,sBAAsB,QAAQ,WAAW;AAClD,SAASC,oBAAoB,QAAQ,eAAe;AAEpD,OAAO,MAAMC,6BAA6B,GAAG,qBAAqB;AAClE,OAAO,MAAMC,oCAAoC,GAAG,4BAA4B;AAEhF,OAAO,MAAMC,oBAAoB,GAAIC,kBAA0B,IAAK;EAClE,MAAMC,UAAU,GAAGT,aAA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AY,CAAC;MAC/DwB,WAAW,GAAGvB,gBAAgB,aAAhBA,gBAAgB,gBAAA8B,sBAAA,GAAhB9B,gBAAgB,CAAEiB,GAAG,cAAAa,sBAAA,uBAArBA,sBAAA,CAAuBxB,EAAE;IACzC;IAEA,OAAO5B,IAAI,CAACqD,uBAAuB,CAAC;MAClC,GAAGV,OAAO;MACVC,KAAK,EAAEC;IACT,CAAC,CAAC;EACJ,CAAC,EAAE;IACDI,SAAS,EAAE,MAAAA,CAAA,KAAY;MACrB,MAAMP,WAAW,CAACQ,iBAAiB,CAACtD,oCAAoC,CAAC;MACzE,MAAM8C,WAAW,CAACQ,iBAAiB,CAACzD,sBAAsB,CAAC;IAC7D;EACF,CAAC,CAAC;AACJ,CAAC;AAED,WAAYuB,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["IdentifierTypeEnum","OneError","useCallback","useMutation","useQuery","useQueryClient","reportException","useHTTPClient","useONECore","OneErrorCode","HISTORY_LIST_QUERY_KEY","useIdentifierDetails","TRUST_ENTITY_DETAIL_QUERY_KEY","REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY","useCreateTrustAnchor","publisherReference","httpClient","core","trustAnchors","getTrustAnchors","page","pageSize","values","length","response","get","ok","data","trustAnchor","createTrustAnchor","isPublisher","name","type","TrustManagementEnum","SimpleTrustList","catch","err","useTrustEntity","identifierId","identifierDetail","_identifierDetail$cer","resolveTrustEntityByIdentifier","identifiers","certificateId","CERTIFICATE","certificates","id","undefined","then","result","_result$identifierId$","_result$identifierId","trustEntity","e","code","NoTrustEntityFound","enabled","Boolean","keepPreviousData","useRemoteTrustEntity","did","getRemoteTrustEntity","useCreateRemoteTrustEntity","queryClient","request","didId","entityDidId","_identifierDetail$did","getIdentifier","createRemoteTrustEntity","onSuccess","invalidateQueries","useUpdateRemoteTrustEntity","_identifierDetail$did2","updateRemoteTrustEntity"],"sources":["trust-entity.ts"],"sourcesContent":["import {\n CreateRemoteTrustEntityRequest,\n IdentifierTypeEnum,\n ONECore,\n OneError,\n TrustAnchor,\n UpdateRemoteTrustEntityRequest,\n} from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { reportException } from '../../reporting';\nimport { useHTTPClient } from '../http/client';\nimport { useONECore } from './core-context';\nimport { OneErrorCode } from './error-code';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\nimport { useIdentifierDetails } from './identifiers';\n\nexport const TRUST_ENTITY_DETAIL_QUERY_KEY = 'trust-entity-detail';\nexport const REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY = 'remote-trust-entity-detail';\n\nexport const useCreateTrustAnchor = (publisherReference: string) => {\n const httpClient = useHTTPClient();\n\n return useCallback(\n async (core: ONECore) => {\n const trustAnchors = await core.getTrustAnchors({\n page: 0,\n pageSize: 1,\n });\n if (trustAnchors.values.length > 0) {\n return;\n }\n const response = await httpClient.get<TrustAnchor>(publisherReference);\n if (!response.ok || !response.data) {\n return;\n }\n const trustAnchor = response.data;\n await core\n .createTrustAnchor({\n isPublisher: false,\n name: trustAnchor.name,\n publisherReference,\n type: TrustManagementEnum.SimpleTrustList,\n })\n .catch((err) => {\n reportException(err, 'Failed to create trust anchor');\n throw err;\n });\n },\n [publisherReference, httpClient],\n );\n};\n\nexport const useTrustEntity = (identifierId: string | undefined) => {\n const { core } = useONECore();\n\n const { data: identifierDetail } = useIdentifierDetails(identifierId);\n\n return useQuery(\n [TRUST_ENTITY_DETAIL_QUERY_KEY, identifierId],\n () =>\n identifierId && identifierDetail\n ? core\n .resolveTrustEntityByIdentifier({\n identifiers: [\n {\n certificateId:\n identifierDetail?.type === IdentifierTypeEnum.CERTIFICATE\n ? identifierDetail.certificates?.[0]?.id\n : undefined,\n id: identifierId,\n },\n ],\n })\n .then((result) => {\n return result[identifierId]?.[0]?.trustEntity ?? null;\n })\n .catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.NoTrustEntityFound) {\n return null;\n }\n throw e;\n })\n : undefined,\n {\n enabled: Boolean(identifierDetail),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useRemoteTrustEntity = (identifierId: string | undefined) => {\n const { core } = useONECore();\n\n const { data: identifierDetail } = useIdentifierDetails(identifierId);\n\n return useQuery(\n [REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY, identifierId],\n () => (identifierDetail?.did ? core.getRemoteTrustEntity(identifierDetail.did.id) : undefined),\n {\n enabled: Boolean(identifierDetail?.did),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useCreateRemoteTrustEntity = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (request: Omit<CreateRemoteTrustEntityRequest, 'didId'> & { identifierId?: string; didId?: string }) => {\n const { identifierId, didId } = request;\n\n let entityDidId = didId;\n\n if (identifierId) {\n const identifierDetail = await core.getIdentifier(identifierId);\n entityDidId = identifierDetail?.did?.id;\n }\n\n return core.createRemoteTrustEntity({\n ...request,\n didId: entityDidId!,\n });\n },\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useUpdateRemoteTrustEntity = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (request: Omit<UpdateRemoteTrustEntityRequest, 'didId'> & { identifierId?: string; didId?: string }) => {\n const { identifierId, didId } = request;\n\n let entityDidId = didId;\n if (identifierId) {\n const identifierDetail = await core.getIdentifier(identifierId);\n entityDidId = identifierDetail?.did?.id;\n }\n\n return core.updateRemoteTrustEntity({\n ...request,\n didId: entityDidId!,\n });\n },\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },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ACzE,MAAMkD,WAAW,CAACQ,iBAAiB,CAAC7D,sBAAsB,CAAC;IAC7D;EACF,CACF,CAAC;AACH,CAAC;AAED,WAAYuB,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA","ignoreList":[]}
@@ -46,8 +46,8 @@ export const hasMsoValidityIssues = credential => {
46
46
  return mdocMsoValidityIssue;
47
47
  };
48
48
  export const cardHeaderFromCredential = (credential, claims = [], config, testID, labels) => {
49
- var _formatDateTimeLocali, _layoutProperties$log, _layoutProperties$log2, _layoutProperties$log3;
50
- let credentialDetailPrimary = (_formatDateTimeLocali = formatDateTimeLocalized(new Date(credential.issuanceDate))) !== null && _formatDateTimeLocali !== void 0 ? _formatDateTimeLocali : '';
49
+ var _formatDateTimeLocali, _credential$issuanceD, _layoutProperties$log, _layoutProperties$log2, _layoutProperties$log3;
50
+ let credentialDetailPrimary = (_formatDateTimeLocali = formatDateTimeLocalized(new Date((_credential$issuanceD = credential.issuanceDate) !== null && _credential$issuanceD !== void 0 ? _credential$issuanceD : credential.createdDate))) !== null && _formatDateTimeLocali !== void 0 ? _formatDateTimeLocali : '';
51
51
  let credentialDetailSecondary;
52
52
  let credentialDetailErrorColor;
53
53
  let credentialDetailTestID;
@@ -1 +1 @@
1
- {"version":3,"names":["CredentialStateEnum","DataTypeEnum","FormatFeatureEnum","CredentialErrorIcon","CredentialNoticeWarningIcon","CredentialWarningIcon","formatDateLocalized","formatDateTimeLocalized","concatTestID","getCarouselImagesFromClaims","ValidityState","getValidityState","credential","state","REVOKED","Revoked","SUSPENDED","Suspended","Valid","supportsSelectiveDisclosure","config","_formatConfig$capabil","formatConfig","format","schema","Boolean","capabilities","features","includes","SelectiveDisclosure","undefined","findClaimByPathParts","path","claims","length","first","second","rest","claim","find","c","key","dataType","Object","value","findClaimByPath","split","formatCredentialDetail","testID","_attributeValue$value","attributeValue","detailsCardAttributeValueFromClaim","hasMsoValidityIssues","mdocMsoValidity","mdocMsoValidityIssue","nextUpdate","Date","cardHeaderFromCredential","labels","_formatDateTimeLocali","_layoutProperties$log","_layoutProperties$log2","_layoutProperties$log3","credentialDetailPrimary","issuanceDate","credentialDetailSecondary","credentialDetailErrorColor","credentialDetailTestID","statusIcon","layoutProperties","suspendEndDate","suspendedUntil","suspended","revoked","validityIssues","primary","primaryAttribute","secondary","secondaryAttribute","color","logo","backgroundColor","credentialName","name","icon","image","imageSource","uri","iconLabelColor","fontColor","getCredentialCardPropsFromCredential","notice","_layoutProperties$bac","_layoutProperties$bac2","text","validityIssuesNotice","noticeIcon","result","cardCarouselImages","cardImage","background","header","detailsCardAttributeFromClaim","id","pop","typeConfig","datatype","array","values","map","arrayValue","index","toString","type","Array","isArray","attributes","nestedClaim","_formatDateLocalized","String","date","File","_typeConfig$params","params","showAs","detailsCardFromCredential","detailsCardFromCredentialWithClaims","card","nestAttributes","attribute","attributePath","push","parent","a","insertAttributeInObject","join","nestAttributeInDummyObject","pathParts","disabled","object","_object$attributes","nextParent","_object$attributes2","parseBase64Image","getCredentialSchemaWithoutImages","credentialSchema","_credentialSchema$lay","_credentialSchema$lay2","_credentialSchema$lay3","_credentialSchema$lay4"],"sources":["credential.ts"],"sourcesContent":["import {\n Claim,\n Config,\n CredentialDetail,\n CredentialListItem,\n CredentialSchema,\n CredentialStateEnum,\n DataTypeEnum,\n FormatFeatureEnum,\n} from '@procivis/react-native-one-core';\n\nimport {\n CredentialAttribute,\n CredentialAttributeValue,\n CredentialCardProps,\n CredentialDetailsCardProps,\n CredentialHeaderProps,\n} from '../../ui-components/credential';\nimport { CredentialCardNotice } from '../../ui-components/credential/card/credential-card';\nimport { CredentialErrorIcon, CredentialNoticeWarningIcon, CredentialWarningIcon } from '../../ui-components/icons';\nimport { formatDateLocalized, formatDateTimeLocalized } from '../date';\nimport { concatTestID } from '../testID';\nimport { getCarouselImagesFromClaims } from './credential-images';\n\nexport enum ValidityState {\n Revoked = 'revoked',\n Suspended = 'suspended',\n Valid = 'valid',\n}\n\nexport const getValidityState = (credential: CredentialListItem | undefined) => {\n if (credential?.state === CredentialStateEnum.REVOKED) {\n return ValidityState.Revoked;\n }\n if (credential?.state === CredentialStateEnum.SUSPENDED) {\n return ValidityState.Suspended;\n }\n return ValidityState.Valid;\n};\n\nexport const supportsSelectiveDisclosure = (credential: CredentialListItem | undefined, config: Config | undefined) => {\n const formatConfig = credential && config?.format[credential.schema.format];\n return formatConfig\n ? Boolean(formatConfig.capabilities?.features?.includes(FormatFeatureEnum.SelectiveDisclosure))\n : undefined;\n};\n\nconst findClaimByPathParts = (path: string[], claims?: Claim[]): Claim | undefined => {\n if (!claims?.length) {\n return undefined;\n }\n const [first, second, ...rest] = path;\n const claim = claims.find((c) => c.key === first);\n if (claim === undefined || second === undefined || claim.dataType !== DataTypeEnum.Object) {\n return claim;\n }\n\n return findClaimByPathParts([`${first}/${second}`, ...rest], claim.value as Claim[]);\n};\n\nexport const findClaimByPath = (path: string | undefined, claims: Claim[] | undefined) =>\n path ? findClaimByPathParts(path.split('/'), claims) : undefined;\n\nconst formatCredentialDetail = (claim: Claim, config: Config, testID: string): string => {\n const attributeValue = detailsCardAttributeValueFromClaim(claim, config, testID);\n return attributeValue.value ?? '';\n};\n\nexport const hasMsoValidityIssues = (credential: CredentialDetail): boolean => {\n const mdocMsoValidity: { nextUpdate: string } | undefined =\n 'mdocMsoValidity' in credential ? (credential.mdocMsoValidity as { nextUpdate: string }) : undefined;\n\n const mdocMsoValidityIssue = Boolean(\n mdocMsoValidity?.nextUpdate && new Date(mdocMsoValidity.nextUpdate) < new Date(),\n );\n\n return mdocMsoValidityIssue;\n};\n\nexport type CardHeaderLabels = {\n validityIssues: string;\n revoked: string;\n suspended: string;\n suspendedUntil: (date: string) => string;\n};\n\nexport const cardHeaderFromCredential = (\n credential: CredentialDetail,\n claims: Claim[] = [],\n config: Config,\n testID: string,\n labels: CardHeaderLabels,\n): Omit<CredentialHeaderProps, 'style'> => {\n let credentialDetailPrimary = formatDateTimeLocalized(new Date(credential.issuanceDate)) ?? '';\n\n let credentialDetailSecondary: string | undefined;\n let credentialDetailErrorColor: boolean | undefined;\n let credentialDetailTestID: string | undefined;\n let statusIcon;\n\n const { layoutProperties } = credential.schema;\n\n switch (credential.state) {\n case CredentialStateEnum.SUSPENDED:\n credentialDetailPrimary = credential.suspendEndDate\n ? labels.suspendedUntil(formatDateTimeLocalized(new Date(credential.suspendEndDate))!)\n : labels.suspended;\n credentialDetailTestID = concatTestID(testID, 'suspended');\n statusIcon = CredentialWarningIcon;\n break;\n case CredentialStateEnum.REVOKED:\n credentialDetailPrimary = labels.revoked;\n credentialDetailErrorColor = true;\n credentialDetailTestID = concatTestID(testID, 'revoked');\n statusIcon = CredentialErrorIcon;\n break;\n default: {\n if (hasMsoValidityIssues(credential)) {\n credentialDetailPrimary = labels.validityIssues;\n credentialDetailTestID = concatTestID(testID, 'validity-issue');\n statusIcon = CredentialWarningIcon;\n } else {\n const primary = findClaimByPath(layoutProperties?.primaryAttribute, claims);\n\n if (primary) {\n credentialDetailPrimary = formatCredentialDetail(primary, config, concatTestID(testID, 'primary'));\n }\n\n const secondary = findClaimByPath(layoutProperties?.secondaryAttribute, claims);\n\n if (secondary) {\n credentialDetailSecondary = formatCredentialDetail(secondary, config, concatTestID(testID, 'secondary'));\n }\n\n credentialDetailTestID = concatTestID(testID, 'detail');\n }\n break;\n }\n }\n return {\n color: layoutProperties?.logo?.backgroundColor,\n credentialDetailErrorColor,\n credentialDetailPrimary,\n credentialDetailSecondary,\n credentialDetailTestID,\n credentialName: credential.schema.name,\n icon: layoutProperties?.logo?.image\n ? {\n imageSource: {\n uri: layoutProperties.logo.image,\n },\n }\n : undefined,\n iconLabelColor: layoutProperties?.logo?.fontColor,\n statusIcon,\n testID,\n };\n};\n\nexport type CardLabels = CardHeaderLabels & {\n validityIssuesNotice: string;\n};\n\nexport const getCredentialCardPropsFromCredential = (\n credential: CredentialDetail,\n claims: Claim[] = [],\n config: Config,\n notice: CredentialCardNotice | undefined,\n testID: string,\n labels: CardLabels,\n): Omit<CredentialCardProps, 'onHeaderPress' | 'style'> => {\n const { layoutProperties } = credential.schema;\n\n if (hasMsoValidityIssues(credential)) {\n notice = {\n text: labels.validityIssuesNotice,\n noticeIcon: CredentialNoticeWarningIcon,\n };\n }\n\n const result: Omit<CredentialCardProps, 'onHeaderPress' | 'style'> = {\n cardCarouselImages: getCarouselImagesFromClaims(claims, layoutProperties, concatTestID(testID, 'carousel')),\n cardImage: layoutProperties?.background?.image\n ? { imageSource: { uri: layoutProperties.background.image } }\n : undefined,\n color: layoutProperties?.background?.color,\n header: cardHeaderFromCredential(credential, claims, config, concatTestID(testID, 'header'), labels),\n testID,\n notice,\n };\n\n return result;\n};\n\nexport const detailsCardAttributeFromClaim = (claim: Claim, config: Config, testID: string): CredentialAttribute => {\n const value = detailsCardAttributeValueFromClaim(claim, config, testID);\n return {\n id: claim.id,\n name: claim.key.split('/').pop(),\n path: claim.key,\n ...value,\n };\n};\n\nconst detailsCardAttributeValueFromClaim = (claim: Claim, config: Config, testID: string): CredentialAttributeValue => {\n const typeConfig = config?.datatype[claim.dataType];\n\n if (claim.array) {\n return {\n values: (claim.value || []).map((arrayValue, index) => {\n return detailsCardAttributeFromClaim(\n {\n ...arrayValue,\n id: `${arrayValue.id}/${index}`,\n },\n config,\n concatTestID(testID, index.toString()),\n );\n }),\n };\n } else {\n switch (typeConfig?.type) {\n case DataTypeEnum.Object: {\n if (!Array.isArray(claim.value)) {\n return { attributes: [] };\n }\n return {\n attributes: (claim.value as Claim[]).map((nestedClaim, index) =>\n detailsCardAttributeFromClaim(nestedClaim, config, concatTestID(testID, index.toString())),\n ),\n };\n }\n case DataTypeEnum.Date: {\n if (!claim.value) {\n // Don't try to parse empty values (which will return \"Invalid Date\")\n return { testID: testID, value: String(claim.value) };\n }\n const date = claim.value as string;\n return {\n testID: testID,\n value: formatDateLocalized(new Date(date)) ?? date,\n };\n }\n case DataTypeEnum.File: {\n if (typeConfig.params?.showAs === 'IMAGE') {\n return { image: { uri: claim.value as string }, testID: testID };\n } else {\n return { testID: testID, value: claim.value as string };\n }\n }\n default:\n return { testID: testID, value: String(claim.value) };\n }\n }\n};\n\nexport const detailsCardFromCredential = (\n credential: CredentialDetail,\n config: Config,\n testID: string,\n labels: CardLabels,\n): Omit<CredentialDetailsCardProps, 'expanded'> => {\n return detailsCardFromCredentialWithClaims(credential, credential.claims, config, testID, labels);\n};\n\nexport const detailsCardFromCredentialWithClaims = (\n credential: CredentialDetail,\n claims: Claim[],\n config: Config,\n testID: string,\n labels: CardLabels,\n): Omit<CredentialDetailsCardProps, 'expanded'> => {\n const attributes: CredentialAttribute[] = claims.map((claim, index) =>\n detailsCardAttributeFromClaim(claim, config, concatTestID(testID, 'attribute', index.toString())),\n );\n\n const card = getCredentialCardPropsFromCredential(\n credential,\n claims,\n config,\n undefined,\n concatTestID(testID, 'card'),\n labels,\n );\n\n return {\n attributes,\n card,\n };\n};\n\n// Converts a flat list of attributes into a nested structure\n// modifies the names to not include slashes\nexport const nestAttributes = (attributes: CredentialAttribute[]): CredentialAttribute[] => {\n const result: CredentialAttribute[] = [];\n\n for (const attribute of attributes) {\n const attributePath = attribute.path.split('/');\n if (attributePath.length === 0) {\n result.push(attribute);\n } else {\n const [first, ...rest] = attributePath;\n const parent = result.find((a) => a.name === first);\n if (parent) {\n insertAttributeInObject({ ...attribute, path: rest.join('/') }, parent);\n } else {\n result.push(nestAttributeInDummyObject(attribute));\n }\n }\n }\n\n return result;\n};\n\n// We nest the leaf node in a (one or more) nested object(s)\n// to make sure the tree structure is correctly rendered in proof request screens.\nconst nestAttributeInDummyObject = (attribute: CredentialAttribute): CredentialAttribute => {\n const pathParts = attribute.path.split('/');\n const [first, ...rest] = pathParts;\n if (!rest.length) {\n return attribute;\n }\n\n // The dummy object is not selectable, and contains a placeholder ID\n // the user can't interact with it.\n return {\n attributes: [nestAttributeInDummyObject({ ...attribute, path: rest.join('/') })],\n disabled: true,\n id: `${attribute.id}/${first}`,\n name: first,\n path: attribute.path,\n };\n};\n\n// Recursively insert an attribute into an object\n// Will create nested objects if necessary\nconst insertAttributeInObject = (attribute: CredentialAttribute, object: CredentialAttribute) => {\n const pathParts = attribute.path.split('/');\n const [first, ...rest] = pathParts;\n\n const nextParent = object.attributes?.find((a) => a.name === first);\n\n if (!nextParent) {\n object.attributes?.push(nestAttributeInDummyObject(attribute));\n } else {\n insertAttributeInObject({ ...attribute, path: rest.join('/') }, nextParent);\n }\n};\n\nfunction parseBase64Image(image: string | undefined) {\n return image ? '__BASE64IMAGE__' : '';\n}\n\nexport function getCredentialSchemaWithoutImages(credentialSchema: CredentialSchema) {\n return {\n ...credentialSchema,\n layoutProperties: {\n ...credentialSchema.layoutProperties,\n background: {\n ...credentialSchema.layoutProperties?.background,\n image: parseBase64Image(credentialSchema.layoutProperties?.background?.image),\n },\n logo: {\n ...credentialSchema.layoutProperties?.logo,\n image: parseBase64Image(credentialSchema.layoutProperties?.logo?.image),\n },\n },\n };\n}\n"],"mappings":"AAAA,SAMEA,mBAAmB,EACnBC,YAAY,EACZC,iBAAiB,QACZ,iCAAiC;AAUxC,SAASC,mBAAmB,EAAEC,2BAA2B,EAAEC,qBAAqB,QAAQ,2BAA2B;AACnH,SAASC,mBAAmB,EAAEC,uBAAuB,QAAQ,SAAS;AACtE,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,2BAA2B,QAAQ,qBAAqB;AAEjE,WAAYC,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAMzB,OAAO,MAAMC,gBAAgB,GAAIC,UAA0C,IAAK;EAC9E,IAAI,CAAAA,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEC,KAAK,MAAKb,mBAAmB,CAACc,OAAO,EAAE;IACrD,OAAOJ,aAAa,CAACK,OAAO;EAC9B;EACA,IAAI,CAAAH,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEC,KAAK,M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GAAG,EAAE;AACvC;AAEA,OAAO,SAAS2D,gCAAgCA,CAACC,gBAAkC,EAAE;EAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA;EACnF,OAAO;IACL,GAAGJ,gBAAgB;IACnB5E,gBAAgB,EAAE;MAChB,GAAG4E,gBAAgB,CAAC5E,gBAAgB;MACpC+B,UAAU,EAAE;QACV,KAAA8C,qBAAA,GAAGD,gBAAgB,CAAC5E,gBAAgB,cAAA6E,qBAAA,uBAAjCA,qBAAA,CAAmC9C,UAAU;QAChDf,KAAK,EAAE0D,gBAAgB,EAAAI,sBAAA,GAACF,gBAAgB,CAAC5E,gBAAgB,cAAA8E,sBAAA,gBAAAA,sBAAA,GAAjCA,sBAAA,CAAmC/C,UAAU,cAAA+C,sBAAA,uBAA7CA,sBAAA,CAA+C9D,KAAK;MAC9E,CAAC;MACDL,IAAI,EAAE;QACJ,KAAAoE,sBAAA,GAAGH,gBAAgB,CAAC5E,gBAAgB,cAAA+E,sBAAA,uBAAjCA,sBAAA,CAAmCpE,IAAI;QAC1CK,KAAK,EAAE0D,gBAAgB,EAAAM,sBAAA,GAACJ,gBAAgB,CAAC5E,gBAAgB,cAAAgF,sBAAA,gBAAAA,sBAAA,GAAjCA,sBAAA,CAAmCrE,IAAI,cAAAqE,sBAAA,uBAAvCA,sBAAA,CAAyChE,KAAK;MACxE;IACF;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["CredentialStateEnum","DataTypeEnum","FormatFeatureEnum","CredentialErrorIcon","CredentialNoticeWarningIcon","CredentialWarningIcon","formatDateLocalized","formatDateTimeLocalized","concatTestID","getCarouselImagesFromClaims","ValidityState","getValidityState","credential","state","REVOKED","Revoked","SUSPENDED","Suspended","Valid","supportsSelectiveDisclosure","config","_formatConfig$capabil","formatConfig","format","schema","Boolean","capabilities","features","includes","SelectiveDisclosure","undefined","findClaimByPathParts","path","claims","length","first","second","rest","claim","find","c","key","dataType","Object","value","findClaimByPath","split","formatCredentialDetail","testID","_attributeValue$value","attributeValue","detailsCardAttributeValueFromClaim","hasMsoValidityIssues","mdocMsoValidity","mdocMsoValidityIssue","nextUpdate","Date","cardHeaderFromCredential","labels","_formatDateTimeLocali","_credential$issuanceD","_layoutProperties$log","_layoutProperties$log2","_layoutProperties$log3","credentialDetailPrimary","issuanceDate","createdDate","credentialDetailSecondary","credentialDetailErrorColor","credentialDetailTestID","statusIcon","layoutProperties","suspendEndDate","suspendedUntil","suspended","revoked","validityIssues","primary","primaryAttribute","secondary","secondaryAttribute","color","logo","backgroundColor","credentialName","name","icon","image","imageSource","uri","iconLabelColor","fontColor","getCredentialCardPropsFromCredential","notice","_layoutProperties$bac","_layoutProperties$bac2","text","validityIssuesNotice","noticeIcon","result","cardCarouselImages","cardImage","background","header","detailsCardAttributeFromClaim","id","pop","typeConfig","datatype","array","values","map","arrayValue","index","toString","type","Array","isArray","attributes","nestedClaim","_formatDateLocalized","String","date","File","_typeConfig$params","params","showAs","detailsCardFromCredential","detailsCardFromCredentialWithClaims","card","nestAttributes","attribute","attributePath","push","parent","a","insertAttributeInObject","join","nestAttributeInDummyObject","pathParts","disabled","object","_object$attributes","nextParent","_object$attributes2","parseBase64Image","getCredentialSchemaWithoutImages","credentialSchema","_credentialSchema$lay","_credentialSchema$lay2","_credentialSchema$lay3","_credentialSchema$lay4"],"sources":["credential.ts"],"sourcesContent":["import {\n Claim,\n Config,\n CredentialDetail,\n CredentialListItem,\n CredentialSchema,\n CredentialStateEnum,\n DataTypeEnum,\n FormatFeatureEnum,\n} from '@procivis/react-native-one-core';\n\nimport {\n CredentialAttribute,\n CredentialAttributeValue,\n CredentialCardProps,\n CredentialDetailsCardProps,\n CredentialHeaderProps,\n} from '../../ui-components/credential';\nimport { CredentialCardNotice } from '../../ui-components/credential/card/credential-card';\nimport { CredentialErrorIcon, CredentialNoticeWarningIcon, CredentialWarningIcon } from '../../ui-components/icons';\nimport { formatDateLocalized, formatDateTimeLocalized } from '../date';\nimport { concatTestID } from '../testID';\nimport { getCarouselImagesFromClaims } from './credential-images';\n\nexport enum ValidityState {\n Revoked = 'revoked',\n Suspended = 'suspended',\n Valid = 'valid',\n}\n\nexport const getValidityState = (credential: CredentialListItem | undefined) => {\n if (credential?.state === CredentialStateEnum.REVOKED) {\n return ValidityState.Revoked;\n }\n if (credential?.state === CredentialStateEnum.SUSPENDED) {\n return ValidityState.Suspended;\n }\n return ValidityState.Valid;\n};\n\nexport const supportsSelectiveDisclosure = (credential: CredentialListItem | undefined, config: Config | undefined) => {\n const formatConfig = credential && config?.format[credential.schema.format];\n return formatConfig\n ? Boolean(formatConfig.capabilities?.features?.includes(FormatFeatureEnum.SelectiveDisclosure))\n : undefined;\n};\n\nconst findClaimByPathParts = (path: string[], claims?: Claim[]): Claim | undefined => {\n if (!claims?.length) {\n return undefined;\n }\n const [first, second, ...rest] = path;\n const claim = claims.find((c) => c.key === first);\n if (claim === undefined || second === undefined || claim.dataType !== DataTypeEnum.Object) {\n return claim;\n }\n\n return findClaimByPathParts([`${first}/${second}`, ...rest], claim.value as Claim[]);\n};\n\nexport const findClaimByPath = (path: string | undefined, claims: Claim[] | undefined) =>\n path ? findClaimByPathParts(path.split('/'), claims) : undefined;\n\nconst formatCredentialDetail = (claim: Claim, config: Config, testID: string): string => {\n const attributeValue = detailsCardAttributeValueFromClaim(claim, config, testID);\n return attributeValue.value ?? '';\n};\n\nexport const hasMsoValidityIssues = (credential: CredentialDetail): boolean => {\n const mdocMsoValidity: { nextUpdate: string } | undefined =\n 'mdocMsoValidity' in credential ? (credential.mdocMsoValidity as { nextUpdate: string }) : undefined;\n\n const mdocMsoValidityIssue = Boolean(\n mdocMsoValidity?.nextUpdate && new Date(mdocMsoValidity.nextUpdate) < new Date(),\n );\n\n return mdocMsoValidityIssue;\n};\n\nexport type CardHeaderLabels = {\n validityIssues: string;\n revoked: string;\n suspended: string;\n suspendedUntil: (date: string) => string;\n};\n\nexport const cardHeaderFromCredential = (\n credential: CredentialDetail,\n claims: Claim[] = [],\n config: Config,\n testID: string,\n labels: CardHeaderLabels,\n): Omit<CredentialHeaderProps, 'style'> => {\n let credentialDetailPrimary =\n formatDateTimeLocalized(new Date(credential.issuanceDate ?? credential.createdDate)) ?? '';\n\n let credentialDetailSecondary: string | undefined;\n let credentialDetailErrorColor: boolean | undefined;\n let credentialDetailTestID: string | undefined;\n let statusIcon;\n\n const { layoutProperties } = credential.schema;\n\n switch (credential.state) {\n case CredentialStateEnum.SUSPENDED:\n credentialDetailPrimary = credential.suspendEndDate\n ? labels.suspendedUntil(formatDateTimeLocalized(new Date(credential.suspendEndDate))!)\n : labels.suspended;\n credentialDetailTestID = concatTestID(testID, 'suspended');\n statusIcon = CredentialWarningIcon;\n break;\n case CredentialStateEnum.REVOKED:\n credentialDetailPrimary = labels.revoked;\n credentialDetailErrorColor = true;\n credentialDetailTestID = concatTestID(testID, 'revoked');\n statusIcon = CredentialErrorIcon;\n break;\n default: {\n if (hasMsoValidityIssues(credential)) {\n credentialDetailPrimary = labels.validityIssues;\n credentialDetailTestID = concatTestID(testID, 'validity-issue');\n statusIcon = CredentialWarningIcon;\n } else {\n const primary = findClaimByPath(layoutProperties?.primaryAttribute, claims);\n\n if (primary) {\n credentialDetailPrimary = formatCredentialDetail(primary, config, concatTestID(testID, 'primary'));\n }\n\n const secondary = findClaimByPath(layoutProperties?.secondaryAttribute, claims);\n\n if (secondary) {\n credentialDetailSecondary = formatCredentialDetail(secondary, config, concatTestID(testID, 'secondary'));\n }\n\n credentialDetailTestID = concatTestID(testID, 'detail');\n }\n break;\n }\n }\n return {\n color: layoutProperties?.logo?.backgroundColor,\n credentialDetailErrorColor,\n credentialDetailPrimary,\n credentialDetailSecondary,\n credentialDetailTestID,\n credentialName: credential.schema.name,\n icon: layoutProperties?.logo?.image\n ? {\n imageSource: {\n uri: layoutProperties.logo.image,\n },\n }\n : undefined,\n iconLabelColor: layoutProperties?.logo?.fontColor,\n statusIcon,\n testID,\n };\n};\n\nexport type CardLabels = CardHeaderLabels & {\n validityIssuesNotice: string;\n};\n\nexport const getCredentialCardPropsFromCredential = (\n credential: CredentialDetail,\n claims: Claim[] = [],\n config: Config,\n notice: CredentialCardNotice | undefined,\n testID: string,\n labels: CardLabels,\n): Omit<CredentialCardProps, 'onHeaderPress' | 'style'> => {\n const { layoutProperties } = credential.schema;\n\n if (hasMsoValidityIssues(credential)) {\n notice = {\n text: labels.validityIssuesNotice,\n noticeIcon: CredentialNoticeWarningIcon,\n };\n }\n\n const result: Omit<CredentialCardProps, 'onHeaderPress' | 'style'> = {\n cardCarouselImages: getCarouselImagesFromClaims(claims, layoutProperties, concatTestID(testID, 'carousel')),\n cardImage: layoutProperties?.background?.image\n ? { imageSource: { uri: layoutProperties.background.image } }\n : undefined,\n color: layoutProperties?.background?.color,\n header: cardHeaderFromCredential(credential, claims, config, concatTestID(testID, 'header'), labels),\n testID,\n notice,\n };\n\n return result;\n};\n\nexport const detailsCardAttributeFromClaim = (claim: Claim, config: Config, testID: string): CredentialAttribute => {\n const value = detailsCardAttributeValueFromClaim(claim, config, testID);\n return {\n id: claim.id,\n name: claim.key.split('/').pop(),\n path: claim.key,\n ...value,\n };\n};\n\nconst detailsCardAttributeValueFromClaim = (claim: Claim, config: Config, testID: string): CredentialAttributeValue => {\n const typeConfig = config?.datatype[claim.dataType];\n\n if (claim.array) {\n return {\n values: (claim.value || []).map((arrayValue, index) => {\n return detailsCardAttributeFromClaim(\n {\n ...arrayValue,\n id: `${arrayValue.id}/${index}`,\n },\n config,\n concatTestID(testID, index.toString()),\n );\n }),\n };\n } else {\n switch (typeConfig?.type) {\n case DataTypeEnum.Object: {\n if (!Array.isArray(claim.value)) {\n return { attributes: [] };\n }\n return {\n attributes: (claim.value as Claim[]).map((nestedClaim, index) =>\n detailsCardAttributeFromClaim(nestedClaim, config, concatTestID(testID, index.toString())),\n ),\n };\n }\n case DataTypeEnum.Date: {\n if (!claim.value) {\n // Don't try to parse empty values (which will return \"Invalid Date\")\n return { testID: testID, value: String(claim.value) };\n }\n const date = claim.value as string;\n return {\n testID: testID,\n value: formatDateLocalized(new Date(date)) ?? date,\n };\n }\n case DataTypeEnum.File: {\n if (typeConfig.params?.showAs === 'IMAGE') {\n return { image: { uri: claim.value as string }, testID: testID };\n } else {\n return { testID: testID, value: claim.value as string };\n }\n }\n default:\n return { testID: testID, value: String(claim.value) };\n }\n }\n};\n\nexport const detailsCardFromCredential = (\n credential: CredentialDetail,\n config: Config,\n testID: string,\n labels: CardLabels,\n): Omit<CredentialDetailsCardProps, 'expanded'> => {\n return detailsCardFromCredentialWithClaims(credential, credential.claims, config, testID, labels);\n};\n\nexport const detailsCardFromCredentialWithClaims = (\n credential: CredentialDetail,\n claims: Claim[],\n config: Config,\n testID: string,\n labels: CardLabels,\n): Omit<CredentialDetailsCardProps, 'expanded'> => {\n const attributes: CredentialAttribute[] = claims.map((claim, index) =>\n detailsCardAttributeFromClaim(claim, config, concatTestID(testID, 'attribute', index.toString())),\n );\n\n const card = getCredentialCardPropsFromCredential(\n credential,\n claims,\n config,\n undefined,\n concatTestID(testID, 'card'),\n labels,\n );\n\n return {\n attributes,\n card,\n };\n};\n\n// Converts a flat list of attributes into a nested structure\n// modifies the names to not include slashes\nexport const nestAttributes = (attributes: CredentialAttribute[]): CredentialAttribute[] => {\n const result: CredentialAttribute[] = [];\n\n for (const attribute of attributes) {\n const attributePath = attribute.path.split('/');\n if (attributePath.length === 0) {\n result.push(attribute);\n } else {\n const [first, ...rest] = attributePath;\n const parent = result.find((a) => a.name === first);\n if (parent) {\n insertAttributeInObject({ ...attribute, path: rest.join('/') }, parent);\n } else {\n result.push(nestAttributeInDummyObject(attribute));\n }\n }\n }\n\n return result;\n};\n\n// We nest the leaf node in a (one or more) nested object(s)\n// to make sure the tree structure is correctly rendered in proof request screens.\nconst nestAttributeInDummyObject = (attribute: CredentialAttribute): CredentialAttribute => {\n const pathParts = attribute.path.split('/');\n const [first, ...rest] = pathParts;\n if (!rest.length) {\n return attribute;\n }\n\n // The dummy object is not selectable, and contains a placeholder ID\n // the user can't interact with it.\n return {\n attributes: [nestAttributeInDummyObject({ ...attribute, path: rest.join('/') })],\n disabled: true,\n id: `${attribute.id}/${first}`,\n name: first,\n path: attribute.path,\n };\n};\n\n// Recursively insert an attribute into an object\n// Will create nested objects if necessary\nconst insertAttributeInObject = (attribute: CredentialAttribute, object: CredentialAttribute) => {\n const pathParts = attribute.path.split('/');\n const [first, ...rest] = pathParts;\n\n const nextParent = object.attributes?.find((a) => a.name === first);\n\n if (!nextParent) {\n object.attributes?.push(nestAttributeInDummyObject(attribute));\n } else {\n insertAttributeInObject({ ...attribute, path: rest.join('/') }, nextParent);\n }\n};\n\nfunction parseBase64Image(image: string | undefined) {\n return image ? '__BASE64IMAGE__' : '';\n}\n\nexport function getCredentialSchemaWithoutImages(credentialSchema: CredentialSchema) {\n return {\n ...credentialSchema,\n layoutProperties: {\n ...credentialSchema.layoutProperties,\n background: {\n ...credentialSchema.layoutProperties?.background,\n image: parseBase64Image(credentialSchema.layoutProperties?.background?.image),\n },\n logo: {\n ...credentialSchema.layoutProperties?.logo,\n image: parseBase64Image(credentialSchema.layoutProperties?.logo?.image),\n },\n },\n };\n}\n"],"mappings":"AAAA,SAMEA,mBAAmB,EACnBC,YAAY,EACZC,iBAAiB,QACZ,iCAAiC;AAUxC,SAASC,mBAAmB,EAAEC,2BAA2B,EAAEC,qBAAqB,QAAQ,2BAA2B;AACnH,SAASC,mBAAmB,EAAEC,uBAAuB,QAAQ,SAAS;AACtE,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,2BAA2B,QAAQ,qBAAqB;AAEjE,WAAYC,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAMzB,OAAO,MAAMC,gBAAgB,GAAIC,UAA0C,IAAK;EAC9E,IAAI,CAAAA,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEC,KAAK,MAAKb,mBAAmB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CAAC;MAAE,GAAGL,SAAS;MAAEnG,IAAI,EAAEK,IAAI,CAACoG,IAAI,CAAC,GAAG;IAAE,CAAC,EAAEM,UAAU,CAAC;EAC7E;AACF,CAAC;AAED,SAASE,gBAAgBA,CAAC1D,KAAyB,EAAE;EACnD,OAAOA,KAAK,GAAG,iBAAiB,GAAG,EAAE;AACvC;AAEA,OAAO,SAAS2D,gCAAgCA,CAACC,gBAAkC,EAAE;EAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA;EACnF,OAAO;IACL,GAAGJ,gBAAgB;IACnB5E,gBAAgB,EAAE;MAChB,GAAG4E,gBAAgB,CAAC5E,gBAAgB;MACpC+B,UAAU,EAAE;QACV,KAAA8C,qBAAA,GAAGD,gBAAgB,CAAC5E,gBAAgB,cAAA6E,qBAAA,uBAAjCA,qBAAA,CAAmC9C,UAAU;QAChDf,KAAK,EAAE0D,gBAAgB,EAAAI,sBAAA,GAACF,gBAAgB,CAAC5E,gBAAgB,cAAA8E,sBAAA,gBAAAA,sBAAA,GAAjCA,sBAAA,CAAmC/C,UAAU,cAAA+C,sBAAA,uBAA7CA,sBAAA,CAA+C9D,KAAK;MAC9E,CAAC;MACDL,IAAI,EAAE;QACJ,KAAAoE,sBAAA,GAAGH,gBAAgB,CAAC5E,gBAAgB,cAAA+E,sBAAA,uBAAjCA,sBAAA,CAAmCpE,IAAI;QAC1CK,KAAK,EAAE0D,gBAAgB,EAAAM,sBAAA,GAACJ,gBAAgB,CAAC5E,gBAAgB,cAAAgF,sBAAA,gBAAAA,sBAAA,GAAjCA,sBAAA,CAAmCrE,IAAI,cAAAqE,sBAAA,uBAAvCA,sBAAA,CAAyChE,KAAK;MACxE;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,109 +1,28 @@
1
- export const getQueryKeyFromCredentialListQueryParams = queryParams => {
2
- if (!queryParams) {
3
- return [];
4
- }
5
- const {
6
- name,
7
- sort,
8
- sortDirection,
9
- exact,
10
- role,
11
- ids,
12
- status,
13
- include
14
- } = queryParams;
15
- return [name, sort, sortDirection, exact, role, ids, status, include];
1
+ // otherwise produce a wrong return type which should trigger compilation error
2
+
3
+ /** Typecheck that all query params are included in the query key */
4
+ function getQueryKey(queryParams, params) {
5
+ return params.map(param => queryParams[param]);
6
+ }
7
+ export const getQueryKeyFromCredentialListQueryParams = (queryParams = {}) => {
8
+ return getQueryKey(queryParams, ['page', 'pageSize', 'organisationId', 'name', 'searchText', 'searchType', 'sort', 'sortDirection', 'exact', 'role', 'ids', 'status', 'include', 'profile']);
16
9
  };
17
- export const getQueryKeyFromHistoryListQueryParams = queryParams => {
18
- if (!queryParams) {
19
- return [];
20
- }
21
- const {
22
- entityId,
23
- actions,
24
- entityTypes,
25
- createdDateFrom,
26
- createdDateTo,
27
- identifierId,
28
- credentialId,
29
- credentialSchemaId,
30
- searchText,
31
- searchType,
32
- proofSchemaId
33
- } = queryParams;
34
- return [entityId, actions, entityTypes, createdDateFrom, createdDateTo, identifierId, credentialId, credentialSchemaId, searchText, searchType, proofSchemaId];
10
+ export const getQueryKeyFromHistoryListQueryParams = (queryParams = {}) => {
11
+ return getQueryKey(queryParams, ['page', 'pageSize', 'organisationId', 'entityId', 'actions', 'entityTypes', 'createdDateFrom', 'createdDateTo', 'identifierId', 'credentialId', 'credentialSchemaId', 'proofSchemaId', 'searchText', 'searchType']);
35
12
  };
36
- export const getQueryKeyFromCredentialSchemaListQueryParams = queryParams => {
37
- if (!queryParams) {
38
- return [];
39
- }
40
- const {
41
- name,
42
- sort,
43
- sortDirection,
44
- exact,
45
- ids,
46
- include
47
- } = queryParams;
48
- return [name, sort, sortDirection, exact, ids, include];
13
+ export const getQueryKeyFromCredentialSchemaListQueryParams = (queryParams = {}) => {
14
+ return getQueryKey(queryParams, ['page', 'pageSize', 'organisationId', 'name', 'sort', 'sortDirection', 'exact', 'ids', 'include', 'schemaId', 'formats']);
49
15
  };
50
- export const getQueryKeyFromProofSchemaListQueryParams = queryParams => {
51
- if (!queryParams) {
52
- return [];
53
- }
54
- const {
55
- name,
56
- sort,
57
- sortDirection,
58
- exact,
59
- ids
60
- } = queryParams;
61
- return [name, sort, sortDirection, exact, ids];
16
+ export const getQueryKeyFromProofSchemaListQueryParams = (queryParams = {}) => {
17
+ return getQueryKey(queryParams, ['page', 'pageSize', 'organisationId', 'name', 'sort', 'sortDirection', 'exact', 'ids', 'formats']);
62
18
  };
63
- export const getQueryKeyFromProofListQueryParams = queryParams => {
64
- if (!queryParams) {
65
- return [];
66
- }
67
- const {
68
- name,
69
- sort,
70
- sortDirection,
71
- exact,
72
- ids,
73
- proofStates,
74
- proofSchemaIds
75
- } = queryParams;
76
- return [name, sort, sortDirection, exact, ids, proofStates, proofSchemaIds];
19
+ export const getQueryKeyFromProofListQueryParams = (queryParams = {}) => {
20
+ return getQueryKey(queryParams, ['page', 'pageSize', 'organisationId', 'sort', 'sortDirection', 'name', 'ids', 'proofStates', 'proofRoles', 'proofSchemaIds', 'exact', 'profile']);
77
21
  };
78
- export const getQueryKeyFromDidListQueryParams = queryParams => {
79
- if (!queryParams) {
80
- return [];
81
- }
82
- const {
83
- name,
84
- did,
85
- type,
86
- deactivated,
87
- keyAlgorithms,
88
- keyRoles
89
- } = queryParams;
90
- return [name, did, type, deactivated, keyAlgorithms, keyRoles];
22
+ export const getQueryKeyFromDidListQueryParams = (queryParams = {}) => {
23
+ return getQueryKey(queryParams, ['page', 'pageSize', 'organisationId', 'sort', 'sortDirection', 'name', 'did', 'type', 'deactivated', 'exact', 'keyAlgorithms', 'keyRoles', 'keyStorages', 'keyIds', 'didMethods']);
91
24
  };
92
- export const getQueryKeyFromIdentifierListQueryParams = queryParams => {
93
- if (!queryParams) {
94
- return [];
95
- }
96
- const {
97
- isRemote,
98
- didMethods,
99
- state,
100
- keyStorages,
101
- keyAlgorithms,
102
- exact,
103
- keyRoles,
104
- types,
105
- name
106
- } = queryParams;
107
- return [name, types, state, isRemote, didMethods, keyStorages, keyAlgorithms, exact, keyRoles];
25
+ export const getQueryKeyFromIdentifierListQueryParams = (queryParams = {}) => {
26
+ return getQueryKey(queryParams, ['page', 'pageSize', 'organisationId', 'sort', 'sortDirection', 'name', 'types', 'state', 'exact', 'didMethods', 'isRemote', 'keyAlgorithms', 'keyRoles', 'keyStorages']);
108
27
  };
109
28
  //# sourceMappingURL=query.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getQueryKeyFromCredentialListQueryParams","queryParams","name","sort","sortDirection","exact","role","ids","status","include","getQueryKeyFromHistoryListQueryParams","entityId","actions","entityTypes","createdDateFrom","createdDateTo","identifierId","credentialId","credentialSchemaId","searchText","searchType","proofSchemaId","getQueryKeyFromCredentialSchemaListQueryParams","getQueryKeyFromProofSchemaListQueryParams","getQueryKeyFromProofListQueryParams","proofStates","proofSchemaIds","getQueryKeyFromDidListQueryParams","did","type","deactivated","keyAlgorithms","keyRoles","getQueryKeyFromIdentifierListQueryParams","isRemote","didMethods","state","keyStorages","types"],"sources":["query.tsx"],"sourcesContent":["import {\n CredentialListQuery,\n CredentialSchemaListQuery,\n DidListQuery,\n HistoryListQuery,\n IdentifierListQuery,\n ProofListQuery,\n ProofSchemaListQuery,\n} from '@procivis/react-native-one-core';\n\nexport const getQueryKeyFromCredentialListQueryParams = (queryParams?: Partial<CredentialListQuery>) => {\n if (!queryParams) {\n return [];\n }\n const { name, sort, sortDirection, exact, role, ids, status, include } = queryParams;\n return [name, sort, sortDirection, exact, role, ids, status, include];\n};\n\nexport const getQueryKeyFromHistoryListQueryParams = (queryParams?: Partial<HistoryListQuery>) => {\n if (!queryParams) {\n return [];\n }\n\n const {\n entityId,\n actions,\n entityTypes,\n createdDateFrom,\n createdDateTo,\n identifierId,\n credentialId,\n credentialSchemaId,\n searchText,\n searchType,\n proofSchemaId,\n } = queryParams;\n return [\n entityId,\n actions,\n entityTypes,\n createdDateFrom,\n createdDateTo,\n identifierId,\n credentialId,\n credentialSchemaId,\n searchText,\n searchType,\n proofSchemaId,\n ];\n};\n\nexport const getQueryKeyFromCredentialSchemaListQueryParams = (queryParams?: Partial<CredentialSchemaListQuery>) => {\n if (!queryParams) {\n return [];\n }\n const { name, sort, sortDirection, exact, ids, include } = queryParams;\n return [name, sort, sortDirection, exact, ids, include];\n};\n\nexport const getQueryKeyFromProofSchemaListQueryParams = (queryParams?: Partial<ProofSchemaListQuery>) => {\n if (!queryParams) {\n return [];\n }\n const { name, sort, sortDirection, exact, ids } = queryParams;\n return [name, sort, sortDirection, exact, ids];\n};\n\nexport const getQueryKeyFromProofListQueryParams = (queryParams?: Partial<ProofListQuery>) => {\n if (!queryParams) {\n return [];\n }\n const { name, sort, sortDirection, exact, ids, proofStates, proofSchemaIds } = queryParams;\n return [name, sort, sortDirection, exact, ids, proofStates, proofSchemaIds];\n};\n\nexport const getQueryKeyFromDidListQueryParams = (queryParams?: Partial<DidListQuery>) => {\n if (!queryParams) {\n return [];\n }\n\n const { name, did, type, deactivated, keyAlgorithms, keyRoles } = queryParams;\n return [name, did, type, deactivated, keyAlgorithms, keyRoles];\n};\n\nexport const getQueryKeyFromIdentifierListQueryParams = (queryParams?: Partial<IdentifierListQuery>) => {\n if (!queryParams) {\n return [];\n }\n\n const { isRemote, didMethods, state, keyStorages, keyAlgorithms, exact, keyRoles, types, name } = queryParams;\n return [name, types, state, isRemote, didMethods, keyStorages, keyAlgorithms, exact, keyRoles];\n};\n"],"mappings":"AAUA,OAAO,MAAMA,wCAAwC,GAAIC,WAA0C,IAAK;EACtG,IAAI,CAACA,WAAW,EAAE;IAChB,OAAO,EAAE;EACX;EACA,MAAM;IAAEC,IAAI;IAAEC,IAAI;IAAEC,aAAa;IAAEC,KAAK;IAAEC,IAAI;IAAEC,GAAG;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGR,WAAW;EACpF,OAAO,CAACC,IAAI,EAAEC,IAAI,EAAEC,aAAa,EAAEC,KAAK,EAAEC,IAAI,EAAEC,GAAG,EAAEC,MAAM,EAAEC,OAAO,CAAC;AACvE,CAAC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B,WAAW;IAAEC;EAAe,CAAC,GAAGzB,WAAW;EAC1F,OAAO,CAACC,IAAI,EAAEC,IAAI,EAAEC,aAAa,EAAEC,KAAK,EAAEE,GAAG,EAAEkB,WAAW,EAAEC,cAAc,CAAC;AAC7E,CAAC;AAED,OAAO,MAAMC,iCAAiC,GAAI1B,WAAmC,IAAK;EACxF,IAAI,CAACA,WAAW,EAAE;IAChB,OAAO,EAAE;EACX;EAEA,MAAM;IAAEC,IAAI;IAAE0B,GAAG;IAAEC,IAAI;IAAEC,WAAW;IAAEC,aAAa;IAAEC;EAAS,CAAC,GAAG/B,WAAW;EAC7E,OAAO,CAACC,IAAI,EAAE0B,GAAG,EAAEC,IAAI,EAAEC,WAAW,EAAEC,aAAa,EAAEC,QAAQ,CAAC;AAChE,CAAC;AAED,OAAO,MAAMC,wCAAwC,GAAIhC,WAA0C,IAAK;EACtG,IAAI,CAACA,WAAW,EAAE;IAChB,OAAO,EAAE;EACX;EAEA,MAAM;IAAEiC,QAAQ;IAAEC,UAAU;IAAEC,KAAK;IAAEC,WAAW;IAAEN,aAAa;IAAE1B,KAAK;IAAE2B,QAAQ;IAAEM,KAAK;IAAEpC;EAAK,CAAC,GAAGD,WAAW;EAC7G,OAAO,CAACC,IAAI,EAAEoC,KAAK,EAAEF,KAAK,EAAEF,QAAQ,EAAEC,UAAU,EAAEE,WAAW,EAAEN,aAAa,EAAE1B,KAAK,EAAE2B,QAAQ,CAAC;AAChG,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getQueryKey","queryParams","params","map","param","getQueryKeyFromCredentialListQueryParams","getQueryKeyFromHistoryListQueryParams","getQueryKeyFromCredentialSchemaListQueryParams","getQueryKeyFromProofSchemaListQueryParams","getQueryKeyFromProofListQueryParams","getQueryKeyFromDidListQueryParams","getQueryKeyFromIdentifierListQueryParams"],"sources":["query.ts"],"sourcesContent":["import {\n CredentialListQuery,\n CredentialSchemaListQuery,\n DidListQuery,\n HistoryListQuery,\n IdentifierListQuery,\n ProofListQuery,\n ProofSchemaListQuery,\n} from '@procivis/react-native-one-core';\n\ntype QueryKey<ListQuery, ParamList> = ParamList extends ReadonlyArray<keyof ListQuery> // all params are inside the ListQuery\n ? keyof ListQuery extends ParamList[number] // all ListQuery fields are in the params\n ? Array<ListQuery[keyof ListQuery]>\n : void\n : void; // otherwise produce a wrong return type which should trigger compilation error\n\n/** Typecheck that all query params are included in the query key */\nfunction getQueryKey<ListQuery extends {}, ParamList extends ReadonlyArray<keyof ListQuery>>(\n queryParams: ListQuery,\n params: ParamList,\n): QueryKey<ListQuery, ParamList> {\n return params.map((param) => queryParams[param]) as QueryKey<ListQuery, ParamList>;\n}\n\nexport const getQueryKeyFromCredentialListQueryParams = (queryParams: Partial<CredentialListQuery> = {}) => {\n return getQueryKey(queryParams, [\n 'page',\n 'pageSize',\n 'organisationId',\n 'name',\n 'searchText',\n 'searchType',\n 'sort',\n 'sortDirection',\n 'exact',\n 'role',\n 'ids',\n 'status',\n 'include',\n 'profile',\n ]);\n};\n\nexport const getQueryKeyFromHistoryListQueryParams = (queryParams: Partial<HistoryListQuery> = {}) => {\n return getQueryKey(queryParams, [\n 'page',\n 'pageSize',\n 'organisationId',\n 'entityId',\n 'actions',\n 'entityTypes',\n 'createdDateFrom',\n 'createdDateTo',\n 'identifierId',\n 'credentialId',\n 'credentialSchemaId',\n 'proofSchemaId',\n 'searchText',\n 'searchType',\n ]);\n};\n\nexport const getQueryKeyFromCredentialSchemaListQueryParams = (\n queryParams: Partial<CredentialSchemaListQuery> = {},\n) => {\n return getQueryKey(queryParams, [\n 'page',\n 'pageSize',\n 'organisationId',\n 'name',\n 'sort',\n 'sortDirection',\n 'exact',\n 'ids',\n 'include',\n 'schemaId',\n 'formats',\n ]);\n};\n\nexport const getQueryKeyFromProofSchemaListQueryParams = (queryParams: Partial<ProofSchemaListQuery> = {}) => {\n return getQueryKey(queryParams, [\n 'page',\n 'pageSize',\n 'organisationId',\n 'name',\n 'sort',\n 'sortDirection',\n 'exact',\n 'ids',\n 'formats',\n ]);\n};\n\nexport const getQueryKeyFromProofListQueryParams = (queryParams: Partial<ProofListQuery> = {}) => {\n return getQueryKey(queryParams, [\n 'page',\n 'pageSize',\n 'organisationId',\n 'sort',\n 'sortDirection',\n 'name',\n 'ids',\n 'proofStates',\n 'proofRoles',\n 'proofSchemaIds',\n 'exact',\n 'profile',\n ]);\n};\n\nexport const getQueryKeyFromDidListQueryParams = (queryParams: Partial<DidListQuery> = {}) => {\n return getQueryKey(queryParams, [\n 'page',\n 'pageSize',\n 'organisationId',\n 'sort',\n 'sortDirection',\n 'name',\n 'did',\n 'type',\n 'deactivated',\n 'exact',\n 'keyAlgorithms',\n 'keyRoles',\n 'keyStorages',\n 'keyIds',\n 'didMethods',\n ]);\n};\n\nexport const getQueryKeyFromIdentifierListQueryParams = (queryParams: Partial<IdentifierListQuery> = {}) => {\n return getQueryKey(queryParams, [\n 'page',\n 'pageSize',\n 'organisationId',\n 'sort',\n 'sortDirection',\n 'name',\n 'types',\n 'state',\n 'exact',\n 'didMethods',\n 'isRemote',\n 'keyAlgorithms',\n 'keyRoles',\n 'keyStorages',\n ]);\n};\n"],"mappings":"AAcU;;AAEV;AACA,SAASA,WAAWA,CAClBC,WAAsB,EACtBC,MAAiB,EACe;EAChC,OAAOA,MAAM,CAACC,GAAG,CAAEC,KAAK,IAAKH,WAAW,CAACG,KAAK,CAAC,CAAC;AAClD;AAEA,OAAO,MAAMC,wCAAwC,GAAGA,CAACJ,WAAyC,GAAG,CAAC,CAAC,KAAK;EAC1G,OAAOD,WAAW,CAACC,WAAW,EAAE,CAC9B,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,eAAe,EACf,OAAO,EACP,MAAM,EACN,KAAK,EACL,QAAQ,EACR,SAAS,EACT,SAAS,CACV,CAAC;AACJ,CAAC;AAED,OAAO,MAAMK,qCAAqC,GAAGA,CAACL,WAAsC,GAAG,CAAC,CAAC,K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EACf,UAAU,EACV,aAAa,EACb,QAAQ,EACR,YAAY,CACb,CAAC;AACJ,CAAC;AAED,OAAO,MAAMU,wCAAwC,GAAGA,CAACV,WAAyC,GAAG,CAAC,CAAC,KAAK;EAC1G,OAAOD,WAAW,CAACC,WAAW,EAAE,CAC9B,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,MAAM,EACN,eAAe,EACf,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,YAAY,EACZ,UAAU,EACV,eAAe,EACf,UAAU,EACV,aAAa,CACd,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1,8 +1,8 @@
1
1
  import { CredentialListQuery, CredentialSchemaListQuery, DidListQuery, HistoryListQuery, IdentifierListQuery, ProofListQuery, ProofSchemaListQuery } from '@procivis/react-native-one-core';
2
- export declare const getQueryKeyFromCredentialListQueryParams: (queryParams?: Partial<CredentialListQuery>) => (string | string[] | undefined)[];
3
- export declare const getQueryKeyFromHistoryListQueryParams: (queryParams?: Partial<HistoryListQuery>) => (string | import("@procivis/react-native-one-core").HistoryActionEnum[] | import("@procivis/react-native-one-core").HistoryEntityTypeEnum[] | undefined)[];
4
- export declare const getQueryKeyFromCredentialSchemaListQueryParams: (queryParams?: Partial<CredentialSchemaListQuery>) => (string | string[] | undefined)[];
5
- export declare const getQueryKeyFromProofSchemaListQueryParams: (queryParams?: Partial<ProofSchemaListQuery>) => (string | string[] | undefined)[];
6
- export declare const getQueryKeyFromProofListQueryParams: (queryParams?: Partial<ProofListQuery>) => (string | string[] | undefined)[];
7
- export declare const getQueryKeyFromDidListQueryParams: (queryParams?: Partial<DidListQuery>) => (string | boolean | string[] | undefined)[];
8
- export declare const getQueryKeyFromIdentifierListQueryParams: (queryParams?: Partial<IdentifierListQuery>) => (string | boolean | string[] | undefined)[];
2
+ export declare const getQueryKeyFromCredentialListQueryParams: (queryParams?: Partial<CredentialListQuery>) => (string | number | string[] | import("@procivis/react-native-one-core").CredentialListQueryExactColumnEnum[] | import("@procivis/react-native-one-core").CredentialStateEnum[] | import("@procivis/react-native-one-core").CredentialListIncludeEntityType[] | import("@procivis/react-native-one-core").CredentialListSearchType[] | undefined)[];
3
+ export declare const getQueryKeyFromHistoryListQueryParams: (queryParams?: Partial<HistoryListQuery>) => (string | number | import("@procivis/react-native-one-core").HistoryActionEnum[] | import("@procivis/react-native-one-core").HistoryEntityTypeEnum[] | undefined)[];
4
+ export declare const getQueryKeyFromCredentialSchemaListQueryParams: (queryParams?: Partial<CredentialSchemaListQuery>) => (string | number | string[] | import("@procivis/react-native-one-core").ExactCredentialSchemaFilterColumnEnum[] | import("@procivis/react-native-one-core").CredentialSchemaListIncludeEntityType[] | undefined)[];
5
+ export declare const getQueryKeyFromProofSchemaListQueryParams: (queryParams?: Partial<ProofSchemaListQuery>) => (string | number | string[] | import("@procivis/react-native-one-core").ExactProofSchemaFilterColumnEnum[] | undefined)[];
6
+ export declare const getQueryKeyFromProofListQueryParams: (queryParams?: Partial<ProofListQuery>) => (string | number | string[] | import("@procivis/react-native-one-core").ExactProofFilterColumnEnum[] | import("@procivis/react-native-one-core").ProofStateEnum[] | import("@procivis/react-native-one-core").ProofRoleEnum[] | undefined)[];
7
+ export declare const getQueryKeyFromDidListQueryParams: (queryParams?: Partial<DidListQuery>) => (string | number | boolean | string[] | import("@procivis/react-native-one-core").ExactDidFilterColumnEnum[] | import("@procivis/react-native-one-core").KeyRoleEnum[] | undefined)[];
8
+ export declare const getQueryKeyFromIdentifierListQueryParams: (queryParams?: Partial<IdentifierListQuery>) => (string | number | boolean | string[] | import("@procivis/react-native-one-core").KeyRoleEnum[] | import("@procivis/react-native-one-core").ExactIdentifierFilterColumnEnum[] | import("@procivis/react-native-one-core").IdentifierTypeEnum[] | undefined)[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procivis/one-react-native-components",
3
- "version": "0.3.47",
3
+ "version": "0.3.50",
4
4
  "author": "Procivis AG (https://procivis.ch)",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Common Procivis ONE UI components for react-native",
@@ -51,7 +51,7 @@
51
51
  "@babel/runtime": "^7.25.0",
52
52
  "@commitlint/config-conventional": "^11.0.0",
53
53
  "@gorhom/bottom-sheet": "^5.1.2",
54
- "@procivis/react-native-one-core": "1.52216.0",
54
+ "@procivis/react-native-one-core": "1.55028.0",
55
55
  "@procivis/react-native-picker": "5.0.3",
56
56
  "@react-native-async-storage/async-storage": "^1.17.3",
57
57
  "@react-native-community/blur": "^4.4.0",
@@ -138,7 +138,7 @@
138
138
  "vite": "^6.2.2"
139
139
  },
140
140
  "peerDependencies": {
141
- "@procivis/react-native-one-core": "^1.52216.0",
141
+ "@procivis/react-native-one-core": "^1.55028.0",
142
142
  "@procivis/react-native-picker": "*",
143
143
  "@react-native-community/blur": "*",
144
144
  "@react-native-community/netinfo": "^11.4.1",
@@ -1,4 +1,11 @@
1
- import { IdentifierCertificateDetail, IdentifierListItem,TrustEntity, TrustEntityRoleEnum, TrustEntityStateEnum } from '@procivis/react-native-one-core';
1
+ import {
2
+ IdentifierCertificateDetail,
3
+ IdentifierListItem,
4
+ IdentifierTypeEnum,
5
+ TrustEntity,
6
+ TrustEntityRoleEnum,
7
+ TrustEntityStateEnum,
8
+ } from '@procivis/react-native-one-core';
2
9
  import React, { FC, ReactNode, useMemo } from 'react';
3
10
  import { StyleProp, ViewStyle } from 'react-native';
4
11
 
@@ -21,22 +28,39 @@ export type EntityDetailsProps = {
21
28
  textColor?: string;
22
29
  testID?: string;
23
30
  } & (
24
- | {
31
+ | {
25
32
  identifier?: IdentifierListItem;
26
33
  }
27
- | {
34
+ | {
28
35
  entity: TrustEntity;
29
36
  }
30
- );
37
+ );
31
38
 
32
39
  const getCertificateCommonName = (certificate: IdentifierCertificateDetail): string | undefined => {
33
- return certificate.x509Attributes.subject.split(', ').find((s) => s.startsWith('CN'))?.split('=')?.pop();
34
- }
40
+ return certificate.x509Attributes.subject
41
+ .split(', ')
42
+ .find((s) => s.startsWith('CN'))
43
+ ?.split('=')
44
+ ?.pop();
45
+ };
35
46
 
36
- const EntityDetails: FC<EntityDetailsProps> = ({ labels, renderMore, role, style, testID, sublineColor, textColor, ...props }) => {
37
- const { data, isLoading: isLoadingTrustEntity } = useTrustEntity('identifier' in props ? props.identifier?.id : undefined);
47
+ const EntityDetails: FC<EntityDetailsProps> = ({
48
+ labels,
49
+ renderMore,
50
+ role,
51
+ style,
52
+ testID,
53
+ sublineColor,
54
+ textColor,
55
+ ...props
56
+ }) => {
57
+ const { data, isLoading: isLoadingTrustEntity } = useTrustEntity(
58
+ 'identifier' in props ? props.identifier?.id : undefined,
59
+ );
38
60
  const trustEntity: TrustEntity | undefined = 'entity' in props ? props.entity : data ?? undefined;
39
- const { data: identifierDetail, isLoading: isLoadingIdentifier } = useIdentifierDetails('identifier' in props ? props.identifier?.id : undefined);
61
+ const { data: identifierDetail, isLoading: isLoadingIdentifier } = useIdentifierDetails(
62
+ 'identifier' in props ? props.identifier?.id : undefined,
63
+ );
40
64
 
41
65
  const trusted =
42
66
  trustEntity &&
@@ -50,18 +74,27 @@ const EntityDetails: FC<EntityDetailsProps> = ({ labels, renderMore, role, style
50
74
  return undefined;
51
75
  }
52
76
 
53
- const avatar = trusted && identifierDetail?.type === 'DID' && trustEntity.logo ? { imageSource: { uri: trustEntity.logo } } : undefined;
77
+ const avatar =
78
+ trusted && identifierDetail?.type === 'DID' && trustEntity.logo
79
+ ? { imageSource: { uri: trustEntity.logo } }
80
+ : undefined;
54
81
 
55
- const placeholderText = identifierDetail?.type === 'CERTIFICATE' && identifierDetail.certificates?.[0] ? getCertificateCommonName(identifierDetail.certificates[0])?.substring(0, 1) : 'D';
82
+ const placeholderText =
83
+ identifierDetail?.type === IdentifierTypeEnum.CERTIFICATE && identifierDetail.certificates?.[0]
84
+ ? getCertificateCommonName(identifierDetail.certificates[0])?.substring(0, 1)
85
+ : 'D';
56
86
 
57
- const statusIcon = trusted ?
58
- <EntityTrustedIcon testID={concatTestID(testID, 'statusIcon', 'trusted')} /> :
59
- <EntityNotTrustedIcon testID={concatTestID(testID, 'statusIcon', 'notTrusted')} />;
87
+ const statusIcon = trusted ? (
88
+ <EntityTrustedIcon testID={concatTestID(testID, 'statusIcon', 'trusted')} />
89
+ ) : (
90
+ <EntityNotTrustedIcon testID={concatTestID(testID, 'statusIcon', 'notTrusted')} />
91
+ );
60
92
 
61
93
  if (trustEntity) {
62
94
  return {
63
95
  avatar,
64
- placeholderText: trusted && identifierDetail?.type === 'DID' ? trustEntity.name.substring(0, 1) : placeholderText,
96
+ placeholderText:
97
+ trusted && identifierDetail?.type === 'DID' ? trustEntity.name.substring(0, 1) : placeholderText,
65
98
  statusIcon,
66
99
  testID: concatTestID(testID, 'avatar'),
67
100
  };
@@ -70,14 +103,14 @@ const EntityDetails: FC<EntityDetailsProps> = ({ labels, renderMore, role, style
70
103
  return {
71
104
  placeholderText,
72
105
  statusIcon,
73
- }
106
+ };
74
107
  }, [trustEntity, trusted, identifierDetail, isLoading, testID]);
75
108
 
76
109
  const trustEntityName = useMemo(() => {
77
110
  if (isLoading) {
78
111
  return '';
79
112
  }
80
- if (identifierDetail?.type === 'CERTIFICATE' && identifierDetail.certificates?.[0]) {
113
+ if (identifierDetail?.type === IdentifierTypeEnum.CERTIFICATE && identifierDetail.certificates?.[0]) {
81
114
  const commonName = getCertificateCommonName(identifierDetail.certificates[0]);
82
115
  if (commonName) {
83
116
  return commonName;