@procivis/one-react-native-components 0.3.94 → 0.3.99
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/backup/preview-credentials.js.map +1 -1
- package/lib/commonjs/components/credential/credential.js.map +1 -1
- package/lib/commonjs/components/entity/EntityButtons.js.map +1 -1
- package/lib/commonjs/components/entity/entity-attributes.js.map +1 -1
- package/lib/commonjs/components/entity/entity-details-with-buttons.js +2 -2
- package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +1 -1
- package/lib/commonjs/components/entity/entity-details.js +3 -3
- package/lib/commonjs/components/entity/entity-details.js.map +1 -1
- package/lib/commonjs/components/history/history-details-screen.js +10 -10
- package/lib/commonjs/components/history/history-details-screen.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item-icon.js +12 -8
- package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item.js.map +1 -1
- package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
- package/lib/commonjs/components/history/history-list-section-header.js +1 -1
- package/lib/commonjs/components/history/history-list-section-header.js.map +1 -1
- package/lib/commonjs/components/history/history-list.js.map +1 -1
- package/lib/commonjs/components/proof-request/share-credential-card-notice.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js +1 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js +2 -2
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +2 -2
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/commonjs/ui-components/accessibility/accessibilityHistoryWrappers.js.map +1 -1
- package/lib/commonjs/ui-components/accessibility/locale/fi.json +1 -1
- package/lib/commonjs/ui-components/entity/entity-cluster.js.map +1 -1
- package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
- package/lib/commonjs/ui-components/history/history-section-header.js +1 -1
- package/lib/commonjs/ui-components/history/history-section-header.js.map +1 -1
- package/lib/commonjs/ui-components/history/history-section-list-item.js +1 -1
- package/lib/commonjs/ui-components/history/history-section-list-item.js.map +1 -1
- package/lib/commonjs/ui-components/icons/entity.js.map +1 -1
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/commonjs/ui-components/screens/section-list-screen.js.map +1 -1
- package/lib/commonjs/ui-components/settings/button-setting.js +3 -1
- package/lib/commonjs/ui-components/settings/button-setting.js.map +1 -1
- package/lib/commonjs/ui-components/settings/setting-item.js +4 -2
- package/lib/commonjs/ui-components/settings/setting-item.js.map +1 -1
- package/lib/commonjs/ui-components/settings/switch-setting.js +4 -2
- package/lib/commonjs/ui-components/settings/switch-setting.js.map +1 -1
- package/lib/commonjs/utils/date.js.map +1 -1
- package/lib/commonjs/utils/history.js +1 -41
- package/lib/commonjs/utils/history.js.map +1 -1
- package/lib/commonjs/utils/hooks/connectivity/connectivity.test.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/backup.js +3 -3
- package/lib/commonjs/utils/hooks/core/backup.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/cache.js +10 -10
- package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-context.js +5 -5
- package/lib/commonjs/utils/hooks/core/core-context.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credential-schemas.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credentials.js +3 -3
- package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/dids.js +1 -1
- package/lib/commonjs/utils/hooks/core/dids.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/history.js +1 -1
- package/lib/commonjs/utils/hooks/core/history.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/identifiers.js +3 -3
- package/lib/commonjs/utils/hooks/core/identifiers.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/proof-schemas.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/proofs.js +9 -9
- package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/trust-entity.js +5 -5
- package/lib/commonjs/utils/hooks/core/trust-entity.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js +1 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/commonjs/utils/hooks/navigation/open-settings.js.map +1 -1
- package/lib/commonjs/utils/hooks/revocation/credential-status.js +1 -1
- package/lib/commonjs/utils/hooks/revocation/credential-status.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-images.js +11 -10
- package/lib/commonjs/utils/parsers/credential-images.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js +14 -33
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing.js +4 -12
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +31 -32
- package/lib/commonjs/utils/parsers/credential.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.js.map +1 -1
- package/lib/commonjs/utils/url.js.map +1 -1
- package/lib/module/components/backup/preview-credentials.js.map +1 -1
- package/lib/module/components/credential/credential.js.map +1 -1
- package/lib/module/components/entity/EntityButtons.js.map +1 -1
- package/lib/module/components/entity/entity-attributes.js.map +1 -1
- package/lib/module/components/entity/entity-details-with-buttons.js +3 -3
- package/lib/module/components/entity/entity-details-with-buttons.js.map +1 -1
- package/lib/module/components/entity/entity-details.js +4 -4
- package/lib/module/components/entity/entity-details.js.map +1 -1
- package/lib/module/components/history/history-details-screen.js +11 -11
- package/lib/module/components/history/history-details-screen.js.map +1 -1
- package/lib/module/components/history/history-list-item-icon.js +13 -9
- package/lib/module/components/history/history-list-item-icon.js.map +1 -1
- package/lib/module/components/history/history-list-item.js.map +1 -1
- package/lib/module/components/history/history-list-screen.js.map +1 -1
- package/lib/module/components/history/history-list-section-header.js +1 -1
- package/lib/module/components/history/history-list-section-header.js.map +1 -1
- package/lib/module/components/history/history-list.js.map +1 -1
- package/lib/module/components/proof-request/share-credential-card-notice.js.map +1 -1
- package/lib/module/components/proof-request/v1/select-credential.js.map +1 -1
- package/lib/module/components/proof-request/v1/share-credential.js +2 -2
- package/lib/module/components/proof-request/v1/share-credential.js.map +1 -1
- package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js +2 -2
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2.js +2 -2
- package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/module/ui-components/accessibility/accessibilityHistoryWrappers.js.map +1 -1
- package/lib/module/ui-components/accessibility/locale/fi.json +1 -1
- package/lib/module/ui-components/entity/entity-cluster.js.map +1 -1
- package/lib/module/ui-components/header/foldable-header.js.map +1 -1
- package/lib/module/ui-components/history/history-section-header.js +1 -1
- package/lib/module/ui-components/history/history-section-header.js.map +1 -1
- package/lib/module/ui-components/history/history-section-list-item.js +1 -1
- package/lib/module/ui-components/history/history-section-list-item.js.map +1 -1
- package/lib/module/ui-components/icons/entity.js.map +1 -1
- package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/module/ui-components/screens/section-list-screen.js.map +1 -1
- package/lib/module/ui-components/settings/button-setting.js +3 -1
- package/lib/module/ui-components/settings/button-setting.js.map +1 -1
- package/lib/module/ui-components/settings/setting-item.js +4 -2
- package/lib/module/ui-components/settings/setting-item.js.map +1 -1
- package/lib/module/ui-components/settings/switch-setting.js +4 -2
- package/lib/module/ui-components/settings/switch-setting.js.map +1 -1
- package/lib/module/utils/date.js.map +1 -1
- package/lib/module/utils/history.js +0 -38
- package/lib/module/utils/history.js.map +1 -1
- package/lib/module/utils/hooks/connectivity/connectivity.test.js.map +1 -1
- package/lib/module/utils/hooks/core/backup.js +4 -4
- package/lib/module/utils/hooks/core/backup.js.map +1 -1
- package/lib/module/utils/hooks/core/cache.js +11 -11
- package/lib/module/utils/hooks/core/cache.js.map +1 -1
- package/lib/module/utils/hooks/core/core-context.js +5 -5
- package/lib/module/utils/hooks/core/core-context.js.map +1 -1
- package/lib/module/utils/hooks/core/credential-schemas.js.map +1 -1
- package/lib/module/utils/hooks/core/credentials.js +4 -4
- package/lib/module/utils/hooks/core/credentials.js.map +1 -1
- package/lib/module/utils/hooks/core/dids.js +2 -2
- package/lib/module/utils/hooks/core/dids.js.map +1 -1
- package/lib/module/utils/hooks/core/history.js +1 -1
- package/lib/module/utils/hooks/core/history.js.map +1 -1
- package/lib/module/utils/hooks/core/identifiers.js +4 -4
- package/lib/module/utils/hooks/core/identifiers.js.map +1 -1
- package/lib/module/utils/hooks/core/proof-schemas.js.map +1 -1
- package/lib/module/utils/hooks/core/proofs.js +10 -10
- package/lib/module/utils/hooks/core/proofs.js.map +1 -1
- package/lib/module/utils/hooks/core/trust-entity.js +6 -6
- package/lib/module/utils/hooks/core/trust-entity.js.map +1 -1
- package/lib/module/utils/hooks/core/wallet-unit.js +2 -2
- package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/module/utils/hooks/navigation/open-settings.js.map +1 -1
- package/lib/module/utils/hooks/revocation/credential-status.js +2 -2
- package/lib/module/utils/hooks/revocation/credential-status.js.map +1 -1
- package/lib/module/utils/parsers/credential-images.js +12 -11
- package/lib/module/utils/parsers/credential-images.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing-v2.js +14 -33
- package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing.js +4 -12
- package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +32 -33
- package/lib/module/utils/parsers/credential.js.map +1 -1
- package/lib/module/utils/parsers/query.js.map +1 -1
- package/lib/module/utils/url.js.map +1 -1
- package/lib/typescript/components/backup/preview-credentials.d.ts +2 -2
- package/lib/typescript/components/credential/credential.d.ts +2 -2
- package/lib/typescript/components/entity/EntityButtons.d.ts +2 -2
- package/lib/typescript/components/entity/entity-attributes.d.ts +2 -2
- package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +3 -3
- package/lib/typescript/components/entity/entity-details.d.ts +5 -5
- package/lib/typescript/components/history/history-details-screen.d.ts +2 -2
- package/lib/typescript/components/history/history-list-item-icon.d.ts +3 -3
- package/lib/typescript/components/history/history-list-item.d.ts +5 -5
- package/lib/typescript/components/history/history-list-screen.d.ts +4 -4
- package/lib/typescript/components/history/history-list.d.ts +5 -5
- package/lib/typescript/components/proof-request/v1/select-credential.d.ts +2 -2
- package/lib/typescript/components/proof-request/v1/share-credential.d.ts +6 -6
- package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +3 -3
- package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +4 -4
- package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +5 -5
- package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +2 -2
- package/lib/typescript/ui-components/settings/setting-item.d.ts +1 -0
- package/lib/typescript/utils/history.d.ts +3 -5
- package/lib/typescript/utils/hooks/core/backup.d.ts +3 -3
- package/lib/typescript/utils/hooks/core/cache.d.ts +2 -2
- package/lib/typescript/utils/hooks/core/core-context.d.ts +1 -1
- package/lib/typescript/utils/hooks/core/credential-schemas.d.ts +6 -6
- package/lib/typescript/utils/hooks/core/credentials.d.ts +8 -8
- package/lib/typescript/utils/hooks/core/dids.d.ts +2 -2
- package/lib/typescript/utils/hooks/core/history.d.ts +2 -2
- package/lib/typescript/utils/hooks/core/identifiers.d.ts +3 -3
- package/lib/typescript/utils/hooks/core/proof-schemas.d.ts +7 -7
- package/lib/typescript/utils/hooks/core/proofs.d.ts +9 -9
- package/lib/typescript/utils/hooks/core/trust-entity.d.ts +6 -6
- package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +5 -5
- package/lib/typescript/utils/parsers/credential-images.d.ts +2 -2
- package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +7 -7
- package/lib/typescript/utils/parsers/credential-sharing.d.ts +8 -9
- package/lib/typescript/utils/parsers/credential.d.ts +15 -35
- package/lib/typescript/utils/parsers/query.d.ts +8 -8
- package/package.json +6 -4
- package/src/components/backup/preview-credentials.tsx +2 -2
- package/src/components/credential/credential.tsx +2 -2
- package/src/components/entity/EntityButtons.tsx +2 -2
- package/src/components/entity/entity-attributes.tsx +4 -4
- package/src/components/entity/entity-details-with-buttons.tsx +11 -6
- package/src/components/entity/entity-details.tsx +17 -16
- package/src/components/history/history-details-screen.tsx +13 -16
- package/src/components/history/history-list-item-icon.tsx +19 -11
- package/src/components/history/history-list-item.tsx +9 -5
- package/src/components/history/history-list-screen.tsx +4 -4
- package/src/components/history/history-list-section-header.tsx +1 -1
- package/src/components/history/history-list.tsx +6 -6
- package/src/components/proof-request/share-credential-card-notice.tsx +1 -1
- package/src/components/proof-request/v1/select-credential.tsx +2 -2
- package/src/components/proof-request/v1/share-credential.tsx +13 -11
- package/src/components/proof-request/v2/select-credential-v2.tsx +6 -3
- package/src/components/proof-request/v2/share-credential-v2-group.tsx +12 -12
- package/src/components/proof-request/v2/share-credential-v2.tsx +11 -11
- package/src/ui-components/accessibility/accessibilityHistoryWrappers.tsx +4 -1
- package/src/ui-components/accessibility/locale/fi.json +1 -1
- package/src/ui-components/buttons/ghost-button.stories.tsx +0 -1
- package/src/ui-components/control/checkbox.stories.tsx +1 -1
- package/src/ui-components/control/switch.stories.tsx +1 -1
- package/src/ui-components/credential/card/credential-header.stories.tsx +0 -1
- package/src/ui-components/entity/entity-cluster.tsx +7 -6
- package/src/ui-components/header/foldable-header.tsx +8 -11
- package/src/ui-components/history/history-section-header.tsx +1 -1
- package/src/ui-components/history/history-section-list-item.tsx +1 -1
- package/src/ui-components/icons/entity.tsx +2 -2
- package/src/ui-components/pin/pin-code-screen.stories.tsx +1 -1
- package/src/ui-components/screens/image-preview-screen.stories.tsx +1 -1
- package/src/ui-components/screens/nerd-mode-screen.tsx +2 -2
- package/src/ui-components/screens/qr-code-scanner-screen.stories.tsx +1 -1
- package/src/ui-components/screens/section-list-screen.tsx +10 -1
- package/src/ui-components/searchbar/search-bar.stories.tsx +0 -1
- package/src/ui-components/settings/button-setting.tsx +2 -1
- package/src/ui-components/settings/setting-item.tsx +9 -2
- package/src/ui-components/settings/switch-setting.tsx +9 -2
- package/src/ui-components/text/typography.stories.tsx +2 -2
- package/src/utils/date.ts +2 -2
- package/src/utils/history.ts +4 -45
- package/src/utils/hooks/connectivity/connectivity.test.ts +2 -2
- package/src/utils/hooks/core/backup.ts +4 -4
- package/src/utils/hooks/core/cache.ts +13 -13
- package/src/utils/hooks/core/core-context.tsx +6 -6
- package/src/utils/hooks/core/credential-schemas.ts +7 -4
- package/src/utils/hooks/core/credentials.ts +21 -13
- package/src/utils/hooks/core/dids.ts +3 -3
- package/src/utils/hooks/core/history.ts +3 -3
- package/src/utils/hooks/core/identifiers.ts +9 -5
- package/src/utils/hooks/core/proof-schemas.ts +21 -16
- package/src/utils/hooks/core/proofs.ts +31 -27
- package/src/utils/hooks/core/trust-entity.ts +19 -12
- package/src/utils/hooks/core/wallet-unit.ts +21 -11
- package/src/utils/hooks/navigation/open-settings.ts +1 -1
- package/src/utils/hooks/revocation/credential-status.ts +2 -2
- package/src/utils/parsers/credential-images.tsx +19 -13
- package/src/utils/parsers/credential-sharing-v2.tsx +32 -48
- package/src/utils/parsers/credential-sharing.tsx +26 -36
- package/src/utils/parsers/credential.ts +64 -61
- package/src/utils/parsers/query.ts +16 -14
- package/src/utils/url.ts +1 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
ProofSchemaListQuery,
|
|
2
|
+
CreateProofSchemaRequestDto,
|
|
3
|
+
GetProofSchemaListItemBindingDto,
|
|
4
|
+
ImportProofSchemaBindingDto,
|
|
5
|
+
ListProofSchemasFiltersBindingDto,
|
|
7
6
|
} from '@procivis/react-native-one-core';
|
|
8
7
|
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from 'react-query';
|
|
9
8
|
|
|
@@ -19,7 +18,7 @@ export const PROOF_SCHEMA_IMPORT_DETAIL_QUERY_KEY = 'proof-schema-import';
|
|
|
19
18
|
export const PROOF_SCHEMA_DETAIL_QUERY_KEY = 'proof-schema-detail';
|
|
20
19
|
export const PROOF_SCHEMA_SHARE_QUERY_KEY = 'proof-schema-share';
|
|
21
20
|
|
|
22
|
-
export const useProofSchemas = (queryParams?: Partial<
|
|
21
|
+
export const useProofSchemas = (queryParams?: Partial<ListProofSchemasFiltersBindingDto>, keepPreviousData = true) => {
|
|
23
22
|
const { core, organisationId } = useONECore();
|
|
24
23
|
|
|
25
24
|
return useInfiniteQuery(
|
|
@@ -40,7 +39,10 @@ export const useProofSchemas = (queryParams?: Partial<ProofSchemaListQuery>, kee
|
|
|
40
39
|
);
|
|
41
40
|
};
|
|
42
41
|
|
|
43
|
-
export const useProofSchemaDetail = (
|
|
42
|
+
export const useProofSchemaDetail = (
|
|
43
|
+
proofSchemaId: GetProofSchemaListItemBindingDto['id'] | undefined,
|
|
44
|
+
active = true,
|
|
45
|
+
) => {
|
|
44
46
|
const { core } = useONECore();
|
|
45
47
|
|
|
46
48
|
return useQuery(
|
|
@@ -63,7 +65,7 @@ export const useProofSchemaImportDetail = (url: string) => {
|
|
|
63
65
|
if (!response.ok) {
|
|
64
66
|
throw response.originalError;
|
|
65
67
|
}
|
|
66
|
-
return response.data as
|
|
68
|
+
return response.data as ImportProofSchemaBindingDto;
|
|
67
69
|
}),
|
|
68
70
|
{
|
|
69
71
|
keepPreviousData: true,
|
|
@@ -76,7 +78,7 @@ export const useProofSchemaAccept = () => {
|
|
|
76
78
|
const { core, organisationId } = useONECore();
|
|
77
79
|
|
|
78
80
|
return useMutation(
|
|
79
|
-
async ({ schema }: { schema:
|
|
81
|
+
async ({ schema }: { schema: ImportProofSchemaBindingDto }) =>
|
|
80
82
|
core.importProofSchema({
|
|
81
83
|
organisationId,
|
|
82
84
|
schema,
|
|
@@ -95,7 +97,7 @@ export const useProofSchemaCreate = () => {
|
|
|
95
97
|
const queryClient = useQueryClient();
|
|
96
98
|
const { core } = useONECore();
|
|
97
99
|
|
|
98
|
-
return useMutation(async (proofSchema:
|
|
100
|
+
return useMutation(async (proofSchema: CreateProofSchemaRequestDto) => core.createProofSchema(proofSchema), {
|
|
99
101
|
onSuccess: async () => {
|
|
100
102
|
await queryClient.invalidateQueries(PROOF_SCHEMA_LIST_QUERY_KEY);
|
|
101
103
|
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
@@ -107,13 +109,16 @@ export const useProofSchemaDelete = () => {
|
|
|
107
109
|
const queryClient = useQueryClient();
|
|
108
110
|
const { core } = useONECore();
|
|
109
111
|
|
|
110
|
-
return useMutation(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
return useMutation(
|
|
113
|
+
async (proofSchemaId: GetProofSchemaListItemBindingDto['id']) => core.deleteProofSchema(proofSchemaId),
|
|
114
|
+
{
|
|
115
|
+
onSuccess: async (_, proofSchemaId) => {
|
|
116
|
+
await queryClient.invalidateQueries(PROOF_SCHEMA_LIST_QUERY_KEY);
|
|
117
|
+
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
118
|
+
await queryClient.removeQueries([PROOF_SCHEMA_DETAIL_QUERY_KEY, proofSchemaId]);
|
|
119
|
+
},
|
|
115
120
|
},
|
|
116
|
-
|
|
121
|
+
);
|
|
117
122
|
};
|
|
118
123
|
|
|
119
124
|
export const useShareProofSchema = (schemaId?: string) => {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Config,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
CreateProofRequestBindingDto,
|
|
4
|
+
GetProofSchemaBindingDto,
|
|
5
|
+
HistoryActionBindingEnum,
|
|
6
|
+
HistoryEntityTypeBindingEnum,
|
|
7
|
+
HistoryErrorMetadataBindingDto,
|
|
8
|
+
IdentifierListQueryBindingDto,
|
|
8
9
|
OneError,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
ShareProofRequest,
|
|
10
|
+
PresentationSubmitCredentialRequestBindingDto,
|
|
11
|
+
ProofListQueryBindingDto,
|
|
12
|
+
ProofStateBindingEnum,
|
|
13
|
+
ProposeProofRequestBindingDto,
|
|
14
|
+
ShareProofRequestBindingDto,
|
|
15
15
|
} from '@procivis/react-native-one-core';
|
|
16
16
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
17
17
|
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
@@ -51,18 +51,18 @@ export const useProofState = (proofId: string | undefined, isPolling: boolean) =
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
const state = await core.getProof(proofId).then((proof) => proof.state);
|
|
54
|
-
let metadata:
|
|
55
|
-
if (state ===
|
|
54
|
+
let metadata: HistoryErrorMetadataBindingDto | undefined;
|
|
55
|
+
if (state === ProofStateBindingEnum.ERROR) {
|
|
56
56
|
metadata = await core
|
|
57
|
-
.
|
|
57
|
+
.getHistoryList({
|
|
58
58
|
organisationId,
|
|
59
59
|
page: 0,
|
|
60
60
|
pageSize: 1,
|
|
61
61
|
entityIds: [proofId],
|
|
62
|
-
entityTypes: [
|
|
63
|
-
actions: [
|
|
62
|
+
entityTypes: [HistoryEntityTypeBindingEnum.PROOF],
|
|
63
|
+
actions: [HistoryActionBindingEnum.ERRORED],
|
|
64
64
|
})
|
|
65
|
-
.then((result) => result.values[0]?.metadata as
|
|
65
|
+
.then((result) => result.values[0]?.metadata?.value as HistoryErrorMetadataBindingDto);
|
|
66
66
|
}
|
|
67
67
|
return { state, metadata };
|
|
68
68
|
},
|
|
@@ -73,7 +73,7 @@ export const useProofState = (proofId: string | undefined, isPolling: boolean) =
|
|
|
73
73
|
);
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
type ProofUrlHookParams = { proofId: string; request?:
|
|
76
|
+
type ProofUrlHookParams = { proofId: string; request?: ShareProofRequestBindingDto };
|
|
77
77
|
|
|
78
78
|
export const useProofUrl = () => {
|
|
79
79
|
const queryClient = useQueryClient();
|
|
@@ -101,7 +101,7 @@ export const useProofAccept = () => {
|
|
|
101
101
|
interactionId,
|
|
102
102
|
credentials,
|
|
103
103
|
}: {
|
|
104
|
-
credentials: Record<string,
|
|
104
|
+
credentials: Record<string, PresentationSubmitCredentialRequestBindingDto[]>;
|
|
105
105
|
interactionId: string;
|
|
106
106
|
}) => core.holderSubmitProof(interactionId, credentials),
|
|
107
107
|
{
|
|
@@ -164,7 +164,8 @@ export const useProposeProof = () => {
|
|
|
164
164
|
const { core, organisationId } = useONECore();
|
|
165
165
|
|
|
166
166
|
return useMutation(
|
|
167
|
-
async (request: Omit<
|
|
167
|
+
async (request: Omit<ProposeProofRequestBindingDto, 'organisationId'>) =>
|
|
168
|
+
core.proposeProof({ organisationId, ...request }),
|
|
168
169
|
{
|
|
169
170
|
onSuccess: async () => {
|
|
170
171
|
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
@@ -198,7 +199,7 @@ export const useProofDelete = () => {
|
|
|
198
199
|
);
|
|
199
200
|
};
|
|
200
201
|
|
|
201
|
-
export const useProofs = (queryParams?: Partial<
|
|
202
|
+
export const useProofs = (queryParams?: Partial<ProofListQueryBindingDto>) => {
|
|
202
203
|
const { core, organisationId } = useONECore();
|
|
203
204
|
|
|
204
205
|
const queryKey = [PROOF_LIST_QUERY_KEY, ...getQueryKeyFromProofListQueryParams(queryParams)];
|
|
@@ -223,7 +224,7 @@ export const useProofCreate = () => {
|
|
|
223
224
|
|
|
224
225
|
const { core } = useONECore();
|
|
225
226
|
|
|
226
|
-
return useMutation(async (data:
|
|
227
|
+
return useMutation(async (data: CreateProofRequestBindingDto) => core.createProof(data), {
|
|
227
228
|
onSuccess: async () => {
|
|
228
229
|
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
229
230
|
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
@@ -231,7 +232,10 @@ export const useProofCreate = () => {
|
|
|
231
232
|
});
|
|
232
233
|
};
|
|
233
234
|
|
|
234
|
-
const getIdentifierFilterForProofSchema = (
|
|
235
|
+
const getIdentifierFilterForProofSchema = (
|
|
236
|
+
proofSchema: GetProofSchemaBindingDto,
|
|
237
|
+
config: Config,
|
|
238
|
+
): Partial<IdentifierListQueryBindingDto> => {
|
|
235
239
|
const requestedFormats = proofSchema.proofInputSchemas.map((schema) => schema.credentialSchema.format);
|
|
236
240
|
const requestedFormatsCapabilities = requestedFormats
|
|
237
241
|
.map((format) => config.format[format]?.capabilities)
|
|
@@ -298,7 +302,7 @@ export const useProofForSchemaIdWithTransport = (
|
|
|
298
302
|
return;
|
|
299
303
|
}
|
|
300
304
|
|
|
301
|
-
if (proofState?.state !==
|
|
305
|
+
if (proofState?.state !== ProofStateBindingEnum.CREATED && proofState?.state !== ProofStateBindingEnum.PENDING) {
|
|
302
306
|
setProofId(undefined);
|
|
303
307
|
} else {
|
|
304
308
|
setDeleting(true);
|
|
@@ -345,7 +349,7 @@ export const useCleanupUnusedProofs = () => {
|
|
|
345
349
|
const { data: proofs } = useProofs({
|
|
346
350
|
page: 0,
|
|
347
351
|
pageSize: 100,
|
|
348
|
-
proofStates: [
|
|
352
|
+
proofStates: [ProofStateBindingEnum.CREATED, ProofStateBindingEnum.PENDING],
|
|
349
353
|
});
|
|
350
354
|
const [cleaned, setCleaned] = useState(false);
|
|
351
355
|
|
|
@@ -370,7 +374,7 @@ export const useShareProof = (proofUrlProps: ProofUrlHookParams | undefined, ena
|
|
|
370
374
|
|
|
371
375
|
// reset when proofId changes or the proof was retracted
|
|
372
376
|
useEffect(() => {
|
|
373
|
-
if (!proofUrlProps?.proofId || proofState?.state ===
|
|
377
|
+
if (!proofUrlProps?.proofId || proofState?.state === ProofStateBindingEnum.CREATED) {
|
|
374
378
|
setSharedProof(undefined);
|
|
375
379
|
}
|
|
376
380
|
}, [proofUrlProps?.proofId, proofState]);
|
|
@@ -442,7 +446,7 @@ export const useDeleteAllProofsData = (schemaId: string) => {
|
|
|
442
446
|
page: 0,
|
|
443
447
|
pageSize: 1000,
|
|
444
448
|
proofSchemaIds: [schemaId],
|
|
445
|
-
proofStates: [
|
|
449
|
+
proofStates: [ProofStateBindingEnum.ACCEPTED],
|
|
446
450
|
})
|
|
447
451
|
.then((result) => Promise.all(result.values.reverse().map((proof) => core.deleteProofClaims(proof.id)))),
|
|
448
452
|
{
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
CreateRemoteTrustEntityRequestBindingDto,
|
|
3
|
+
GetTrustAnchorResponseBindingDto,
|
|
4
|
+
IdentifierTypeBindingEnum,
|
|
4
5
|
ONECore,
|
|
5
6
|
OneError,
|
|
6
|
-
|
|
7
|
-
UpdateRemoteTrustEntityRequest,
|
|
7
|
+
UpdateRemoteTrustEntityFromDidRequestBindingDto,
|
|
8
8
|
} from '@procivis/react-native-one-core';
|
|
9
9
|
import { useCallback } from 'react';
|
|
10
10
|
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
@@ -19,19 +19,19 @@ import { useIdentifierDetails } from './identifiers';
|
|
|
19
19
|
export const TRUST_ENTITY_DETAIL_QUERY_KEY = 'trust-entity-detail';
|
|
20
20
|
export const REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY = 'remote-trust-entity-detail';
|
|
21
21
|
|
|
22
|
-
export const useCreateTrustAnchor = (
|
|
22
|
+
export const useCreateTrustAnchor = () => {
|
|
23
23
|
const httpClient = useHTTPClient();
|
|
24
24
|
|
|
25
25
|
return useCallback(
|
|
26
|
-
async (core: ONECore) => {
|
|
27
|
-
const trustAnchors = await core.
|
|
26
|
+
async (core: ONECore, publisherReference: string) => {
|
|
27
|
+
const trustAnchors = await core.listTrustAnchors({
|
|
28
28
|
page: 0,
|
|
29
29
|
pageSize: 1,
|
|
30
30
|
});
|
|
31
31
|
if (trustAnchors.values.length > 0) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
const response = await httpClient.get<
|
|
34
|
+
const response = await httpClient.get<GetTrustAnchorResponseBindingDto>(publisherReference);
|
|
35
35
|
if (!response.ok || !response.data) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
@@ -48,7 +48,7 @@ export const useCreateTrustAnchor = (publisherReference: string) => {
|
|
|
48
48
|
throw err;
|
|
49
49
|
});
|
|
50
50
|
},
|
|
51
|
-
[
|
|
51
|
+
[httpClient],
|
|
52
52
|
);
|
|
53
53
|
};
|
|
54
54
|
|
|
@@ -66,7 +66,7 @@ export const useTrustEntity = (identifierId: string | undefined) => {
|
|
|
66
66
|
identifiers: [
|
|
67
67
|
{
|
|
68
68
|
certificateId:
|
|
69
|
-
identifierDetail?.type ===
|
|
69
|
+
identifierDetail?.type === IdentifierTypeBindingEnum.CERTIFICATE
|
|
70
70
|
? identifierDetail.certificates?.[0]?.id
|
|
71
71
|
: undefined,
|
|
72
72
|
id: identifierId,
|
|
@@ -110,7 +110,9 @@ export const useCreateRemoteTrustEntity = () => {
|
|
|
110
110
|
const { core } = useONECore();
|
|
111
111
|
|
|
112
112
|
return useMutation(
|
|
113
|
-
async (
|
|
113
|
+
async (
|
|
114
|
+
request: Omit<CreateRemoteTrustEntityRequestBindingDto, 'didId'> & { identifierId?: string; didId?: string },
|
|
115
|
+
) => {
|
|
114
116
|
const { identifierId, didId } = request;
|
|
115
117
|
|
|
116
118
|
let entityDidId = didId;
|
|
@@ -139,7 +141,12 @@ export const useUpdateRemoteTrustEntity = () => {
|
|
|
139
141
|
const { core } = useONECore();
|
|
140
142
|
|
|
141
143
|
return useMutation(
|
|
142
|
-
async (
|
|
144
|
+
async (
|
|
145
|
+
request: Omit<UpdateRemoteTrustEntityFromDidRequestBindingDto, 'didId'> & {
|
|
146
|
+
identifierId?: string;
|
|
147
|
+
didId?: string;
|
|
148
|
+
},
|
|
149
|
+
) => {
|
|
143
150
|
const { identifierId, didId } = request;
|
|
144
151
|
|
|
145
152
|
let entityDidId = didId;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
HolderWalletUnitResponseBindingDto,
|
|
3
|
+
WalletProviderBindingDto,
|
|
4
|
+
WalletUnitStatusBindingEnum,
|
|
5
|
+
} from '@procivis/react-native-one-core';
|
|
2
6
|
import { useEffect } from 'react';
|
|
3
7
|
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
4
8
|
|
|
@@ -7,7 +11,10 @@ import { useONECore } from './core-context';
|
|
|
7
11
|
|
|
8
12
|
export const WALLET_UNIT_QUERY_KEY = 'wallet-unit';
|
|
9
13
|
|
|
10
|
-
export const useWalletUnitDetail = (
|
|
14
|
+
export const useWalletUnitDetail = (
|
|
15
|
+
walletUnitId: HolderWalletUnitResponseBindingDto['id'] | undefined,
|
|
16
|
+
active = true,
|
|
17
|
+
) => {
|
|
11
18
|
const { core } = useONECore();
|
|
12
19
|
|
|
13
20
|
return useQuery(
|
|
@@ -25,7 +32,7 @@ export const useRegisterWalletUnit = () => {
|
|
|
25
32
|
const { core, organisationId } = useONECore();
|
|
26
33
|
|
|
27
34
|
return useMutation(
|
|
28
|
-
async (walletProvider:
|
|
35
|
+
async (walletProvider: WalletProviderBindingDto) =>
|
|
29
36
|
core.holderRegisterWalletUnit({
|
|
30
37
|
keyType: 'ECDSA',
|
|
31
38
|
organisationId,
|
|
@@ -42,16 +49,19 @@ export const useWalletUnitStatus = () => {
|
|
|
42
49
|
const queryClient = useQueryClient();
|
|
43
50
|
const { core } = useONECore();
|
|
44
51
|
|
|
45
|
-
return useMutation(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
return useMutation(
|
|
53
|
+
async (walletUnitId: HolderWalletUnitResponseBindingDto['id']) => core.holderWalletUnitStatus(walletUnitId),
|
|
54
|
+
{
|
|
55
|
+
onError: async (err) => {
|
|
56
|
+
reportException(err, 'Refresh wallet unit failure');
|
|
57
|
+
await queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY);
|
|
58
|
+
},
|
|
59
|
+
onSuccess: () => queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY),
|
|
49
60
|
},
|
|
50
|
-
|
|
51
|
-
});
|
|
61
|
+
);
|
|
52
62
|
};
|
|
53
63
|
|
|
54
|
-
export const useWalletUnitCheck = (walletUnitId:
|
|
64
|
+
export const useWalletUnitCheck = (walletUnitId: HolderWalletUnitResponseBindingDto['id'] | undefined) => {
|
|
55
65
|
const { data: walletUnitDetail, isLoading } = useWalletUnitDetail(walletUnitId);
|
|
56
66
|
const { mutateAsync: refreshWalletUnit, isLoading: isRefreshing, status: refreshStatus } = useWalletUnitStatus();
|
|
57
67
|
|
|
@@ -59,7 +69,7 @@ export const useWalletUnitCheck = (walletUnitId: HolderWalletUnitDetail['id'] |
|
|
|
59
69
|
if (isLoading || refreshStatus !== 'idle') {
|
|
60
70
|
return;
|
|
61
71
|
}
|
|
62
|
-
if (walletUnitId && walletUnitDetail?.status ===
|
|
72
|
+
if (walletUnitId && walletUnitDetail?.status === WalletUnitStatusBindingEnum.ACTIVE) {
|
|
63
73
|
void refreshWalletUnit(walletUnitId);
|
|
64
74
|
}
|
|
65
75
|
}, [isLoading, refreshStatus, walletUnitDetail, refreshWalletUnit, walletUnitId]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CredentialStateBindingEnum } from '@procivis/react-native-one-core';
|
|
2
2
|
import { useIsFocused } from '@react-navigation/native';
|
|
3
3
|
import { useCallback, useRef } from 'react';
|
|
4
4
|
|
|
@@ -18,7 +18,7 @@ export const useCredentialStatusCheck = (credentialIds?: string[], forceRefresh
|
|
|
18
18
|
const { mutateAsync: check } = useCredentialRevocationCheck(forceRefresh);
|
|
19
19
|
const { data: credentials } = useCredentials({
|
|
20
20
|
ids: credentialIds,
|
|
21
|
-
states: [
|
|
21
|
+
states: [CredentialStateBindingEnum.ACCEPTED, CredentialStateBindingEnum.SUSPENDED],
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
const checkCredentialsStatus = useCallback(async () => {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ClaimBindingDto,
|
|
3
|
+
CredentialSchemaCodeTypeBindingDto,
|
|
4
|
+
CredentialSchemaLayoutPropertiesBindingDto,
|
|
5
|
+
} from '@procivis/react-native-one-core';
|
|
2
6
|
import React from 'react';
|
|
3
7
|
import { StyleSheet } from 'react-native';
|
|
4
8
|
|
|
@@ -17,8 +21,8 @@ const styles = StyleSheet.create({
|
|
|
17
21
|
});
|
|
18
22
|
|
|
19
23
|
export const getCarouselImagesFromClaims = (
|
|
20
|
-
claims:
|
|
21
|
-
layoutProperties?:
|
|
24
|
+
claims: ClaimBindingDto[],
|
|
25
|
+
layoutProperties?: CredentialSchemaLayoutPropertiesBindingDto,
|
|
22
26
|
testID?: string,
|
|
23
27
|
): CarouselImage[] => {
|
|
24
28
|
const result: CarouselImage[] = [];
|
|
@@ -35,7 +39,7 @@ export const getCarouselImagesFromClaims = (
|
|
|
35
39
|
result.push({
|
|
36
40
|
element: (
|
|
37
41
|
<ImageOrComponent
|
|
38
|
-
source={{ imageSource: { uri: pictureClaim.value as string } }}
|
|
42
|
+
source={{ imageSource: { uri: pictureClaim.value.value as string } }}
|
|
39
43
|
style={styles.container}
|
|
40
44
|
testID={concatTestID(testID, CarouselImageType.Photo)}
|
|
41
45
|
/>
|
|
@@ -48,27 +52,29 @@ export const getCarouselImagesFromClaims = (
|
|
|
48
52
|
if (code) {
|
|
49
53
|
const claim = findClaimByPath(code.attribute, claims);
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
let claimValue = '';
|
|
56
|
+
|
|
57
|
+
if (claim && (claim.value.type_ === 'FLOAT' || claim.value.type_ === 'INTEGER')) {
|
|
58
|
+
claimValue = String(claim.value.value);
|
|
53
59
|
}
|
|
54
60
|
|
|
55
|
-
if (!claim || typeof
|
|
61
|
+
if (!claim || typeof claimValue !== 'string') {
|
|
56
62
|
return result;
|
|
57
63
|
}
|
|
58
64
|
|
|
59
|
-
if (code.type ===
|
|
65
|
+
if (code.type === CredentialSchemaCodeTypeBindingDto.QR_CODE) {
|
|
60
66
|
result.push({
|
|
61
|
-
element: <QrCode content={
|
|
67
|
+
element: <QrCode content={claimValue} testID={concatTestID(testID, CarouselImageType.QrCode)} />,
|
|
62
68
|
type: CarouselImageType.QrCode,
|
|
63
69
|
});
|
|
64
|
-
} else if (code.type ===
|
|
70
|
+
} else if (code.type === CredentialSchemaCodeTypeBindingDto.BARCODE && isASCII(claimValue)) {
|
|
65
71
|
result.push({
|
|
66
|
-
element: <Barcode content={
|
|
72
|
+
element: <Barcode content={claimValue} testID={concatTestID(testID, CarouselImageType.Barcode)} />,
|
|
67
73
|
type: CarouselImageType.Barcode,
|
|
68
74
|
});
|
|
69
|
-
} else if (code.type ===
|
|
75
|
+
} else if (code.type === CredentialSchemaCodeTypeBindingDto.MRZ) {
|
|
70
76
|
result.push({
|
|
71
|
-
element: <Mrz content={
|
|
77
|
+
element: <Mrz content={claimValue} testID={concatTestID(testID, CarouselImageType.MRZ)} />,
|
|
72
78
|
type: CarouselImageType.MRZ,
|
|
73
79
|
});
|
|
74
80
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
ClaimBindingDto,
|
|
3
|
+
ClaimValueBindingDto,
|
|
3
4
|
Config,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
PresentationDefinitionV2CredentialDetail,
|
|
5
|
+
CredentialQueryFailureHintResponseBindingDto,
|
|
6
|
+
PresentationDefinitionV2ClaimBindingDto,
|
|
7
|
+
PresentationDefinitionV2ClaimValueBindingDto,
|
|
8
|
+
PresentationDefinitionV2CredentialDetailBindingDto,
|
|
9
9
|
} from '@procivis/react-native-one-core';
|
|
10
10
|
import React from 'react';
|
|
11
11
|
|
|
@@ -27,51 +27,33 @@ import {
|
|
|
27
27
|
} from '.';
|
|
28
28
|
import { ShareCredentialCardLabels, validityCheckedCardFromCredential } from './credential-sharing';
|
|
29
29
|
|
|
30
|
-
const v2ClaimValueToClaimValue = (value:
|
|
31
|
-
if (
|
|
30
|
+
const v2ClaimValueToClaimValue = (value: PresentationDefinitionV2ClaimValueBindingDto): ClaimValueBindingDto => {
|
|
31
|
+
if (value.type_ !== 'NESTED') {
|
|
32
32
|
return value;
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return {
|
|
35
|
+
type_: 'NESTED',
|
|
36
|
+
value: value.value.map((c) => v2PresentationClaimToClaim(c)),
|
|
37
|
+
};
|
|
35
38
|
};
|
|
36
39
|
|
|
37
|
-
const v2PresentationClaimToClaim = (claim:
|
|
38
|
-
if (Array.isArray(claim.value)) {
|
|
39
|
-
if (claim.schema.array) {
|
|
40
|
-
return {
|
|
41
|
-
array: claim.schema.array,
|
|
42
|
-
dataType: claim.schema.datatype,
|
|
43
|
-
id: claim.path,
|
|
44
|
-
key: claim.path,
|
|
45
|
-
value: v2ClaimValueToClaimValue(claim.value) as Claim[],
|
|
46
|
-
};
|
|
47
|
-
} else {
|
|
48
|
-
return {
|
|
49
|
-
array: claim.schema.array,
|
|
50
|
-
dataType: DataTypeEnum.Object,
|
|
51
|
-
id: claim.path,
|
|
52
|
-
key: claim.path,
|
|
53
|
-
value: v2ClaimValueToClaimValue(claim.value) as Claim[],
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
40
|
+
const v2PresentationClaimToClaim = (claim: PresentationDefinitionV2ClaimBindingDto): ClaimBindingDto => {
|
|
57
41
|
return {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
key: claim.path,
|
|
62
|
-
value: claim.value,
|
|
42
|
+
schema: claim.schema,
|
|
43
|
+
path: claim.path,
|
|
44
|
+
value: v2ClaimValueToClaimValue(claim.value),
|
|
63
45
|
};
|
|
64
46
|
};
|
|
65
47
|
|
|
66
48
|
const getAttributeSelectorStatus = (
|
|
67
|
-
claim:
|
|
49
|
+
claim: PresentationDefinitionV2ClaimBindingDto,
|
|
68
50
|
selected: boolean,
|
|
69
51
|
force: boolean,
|
|
70
52
|
): SelectorStatus | undefined => {
|
|
71
53
|
if (claim.required && selected) {
|
|
72
54
|
return SelectorStatus.Required;
|
|
73
55
|
}
|
|
74
|
-
if (force
|
|
56
|
+
if (force) {
|
|
75
57
|
return SelectorStatus.Required;
|
|
76
58
|
}
|
|
77
59
|
if (claim.userSelection) {
|
|
@@ -84,7 +66,7 @@ const getAttributeSelectorStatus = (
|
|
|
84
66
|
};
|
|
85
67
|
|
|
86
68
|
export const shareCredentialCardAttributeFromV2Claim = (
|
|
87
|
-
claim:
|
|
69
|
+
claim: PresentationDefinitionV2ClaimBindingDto,
|
|
88
70
|
selection: string[] | undefined,
|
|
89
71
|
parentShared: boolean,
|
|
90
72
|
parentUserSelected: boolean,
|
|
@@ -114,14 +96,14 @@ export const shareCredentialCardAttributeFromV2Claim = (
|
|
|
114
96
|
selected,
|
|
115
97
|
testID,
|
|
116
98
|
};
|
|
117
|
-
if (
|
|
99
|
+
if (claim.value.type_ === 'NESTED') {
|
|
118
100
|
if (claim.schema.array) {
|
|
119
101
|
return {
|
|
120
102
|
...credentialAttribute,
|
|
121
103
|
attributes: undefined,
|
|
122
104
|
image: undefined,
|
|
123
105
|
value: undefined,
|
|
124
|
-
values: claim.value.map((v) =>
|
|
106
|
+
values: claim.value.value.map((v) =>
|
|
125
107
|
shareCredentialCardAttributeFromV2Claim(
|
|
126
108
|
v,
|
|
127
109
|
selection,
|
|
@@ -137,7 +119,7 @@ export const shareCredentialCardAttributeFromV2Claim = (
|
|
|
137
119
|
} else if (claim.schema.datatype === 'OBJECT') {
|
|
138
120
|
return {
|
|
139
121
|
...credentialAttribute,
|
|
140
|
-
attributes: claim.value.map((v) =>
|
|
122
|
+
attributes: claim.value.value.map((v) =>
|
|
141
123
|
shareCredentialCardAttributeFromV2Claim(v, selection, attributeShared, userSelected, config, testID, true),
|
|
142
124
|
),
|
|
143
125
|
image: undefined,
|
|
@@ -151,7 +133,7 @@ export const shareCredentialCardAttributeFromV2Claim = (
|
|
|
151
133
|
};
|
|
152
134
|
|
|
153
135
|
export const missingCredentialCardFromFailureHint = (
|
|
154
|
-
failureHint:
|
|
136
|
+
failureHint: CredentialQueryFailureHintResponseBindingDto | undefined,
|
|
155
137
|
notice: CredentialCardNotice | undefined,
|
|
156
138
|
testID: string,
|
|
157
139
|
labels: ShareCredentialCardLabels,
|
|
@@ -172,8 +154,8 @@ export const missingCredentialCardFromFailureHint = (
|
|
|
172
154
|
};
|
|
173
155
|
|
|
174
156
|
export const shareCredentialCardFromV2PresentationCredential = (
|
|
175
|
-
credential:
|
|
176
|
-
failureHint:
|
|
157
|
+
credential: PresentationDefinitionV2CredentialDetailBindingDto | undefined,
|
|
158
|
+
failureHint: CredentialQueryFailureHintResponseBindingDto | undefined,
|
|
177
159
|
expanded: boolean,
|
|
178
160
|
multipleCredentialsAvailable: boolean,
|
|
179
161
|
selectedFields: string[] | undefined,
|
|
@@ -219,7 +201,7 @@ export const shareCredentialCardFromV2PresentationCredential = (
|
|
|
219
201
|
};
|
|
220
202
|
|
|
221
203
|
export const selectCredentialCardFromV2Credential = (
|
|
222
|
-
credential:
|
|
204
|
+
credential: PresentationDefinitionV2CredentialDetailBindingDto,
|
|
223
205
|
selected: boolean,
|
|
224
206
|
multiple: boolean,
|
|
225
207
|
config: Config,
|
|
@@ -266,13 +248,15 @@ export const selectCredentialCardFromV2Credential = (
|
|
|
266
248
|
};
|
|
267
249
|
};
|
|
268
250
|
|
|
269
|
-
export const getV2CredentialClaimAllSubpaths = (claim:
|
|
270
|
-
if (
|
|
251
|
+
export const getV2CredentialClaimAllSubpaths = (claim: PresentationDefinitionV2ClaimBindingDto): string[] => {
|
|
252
|
+
if (claim.value.type_ !== 'NESTED') {
|
|
271
253
|
return [claim.path];
|
|
272
254
|
}
|
|
273
|
-
return [claim.path, ...claim.value.flatMap(getV2CredentialClaimAllSubpaths)];
|
|
255
|
+
return [claim.path, ...claim.value.value.flatMap(getV2CredentialClaimAllSubpaths)];
|
|
274
256
|
};
|
|
275
257
|
|
|
276
|
-
export const getV2CredentialAvailablePaths = (
|
|
258
|
+
export const getV2CredentialAvailablePaths = (
|
|
259
|
+
credential: PresentationDefinitionV2CredentialDetailBindingDto,
|
|
260
|
+
): string[] => {
|
|
277
261
|
return credential.claims.flatMap(getV2CredentialClaimAllSubpaths);
|
|
278
262
|
};
|