@procivis/one-react-native-components 0.3.130 → 0.3.142
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/history/history-list-item-icon.js +3 -0
- package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item.js +3 -4
- package/lib/commonjs/components/history/history-list-item.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +3 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/commonjs/ui-components/buttons/scan-button.js +122 -27
- package/lib/commonjs/ui-components/buttons/scan-button.js.map +1 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js +37 -18
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/commonjs/ui-components/credential/credential-attribute-item.js +13 -4
- package/lib/commonjs/ui-components/credential/credential-attribute-item.js.map +1 -1
- package/lib/commonjs/ui-components/history/history-section-list-item.js +2 -2
- package/lib/commonjs/ui-components/history/history-section-list-item.js.map +1 -1
- package/lib/commonjs/ui-components/history/index.js +0 -8
- package/lib/commonjs/ui-components/history/index.js.map +1 -1
- package/lib/commonjs/ui-components/icons/icons.js +36 -2
- package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
- package/lib/commonjs/ui-components/list/index.js +8 -0
- package/lib/commonjs/ui-components/list/index.js.map +1 -1
- package/lib/commonjs/ui-components/{history/history-item.js → list/list-item.js} +32 -22
- package/lib/commonjs/ui-components/list/list-item.js.map +1 -0
- package/lib/commonjs/ui-components/list/wallet/empty-list.js +2 -1
- package/lib/commonjs/ui-components/list/wallet/empty-list.js.map +1 -1
- package/lib/commonjs/ui-components/notice/wallet-notice.js +4 -2
- package/lib/commonjs/ui-components/notice/wallet-notice.js.map +1 -1
- package/lib/commonjs/ui-components/text/expandableTypography.js +64 -0
- package/lib/commonjs/ui-components/text/expandableTypography.js.map +1 -0
- package/lib/commonjs/ui-components/text/index.js +15 -0
- package/lib/commonjs/ui-components/text/index.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credential-schemas.js +24 -1
- package/lib/commonjs/utils/hooks/core/credential-schemas.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js +20 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js +8 -7
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing.js +17 -11
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +12 -4
- 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/module/components/history/history-list-item-icon.js +3 -0
- package/lib/module/components/history/history-list-item-icon.js.map +1 -1
- package/lib/module/components/history/history-list-item.js +4 -5
- package/lib/module/components/history/history-list-item.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2.js +3 -1
- package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/module/ui-components/buttons/scan-button.js +124 -29
- package/lib/module/ui-components/buttons/scan-button.js.map +1 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js +37 -18
- package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/module/ui-components/credential/credential-attribute-item.js +13 -4
- package/lib/module/ui-components/credential/credential-attribute-item.js.map +1 -1
- package/lib/module/ui-components/history/history-section-list-item.js +2 -2
- package/lib/module/ui-components/history/history-section-list-item.js.map +1 -1
- package/lib/module/ui-components/history/index.js +0 -2
- package/lib/module/ui-components/history/index.js.map +1 -1
- package/lib/module/ui-components/icons/icons.js +32 -0
- package/lib/module/ui-components/icons/icons.js.map +1 -1
- package/lib/module/ui-components/list/index.js +2 -0
- package/lib/module/ui-components/list/index.js.map +1 -1
- package/lib/module/ui-components/{history/history-item.js → list/list-item.js} +32 -22
- package/lib/module/ui-components/list/list-item.js.map +1 -0
- package/lib/module/ui-components/list/wallet/empty-list.js +2 -1
- package/lib/module/ui-components/list/wallet/empty-list.js.map +1 -1
- package/lib/module/ui-components/notice/wallet-notice.js +4 -2
- package/lib/module/ui-components/notice/wallet-notice.js.map +1 -1
- package/lib/module/ui-components/text/expandableTypography.js +55 -0
- package/lib/module/ui-components/text/expandableTypography.js.map +1 -0
- package/lib/module/ui-components/text/index.js +2 -1
- package/lib/module/ui-components/text/index.js.map +1 -1
- package/lib/module/utils/hooks/core/credential-schemas.js +24 -1
- package/lib/module/utils/hooks/core/credential-schemas.js.map +1 -1
- package/lib/module/utils/hooks/core/wallet-unit.js +18 -0
- package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing-v2.js +8 -7
- package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing.js +18 -12
- package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +10 -4
- 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/typescript/ui-components/buttons/scan-button.d.ts +9 -3
- package/lib/typescript/ui-components/credential/card/credential-details-card.d.ts +3 -0
- package/lib/typescript/ui-components/credential/credential-attribute-item.d.ts +3 -0
- package/lib/typescript/ui-components/history/history-section-list-item.d.ts +2 -2
- package/lib/typescript/ui-components/history/index.d.ts +0 -3
- package/lib/typescript/ui-components/icons/icons.d.ts +2 -0
- package/lib/typescript/ui-components/list/index.d.ts +3 -0
- package/lib/typescript/ui-components/{history/history-item.d.ts → list/list-item.d.ts} +4 -4
- package/lib/typescript/ui-components/list/wallet/empty-list.d.ts +2 -2
- package/lib/typescript/ui-components/text/expandableTypography.d.ts +10 -0
- package/lib/typescript/ui-components/text/index.d.ts +2 -1
- package/lib/typescript/ui-components/text/typography.d.ts +14 -14
- package/lib/typescript/utils/hooks/app-state.d.ts +1 -1
- package/lib/typescript/utils/hooks/core/credentials.d.ts +1 -1
- package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +5 -1
- package/lib/typescript/utils/parsers/credential-sharing.d.ts +4 -3
- package/lib/typescript/utils/parsers/credential.d.ts +2 -1
- package/lib/typescript/utils/parsers/query.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/history/history-list-item-icon.tsx +3 -0
- package/src/components/history/history-list-item.tsx +3 -3
- package/src/components/proof-request/v2/share-credential-v2.tsx +2 -0
- package/src/ui-components/buttons/scan-button.tsx +130 -38
- package/src/ui-components/credential/card/credential-details-card.tsx +46 -19
- package/src/ui-components/credential/credential-attribute-item.tsx +15 -3
- package/src/ui-components/history/history-section-list-item.tsx +3 -3
- package/src/ui-components/history/index.ts +0 -3
- package/src/ui-components/icons/icons.tsx +24 -0
- package/src/ui-components/list/index.ts +3 -0
- package/src/ui-components/{history/history-item.tsx → list/list-item.tsx} +36 -33
- package/src/ui-components/list/wallet/empty-list.tsx +11 -8
- package/src/ui-components/notice/wallet-notice.tsx +4 -2
- package/src/ui-components/text/expandableTypography.tsx +71 -0
- package/src/ui-components/text/index.ts +2 -1
- package/src/utils/hooks/core/credential-schemas.ts +23 -1
- package/src/utils/hooks/core/wallet-unit.ts +21 -0
- package/src/utils/parsers/credential-sharing-v2.tsx +5 -6
- package/src/utils/parsers/credential-sharing.tsx +20 -9
- package/src/utils/parsers/credential.ts +14 -3
- package/src/utils/parsers/query.ts +2 -0
- package/lib/commonjs/ui-components/history/history-item.js.map +0 -1
- package/lib/module/ui-components/history/history-item.js.map +0 -1
|
@@ -6,7 +6,8 @@ import { TouchableOpacity } from '../accessibility/accessibilityHistoryWrappers'
|
|
|
6
6
|
import Typography from '../text/typography';
|
|
7
7
|
import { useAppColorScheme } from '../theme/color-scheme-context';
|
|
8
8
|
|
|
9
|
-
export type
|
|
9
|
+
export type ListItemViewProps = {
|
|
10
|
+
accessory?: string | ComponentType<any> | ReactElement;
|
|
10
11
|
first?: boolean;
|
|
11
12
|
icon: ComponentType<any> | ReactElement;
|
|
12
13
|
info?: string;
|
|
@@ -15,22 +16,31 @@ export type HistoryItemViewProps = {
|
|
|
15
16
|
onPress?: () => void;
|
|
16
17
|
style?: StyleProp<ViewStyle>;
|
|
17
18
|
testID?: string;
|
|
18
|
-
time: string;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
first,
|
|
23
|
-
icon,
|
|
24
|
-
label,
|
|
25
|
-
info,
|
|
26
|
-
last,
|
|
27
|
-
style,
|
|
28
|
-
time,
|
|
29
|
-
onPress,
|
|
30
|
-
testID,
|
|
31
|
-
}) => {
|
|
21
|
+
const ListItemView: FC<ListItemViewProps> = ({ accessory, first, icon, label, info, last, style, onPress, testID }) => {
|
|
32
22
|
const colorScheme = useAppColorScheme();
|
|
33
23
|
|
|
24
|
+
const accessoryView: ReactElement | undefined = useMemo(() => {
|
|
25
|
+
if (typeof accessory === 'string') {
|
|
26
|
+
return (
|
|
27
|
+
<Typography
|
|
28
|
+
color={colorScheme.text}
|
|
29
|
+
numberOfLines={1}
|
|
30
|
+
preset="xs/line-height-small"
|
|
31
|
+
style={styles.time}
|
|
32
|
+
testID={concatTestID(testID, 'timeLabel')}>
|
|
33
|
+
{accessory}
|
|
34
|
+
</Typography>
|
|
35
|
+
);
|
|
36
|
+
} else if (React.isValidElement(accessory)) {
|
|
37
|
+
return accessory;
|
|
38
|
+
} else if (accessory) {
|
|
39
|
+
const AccessoryComponent = accessory as ComponentType<any>;
|
|
40
|
+
return <AccessoryComponent />;
|
|
41
|
+
}
|
|
42
|
+
}, [accessory, colorScheme.text, testID]);
|
|
43
|
+
|
|
34
44
|
const iconView: ReactElement | undefined = useMemo(() => {
|
|
35
45
|
if (React.isValidElement(icon)) {
|
|
36
46
|
return icon;
|
|
@@ -45,7 +55,7 @@ const HistoryItemView: FC<HistoryItemViewProps> = ({
|
|
|
45
55
|
disabled={!onPress}
|
|
46
56
|
onPress={() => onPress?.()}
|
|
47
57
|
style={[
|
|
48
|
-
styles.
|
|
58
|
+
styles.listItemContainer,
|
|
49
59
|
{
|
|
50
60
|
backgroundColor: colorScheme.white,
|
|
51
61
|
},
|
|
@@ -56,7 +66,7 @@ const HistoryItemView: FC<HistoryItemViewProps> = ({
|
|
|
56
66
|
testID={testID}>
|
|
57
67
|
<View
|
|
58
68
|
style={[
|
|
59
|
-
styles.
|
|
69
|
+
styles.listItemWrapper,
|
|
60
70
|
{
|
|
61
71
|
backgroundColor: colorScheme.white,
|
|
62
72
|
borderColor: colorScheme.background,
|
|
@@ -84,14 +94,7 @@ const HistoryItemView: FC<HistoryItemViewProps> = ({
|
|
|
84
94
|
</Typography>
|
|
85
95
|
)}
|
|
86
96
|
</View>
|
|
87
|
-
|
|
88
|
-
color={colorScheme.text}
|
|
89
|
-
numberOfLines={1}
|
|
90
|
-
preset="xs/line-height-small"
|
|
91
|
-
style={styles.time}
|
|
92
|
-
testID={concatTestID(testID, 'timeLabel')}>
|
|
93
|
-
{time}
|
|
94
|
-
</Typography>
|
|
97
|
+
{accessoryView}
|
|
95
98
|
</View>
|
|
96
99
|
</TouchableOpacity>
|
|
97
100
|
);
|
|
@@ -110,15 +113,6 @@ const styles = StyleSheet.create({
|
|
|
110
113
|
marginBottom: 12,
|
|
111
114
|
paddingBottom: 12,
|
|
112
115
|
},
|
|
113
|
-
historyItemContainer: {
|
|
114
|
-
paddingHorizontal: 12,
|
|
115
|
-
},
|
|
116
|
-
historyItemWrapper: {
|
|
117
|
-
alignItems: 'center',
|
|
118
|
-
borderBottomWidth: 1,
|
|
119
|
-
flexDirection: 'row',
|
|
120
|
-
paddingVertical: 12,
|
|
121
|
-
},
|
|
122
116
|
label: {
|
|
123
117
|
marginBottom: 2,
|
|
124
118
|
},
|
|
@@ -126,6 +120,15 @@ const styles = StyleSheet.create({
|
|
|
126
120
|
flex: 1,
|
|
127
121
|
marginHorizontal: 12,
|
|
128
122
|
},
|
|
123
|
+
listItemContainer: {
|
|
124
|
+
paddingHorizontal: 12,
|
|
125
|
+
},
|
|
126
|
+
listItemWrapper: {
|
|
127
|
+
alignItems: 'center',
|
|
128
|
+
borderBottomWidth: 1,
|
|
129
|
+
flexDirection: 'row',
|
|
130
|
+
paddingVertical: 12,
|
|
131
|
+
},
|
|
129
132
|
shaded: {
|
|
130
133
|
opacity: 0.7,
|
|
131
134
|
},
|
|
@@ -138,4 +141,4 @@ const styles = StyleSheet.create({
|
|
|
138
141
|
},
|
|
139
142
|
});
|
|
140
143
|
|
|
141
|
-
export default
|
|
144
|
+
export default ListItemView;
|
|
@@ -9,8 +9,8 @@ import { Typography } from '../../text';
|
|
|
9
9
|
import { useAppColorScheme } from '../../theme';
|
|
10
10
|
|
|
11
11
|
type WalletEmptyListProps = {
|
|
12
|
-
onScanPress
|
|
13
|
-
scanButtonTitle
|
|
12
|
+
onScanPress?: () => void;
|
|
13
|
+
scanButtonTitle?: string;
|
|
14
14
|
subtitle: string;
|
|
15
15
|
testID: string;
|
|
16
16
|
title: string;
|
|
@@ -19,6 +19,7 @@ type WalletEmptyListProps = {
|
|
|
19
19
|
const WalletEmptyList: FC<WalletEmptyListProps> = ({ onScanPress, scanButtonTitle, subtitle, testID, title }) => {
|
|
20
20
|
const safeAreaInsets = useSafeAreaInsets();
|
|
21
21
|
const colorScheme = useAppColorScheme();
|
|
22
|
+
const showButton = Boolean(onScanPress && scanButtonTitle);
|
|
22
23
|
|
|
23
24
|
return (
|
|
24
25
|
<View style={styles.empty}>
|
|
@@ -38,12 +39,14 @@ const WalletEmptyList: FC<WalletEmptyListProps> = ({ onScanPress, scanButtonTitl
|
|
|
38
39
|
{subtitle}
|
|
39
40
|
</Typography>
|
|
40
41
|
<NoCredentialsIcon style={styles.emptyIcon} />
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
{showButton && (
|
|
43
|
+
<Button
|
|
44
|
+
onPress={onScanPress}
|
|
45
|
+
style={[styles.emptyButton, { bottom: Math.max(24, safeAreaInsets.bottom) }]}
|
|
46
|
+
testID={concatTestID(testID, 'scanQrCode')}
|
|
47
|
+
title={scanButtonTitle!}
|
|
48
|
+
/>
|
|
49
|
+
)}
|
|
47
50
|
</View>
|
|
48
51
|
);
|
|
49
52
|
};
|
|
@@ -45,10 +45,12 @@ const WalletNotice: FunctionComponent<WalletNoticeProps> = ({ accessory, icon, s
|
|
|
45
45
|
}, [accessory]);
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
|
-
<View style={[styles.noticeContainer, style]}>
|
|
48
|
+
<View style={[styles.noticeContainer, style]} testID={testID}>
|
|
49
49
|
<View style={styles.title}>
|
|
50
50
|
{iconView}
|
|
51
|
-
<Typography color={colorScheme.white}
|
|
51
|
+
<Typography color={colorScheme.white} testID={concatTestID(testID, 'label')}>
|
|
52
|
+
{text}
|
|
53
|
+
</Typography>
|
|
52
54
|
{accessoryView}
|
|
53
55
|
</View>
|
|
54
56
|
{onClose && (
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { concatTestID } from '../../utils';
|
|
5
|
+
import { Button, ButtonType } from '../buttons';
|
|
6
|
+
import { useAppColorScheme } from '../theme/color-scheme-context';
|
|
7
|
+
import Typography, { TypographyProps } from './typography';
|
|
8
|
+
|
|
9
|
+
const testID = 'expandableTypography';
|
|
10
|
+
|
|
11
|
+
export type ExpandableTypographyProps = TypographyProps & {
|
|
12
|
+
numberOfLines?: number;
|
|
13
|
+
hideExpandButton?: boolean;
|
|
14
|
+
moreLabel?: string;
|
|
15
|
+
lessLabel?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const ExpandableTypography: React.FC<ExpandableTypographyProps> = ({
|
|
19
|
+
numberOfLines = 3,
|
|
20
|
+
hideExpandButton,
|
|
21
|
+
moreLabel = 'More',
|
|
22
|
+
lessLabel = 'Less',
|
|
23
|
+
style,
|
|
24
|
+
...props
|
|
25
|
+
}) => {
|
|
26
|
+
const colorScheme = useAppColorScheme();
|
|
27
|
+
const [expanded, setExpanded] = useState(false);
|
|
28
|
+
const [isTruncated, setIsTruncated] = useState(false);
|
|
29
|
+
|
|
30
|
+
const handlePress = useCallback(() => {
|
|
31
|
+
setExpanded((prev) => !prev);
|
|
32
|
+
}, []);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<View style={[style]}>
|
|
36
|
+
<Typography
|
|
37
|
+
{...props}
|
|
38
|
+
numberOfLines={undefined}
|
|
39
|
+
style={[styles.hiddenTypography]}
|
|
40
|
+
onTextLayout={(e) => {
|
|
41
|
+
setIsTruncated(e.nativeEvent.lines.length > numberOfLines);
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
<Typography {...props} numberOfLines={expanded ? undefined : numberOfLines} />
|
|
45
|
+
{(isTruncated || expanded) && !hideExpandButton && (
|
|
46
|
+
<Button
|
|
47
|
+
onPress={handlePress}
|
|
48
|
+
type={ButtonType.Secondary}
|
|
49
|
+
style={[
|
|
50
|
+
styles.button,
|
|
51
|
+
{
|
|
52
|
+
backgroundColor: colorScheme.background,
|
|
53
|
+
},
|
|
54
|
+
]}
|
|
55
|
+
testID={concatTestID(testID, 'showMore')}
|
|
56
|
+
title={expanded ? lessLabel : moreLabel}
|
|
57
|
+
/>
|
|
58
|
+
)}
|
|
59
|
+
</View>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const styles = StyleSheet.create({
|
|
64
|
+
button: {
|
|
65
|
+
marginTop: 10,
|
|
66
|
+
paddingVertical: 12,
|
|
67
|
+
},
|
|
68
|
+
hiddenTypography: { opacity: 0, position: 'absolute', zIndex: -1 },
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export default ExpandableTypography;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import ExpandableTypography, { ExpandableTypographyProps } from './expandableTypography';
|
|
1
2
|
import type { TypographyProps } from './typography';
|
|
2
3
|
import Typography from './typography';
|
|
3
4
|
|
|
4
|
-
export { Typography, TypographyProps };
|
|
5
|
+
export { ExpandableTypography, ExpandableTypographyProps, Typography, TypographyProps };
|
|
@@ -43,7 +43,7 @@ export const useCredentialSchemaPreview = (url: string) => {
|
|
|
43
43
|
if (!response.ok) {
|
|
44
44
|
throw response.originalError;
|
|
45
45
|
}
|
|
46
|
-
return response.data
|
|
46
|
+
return prepareImportCredentialSchema(response.data);
|
|
47
47
|
}),
|
|
48
48
|
{
|
|
49
49
|
keepPreviousData: true,
|
|
@@ -51,6 +51,28 @@ export const useCredentialSchemaPreview = (url: string) => {
|
|
|
51
51
|
);
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
const prepareImportCredentialSchema = (data: unknown): ImportCredentialSchemaRequestSchema => {
|
|
55
|
+
if (!data || typeof data !== 'object') {
|
|
56
|
+
throw Error('Invalid credential schema data');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if ('formats' in data) {
|
|
60
|
+
// v2 schema: just return
|
|
61
|
+
return data as ImportCredentialSchemaRequestSchema;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// v1 schema: convert format
|
|
65
|
+
const schema = data as Record<string, any>;
|
|
66
|
+
const format = schema.format;
|
|
67
|
+
const schemaId = schema.schemaId;
|
|
68
|
+
const revocationMethod = schema.revocationMethod;
|
|
69
|
+
return {
|
|
70
|
+
...schema,
|
|
71
|
+
formats: [{ format, schemaId }],
|
|
72
|
+
allowRevocation: Boolean(revocationMethod),
|
|
73
|
+
} as unknown as ImportCredentialSchemaRequestSchema;
|
|
74
|
+
};
|
|
75
|
+
|
|
54
76
|
export const useCredentialSchemaAccept = () => {
|
|
55
77
|
const queryClient = useQueryClient();
|
|
56
78
|
const { core, organisationId } = useONECore();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
HolderActivateWalletUnitRequest,
|
|
2
3
|
HolderRegisterWalletUnitRequest,
|
|
3
4
|
HolderWalletUnit,
|
|
4
5
|
HolderWalletUnitUpdateRequest,
|
|
@@ -60,6 +61,26 @@ export const useRegisterWalletUnit = () => {
|
|
|
60
61
|
);
|
|
61
62
|
};
|
|
62
63
|
|
|
64
|
+
export const useActivateWalletUnit = () => {
|
|
65
|
+
const queryClient = useQueryClient();
|
|
66
|
+
const { core } = useONECore();
|
|
67
|
+
|
|
68
|
+
return useMutation(
|
|
69
|
+
async ({ id, userIdToken }: { id: string; userIdToken: HolderActivateWalletUnitRequest['userIdToken'] }) =>
|
|
70
|
+
core.holderActivateWalletUnit(id, {
|
|
71
|
+
keyType: 'ECDSA',
|
|
72
|
+
userIdToken,
|
|
73
|
+
}),
|
|
74
|
+
|
|
75
|
+
{
|
|
76
|
+
onSuccess: async () => {
|
|
77
|
+
await queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY);
|
|
78
|
+
await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
63
84
|
export const useWalletUnitStatus = () => {
|
|
64
85
|
const queryClient = useQueryClient();
|
|
65
86
|
const { core } = useONECore();
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ClaimValue,
|
|
4
4
|
CoreConfig,
|
|
5
5
|
CredentialQueryFailureHint,
|
|
6
|
+
CredentialType,
|
|
6
7
|
PresentationDefinitionV2Claim,
|
|
7
8
|
PresentationDefinitionV2ClaimValue,
|
|
8
9
|
PresentationDefinitionV2Credential,
|
|
@@ -178,7 +179,7 @@ export const shareCredentialCardFromV2PresentationCredential = (
|
|
|
178
179
|
language: string | undefined,
|
|
179
180
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
180
181
|
const selectiveDisclosureSupported = supportsSelectiveDisclosure(
|
|
181
|
-
credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
|
|
182
|
+
credential ? { ...credential, issuer: credential.issuer?.id, type: CredentialType.SINGLE } : undefined,
|
|
182
183
|
config,
|
|
183
184
|
);
|
|
184
185
|
const notice: CredentialCardNotice | undefined = purpose
|
|
@@ -190,10 +191,7 @@ export const shareCredentialCardFromV2PresentationCredential = (
|
|
|
190
191
|
const cardTestId = concatTestID(testID, 'card');
|
|
191
192
|
const card = credential
|
|
192
193
|
? validityCheckedCardFromCredential(
|
|
193
|
-
|
|
194
|
-
...credential,
|
|
195
|
-
claims: [],
|
|
196
|
-
},
|
|
194
|
+
credential,
|
|
197
195
|
expanded,
|
|
198
196
|
selectiveDisclosureSupported,
|
|
199
197
|
multipleCredentialsAvailable,
|
|
@@ -224,7 +222,7 @@ export const selectCredentialCardFromV2Credential = (
|
|
|
224
222
|
language: string | undefined,
|
|
225
223
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
226
224
|
const selectiveDisclosureSupported = supportsSelectiveDisclosure(
|
|
227
|
-
credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
|
|
225
|
+
credential ? { ...credential, issuer: credential.issuer?.id, type: CredentialType.SINGLE } : undefined,
|
|
228
226
|
config,
|
|
229
227
|
);
|
|
230
228
|
const selectedStatus = multiple ? SelectorStatus.SelectedCheckmark : SelectorStatus.SelectedRadio;
|
|
@@ -240,6 +238,7 @@ export const selectCredentialCardFromV2Credential = (
|
|
|
240
238
|
{
|
|
241
239
|
...credential,
|
|
242
240
|
claims: credential.claims.map(v2PresentationClaimToClaim),
|
|
241
|
+
type: CredentialType.SINGLE,
|
|
243
242
|
},
|
|
244
243
|
credential.claims.map(v2PresentationClaimToClaim),
|
|
245
244
|
config,
|
|
@@ -2,8 +2,11 @@ import {
|
|
|
2
2
|
Claim,
|
|
3
3
|
CoreConfig,
|
|
4
4
|
CredentialDetail,
|
|
5
|
+
CredentialListItem,
|
|
6
|
+
CredentialType,
|
|
5
7
|
PresentationDefinitionField,
|
|
6
8
|
PresentationDefinitionRequestedCredential,
|
|
9
|
+
PresentationDefinitionV2Credential,
|
|
7
10
|
} from '@procivis/react-native-one-core';
|
|
8
11
|
import React from 'react';
|
|
9
12
|
|
|
@@ -19,6 +22,7 @@ import { CredentialNoticeWarningIcon, CredentialWarningIcon, RequiredAttributeIc
|
|
|
19
22
|
import { concatTestID } from '../testID';
|
|
20
23
|
import {
|
|
21
24
|
CardLabels,
|
|
25
|
+
credentialDetailFromPresentationV2Credential,
|
|
22
26
|
CredentialDetailsCardPropsWithoutWidth,
|
|
23
27
|
detailsCardAttributeFromClaim,
|
|
24
28
|
getCredentialCardPropsFromCredential,
|
|
@@ -29,7 +33,7 @@ import {
|
|
|
29
33
|
} from './credential';
|
|
30
34
|
|
|
31
35
|
export const validityCheckedCardFromCredential = (
|
|
32
|
-
credential: CredentialDetail,
|
|
36
|
+
credential: CredentialDetail | PresentationDefinitionV2Credential,
|
|
33
37
|
expanded: boolean,
|
|
34
38
|
selectiveDisclosureSupported: boolean | undefined,
|
|
35
39
|
multipleCredentialsAvailable: boolean,
|
|
@@ -55,6 +59,12 @@ export const validityCheckedCardFromCredential = (
|
|
|
55
59
|
credentialDetailTestID: concatTestID(testID, 'header.nonSelectiveDisclosure'),
|
|
56
60
|
statusIcon: CredentialWarningIcon,
|
|
57
61
|
};
|
|
62
|
+
} else if ('embeddedDisclosurePolicyViolation' in credential) {
|
|
63
|
+
credentialHeaderDetail = {
|
|
64
|
+
credentialDetailPrimary: labels.disclosurePolicyViolation,
|
|
65
|
+
credentialDetailTestID: concatTestID(testID, 'header.dislosurePolicyViolation'),
|
|
66
|
+
statusIcon: CredentialWarningIcon,
|
|
67
|
+
};
|
|
58
68
|
} else if (!expanded && multipleCredentialsAvailable) {
|
|
59
69
|
credentialHeaderDetail = {
|
|
60
70
|
credentialDetailPrimary: labels.multipleCredentials,
|
|
@@ -64,7 +74,7 @@ export const validityCheckedCardFromCredential = (
|
|
|
64
74
|
}
|
|
65
75
|
|
|
66
76
|
const card = getCredentialCardPropsFromCredential(
|
|
67
|
-
credential,
|
|
77
|
+
credentialDetailFromPresentationV2Credential(credential),
|
|
68
78
|
credential.claims,
|
|
69
79
|
config,
|
|
70
80
|
notice,
|
|
@@ -264,10 +274,11 @@ export type ShareCredentialCardLabels = CardLabels & {
|
|
|
264
274
|
missingAttribute: string;
|
|
265
275
|
missingCredential: string;
|
|
266
276
|
multipleCredentials: string;
|
|
277
|
+
disclosurePolicyViolation: string;
|
|
267
278
|
};
|
|
268
279
|
|
|
269
280
|
export const shareCredentialCardFromCredential = (
|
|
270
|
-
credential: CredentialDetail | undefined,
|
|
281
|
+
credential: CredentialDetail | PresentationDefinitionV2Credential | undefined,
|
|
271
282
|
expanded: boolean,
|
|
272
283
|
multipleCredentialsAvailable: boolean,
|
|
273
284
|
request: PresentationDefinitionRequestedCredential,
|
|
@@ -277,10 +288,10 @@ export const shareCredentialCardFromCredential = (
|
|
|
277
288
|
labels: ShareCredentialCardLabels,
|
|
278
289
|
language: string | undefined,
|
|
279
290
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
);
|
|
291
|
+
const credentialAsListItem: CredentialListItem | undefined = credential
|
|
292
|
+
? { type: CredentialType.SINGLE, ...credential, issuer: credential.issuer?.id }
|
|
293
|
+
: undefined;
|
|
294
|
+
const selectiveDisclosureSupported = supportsSelectiveDisclosure(credentialAsListItem, config);
|
|
284
295
|
const cardTestId = concatTestID(testID, 'card');
|
|
285
296
|
const card = credential
|
|
286
297
|
? validityCheckedCardFromCredential(
|
|
@@ -295,11 +306,11 @@ export const shareCredentialCardFromCredential = (
|
|
|
295
306
|
language,
|
|
296
307
|
)
|
|
297
308
|
: missingCredentialCardFromRequest(request, undefined, cardTestId, labels);
|
|
298
|
-
const validityState = getValidityState(
|
|
309
|
+
const validityState = getValidityState(credentialAsListItem);
|
|
299
310
|
const displayedAttributes = getDisplayedAttributes(
|
|
300
311
|
request,
|
|
301
312
|
validityState,
|
|
302
|
-
credential,
|
|
313
|
+
credential ? credentialDetailFromPresentationV2Credential(credential) : undefined,
|
|
303
314
|
selectiveDisclosureSupported,
|
|
304
315
|
selectedFields,
|
|
305
316
|
);
|
|
@@ -5,8 +5,10 @@ import {
|
|
|
5
5
|
CredentialListItem,
|
|
6
6
|
CredentialSchemaListItem,
|
|
7
7
|
CredentialState,
|
|
8
|
+
CredentialType,
|
|
8
9
|
DataType,
|
|
9
10
|
FormatFeature,
|
|
11
|
+
PresentationDefinitionV2Credential,
|
|
10
12
|
} from '@procivis/react-native-one-core';
|
|
11
13
|
import { FC } from 'react';
|
|
12
14
|
import { SvgProps } from 'react-native-svg';
|
|
@@ -180,7 +182,7 @@ export const cardHeaderFromCredential = (
|
|
|
180
182
|
statusIcon,
|
|
181
183
|
} = credentialDetailFromCredential(credential, claims, config, testID, labels, language);
|
|
182
184
|
const { layoutProperties } = credential.schema;
|
|
183
|
-
const defaultLanguage = config.defaultLanguage;
|
|
185
|
+
const defaultLanguage = config.globalSettings.defaultLanguage;
|
|
184
186
|
|
|
185
187
|
return {
|
|
186
188
|
color: layoutProperties?.logo?.backgroundColor,
|
|
@@ -217,7 +219,7 @@ export const getCredentialCardPropsFromCredential = (
|
|
|
217
219
|
language: string | undefined,
|
|
218
220
|
): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'width'> => {
|
|
219
221
|
const { layoutProperties } = credential.schema;
|
|
220
|
-
const defaultLanguage = config.defaultLanguage;
|
|
222
|
+
const defaultLanguage = config.globalSettings.defaultLanguage;
|
|
221
223
|
|
|
222
224
|
if (hasMsoValidityIssues(credential)) {
|
|
223
225
|
notice = {
|
|
@@ -255,7 +257,7 @@ export const detailsCardAttributeFromClaim = (
|
|
|
255
257
|
language: string | undefined,
|
|
256
258
|
): CredentialAttribute => {
|
|
257
259
|
const value = detailsCardAttributeValueFromClaim(claim, config, testID, language);
|
|
258
|
-
const defaultLanguage = config.defaultLanguage;
|
|
260
|
+
const defaultLanguage = config.globalSettings.defaultLanguage;
|
|
259
261
|
return {
|
|
260
262
|
id: claim.path,
|
|
261
263
|
name: getTranslatedLabel(claim.schema.translations.name, language, defaultLanguage) ?? claim.path.split('/').pop(),
|
|
@@ -449,3 +451,12 @@ export function getCredentialSchemaWithoutImages<T extends CredentialSchemaListI
|
|
|
449
451
|
},
|
|
450
452
|
};
|
|
451
453
|
}
|
|
454
|
+
|
|
455
|
+
export function credentialDetailFromPresentationV2Credential(
|
|
456
|
+
presentationCredential: CredentialDetail | PresentationDefinitionV2Credential,
|
|
457
|
+
): CredentialDetail {
|
|
458
|
+
return {
|
|
459
|
+
type: CredentialType.SINGLE,
|
|
460
|
+
...presentationCredential,
|
|
461
|
+
};
|
|
462
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_testID","_accessibilityHistoryWrappers","_typography","_interopRequireDefault","_colorSchemeContext","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","HistoryItemView","first","icon","label","info","last","style","time","onPress","testID","colorScheme","useAppColorScheme","iconView","useMemo","React","isValidElement","IconComponent","createElement","TouchableOpacity","disabled","styles","historyItemContainer","backgroundColor","white","containerFirst","containerLast","View","historyItemWrapper","borderColor","background","wrapperLast","labelAndInfo","color","text","numberOfLines","preset","concatTestID","Boolean","shaded","StyleSheet","create","borderTopLeftRadius","borderTopRightRadius","marginTop","paddingTop","borderBottomLeftRadius","borderBottomRightRadius","marginBottom","paddingBottom","paddingHorizontal","alignItems","borderBottomWidth","flexDirection","paddingVertical","flex","marginHorizontal","opacity","marginRight","_default","exports"],"sources":["history-item.tsx"],"sourcesContent":["import React, { ComponentType, FC, ReactElement, useMemo } from 'react';\nimport { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport { concatTestID } from '../../utils/testID';\nimport { TouchableOpacity } from '../accessibility/accessibilityHistoryWrappers';\nimport Typography from '../text/typography';\nimport { useAppColorScheme } from '../theme/color-scheme-context';\n\nexport type HistoryItemViewProps = {\n first?: boolean;\n icon: ComponentType<any> | ReactElement;\n info?: string;\n label: string;\n last?: boolean;\n onPress?: () => void;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n time: string;\n};\n\nconst HistoryItemView: FC<HistoryItemViewProps> = ({\n first,\n icon,\n label,\n info,\n last,\n style,\n time,\n onPress,\n testID,\n}) => {\n const colorScheme = useAppColorScheme();\n\n const iconView: ReactElement | undefined = useMemo(() => {\n if (React.isValidElement(icon)) {\n return icon;\n } else if (icon) {\n const IconComponent = icon as ComponentType<any>;\n return <IconComponent />;\n }\n }, [icon]);\n\n return (\n <TouchableOpacity\n disabled={!onPress}\n onPress={() => onPress?.()}\n style={[\n styles.historyItemContainer,\n {\n backgroundColor: colorScheme.white,\n },\n first && styles.containerFirst,\n last && styles.containerLast,\n style,\n ]}\n testID={testID}>\n <View\n style={[\n styles.historyItemWrapper,\n {\n backgroundColor: colorScheme.white,\n borderColor: colorScheme.background,\n },\n last && styles.wrapperLast,\n ]}>\n {iconView}\n <View style={styles.labelAndInfo}>\n <Typography\n color={colorScheme.text}\n numberOfLines={1}\n preset=\"s\"\n style={styles.label}\n testID={concatTestID(testID, 'label')}>\n {label}\n </Typography>\n {Boolean(info) && (\n <Typography\n color={colorScheme.text}\n numberOfLines={1}\n preset=\"s/line-height-small\"\n style={styles.shaded}\n testID={concatTestID(testID, 'info')}>\n {info}\n </Typography>\n )}\n </View>\n <Typography\n color={colorScheme.text}\n numberOfLines={1}\n preset=\"xs/line-height-small\"\n style={styles.time}\n testID={concatTestID(testID, 'timeLabel')}>\n {time}\n </Typography>\n </View>\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n containerFirst: {\n borderTopLeftRadius: 20,\n borderTopRightRadius: 20,\n marginTop: 8,\n paddingTop: 12,\n },\n containerLast: {\n borderBottomLeftRadius: 20,\n borderBottomRightRadius: 20,\n marginBottom: 12,\n paddingBottom: 12,\n },\n historyItemContainer: {\n paddingHorizontal: 12,\n },\n historyItemWrapper: {\n alignItems: 'center',\n borderBottomWidth: 1,\n flexDirection: 'row',\n paddingVertical: 12,\n },\n label: {\n marginBottom: 2,\n },\n labelAndInfo: {\n flex: 1,\n marginHorizontal: 12,\n },\n shaded: {\n opacity: 0.7,\n },\n time: {\n marginRight: 8,\n opacity: 0.7,\n },\n wrapperLast: {\n borderBottomWidth: 0,\n },\n});\n\nexport default HistoryItemView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,6BAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AAAkE,SAAAK,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAA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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","StyleSheet","View","concatTestID","TouchableOpacity","Typography","useAppColorScheme","HistoryItemView","first","icon","label","info","last","style","time","onPress","testID","colorScheme","iconView","isValidElement","IconComponent","createElement","disabled","styles","historyItemContainer","backgroundColor","white","containerFirst","containerLast","historyItemWrapper","borderColor","background","wrapperLast","labelAndInfo","color","text","numberOfLines","preset","Boolean","shaded","create","borderTopLeftRadius","borderTopRightRadius","marginTop","paddingTop","borderBottomLeftRadius","borderBottomRightRadius","marginBottom","paddingBottom","paddingHorizontal","alignItems","borderBottomWidth","flexDirection","paddingVertical","flex","marginHorizontal","opacity","marginRight"],"sources":["history-item.tsx"],"sourcesContent":["import React, { ComponentType, FC, ReactElement, useMemo } from 'react';\nimport { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport { concatTestID } from '../../utils/testID';\nimport { TouchableOpacity } from '../accessibility/accessibilityHistoryWrappers';\nimport Typography from '../text/typography';\nimport { useAppColorScheme } from '../theme/color-scheme-context';\n\nexport type HistoryItemViewProps = {\n first?: boolean;\n icon: ComponentType<any> | ReactElement;\n info?: string;\n label: string;\n last?: boolean;\n onPress?: () => void;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n time: string;\n};\n\nconst HistoryItemView: FC<HistoryItemViewProps> = ({\n first,\n icon,\n label,\n info,\n last,\n style,\n time,\n onPress,\n testID,\n}) => {\n const colorScheme = useAppColorScheme();\n\n const iconView: ReactElement | undefined = useMemo(() => {\n if (React.isValidElement(icon)) {\n return icon;\n } else if (icon) {\n const IconComponent = icon as ComponentType<any>;\n return <IconComponent />;\n }\n }, [icon]);\n\n return (\n <TouchableOpacity\n disabled={!onPress}\n onPress={() => onPress?.()}\n style={[\n styles.historyItemContainer,\n {\n backgroundColor: colorScheme.white,\n },\n first && styles.containerFirst,\n last && styles.containerLast,\n style,\n ]}\n testID={testID}>\n <View\n style={[\n styles.historyItemWrapper,\n {\n backgroundColor: colorScheme.white,\n borderColor: colorScheme.background,\n },\n last && styles.wrapperLast,\n ]}>\n {iconView}\n <View style={styles.labelAndInfo}>\n <Typography\n color={colorScheme.text}\n numberOfLines={1}\n preset=\"s\"\n style={styles.label}\n testID={concatTestID(testID, 'label')}>\n {label}\n </Typography>\n {Boolean(info) && (\n <Typography\n color={colorScheme.text}\n numberOfLines={1}\n preset=\"s/line-height-small\"\n style={styles.shaded}\n testID={concatTestID(testID, 'info')}>\n {info}\n </Typography>\n )}\n </View>\n <Typography\n color={colorScheme.text}\n numberOfLines={1}\n preset=\"xs/line-height-small\"\n style={styles.time}\n testID={concatTestID(testID, 'timeLabel')}>\n {time}\n </Typography>\n </View>\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n containerFirst: {\n borderTopLeftRadius: 20,\n borderTopRightRadius: 20,\n marginTop: 8,\n paddingTop: 12,\n },\n containerLast: {\n borderBottomLeftRadius: 20,\n borderBottomRightRadius: 20,\n marginBottom: 12,\n paddingBottom: 12,\n },\n historyItemContainer: {\n paddingHorizontal: 12,\n },\n historyItemWrapper: {\n alignItems: 'center',\n borderBottomWidth: 1,\n flexDirection: 'row',\n paddingVertical: 12,\n },\n label: {\n marginBottom: 2,\n },\n labelAndInfo: {\n flex: 1,\n marginHorizontal: 12,\n },\n shaded: {\n opacity: 0.7,\n },\n time: {\n marginRight: 8,\n opacity: 0.7,\n },\n wrapperLast: {\n borderBottomWidth: 0,\n },\n});\n\nexport default HistoryItemView;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAqCC,OAAO,QAAQ,OAAO;AACvE,SAAoBC,UAAU,EAAEC,IAAI,QAAmB,cAAc;AAErE,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,gBAAgB,QAAQ,+CAA+C;AAChF,OAAOC,UAAU,MAAM,oBAAoB;AAC3C,SAASC,iBAAiB,QAAQ,+BAA+B;AAcjE,MAAMC,eAAyC,GAAGA,CAAC;EACjDC,KAAK;EACLC,IAAI;EACJC,K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