@procivis/one-react-native-components 0.3.47 → 0.3.53
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.
- package/lib/commonjs/components/entity/entity-details.js +2 -2
- package/lib/commonjs/components/entity/entity-details.js.map +1 -1
- package/lib/commonjs/components/history/history-list-screen.js +2 -1
- package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
- package/lib/commonjs/ui-components/icons/icons.js +32 -1
- package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credentials.js +31 -1
- package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/trust-entity.js +3 -2
- package/lib/commonjs/utils/hooks/core/trust-entity.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +2 -2
- package/lib/commonjs/utils/parsers/credential.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.js +20 -101
- package/lib/commonjs/utils/parsers/query.js.map +1 -1
- package/lib/module/components/entity/entity-details.js +3 -3
- package/lib/module/components/entity/entity-details.js.map +1 -1
- package/lib/module/components/history/history-list-screen.js +2 -1
- package/lib/module/components/history/history-list-screen.js.map +1 -1
- package/lib/module/ui-components/icons/icons.js +30 -0
- package/lib/module/ui-components/icons/icons.js.map +1 -1
- package/lib/module/utils/hooks/core/credentials.js +28 -0
- package/lib/module/utils/hooks/core/credentials.js.map +1 -1
- package/lib/module/utils/hooks/core/trust-entity.js +4 -3
- package/lib/module/utils/hooks/core/trust-entity.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +2 -2
- package/lib/module/utils/parsers/credential.js.map +1 -1
- package/lib/module/utils/parsers/query.js +20 -101
- package/lib/module/utils/parsers/query.js.map +1 -1
- package/lib/typescript/ui-components/icons/icons.d.ts +1 -0
- package/lib/typescript/utils/hooks/core/credentials.d.ts +3 -1
- package/lib/typescript/utils/parsers/query.d.ts +7 -7
- package/package.json +3 -3
- package/src/components/entity/entity-details.tsx +50 -17
- package/src/components/history/history-list-screen.tsx +1 -1
- package/src/ui-components/icons/icons.tsx +13 -0
- package/src/utils/hooks/core/credentials.ts +35 -1
- package/src/utils/hooks/core/trust-entity.ts +64 -48
- package/src/utils/parsers/credential.ts +2 -1
- package/src/utils/parsers/query.ts +176 -0
- package/src/utils/parsers/query.tsx +0 -92
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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 'createdDateAfter',\n 'createdDateBefore',\n 'lastModifiedAfter',\n 'lastModifiedBefore',\n 'issuanceDateAfter',\n 'issuanceDateBefore',\n 'revocationDateAfter',\n 'revocationDateBefore',\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 'createdDateAfter',\n 'createdDateBefore',\n 'identifierId',\n 'credentialId',\n 'credentialSchemaId',\n 'proofSchemaId',\n 'search',\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 'createdDateAfter',\n 'createdDateBefore',\n 'lastModifiedAfter',\n 'lastModifiedBefore',\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 'createdDateAfter',\n 'createdDateBefore',\n 'lastModifiedAfter',\n 'lastModifiedBefore',\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 'createdDateAfter',\n 'createdDateBefore',\n 'lastModifiedAfter',\n 'lastModifiedBefore',\n 'requestedDateAfter',\n 'requestedDateBefore',\n 'completedDateAfter',\n 'completedDateBefore',\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 'createdDateAfter',\n 'createdDateBefore',\n 'lastModifiedAfter',\n 'lastModifiedBefore',\n ]);\n};\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CredentialListQuery, InvitationResult } from '@procivis/react-native-one-core';
|
|
1
|
+
import { CredentialListQuery, InitiateIssuanceRequest, InvitationResult } from '@procivis/react-native-one-core';
|
|
2
2
|
import { Transport } from '../connectivity/connectivity';
|
|
3
3
|
export declare const CREDENTIAL_LIST_QUERY_KEY = "credential-list";
|
|
4
4
|
export declare const CREDENTIAL_LIST_PAGED_QUERY_KEY = "credential-list-paged";
|
|
@@ -21,3 +21,5 @@ export declare const useCredentialReject: () => import("react-query").UseMutatio
|
|
|
21
21
|
export declare const useCredentialRevocationCheck: (forceRefresh: boolean) => import("react-query").UseMutationResult<import("@procivis/react-native-one-core").CredentialRevocationCheckResponse[], unknown, string[], unknown>;
|
|
22
22
|
export declare const useCredentialDelete: () => import("react-query").UseMutationResult<void, unknown, string, unknown>;
|
|
23
23
|
export declare const useInvalidateCredentialDetails: () => (credentialId: string | undefined) => Promise<void>;
|
|
24
|
+
export declare const useInitiateIssuance: () => import("react-query").UseMutationResult<import("@procivis/react-native-one-core").InitiateIssuanceResponse, unknown, Omit<InitiateIssuanceRequest, "organisationId">, unknown>;
|
|
25
|
+
export declare const useContinueIssuance: () => import("react-query").UseMutationResult<import("@procivis/react-native-one-core").ContinueIssuanceResponse, unknown, string, unknown>;
|
|
@@ -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").HistoryListSearch | 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.
|
|
3
|
+
"version": "0.3.53",
|
|
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.
|
|
54
|
+
"@procivis/react-native-one-core": "1.56061.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.
|
|
141
|
+
"@procivis/react-native-one-core": "^1.56061.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 {
|
|
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
|
|
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> = ({
|
|
37
|
-
|
|
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(
|
|
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 =
|
|
77
|
+
const avatar =
|
|
78
|
+
trusted && identifierDetail?.type === 'DID' && trustEntity.logo
|
|
79
|
+
? { imageSource: { uri: trustEntity.logo } }
|
|
80
|
+
: undefined;
|
|
54
81
|
|
|
55
|
-
const placeholderText =
|
|
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
|
-
|
|
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:
|
|
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 ===
|
|
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;
|
|
@@ -52,7 +52,7 @@ export const HistoryListScreen: FC<PropsWithChildren<HistoryListScreenProps>> =
|
|
|
52
52
|
const [scrollOffset] = useState(() => new Animated.Value(0));
|
|
53
53
|
|
|
54
54
|
const [searchPhrase, setSearchPhrase] = useState<string>('');
|
|
55
|
-
const searchBarVisible = !empty || Boolean(queryParams.
|
|
55
|
+
const searchBarVisible = !empty || Boolean(queryParams.search?.text);
|
|
56
56
|
|
|
57
57
|
const handleSearchPhraseChange = useMemo(() => debounce(onSearchPhraseChange, 500), [onSearchPhraseChange]);
|
|
58
58
|
useEffect(() => {
|
|
@@ -132,3 +132,16 @@ export const FilterIcon: FC<SvgProps> = ({ color, ...props }) => {
|
|
|
132
132
|
</Svg>
|
|
133
133
|
);
|
|
134
134
|
};
|
|
135
|
+
|
|
136
|
+
// https://www.figma.com/design/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?node-id=3436-22561
|
|
137
|
+
export const PlusIcon: FC<SvgProps> = ({ color, ...props }) => {
|
|
138
|
+
const colorScheme = useAppColorScheme();
|
|
139
|
+
const iconColor = color ?? colorScheme.text;
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<Svg fill="none" height={24} viewBox="0 0 24 24" width={24} {...props}>
|
|
143
|
+
<Rect fill={iconColor} height={2} rx={0.5} width={14} x={5} y={11} />
|
|
144
|
+
<Rect fill={iconColor} height={2} rx={0.5} transform="rotate(90 13 5)" width={14} x={13} y={5} />
|
|
145
|
+
</Svg>
|
|
146
|
+
);
|
|
147
|
+
};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
CredentialListQuery,
|
|
3
|
+
CredentialStateEnum,
|
|
4
|
+
InitiateIssuanceRequest,
|
|
5
|
+
InvitationResult,
|
|
6
|
+
OneError,
|
|
7
|
+
} from '@procivis/react-native-one-core';
|
|
2
8
|
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from 'react-query';
|
|
3
9
|
|
|
4
10
|
import { getQueryKeyFromCredentialListQueryParams } from '../../parsers/query';
|
|
@@ -170,3 +176,31 @@ export const useInvalidateCredentialDetails = () => {
|
|
|
170
176
|
return (credentialId: string | undefined) =>
|
|
171
177
|
queryClient.invalidateQueries([CREDENTIAL_DETAIL_QUERY_KEY, credentialId]);
|
|
172
178
|
};
|
|
179
|
+
|
|
180
|
+
export const useInitiateIssuance = () => {
|
|
181
|
+
const queryClient = useQueryClient();
|
|
182
|
+
const { core, organisationId } = useONECore();
|
|
183
|
+
|
|
184
|
+
return useMutation(
|
|
185
|
+
async (request: Omit<InitiateIssuanceRequest, 'organisationId'>) =>
|
|
186
|
+
core.initiateIssuance({ organisationId, ...request }),
|
|
187
|
+
{
|
|
188
|
+
onSuccess: async () => {
|
|
189
|
+
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export const useContinueIssuance = () => {
|
|
196
|
+
const queryClient = useQueryClient();
|
|
197
|
+
const { core } = useONECore();
|
|
198
|
+
|
|
199
|
+
return useMutation(async (url: string) => core.continueIssuance(url), {
|
|
200
|
+
onSuccess: async () => {
|
|
201
|
+
await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);
|
|
202
|
+
await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);
|
|
203
|
+
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CreateRemoteTrustEntityRequest,
|
|
3
|
+
IdentifierTypeEnum,
|
|
3
4
|
ONECore,
|
|
4
5
|
OneError,
|
|
5
6
|
TrustAnchor,
|
|
@@ -58,20 +59,29 @@ export const useTrustEntity = (identifierId: string | undefined) => {
|
|
|
58
59
|
|
|
59
60
|
return useQuery(
|
|
60
61
|
[TRUST_ENTITY_DETAIL_QUERY_KEY, identifierId],
|
|
61
|
-
() =>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
() =>
|
|
63
|
+
identifierId && identifierDetail
|
|
64
|
+
? core
|
|
65
|
+
.resolveTrustEntityByIdentifier({
|
|
66
|
+
identifiers: [
|
|
67
|
+
{
|
|
68
|
+
certificateId:
|
|
69
|
+
identifierDetail?.type === IdentifierTypeEnum.CERTIFICATE
|
|
70
|
+
? identifierDetail.certificates?.[0]?.id
|
|
71
|
+
: undefined,
|
|
72
|
+
id: identifierId,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
})
|
|
76
|
+
.then((result) => {
|
|
77
|
+
return result[identifierId]?.[0]?.trustEntity ?? null;
|
|
78
|
+
})
|
|
79
|
+
.catch((e) => {
|
|
80
|
+
if (e instanceof OneError && e.code === OneErrorCode.NoTrustEntityFound) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
throw e;
|
|
84
|
+
})
|
|
75
85
|
: undefined,
|
|
76
86
|
{
|
|
77
87
|
enabled: Boolean(identifierDetail),
|
|
@@ -99,51 +109,57 @@ export const useCreateRemoteTrustEntity = () => {
|
|
|
99
109
|
const queryClient = useQueryClient();
|
|
100
110
|
const { core } = useONECore();
|
|
101
111
|
|
|
102
|
-
return useMutation(
|
|
103
|
-
|
|
112
|
+
return useMutation(
|
|
113
|
+
async (request: Omit<CreateRemoteTrustEntityRequest, 'didId'> & { identifierId?: string; didId?: string }) => {
|
|
114
|
+
const { identifierId, didId } = request;
|
|
104
115
|
|
|
105
|
-
|
|
116
|
+
let entityDidId = didId;
|
|
106
117
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
118
|
+
if (identifierId) {
|
|
119
|
+
const identifierDetail = await core.getIdentifier(identifierId);
|
|
120
|
+
entityDidId = identifierDetail?.did?.id;
|
|
121
|
+
}
|
|
111
122
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}, {
|
|
117
|
-
onSuccess: async () => {
|
|
118
|
-
await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);
|
|
119
|
-
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
123
|
+
return core.createRemoteTrustEntity({
|
|
124
|
+
...request,
|
|
125
|
+
didId: entityDidId!,
|
|
126
|
+
});
|
|
120
127
|
},
|
|
121
|
-
|
|
128
|
+
{
|
|
129
|
+
onSuccess: async () => {
|
|
130
|
+
await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);
|
|
131
|
+
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
);
|
|
122
135
|
};
|
|
123
136
|
|
|
124
137
|
export const useUpdateRemoteTrustEntity = () => {
|
|
125
138
|
const queryClient = useQueryClient();
|
|
126
139
|
const { core } = useONECore();
|
|
127
140
|
|
|
128
|
-
return useMutation(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
onSuccess: async () => {
|
|
143
|
-
await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);
|
|
144
|
-
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
141
|
+
return useMutation(
|
|
142
|
+
async (request: Omit<UpdateRemoteTrustEntityRequest, 'didId'> & { identifierId?: string; didId?: string }) => {
|
|
143
|
+
const { identifierId, didId } = request;
|
|
144
|
+
|
|
145
|
+
let entityDidId = didId;
|
|
146
|
+
if (identifierId) {
|
|
147
|
+
const identifierDetail = await core.getIdentifier(identifierId);
|
|
148
|
+
entityDidId = identifierDetail?.did?.id;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return core.updateRemoteTrustEntity({
|
|
152
|
+
...request,
|
|
153
|
+
didId: entityDidId!,
|
|
154
|
+
});
|
|
145
155
|
},
|
|
146
|
-
|
|
156
|
+
{
|
|
157
|
+
onSuccess: async () => {
|
|
158
|
+
await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);
|
|
159
|
+
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
);
|
|
147
163
|
};
|
|
148
164
|
|
|
149
165
|
export enum TrustManagementEnum {
|
|
@@ -91,7 +91,8 @@ export const cardHeaderFromCredential = (
|
|
|
91
91
|
testID: string,
|
|
92
92
|
labels: CardHeaderLabels,
|
|
93
93
|
): Omit<CredentialHeaderProps, 'style'> => {
|
|
94
|
-
let credentialDetailPrimary =
|
|
94
|
+
let credentialDetailPrimary =
|
|
95
|
+
formatDateTimeLocalized(new Date(credential.issuanceDate ?? credential.createdDate)) ?? '';
|
|
95
96
|
|
|
96
97
|
let credentialDetailSecondary: string | undefined;
|
|
97
98
|
let credentialDetailErrorColor: boolean | undefined;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CredentialListQuery,
|
|
3
|
+
CredentialSchemaListQuery,
|
|
4
|
+
DidListQuery,
|
|
5
|
+
HistoryListQuery,
|
|
6
|
+
IdentifierListQuery,
|
|
7
|
+
ProofListQuery,
|
|
8
|
+
ProofSchemaListQuery,
|
|
9
|
+
} from '@procivis/react-native-one-core';
|
|
10
|
+
|
|
11
|
+
type QueryKey<ListQuery, ParamList> = ParamList extends ReadonlyArray<keyof ListQuery> // all params are inside the ListQuery
|
|
12
|
+
? keyof ListQuery extends ParamList[number] // all ListQuery fields are in the params
|
|
13
|
+
? Array<ListQuery[keyof ListQuery]>
|
|
14
|
+
: void
|
|
15
|
+
: void; // otherwise produce a wrong return type which should trigger compilation error
|
|
16
|
+
|
|
17
|
+
/** Typecheck that all query params are included in the query key */
|
|
18
|
+
function getQueryKey<ListQuery extends {}, ParamList extends ReadonlyArray<keyof ListQuery>>(
|
|
19
|
+
queryParams: ListQuery,
|
|
20
|
+
params: ParamList,
|
|
21
|
+
): QueryKey<ListQuery, ParamList> {
|
|
22
|
+
return params.map((param) => queryParams[param]) as QueryKey<ListQuery, ParamList>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const getQueryKeyFromCredentialListQueryParams = (queryParams: Partial<CredentialListQuery> = {}) => {
|
|
26
|
+
return getQueryKey(queryParams, [
|
|
27
|
+
'page',
|
|
28
|
+
'pageSize',
|
|
29
|
+
'organisationId',
|
|
30
|
+
'name',
|
|
31
|
+
'searchText',
|
|
32
|
+
'searchType',
|
|
33
|
+
'sort',
|
|
34
|
+
'sortDirection',
|
|
35
|
+
'exact',
|
|
36
|
+
'role',
|
|
37
|
+
'ids',
|
|
38
|
+
'status',
|
|
39
|
+
'include',
|
|
40
|
+
'profile',
|
|
41
|
+
'createdDateAfter',
|
|
42
|
+
'createdDateBefore',
|
|
43
|
+
'lastModifiedAfter',
|
|
44
|
+
'lastModifiedBefore',
|
|
45
|
+
'issuanceDateAfter',
|
|
46
|
+
'issuanceDateBefore',
|
|
47
|
+
'revocationDateAfter',
|
|
48
|
+
'revocationDateBefore',
|
|
49
|
+
]);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const getQueryKeyFromHistoryListQueryParams = (queryParams: Partial<HistoryListQuery> = {}) => {
|
|
53
|
+
return getQueryKey(queryParams, [
|
|
54
|
+
'page',
|
|
55
|
+
'pageSize',
|
|
56
|
+
'organisationId',
|
|
57
|
+
'entityId',
|
|
58
|
+
'actions',
|
|
59
|
+
'entityTypes',
|
|
60
|
+
'createdDateAfter',
|
|
61
|
+
'createdDateBefore',
|
|
62
|
+
'identifierId',
|
|
63
|
+
'credentialId',
|
|
64
|
+
'credentialSchemaId',
|
|
65
|
+
'proofSchemaId',
|
|
66
|
+
'search',
|
|
67
|
+
]);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const getQueryKeyFromCredentialSchemaListQueryParams = (
|
|
71
|
+
queryParams: Partial<CredentialSchemaListQuery> = {},
|
|
72
|
+
) => {
|
|
73
|
+
return getQueryKey(queryParams, [
|
|
74
|
+
'page',
|
|
75
|
+
'pageSize',
|
|
76
|
+
'organisationId',
|
|
77
|
+
'name',
|
|
78
|
+
'sort',
|
|
79
|
+
'sortDirection',
|
|
80
|
+
'exact',
|
|
81
|
+
'ids',
|
|
82
|
+
'include',
|
|
83
|
+
'schemaId',
|
|
84
|
+
'formats',
|
|
85
|
+
'createdDateAfter',
|
|
86
|
+
'createdDateBefore',
|
|
87
|
+
'lastModifiedAfter',
|
|
88
|
+
'lastModifiedBefore',
|
|
89
|
+
]);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const getQueryKeyFromProofSchemaListQueryParams = (queryParams: Partial<ProofSchemaListQuery> = {}) => {
|
|
93
|
+
return getQueryKey(queryParams, [
|
|
94
|
+
'page',
|
|
95
|
+
'pageSize',
|
|
96
|
+
'organisationId',
|
|
97
|
+
'name',
|
|
98
|
+
'sort',
|
|
99
|
+
'sortDirection',
|
|
100
|
+
'exact',
|
|
101
|
+
'ids',
|
|
102
|
+
'formats',
|
|
103
|
+
'createdDateAfter',
|
|
104
|
+
'createdDateBefore',
|
|
105
|
+
'lastModifiedAfter',
|
|
106
|
+
'lastModifiedBefore',
|
|
107
|
+
]);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const getQueryKeyFromProofListQueryParams = (queryParams: Partial<ProofListQuery> = {}) => {
|
|
111
|
+
return getQueryKey(queryParams, [
|
|
112
|
+
'page',
|
|
113
|
+
'pageSize',
|
|
114
|
+
'organisationId',
|
|
115
|
+
'sort',
|
|
116
|
+
'sortDirection',
|
|
117
|
+
'name',
|
|
118
|
+
'ids',
|
|
119
|
+
'proofStates',
|
|
120
|
+
'proofRoles',
|
|
121
|
+
'proofSchemaIds',
|
|
122
|
+
'exact',
|
|
123
|
+
'profile',
|
|
124
|
+
'createdDateAfter',
|
|
125
|
+
'createdDateBefore',
|
|
126
|
+
'lastModifiedAfter',
|
|
127
|
+
'lastModifiedBefore',
|
|
128
|
+
'requestedDateAfter',
|
|
129
|
+
'requestedDateBefore',
|
|
130
|
+
'completedDateAfter',
|
|
131
|
+
'completedDateBefore',
|
|
132
|
+
]);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const getQueryKeyFromDidListQueryParams = (queryParams: Partial<DidListQuery> = {}) => {
|
|
136
|
+
return getQueryKey(queryParams, [
|
|
137
|
+
'page',
|
|
138
|
+
'pageSize',
|
|
139
|
+
'organisationId',
|
|
140
|
+
'sort',
|
|
141
|
+
'sortDirection',
|
|
142
|
+
'name',
|
|
143
|
+
'did',
|
|
144
|
+
'type',
|
|
145
|
+
'deactivated',
|
|
146
|
+
'exact',
|
|
147
|
+
'keyAlgorithms',
|
|
148
|
+
'keyRoles',
|
|
149
|
+
'keyStorages',
|
|
150
|
+
'keyIds',
|
|
151
|
+
'didMethods',
|
|
152
|
+
]);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const getQueryKeyFromIdentifierListQueryParams = (queryParams: Partial<IdentifierListQuery> = {}) => {
|
|
156
|
+
return getQueryKey(queryParams, [
|
|
157
|
+
'page',
|
|
158
|
+
'pageSize',
|
|
159
|
+
'organisationId',
|
|
160
|
+
'sort',
|
|
161
|
+
'sortDirection',
|
|
162
|
+
'name',
|
|
163
|
+
'types',
|
|
164
|
+
'state',
|
|
165
|
+
'exact',
|
|
166
|
+
'didMethods',
|
|
167
|
+
'isRemote',
|
|
168
|
+
'keyAlgorithms',
|
|
169
|
+
'keyRoles',
|
|
170
|
+
'keyStorages',
|
|
171
|
+
'createdDateAfter',
|
|
172
|
+
'createdDateBefore',
|
|
173
|
+
'lastModifiedAfter',
|
|
174
|
+
'lastModifiedBefore',
|
|
175
|
+
]);
|
|
176
|
+
};
|