@procivis/one-react-native-components 0.3.22 → 0.3.47
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/entity/entity-attributes.js +15 -2
- package/lib/commonjs/components/entity/entity-attributes.js.map +1 -1
- package/lib/commonjs/components/entity/entity-details-with-buttons.js +14 -38
- package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +1 -1
- package/lib/commonjs/components/entity/entity-details.js +63 -34
- package/lib/commonjs/components/entity/entity-details.js.map +1 -1
- package/lib/commonjs/components/entity/index.js +2 -15
- package/lib/commonjs/components/entity/index.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item-icon.js +4 -1
- package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item.js +15 -3
- package/lib/commonjs/components/history/history-list-item.js.map +1 -1
- package/lib/commonjs/components/history/history-list-screen.js +2 -0
- package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
- package/lib/commonjs/components/proof-request/share-credential.js +2 -2
- package/lib/commonjs/components/proof-request/share-credential.js.map +1 -1
- package/lib/commonjs/ui-components/blur/index.js +2 -9
- package/lib/commonjs/ui-components/blur/index.js.map +1 -1
- package/lib/commonjs/ui-components/buttons/hold-button.js +3 -2
- package/lib/commonjs/ui-components/buttons/hold-button.js.map +1 -1
- package/lib/commonjs/ui-components/camera/index.js +2 -9
- package/lib/commonjs/ui-components/camera/index.js.map +1 -1
- package/lib/commonjs/ui-components/control/index.js +0 -12
- package/lib/commonjs/ui-components/control/index.js.map +1 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js +1 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/commonjs/ui-components/credential/credential-carousel-images.js +15 -8
- package/lib/commonjs/ui-components/credential/credential-carousel-images.js.map +1 -1
- package/lib/commonjs/ui-components/entity/entity-cluster.js +51 -3
- package/lib/commonjs/ui-components/entity/entity-cluster.js.map +1 -1
- package/lib/commonjs/ui-components/entity/index.js +3 -16
- package/lib/commonjs/ui-components/entity/index.js.map +1 -1
- package/lib/commonjs/ui-components/history/history-details.js +1 -1
- package/lib/commonjs/ui-components/history/history-details.js.map +1 -1
- package/lib/commonjs/ui-components/history/index.js +4 -27
- package/lib/commonjs/ui-components/history/index.js.map +1 -1
- package/lib/commonjs/ui-components/icons/entity.js +26 -1
- package/lib/commonjs/ui-components/icons/entity.js.map +1 -1
- package/lib/commonjs/ui-components/icons/history.js +3 -1
- package/lib/commonjs/ui-components/icons/history.js.map +1 -1
- package/lib/commonjs/ui-components/input/index.js +3 -32
- package/lib/commonjs/ui-components/input/index.js.map +1 -1
- package/lib/commonjs/ui-components/list/index.js +4 -19
- package/lib/commonjs/ui-components/list/index.js.map +1 -1
- package/lib/commonjs/ui-components/loader/index.js +2 -13
- package/lib/commonjs/ui-components/loader/index.js.map +1 -1
- package/lib/commonjs/ui-components/pin/index.js +2 -21
- package/lib/commonjs/ui-components/pin/index.js.map +1 -1
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js +1 -1
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/commonjs/ui-components/searchbar/index.js +3 -16
- package/lib/commonjs/ui-components/searchbar/index.js.map +1 -1
- package/lib/commonjs/ui-components/settings/index.js +6 -37
- package/lib/commonjs/ui-components/settings/index.js.map +1 -1
- package/lib/commonjs/ui-components/state/index.js +2 -15
- package/lib/commonjs/ui-components/state/index.js.map +1 -1
- package/lib/commonjs/utils/date.js +1 -1
- package/lib/commonjs/utils/date.js.map +1 -1
- package/lib/commonjs/utils/hooks/connectivity/connectivity.test.js +4 -0
- package/lib/commonjs/utils/hooks/connectivity/connectivity.test.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/backup.js +22 -66
- package/lib/commonjs/utils/hooks/core/backup.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-init.js +33 -25
- package/lib/commonjs/utils/hooks/core/core-init.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credentials.js +2 -1
- package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/identifiers.js +42 -0
- package/lib/commonjs/utils/hooks/core/identifiers.js.map +1 -0
- 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/proofs.js +26 -15
- package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/trust-entity.js +60 -13
- package/lib/commonjs/utils/hooks/core/trust-entity.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing.js +9 -15
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +7 -0
- package/lib/commonjs/utils/parsers/credential.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.js +22 -4
- package/lib/commonjs/utils/parsers/query.js.map +1 -1
- package/lib/module/components/entity/entity-attributes.js +16 -3
- package/lib/module/components/entity/entity-attributes.js.map +1 -1
- package/lib/module/components/entity/entity-details-with-buttons.js +16 -40
- package/lib/module/components/entity/entity-details-with-buttons.js.map +1 -1
- package/lib/module/components/entity/entity-details.js +65 -36
- package/lib/module/components/entity/entity-details.js.map +1 -1
- package/lib/module/components/entity/index.js +2 -2
- package/lib/module/components/entity/index.js.map +1 -1
- package/lib/module/components/history/history-list-item-icon.js +5 -2
- package/lib/module/components/history/history-list-item-icon.js.map +1 -1
- package/lib/module/components/history/history-list-item.js +16 -4
- package/lib/module/components/history/history-list-item.js.map +1 -1
- package/lib/module/components/history/history-list-screen.js +2 -0
- package/lib/module/components/history/history-list-screen.js.map +1 -1
- package/lib/module/components/proof-request/share-credential.js +2 -2
- package/lib/module/components/proof-request/share-credential.js.map +1 -1
- package/lib/module/ui-components/blur/index.js +2 -2
- package/lib/module/ui-components/blur/index.js.map +1 -1
- package/lib/module/ui-components/buttons/hold-button.js +4 -3
- package/lib/module/ui-components/buttons/hold-button.js.map +1 -1
- package/lib/module/ui-components/camera/index.js +2 -2
- package/lib/module/ui-components/camera/index.js.map +1 -1
- package/lib/module/ui-components/control/index.js +3 -3
- package/lib/module/ui-components/control/index.js.map +1 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js +1 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/module/ui-components/credential/credential-carousel-images.js +15 -8
- package/lib/module/ui-components/credential/credential-carousel-images.js.map +1 -1
- package/lib/module/ui-components/entity/entity-cluster.js +52 -4
- package/lib/module/ui-components/entity/entity-cluster.js.map +1 -1
- package/lib/module/ui-components/entity/index.js +4 -4
- package/lib/module/ui-components/entity/index.js.map +1 -1
- package/lib/module/ui-components/history/history-details.js +1 -1
- package/lib/module/ui-components/history/history-details.js.map +1 -1
- package/lib/module/ui-components/history/index.js +6 -6
- package/lib/module/ui-components/history/index.js.map +1 -1
- package/lib/module/ui-components/icons/entity.js +24 -0
- package/lib/module/ui-components/icons/entity.js.map +1 -1
- package/lib/module/ui-components/icons/history.js +2 -0
- package/lib/module/ui-components/icons/history.js.map +1 -1
- package/lib/module/ui-components/input/index.js +6 -6
- package/lib/module/ui-components/input/index.js.map +1 -1
- package/lib/module/ui-components/list/index.js +4 -4
- package/lib/module/ui-components/list/index.js.map +1 -1
- package/lib/module/ui-components/loader/index.js +4 -4
- package/lib/module/ui-components/loader/index.js.map +1 -1
- package/lib/module/ui-components/pin/index.js +3 -3
- package/lib/module/ui-components/pin/index.js.map +1 -1
- package/lib/module/ui-components/screens/nerd-mode-screen.js +1 -1
- package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/module/ui-components/searchbar/index.js +4 -4
- package/lib/module/ui-components/searchbar/index.js.map +1 -1
- package/lib/module/ui-components/settings/index.js +10 -10
- package/lib/module/ui-components/settings/index.js.map +1 -1
- package/lib/module/ui-components/state/index.js +2 -2
- package/lib/module/ui-components/state/index.js.map +1 -1
- package/lib/module/utils/date.js +1 -1
- package/lib/module/utils/date.js.map +1 -1
- package/lib/module/utils/hooks/connectivity/connectivity.test.js +4 -0
- package/lib/module/utils/hooks/connectivity/connectivity.test.js.map +1 -1
- package/lib/module/utils/hooks/core/backup.js +24 -68
- package/lib/module/utils/hooks/core/backup.js.map +1 -1
- package/lib/module/utils/hooks/core/core-init.js +30 -24
- package/lib/module/utils/hooks/core/core-init.js.map +1 -1
- package/lib/module/utils/hooks/core/credentials.js +2 -1
- package/lib/module/utils/hooks/core/credentials.js.map +1 -1
- package/lib/module/utils/hooks/core/identifiers.js +34 -0
- package/lib/module/utils/hooks/core/identifiers.js.map +1 -0
- 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/proofs.js +26 -15
- package/lib/module/utils/hooks/core/proofs.js.map +1 -1
- package/lib/module/utils/hooks/core/trust-entity.js +60 -13
- package/lib/module/utils/hooks/core/trust-entity.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing.js +9 -15
- package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +7 -0
- package/lib/module/utils/parsers/credential.js.map +1 -1
- package/lib/module/utils/parsers/query.js +20 -3
- package/lib/module/utils/parsers/query.js.map +1 -1
- package/lib/typescript/components/entity/entity-attributes.d.ts +1 -0
- package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +2 -2
- package/lib/typescript/components/entity/entity-details.d.ts +4 -2
- package/lib/typescript/components/entity/index.d.ts +2 -1
- package/lib/typescript/components/history/history-list-item.d.ts +1 -0
- package/lib/typescript/components/history/history-list-screen.d.ts +2 -0
- package/lib/typescript/ui-components/blur/index.d.ts +2 -1
- package/lib/typescript/ui-components/buttons/hold-button.d.ts +2 -2
- package/lib/typescript/ui-components/camera/index.d.ts +2 -1
- package/lib/typescript/ui-components/control/index.d.ts +4 -2
- package/lib/typescript/ui-components/credential/credential-carousel-images.d.ts +1 -0
- package/lib/typescript/ui-components/entity/entity-cluster.d.ts +1 -0
- package/lib/typescript/ui-components/entity/index.d.ts +4 -2
- package/lib/typescript/ui-components/history/history-details.d.ts +4 -1
- package/lib/typescript/ui-components/history/index.d.ts +6 -3
- package/lib/typescript/ui-components/icons/entity.d.ts +1 -0
- package/lib/typescript/ui-components/icons/history.d.ts +2 -0
- package/lib/typescript/ui-components/input/index.d.ts +6 -3
- package/lib/typescript/ui-components/list/index.d.ts +4 -2
- package/lib/typescript/ui-components/loader/index.d.ts +4 -2
- package/lib/typescript/ui-components/pin/index.d.ts +4 -2
- package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +4 -4
- package/lib/typescript/ui-components/searchbar/index.d.ts +4 -2
- package/lib/typescript/ui-components/settings/index.d.ts +10 -5
- package/lib/typescript/ui-components/state/index.d.ts +2 -1
- package/lib/typescript/utils/hooks/core/backup.d.ts +5 -0
- package/lib/typescript/utils/hooks/core/core-init.d.ts +4 -1
- package/lib/typescript/utils/hooks/core/credentials.d.ts +2 -1
- package/lib/typescript/utils/hooks/core/identifiers.d.ts +5 -0
- package/lib/typescript/utils/hooks/core/index.d.ts +1 -0
- package/lib/typescript/utils/hooks/core/proofs.d.ts +3 -1
- package/lib/typescript/utils/hooks/core/trust-entity.d.ts +10 -4
- package/lib/typescript/utils/parsers/query.d.ts +3 -2
- package/package.json +9 -4
- package/src/components/entity/entity-attributes.tsx +17 -3
- package/src/components/entity/entity-details-with-buttons.tsx +17 -42
- package/src/components/entity/entity-details.tsx +64 -37
- package/src/components/entity/index.ts +2 -1
- package/src/components/history/history-list-item-icon.tsx +5 -0
- package/src/components/history/history-list-item.tsx +19 -4
- package/src/components/history/history-list-screen.tsx +4 -1
- package/src/components/proof-request/share-credential.tsx +1 -1
- package/src/ui-components/blur/index.ts +2 -1
- package/src/ui-components/buttons/hold-button.tsx +6 -5
- package/src/ui-components/camera/index.tsx +2 -1
- package/src/ui-components/control/index.ts +4 -2
- package/src/ui-components/credential/card/credential-details-card.tsx +1 -1
- package/src/ui-components/credential/credential-carousel-images.tsx +15 -8
- package/src/ui-components/entity/entity-cluster.tsx +63 -10
- package/src/ui-components/entity/index.ts +4 -2
- package/src/ui-components/history/history-details.tsx +5 -2
- package/src/ui-components/history/index.ts +6 -3
- package/src/ui-components/icons/entity.tsx +23 -0
- package/src/ui-components/icons/history.tsx +2 -0
- package/src/ui-components/input/index.ts +6 -3
- package/src/ui-components/list/index.ts +4 -2
- package/src/ui-components/loader/index.ts +4 -2
- package/src/ui-components/pin/index.ts +4 -2
- package/src/ui-components/screens/nerd-mode-screen.tsx +5 -5
- package/src/ui-components/searchbar/index.ts +4 -2
- package/src/ui-components/settings/index.ts +10 -5
- package/src/ui-components/state/index.ts +2 -1
- package/src/utils/date.ts +1 -1
- package/src/utils/hooks/connectivity/connectivity.test.ts +7 -2
- package/src/utils/hooks/core/backup.ts +30 -72
- package/src/utils/hooks/core/core-init.ts +29 -23
- package/src/utils/hooks/core/credentials.ts +9 -3
- package/src/utils/hooks/core/identifiers.ts +39 -0
- package/src/utils/hooks/core/index.ts +2 -1
- package/src/utils/hooks/core/proofs.ts +31 -18
- package/src/utils/hooks/core/trust-entity.ts +55 -17
- package/src/utils/parsers/credential-sharing.tsx +30 -36
- package/src/utils/parsers/credential.ts +4 -0
- package/src/utils/parsers/query.tsx +14 -4
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CredentialListQuery, CredentialSchemaListQuery, DidListQuery, HistoryListQuery, ProofListQuery, ProofSchemaListQuery } from '@procivis/react-native-one-core';
|
|
1
|
+
import { CredentialListQuery, CredentialSchemaListQuery, DidListQuery, HistoryListQuery, IdentifierListQuery, ProofListQuery, ProofSchemaListQuery } from '@procivis/react-native-one-core';
|
|
2
2
|
export declare const getQueryKeyFromCredentialListQueryParams: (queryParams?: Partial<CredentialListQuery>) => (string | string[] | undefined)[];
|
|
3
|
-
export declare const getQueryKeyFromHistoryListQueryParams: (queryParams?: Partial<HistoryListQuery>) => (string | import("@procivis/react-native-one-core").HistoryEntityTypeEnum[] | undefined)[];
|
|
3
|
+
export declare const getQueryKeyFromHistoryListQueryParams: (queryParams?: Partial<HistoryListQuery>) => (string | import("@procivis/react-native-one-core").HistoryActionEnum[] | import("@procivis/react-native-one-core").HistoryEntityTypeEnum[] | undefined)[];
|
|
4
4
|
export declare const getQueryKeyFromCredentialSchemaListQueryParams: (queryParams?: Partial<CredentialSchemaListQuery>) => (string | string[] | undefined)[];
|
|
5
5
|
export declare const getQueryKeyFromProofSchemaListQueryParams: (queryParams?: Partial<ProofSchemaListQuery>) => (string | string[] | undefined)[];
|
|
6
6
|
export declare const getQueryKeyFromProofListQueryParams: (queryParams?: Partial<ProofListQuery>) => (string | string[] | undefined)[];
|
|
7
7
|
export declare const getQueryKeyFromDidListQueryParams: (queryParams?: Partial<DidListQuery>) => (string | boolean | string[] | undefined)[];
|
|
8
|
+
export declare const getQueryKeyFromIdentifierListQueryParams: (queryParams?: Partial<IdentifierListQuery>) => (string | boolean | string[] | undefined)[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@procivis/one-react-native-components",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.47",
|
|
4
4
|
"author": "Procivis AG (https://procivis.ch)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "Common Procivis ONE UI components for react-native",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@babel/runtime": "^7.25.0",
|
|
52
52
|
"@commitlint/config-conventional": "^11.0.0",
|
|
53
53
|
"@gorhom/bottom-sheet": "^5.1.2",
|
|
54
|
-
"@procivis/react-native-one-core": "1.
|
|
54
|
+
"@procivis/react-native-one-core": "1.52216.0",
|
|
55
55
|
"@procivis/react-native-picker": "5.0.3",
|
|
56
56
|
"@react-native-async-storage/async-storage": "^1.17.3",
|
|
57
57
|
"@react-native-community/blur": "^4.4.0",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"vite": "^6.2.2"
|
|
139
139
|
},
|
|
140
140
|
"peerDependencies": {
|
|
141
|
-
"@procivis/react-native-one-core": "^1.
|
|
141
|
+
"@procivis/react-native-one-core": "^1.52216.0",
|
|
142
142
|
"@procivis/react-native-picker": "*",
|
|
143
143
|
"@react-native-community/blur": "*",
|
|
144
144
|
"@react-native-community/netinfo": "^11.4.1",
|
|
@@ -277,5 +277,10 @@
|
|
|
277
277
|
]
|
|
278
278
|
]
|
|
279
279
|
},
|
|
280
|
-
"packageManager": "pnpm@10.5.2"
|
|
280
|
+
"packageManager": "pnpm@10.5.2",
|
|
281
|
+
"pnpm": {
|
|
282
|
+
"patchedDependencies": {
|
|
283
|
+
"react-native-web": "patches/react-native-web.patch"
|
|
284
|
+
}
|
|
285
|
+
}
|
|
281
286
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { TrustEntity } from '@procivis/react-native-one-core';
|
|
2
2
|
import React, { FC, memo } from 'react';
|
|
3
|
-
import { View } from 'react-native';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import { NerdModeItem } from '../../ui-components/nerd-view';
|
|
6
6
|
import { AttributesLabels, EntityType } from '../../ui-components/screens/nerd-mode-screen';
|
|
7
7
|
import { addElementIf } from '../../utils/array';
|
|
8
8
|
|
|
9
9
|
interface EntityAttributesProps {
|
|
10
|
+
certificate?: string;
|
|
10
11
|
did?: string;
|
|
11
12
|
trustEntity?: TrustEntity;
|
|
12
13
|
trusted: boolean;
|
|
@@ -16,6 +17,7 @@ interface EntityAttributesProps {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
const EntityAttributes: FC<EntityAttributesProps> = ({
|
|
20
|
+
certificate,
|
|
19
21
|
did,
|
|
20
22
|
trustEntity,
|
|
21
23
|
trusted,
|
|
@@ -34,12 +36,18 @@ const EntityAttributes: FC<EntityAttributesProps> = ({
|
|
|
34
36
|
testID: 'trustRegistry',
|
|
35
37
|
}),
|
|
36
38
|
...addElementIf(Boolean(did), {
|
|
37
|
-
attributeKey: entityType === EntityType.CredentialEntity ? labels.
|
|
39
|
+
attributeKey: entityType === EntityType.CredentialEntity ? labels.issuerIdentifier : labels.entityIdentifier,
|
|
38
40
|
attributeText: identifier,
|
|
39
41
|
canBeCopied: true,
|
|
40
42
|
highlightedText: didMethod,
|
|
41
43
|
testID: 'issuerDID',
|
|
42
44
|
}),
|
|
45
|
+
...addElementIf(Boolean(certificate), {
|
|
46
|
+
attributeKey: entityType === EntityType.CredentialEntity ? labels.issuerIdentifier : labels.entityIdentifier,
|
|
47
|
+
attributeText: certificate,
|
|
48
|
+
canBeCopied: true,
|
|
49
|
+
testID: 'issuerCertificate',
|
|
50
|
+
}),
|
|
43
51
|
...addElementIf(trusted && Boolean(trustEntity?.role), {
|
|
44
52
|
attributeKey: labels.role,
|
|
45
53
|
highlightedText: trustEntity?.role,
|
|
@@ -47,7 +55,7 @@ const EntityAttributes: FC<EntityAttributesProps> = ({
|
|
|
47
55
|
}),
|
|
48
56
|
];
|
|
49
57
|
return (
|
|
50
|
-
<View>
|
|
58
|
+
<View style={styles.wrapper}>
|
|
51
59
|
{attributes.map((attribute) => (
|
|
52
60
|
<NerdModeItem
|
|
53
61
|
key={attribute.attributeKey}
|
|
@@ -60,4 +68,10 @@ const EntityAttributes: FC<EntityAttributesProps> = ({
|
|
|
60
68
|
);
|
|
61
69
|
};
|
|
62
70
|
|
|
71
|
+
const styles = StyleSheet.create({
|
|
72
|
+
wrapper: {
|
|
73
|
+
marginBottom: 20,
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
|
|
63
77
|
export default memo(EntityAttributes);
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, { FC, memo
|
|
1
|
+
import { IdentifierListItem, TrustEntityRoleEnum, TrustEntityStateEnum } from '@procivis/react-native-one-core';
|
|
2
|
+
import React, { FC, memo } from 'react';
|
|
3
3
|
import { StyleProp, View, ViewStyle } from 'react-native';
|
|
4
4
|
|
|
5
|
-
import EntityCluster from '../../ui-components/entity/entity-cluster';
|
|
6
|
-
import { EntityTrustedIcon } from '../../ui-components/icons';
|
|
7
5
|
import { AttributesLabels, EntityLabels, EntityType } from '../../ui-components/screens/nerd-mode-screen';
|
|
8
6
|
import { useAppColorScheme } from '../../ui-components/theme/color-scheme-context';
|
|
9
|
-
import { concatTestID } from '../../utils';
|
|
7
|
+
import { concatTestID, useIdentifierDetails } from '../../utils';
|
|
10
8
|
import { useTrustEntity } from '../../utils/hooks/core/trust-entity';
|
|
11
9
|
import EntityAttributes from './entity-attributes';
|
|
10
|
+
import EntityDetails from './entity-details';
|
|
12
11
|
import EntityButtons from './EntityButtons';
|
|
13
12
|
|
|
14
13
|
export type ContextRole = Exclude<TrustEntityRoleEnum, TrustEntityRoleEnum.BOTH>;
|
|
15
14
|
|
|
16
15
|
interface EntityDetailsWithButtonsProps {
|
|
17
|
-
|
|
16
|
+
identifier?: IdentifierListItem;
|
|
18
17
|
entityLabels: EntityLabels;
|
|
19
18
|
attributesLabels: AttributesLabels;
|
|
20
19
|
style?: StyleProp<ViewStyle>;
|
|
@@ -26,7 +25,7 @@ interface EntityDetailsWithButtonsProps {
|
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
const EntityDetailsWithButtons: FC<EntityDetailsWithButtonsProps> = ({
|
|
29
|
-
|
|
28
|
+
identifier,
|
|
30
29
|
entityLabels,
|
|
31
30
|
attributesLabels,
|
|
32
31
|
onCopyToClipboard,
|
|
@@ -35,57 +34,33 @@ const EntityDetailsWithButtons: FC<EntityDetailsWithButtonsProps> = ({
|
|
|
35
34
|
testID,
|
|
36
35
|
...props
|
|
37
36
|
}) => {
|
|
38
|
-
let { data } = useTrustEntity(
|
|
37
|
+
let { data } = useTrustEntity(identifier?.id);
|
|
38
|
+
let { data: identifierDetail } = useIdentifierDetails(identifier?.id);
|
|
39
39
|
const trustEntity = data ?? undefined;
|
|
40
40
|
|
|
41
41
|
const colorScheme = useAppColorScheme();
|
|
42
42
|
|
|
43
43
|
const trusted = Boolean(
|
|
44
44
|
trustEntity &&
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
trustEntity.state === TrustEntityStateEnum.ACTIVE &&
|
|
46
|
+
(trustEntity.role === TrustEntityRoleEnum.BOTH || trustEntity.role === role),
|
|
47
47
|
);
|
|
48
48
|
|
|
49
|
-
const trustEntityName = useMemo(() => {
|
|
50
|
-
if (!trustEntity || !trusted) {
|
|
51
|
-
return role === TrustEntityRoleEnum.ISSUER ? entityLabels.unknownIssuer : entityLabels.unknownVerifier;
|
|
52
|
-
}
|
|
53
|
-
return trustEntity.name;
|
|
54
|
-
}, [entityLabels, role, trustEntity, trusted]);
|
|
55
|
-
|
|
56
|
-
const trustEntitySubline = useMemo(() => {
|
|
57
|
-
if (!trusted) {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return `${entityLabels.trusted} • ${trustEntity?.trustAnchor.name}`;
|
|
62
|
-
}, [trustEntity, trusted, entityLabels.trusted]);
|
|
63
|
-
|
|
64
|
-
const trustEntityStatusIcon = useMemo(() => {
|
|
65
|
-
if (!trusted) {
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
return <EntityTrustedIcon testID={concatTestID(testID, 'statusIcon', 'trusted')} />;
|
|
69
|
-
}, [testID, trusted]);
|
|
70
|
-
|
|
71
49
|
return (
|
|
72
50
|
<View style={{ backgroundColor: colorScheme.nerdView.background }}>
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
statusIcon: trustEntityStatusIcon,
|
|
78
|
-
testID: concatTestID(testID, 'avatar'),
|
|
51
|
+
<EntityDetails
|
|
52
|
+
identifier={identifier}
|
|
53
|
+
labels={{
|
|
54
|
+
unknown: role === TrustEntityRoleEnum.ISSUER ? entityLabels.unknownIssuer : entityLabels.unknownVerifier,
|
|
79
55
|
}}
|
|
80
|
-
|
|
81
|
-
subline={trustEntitySubline}
|
|
82
|
-
sublineColor={trusted ? colorScheme.success : colorScheme.white}
|
|
56
|
+
role={role}
|
|
83
57
|
testID={testID}
|
|
84
58
|
{...props}
|
|
85
59
|
/>
|
|
86
60
|
{trusted && <EntityButtons entity={trustEntity} labels={entityLabels} testID={concatTestID(testID, 'links')} />}
|
|
87
61
|
<EntityAttributes
|
|
88
|
-
|
|
62
|
+
certificate={identifierDetail?.certificates?.[0]?.chain}
|
|
63
|
+
did={identifierDetail?.did?.did}
|
|
89
64
|
trustEntity={trustEntity}
|
|
90
65
|
trusted={trusted}
|
|
91
66
|
labels={attributesLabels}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IdentifierCertificateDetail, IdentifierListItem,TrustEntity, TrustEntityRoleEnum, TrustEntityStateEnum } from '@procivis/react-native-one-core';
|
|
2
2
|
import React, { FC, ReactNode, useMemo } from 'react';
|
|
3
3
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
4
4
|
|
|
5
|
+
import { AvatarProps } from '../../ui-components';
|
|
5
6
|
import EntityCluster from '../../ui-components/entity/entity-cluster';
|
|
6
|
-
import { EntityTrustedIcon } from '../../ui-components/icons';
|
|
7
|
-
import { concatTestID, replaceBreakingHyphens } from '../../utils';
|
|
7
|
+
import { EntityNotTrustedIcon, EntityTrustedIcon } from '../../ui-components/icons';
|
|
8
|
+
import { concatTestID, replaceBreakingHyphens, useIdentifierDetails } from '../../utils';
|
|
8
9
|
import { useTrustEntity } from '../../utils/hooks/core/trust-entity';
|
|
9
10
|
|
|
10
11
|
export type EntityDetailsLabels = {
|
|
@@ -16,66 +17,92 @@ export type EntityDetailsProps = {
|
|
|
16
17
|
renderMore?: (trustEntity: TrustEntity) => ReactNode;
|
|
17
18
|
role: Exclude<TrustEntityRoleEnum, TrustEntityRoleEnum.BOTH>;
|
|
18
19
|
style?: StyleProp<ViewStyle>;
|
|
20
|
+
sublineColor?: string;
|
|
21
|
+
textColor?: string;
|
|
19
22
|
testID?: string;
|
|
20
23
|
} & (
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
| {
|
|
25
|
+
identifier?: IdentifierListItem;
|
|
23
26
|
}
|
|
24
|
-
|
|
27
|
+
| {
|
|
25
28
|
entity: TrustEntity;
|
|
26
29
|
}
|
|
27
|
-
);
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const getCertificateCommonName = (certificate: IdentifierCertificateDetail): string | undefined => {
|
|
33
|
+
return certificate.x509Attributes.subject.split(', ').find((s) => s.startsWith('CN'))?.split('=')?.pop();
|
|
34
|
+
}
|
|
28
35
|
|
|
29
|
-
const EntityDetails: FC<EntityDetailsProps> = ({ labels, renderMore, role, style, testID, ...props }) => {
|
|
30
|
-
const { data } = useTrustEntity('
|
|
36
|
+
const EntityDetails: FC<EntityDetailsProps> = ({ labels, renderMore, role, style, testID, sublineColor, textColor, ...props }) => {
|
|
37
|
+
const { data, isLoading: isLoadingTrustEntity } = useTrustEntity('identifier' in props ? props.identifier?.id : undefined);
|
|
31
38
|
const trustEntity: TrustEntity | undefined = 'entity' in props ? props.entity : data ?? undefined;
|
|
39
|
+
const { data: identifierDetail, isLoading: isLoadingIdentifier } = useIdentifierDetails('identifier' in props ? props.identifier?.id : undefined);
|
|
32
40
|
|
|
33
41
|
const trusted =
|
|
34
42
|
trustEntity &&
|
|
35
43
|
trustEntity.state === TrustEntityStateEnum.ACTIVE &&
|
|
36
44
|
(trustEntity.role === TrustEntityRoleEnum.BOTH || trustEntity.role === role);
|
|
37
45
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
const isLoading = isLoadingIdentifier || isLoadingTrustEntity;
|
|
47
|
+
|
|
48
|
+
const avatarProps: AvatarProps | undefined = useMemo(() => {
|
|
49
|
+
if (isLoading) {
|
|
50
|
+
return undefined;
|
|
41
51
|
}
|
|
42
|
-
return trustEntity.name;
|
|
43
|
-
}, [labels.unknown, trustEntity, trusted]);
|
|
44
52
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
const avatar = trusted && identifierDetail?.type === 'DID' && trustEntity.logo ? { imageSource: { uri: trustEntity.logo } } : undefined;
|
|
54
|
+
|
|
55
|
+
const placeholderText = identifierDetail?.type === 'CERTIFICATE' && identifierDetail.certificates?.[0] ? getCertificateCommonName(identifierDetail.certificates[0])?.substring(0, 1) : 'D';
|
|
56
|
+
|
|
57
|
+
const statusIcon = trusted ?
|
|
58
|
+
<EntityTrustedIcon testID={concatTestID(testID, 'statusIcon', 'trusted')} /> :
|
|
59
|
+
<EntityNotTrustedIcon testID={concatTestID(testID, 'statusIcon', 'notTrusted')} />;
|
|
60
|
+
|
|
61
|
+
if (trustEntity) {
|
|
62
|
+
return {
|
|
63
|
+
avatar,
|
|
64
|
+
placeholderText: trusted && identifierDetail?.type === 'DID' ? trustEntity.name.substring(0, 1) : placeholderText,
|
|
65
|
+
statusIcon,
|
|
66
|
+
testID: concatTestID(testID, 'avatar'),
|
|
67
|
+
};
|
|
48
68
|
}
|
|
49
|
-
|
|
50
|
-
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
placeholderText,
|
|
72
|
+
statusIcon,
|
|
51
73
|
}
|
|
52
|
-
|
|
53
|
-
}, [props, trustEntity, trusted]);
|
|
74
|
+
}, [trustEntity, trusted, identifierDetail, isLoading, testID]);
|
|
54
75
|
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
return
|
|
76
|
+
const trustEntityName = useMemo(() => {
|
|
77
|
+
if (isLoading) {
|
|
78
|
+
return '';
|
|
79
|
+
}
|
|
80
|
+
if (identifierDetail?.type === 'CERTIFICATE' && identifierDetail.certificates?.[0]) {
|
|
81
|
+
const commonName = getCertificateCommonName(identifierDetail.certificates[0]);
|
|
82
|
+
if (commonName) {
|
|
83
|
+
return commonName;
|
|
84
|
+
}
|
|
58
85
|
}
|
|
59
|
-
|
|
60
|
-
|
|
86
|
+
if (trustEntity) {
|
|
87
|
+
return trustEntity.name;
|
|
88
|
+
}
|
|
89
|
+
if (identifierDetail?.did?.did) {
|
|
90
|
+
return replaceBreakingHyphens(identifierDetail.did.did);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return labels.unknown;
|
|
94
|
+
}, [labels.unknown, trustEntity, identifierDetail, isLoading]);
|
|
61
95
|
|
|
62
96
|
return (
|
|
63
97
|
<>
|
|
64
98
|
<EntityCluster
|
|
65
|
-
avatar={
|
|
66
|
-
trustEntity
|
|
67
|
-
? {
|
|
68
|
-
avatar: trusted && trustEntity.logo ? { imageSource: { uri: trustEntity.logo } } : undefined,
|
|
69
|
-
placeholderText: trustEntity.name.substring(0, 1),
|
|
70
|
-
statusIcon: trustEntityStatusIcon,
|
|
71
|
-
testID: concatTestID(testID, 'avatar'),
|
|
72
|
-
}
|
|
73
|
-
: undefined
|
|
74
|
-
}
|
|
99
|
+
avatar={avatarProps}
|
|
75
100
|
entityName={trustEntityName}
|
|
76
101
|
style={style}
|
|
77
|
-
subline={trustEntitySubline}
|
|
78
102
|
testID={testID}
|
|
103
|
+
textColor={textColor}
|
|
104
|
+
sublineColor={sublineColor}
|
|
105
|
+
isLoading={isLoading}
|
|
79
106
|
/>
|
|
80
107
|
{trustEntity && renderMore && renderMore(trustEntity)}
|
|
81
108
|
</>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { EntityDetailsLabels, EntityDetailsProps } from './entity-details';
|
|
2
|
+
import EntityDetails from './entity-details';
|
|
2
3
|
|
|
3
4
|
export { EntityDetails, EntityDetailsLabels, EntityDetailsProps };
|
|
@@ -5,8 +5,10 @@ import { SvgProps } from 'react-native-svg';
|
|
|
5
5
|
import {
|
|
6
6
|
HistoryBackupCreatedIcon,
|
|
7
7
|
HistoryBackupRestoredIcon,
|
|
8
|
+
HistoryCertificateIcon,
|
|
8
9
|
HistoryCredentialIcon,
|
|
9
10
|
HistoryDidIcon,
|
|
11
|
+
HistoryIdentifierIcon,
|
|
10
12
|
HistoryIssueIcon,
|
|
11
13
|
HistoryItemIcon,
|
|
12
14
|
HistoryKeyIcon,
|
|
@@ -51,12 +53,15 @@ const defaultIcons: {
|
|
|
51
53
|
WITHDRAWN: HistoryStatusErrorIcon,
|
|
52
54
|
REACTIVATED: HistoryStatusAcceptedIcon,
|
|
53
55
|
CSR_GENERATED: HistoryStatusAcceptedIcon,
|
|
56
|
+
EXPIRED: HistoryStatusErrorIcon,
|
|
54
57
|
},
|
|
55
58
|
entityTypes: {
|
|
56
59
|
BACKUP: HistoryRevokeIcon,
|
|
60
|
+
CERTIFICATE: HistoryCertificateIcon,
|
|
57
61
|
CREDENTIAL: HistoryCredentialIcon,
|
|
58
62
|
CREDENTIAL_SCHEMA: HistorySchemaIcon,
|
|
59
63
|
DID: HistoryDidIcon,
|
|
64
|
+
IDENTIFIER: HistoryIdentifierIcon,
|
|
60
65
|
KEY: HistoryKeyIcon,
|
|
61
66
|
ORGANISATION: HistoryOrganisationIcon,
|
|
62
67
|
PROOF: HistoryProofRequestIcon,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HistoryActionEnum, HistoryEntityTypeEnum, HistoryListItem } from '@procivis/react-native-one-core';
|
|
2
|
-
import React, { FC, useCallback } from 'react';
|
|
2
|
+
import React, { FC, useCallback, useMemo } from 'react';
|
|
3
3
|
|
|
4
4
|
import { HistoryItemView } from '../../ui-components';
|
|
5
5
|
import { formatTime, useTrustEntity } from '../../utils';
|
|
@@ -13,6 +13,7 @@ export type HistoryListItemLabels = {
|
|
|
13
13
|
export interface HistoryListItemViewProps {
|
|
14
14
|
dateFormatter?: (date: Date) => string;
|
|
15
15
|
first?: boolean;
|
|
16
|
+
infoLabelMode?: 'entity' | 'associatedLabel' | 'none';
|
|
16
17
|
item: HistoryListItem;
|
|
17
18
|
labels: HistoryListItemLabels;
|
|
18
19
|
last?: boolean;
|
|
@@ -23,15 +24,29 @@ export interface HistoryListItemViewProps {
|
|
|
23
24
|
export const HistoryListItemView: FC<HistoryListItemViewProps> = ({
|
|
24
25
|
dateFormatter = formatTime,
|
|
25
26
|
first,
|
|
27
|
+
infoLabelMode = 'entity',
|
|
26
28
|
item,
|
|
27
29
|
labels,
|
|
28
30
|
last,
|
|
29
31
|
onPress,
|
|
30
|
-
testID
|
|
32
|
+
testID,
|
|
31
33
|
}) => {
|
|
32
|
-
const
|
|
34
|
+
const identifierId = infoLabelMode === 'entity' ? item.target : undefined;
|
|
35
|
+
const { data: trustEntity } = useTrustEntity(identifierId);
|
|
33
36
|
|
|
34
37
|
const label = `${labels.entityTypes[item.entityType]} ${labels.actions[item.action]}`;
|
|
38
|
+
|
|
39
|
+
const info = useMemo(() => {
|
|
40
|
+
switch (infoLabelMode) {
|
|
41
|
+
case 'entity':
|
|
42
|
+
return trustEntity?.name;
|
|
43
|
+
case 'associatedLabel':
|
|
44
|
+
return item.name;
|
|
45
|
+
case 'none':
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
}, [infoLabelMode, item, trustEntity]);
|
|
49
|
+
|
|
35
50
|
const icon = <HistoryListItemIcon item={item} />;
|
|
36
51
|
|
|
37
52
|
const pressHandler = useCallback(() => {
|
|
@@ -42,7 +57,7 @@ export const HistoryListItemView: FC<HistoryListItemViewProps> = ({
|
|
|
42
57
|
<HistoryItemView
|
|
43
58
|
first={first}
|
|
44
59
|
icon={icon}
|
|
45
|
-
info={
|
|
60
|
+
info={info}
|
|
46
61
|
label={label}
|
|
47
62
|
last={last}
|
|
48
63
|
onPress={pressHandler}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from '../../ui-components';
|
|
14
14
|
import { concatTestID, groupEntriesByDay, HistoryGroupByDaySection, useListContentInset } from '../../utils';
|
|
15
15
|
import { HistoryListLabels, HistoryListView } from './history-list';
|
|
16
|
+
import { HistoryListItemViewProps } from './history-list-item';
|
|
16
17
|
|
|
17
18
|
export type HistoryListScreenLabels = {
|
|
18
19
|
emptyTitle: string;
|
|
@@ -24,6 +25,7 @@ export type HistoryListScreenLabels = {
|
|
|
24
25
|
|
|
25
26
|
export type HistoryListScreenProps = {
|
|
26
27
|
groupItems?: (entries: HistoryListItem[]) => HistoryGroupByDaySection[];
|
|
28
|
+
itemInfoLabelMode?: HistoryListItemViewProps['infoLabelMode'];
|
|
27
29
|
labels: HistoryListScreenLabels;
|
|
28
30
|
onBackPressed: () => void;
|
|
29
31
|
onHistoryItemPressed: (historyItem: HistoryListItem) => void;
|
|
@@ -36,6 +38,7 @@ export type HistoryListScreenProps = {
|
|
|
36
38
|
export const HistoryListScreen: FC<PropsWithChildren<HistoryListScreenProps>> = ({
|
|
37
39
|
children,
|
|
38
40
|
groupItems = groupEntriesByDay,
|
|
41
|
+
itemInfoLabelMode = 'entity',
|
|
39
42
|
labels,
|
|
40
43
|
onBackPressed,
|
|
41
44
|
onHistoryItemPressed,
|
|
@@ -92,7 +95,7 @@ export const HistoryListScreen: FC<PropsWithChildren<HistoryListScreenProps>> =
|
|
|
92
95
|
<HistoryListView
|
|
93
96
|
contentContainerStyle={insets}
|
|
94
97
|
groupItems={groupItems}
|
|
95
|
-
itemProps={{ onPress: onHistoryItemPressed }}
|
|
98
|
+
itemProps={{ infoLabelMode: itemInfoLabelMode, onPress: onHistoryItemPressed }}
|
|
96
99
|
onEmpty={setEmpty}
|
|
97
100
|
onScroll={Animated.event([{ nativeEvent: { contentOffset: { y: scrollOffset } } }], {
|
|
98
101
|
useNativeDriver: true,
|
|
@@ -11,7 +11,7 @@ import Animated, {
|
|
|
11
11
|
withTiming,
|
|
12
12
|
} from 'react-native-reanimated';
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import { TouchableOpacity, TouchableOpacityRef } from '../accessibility/accessibilityHistoryWrappers';
|
|
15
15
|
import { Typography } from '../text';
|
|
16
16
|
import { useAppColorScheme } from '../theme';
|
|
17
17
|
|
|
@@ -96,7 +96,7 @@ const Content = ({
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
interface HoldButtonLayoutedProps extends Omit<HoldButtonProps, 'style'> {
|
|
99
|
-
ref: React.ForwardedRef<
|
|
99
|
+
ref: React.ForwardedRef<TouchableOpacityRef>;
|
|
100
100
|
width: number;
|
|
101
101
|
height: number;
|
|
102
102
|
}
|
|
@@ -182,16 +182,17 @@ const HoldButtonLayouted = ({
|
|
|
182
182
|
</Animated.View>
|
|
183
183
|
)}
|
|
184
184
|
<View style={styles.pressableLayer}>
|
|
185
|
-
<
|
|
185
|
+
<TouchableOpacity
|
|
186
186
|
accessibilityRole="button"
|
|
187
187
|
ref={ref}
|
|
188
188
|
disabled={isFinished || disabled}
|
|
189
189
|
onLongPress={onLongPress}
|
|
190
190
|
onPressIn={isFinished ? undefined : onPressIn}
|
|
191
191
|
onPressOut={isFinished ? undefined : onPressOut}
|
|
192
|
+
activeOpacity={1}
|
|
192
193
|
{...props}>
|
|
193
194
|
<View style={{ width, height }} />
|
|
194
|
-
</
|
|
195
|
+
</TouchableOpacity>
|
|
195
196
|
</View>
|
|
196
197
|
</>
|
|
197
198
|
);
|
|
@@ -202,7 +203,7 @@ const HoldButtonLayouted = ({
|
|
|
202
203
|
*
|
|
203
204
|
* follows design: https://www.figma.com/design/cCmAyBQrQWCQZuDi85pJfe/Procivis-One-Wallet-Developments-2025?node-id=1-871
|
|
204
205
|
*/
|
|
205
|
-
const HoldButton = React.forwardRef<
|
|
206
|
+
const HoldButton = React.forwardRef<TouchableOpacityRef, HoldButtonProps>(
|
|
206
207
|
({ style, disabled, ...props }, ref) => {
|
|
207
208
|
const colorScheme = useAppColorScheme();
|
|
208
209
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { CheckboxProps } from './checkbox';
|
|
2
|
+
import { Checkbox } from './checkbox';
|
|
3
|
+
import type { SwitchProps } from './switch';
|
|
4
|
+
import { Switch } from './switch';
|
|
3
5
|
|
|
4
6
|
export { Checkbox, CheckboxProps, Switch, SwitchProps };
|
|
@@ -154,7 +154,7 @@ const CredentialDetailsCard: FC<CredentialDetailsCardProps> = ({
|
|
|
154
154
|
testID={concatTestID(card.testID, expanded ? 'expanded' : 'collapsed')}>
|
|
155
155
|
<CredentialCard
|
|
156
156
|
{...cardProps}
|
|
157
|
-
header={{ ...header, accessory: header.accessory ?? CaretIcon }}
|
|
157
|
+
header={{ ...header, accessory: header.accessory ?? (cardProps.onHeaderPress ? CaretIcon : undefined) }}
|
|
158
158
|
style={[styles.card, cardProps.style]}
|
|
159
159
|
/>
|
|
160
160
|
{previewAttributes.length > 0 && (
|
|
@@ -64,17 +64,24 @@ type QrCodeProps = {
|
|
|
64
64
|
content: string;
|
|
65
65
|
padding?: number;
|
|
66
66
|
testID?: string;
|
|
67
|
+
onError?: (err: string) => void;
|
|
67
68
|
};
|
|
68
69
|
|
|
69
|
-
export const QrCode: FC<QrCodeProps> = ({ content, padding, testID }) => {
|
|
70
|
+
export const QrCode: FC<QrCodeProps> = ({ content, padding, testID, onError }) => {
|
|
70
71
|
const qrCodeXml = useMemo(() => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
try {
|
|
73
|
+
return new QRCode({
|
|
74
|
+
container: 'svg-viewbox',
|
|
75
|
+
content,
|
|
76
|
+
ecl: 'L',
|
|
77
|
+
join: true,
|
|
78
|
+
padding: padding ?? 1,
|
|
79
|
+
}).svg();
|
|
80
|
+
} catch (err) {
|
|
81
|
+
onError && onError(err instanceof Error ? err.message : 'Unknown error occurred.');
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}, [content, onError, padding]);
|
|
78
85
|
return <SvgXml height={'100%'} testID={testID} width={'100%'} xml={qrCodeXml} />;
|
|
79
86
|
};
|
|
80
87
|
|