@procivis/one-react-native-components 0.3.121 → 0.3.130
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/credential/credential.js +2 -1
- package/lib/commonjs/components/credential/credential.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item-icon.js +2 -3
- package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item.js +2 -8
- package/lib/commonjs/components/history/history-list-item.js.map +1 -1
- package/lib/commonjs/components/history/history-list-screen.js +1 -1
- package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
- package/lib/commonjs/components/index.js +0 -11
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/select-credential.js +2 -1
- package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js +2 -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 +2 -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 +3 -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 +4 -2
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js +3 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
- package/lib/commonjs/ui-components/header/header.js.map +1 -1
- package/lib/commonjs/ui-components/history/history-details.js +2 -2
- package/lib/commonjs/ui-components/history/history-details.js.map +1 -1
- package/lib/commonjs/ui-components/icons/contact.js.map +1 -1
- package/lib/commonjs/ui-components/icons/credential.js +3 -3
- package/lib/commonjs/ui-components/icons/credential.js.map +1 -1
- package/lib/commonjs/ui-components/icons/icons.js +20 -1
- package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
- package/lib/commonjs/ui-components/loader/loading-result.js +2 -0
- package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js +7 -33
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/commonjs/utils/date.js +4 -5
- package/lib/commonjs/utils/date.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/cache.js +7 -4
- package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-config.js +1 -6
- package/lib/commonjs/utils/hooks/core/core-config.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-context.js +0 -15
- package/lib/commonjs/utils/hooks/core/core-context.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credentials.js +15 -1
- package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/index.js +0 -11
- package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/trust-list.js +19 -3
- package/lib/commonjs/utils/hooks/core/trust-list.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/verifier-instance.js +22 -3
- package/lib/commonjs/utils/hooks/core/verifier-instance.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js +2 -2
- package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js +14 -14
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing.js +20 -18
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +36 -22
- package/lib/commonjs/utils/parsers/credential.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.js +1 -1
- package/lib/commonjs/utils/parsers/query.js.map +1 -1
- package/lib/commonjs/utils/translations.js +15 -0
- package/lib/commonjs/utils/translations.js.map +1 -0
- package/lib/module/components/credential/credential.js +2 -1
- package/lib/module/components/credential/credential.js.map +1 -1
- package/lib/module/components/history/history-list-item-icon.js +2 -3
- package/lib/module/components/history/history-list-item-icon.js.map +1 -1
- package/lib/module/components/history/history-list-item.js +3 -9
- package/lib/module/components/history/history-list-item.js.map +1 -1
- package/lib/module/components/history/history-list-screen.js +1 -1
- package/lib/module/components/history/history-list-screen.js.map +1 -1
- package/lib/module/components/index.js +0 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/proof-request/v1/select-credential.js +2 -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 -1
- package/lib/module/components/proof-request/v1/share-credential.js.map +1 -1
- package/lib/module/components/proof-request/v2/select-credential-v2.js +2 -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 +3 -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 +4 -2
- package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js +3 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/module/ui-components/header/foldable-header.js.map +1 -1
- package/lib/module/ui-components/header/header.js.map +1 -1
- package/lib/module/ui-components/history/history-details.js +3 -3
- package/lib/module/ui-components/history/history-details.js.map +1 -1
- package/lib/module/ui-components/icons/contact.js.map +1 -1
- package/lib/module/ui-components/icons/credential.js +1 -1
- package/lib/module/ui-components/icons/credential.js.map +1 -1
- package/lib/module/ui-components/icons/icons.js +18 -0
- package/lib/module/ui-components/icons/icons.js.map +1 -1
- package/lib/module/ui-components/loader/loading-result.js +2 -0
- package/lib/module/ui-components/loader/loading-result.js.map +1 -1
- package/lib/module/ui-components/screens/nerd-mode-screen.js +7 -33
- package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/module/utils/date.js +4 -5
- package/lib/module/utils/date.js.map +1 -1
- package/lib/module/utils/hooks/core/cache.js +7 -4
- package/lib/module/utils/hooks/core/cache.js.map +1 -1
- package/lib/module/utils/hooks/core/core-config.js +0 -4
- package/lib/module/utils/hooks/core/core-config.js.map +1 -1
- package/lib/module/utils/hooks/core/core-context.js +0 -15
- package/lib/module/utils/hooks/core/core-context.js.map +1 -1
- package/lib/module/utils/hooks/core/credentials.js +13 -0
- package/lib/module/utils/hooks/core/credentials.js.map +1 -1
- package/lib/module/utils/hooks/core/index.js +0 -1
- package/lib/module/utils/hooks/core/index.js.map +1 -1
- package/lib/module/utils/hooks/core/trust-list.js +20 -4
- package/lib/module/utils/hooks/core/trust-list.js.map +1 -1
- package/lib/module/utils/hooks/core/verifier-instance.js +20 -2
- package/lib/module/utils/hooks/core/verifier-instance.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/parsers/credential-sharing-v2.js +15 -15
- package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing.js +20 -18
- package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +37 -23
- package/lib/module/utils/parsers/credential.js.map +1 -1
- package/lib/module/utils/parsers/query.js +1 -1
- package/lib/module/utils/parsers/query.js.map +1 -1
- package/lib/module/utils/translations.js +8 -0
- package/lib/module/utils/translations.js.map +1 -0
- package/lib/typescript/components/credential/credential.d.ts +1 -0
- package/lib/typescript/components/history/history-list-item.d.ts +1 -1
- package/lib/typescript/components/index.d.ts +0 -1
- package/lib/typescript/components/proof-request/v1/select-credential.d.ts +1 -0
- package/lib/typescript/components/proof-request/v1/share-credential.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +1 -0
- package/lib/typescript/ui-components/history/history-details.d.ts +2 -2
- package/lib/typescript/ui-components/icons/credential.d.ts +1 -1
- package/lib/typescript/ui-components/icons/icons.d.ts +1 -0
- package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +0 -12
- package/lib/typescript/utils/hooks/core/core-config.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/core-context.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/credentials.d.ts +2 -1
- package/lib/typescript/utils/hooks/core/index.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/trust-list.d.ts +1 -4
- package/lib/typescript/utils/hooks/core/verifier-instance.d.ts +2 -0
- package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +2 -2
- package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +3 -3
- package/lib/typescript/utils/parsers/credential-sharing.d.ts +6 -6
- package/lib/typescript/utils/parsers/credential.d.ts +5 -5
- package/lib/typescript/utils/parsers/query.d.ts +1 -1
- package/lib/typescript/utils/translations.d.ts +1 -0
- package/package.json +3 -3
- package/src/components/credential/credential.tsx +3 -0
- package/src/components/history/history-list-item-icon.tsx +1 -2
- package/src/components/history/history-list-item.tsx +4 -9
- package/src/components/history/history-list-screen.tsx +1 -1
- package/src/components/index.ts +0 -1
- package/src/components/proof-request/v1/select-credential.tsx +3 -1
- package/src/components/proof-request/v1/share-credential.tsx +3 -0
- package/src/components/proof-request/v2/select-credential-v2.tsx +3 -1
- package/src/components/proof-request/v2/share-credential-v2-group.tsx +4 -0
- package/src/components/proof-request/v2/share-credential-v2.tsx +5 -0
- package/src/ui-components/credential/card/credential-details-card.tsx +3 -2
- package/src/ui-components/header/foldable-header.tsx +10 -9
- package/src/ui-components/header/header.tsx +10 -1
- package/src/ui-components/history/history-details.tsx +4 -4
- package/src/ui-components/icons/contact.tsx +1 -1
- package/src/ui-components/icons/credential.tsx +1 -1
- package/src/ui-components/icons/icons.tsx +18 -0
- package/src/ui-components/loader/loading-result.tsx +7 -1
- package/src/ui-components/screens/nerd-mode-screen.tsx +2 -52
- package/src/utils/date.ts +7 -14
- package/src/utils/hooks/core/cache.ts +10 -3
- package/src/utils/hooks/core/core-config.ts +1 -6
- package/src/utils/hooks/core/core-context.tsx +0 -24
- package/src/utils/hooks/core/credentials.ts +13 -0
- package/src/utils/hooks/core/index.ts +0 -1
- package/src/utils/hooks/core/trust-list.ts +22 -11
- package/src/utils/hooks/core/verifier-instance.ts +23 -2
- package/src/utils/hooks/core/wallet-unit.ts +3 -3
- package/src/utils/parsers/credential-sharing-v2.tsx +29 -12
- package/src/utils/parsers/credential-sharing.tsx +33 -16
- package/src/utils/parsers/credential.ts +45 -14
- package/src/utils/parsers/query.ts +3 -0
- package/src/utils/translations.ts +10 -0
- package/lib/commonjs/components/entity/EntityButtons.js +0 -64
- package/lib/commonjs/components/entity/EntityButtons.js.map +0 -1
- package/lib/commonjs/components/entity/entity-attributes.js +0 -65
- package/lib/commonjs/components/entity/entity-attributes.js.map +0 -1
- package/lib/commonjs/components/entity/entity-details-with-buttons.js +0 -67
- package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +0 -1
- package/lib/commonjs/components/entity/entity-details.js +0 -101
- package/lib/commonjs/components/entity/entity-details.js.map +0 -1
- package/lib/commonjs/components/entity/index.js +0 -14
- package/lib/commonjs/components/entity/index.js.map +0 -1
- package/lib/commonjs/utils/hooks/core/trust-entity.js +0 -147
- package/lib/commonjs/utils/hooks/core/trust-entity.js.map +0 -1
- package/lib/module/components/entity/EntityButtons.js +0 -56
- package/lib/module/components/entity/EntityButtons.js.map +0 -1
- package/lib/module/components/entity/entity-attributes.js +0 -57
- package/lib/module/components/entity/entity-attributes.js.map +0 -1
- package/lib/module/components/entity/entity-details-with-buttons.js +0 -58
- package/lib/module/components/entity/entity-details-with-buttons.js.map +0 -1
- package/lib/module/components/entity/entity-details.js +0 -92
- package/lib/module/components/entity/entity-details.js.map +0 -1
- package/lib/module/components/entity/index.js +0 -3
- package/lib/module/components/entity/index.js.map +0 -1
- package/lib/module/utils/hooks/core/trust-entity.js +0 -136
- package/lib/module/utils/hooks/core/trust-entity.js.map +0 -1
- package/lib/typescript/components/entity/EntityButtons.d.ts +0 -14
- package/lib/typescript/components/entity/entity-attributes.d.ts +0 -15
- package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +0 -18
- package/lib/typescript/components/entity/entity-details.d.ts +0 -21
- package/lib/typescript/components/entity/index.d.ts +0 -3
- package/lib/typescript/utils/hooks/core/trust-entity.d.ts +0 -17
- package/src/components/entity/EntityButtons.tsx +0 -79
- package/src/components/entity/entity-attributes.tsx +0 -80
- package/src/components/entity/entity-details-with-buttons.tsx +0 -75
- package/src/components/entity/entity-details.tsx +0 -145
- package/src/components/entity/index.ts +0 -4
- package/src/utils/hooks/core/trust-entity.ts +0 -172
|
@@ -2,7 +2,7 @@ import { HistoryAction, HistoryEntityType, HistoryListItem } from '@procivis/rea
|
|
|
2
2
|
import React, { FC, useCallback, useMemo } from 'react';
|
|
3
3
|
|
|
4
4
|
import { HistoryItemView } from '../../ui-components';
|
|
5
|
-
import { formatTime
|
|
5
|
+
import { formatTime } from '../../utils';
|
|
6
6
|
import { HistoryListItemIcon } from './history-list-item-icon';
|
|
7
7
|
|
|
8
8
|
export type HistoryListItemLabels = {
|
|
@@ -13,7 +13,7 @@ export type HistoryListItemLabels = {
|
|
|
13
13
|
export interface HistoryListItemViewProps {
|
|
14
14
|
dateFormatter?: (date: Date) => string;
|
|
15
15
|
first?: boolean;
|
|
16
|
-
infoLabelMode?: '
|
|
16
|
+
infoLabelMode?: 'associatedLabel' | 'none';
|
|
17
17
|
item: HistoryListItem;
|
|
18
18
|
labels: HistoryListItemLabels;
|
|
19
19
|
last?: boolean;
|
|
@@ -24,28 +24,23 @@ export interface HistoryListItemViewProps {
|
|
|
24
24
|
export const HistoryListItemView: FC<HistoryListItemViewProps> = ({
|
|
25
25
|
dateFormatter = formatTime,
|
|
26
26
|
first,
|
|
27
|
-
infoLabelMode = '
|
|
27
|
+
infoLabelMode = 'associatedLabel',
|
|
28
28
|
item,
|
|
29
29
|
labels,
|
|
30
30
|
last,
|
|
31
31
|
onPress,
|
|
32
32
|
testID,
|
|
33
33
|
}) => {
|
|
34
|
-
const identifierId = infoLabelMode === 'entity' ? item.target : undefined;
|
|
35
|
-
const { data: trustEntity } = useTrustEntity(identifierId);
|
|
36
|
-
|
|
37
34
|
const label = `${labels.entityTypes[item.entityType]} ${labels.actions[item.action]}`;
|
|
38
35
|
|
|
39
36
|
const info = useMemo(() => {
|
|
40
37
|
switch (infoLabelMode) {
|
|
41
|
-
case 'entity':
|
|
42
|
-
return trustEntity?.name;
|
|
43
38
|
case 'associatedLabel':
|
|
44
39
|
return item.name;
|
|
45
40
|
case 'none':
|
|
46
41
|
return undefined;
|
|
47
42
|
}
|
|
48
|
-
}, [infoLabelMode, item
|
|
43
|
+
}, [infoLabelMode, item]);
|
|
49
44
|
|
|
50
45
|
const icon = <HistoryListItemIcon item={item} />;
|
|
51
46
|
|
|
@@ -38,7 +38,7 @@ export type HistoryListScreenProps = {
|
|
|
38
38
|
export const HistoryListScreen: FC<PropsWithChildren<HistoryListScreenProps>> = ({
|
|
39
39
|
children,
|
|
40
40
|
groupItems = groupEntriesByDay,
|
|
41
|
-
itemInfoLabelMode = '
|
|
41
|
+
itemInfoLabelMode = 'associatedLabel',
|
|
42
42
|
labels,
|
|
43
43
|
onBackPressed,
|
|
44
44
|
onHistoryItemPressed,
|
package/src/components/index.ts
CHANGED
|
@@ -13,13 +13,14 @@ import {
|
|
|
13
13
|
export const SelectCredential: FC<{
|
|
14
14
|
credentialId: string;
|
|
15
15
|
labels: ShareCredentialCardLabels;
|
|
16
|
+
language?: string;
|
|
16
17
|
lastItem: boolean;
|
|
17
18
|
onImagePreview: (title: string, image: ImageSourcePropType) => void;
|
|
18
19
|
onPress?: () => void;
|
|
19
20
|
request: PresentationDefinitionRequestedCredential;
|
|
20
21
|
selected: boolean;
|
|
21
22
|
testID: string;
|
|
22
|
-
}> = ({ credentialId, labels, lastItem, onImagePreview, onPress, request, selected, testID }) => {
|
|
23
|
+
}> = ({ credentialId, labels, language, lastItem, onImagePreview, onPress, request, selected, testID }) => {
|
|
23
24
|
const { data: credential } = useCredentialDetail(credentialId);
|
|
24
25
|
const { data: config } = useCoreConfig();
|
|
25
26
|
const cardWidth = useMemo(() => Dimensions.get('window').width - 32, []);
|
|
@@ -35,6 +36,7 @@ export const SelectCredential: FC<{
|
|
|
35
36
|
config,
|
|
36
37
|
testID,
|
|
37
38
|
labels,
|
|
39
|
+
language,
|
|
38
40
|
);
|
|
39
41
|
|
|
40
42
|
return (
|
|
@@ -31,6 +31,7 @@ export const ShareCredential: FunctionComponent<{
|
|
|
31
31
|
allCredentials: CredentialDetail[];
|
|
32
32
|
expanded?: boolean;
|
|
33
33
|
labels: ShareCredentialLabels;
|
|
34
|
+
language?: string;
|
|
34
35
|
lastItem?: boolean;
|
|
35
36
|
onHeaderPress?: (_credentialId?: string) => void;
|
|
36
37
|
onImagePreview: (title: string, image: ImageSourcePropType) => void;
|
|
@@ -45,6 +46,7 @@ export const ShareCredential: FunctionComponent<{
|
|
|
45
46
|
allCredentials,
|
|
46
47
|
expanded,
|
|
47
48
|
labels,
|
|
49
|
+
language,
|
|
48
50
|
lastItem,
|
|
49
51
|
onHeaderPress,
|
|
50
52
|
onImagePreview,
|
|
@@ -125,6 +127,7 @@ export const ShareCredential: FunctionComponent<{
|
|
|
125
127
|
config,
|
|
126
128
|
testID,
|
|
127
129
|
labels,
|
|
130
|
+
language,
|
|
128
131
|
);
|
|
129
132
|
|
|
130
133
|
return (
|
|
@@ -9,13 +9,14 @@ import { selectCredentialCardFromV2Credential } from '../../../utils/parsers/cre
|
|
|
9
9
|
export const SelectCredentialV2: FC<{
|
|
10
10
|
credential: PresentationDefinitionV2Credential;
|
|
11
11
|
labels: ShareCredentialCardLabels;
|
|
12
|
+
language?: string;
|
|
12
13
|
lastItem: boolean;
|
|
13
14
|
multiple: boolean;
|
|
14
15
|
onImagePreview: (title: string, image: ImageSourcePropType) => void;
|
|
15
16
|
onSelected?: (credentialId: CredentialListItem['id'], selected: boolean) => void;
|
|
16
17
|
selected: boolean;
|
|
17
18
|
testID: string;
|
|
18
|
-
}> = ({ credential, labels, lastItem, multiple, onImagePreview, onSelected, selected, testID }) => {
|
|
19
|
+
}> = ({ credential, labels, language, lastItem, multiple, onImagePreview, onSelected, selected, testID }) => {
|
|
19
20
|
const { data: config } = useCoreConfig();
|
|
20
21
|
const cardWidth = useMemo(() => Dimensions.get('window').width - 32, []);
|
|
21
22
|
|
|
@@ -34,6 +35,7 @@ export const SelectCredentialV2: FC<{
|
|
|
34
35
|
config,
|
|
35
36
|
testID,
|
|
36
37
|
labels,
|
|
38
|
+
language,
|
|
37
39
|
);
|
|
38
40
|
|
|
39
41
|
return (
|
|
@@ -33,6 +33,7 @@ export type ShareCredentialGroupLabels = ShareCredentialLabels & {
|
|
|
33
33
|
|
|
34
34
|
export type ShareCredentialV2GroupProps = {
|
|
35
35
|
labels: ShareCredentialGroupLabels;
|
|
36
|
+
language: string;
|
|
36
37
|
lastGroup: boolean;
|
|
37
38
|
onGroupSelect?: (selected: boolean) => void;
|
|
38
39
|
onImagePreview: (title: string, image: ImageSourcePropType) => void;
|
|
@@ -83,6 +84,7 @@ const heightForNumberOfCards = (numberOfCards: number) => 60 * (numberOfCards +
|
|
|
83
84
|
|
|
84
85
|
export const ShareCredentialV2Group: FC<ShareCredentialV2GroupProps> = ({
|
|
85
86
|
labels,
|
|
87
|
+
language,
|
|
86
88
|
lastGroup,
|
|
87
89
|
onGroupSelect,
|
|
88
90
|
onImagePreview,
|
|
@@ -165,6 +167,7 @@ export const ShareCredentialV2Group: FC<ShareCredentialV2GroupProps> = ({
|
|
|
165
167
|
headerAccessory={headerAccessory}
|
|
166
168
|
key={credentialRequestId}
|
|
167
169
|
labels={labels}
|
|
170
|
+
language={language}
|
|
168
171
|
lastItem={lastItem}
|
|
169
172
|
onHeaderPress={singleCredentialGroup ? headerPressHandler : onNestedCardHeaderPress(cardId)}
|
|
170
173
|
onImagePreview={onImagePreview}
|
|
@@ -181,6 +184,7 @@ export const ShareCredentialV2Group: FC<ShareCredentialV2GroupProps> = ({
|
|
|
181
184
|
}, [
|
|
182
185
|
expandedCredential,
|
|
183
186
|
labels,
|
|
187
|
+
language,
|
|
184
188
|
lastGroup,
|
|
185
189
|
headerPressHandler,
|
|
186
190
|
onImagePreview,
|
|
@@ -20,6 +20,7 @@ export type ShareCredentialV2Props = {
|
|
|
20
20
|
grouped?: boolean;
|
|
21
21
|
headerAccessory?: React.ComponentType<any> | React.ReactElement;
|
|
22
22
|
labels: ShareCredentialLabels;
|
|
23
|
+
language: string;
|
|
23
24
|
lastItem?: boolean;
|
|
24
25
|
onHeaderPress?: (_credentialId?: string) => void;
|
|
25
26
|
onImagePreview: (title: string, image: ImageSourcePropType) => void;
|
|
@@ -44,6 +45,7 @@ export const ShareCredentialV2: FunctionComponent<ShareCredentialV2Props> = ({
|
|
|
44
45
|
grouped,
|
|
45
46
|
headerAccessory,
|
|
46
47
|
labels,
|
|
48
|
+
language,
|
|
47
49
|
lastItem,
|
|
48
50
|
onHeaderPress,
|
|
49
51
|
onImagePreview,
|
|
@@ -64,6 +66,7 @@ export const ShareCredentialV2: FunctionComponent<ShareCredentialV2Props> = ({
|
|
|
64
66
|
() => Dimensions.get('window').width - 32 - (grouped ? GroupedShareCredentialV2Padding * 2 : 0),
|
|
65
67
|
[grouped],
|
|
66
68
|
);
|
|
69
|
+
const purpose = credentialQuery.type_ === 'APPLICABLE_CREDENTIALS' ? credentialQuery.purpose?.[language] : undefined;
|
|
67
70
|
|
|
68
71
|
const multipleCredentialsAvailable = Boolean(applicableCredentials?.length && applicableCredentials.length > 1);
|
|
69
72
|
|
|
@@ -152,10 +155,12 @@ export const ShareCredentialV2: FunctionComponent<ShareCredentialV2Props> = ({
|
|
|
152
155
|
failureHint,
|
|
153
156
|
Boolean(expanded),
|
|
154
157
|
multipleCredentialsAvailable,
|
|
158
|
+
purpose,
|
|
155
159
|
selectedFields,
|
|
156
160
|
config,
|
|
157
161
|
testID,
|
|
158
162
|
labels,
|
|
163
|
+
language,
|
|
159
164
|
);
|
|
160
165
|
|
|
161
166
|
if (headerAccessory) {
|
|
@@ -48,6 +48,7 @@ const CredentialDetailsCard: FC<CredentialDetailsCardProps> = ({
|
|
|
48
48
|
|
|
49
49
|
const cardHeight = Math.ceil(card.width / CredentialCardRatio);
|
|
50
50
|
const currentHeight = useSharedValue<number | undefined>(undefined);
|
|
51
|
+
const [animatedHeightSet, setAnimatedHeightSet] = useState(false);
|
|
51
52
|
|
|
52
53
|
const previewAttributes = attributes ? attributes.slice(0, PREVIEW_ATTRIBUTES_COUNT) : [];
|
|
53
54
|
const extraAttributes = useMemo(() => (attributes ? attributes.slice(PREVIEW_ATTRIBUTES_COUNT) : []), [attributes]);
|
|
@@ -76,6 +77,7 @@ const CredentialDetailsCard: FC<CredentialDetailsCardProps> = ({
|
|
|
76
77
|
const additionalHeight = allAttributesRendered ? additionalAttributesHeight : buttonViewHeight;
|
|
77
78
|
const fullHeight = previewAttributesHeight + additionalHeight;
|
|
78
79
|
|
|
80
|
+
setAnimatedHeightSet(true);
|
|
79
81
|
if (!animate) {
|
|
80
82
|
currentHeight.value = fullHeight;
|
|
81
83
|
return;
|
|
@@ -139,8 +141,7 @@ const CredentialDetailsCard: FC<CredentialDetailsCardProps> = ({
|
|
|
139
141
|
|
|
140
142
|
const { header, ...cardProps } = card;
|
|
141
143
|
|
|
142
|
-
const renderExtraAttributes =
|
|
143
|
-
allAttributesRendered || (previewAttributesHeight !== undefined && currentHeight.value !== undefined);
|
|
144
|
+
const renderExtraAttributes = allAttributesRendered || (previewAttributesHeight !== undefined && animatedHeightSet);
|
|
144
145
|
|
|
145
146
|
const ContainerComponent = animate ? Animated.View : View;
|
|
146
147
|
return (
|
|
@@ -53,13 +53,15 @@ const FoldableSearchHeader: FunctionComponent<FoldableHeaderProps> = ({
|
|
|
53
53
|
|
|
54
54
|
const scrollHeaderAnimatedStyle: Animated.WithAnimatedObject<ViewStyle> | undefined = playHeaderFoldAnimation
|
|
55
55
|
? {
|
|
56
|
-
transform: [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
transform: [
|
|
57
|
+
{
|
|
58
|
+
translateY: scrollOffset.interpolate({
|
|
59
|
+
extrapolate: 'clamp',
|
|
60
|
+
inputRange: [0, headerHeight],
|
|
61
|
+
outputRange: [0, -headerHeight],
|
|
62
|
+
}),
|
|
63
|
+
},
|
|
64
|
+
],
|
|
63
65
|
}
|
|
64
66
|
: undefined;
|
|
65
67
|
|
|
@@ -84,8 +86,7 @@ const FoldableSearchHeader: FunctionComponent<FoldableHeaderProps> = ({
|
|
|
84
86
|
<Animated.View
|
|
85
87
|
style={[styles.headerContainer, containerPaddingStyle, withNotice ? styles.noticeBorderRadius : undefined]}>
|
|
86
88
|
<Animated.View style={scrollHeaderAnimatedStyle}>
|
|
87
|
-
<View
|
|
88
|
-
style={[styles.blurFill, { top: -containerPaddingTop }]}>
|
|
89
|
+
<View style={[styles.blurFill, { top: -containerPaddingTop }]}>
|
|
89
90
|
<BlurView
|
|
90
91
|
blurStyle={'header'}
|
|
91
92
|
color={colorScheme.background}
|
|
@@ -23,7 +23,16 @@ const backButtonHitSlop: Insets = { top: 12, bottom: 12, left: 20, right: 20 };
|
|
|
23
23
|
* Following the design: https://www.figma.com/file/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?node-id=425-18624
|
|
24
24
|
* states (Default + Dashboard)
|
|
25
25
|
*/
|
|
26
|
-
const Header: FC<HeaderProps> = ({
|
|
26
|
+
const Header: FC<HeaderProps> = ({
|
|
27
|
+
backIcon,
|
|
28
|
+
onBack,
|
|
29
|
+
rightButtons,
|
|
30
|
+
style,
|
|
31
|
+
titleRowStyle,
|
|
32
|
+
testID,
|
|
33
|
+
title,
|
|
34
|
+
...viewProps
|
|
35
|
+
}) => {
|
|
27
36
|
const colorScheme = useAppColorScheme();
|
|
28
37
|
|
|
29
38
|
return (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ComponentType, FC, ReactElement, useEffect, useMemo } from 'react';
|
|
2
2
|
import { ColorValue, Dimensions, ImageSourcePropType, StyleSheet, View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { CredentialDetails, CredentialDetailsProps,
|
|
4
|
+
import { CredentialDetails, CredentialDetailsProps, TrustInfo, TrustInfoProps } from '../../components';
|
|
5
5
|
import { HeaderInfoButton } from '../../components/navigation/header-buttons';
|
|
6
6
|
import { CardLabels, concatTestID, useCredentialListExpandedCard } from '../../utils';
|
|
7
7
|
import { TouchableOpacity } from '../accessibility';
|
|
@@ -59,7 +59,7 @@ export type HistoryDetailsViewProps = {
|
|
|
59
59
|
data: {
|
|
60
60
|
header?:
|
|
61
61
|
| {
|
|
62
|
-
entity:
|
|
62
|
+
entity: TrustInfoProps;
|
|
63
63
|
}
|
|
64
64
|
| {
|
|
65
65
|
credentialHeader: CredentialHeaderProps;
|
|
@@ -141,9 +141,9 @@ export const HistoryDetailsView: FC<HistoryDetailsViewProps> = ({
|
|
|
141
141
|
testID={testID}>
|
|
142
142
|
<View style={[styles.section, { backgroundColor: colorScheme.white }]}>
|
|
143
143
|
{data.header && 'entity' in data.header && (
|
|
144
|
-
<
|
|
144
|
+
<TrustInfo
|
|
145
145
|
{...data.header.entity}
|
|
146
|
-
style={[styles.entity, {
|
|
146
|
+
style={[styles.entity, { borderBottomColor: colorScheme.background }, data.header.entity.style]}
|
|
147
147
|
/>
|
|
148
148
|
)}
|
|
149
149
|
{data.header && 'credentialHeader' in data.header && (
|
|
@@ -44,7 +44,7 @@ export const CredentialWarningIcon: FC<SvgProps> = ({ ...props }) => (
|
|
|
44
44
|
);
|
|
45
45
|
|
|
46
46
|
// https://www.figma.com/design/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?node-id=542-90920&m=dev
|
|
47
|
-
export const
|
|
47
|
+
export const CredentialNoticeInfoIcon: FC<SvgProps> = ({ ...props }) => {
|
|
48
48
|
const colorScheme = useAppColorScheme();
|
|
49
49
|
return (
|
|
50
50
|
<Svg width={24} height={24} viewBox="0 0 24 24" fill="none" {...props}>
|
|
@@ -252,3 +252,21 @@ export const NFCIcon: FC<SvgProps> = ({ color, ...props }) => {
|
|
|
252
252
|
</Svg>
|
|
253
253
|
);
|
|
254
254
|
};
|
|
255
|
+
|
|
256
|
+
// https://www.figma.com/file/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?node-id=542-90920
|
|
257
|
+
export const PurposeInfoIcon: FC<SvgProps> = () => {
|
|
258
|
+
const colorScheme = useAppColorScheme();
|
|
259
|
+
return (
|
|
260
|
+
<Svg fill="none" height={24} viewBox="0 0 24 24" width={24}>
|
|
261
|
+
<Path
|
|
262
|
+
d="M12.3609 10.7319C12.4714 10.7319 12.5609 10.8215 12.5609 10.9319V15.8C12.5609 15.9105 12.4714 16 12.3609 16H11.7C11.5895 16 11.5 15.9105 11.5 15.8V10.9319C11.5 10.8215 11.5895 10.7319 11.7 10.7319H12.3609ZM11.5 8.2C11.5 8.08954 11.5895 8 11.7 8L12.3609 8C12.4714 8 12.5609 8.08954 12.5609 8.2L12.5609 8.89863C12.5609 9.00909 12.4714 9.09863 12.3609 9.09863H11.7C11.5895 9.09863 11.5 9.00909 11.5 8.89863L11.5 8.2Z"
|
|
263
|
+
fill={colorScheme.text}
|
|
264
|
+
/>
|
|
265
|
+
<Path
|
|
266
|
+
d="M12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z"
|
|
267
|
+
fill={colorScheme.text}
|
|
268
|
+
fillRule="evenodd"
|
|
269
|
+
/>
|
|
270
|
+
</Svg>
|
|
271
|
+
);
|
|
272
|
+
};
|
|
@@ -2,6 +2,7 @@ import React, { FC } from 'react';
|
|
|
2
2
|
import { Platform, StyleSheet, View, ViewProps, ViewStyle } from 'react-native';
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
|
|
5
|
+
import { concatTestID } from '../../utils';
|
|
5
6
|
import { Button, ButtonProps } from '../buttons/button';
|
|
6
7
|
import ShareButton, { ShareButtonProps } from '../buttons/share-button';
|
|
7
8
|
import NavigationHeader, { NavigationHeaderProps } from '../header/navigation-header';
|
|
@@ -53,7 +54,12 @@ const LoadingResultScreen: FC<LoadingResultScreenProps> = ({
|
|
|
53
54
|
</View>
|
|
54
55
|
<View style={styles.loaderWrapper}>
|
|
55
56
|
<LoaderView {...loaderProps} />
|
|
56
|
-
<Typography
|
|
57
|
+
<Typography
|
|
58
|
+
testID={concatTestID(viewProps.testID, 'label')}
|
|
59
|
+
align="center"
|
|
60
|
+
color={colorScheme.text}
|
|
61
|
+
preset="regular"
|
|
62
|
+
style={styles.label}>
|
|
57
63
|
{label}
|
|
58
64
|
</Typography>
|
|
59
65
|
</View>
|
|
@@ -5,7 +5,6 @@ import Animated, { useAnimatedScrollHandler, useSharedValue } from 'react-native
|
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
6
|
|
|
7
7
|
import { TrustInfo, TrustInfoLabels } from '../../components';
|
|
8
|
-
import EntityDetailsWithButtons, { ContextRole } from '../../components/entity/entity-details-with-buttons';
|
|
9
8
|
import ContrastingStatusBar from '../../utils/contrasting-status-bar';
|
|
10
9
|
import { concatTestID } from '../../utils/testID';
|
|
11
10
|
import { TouchableOpacity } from '../accessibility/accessibilityHistoryWrappers';
|
|
@@ -16,15 +15,6 @@ import NerdModeItem, { NerdModeItemProps } from '../nerd-view/nerd-mode-item';
|
|
|
16
15
|
import Typography from '../text/typography';
|
|
17
16
|
import { useAppColorScheme } from '../theme/color-scheme-context';
|
|
18
17
|
|
|
19
|
-
export interface EntityLabels {
|
|
20
|
-
trusted: string;
|
|
21
|
-
unknownIssuer: string;
|
|
22
|
-
unknownVerifier: string;
|
|
23
|
-
visitWebsite: string;
|
|
24
|
-
termsAndServices: string;
|
|
25
|
-
privacyPolicy: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
18
|
export interface AttributesLabels {
|
|
29
19
|
trustRegistry: string;
|
|
30
20
|
issuerIdentifier: string;
|
|
@@ -37,9 +27,6 @@ export interface AttributesLabels {
|
|
|
37
27
|
interface SectionEntityCluster {
|
|
38
28
|
identifier?: IdentifierListItem;
|
|
39
29
|
subline?: string;
|
|
40
|
-
entityLabels: EntityLabels;
|
|
41
|
-
legacyTrustManagementEnabled: boolean;
|
|
42
|
-
role: ContextRole;
|
|
43
30
|
testID?: string;
|
|
44
31
|
trustInfoLabels: TrustInfoLabels;
|
|
45
32
|
trustInformation?: TrustInformationDetail;
|
|
@@ -115,25 +102,6 @@ const NerdModeScreen: FunctionComponent<NerdModeScreenProps> = ({
|
|
|
115
102
|
if (!entityCluster) {
|
|
116
103
|
return null;
|
|
117
104
|
}
|
|
118
|
-
if (entityCluster.legacyTrustManagementEnabled) {
|
|
119
|
-
return (
|
|
120
|
-
<EntityDetailsWithButtons
|
|
121
|
-
{...entityCluster}
|
|
122
|
-
entityType={EntityType.ProofEntity}
|
|
123
|
-
entityLabels={entityCluster.entityLabels}
|
|
124
|
-
attributesLabels={labels}
|
|
125
|
-
style={[
|
|
126
|
-
styles.entityCluster,
|
|
127
|
-
{
|
|
128
|
-
backgroundColor: colorScheme.nerdView.background,
|
|
129
|
-
},
|
|
130
|
-
]}
|
|
131
|
-
onCopyToClipboard={onCopyToClipboard}
|
|
132
|
-
testID={entityCluster.testID ?? concatTestID(testID, 'entityCluster')}
|
|
133
|
-
textColor={colorScheme.white}
|
|
134
|
-
/>
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
105
|
return (
|
|
138
106
|
<TrustInfo
|
|
139
107
|
labels={entityCluster.trustInfoLabels}
|
|
@@ -157,8 +125,6 @@ const NerdModeScreen: FunctionComponent<NerdModeScreenProps> = ({
|
|
|
157
125
|
entityCluster,
|
|
158
126
|
colorScheme.nerdView.background,
|
|
159
127
|
colorScheme.white,
|
|
160
|
-
labels,
|
|
161
|
-
onCopyToClipboard,
|
|
162
128
|
onOpenTrustInfoDetails,
|
|
163
129
|
testID,
|
|
164
130
|
]);
|
|
@@ -182,25 +148,9 @@ const NerdModeScreen: FunctionComponent<NerdModeScreenProps> = ({
|
|
|
182
148
|
<AnimatedSectionList
|
|
183
149
|
ListHeaderComponent={listHeader}
|
|
184
150
|
onScroll={onScroll}
|
|
185
|
-
renderItem={({ item, section
|
|
151
|
+
renderItem={({ item, section }) => {
|
|
186
152
|
if (isSectionEntityCluster(item)) {
|
|
187
|
-
return
|
|
188
|
-
<EntityDetailsWithButtons
|
|
189
|
-
{...item}
|
|
190
|
-
entityType={EntityType.CredentialEntity}
|
|
191
|
-
entityLabels={item!.entityLabels}
|
|
192
|
-
attributesLabels={labels}
|
|
193
|
-
style={[
|
|
194
|
-
styles.entityCluster,
|
|
195
|
-
{
|
|
196
|
-
backgroundColor: colorScheme.nerdView.background,
|
|
197
|
-
},
|
|
198
|
-
]}
|
|
199
|
-
onCopyToClipboard={onCopyToClipboard}
|
|
200
|
-
testID={item.testID ?? concatTestID(testID, 'sectionEntityCluster', index.toString())}
|
|
201
|
-
textColor={colorScheme.white}
|
|
202
|
-
/>
|
|
203
|
-
) : (
|
|
153
|
+
return (
|
|
204
154
|
<TrustInfo
|
|
205
155
|
labels={item.trustInfoLabels}
|
|
206
156
|
onPress={
|
package/src/utils/date.ts
CHANGED
|
@@ -7,10 +7,11 @@ const MINUTE = 60 * 1000;
|
|
|
7
7
|
const DAY = 24 * 60 * MINUTE;
|
|
8
8
|
|
|
9
9
|
// OS locale
|
|
10
|
-
const systemLocale: string | undefined =
|
|
11
|
-
.
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const systemLocale: string | undefined = (
|
|
11
|
+
Platform.OS === 'ios' ? Settings.get('AppleLocale') : I18nManager.getConstants().localeIdentifier
|
|
12
|
+
)
|
|
13
|
+
?.match(/[a-zA-Z]+_[a-zA-Z]+/)[0]
|
|
14
|
+
?.replaceAll('_', '-');
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Date only format
|
|
@@ -136,18 +137,10 @@ export const formatDateOnlyFromUTCTimestamp = (utcTimestamp: number): string =>
|
|
|
136
137
|
);
|
|
137
138
|
};
|
|
138
139
|
|
|
139
|
-
const locale = (
|
|
140
|
-
Platform.OS === 'ios'
|
|
141
|
-
? Settings.get('AppleLocale')
|
|
142
|
-
: I18nManager.getConstants().localeIdentifier
|
|
143
|
-
)
|
|
144
|
-
?.split('@')[0]
|
|
145
|
-
.replace('_', '-');
|
|
146
|
-
|
|
147
140
|
export const formatDateTimeLocalized = (date: Date) => {
|
|
148
|
-
return formatDateTime(date,
|
|
141
|
+
return formatDateTime(date, systemLocale);
|
|
149
142
|
};
|
|
150
143
|
|
|
151
144
|
export const formatDateLocalized = (date: Date) => {
|
|
152
|
-
return formatDate(date,
|
|
145
|
+
return formatDate(date, systemLocale);
|
|
153
146
|
};
|
|
@@ -3,10 +3,15 @@ import { useMutation, useQueryClient } from 'react-query';
|
|
|
3
3
|
|
|
4
4
|
import { useONECore } from './core-context';
|
|
5
5
|
import { CREDENTIAL_DETAIL_QUERY_KEY, CREDENTIAL_LIST_PAGED_QUERY_KEY, CREDENTIAL_LIST_QUERY_KEY } from './credentials';
|
|
6
|
-
import {
|
|
6
|
+
import { VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY } from './verifier-instance';
|
|
7
|
+
import { WALLET_UNIT_QUERY_KEY, WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY } from './wallet-unit';
|
|
7
8
|
|
|
8
9
|
const CREDENTIAL_QUERY_KEYS = [CREDENTIAL_LIST_QUERY_KEY, CREDENTIAL_LIST_PAGED_QUERY_KEY, CREDENTIAL_DETAIL_QUERY_KEY];
|
|
9
|
-
const
|
|
10
|
+
const WALLET_VERIFIER_INSTANCE_QUERY_KEYS = [
|
|
11
|
+
WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY,
|
|
12
|
+
WALLET_UNIT_QUERY_KEY,
|
|
13
|
+
VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY,
|
|
14
|
+
];
|
|
10
15
|
|
|
11
16
|
// Map each CacheType to the query keys that should be invalidated when that cache is cleared.
|
|
12
17
|
const cacheTypeToQueryKeys: Record<CacheType, string[]> = {
|
|
@@ -15,11 +20,13 @@ const cacheTypeToQueryKeys: Record<CacheType, string[]> = {
|
|
|
15
20
|
[CacheType.STATUS_LIST_CREDENTIAL]: CREDENTIAL_QUERY_KEYS,
|
|
16
21
|
[CacheType.VCT_METADATA]: CREDENTIAL_QUERY_KEYS,
|
|
17
22
|
[CacheType.JSON_SCHEMA]: CREDENTIAL_QUERY_KEYS,
|
|
18
|
-
[CacheType.TRUST_LIST]:
|
|
23
|
+
[CacheType.TRUST_LIST]: CREDENTIAL_QUERY_KEYS,
|
|
19
24
|
[CacheType.X509_CRL]: CREDENTIAL_QUERY_KEYS,
|
|
20
25
|
[CacheType.ANDROID_ATTESTATION_CRL]: CREDENTIAL_QUERY_KEYS,
|
|
21
26
|
[CacheType.OPEN_ID_METADATA_HOLDER]: CREDENTIAL_QUERY_KEYS,
|
|
22
27
|
[CacheType.OPEN_ID_METADATA_ISSUER]: CREDENTIAL_QUERY_KEYS,
|
|
28
|
+
[CacheType.WALLET_PROVIDER_METADATA]: WALLET_VERIFIER_INSTANCE_QUERY_KEYS,
|
|
29
|
+
[CacheType.REMOTE_TRUST_COLLECTION]: WALLET_VERIFIER_INSTANCE_QUERY_KEYS,
|
|
23
30
|
};
|
|
24
31
|
|
|
25
32
|
export const useCacheClear = () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigEntities,CoreConfig } from '@procivis/react-native-one-core';
|
|
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';
|
|
@@ -25,8 +25,3 @@ export const getEnabledExchangeProtocols = (exchangeProtocol: ConfigEntities<any
|
|
|
25
25
|
.map((exchange) => exchange.type);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
export const getEnabledTrustManagement = (config: CoreConfig): string[] => {
|
|
29
|
-
return Object.values(config?.trustManagement ?? {})
|
|
30
|
-
.filter((t) => t.enabled !== false)
|
|
31
|
-
.map((trustManagement) => trustManagement.type);
|
|
32
|
-
};
|
|
@@ -11,8 +11,6 @@ import React, {
|
|
|
11
11
|
} from 'react';
|
|
12
12
|
|
|
13
13
|
import { reportException } from '../../reporting';
|
|
14
|
-
import { getEnabledTrustManagement } from './core-config';
|
|
15
|
-
import { TrustManagementEnum, useCreateTrustAnchor } from './trust-entity';
|
|
16
14
|
|
|
17
15
|
interface ContextValue {
|
|
18
16
|
core: ONECore;
|
|
@@ -29,7 +27,6 @@ const defaultContextValue: ContextValue = {
|
|
|
29
27
|
export type ONECoreContextProviderProps = {
|
|
30
28
|
config?: Record<string, unknown>;
|
|
31
29
|
organisationId?: string;
|
|
32
|
-
publisherReference?: string;
|
|
33
30
|
};
|
|
34
31
|
|
|
35
32
|
const ONECoreContext = createContext<ContextValue>(defaultContextValue);
|
|
@@ -37,11 +34,9 @@ const ONECoreContext = createContext<ContextValue>(defaultContextValue);
|
|
|
37
34
|
export const ONECoreContextProvider: FC<PropsWithChildren<ONECoreContextProviderProps>> = ({
|
|
38
35
|
children,
|
|
39
36
|
organisationId = defaultContextValue.organisationId,
|
|
40
|
-
publisherReference,
|
|
41
37
|
config,
|
|
42
38
|
}) => {
|
|
43
39
|
const [core, setCore] = useState<ONECore>();
|
|
44
|
-
const createTrustAnchor = useCreateTrustAnchor();
|
|
45
40
|
|
|
46
41
|
const initialize = useCallback(
|
|
47
42
|
async (force?: boolean) => {
|
|
@@ -76,25 +71,6 @@ export const ONECoreContextProvider: FC<PropsWithChildren<ONECoreContextProvider
|
|
|
76
71
|
[],
|
|
77
72
|
);
|
|
78
73
|
|
|
79
|
-
useEffect(() => {
|
|
80
|
-
if (!core || !publisherReference) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
core
|
|
85
|
-
.getConfig()
|
|
86
|
-
.then((coreConfig) => {
|
|
87
|
-
const trustManagementEnabled = getEnabledTrustManagement(coreConfig).includes(
|
|
88
|
-
TrustManagementEnum.SimpleTrustList,
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
if (trustManagementEnabled) {
|
|
92
|
-
createTrustAnchor(core, publisherReference).catch(() => {});
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
.catch(() => {});
|
|
96
|
-
}, [core, createTrustAnchor, publisherReference]);
|
|
97
|
-
|
|
98
74
|
const contextValue = useMemo(
|
|
99
75
|
() => ({
|
|
100
76
|
core: core ?? defaultContextValue.core,
|
|
@@ -170,6 +170,19 @@ export const useCredentialDelete = () => {
|
|
|
170
170
|
});
|
|
171
171
|
};
|
|
172
172
|
|
|
173
|
+
export const useCredentialRefresh = () => {
|
|
174
|
+
const queryClient = useQueryClient();
|
|
175
|
+
const { core } = useONECore();
|
|
176
|
+
|
|
177
|
+
return useMutation(async (interactionId: string) => core.holderRefreshCredential(interactionId), {
|
|
178
|
+
onSuccess: async () => {
|
|
179
|
+
await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);
|
|
180
|
+
await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);
|
|
181
|
+
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
|
|
173
186
|
export const useInvalidateCredentialDetails = () => {
|
|
174
187
|
const queryClient = useQueryClient();
|
|
175
188
|
|
|
@@ -11,7 +11,6 @@ export * from './identifiers';
|
|
|
11
11
|
export * from './proof-schemas';
|
|
12
12
|
export * from './proofs';
|
|
13
13
|
export * from './query';
|
|
14
|
-
export * from './trust-entity';
|
|
15
14
|
export * from './trust-list';
|
|
16
15
|
export * from './verifier-instance';
|
|
17
16
|
export * from './wallet-unit';
|