@procivis/one-react-native-components 0.3.71 → 0.3.91
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 +3 -1
- package/lib/commonjs/components/entity/entity-attributes.js.map +1 -1
- package/lib/commonjs/components/entity/entity-details-with-buttons.js +2 -1
- package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +1 -1
- package/lib/commonjs/components/proof-request/index.js +23 -12
- package/lib/commonjs/components/proof-request/index.js.map +1 -1
- package/lib/commonjs/components/proof-request/select-share-credential-card-notice.js +37 -0
- package/lib/commonjs/components/proof-request/select-share-credential-card-notice.js.map +1 -0
- package/lib/commonjs/components/proof-request/share-credential-card-notice.js +36 -0
- package/lib/commonjs/components/proof-request/share-credential-card-notice.js.map +1 -0
- package/lib/commonjs/components/proof-request/{group.js → v1/group.js} +1 -1
- package/lib/commonjs/components/proof-request/v1/group.js.map +1 -0
- package/lib/commonjs/components/proof-request/v1/index.js +39 -0
- package/lib/commonjs/components/proof-request/v1/index.js.map +1 -0
- package/lib/commonjs/components/proof-request/{select-credential.js → v1/select-credential.js} +4 -4
- package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -0
- package/lib/commonjs/components/proof-request/{share-credential.js → v1/share-credential.js} +25 -60
- package/lib/commonjs/components/proof-request/v1/share-credential.js.map +1 -0
- package/lib/commonjs/components/proof-request/v2/index.js +39 -0
- package/lib/commonjs/components/proof-request/v2/index.js.map +1 -0
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js +51 -0
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -0
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js +164 -0
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -0
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +131 -0
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -0
- package/lib/commonjs/ui-components/buttons/share-button.js +1 -1
- package/lib/commonjs/ui-components/buttons/share-button.js.map +1 -1
- package/lib/commonjs/ui-components/camera/qr-code-scanner.js +5 -1
- package/lib/commonjs/ui-components/camera/qr-code-scanner.js.map +1 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-list-item.js +16 -42
- package/lib/commonjs/ui-components/credential/card/credential-details-list-item.js.map +1 -1
- package/lib/commonjs/ui-components/credential/credential-attribute-item.js +3 -1
- package/lib/commonjs/ui-components/credential/credential-attribute-item.js.map +1 -1
- package/lib/commonjs/ui-components/credential/group/credential-group-header.js +72 -0
- package/lib/commonjs/ui-components/credential/group/credential-group-header.js.map +1 -0
- package/lib/commonjs/ui-components/credential/group/index.js +14 -0
- package/lib/commonjs/ui-components/credential/group/index.js.map +1 -0
- package/lib/commonjs/ui-components/credential/index.js +12 -0
- package/lib/commonjs/ui-components/credential/index.js.map +1 -1
- package/lib/commonjs/ui-components/header/foldable-header.js +29 -17
- package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
- package/lib/commonjs/ui-components/index.js +11 -0
- package/lib/commonjs/ui-components/index.js.map +1 -1
- package/lib/commonjs/ui-components/loader/loading-result.js +1 -1
- package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
- package/lib/commonjs/ui-components/pin/pin-lock-animation.js +477 -475
- package/lib/commonjs/ui-components/pin/pin-lock-animation.js.map +1 -1
- package/lib/commonjs/ui-components/proof-request/index.js +13 -0
- package/lib/commonjs/ui-components/proof-request/index.js.map +1 -0
- package/lib/commonjs/ui-components/proof-request/proof-request-set.js +47 -0
- package/lib/commonjs/ui-components/proof-request/proof-request-set.js.map +1 -0
- package/lib/commonjs/ui-components/screens/section-list-screen.js +17 -3
- package/lib/commonjs/ui-components/screens/section-list-screen.js.map +1 -1
- package/lib/commonjs/utils/array.js.map +1 -1
- package/lib/commonjs/utils/hooks/app-state.js +33 -0
- package/lib/commonjs/utils/hooks/app-state.js.map +1 -0
- package/lib/commonjs/utils/hooks/core/backup.js +1 -1
- package/lib/commonjs/utils/hooks/core/backup.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/cache.js +4 -1
- package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credentials.js +11 -10
- package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/identifiers.js +1 -1
- 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/proofs.js +41 -15
- package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js +76 -0
- package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -0
- package/lib/commonjs/utils/hooks/index.js +11 -0
- package/lib/commonjs/utils/hooks/index.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/index.js +12 -12
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js +190 -0
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -0
- package/lib/commonjs/utils/parsers/credential-sharing.js +25 -12
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +89 -57
- package/lib/commonjs/utils/parsers/credential.js.map +1 -1
- package/lib/commonjs/utils/parsers/index.js +11 -0
- package/lib/commonjs/utils/parsers/index.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.js +4 -4
- package/lib/commonjs/utils/parsers/query.js.map +1 -1
- package/lib/module/components/entity/entity-attributes.js +3 -1
- package/lib/module/components/entity/entity-attributes.js.map +1 -1
- package/lib/module/components/entity/entity-details-with-buttons.js +2 -1
- package/lib/module/components/entity/entity-details-with-buttons.js.map +1 -1
- package/lib/module/components/proof-request/index.js +4 -3
- package/lib/module/components/proof-request/index.js.map +1 -1
- package/lib/module/components/proof-request/select-share-credential-card-notice.js +29 -0
- package/lib/module/components/proof-request/select-share-credential-card-notice.js.map +1 -0
- package/lib/module/components/proof-request/share-credential-card-notice.js +28 -0
- package/lib/module/components/proof-request/share-credential-card-notice.js.map +1 -0
- package/lib/module/components/proof-request/{group.js → v1/group.js} +1 -1
- package/lib/module/components/proof-request/v1/group.js.map +1 -0
- package/lib/module/components/proof-request/v1/index.js +4 -0
- package/lib/module/components/proof-request/v1/index.js.map +1 -0
- package/lib/module/components/proof-request/{select-credential.js → v1/select-credential.js} +4 -4
- package/lib/module/components/proof-request/v1/select-credential.js.map +1 -0
- package/lib/module/components/proof-request/{share-credential.js → v1/share-credential.js} +26 -61
- package/lib/module/components/proof-request/v1/share-credential.js.map +1 -0
- package/lib/module/components/proof-request/v2/index.js +4 -0
- package/lib/module/components/proof-request/v2/index.js.map +1 -0
- package/lib/module/components/proof-request/v2/select-credential-v2.js +42 -0
- package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -0
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js +154 -0
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -0
- package/lib/module/components/proof-request/v2/share-credential-v2.js +122 -0
- package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -0
- package/lib/module/ui-components/buttons/share-button.js +1 -1
- package/lib/module/ui-components/buttons/share-button.js.map +1 -1
- package/lib/module/ui-components/camera/qr-code-scanner.js +5 -1
- package/lib/module/ui-components/camera/qr-code-scanner.js.map +1 -1
- package/lib/module/ui-components/credential/card/credential-details-list-item.js +19 -45
- package/lib/module/ui-components/credential/card/credential-details-list-item.js.map +1 -1
- package/lib/module/ui-components/credential/credential-attribute-item.js +3 -1
- package/lib/module/ui-components/credential/credential-attribute-item.js.map +1 -1
- package/lib/module/ui-components/credential/group/credential-group-header.js +64 -0
- package/lib/module/ui-components/credential/group/credential-group-header.js.map +1 -0
- package/lib/module/ui-components/credential/group/index.js +3 -0
- package/lib/module/ui-components/credential/group/index.js.map +1 -0
- package/lib/module/ui-components/credential/index.js +1 -0
- package/lib/module/ui-components/credential/index.js.map +1 -1
- package/lib/module/ui-components/header/foldable-header.js +29 -17
- package/lib/module/ui-components/header/foldable-header.js.map +1 -1
- package/lib/module/ui-components/index.js +1 -0
- package/lib/module/ui-components/index.js.map +1 -1
- package/lib/module/ui-components/loader/loading-result.js +1 -1
- package/lib/module/ui-components/loader/loading-result.js.map +1 -1
- package/lib/module/ui-components/pin/pin-lock-animation.js +477 -475
- package/lib/module/ui-components/pin/pin-lock-animation.js.map +1 -1
- package/lib/module/ui-components/proof-request/index.js +3 -0
- package/lib/module/ui-components/proof-request/index.js.map +1 -0
- package/lib/module/ui-components/proof-request/proof-request-set.js +39 -0
- package/lib/module/ui-components/proof-request/proof-request-set.js.map +1 -0
- package/lib/module/ui-components/screens/section-list-screen.js +15 -3
- package/lib/module/ui-components/screens/section-list-screen.js.map +1 -1
- package/lib/module/utils/array.js.map +1 -1
- package/lib/module/utils/hooks/app-state.js +27 -0
- package/lib/module/utils/hooks/app-state.js.map +1 -0
- package/lib/module/utils/hooks/core/backup.js +1 -1
- package/lib/module/utils/hooks/core/backup.js.map +1 -1
- package/lib/module/utils/hooks/core/cache.js +4 -1
- package/lib/module/utils/hooks/core/cache.js.map +1 -1
- package/lib/module/utils/hooks/core/credentials.js +12 -11
- package/lib/module/utils/hooks/core/credentials.js.map +1 -1
- package/lib/module/utils/hooks/core/identifiers.js +5 -5
- 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/proofs.js +42 -16
- package/lib/module/utils/hooks/core/proofs.js.map +1 -1
- package/lib/module/utils/hooks/core/wallet-unit.js +66 -0
- package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -0
- package/lib/module/utils/hooks/index.js +1 -0
- package/lib/module/utils/hooks/index.js.map +1 -1
- package/lib/module/utils/hooks/revocation/credential-status.js +1 -1
- package/lib/module/utils/hooks/revocation/credential-status.js.map +1 -1
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing-v2.js +177 -0
- package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -0
- package/lib/module/utils/parsers/credential-sharing.js +25 -12
- package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +89 -57
- package/lib/module/utils/parsers/credential.js.map +1 -1
- package/lib/module/utils/parsers/index.js +1 -0
- package/lib/module/utils/parsers/index.js.map +1 -1
- package/lib/module/utils/parsers/query.js +4 -4
- 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/proof-request/index.d.ts +4 -3
- package/lib/typescript/components/proof-request/select-share-credential-card-notice.d.ts +7 -0
- package/lib/typescript/components/proof-request/share-credential-card-notice.d.ts +6 -0
- package/lib/typescript/components/proof-request/v1/index.d.ts +3 -0
- package/lib/typescript/components/proof-request/{select-credential.d.ts → v1/select-credential.d.ts} +1 -1
- package/lib/typescript/components/proof-request/{share-credential.d.ts → v1/share-credential.d.ts} +1 -1
- package/lib/typescript/components/proof-request/v2/index.d.ts +3 -0
- package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +14 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +24 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +23 -0
- package/lib/typescript/ui-components/credential/group/credential-group-header.d.ts +10 -0
- package/lib/typescript/ui-components/credential/group/index.d.ts +3 -0
- package/lib/typescript/ui-components/credential/index.d.ts +1 -0
- package/lib/typescript/ui-components/header/foldable-header.d.ts +1 -0
- package/lib/typescript/ui-components/index.d.ts +1 -0
- package/lib/typescript/ui-components/loader/loading-result.d.ts +1 -1
- package/lib/typescript/ui-components/pin/pin-lock-animation.d.ts +311 -311
- package/lib/typescript/ui-components/proof-request/index.d.ts +3 -0
- package/lib/typescript/ui-components/proof-request/proof-request-set.d.ts +7 -0
- package/lib/typescript/ui-components/screens/section-list-screen.d.ts +4 -2
- package/lib/typescript/utils/array.d.ts +1 -0
- package/lib/typescript/utils/hooks/app-state.d.ts +5 -0
- package/lib/typescript/utils/hooks/core/backup.d.ts +1 -1
- package/lib/typescript/utils/hooks/core/credentials.d.ts +2 -1
- package/lib/typescript/utils/hooks/core/identifiers.d.ts +1 -1
- package/lib/typescript/utils/hooks/core/index.d.ts +1 -0
- package/lib/typescript/utils/hooks/core/proofs.d.ts +6 -10
- package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +9 -0
- package/lib/typescript/utils/hooks/index.d.ts +1 -0
- package/lib/typescript/utils/index.d.ts +1 -1
- package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +10 -0
- package/lib/typescript/utils/parsers/credential-sharing.d.ts +7 -2
- package/lib/typescript/utils/parsers/credential.d.ts +1 -2
- package/lib/typescript/utils/parsers/index.d.ts +1 -0
- package/lib/typescript/utils/parsers/query.d.ts +2 -2
- package/package.json +13 -7
- package/src/components/entity/entity-attributes.tsx +3 -0
- package/src/components/entity/entity-details-with-buttons.tsx +1 -0
- package/src/components/proof-request/index.ts +4 -3
- package/src/components/proof-request/select-share-credential-card-notice.tsx +37 -0
- package/src/components/proof-request/share-credential-card-notice.tsx +33 -0
- package/src/components/proof-request/{group.tsx → v1/group.tsx} +1 -1
- package/src/components/proof-request/v1/index.ts +3 -0
- package/src/components/proof-request/{select-credential.tsx → v1/select-credential.tsx} +7 -4
- package/src/components/proof-request/{share-credential.tsx → v1/share-credential.tsx} +30 -51
- package/src/components/proof-request/v2/index.ts +3 -0
- package/src/components/proof-request/v2/select-credential-v2.tsx +52 -0
- package/src/components/proof-request/v2/share-credential-v2-group.tsx +258 -0
- package/src/components/proof-request/v2/share-credential-v2.tsx +202 -0
- package/src/ui-components/buttons/share-button.tsx +1 -1
- package/src/ui-components/camera/qr-code-scanner.tsx +11 -2
- package/src/ui-components/credential/card/credential-details-list-item.tsx +27 -49
- package/src/ui-components/credential/credential-attribute-item.tsx +2 -0
- package/src/ui-components/credential/group/credential-group-header.tsx +70 -0
- package/src/ui-components/credential/group/index.ts +4 -0
- package/src/ui-components/credential/index.ts +1 -0
- package/src/ui-components/header/foldable-header.tsx +31 -16
- package/src/ui-components/index.ts +1 -0
- package/src/ui-components/loader/loading-result.tsx +1 -1
- package/src/ui-components/pin/pin-lock-animation.tsx +240 -278
- package/src/ui-components/proof-request/index.ts +4 -0
- package/src/ui-components/proof-request/proof-request-set.tsx +46 -0
- package/src/ui-components/screens/section-list-screen.tsx +18 -4
- package/src/utils/array.ts +4 -0
- package/src/utils/hooks/app-state.ts +29 -0
- package/src/utils/hooks/core/backup.ts +2 -5
- package/src/utils/hooks/core/cache.ts +3 -0
- package/src/utils/hooks/core/credentials.ts +14 -6
- package/src/utils/hooks/core/identifiers.ts +15 -14
- package/src/utils/hooks/core/index.ts +2 -1
- package/src/utils/hooks/core/proofs.ts +40 -22
- package/src/utils/hooks/core/wallet-unit.ts +71 -0
- package/src/utils/hooks/index.ts +1 -0
- package/src/utils/hooks/revocation/credential-status.ts +1 -1
- package/src/utils/index.ts +1 -1
- package/src/utils/parsers/credential-sharing-v2.tsx +278 -0
- package/src/utils/parsers/credential-sharing.tsx +63 -40
- package/src/utils/parsers/credential.ts +100 -57
- package/src/utils/parsers/index.ts +1 -0
- package/src/utils/parsers/query.ts +6 -5
- package/lib/commonjs/components/proof-request/group.js.map +0 -1
- package/lib/commonjs/components/proof-request/select-credential.js.map +0 -1
- package/lib/commonjs/components/proof-request/share-credential.js.map +0 -1
- package/lib/module/components/proof-request/group.js.map +0 -1
- package/lib/module/components/proof-request/select-credential.js.map +0 -1
- package/lib/module/components/proof-request/share-credential.js.map +0 -1
- /package/lib/typescript/components/proof-request/{group.d.ts → v1/group.d.ts} +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { FunctionComponent, PropsWithChildren } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Typography } from '../text';
|
|
5
|
+
import { useAppColorScheme } from '../theme';
|
|
6
|
+
|
|
7
|
+
export type ProofRequestSetProps = {
|
|
8
|
+
headerLabel?: string;
|
|
9
|
+
showHeader?: boolean;
|
|
10
|
+
showSeparator?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const ProofRequestSet: FunctionComponent<PropsWithChildren<ProofRequestSetProps>> = ({
|
|
14
|
+
children,
|
|
15
|
+
headerLabel,
|
|
16
|
+
showHeader = false,
|
|
17
|
+
showSeparator = true,
|
|
18
|
+
}) => {
|
|
19
|
+
const colorScheme = useAppColorScheme();
|
|
20
|
+
return (
|
|
21
|
+
<View style={styles.set}>
|
|
22
|
+
{showSeparator && <View style={[styles.separator, { backgroundColor: colorScheme.grayDark }]} />}
|
|
23
|
+
{showHeader && headerLabel && (
|
|
24
|
+
<Typography align="left" color={colorScheme.text} preset="m" style={styles.header}>
|
|
25
|
+
{headerLabel}
|
|
26
|
+
</Typography>
|
|
27
|
+
)}
|
|
28
|
+
{children}
|
|
29
|
+
</View>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
header: {
|
|
35
|
+
marginBottom: 16,
|
|
36
|
+
},
|
|
37
|
+
separator: {
|
|
38
|
+
height: 1,
|
|
39
|
+
marginBottom: 16,
|
|
40
|
+
marginHorizontal: 4,
|
|
41
|
+
opacity: 0.5,
|
|
42
|
+
},
|
|
43
|
+
set: {
|
|
44
|
+
marginTop: 16,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { Platform, SectionList, SectionListProps, StyleSheet, View, ViewProps, ViewStyle } from 'react-native';
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
|
|
@@ -13,13 +13,15 @@ export type SectionListScreenProps<ItemT, SectionT> = ViewProps & {
|
|
|
13
13
|
static?: boolean;
|
|
14
14
|
title: string;
|
|
15
15
|
};
|
|
16
|
-
list: Omit<SectionListProps<ItemT, SectionT>, 'ListHeaderComponent' | 'onScroll'
|
|
16
|
+
list: Omit<SectionListProps<ItemT, SectionT>, 'ListHeaderComponent' | 'onScroll'> & {
|
|
17
|
+
header?: React.ComponentType<any> | React.ReactElement;
|
|
18
|
+
};
|
|
17
19
|
modalPresentation?: boolean;
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
const SectionListScreen = <ItemT, SectionT>({
|
|
21
23
|
header,
|
|
22
|
-
list: { contentContainerStyle, stickySectionHeadersEnabled, ...listProps },
|
|
24
|
+
list: { contentContainerStyle, header: listHeader, stickySectionHeadersEnabled, ...listProps },
|
|
23
25
|
modalPresentation,
|
|
24
26
|
style,
|
|
25
27
|
...viewProps
|
|
@@ -41,10 +43,22 @@ const SectionListScreen = <ItemT, SectionT>({
|
|
|
41
43
|
headerPaddingStyle = styles.modalHeaderWithoutHandle;
|
|
42
44
|
}
|
|
43
45
|
|
|
46
|
+
const headerView: React.ReactElement | undefined = useMemo(() => {
|
|
47
|
+
if (!listHeader) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
if (React.isValidElement(listHeader)) {
|
|
51
|
+
return listHeader;
|
|
52
|
+
} else {
|
|
53
|
+
const HeaderComponent = listHeader as React.ComponentType<any>;
|
|
54
|
+
return <HeaderComponent />;
|
|
55
|
+
}
|
|
56
|
+
}, [listHeader]);
|
|
57
|
+
|
|
44
58
|
return (
|
|
45
59
|
<View style={[styles.container, { backgroundColor: colorScheme.background }, style]} {...viewProps}>
|
|
46
60
|
<SectionList<ItemT, SectionT>
|
|
47
|
-
ListHeaderComponent={!header.static ? <ListTitleHeader title={header.title} /> :
|
|
61
|
+
ListHeaderComponent={!header.static ? <View><ListTitleHeader title={header.title} />{headerView}</View> : headerView}
|
|
48
62
|
contentContainerStyle={[contentInsetsStyle, contentContainerStyle]}
|
|
49
63
|
onScroll={onScroll}
|
|
50
64
|
scrollEventThrottle={100}
|
package/src/utils/array.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { AppState } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Returns current app state
|
|
6
|
+
*/
|
|
7
|
+
export function useAppState() {
|
|
8
|
+
const [appState, setAppState] = useState(AppState.currentState);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const subscription = AppState.addEventListener('change', setAppState);
|
|
12
|
+
return () => subscription.remove();
|
|
13
|
+
}, []);
|
|
14
|
+
|
|
15
|
+
return appState;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function useIsAppActive(): boolean | undefined {
|
|
19
|
+
switch (useAppState()) {
|
|
20
|
+
case 'active':
|
|
21
|
+
case 'extension':
|
|
22
|
+
return true;
|
|
23
|
+
case 'inactive':
|
|
24
|
+
case 'background':
|
|
25
|
+
return false;
|
|
26
|
+
default:
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -70,10 +70,7 @@ export const useRollbackImport = () => {
|
|
|
70
70
|
* @param {IdentifiersInitializationConfig} config Select desired keys/dids to be restored/created
|
|
71
71
|
* @returns [hwIdentifierId, swIdentifierId]
|
|
72
72
|
*/
|
|
73
|
-
export const useBackupFinalizeImportProcedure = ({
|
|
74
|
-
generateHwKey,
|
|
75
|
-
generateSwKey,
|
|
76
|
-
}: IdentifiersInitializationConfig) => {
|
|
73
|
+
export const useBackupFinalizeImportProcedure = ({ generateHwKey, generateSwKey }: IdentifiersInitializationConfig) => {
|
|
77
74
|
const { mutateAsync: finalizeImport } = useFinalizeImport();
|
|
78
75
|
const { core, organisationId } = useONECore();
|
|
79
76
|
|
|
@@ -84,7 +81,7 @@ export const useBackupFinalizeImportProcedure = ({
|
|
|
84
81
|
let swIdentifierId: string | undefined;
|
|
85
82
|
if (generateSwKey) {
|
|
86
83
|
const identifiers = await core.getIdentifiers({
|
|
87
|
-
|
|
84
|
+
states: [IdentifierStateEnum.ACTIVE],
|
|
88
85
|
organisationId,
|
|
89
86
|
page: 0,
|
|
90
87
|
pageSize: 1,
|
|
@@ -16,6 +16,9 @@ const cacheTypeToQueryKeys: Record<CacheType, string[]> = {
|
|
|
16
16
|
[CacheType.VCT_METADATA]: CREDENTIAL_QUERY_KEYS,
|
|
17
17
|
[CacheType.JSON_SCHEMA]: CREDENTIAL_QUERY_KEYS,
|
|
18
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,
|
|
19
22
|
};
|
|
20
23
|
|
|
21
24
|
export const useCacheClear = () => {
|
|
@@ -10,9 +10,10 @@ import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from 'react-q
|
|
|
10
10
|
|
|
11
11
|
import { getQueryKeyFromCredentialListQueryParams } from '../../parsers/query';
|
|
12
12
|
import { useONECore } from './core-context';
|
|
13
|
-
import { CREDENTIAL_SCHEMA_LIST_QUERY_KEY } from './credential-schemas';
|
|
13
|
+
import { CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY, CREDENTIAL_SCHEMA_LIST_QUERY_KEY } from './credential-schemas';
|
|
14
14
|
import { OneErrorCode } from './error-code';
|
|
15
15
|
import { HISTORY_LIST_QUERY_KEY } from './history';
|
|
16
|
+
import { PROOF_LIST_QUERY_KEY } from './proofs';
|
|
16
17
|
|
|
17
18
|
const PAGE_SIZE = 20;
|
|
18
19
|
export const CREDENTIAL_LIST_QUERY_KEY = 'credential-list';
|
|
@@ -30,7 +31,7 @@ export const useCredentials = (queryParams?: Partial<CredentialListQuery>) => {
|
|
|
30
31
|
page: 0,
|
|
31
32
|
// TODO: workaround pagination for now, until it's supported by UI
|
|
32
33
|
pageSize: 10000,
|
|
33
|
-
|
|
34
|
+
states: [CredentialStateEnum.ACCEPTED, CredentialStateEnum.SUSPENDED, CredentialStateEnum.REVOKED],
|
|
34
35
|
...queryParams,
|
|
35
36
|
});
|
|
36
37
|
return values;
|
|
@@ -55,7 +56,7 @@ export const usePagedCredentials = (queryParams?: Partial<CredentialListQuery>)
|
|
|
55
56
|
organisationId,
|
|
56
57
|
page: pageParam,
|
|
57
58
|
pageSize: PAGE_SIZE,
|
|
58
|
-
|
|
59
|
+
states: [CredentialStateEnum.ACCEPTED, CredentialStateEnum.SUSPENDED, CredentialStateEnum.REVOKED],
|
|
59
60
|
...queryParams,
|
|
60
61
|
}),
|
|
61
62
|
{
|
|
@@ -87,9 +88,12 @@ export const useInvitationHandler = () => {
|
|
|
87
88
|
core.handleInvitation({ organisationId, ...request }),
|
|
88
89
|
{
|
|
89
90
|
onSuccess: async (result: InvitationResult) => {
|
|
90
|
-
if ('
|
|
91
|
+
if ('proofId' in result) {
|
|
92
|
+
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
93
|
+
} else {
|
|
91
94
|
await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);
|
|
92
95
|
await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);
|
|
96
|
+
await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);
|
|
93
97
|
}
|
|
94
98
|
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
95
99
|
},
|
|
@@ -107,14 +111,17 @@ export const useCredentialAccept = () => {
|
|
|
107
111
|
interactionId: string;
|
|
108
112
|
keyId?: string;
|
|
109
113
|
txCode?: string;
|
|
114
|
+
holderWalletUnitId?: string;
|
|
110
115
|
};
|
|
111
116
|
|
|
112
117
|
return useMutation(
|
|
113
|
-
async (
|
|
114
|
-
core.holderAcceptCredential(
|
|
118
|
+
async (credentialAcceptHookParams: CredentialAcceptHookParams) =>
|
|
119
|
+
core.holderAcceptCredential(credentialAcceptHookParams),
|
|
115
120
|
{
|
|
116
121
|
onSuccess: async () => {
|
|
117
122
|
await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);
|
|
123
|
+
await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);
|
|
124
|
+
await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);
|
|
118
125
|
await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);
|
|
119
126
|
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
120
127
|
},
|
|
@@ -200,6 +207,7 @@ export const useContinueIssuance = () => {
|
|
|
200
207
|
onSuccess: async () => {
|
|
201
208
|
await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);
|
|
202
209
|
await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);
|
|
210
|
+
await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);
|
|
203
211
|
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
204
212
|
},
|
|
205
213
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IdentifierListQuery, IdentifierStateEnum, IdentifierTypeEnum } from
|
|
2
|
-
import { useQuery } from
|
|
1
|
+
import { IdentifierListQuery, IdentifierStateEnum, IdentifierTypeEnum } from '@procivis/react-native-one-core';
|
|
2
|
+
import { useQuery } from 'react-query';
|
|
3
3
|
|
|
4
|
-
import { getQueryKeyFromIdentifierListQueryParams } from
|
|
5
|
-
import { useONECore } from
|
|
4
|
+
import { getQueryKeyFromIdentifierListQueryParams } from '../../parsers';
|
|
5
|
+
import { useONECore } from './core-context';
|
|
6
6
|
|
|
7
7
|
export const IDENTIFIER_DETAIL_QUERY_KEY = 'identifier-detail';
|
|
8
8
|
export const IDENTIFIER_LIST_QUERY_KEY = 'identifier-list';
|
|
@@ -19,21 +19,22 @@ export const useIdentifierDetails = (identifierId: string | undefined) => {
|
|
|
19
19
|
keepPreviousData: true,
|
|
20
20
|
},
|
|
21
21
|
);
|
|
22
|
-
}
|
|
22
|
+
};
|
|
23
23
|
|
|
24
24
|
export const useIdentifiers = (identifierFilter?: Partial<IdentifierListQuery>) => {
|
|
25
25
|
const { core, organisationId } = useONECore();
|
|
26
26
|
|
|
27
27
|
return useQuery(
|
|
28
28
|
[IDENTIFIER_LIST_QUERY_KEY, ...getQueryKeyFromIdentifierListQueryParams(identifierFilter)],
|
|
29
|
-
({ pageParam = 0 }) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
({ pageParam = 0 }) =>
|
|
30
|
+
core.getIdentifiers({
|
|
31
|
+
types: [IdentifierTypeEnum.DID],
|
|
32
|
+
isRemote: false,
|
|
33
|
+
page: pageParam,
|
|
34
|
+
states: [IdentifierStateEnum.ACTIVE],
|
|
35
|
+
organisationId: organisationId,
|
|
36
|
+
pageSize: PAGE_SIZE,
|
|
37
|
+
...identifierFilter,
|
|
38
|
+
}),
|
|
38
39
|
);
|
|
39
40
|
};
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Config,
|
|
3
3
|
CreateProofRequest,
|
|
4
|
+
HistoryActionEnum,
|
|
5
|
+
HistoryEntityTypeEnum,
|
|
6
|
+
HistoryErrorMetadata,
|
|
4
7
|
IdentifierListQuery,
|
|
5
8
|
OneError,
|
|
6
9
|
PresentationSubmitCredentialRequest,
|
|
7
10
|
ProofListQuery,
|
|
8
11
|
ProofSchema,
|
|
9
12
|
ProofStateEnum,
|
|
13
|
+
ProposeProofRequest,
|
|
10
14
|
ShareProofRequest,
|
|
11
15
|
} from '@procivis/react-native-one-core';
|
|
12
16
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -37,11 +41,31 @@ export const useProofDetail = (proofId: string | undefined) => {
|
|
|
37
41
|
};
|
|
38
42
|
|
|
39
43
|
export const useProofState = (proofId: string | undefined, isPolling: boolean) => {
|
|
40
|
-
const { core } = useONECore();
|
|
44
|
+
const { core, organisationId } = useONECore();
|
|
41
45
|
|
|
42
46
|
return useQuery(
|
|
43
47
|
[PROOF_STATE_QUERY_KEY, proofId],
|
|
44
|
-
|
|
48
|
+
async () => {
|
|
49
|
+
if (!proofId) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const state = await core.getProof(proofId).then((proof) => proof.state);
|
|
54
|
+
let metadata: HistoryErrorMetadata | undefined;
|
|
55
|
+
if (state === ProofStateEnum.ERROR) {
|
|
56
|
+
metadata = await core
|
|
57
|
+
.getHistory({
|
|
58
|
+
organisationId,
|
|
59
|
+
page: 0,
|
|
60
|
+
pageSize: 1,
|
|
61
|
+
entityId: proofId,
|
|
62
|
+
entityTypes: [HistoryEntityTypeEnum.PROOF],
|
|
63
|
+
actions: [HistoryActionEnum.ERRORED],
|
|
64
|
+
})
|
|
65
|
+
.then((result) => result.values[0]?.metadata as HistoryErrorMetadata);
|
|
66
|
+
}
|
|
67
|
+
return { state, metadata };
|
|
68
|
+
},
|
|
45
69
|
{
|
|
46
70
|
enabled: Boolean(proofId),
|
|
47
71
|
refetchInterval: isPolling ? 1000 : false,
|
|
@@ -60,6 +84,7 @@ export const useProofUrl = () => {
|
|
|
60
84
|
core.shareProof(proofId, request ?? {}).then((proof) => proof.url),
|
|
61
85
|
{
|
|
62
86
|
onSuccess: async () => {
|
|
87
|
+
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
63
88
|
await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);
|
|
64
89
|
await queryClient.invalidateQueries(PROOF_STATE_QUERY_KEY);
|
|
65
90
|
},
|
|
@@ -75,22 +100,19 @@ export const useProofAccept = () => {
|
|
|
75
100
|
async ({
|
|
76
101
|
interactionId,
|
|
77
102
|
credentials,
|
|
78
|
-
didId,
|
|
79
|
-
identifierId,
|
|
80
|
-
keyId,
|
|
81
103
|
}: {
|
|
82
104
|
credentials: Record<string, PresentationSubmitCredentialRequest>;
|
|
83
|
-
didId?: string;
|
|
84
|
-
identifierId?: string;
|
|
85
105
|
interactionId: string;
|
|
86
|
-
|
|
87
|
-
}) => core.holderSubmitProof(interactionId, credentials, didId, identifierId, keyId),
|
|
106
|
+
}) => core.holderSubmitProof(interactionId, credentials),
|
|
88
107
|
{
|
|
89
108
|
onError: async (err) => {
|
|
90
109
|
reportException(err, 'Proof submission failure');
|
|
110
|
+
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
91
111
|
await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);
|
|
112
|
+
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
92
113
|
},
|
|
93
114
|
onSuccess: async () => {
|
|
115
|
+
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
94
116
|
await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);
|
|
95
117
|
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
96
118
|
},
|
|
@@ -112,6 +134,7 @@ export const useProofReject = () => {
|
|
|
112
134
|
}),
|
|
113
135
|
{
|
|
114
136
|
onSuccess: async () => {
|
|
137
|
+
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
115
138
|
await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);
|
|
116
139
|
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
117
140
|
},
|
|
@@ -136,19 +159,15 @@ export enum VerificationEngagement {
|
|
|
136
159
|
NFC = 'NFC',
|
|
137
160
|
}
|
|
138
161
|
|
|
139
|
-
export interface ProposeProofRequest {
|
|
140
|
-
exchange: VerificationProtocol;
|
|
141
|
-
engagement: VerificationEngagement[];
|
|
142
|
-
}
|
|
143
|
-
|
|
144
162
|
export const useProposeProof = () => {
|
|
145
163
|
const queryClient = useQueryClient();
|
|
146
164
|
const { core, organisationId } = useONECore();
|
|
147
165
|
|
|
148
166
|
return useMutation(
|
|
149
|
-
async (
|
|
167
|
+
async (request: Omit<ProposeProofRequest, 'organisationId'>) => core.proposeProof({ organisationId, ...request }),
|
|
150
168
|
{
|
|
151
169
|
onSuccess: async () => {
|
|
170
|
+
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
152
171
|
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
153
172
|
},
|
|
154
173
|
},
|
|
@@ -207,8 +226,7 @@ export const useProofCreate = () => {
|
|
|
207
226
|
return useMutation(async (data: CreateProofRequest) => core.createProof(data), {
|
|
208
227
|
onSuccess: async () => {
|
|
209
228
|
await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);
|
|
210
|
-
await queryClient.invalidateQueries(
|
|
211
|
-
await queryClient.invalidateQueries(PROOF_DETAIL_QUERY_KEY);
|
|
229
|
+
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
212
230
|
},
|
|
213
231
|
});
|
|
214
232
|
};
|
|
@@ -272,7 +290,7 @@ export const useProofForSchemaIdWithTransport = (
|
|
|
272
290
|
setProofId(undefined);
|
|
273
291
|
setDeleting(false);
|
|
274
292
|
})
|
|
275
|
-
.catch(() => {});
|
|
293
|
+
.catch(() => { });
|
|
276
294
|
}, [proofIdRef, deleteProof, proofSchemaId, transport, setProofId]);
|
|
277
295
|
|
|
278
296
|
useEffect(() => {
|
|
@@ -280,7 +298,7 @@ export const useProofForSchemaIdWithTransport = (
|
|
|
280
298
|
return;
|
|
281
299
|
}
|
|
282
300
|
|
|
283
|
-
if (proofState !== ProofStateEnum.CREATED && proofState !== ProofStateEnum.PENDING) {
|
|
301
|
+
if (proofState?.state !== ProofStateEnum.CREATED && proofState?.state !== ProofStateEnum.PENDING) {
|
|
284
302
|
setProofId(undefined);
|
|
285
303
|
} else {
|
|
286
304
|
setDeleting(true);
|
|
@@ -289,7 +307,7 @@ export const useProofForSchemaIdWithTransport = (
|
|
|
289
307
|
setProofId(undefined);
|
|
290
308
|
setDeleting(false);
|
|
291
309
|
})
|
|
292
|
-
.catch(() => {});
|
|
310
|
+
.catch(() => { });
|
|
293
311
|
}
|
|
294
312
|
}, [deleteProof, enabled, proofId, proofState, setProofId]);
|
|
295
313
|
|
|
@@ -316,7 +334,7 @@ export const useProofForSchemaIdWithTransport = (
|
|
|
316
334
|
.then((id) => {
|
|
317
335
|
setProofId(id);
|
|
318
336
|
})
|
|
319
|
-
.catch(() => {});
|
|
337
|
+
.catch(() => { });
|
|
320
338
|
}, [proofSchemaId, identifiers, identifierFilter, createProof, enabled, transport, proofId, setProofId, deleting]);
|
|
321
339
|
|
|
322
340
|
return deleting ? undefined : proofId;
|
|
@@ -352,7 +370,7 @@ export const useShareProof = (proofUrlProps: ProofUrlHookParams | undefined, ena
|
|
|
352
370
|
|
|
353
371
|
// reset when proofId changes or the proof was retracted
|
|
354
372
|
useEffect(() => {
|
|
355
|
-
if (!proofUrlProps?.proofId || proofState === ProofStateEnum.CREATED) {
|
|
373
|
+
if (!proofUrlProps?.proofId || proofState?.state === ProofStateEnum.CREATED) {
|
|
356
374
|
setSharedProof(undefined);
|
|
357
375
|
}
|
|
358
376
|
}, [proofUrlProps?.proofId, proofState]);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { HolderWalletUnitDetail, WalletProvider, WalletUnitStatus } from '@procivis/react-native-one-core';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
4
|
+
|
|
5
|
+
import { reportException } from '../../reporting';
|
|
6
|
+
import { useONECore } from './core-context';
|
|
7
|
+
|
|
8
|
+
export const WALLET_UNIT_QUERY_KEY = 'wallet-unit';
|
|
9
|
+
|
|
10
|
+
export const useWalletUnitDetail = (walletUnitId: HolderWalletUnitDetail['id'] | undefined, active = true) => {
|
|
11
|
+
const { core } = useONECore();
|
|
12
|
+
|
|
13
|
+
return useQuery(
|
|
14
|
+
[WALLET_UNIT_QUERY_KEY, walletUnitId],
|
|
15
|
+
() => (walletUnitId ? core.holderGetWalletUnit(walletUnitId) : undefined),
|
|
16
|
+
{
|
|
17
|
+
enabled: active && Boolean(walletUnitId),
|
|
18
|
+
keepPreviousData: true,
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const useRegisterWalletUnit = () => {
|
|
24
|
+
const queryClient = useQueryClient();
|
|
25
|
+
const { core, organisationId } = useONECore();
|
|
26
|
+
|
|
27
|
+
return useMutation(
|
|
28
|
+
async (walletProvider: WalletProvider) =>
|
|
29
|
+
core.holderRegisterWalletUnit({
|
|
30
|
+
keyType: 'ECDSA',
|
|
31
|
+
organisationId,
|
|
32
|
+
walletProvider,
|
|
33
|
+
}),
|
|
34
|
+
|
|
35
|
+
{
|
|
36
|
+
onSuccess: () => queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY),
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const useWalletUnitStatus = () => {
|
|
42
|
+
const queryClient = useQueryClient();
|
|
43
|
+
const { core } = useONECore();
|
|
44
|
+
|
|
45
|
+
return useMutation(async (walletUnitId: HolderWalletUnitDetail['id']) => core.holderWalletUnitStatus(walletUnitId), {
|
|
46
|
+
onError: async (err) => {
|
|
47
|
+
reportException(err, 'Refresh wallet unit failure');
|
|
48
|
+
await queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY);
|
|
49
|
+
},
|
|
50
|
+
onSuccess: () => queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY),
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const useWalletUnitCheck = (walletUnitId: HolderWalletUnitDetail['id'] | undefined) => {
|
|
55
|
+
const { data: walletUnitDetail, isLoading } = useWalletUnitDetail(walletUnitId);
|
|
56
|
+
const { mutateAsync: refreshWalletUnit, isLoading: isRefreshing, status: refreshStatus } = useWalletUnitStatus();
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (isLoading || refreshStatus !== 'idle') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (walletUnitId && walletUnitDetail?.status === WalletUnitStatus.ACTIVE) {
|
|
63
|
+
void refreshWalletUnit(walletUnitId);
|
|
64
|
+
}
|
|
65
|
+
}, [isLoading, refreshStatus, walletUnitDetail, refreshWalletUnit, walletUnitId]);
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
isLoading: isLoading || isRefreshing,
|
|
69
|
+
walletUnitDetail: isLoading || isRefreshing ? undefined : walletUnitDetail,
|
|
70
|
+
};
|
|
71
|
+
};
|
package/src/utils/hooks/index.ts
CHANGED
|
@@ -18,7 +18,7 @@ export const useCredentialStatusCheck = (credentialIds?: string[], forceRefresh
|
|
|
18
18
|
const { mutateAsync: check } = useCredentialRevocationCheck(forceRefresh);
|
|
19
19
|
const { data: credentials } = useCredentials({
|
|
20
20
|
ids: credentialIds,
|
|
21
|
-
|
|
21
|
+
states: [CredentialStateEnum.ACCEPTED, CredentialStateEnum.SUSPENDED],
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
const checkCredentialsStatus = useCallback(async () => {
|