@procivis/one-react-native-components 0.3.115 → 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 +3 -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 +11 -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/components/trust-info/index.js +29 -0
- package/lib/commonjs/components/trust-info/index.js.map +1 -0
- package/lib/commonjs/components/trust-info/trust-info.js +79 -0
- package/lib/commonjs/components/trust-info/trust-info.js.map +1 -0
- 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 +2 -0
- 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 +45 -0
- package/lib/commonjs/ui-components/icons/contact.js.map +1 -0
- 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/icons/index.js +11 -0
- package/lib/commonjs/ui-components/icons/index.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/index.js +7 -0
- package/lib/commonjs/ui-components/screens/index.js.map +1 -1
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js +28 -24
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/commonjs/ui-components/screens/trust-info-details-screen.js +384 -0
- package/lib/commonjs/ui-components/screens/trust-info-details-screen.js.map +1 -0
- 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 +8 -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 +40 -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/proofs.js +12 -1
- package/lib/commonjs/utils/hooks/core/proofs.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 +3 -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 +1 -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/components/trust-info/index.js +4 -0
- package/lib/module/components/trust-info/index.js.map +1 -0
- package/lib/module/components/trust-info/trust-info.js +70 -0
- package/lib/module/components/trust-info/trust-info.js.map +1 -0
- 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 +2 -0
- 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 +34 -0
- package/lib/module/ui-components/icons/contact.js.map +1 -0
- 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/icons/index.js +1 -0
- package/lib/module/ui-components/icons/index.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/index.js +2 -0
- package/lib/module/ui-components/screens/index.js.map +1 -1
- package/lib/module/ui-components/screens/nerd-mode-screen.js +29 -25
- package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/module/ui-components/screens/trust-info-details-screen.js +375 -0
- package/lib/module/ui-components/screens/trust-info-details-screen.js.map +1 -0
- 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 +8 -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 +37 -1
- 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/proofs.js +10 -0
- package/lib/module/utils/hooks/core/proofs.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 +1 -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/components/trust-info/index.d.ts +3 -0
- package/lib/typescript/components/trust-info/trust-info.d.ts +19 -0
- package/lib/typescript/ui-components/header/header.d.ts +2 -0
- package/lib/typescript/ui-components/history/history-details.d.ts +2 -2
- package/lib/typescript/ui-components/icons/contact.d.ts +4 -0
- 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/icons/index.d.ts +1 -0
- package/lib/typescript/ui-components/screens/index.d.ts +3 -0
- package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +5 -12
- package/lib/typescript/ui-components/screens/trust-info-details-screen.d.ts +32 -0
- 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 +5 -1
- package/lib/typescript/utils/hooks/core/index.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/proofs.d.ts +2 -0
- 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 +8 -8
- package/src/components/credential/credential.tsx +3 -0
- package/src/components/history/history-list-item-icon.tsx +2 -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 +1 -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/components/trust-info/index.ts +4 -0
- package/src/components/trust-info/trust-info.tsx +90 -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 +18 -3
- package/src/ui-components/history/history-details.tsx +4 -4
- package/src/ui-components/icons/contact.tsx +26 -0
- package/src/ui-components/icons/credential.tsx +1 -1
- package/src/ui-components/icons/icons.tsx +18 -0
- package/src/ui-components/icons/index.ts +1 -0
- package/src/ui-components/loader/loading-result.tsx +7 -1
- package/src/ui-components/screens/index.ts +3 -0
- package/src/ui-components/screens/nerd-mode-screen.tsx +49 -41
- package/src/ui-components/screens/trust-info-details-screen.tsx +472 -0
- package/src/utils/date.ts +7 -14
- package/src/utils/hooks/core/cache.ts +12 -4
- 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 +43 -1
- package/src/utils/hooks/core/index.ts +0 -1
- package/src/utils/hooks/core/proofs.ts +14 -0
- 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
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,10 +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
|
-
[CacheType.
|
|
26
|
+
[CacheType.OPEN_ID_METADATA_HOLDER]: CREDENTIAL_QUERY_KEYS,
|
|
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,
|
|
22
30
|
};
|
|
23
31
|
|
|
24
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,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
InitiateIssuanceRequest,
|
|
8
8
|
OneError,
|
|
9
9
|
} from '@procivis/react-native-one-core';
|
|
10
|
-
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from 'react-query';
|
|
10
|
+
import { useInfiniteQuery, useMutation, useQueries, useQuery, useQueryClient } from 'react-query';
|
|
11
11
|
|
|
12
12
|
import { getQueryKeyFromCredentialListQueryParams } from '../../parsers/query';
|
|
13
13
|
import { useONECore } from './core-context';
|
|
@@ -20,6 +20,7 @@ const PAGE_SIZE = 20;
|
|
|
20
20
|
export const CREDENTIAL_LIST_QUERY_KEY = 'credential-list';
|
|
21
21
|
export const CREDENTIAL_LIST_PAGED_QUERY_KEY = 'credential-list-paged';
|
|
22
22
|
export const CREDENTIAL_DETAIL_QUERY_KEY = 'credential-detail';
|
|
23
|
+
export const CREDENTIAL_TRUST_INFORMATION_QUERY_KEY = 'credential-trust-information';
|
|
23
24
|
|
|
24
25
|
export const useCredentials = (queryParams?: Partial<CredentialListQuery>) => {
|
|
25
26
|
const { core, organisationId } = useONECore();
|
|
@@ -169,6 +170,19 @@ export const useCredentialDelete = () => {
|
|
|
169
170
|
});
|
|
170
171
|
};
|
|
171
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
|
+
|
|
172
186
|
export const useInvalidateCredentialDetails = () => {
|
|
173
187
|
const queryClient = useQueryClient();
|
|
174
188
|
|
|
@@ -204,3 +218,31 @@ export const useContinueIssuance = () => {
|
|
|
204
218
|
},
|
|
205
219
|
});
|
|
206
220
|
};
|
|
221
|
+
|
|
222
|
+
export const useCredentialTrustInformation = (credentialId: string | undefined) => {
|
|
223
|
+
const { core } = useONECore();
|
|
224
|
+
|
|
225
|
+
return useQuery(
|
|
226
|
+
[CREDENTIAL_TRUST_INFORMATION_QUERY_KEY, credentialId],
|
|
227
|
+
() => (credentialId ? core.getCredentialTrustInformation(credentialId) : undefined),
|
|
228
|
+
{
|
|
229
|
+
enabled: Boolean(credentialId),
|
|
230
|
+
keepPreviousData: true,
|
|
231
|
+
},
|
|
232
|
+
);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export const useCredentialsTrustInformation = (credentialIds: string[]) => {
|
|
236
|
+
const { core } = useONECore();
|
|
237
|
+
|
|
238
|
+
return useQueries(
|
|
239
|
+
credentialIds.map((id) => ({
|
|
240
|
+
keepPreviousData: true,
|
|
241
|
+
meta: {
|
|
242
|
+
id,
|
|
243
|
+
},
|
|
244
|
+
queryFn: () => core.getCredentialTrustInformation(id),
|
|
245
|
+
queryKey: [CREDENTIAL_TRUST_INFORMATION_QUERY_KEY, id],
|
|
246
|
+
})),
|
|
247
|
+
);
|
|
248
|
+
};
|
|
@@ -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';
|
|
@@ -30,6 +30,7 @@ const PAGE_SIZE = 10;
|
|
|
30
30
|
export const PROOF_DETAIL_QUERY_KEY = 'proof-detail';
|
|
31
31
|
export const PROOF_STATE_QUERY_KEY = 'proof-state';
|
|
32
32
|
export const PROOF_LIST_QUERY_KEY = 'proof-list';
|
|
33
|
+
export const PROOF_REQUEST_TRUST_INFORMATION_QUERY_KEY = 'proof-request-trust-information';
|
|
33
34
|
|
|
34
35
|
export const useProofDetail = (proofId: string | undefined) => {
|
|
35
36
|
const { core } = useONECore();
|
|
@@ -464,3 +465,16 @@ export const useDeleteAllProofsData = (schemaId: string) => {
|
|
|
464
465
|
},
|
|
465
466
|
);
|
|
466
467
|
};
|
|
468
|
+
|
|
469
|
+
export const useProofRequestTrustInformation = (credentialId: string | undefined) => {
|
|
470
|
+
const { core } = useONECore();
|
|
471
|
+
|
|
472
|
+
return useQuery(
|
|
473
|
+
[PROOF_REQUEST_TRUST_INFORMATION_QUERY_KEY, credentialId],
|
|
474
|
+
() => (credentialId ? core.getProofTrustInformation(credentialId) : undefined),
|
|
475
|
+
{
|
|
476
|
+
enabled: Boolean(credentialId),
|
|
477
|
+
keepPreviousData: true,
|
|
478
|
+
},
|
|
479
|
+
);
|
|
480
|
+
};
|
|
@@ -1,29 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useMutation } from 'react-query';
|
|
1
|
+
import { useMutation, useQueryClient } from 'react-query';
|
|
3
2
|
|
|
4
3
|
import { reportException } from '../../reporting';
|
|
5
4
|
import { useONECore } from './core-context';
|
|
5
|
+
import { VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY } from './verifier-instance';
|
|
6
|
+
import { WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY } from './wallet-unit';
|
|
6
7
|
|
|
7
8
|
export const useTrustCollectionSync = () => {
|
|
9
|
+
const queryClient = useQueryClient();
|
|
8
10
|
const { core } = useONECore();
|
|
9
11
|
|
|
10
|
-
return useMutation(
|
|
11
|
-
async (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
reportException(err, 'TRUST_COLLECTION_SYNC error');
|
|
16
|
-
},
|
|
12
|
+
return useMutation(async () => core.runTask('TRUST_COLLECTION_SYNC', undefined), {
|
|
13
|
+
onError: async (err) => {
|
|
14
|
+
reportException(err, 'TRUST_COLLECTION_SYNC error');
|
|
15
|
+
await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
|
|
16
|
+
await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
|
|
17
17
|
},
|
|
18
|
-
|
|
18
|
+
onSuccess: async () => {
|
|
19
|
+
await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
|
|
20
|
+
await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
|
|
21
|
+
},
|
|
22
|
+
});
|
|
19
23
|
};
|
|
20
24
|
|
|
21
25
|
export const useTrustListSubscriptionUpdate = () => {
|
|
26
|
+
const queryClient = useQueryClient();
|
|
22
27
|
const { core } = useONECore();
|
|
23
28
|
|
|
24
29
|
return useMutation(async () => core.runTask('TRUST_LIST_SUBSCRIPTION_UPDATE', undefined), {
|
|
25
|
-
onError: (err) => {
|
|
30
|
+
onError: async (err) => {
|
|
26
31
|
reportException(err, 'TRUST_LIST_SUBSCRIPTION_UPDATE error');
|
|
32
|
+
await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
|
|
33
|
+
await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
|
|
34
|
+
},
|
|
35
|
+
onSuccess: async () => {
|
|
36
|
+
await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
|
|
37
|
+
await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
|
|
27
38
|
},
|
|
28
39
|
});
|
|
29
40
|
};
|
|
@@ -4,8 +4,22 @@ import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
|
4
4
|
import { reportException } from '../../reporting';
|
|
5
5
|
import { useONECore } from './core-context';
|
|
6
6
|
|
|
7
|
+
export const VERIFIER_INSTANCE_QUERY_KEY = 'verifier-instance';
|
|
7
8
|
export const VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY = 'verifier-instance-trust-collections';
|
|
8
9
|
|
|
10
|
+
export const useVerifierInstance = (active = true) => {
|
|
11
|
+
const { core, organisationId } = useONECore();
|
|
12
|
+
|
|
13
|
+
return useQuery(
|
|
14
|
+
[VERIFIER_INSTANCE_QUERY_KEY],
|
|
15
|
+
() => core.getOrganisation(organisationId).then((org) => org.verifierInstance),
|
|
16
|
+
{
|
|
17
|
+
enabled: active,
|
|
18
|
+
keepPreviousData: true,
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
9
23
|
export const useVerifierInstanceTrustCollections = (verifierInstanceId: string | undefined, active = true) => {
|
|
10
24
|
const { core } = useONECore();
|
|
11
25
|
|
|
@@ -31,7 +45,10 @@ export const useRegisterVerifierInstance = () => {
|
|
|
31
45
|
}),
|
|
32
46
|
|
|
33
47
|
{
|
|
34
|
-
onSuccess: () =>
|
|
48
|
+
onSuccess: async () => {
|
|
49
|
+
await queryClient.invalidateQueries(VERIFIER_INSTANCE_QUERY_KEY);
|
|
50
|
+
await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
|
|
51
|
+
},
|
|
35
52
|
},
|
|
36
53
|
);
|
|
37
54
|
};
|
|
@@ -46,9 +63,13 @@ export const useVerifierInstanceUpdate = () => {
|
|
|
46
63
|
{
|
|
47
64
|
onError: async (err) => {
|
|
48
65
|
reportException(err, 'Update verifier instance failure');
|
|
66
|
+
await queryClient.invalidateQueries(VERIFIER_INSTANCE_QUERY_KEY);
|
|
67
|
+
await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
|
|
68
|
+
},
|
|
69
|
+
onSuccess: async () => {
|
|
70
|
+
await queryClient.invalidateQueries(VERIFIER_INSTANCE_QUERY_KEY);
|
|
49
71
|
await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
|
|
50
72
|
},
|
|
51
|
-
onSuccess: () => queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY),
|
|
52
73
|
},
|
|
53
74
|
);
|
|
54
75
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
HolderRegisterWalletUnitRequest,
|
|
2
3
|
HolderWalletUnit,
|
|
3
4
|
HolderWalletUnitUpdateRequest,
|
|
4
|
-
WalletProvider,
|
|
5
5
|
WalletUnitStatus,
|
|
6
6
|
} from '@procivis/react-native-one-core';
|
|
7
7
|
import { useEffect } from 'react';
|
|
@@ -44,11 +44,11 @@ export const useRegisterWalletUnit = () => {
|
|
|
44
44
|
const { core, organisationId } = useONECore();
|
|
45
45
|
|
|
46
46
|
return useMutation(
|
|
47
|
-
async (
|
|
47
|
+
async (request: Omit<HolderRegisterWalletUnitRequest, 'organisationId' | 'keyType'>) =>
|
|
48
48
|
core.holderRegisterWalletUnit({
|
|
49
49
|
keyType: 'ECDSA',
|
|
50
50
|
organisationId,
|
|
51
|
-
|
|
51
|
+
...request,
|
|
52
52
|
}),
|
|
53
53
|
|
|
54
54
|
{
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
CredentialCardProps,
|
|
16
16
|
CredentialNoticeWarningIcon,
|
|
17
17
|
CredentialWarningIcon,
|
|
18
|
+
PurposeInfoIcon,
|
|
18
19
|
Selector,
|
|
19
20
|
SelectorStatus,
|
|
20
21
|
} from '../../ui-components';
|
|
@@ -72,6 +73,7 @@ export const shareCredentialCardAttributeFromV2Claim = (
|
|
|
72
73
|
parentUserSelected: boolean,
|
|
73
74
|
config: CoreConfig,
|
|
74
75
|
testID: string,
|
|
76
|
+
language: string | undefined,
|
|
75
77
|
nested?: boolean,
|
|
76
78
|
listValue?: boolean,
|
|
77
79
|
): CredentialAttribute => {
|
|
@@ -82,7 +84,7 @@ export const shareCredentialCardAttributeFromV2Claim = (
|
|
|
82
84
|
const status = selection
|
|
83
85
|
? getAttributeSelectorStatus(claim, attributeShared, parentUserSelected || (attributeShared && !userSelected))
|
|
84
86
|
: undefined;
|
|
85
|
-
const attribute = detailsCardAttributeFromClaim(v2PresentationClaimToClaim(claim), config, testID);
|
|
87
|
+
const attribute = detailsCardAttributeFromClaim(v2PresentationClaimToClaim(claim), config, testID, language);
|
|
86
88
|
const disabledStatus = [SelectorStatus.Disabled, SelectorStatus.Rejected, SelectorStatus.Required];
|
|
87
89
|
const disabled = attribute.disabled || !status || disabledStatus.includes(status);
|
|
88
90
|
const credentialAttribute: CredentialAttribute = {
|
|
@@ -111,6 +113,7 @@ export const shareCredentialCardAttributeFromV2Claim = (
|
|
|
111
113
|
userSelected,
|
|
112
114
|
config,
|
|
113
115
|
testID,
|
|
116
|
+
language,
|
|
114
117
|
true,
|
|
115
118
|
false,
|
|
116
119
|
),
|
|
@@ -120,7 +123,16 @@ export const shareCredentialCardAttributeFromV2Claim = (
|
|
|
120
123
|
return {
|
|
121
124
|
...credentialAttribute,
|
|
122
125
|
attributes: claim.value.value.map((v) =>
|
|
123
|
-
shareCredentialCardAttributeFromV2Claim(
|
|
126
|
+
shareCredentialCardAttributeFromV2Claim(
|
|
127
|
+
v,
|
|
128
|
+
selection,
|
|
129
|
+
attributeShared,
|
|
130
|
+
userSelected,
|
|
131
|
+
config,
|
|
132
|
+
testID,
|
|
133
|
+
language,
|
|
134
|
+
true,
|
|
135
|
+
),
|
|
124
136
|
),
|
|
125
137
|
image: undefined,
|
|
126
138
|
value: undefined,
|
|
@@ -158,22 +170,23 @@ export const shareCredentialCardFromV2PresentationCredential = (
|
|
|
158
170
|
failureHint: CredentialQueryFailureHint | undefined,
|
|
159
171
|
expanded: boolean,
|
|
160
172
|
multipleCredentialsAvailable: boolean,
|
|
173
|
+
purpose: string | undefined,
|
|
161
174
|
selectedFields: string[] | undefined,
|
|
162
175
|
config: CoreConfig,
|
|
163
176
|
testID: string,
|
|
164
177
|
labels: ShareCredentialCardLabels,
|
|
178
|
+
language: string | undefined,
|
|
165
179
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
166
180
|
const selectiveDisclosureSupported = supportsSelectiveDisclosure(
|
|
167
181
|
credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
|
|
168
182
|
config,
|
|
169
183
|
);
|
|
170
|
-
const notice: CredentialCardNotice | undefined =
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
: undefined;
|
|
184
|
+
const notice: CredentialCardNotice | undefined = purpose
|
|
185
|
+
? {
|
|
186
|
+
noticeIcon: PurposeInfoIcon,
|
|
187
|
+
text: purpose,
|
|
188
|
+
}
|
|
189
|
+
: undefined;
|
|
177
190
|
const cardTestId = concatTestID(testID, 'card');
|
|
178
191
|
const card = credential
|
|
179
192
|
? validityCheckedCardFromCredential(
|
|
@@ -182,18 +195,20 @@ export const shareCredentialCardFromV2PresentationCredential = (
|
|
|
182
195
|
claims: [],
|
|
183
196
|
},
|
|
184
197
|
expanded,
|
|
198
|
+
selectiveDisclosureSupported,
|
|
185
199
|
multipleCredentialsAvailable,
|
|
186
200
|
config,
|
|
187
201
|
notice,
|
|
188
202
|
cardTestId,
|
|
189
203
|
labels,
|
|
204
|
+
language,
|
|
190
205
|
)
|
|
191
206
|
: missingCredentialCardFromFailureHint(failureHint, notice, cardTestId, labels);
|
|
192
207
|
|
|
193
208
|
return {
|
|
194
209
|
attributes:
|
|
195
210
|
credential?.claims.map((v) =>
|
|
196
|
-
shareCredentialCardAttributeFromV2Claim(v, selectedFields ?? [], true, false, config, testID),
|
|
211
|
+
shareCredentialCardAttributeFromV2Claim(v, selectedFields ?? [], true, false, config, testID, language),
|
|
197
212
|
) ?? [],
|
|
198
213
|
card,
|
|
199
214
|
};
|
|
@@ -206,6 +221,7 @@ export const selectCredentialCardFromV2Credential = (
|
|
|
206
221
|
config: CoreConfig,
|
|
207
222
|
testID: string,
|
|
208
223
|
labels: ShareCredentialCardLabels,
|
|
224
|
+
language: string | undefined,
|
|
209
225
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
210
226
|
const selectiveDisclosureSupported = supportsSelectiveDisclosure(
|
|
211
227
|
credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
|
|
@@ -217,7 +233,7 @@ export const selectCredentialCardFromV2Credential = (
|
|
|
217
233
|
selectiveDisclosureSupported === false
|
|
218
234
|
? {
|
|
219
235
|
noticeIcon: CredentialNoticeWarningIcon,
|
|
220
|
-
text: labels.
|
|
236
|
+
text: labels.selectiveDisclosure,
|
|
221
237
|
}
|
|
222
238
|
: undefined;
|
|
223
239
|
const { header, ...cardProps } = getCredentialCardPropsFromCredential(
|
|
@@ -230,6 +246,7 @@ export const selectCredentialCardFromV2Credential = (
|
|
|
230
246
|
notice,
|
|
231
247
|
testID,
|
|
232
248
|
labels,
|
|
249
|
+
language,
|
|
233
250
|
);
|
|
234
251
|
const card = {
|
|
235
252
|
header: {
|
|
@@ -241,7 +258,7 @@ export const selectCredentialCardFromV2Credential = (
|
|
|
241
258
|
return {
|
|
242
259
|
attributes:
|
|
243
260
|
credential?.claims.map((v) =>
|
|
244
|
-
shareCredentialCardAttributeFromV2Claim(v, undefined, false, false, config, testID),
|
|
261
|
+
shareCredentialCardAttributeFromV2Claim(v, undefined, false, false, config, testID, language),
|
|
245
262
|
) ?? [],
|
|
246
263
|
card,
|
|
247
264
|
};
|
|
@@ -31,11 +31,13 @@ import {
|
|
|
31
31
|
export const validityCheckedCardFromCredential = (
|
|
32
32
|
credential: CredentialDetail,
|
|
33
33
|
expanded: boolean,
|
|
34
|
+
selectiveDisclosureSupported: boolean | undefined,
|
|
34
35
|
multipleCredentialsAvailable: boolean,
|
|
35
36
|
config: CoreConfig,
|
|
36
37
|
notice: CredentialCardNotice | undefined,
|
|
37
38
|
testID: string,
|
|
38
39
|
labels: ShareCredentialCardLabels,
|
|
40
|
+
language: string | undefined,
|
|
39
41
|
): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'testID' | 'width'> => {
|
|
40
42
|
let credentialHeaderDetail:
|
|
41
43
|
| Pick<
|
|
@@ -47,7 +49,13 @@ export const validityCheckedCardFromCredential = (
|
|
|
47
49
|
| 'statusIcon'
|
|
48
50
|
>
|
|
49
51
|
| undefined;
|
|
50
|
-
if (
|
|
52
|
+
if (selectiveDisclosureSupported === false) {
|
|
53
|
+
credentialHeaderDetail = {
|
|
54
|
+
credentialDetailPrimary: labels.selectiveDisclosure,
|
|
55
|
+
credentialDetailTestID: concatTestID(testID, 'header.nonSelectiveDisclosure'),
|
|
56
|
+
statusIcon: CredentialWarningIcon,
|
|
57
|
+
};
|
|
58
|
+
} else if (!expanded && multipleCredentialsAvailable) {
|
|
51
59
|
credentialHeaderDetail = {
|
|
52
60
|
credentialDetailPrimary: labels.multipleCredentials,
|
|
53
61
|
credentialDetailTestID: concatTestID(testID, 'header.multiple'),
|
|
@@ -55,7 +63,15 @@ export const validityCheckedCardFromCredential = (
|
|
|
55
63
|
};
|
|
56
64
|
}
|
|
57
65
|
|
|
58
|
-
const card = getCredentialCardPropsFromCredential(
|
|
66
|
+
const card = getCredentialCardPropsFromCredential(
|
|
67
|
+
credential,
|
|
68
|
+
credential.claims,
|
|
69
|
+
config,
|
|
70
|
+
notice,
|
|
71
|
+
testID,
|
|
72
|
+
labels,
|
|
73
|
+
language,
|
|
74
|
+
);
|
|
59
75
|
return {
|
|
60
76
|
...card,
|
|
61
77
|
header: {
|
|
@@ -188,12 +204,13 @@ export const shareCredentialCardAttributeFromClaim = (
|
|
|
188
204
|
config: CoreConfig,
|
|
189
205
|
testID: string,
|
|
190
206
|
labels: ShareCredentialCardLabels,
|
|
207
|
+
language: string | undefined,
|
|
191
208
|
claim?: FlatClaim,
|
|
192
209
|
field?: PresentationDefinitionField,
|
|
193
210
|
): CredentialAttribute => {
|
|
194
211
|
if (claim) {
|
|
195
212
|
return {
|
|
196
|
-
...detailsCardAttributeFromClaim(claim, config, testID),
|
|
213
|
+
...detailsCardAttributeFromClaim(claim, config, testID, language),
|
|
197
214
|
id,
|
|
198
215
|
path: claim.path,
|
|
199
216
|
listValue: claim.isArrayElement,
|
|
@@ -243,7 +260,7 @@ const setStatusForNestedObjectOrArrayFields = (
|
|
|
243
260
|
};
|
|
244
261
|
|
|
245
262
|
export type ShareCredentialCardLabels = CardLabels & {
|
|
246
|
-
|
|
263
|
+
selectiveDisclosure: string;
|
|
247
264
|
missingAttribute: string;
|
|
248
265
|
missingCredential: string;
|
|
249
266
|
multipleCredentials: string;
|
|
@@ -258,30 +275,26 @@ export const shareCredentialCardFromCredential = (
|
|
|
258
275
|
config: CoreConfig,
|
|
259
276
|
testID: string,
|
|
260
277
|
labels: ShareCredentialCardLabels,
|
|
278
|
+
language: string | undefined,
|
|
261
279
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
262
280
|
const selectiveDisclosureSupported = supportsSelectiveDisclosure(
|
|
263
281
|
credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
|
|
264
282
|
config,
|
|
265
283
|
);
|
|
266
|
-
const notice: CredentialCardNotice | undefined =
|
|
267
|
-
selectiveDisclosureSupported === false
|
|
268
|
-
? {
|
|
269
|
-
text: labels.selectiveDisclosureNotice,
|
|
270
|
-
noticeIcon: CredentialNoticeWarningIcon,
|
|
271
|
-
}
|
|
272
|
-
: undefined;
|
|
273
284
|
const cardTestId = concatTestID(testID, 'card');
|
|
274
285
|
const card = credential
|
|
275
286
|
? validityCheckedCardFromCredential(
|
|
276
287
|
credential,
|
|
277
288
|
expanded,
|
|
289
|
+
selectiveDisclosureSupported,
|
|
278
290
|
multipleCredentialsAvailable,
|
|
279
291
|
config,
|
|
280
|
-
|
|
292
|
+
undefined,
|
|
281
293
|
cardTestId,
|
|
282
294
|
labels,
|
|
295
|
+
language,
|
|
283
296
|
)
|
|
284
|
-
: missingCredentialCardFromRequest(request,
|
|
297
|
+
: missingCredentialCardFromRequest(request, undefined, cardTestId, labels);
|
|
285
298
|
const validityState = getValidityState(credential ? { ...credential, issuer: credential.issuer?.id } : undefined);
|
|
286
299
|
const displayedAttributes = getDisplayedAttributes(
|
|
287
300
|
request,
|
|
@@ -299,6 +312,7 @@ export const shareCredentialCardFromCredential = (
|
|
|
299
312
|
config,
|
|
300
313
|
concatTestID(testID, 'attribute', `${index}`),
|
|
301
314
|
labels,
|
|
315
|
+
language,
|
|
302
316
|
claim,
|
|
303
317
|
field,
|
|
304
318
|
),
|
|
@@ -319,10 +333,11 @@ export const selectCredentialCardAttributeFromClaim = (
|
|
|
319
333
|
config: CoreConfig,
|
|
320
334
|
testID: string,
|
|
321
335
|
labels: ShareCredentialCardLabels,
|
|
336
|
+
language: string | undefined,
|
|
322
337
|
claim?: FlatClaim,
|
|
323
338
|
field?: PresentationDefinitionField,
|
|
324
339
|
): CredentialAttribute => {
|
|
325
|
-
const attribute = shareCredentialCardAttributeFromClaim(id, config, testID, labels, claim, field);
|
|
340
|
+
const attribute = shareCredentialCardAttributeFromClaim(id, config, testID, labels, language, claim, field);
|
|
326
341
|
if (!claim) {
|
|
327
342
|
return attribute;
|
|
328
343
|
}
|
|
@@ -339,6 +354,7 @@ export const selectCredentialCardFromCredential = (
|
|
|
339
354
|
config: CoreConfig,
|
|
340
355
|
testID: string,
|
|
341
356
|
labels: ShareCredentialCardLabels,
|
|
357
|
+
language: string | undefined,
|
|
342
358
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
343
359
|
const selectiveDisclosureSupported = supportsSelectiveDisclosure(
|
|
344
360
|
credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
|
|
@@ -348,7 +364,7 @@ export const selectCredentialCardFromCredential = (
|
|
|
348
364
|
const notice: CredentialCardNotice | undefined =
|
|
349
365
|
selectiveDisclosureSupported === false
|
|
350
366
|
? {
|
|
351
|
-
text: labels.
|
|
367
|
+
text: labels.selectiveDisclosure,
|
|
352
368
|
noticeIcon: CredentialNoticeWarningIcon,
|
|
353
369
|
}
|
|
354
370
|
: undefined;
|
|
@@ -359,6 +375,7 @@ export const selectCredentialCardFromCredential = (
|
|
|
359
375
|
notice,
|
|
360
376
|
testID,
|
|
361
377
|
labels,
|
|
378
|
+
language,
|
|
362
379
|
);
|
|
363
380
|
const card = {
|
|
364
381
|
header: {
|
|
@@ -372,7 +389,7 @@ export const selectCredentialCardFromCredential = (
|
|
|
372
389
|
return path === field.keyMap[credential.id];
|
|
373
390
|
});
|
|
374
391
|
|
|
375
|
-
const attribute = selectCredentialCardAttributeFromClaim(field.id, config, testID, labels, claim, field);
|
|
392
|
+
const attribute = selectCredentialCardAttributeFromClaim(field.id, config, testID, labels, language, claim, field);
|
|
376
393
|
return {
|
|
377
394
|
...attribute,
|
|
378
395
|
rightAccessory: (
|