@procivis/one-react-native-components 0.3.106 → 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 +10 -7
- 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 +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.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/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/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 +11 -11
- 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 +3 -3
- package/lib/commonjs/utils/parsers/credential-images.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
- 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 +11 -8
- 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 +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.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/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/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 +12 -12
- 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 +4 -4
- package/lib/module/utils/parsers/credential-images.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
- 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/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 +9 -9
- 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 +14 -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 +11 -13
- 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/history/history-section-header.tsx +1 -1
- package/src/ui-components/history/history-section-list-item.tsx +1 -1
- 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 +33 -34
- 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 +6 -10
- package/src/utils/parsers/credential-sharing-v2.tsx +20 -22
- package/src/utils/parsers/credential-sharing.tsx +28 -28
- package/src/utils/parsers/credential.ts +43 -43
- package/src/utils/parsers/query.ts +14 -16
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
HistoryActionBindingEnum,
|
|
3
|
-
HistoryEntityTypeBindingEnum,
|
|
4
|
-
HistoryListItemBindingDto,
|
|
5
|
-
} from '@procivis/react-native-one-core';
|
|
1
|
+
import { HistoryAction, HistoryEntityType, HistoryListItem } from '@procivis/react-native-one-core';
|
|
6
2
|
import React, { FC, useMemo } from 'react';
|
|
7
3
|
import { SvgProps } from 'react-native-svg';
|
|
8
4
|
|
|
@@ -30,8 +26,8 @@ import {
|
|
|
30
26
|
} from '../../ui-components';
|
|
31
27
|
|
|
32
28
|
const defaultIcons: {
|
|
33
|
-
actions: { [key in keyof typeof
|
|
34
|
-
entityTypes: { [key in keyof typeof
|
|
29
|
+
actions: { [key in keyof typeof HistoryAction]: FC<SvgProps> };
|
|
30
|
+
entityTypes: { [key in keyof typeof HistoryEntityType]: FC<SvgProps> };
|
|
35
31
|
} = {
|
|
36
32
|
actions: {
|
|
37
33
|
ACCEPTED: HistoryStatusAcceptedIcon,
|
|
@@ -88,36 +84,39 @@ const defaultIcons: {
|
|
|
88
84
|
STS_SESSION: HistoryIdentifierIcon,
|
|
89
85
|
NOTIFICATION: HistoryCredentialIcon,
|
|
90
86
|
SUPERVISORY_AUTHORITY: HistoryCertificateIcon,
|
|
87
|
+
TRUST_LIST_PUBLICATION: HistoryTrustAnchorIcon,
|
|
88
|
+
TRUST_COLLECTION: HistoryTrustAnchorIcon,
|
|
89
|
+
TRUST_LIST_SUBSCRIPTION: HistoryTrustAnchorIcon,
|
|
91
90
|
},
|
|
92
91
|
};
|
|
93
92
|
|
|
94
|
-
export const getHistoryItemActionIcon = (action:
|
|
93
|
+
export const getHistoryItemActionIcon = (action: HistoryAction) => {
|
|
95
94
|
return defaultIcons.actions[action] ?? HistoryStatusAcceptedIcon;
|
|
96
95
|
};
|
|
97
96
|
|
|
98
97
|
export type HistoryListItemIconProps = {
|
|
99
|
-
item:
|
|
98
|
+
item: HistoryListItem;
|
|
100
99
|
};
|
|
101
100
|
|
|
102
101
|
export const HistoryListItemIcon: FC<HistoryListItemIconProps> = ({ item }) => {
|
|
103
102
|
const statusIcon = getHistoryItemActionIcon(item.action);
|
|
104
103
|
const typeIcon = useMemo(() => {
|
|
105
104
|
switch (item.entityType) {
|
|
106
|
-
case
|
|
105
|
+
case HistoryEntityType.BACKUP:
|
|
107
106
|
switch (item.action) {
|
|
108
|
-
case
|
|
107
|
+
case HistoryAction.CREATED:
|
|
109
108
|
return HistoryBackupCreatedIcon;
|
|
110
|
-
case
|
|
109
|
+
case HistoryAction.RESTORED:
|
|
111
110
|
return HistoryBackupRestoredIcon;
|
|
112
111
|
default:
|
|
113
112
|
break;
|
|
114
113
|
}
|
|
115
114
|
break;
|
|
116
|
-
case
|
|
115
|
+
case HistoryEntityType.CREDENTIAL:
|
|
117
116
|
switch (item.action) {
|
|
118
|
-
case
|
|
117
|
+
case HistoryAction.REVOKED:
|
|
119
118
|
return HistoryRevokeIcon;
|
|
120
|
-
case
|
|
119
|
+
case HistoryAction.SUSPENDED:
|
|
121
120
|
return HistorySuspendIcon;
|
|
122
121
|
default:
|
|
123
122
|
break;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
HistoryActionBindingEnum,
|
|
3
|
-
HistoryEntityTypeBindingEnum,
|
|
4
|
-
HistoryListItemBindingDto,
|
|
5
|
-
} from '@procivis/react-native-one-core';
|
|
1
|
+
import { HistoryAction, HistoryEntityType, HistoryListItem } from '@procivis/react-native-one-core';
|
|
6
2
|
import React, { FC, useCallback, useMemo } from 'react';
|
|
7
3
|
|
|
8
4
|
import { HistoryItemView } from '../../ui-components';
|
|
@@ -10,18 +6,18 @@ import { formatTime, useTrustEntity } from '../../utils';
|
|
|
10
6
|
import { HistoryListItemIcon } from './history-list-item-icon';
|
|
11
7
|
|
|
12
8
|
export type HistoryListItemLabels = {
|
|
13
|
-
actions: { [key in keyof typeof
|
|
14
|
-
entityTypes: { [key in keyof typeof
|
|
9
|
+
actions: { [key in keyof typeof HistoryAction]: string };
|
|
10
|
+
entityTypes: { [key in keyof typeof HistoryEntityType]: string };
|
|
15
11
|
};
|
|
16
12
|
|
|
17
13
|
export interface HistoryListItemViewProps {
|
|
18
14
|
dateFormatter?: (date: Date) => string;
|
|
19
15
|
first?: boolean;
|
|
20
16
|
infoLabelMode?: 'entity' | 'associatedLabel' | 'none';
|
|
21
|
-
item:
|
|
17
|
+
item: HistoryListItem;
|
|
22
18
|
labels: HistoryListItemLabels;
|
|
23
19
|
last?: boolean;
|
|
24
|
-
onPress?: (item:
|
|
20
|
+
onPress?: (item: HistoryListItem) => void;
|
|
25
21
|
testID?: string;
|
|
26
22
|
}
|
|
27
23
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HistoryListItem, HistoryListQuery } from '@procivis/react-native-one-core';
|
|
2
2
|
import { debounce } from 'lodash';
|
|
3
3
|
import React, { FC, PropsWithChildren, useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import { Animated, StyleSheet, View } from 'react-native';
|
|
@@ -24,14 +24,14 @@ export type HistoryListScreenLabels = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export type HistoryListScreenProps = {
|
|
27
|
-
groupItems?: (entries:
|
|
27
|
+
groupItems?: (entries: HistoryListItem[]) => HistoryGroupByDaySection[];
|
|
28
28
|
itemInfoLabelMode?: HistoryListItemViewProps['infoLabelMode'];
|
|
29
29
|
labels: HistoryListScreenLabels;
|
|
30
30
|
onBackPressed: () => void;
|
|
31
|
-
onHistoryItemPressed: (historyItem:
|
|
31
|
+
onHistoryItemPressed: (historyItem: HistoryListItem) => void;
|
|
32
32
|
onOpenFilter?: () => void;
|
|
33
33
|
onSearchPhraseChange: (searchPhrase: string | undefined) => void;
|
|
34
|
-
queryParams: Partial<
|
|
34
|
+
queryParams: Partial<HistoryListQuery>;
|
|
35
35
|
testID?: string;
|
|
36
36
|
};
|
|
37
37
|
|
|
@@ -15,7 +15,7 @@ export type HistoryListSectionHeaderViewProps = {
|
|
|
15
15
|
testID?: string;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
// components used on the history section lists (Settings->History,
|
|
18
|
+
// components used on the history section lists (Settings->History, CredentialDetail->History)
|
|
19
19
|
// https://www.figma.com/file/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?type=design&node-id=1246-51813&mode=dev
|
|
20
20
|
|
|
21
21
|
export const HistoryListSectionHeaderView: FC<HistoryListSectionHeaderViewProps> = ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HistoryListItem, HistoryListQuery } from '@procivis/react-native-one-core';
|
|
2
2
|
import { useIsFocused } from '@react-navigation/native';
|
|
3
3
|
import React, { FC, useCallback, useMemo } from 'react';
|
|
4
4
|
import { Animated, SectionListProps, StyleSheet } from 'react-native';
|
|
@@ -16,15 +16,15 @@ export type HistoryListLabels = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export interface HistoryListViewProps
|
|
19
|
-
extends Omit<SectionListProps<
|
|
19
|
+
extends Omit<SectionListProps<HistoryListItem, HistoryGroupByDaySection>, 'sections'> {
|
|
20
20
|
// optional customization of item props
|
|
21
|
-
getItemProps?: (item:
|
|
22
|
-
groupItems?: (entries:
|
|
21
|
+
getItemProps?: (item: HistoryListItem) => Partial<HistoryListItemViewProps> | undefined;
|
|
22
|
+
groupItems?: (entries: HistoryListItem[]) => HistoryGroupByDaySection[];
|
|
23
23
|
itemProps?: Partial<HistoryListItemViewProps>;
|
|
24
24
|
labels: HistoryListLabels;
|
|
25
25
|
// callback when empty list displayed
|
|
26
26
|
onEmpty?: (empty: boolean) => void;
|
|
27
|
-
query: Partial<
|
|
27
|
+
query: Partial<HistoryListQuery>;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export const HistoryListView: FC<HistoryListViewProps> = ({
|
|
@@ -72,7 +72,7 @@ export const HistoryListView: FC<HistoryListViewProps> = ({
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
return (
|
|
75
|
-
<Animated.SectionList<
|
|
75
|
+
<Animated.SectionList<HistoryListItem, HistoryGroupByDaySection>
|
|
76
76
|
ListFooterComponent={
|
|
77
77
|
isLoading ? <ListPageLoadingIndicator color={colorScheme.accent} style={styles.footer} /> : undefined
|
|
78
78
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PresentationDefinitionRequestedCredential } from '@procivis/react-native-one-core';
|
|
2
2
|
import React, { FC, useMemo } from 'react';
|
|
3
3
|
import { Dimensions, ImageSourcePropType } from 'react-native';
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ export const SelectCredential: FC<{
|
|
|
16
16
|
lastItem: boolean;
|
|
17
17
|
onImagePreview: (title: string, image: ImageSourcePropType) => void;
|
|
18
18
|
onPress?: () => void;
|
|
19
|
-
request:
|
|
19
|
+
request: PresentationDefinitionRequestedCredential;
|
|
20
20
|
selected: boolean;
|
|
21
21
|
testID: string;
|
|
22
22
|
}> = ({ credentialId, labels, lastItem, onImagePreview, onPress, request, selected, testID }) => {
|
|
@@ -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
|
);
|
|
@@ -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
|
],
|
|
@@ -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 {
|
|
@@ -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);
|