@procivis/one-react-native-components 0.3.102 → 0.3.112
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 +15 -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/v1/select-credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js +3 -15
- 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.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/commonjs/ui-components/control/checkbox.js +1 -1
- package/lib/commonjs/ui-components/control/checkbox.js.map +1 -1
- package/lib/commonjs/ui-components/control/switch.js +2 -2
- package/lib/commonjs/ui-components/control/switch.js.map +1 -1
- package/lib/commonjs/ui-components/header/foldable-header.js +26 -16
- 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/index.js +11 -0
- package/lib/commonjs/ui-components/index.js.map +1 -1
- package/lib/commonjs/ui-components/notice/index.js +14 -0
- package/lib/commonjs/ui-components/notice/index.js.map +1 -0
- package/lib/commonjs/ui-components/notice/wallet-notice.js +80 -0
- package/lib/commonjs/ui-components/notice/wallet-notice.js.map +1 -0
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/commonjs/utils/history.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/backup.js +2 -2
- 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-config.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credential-schemas.js +1 -1
- package/lib/commonjs/utils/hooks/core/credential-schemas.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credentials.js +4 -4
- package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/dids.js +2 -2
- 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 +2 -2
- package/lib/commonjs/utils/hooks/core/identifiers.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/index.js +11 -0
- package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/proof-schemas.js +1 -1
- package/lib/commonjs/utils/hooks/core/proof-schemas.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/proofs.js +23 -13
- package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/trust-entity.js +1 -1
- package/lib/commonjs/utils/hooks/core/trust-entity.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/trust-list.js +32 -0
- package/lib/commonjs/utils/hooks/core/trust-list.js.map +1 -0
- package/lib/commonjs/utils/hooks/core/wallet-unit.js +30 -2
- package/lib/commonjs/utils/hooks/core/wallet-unit.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 +4 -4
- package/lib/commonjs/utils/parsers/credential-images.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing.js +4 -10
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +9 -9
- package/lib/commonjs/utils/parsers/credential.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.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 +16 -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/v1/select-credential.js.map +1 -1
- package/lib/module/components/proof-request/v1/share-credential.js +4 -16
- 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.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/module/ui-components/control/checkbox.js +1 -1
- package/lib/module/ui-components/control/checkbox.js.map +1 -1
- package/lib/module/ui-components/control/switch.js +3 -3
- package/lib/module/ui-components/control/switch.js.map +1 -1
- package/lib/module/ui-components/header/foldable-header.js +26 -16
- 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/index.js +1 -0
- package/lib/module/ui-components/index.js.map +1 -1
- package/lib/module/ui-components/notice/index.js +3 -0
- package/lib/module/ui-components/notice/index.js.map +1 -0
- package/lib/module/ui-components/notice/wallet-notice.js +72 -0
- package/lib/module/ui-components/notice/wallet-notice.js.map +1 -0
- package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/module/utils/history.js.map +1 -1
- package/lib/module/utils/hooks/core/backup.js +3 -3
- 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-config.js.map +1 -1
- package/lib/module/utils/hooks/core/credential-schemas.js +1 -1
- package/lib/module/utils/hooks/core/credential-schemas.js.map +1 -1
- package/lib/module/utils/hooks/core/credentials.js +5 -5
- package/lib/module/utils/hooks/core/credentials.js.map +1 -1
- package/lib/module/utils/hooks/core/dids.js +3 -3
- 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 +3 -3
- package/lib/module/utils/hooks/core/identifiers.js.map +1 -1
- package/lib/module/utils/hooks/core/index.js +1 -0
- package/lib/module/utils/hooks/core/index.js.map +1 -1
- package/lib/module/utils/hooks/core/proof-schemas.js +1 -1
- package/lib/module/utils/hooks/core/proof-schemas.js.map +1 -1
- package/lib/module/utils/hooks/core/proofs.js +24 -14
- package/lib/module/utils/hooks/core/proofs.js.map +1 -1
- package/lib/module/utils/hooks/core/trust-entity.js +2 -2
- package/lib/module/utils/hooks/core/trust-entity.js.map +1 -1
- package/lib/module/utils/hooks/core/trust-list.js +24 -0
- package/lib/module/utils/hooks/core/trust-list.js.map +1 -0
- package/lib/module/utils/hooks/core/wallet-unit.js +28 -2
- package/lib/module/utils/hooks/core/wallet-unit.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 +5 -5
- package/lib/module/utils/parsers/credential-images.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing-v2.js +1 -1
- package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing.js +4 -10
- package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +10 -10
- package/lib/module/utils/parsers/credential.js.map +1 -1
- package/lib/module/utils/parsers/query.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/control/checkbox.d.ts +1 -1
- package/lib/typescript/ui-components/index.d.ts +1 -0
- package/lib/typescript/ui-components/notice/index.d.ts +2 -0
- package/lib/typescript/ui-components/notice/wallet-notice.d.ts +11 -0
- package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +2 -2
- package/lib/typescript/utils/history.d.ts +3 -3
- 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-config.d.ts +4 -4
- 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/index.d.ts +1 -0
- package/lib/typescript/utils/hooks/core/proof-schemas.d.ts +7 -7
- package/lib/typescript/utils/hooks/core/proofs.d.ts +14 -12
- package/lib/typescript/utils/hooks/core/trust-entity.d.ts +5 -5
- package/lib/typescript/utils/hooks/core/trust-list.d.ts +5 -0
- package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +11 -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 -8
- package/lib/typescript/utils/parsers/credential.d.ts +11 -11
- package/lib/typescript/utils/parsers/query.d.ts +8 -8
- package/package.json +3 -3
- 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 +2 -2
- package/src/components/entity/entity-details-with-buttons.tsx +6 -11
- package/src/components/entity/entity-details.tsx +16 -17
- package/src/components/history/history-details-screen.tsx +13 -13
- package/src/components/history/history-list-item-icon.tsx +18 -15
- package/src/components/history/history-list-item.tsx +5 -9
- 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/v1/select-credential.tsx +2 -2
- package/src/components/proof-request/v1/share-credential.tsx +12 -31
- package/src/components/proof-request/v2/select-credential-v2.tsx +3 -6
- package/src/components/proof-request/v2/share-credential-v2-group.tsx +10 -10
- package/src/components/proof-request/v2/share-credential-v2.tsx +9 -9
- package/src/ui-components/control/checkbox.tsx +12 -10
- package/src/ui-components/control/switch.tsx +23 -21
- package/src/ui-components/detail/detail.stories.tsx +1 -1
- package/src/ui-components/header/foldable-header.tsx +27 -20
- 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/index.ts +1 -0
- package/src/ui-components/notice/index.ts +3 -0
- package/src/ui-components/notice/wallet-notice.tsx +82 -0
- package/src/ui-components/screens/nerd-mode-screen.tsx +2 -2
- package/src/utils/history.ts +4 -4
- package/src/utils/hooks/core/backup.ts +3 -3
- package/src/utils/hooks/core/cache.ts +13 -13
- package/src/utils/hooks/core/core-config.ts +3 -3
- package/src/utils/hooks/core/credential-schemas.ts +5 -8
- package/src/utils/hooks/core/credentials.ts +14 -22
- package/src/utils/hooks/core/dids.ts +4 -4
- package/src/utils/hooks/core/history.ts +3 -3
- package/src/utils/hooks/core/identifiers.ts +4 -8
- package/src/utils/hooks/core/index.ts +1 -0
- package/src/utils/hooks/core/proof-schemas.ts +16 -22
- package/src/utils/hooks/core/proofs.ts +43 -36
- package/src/utils/hooks/core/trust-entity.ts +8 -10
- package/src/utils/hooks/core/trust-list.ts +29 -0
- package/src/utils/hooks/core/wallet-unit.ts +38 -12
- package/src/utils/hooks/revocation/credential-status.ts +2 -2
- package/src/utils/parsers/credential-images.tsx +7 -11
- package/src/utils/parsers/credential-sharing-v2.tsx +20 -23
- package/src/utils/parsers/credential-sharing.tsx +29 -38
- package/src/utils/parsers/credential.ts +43 -43
- package/src/utils/parsers/query.ts +14 -16
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
CredentialDetail,
|
|
3
|
+
CredentialListItem,
|
|
4
|
+
CredentialState,
|
|
5
|
+
PresentationDefinitionField,
|
|
6
|
+
PresentationDefinitionRequestedCredential,
|
|
7
7
|
} from '@procivis/react-native-one-core';
|
|
8
8
|
import React, { FunctionComponent, useMemo } from 'react';
|
|
9
9
|
import { Dimensions, ImageSourcePropType, StyleProp, StyleSheet, ViewStyle } from 'react-native';
|
|
@@ -28,17 +28,17 @@ export type ShareCredentialLabels = ShareCredentialCardLabels & {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export const ShareCredential: FunctionComponent<{
|
|
31
|
-
allCredentials:
|
|
31
|
+
allCredentials: CredentialDetail[];
|
|
32
32
|
expanded?: boolean;
|
|
33
33
|
labels: ShareCredentialLabels;
|
|
34
34
|
lastItem?: boolean;
|
|
35
35
|
onHeaderPress?: (_credentialId?: string) => void;
|
|
36
36
|
onImagePreview: (title: string, image: ImageSourcePropType) => void;
|
|
37
37
|
onSelectCredential?: () => void;
|
|
38
|
-
onSelectField: (_id:
|
|
39
|
-
request:
|
|
40
|
-
selectedCredentialId?:
|
|
41
|
-
selectedFields?: Array<
|
|
38
|
+
onSelectField: (_id: PresentationDefinitionField['id'], _selected: boolean) => void;
|
|
39
|
+
request: PresentationDefinitionRequestedCredential;
|
|
40
|
+
selectedCredentialId?: CredentialListItem['id'];
|
|
41
|
+
selectedFields?: Array<PresentationDefinitionField['id']>;
|
|
42
42
|
style?: StyleProp<ViewStyle>;
|
|
43
43
|
testID: string;
|
|
44
44
|
}> = ({
|
|
@@ -64,9 +64,7 @@ export const ShareCredential: FunctionComponent<{
|
|
|
64
64
|
const selectionOptions = useMemo(
|
|
65
65
|
() =>
|
|
66
66
|
request.applicableCredentials.filter((applicableCredentialId) =>
|
|
67
|
-
allCredentials.some(
|
|
68
|
-
({ id, state }) => id === applicableCredentialId && state === CredentialStateBindingEnum.ACCEPTED,
|
|
69
|
-
),
|
|
67
|
+
allCredentials.some(({ id, state }) => id === applicableCredentialId && state === CredentialState.ACCEPTED),
|
|
70
68
|
),
|
|
71
69
|
[allCredentials, request],
|
|
72
70
|
);
|
|
@@ -81,13 +79,6 @@ export const ShareCredential: FunctionComponent<{
|
|
|
81
79
|
: undefined,
|
|
82
80
|
);
|
|
83
81
|
|
|
84
|
-
const invalid = useMemo(() => {
|
|
85
|
-
if (!credential?.lvvcIssuanceDate || !request.validityCredentialNbf) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
return new Date(credential.lvvcIssuanceDate) < new Date(request.validityCredentialNbf);
|
|
89
|
-
}, [credential, request]);
|
|
90
|
-
|
|
91
82
|
const footer = useMemo(() => {
|
|
92
83
|
if (!expanded) {
|
|
93
84
|
return;
|
|
@@ -109,15 +100,6 @@ export const ShareCredential: FunctionComponent<{
|
|
|
109
100
|
);
|
|
110
101
|
}
|
|
111
102
|
|
|
112
|
-
if (invalid) {
|
|
113
|
-
return (
|
|
114
|
-
<ShareCredentialCardNotice
|
|
115
|
-
testID={concatTestID(testID, 'notice.invalid')}
|
|
116
|
-
text={labels.invalidCredentialNotice}
|
|
117
|
-
/>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
103
|
if (multipleCredentialsAvailable) {
|
|
122
104
|
return (
|
|
123
105
|
<SelectShareCredentialCardNotice
|
|
@@ -128,7 +110,7 @@ export const ShareCredential: FunctionComponent<{
|
|
|
128
110
|
/>
|
|
129
111
|
);
|
|
130
112
|
}
|
|
131
|
-
}, [expanded,
|
|
113
|
+
}, [expanded, labels, multipleCredentialsAvailable, onSelectCredential, testID, validityState]);
|
|
132
114
|
|
|
133
115
|
if (!config) {
|
|
134
116
|
return null;
|
|
@@ -136,7 +118,6 @@ export const ShareCredential: FunctionComponent<{
|
|
|
136
118
|
|
|
137
119
|
const { card, attributes } = shareCredentialCardFromCredential(
|
|
138
120
|
credential,
|
|
139
|
-
invalid,
|
|
140
121
|
Boolean(expanded),
|
|
141
122
|
multipleCredentialsAvailable,
|
|
142
123
|
request,
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CredentialListItemBindingDto,
|
|
3
|
-
PresentationDefinitionV2CredentialDetailBindingDto,
|
|
4
|
-
} from '@procivis/react-native-one-core';
|
|
1
|
+
import { CredentialListItem, PresentationDefinitionV2Credential } from '@procivis/react-native-one-core';
|
|
5
2
|
import React, { FC, useCallback, useMemo } from 'react';
|
|
6
3
|
import { Dimensions, ImageSourcePropType } from 'react-native';
|
|
7
4
|
|
|
@@ -10,12 +7,12 @@ import { ShareCredentialCardLabels, useCoreConfig } from '../../../utils';
|
|
|
10
7
|
import { selectCredentialCardFromV2Credential } from '../../../utils/parsers/credential-sharing-v2';
|
|
11
8
|
|
|
12
9
|
export const SelectCredentialV2: FC<{
|
|
13
|
-
credential:
|
|
10
|
+
credential: PresentationDefinitionV2Credential;
|
|
14
11
|
labels: ShareCredentialCardLabels;
|
|
15
12
|
lastItem: boolean;
|
|
16
13
|
multiple: boolean;
|
|
17
14
|
onImagePreview: (title: string, image: ImageSourcePropType) => void;
|
|
18
|
-
onSelected?: (credentialId:
|
|
15
|
+
onSelected?: (credentialId: CredentialListItem['id'], selected: boolean) => void;
|
|
19
16
|
selected: boolean;
|
|
20
17
|
testID: string;
|
|
21
18
|
}> = ({ credential, labels, lastItem, multiple, onImagePreview, onSelected, selected, testID }) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
CredentialListItem,
|
|
3
|
+
PresentationDefinitionV2,
|
|
4
|
+
PresentationDefinitionV2Claim,
|
|
5
|
+
PresentationSubmitV2CredentialRequest,
|
|
6
6
|
} from '@procivis/react-native-one-core';
|
|
7
7
|
import React, { FC, useCallback, useMemo } from 'react';
|
|
8
8
|
import { ImageSourcePropType, StyleProp, StyleSheet, ViewStyle } from 'react-native';
|
|
@@ -24,7 +24,7 @@ import { GroupedShareCredentialV2Padding, ShareCredentialV2 } from './share-cred
|
|
|
24
24
|
|
|
25
25
|
export type CredentialQuerySelection = Record<
|
|
26
26
|
string,
|
|
27
|
-
|
|
27
|
+
PresentationSubmitV2CredentialRequest | PresentationSubmitV2CredentialRequest[]
|
|
28
28
|
>;
|
|
29
29
|
|
|
30
30
|
export type ShareCredentialGroupLabels = ShareCredentialLabels & {
|
|
@@ -40,11 +40,11 @@ export type ShareCredentialV2GroupProps = {
|
|
|
40
40
|
onSelectField: (
|
|
41
41
|
requestCredentialId: string,
|
|
42
42
|
) => (
|
|
43
|
-
credentialId:
|
|
44
|
-
fieldPath:
|
|
43
|
+
credentialId: CredentialListItem['id'],
|
|
44
|
+
fieldPath: PresentationDefinitionV2Claim['path'],
|
|
45
45
|
selected: boolean,
|
|
46
46
|
) => void;
|
|
47
|
-
presentationDefinition:
|
|
47
|
+
presentationDefinition: PresentationDefinitionV2;
|
|
48
48
|
requestGroup: string[];
|
|
49
49
|
selected?: boolean;
|
|
50
50
|
selectedCredentials?: CredentialQuerySelection;
|
|
@@ -61,7 +61,7 @@ const multipleCredentialsSelected = (
|
|
|
61
61
|
selectedCredentials &&
|
|
62
62
|
selectedCredentials[credentialRequestId] &&
|
|
63
63
|
Array.isArray(selectedCredentials[credentialRequestId]) &&
|
|
64
|
-
(selectedCredentials[credentialRequestId] as
|
|
64
|
+
(selectedCredentials[credentialRequestId] as PresentationSubmitV2CredentialRequest[]).length > 1
|
|
65
65
|
);
|
|
66
66
|
};
|
|
67
67
|
|
|
@@ -123,7 +123,7 @@ export const ShareCredentialV2Group: FC<ShareCredentialV2GroupProps> = ({
|
|
|
123
123
|
const lastQuery = credentialRequestIndex === credentialRequestsLength - 1;
|
|
124
124
|
|
|
125
125
|
const credentialQuery = presentationDefinition.credentialQueries[credentialRequestId].credentialOrFailureHint;
|
|
126
|
-
let defaultSelection:
|
|
126
|
+
let defaultSelection: PresentationSubmitV2CredentialRequest;
|
|
127
127
|
if (credentialQuery.type_ === 'APPLICABLE_CREDENTIALS') {
|
|
128
128
|
defaultSelection = credentialQuery.applicableCredentials?.[0]
|
|
129
129
|
? {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
ApplicableCredentialOrFailureHint,
|
|
3
|
+
CredentialListItem,
|
|
4
|
+
PresentationDefinitionV2Claim,
|
|
5
5
|
} from '@procivis/react-native-one-core';
|
|
6
6
|
import React, { FunctionComponent, useCallback, useMemo } from 'react';
|
|
7
7
|
import { Dimensions, ImageSourcePropType, StyleProp, StyleSheet, ViewStyle } from 'react-native';
|
|
@@ -14,7 +14,7 @@ import { ShareCredentialCardNotice } from '../share-credential-card-notice';
|
|
|
14
14
|
import { ShareCredentialLabels } from '../v1';
|
|
15
15
|
|
|
16
16
|
export type ShareCredentialV2Props = {
|
|
17
|
-
credentialQuery:
|
|
17
|
+
credentialQuery: ApplicableCredentialOrFailureHint;
|
|
18
18
|
credentialRequestId: string;
|
|
19
19
|
expanded?: boolean;
|
|
20
20
|
grouped?: boolean;
|
|
@@ -25,12 +25,12 @@ export type ShareCredentialV2Props = {
|
|
|
25
25
|
onImagePreview: (title: string, image: ImageSourcePropType) => void;
|
|
26
26
|
onSelectCredential?: () => void;
|
|
27
27
|
onSelectField: (
|
|
28
|
-
credentialId:
|
|
29
|
-
fieldPath:
|
|
28
|
+
credentialId: CredentialListItem['id'],
|
|
29
|
+
fieldPath: PresentationDefinitionV2Claim['path'],
|
|
30
30
|
selected: boolean,
|
|
31
31
|
) => void;
|
|
32
|
-
selectedCredentialId?:
|
|
33
|
-
selectedFields?: Array<
|
|
32
|
+
selectedCredentialId?: CredentialListItem['id'];
|
|
33
|
+
selectedFields?: Array<PresentationDefinitionV2Claim['path']>;
|
|
34
34
|
style?: StyleProp<ViewStyle>;
|
|
35
35
|
testID: string;
|
|
36
36
|
};
|
|
@@ -131,7 +131,7 @@ export const ShareCredentialV2: FunctionComponent<ShareCredentialV2Props> = ({
|
|
|
131
131
|
]);
|
|
132
132
|
|
|
133
133
|
const onAttributeSelected = useCallback(
|
|
134
|
-
(fieldPath:
|
|
134
|
+
(fieldPath: PresentationDefinitionV2Claim['path'], selected: boolean) => {
|
|
135
135
|
if (!selectedCredentialId) {
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
@@ -9,7 +9,7 @@ import { useAppColorScheme } from '../theme';
|
|
|
9
9
|
|
|
10
10
|
export interface CheckboxProps extends TouchableOpacityProps {
|
|
11
11
|
value: boolean;
|
|
12
|
-
text
|
|
12
|
+
text?: ReactNode;
|
|
13
13
|
onValueChanged: (value: boolean) => void;
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
}
|
|
@@ -45,15 +45,17 @@ export const Checkbox: FC<CheckboxProps> = ({ style, text, value, disabled, onVa
|
|
|
45
45
|
]}
|
|
46
46
|
/>
|
|
47
47
|
)}
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
{text}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
{text && (
|
|
49
|
+
<View style={[styles.text, disabled && styles.disabled]}>
|
|
50
|
+
{typeof text === 'string' ? (
|
|
51
|
+
<Typography preset="xs/line-height-small" color={colorScheme.text}>
|
|
52
|
+
{text}
|
|
53
|
+
</Typography>
|
|
54
|
+
) : (
|
|
55
|
+
text
|
|
56
|
+
)}
|
|
57
|
+
</View>
|
|
58
|
+
)}
|
|
57
59
|
</TouchableOpacity>
|
|
58
60
|
);
|
|
59
61
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
-
import { Insets, Platform, StyleSheet, Switch as RNSwitch, SwitchProps as RNSwitchProps } from 'react-native';
|
|
2
|
+
import { Insets, Platform, StyleSheet, Switch as RNSwitch, SwitchProps as RNSwitchProps, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useAppColorScheme } from '../theme';
|
|
5
5
|
|
|
@@ -15,26 +15,28 @@ const hitSlop: Insets = { top: 10, bottom: 10, left: 10, right: 10 };
|
|
|
15
15
|
export const Switch = forwardRef<RNSwitch, SwitchProps>(({ value, disabled, style, onChange, ...props }, ref) => {
|
|
16
16
|
const colorScheme = useAppColorScheme();
|
|
17
17
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
18
|
+
<View>
|
|
19
|
+
<RNSwitch
|
|
20
|
+
ref={ref}
|
|
21
|
+
value={value}
|
|
22
|
+
disabled={disabled}
|
|
23
|
+
hitSlop={hitSlop}
|
|
24
|
+
style={[disabled && styles.disabled, style]}
|
|
25
|
+
onValueChange={onChange}
|
|
26
|
+
trackColor={Platform.select({
|
|
27
|
+
default: { true: colorScheme.grayDark, false: colorScheme.grayDark },
|
|
28
|
+
ios: { true: colorScheme.accent, false: colorScheme.grayDark },
|
|
29
|
+
})}
|
|
30
|
+
thumbColor={Platform.select({
|
|
31
|
+
default: value ? colorScheme.accent : disabled ? colorScheme.background : colorScheme.white,
|
|
32
|
+
ios: colorScheme.white,
|
|
33
|
+
})}
|
|
34
|
+
ios_backgroundColor={colorScheme.grayDark}
|
|
35
|
+
// @ts-ignore: web only prop
|
|
36
|
+
activeThumbColor={colorScheme.accent}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
</View>
|
|
38
40
|
);
|
|
39
41
|
});
|
|
40
42
|
|
|
@@ -19,7 +19,7 @@ const Render = ({ onRightAction, contentHeight, headerProps }: Args) => {
|
|
|
19
19
|
headerProps={{
|
|
20
20
|
...headerProps,
|
|
21
21
|
rightButtons: [
|
|
22
|
-
<TouchableOpacity onPress={onRightAction} hitSlop={hitSlop}>
|
|
22
|
+
<TouchableOpacity key="R" onPress={onRightAction} hitSlop={hitSlop}>
|
|
23
23
|
<Placeholder id="R" style={styles.rightButton} />
|
|
24
24
|
</TouchableOpacity>,
|
|
25
25
|
],
|
|
@@ -27,8 +27,9 @@ const FoldableSearchHeader: FunctionComponent<FoldableHeaderProps> = ({
|
|
|
27
27
|
const [collapsed, setCollapsed] = useState(header ? false : true);
|
|
28
28
|
const [headerHeight, setHeaderHeight] = useState<number>();
|
|
29
29
|
|
|
30
|
+
const containerPaddingTop = withNotice ? 15 : safeAreaInsets.top;
|
|
30
31
|
const containerPaddingStyle = {
|
|
31
|
-
paddingTop:
|
|
32
|
+
paddingTop: containerPaddingTop,
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
useEffect(() => {
|
|
@@ -52,11 +53,13 @@ const FoldableSearchHeader: FunctionComponent<FoldableHeaderProps> = ({
|
|
|
52
53
|
|
|
53
54
|
const scrollHeaderAnimatedStyle: Animated.WithAnimatedObject<ViewStyle> | undefined = playHeaderFoldAnimation
|
|
54
55
|
? {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
transform: [{
|
|
57
|
+
translateY: scrollOffset.interpolate({
|
|
58
|
+
extrapolate: 'clamp',
|
|
59
|
+
inputRange: [0, headerHeight],
|
|
60
|
+
outputRange: [0, -headerHeight],
|
|
61
|
+
}),
|
|
62
|
+
}],
|
|
60
63
|
}
|
|
61
64
|
: undefined;
|
|
62
65
|
|
|
@@ -80,32 +83,36 @@ const FoldableSearchHeader: FunctionComponent<FoldableHeaderProps> = ({
|
|
|
80
83
|
return (
|
|
81
84
|
<Animated.View
|
|
82
85
|
style={[styles.headerContainer, containerPaddingStyle, withNotice ? styles.noticeBorderRadius : undefined]}>
|
|
83
|
-
<View style={
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
{searchBar && <AnimatedSearchBar {...searchBar} collapsed={collapsed} />}
|
|
93
|
-
</Animated.View>
|
|
86
|
+
<Animated.View style={scrollHeaderAnimatedStyle}>
|
|
87
|
+
<View
|
|
88
|
+
style={[styles.blurFill, { top: -containerPaddingTop }]}>
|
|
89
|
+
<BlurView
|
|
90
|
+
blurStyle={'header'}
|
|
91
|
+
color={colorScheme.background}
|
|
92
|
+
style={[StyleSheet.absoluteFill, withNotice ? styles.noticeBorderRadius : undefined]}
|
|
93
|
+
/>
|
|
94
|
+
</View>
|
|
94
95
|
{header && (
|
|
95
|
-
<Animated.View onLayout={onHeaderLayout} style={
|
|
96
|
+
<Animated.View onLayout={onHeaderLayout} style={fadeHeaderOutAnimatedStyle}>
|
|
96
97
|
{header}
|
|
97
98
|
</Animated.View>
|
|
98
99
|
)}
|
|
99
|
-
|
|
100
|
+
{searchBar && <AnimatedSearchBar {...searchBar} collapsed={collapsed} />}
|
|
101
|
+
</Animated.View>
|
|
100
102
|
</Animated.View>
|
|
101
103
|
);
|
|
102
104
|
};
|
|
103
105
|
|
|
104
106
|
const styles = StyleSheet.create({
|
|
105
|
-
|
|
107
|
+
blurFill: {
|
|
108
|
+
bottom: 0,
|
|
109
|
+
left: 0,
|
|
106
110
|
overflow: 'hidden',
|
|
111
|
+
position: 'absolute',
|
|
112
|
+
right: 0,
|
|
107
113
|
},
|
|
108
114
|
headerContainer: {
|
|
115
|
+
overflow: 'hidden',
|
|
109
116
|
position: 'absolute',
|
|
110
117
|
width: '100%',
|
|
111
118
|
},
|
|
@@ -5,7 +5,7 @@ import { concatTestID } from '../../utils/testID';
|
|
|
5
5
|
import Typography from '../text/typography';
|
|
6
6
|
import { useAppColorScheme } from '../theme/color-scheme-context';
|
|
7
7
|
|
|
8
|
-
// component used on the history section lists (Settings->History,
|
|
8
|
+
// component used on the history section lists (Settings->History, CredentialDetail->History)
|
|
9
9
|
// https://www.figma.com/file/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?type=design&node-id=1246-51813&mode=dev
|
|
10
10
|
|
|
11
11
|
const HistorySectionHeaderView: FC<{
|
|
@@ -4,7 +4,7 @@ import { StyleSheet, View } from 'react-native';
|
|
|
4
4
|
import { useAppColorScheme } from '../theme/color-scheme-context';
|
|
5
5
|
import HistoryItemView, { HistoryItemViewProps } from './history-item';
|
|
6
6
|
|
|
7
|
-
// component used on the history section lists (Settings->History,
|
|
7
|
+
// component used on the history section lists (Settings->History, CredentialDetail->History)
|
|
8
8
|
// https://www.figma.com/file/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?type=design&node-id=1246-51813&mode=dev
|
|
9
9
|
|
|
10
10
|
export interface HistorySectionListItemProps extends HistoryItemViewProps {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { ComponentType, FunctionComponent, JSXElementConstructor, ReactElement, useMemo } from 'react';
|
|
2
|
+
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { concatTestID } from '../../utils';
|
|
5
|
+
import { TouchableOpacity } from '../accessibility/accessibilityHistoryWrappers';
|
|
6
|
+
import { CloseIcon } from '../icons';
|
|
7
|
+
import { Typography } from '../text';
|
|
8
|
+
import { useAppColorScheme } from '../theme';
|
|
9
|
+
|
|
10
|
+
export type WalletNoticeProps = {
|
|
11
|
+
accessory?: ComponentType<any> | ReactElement;
|
|
12
|
+
icon?: ComponentType<any> | ReactElement;
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
text: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const testID = 'WalletNotice';
|
|
19
|
+
|
|
20
|
+
const WalletNotice: FunctionComponent<WalletNoticeProps> = ({ accessory, icon, style, text, onClose }) => {
|
|
21
|
+
const colorScheme = useAppColorScheme();
|
|
22
|
+
|
|
23
|
+
const iconView: React.ReactElement | undefined = useMemo(() => {
|
|
24
|
+
if (!icon) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
if (React.isValidElement(icon)) {
|
|
28
|
+
return icon;
|
|
29
|
+
} else {
|
|
30
|
+
const IconComponent = icon as JSXElementConstructor<any>;
|
|
31
|
+
return <IconComponent />;
|
|
32
|
+
}
|
|
33
|
+
}, [icon]);
|
|
34
|
+
|
|
35
|
+
const accessoryView: React.ReactElement | undefined = useMemo(() => {
|
|
36
|
+
if (!accessory) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
if (React.isValidElement(accessory)) {
|
|
40
|
+
return accessory;
|
|
41
|
+
} else {
|
|
42
|
+
const AccessoryComponent = accessory as JSXElementConstructor<any>;
|
|
43
|
+
return <AccessoryComponent />;
|
|
44
|
+
}
|
|
45
|
+
}, [accessory]);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<View style={[styles.noticeContainer, style]}>
|
|
49
|
+
<View style={styles.title}>
|
|
50
|
+
{iconView}
|
|
51
|
+
<Typography color={colorScheme.white}>{text}</Typography>
|
|
52
|
+
{accessoryView}
|
|
53
|
+
</View>
|
|
54
|
+
{onClose && (
|
|
55
|
+
<TouchableOpacity onPress={onClose} style={styles.closeIcon} testID={concatTestID(testID, 'close')}>
|
|
56
|
+
<CloseIcon color="white" />
|
|
57
|
+
</TouchableOpacity>
|
|
58
|
+
)}
|
|
59
|
+
</View>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const styles = StyleSheet.create({
|
|
64
|
+
closeIcon: {
|
|
65
|
+
position: 'absolute',
|
|
66
|
+
right: 20,
|
|
67
|
+
top: 5,
|
|
68
|
+
},
|
|
69
|
+
noticeContainer: {
|
|
70
|
+
flexDirection: 'row',
|
|
71
|
+
justifyContent: 'center',
|
|
72
|
+
position: 'relative',
|
|
73
|
+
},
|
|
74
|
+
title: {
|
|
75
|
+
alignItems: 'center',
|
|
76
|
+
flexDirection: 'row',
|
|
77
|
+
gap: 5,
|
|
78
|
+
justifyContent: 'center',
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export default WalletNotice;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IdentifierListItem } from '@procivis/react-native-one-core';
|
|
2
2
|
import React, { FunctionComponent, useState } from 'react';
|
|
3
3
|
import { SectionList, StyleSheet, View } from 'react-native';
|
|
4
4
|
import Animated, { useAnimatedScrollHandler, useSharedValue } from 'react-native-reanimated';
|
|
@@ -34,7 +34,7 @@ export interface AttributesLabels {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
interface SectionEntityCluster {
|
|
37
|
-
identifier?:
|
|
37
|
+
identifier?: IdentifierListItem;
|
|
38
38
|
subline?: string;
|
|
39
39
|
entityLabels: EntityLabels;
|
|
40
40
|
role: ContextRole;
|
package/src/utils/history.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HistoryListItem } from '@procivis/react-native-one-core';
|
|
2
2
|
import moment, { Moment } from 'moment';
|
|
3
3
|
|
|
4
4
|
export interface HistoryGroupByDaySection {
|
|
5
|
-
data:
|
|
5
|
+
data: HistoryListItem[];
|
|
6
6
|
date: Moment;
|
|
7
7
|
firstYearEntry: boolean;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const groupEntriesByDay = (entries:
|
|
11
|
-
const groupedEntries = entries.reduce((result: HistoryGroupByDaySection[], entry:
|
|
10
|
+
export const groupEntriesByDay = (entries: HistoryListItem[]) => {
|
|
11
|
+
const groupedEntries = entries.reduce((result: HistoryGroupByDaySection[], entry: HistoryListItem) => {
|
|
12
12
|
const entryDate = moment(entry.createdDate);
|
|
13
13
|
|
|
14
14
|
const matchingEntry = result.find(({ date }) => date.isSame(entryDate, 'day'));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IdentifierState, IdentifierType } from '@procivis/react-native-one-core';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
4
4
|
|
|
@@ -81,11 +81,11 @@ export const useBackupFinalizeImportProcedure = ({ generateHwKey, generateSwKey
|
|
|
81
81
|
let swIdentifierId: string | undefined;
|
|
82
82
|
if (generateSwKey) {
|
|
83
83
|
const identifiers = await core.listIdentifiers({
|
|
84
|
-
states: [
|
|
84
|
+
states: [IdentifierState.ACTIVE],
|
|
85
85
|
organisationId,
|
|
86
86
|
page: 0,
|
|
87
87
|
pageSize: 1,
|
|
88
|
-
types: [
|
|
88
|
+
types: [IdentifierType.DID],
|
|
89
89
|
isRemote: false,
|
|
90
90
|
});
|
|
91
91
|
swIdentifierId = identifiers.values.find((identifier) => identifier.name.startsWith(SW_DID_NAME_PREFIX))?.id;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CacheType } from '@procivis/react-native-one-core';
|
|
2
2
|
import { useMutation, useQueryClient } from 'react-query';
|
|
3
3
|
|
|
4
4
|
import { useONECore } from './core-context';
|
|
@@ -8,17 +8,17 @@ import { REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY, TRUST_ENTITY_DETAIL_QUERY_KEY } f
|
|
|
8
8
|
const CREDENTIAL_QUERY_KEYS = [CREDENTIAL_LIST_QUERY_KEY, CREDENTIAL_LIST_PAGED_QUERY_KEY, CREDENTIAL_DETAIL_QUERY_KEY];
|
|
9
9
|
const TRUST_ENTITY_QUERY_KEYS = [TRUST_ENTITY_DETAIL_QUERY_KEY, REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY];
|
|
10
10
|
|
|
11
|
-
// Map each
|
|
12
|
-
const cacheTypeToQueryKeys: Record<
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
11
|
+
// Map each CacheType to the query keys that should be invalidated when that cache is cleared.
|
|
12
|
+
const cacheTypeToQueryKeys: Record<CacheType, string[]> = {
|
|
13
|
+
[CacheType.DID_DOCUMENT]: CREDENTIAL_QUERY_KEYS,
|
|
14
|
+
[CacheType.JSON_LD_CONTEXT]: CREDENTIAL_QUERY_KEYS,
|
|
15
|
+
[CacheType.STATUS_LIST_CREDENTIAL]: CREDENTIAL_QUERY_KEYS,
|
|
16
|
+
[CacheType.VCT_METADATA]: CREDENTIAL_QUERY_KEYS,
|
|
17
|
+
[CacheType.JSON_SCHEMA]: CREDENTIAL_QUERY_KEYS,
|
|
18
|
+
[CacheType.TRUST_LIST]: [...TRUST_ENTITY_QUERY_KEYS, ...CREDENTIAL_QUERY_KEYS],
|
|
19
|
+
[CacheType.X509_CRL]: CREDENTIAL_QUERY_KEYS,
|
|
20
|
+
[CacheType.ANDROID_ATTESTATION_CRL]: CREDENTIAL_QUERY_KEYS,
|
|
21
|
+
[CacheType.OPEN_ID_METADATA]: CREDENTIAL_QUERY_KEYS,
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
export const useCacheClear = () => {
|
|
@@ -26,7 +26,7 @@ export const useCacheClear = () => {
|
|
|
26
26
|
const { core } = useONECore();
|
|
27
27
|
|
|
28
28
|
return useMutation(
|
|
29
|
-
async (cacheTypes:
|
|
29
|
+
async (cacheTypes: CacheType[]) => {
|
|
30
30
|
await core.deleteCache(cacheTypes);
|
|
31
31
|
return cacheTypes;
|
|
32
32
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConfigEntities,CoreConfig } from '@procivis/react-native-one-core';
|
|
2
2
|
import { useQuery } from 'react-query';
|
|
3
3
|
|
|
4
4
|
import { useONECore } from './core-context';
|
|
@@ -13,7 +13,7 @@ export const useCoreConfig = () => {
|
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export const getEnabledTransports = (config:
|
|
16
|
+
export const getEnabledTransports = (config: CoreConfig): string[] => {
|
|
17
17
|
return Object.values(config?.transport ?? {})
|
|
18
18
|
.filter((t) => t.enabled !== false)
|
|
19
19
|
.map((transport) => transport.type);
|
|
@@ -25,7 +25,7 @@ export const getEnabledExchangeProtocols = (exchangeProtocol: ConfigEntities<any
|
|
|
25
25
|
.map((exchange) => exchange.type);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
export const getEnabledTrustManagement = (config:
|
|
28
|
+
export const getEnabledTrustManagement = (config: CoreConfig): string[] => {
|
|
29
29
|
return Object.values(config?.trustManagement ?? {})
|
|
30
30
|
.filter((t) => t.enabled !== false)
|
|
31
31
|
.map((trustManagement) => trustManagement.type);
|