@procivis/one-react-native-components 0.3.112 → 0.3.121
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 +6 -2
- package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
- package/lib/commonjs/components/index.js +11 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/trust-info/index.js +29 -0
- package/lib/commonjs/components/trust-info/index.js.map +1 -0
- package/lib/commonjs/components/trust-info/trust-info.js +79 -0
- package/lib/commonjs/components/trust-info/trust-info.js.map +1 -0
- package/lib/commonjs/ui-components/control/checkbox.js +1 -0
- package/lib/commonjs/ui-components/control/checkbox.js.map +1 -1
- package/lib/commonjs/ui-components/header/header.js +2 -0
- package/lib/commonjs/ui-components/header/header.js.map +1 -1
- package/lib/commonjs/ui-components/icons/contact.js +45 -0
- package/lib/commonjs/ui-components/icons/contact.js.map +1 -0
- package/lib/commonjs/ui-components/icons/index.js +11 -0
- package/lib/commonjs/ui-components/icons/index.js.map +1 -1
- package/lib/commonjs/ui-components/screens/index.js +7 -0
- package/lib/commonjs/ui-components/screens/index.js.map +1 -1
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js +45 -15
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/commonjs/ui-components/screens/trust-info-details-screen.js +384 -0
- package/lib/commonjs/ui-components/screens/trust-info-details-screen.js.map +1 -0
- package/lib/commonjs/utils/hooks/core/cache.js +2 -1
- package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-init.js +4 -2
- package/lib/commonjs/utils/hooks/core/core-init.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credentials.js +26 -1
- package/lib/commonjs/utils/hooks/core/credentials.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 +12 -1
- package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/trust-list.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/verifier-instance.js +52 -0
- package/lib/commonjs/utils/hooks/core/verifier-instance.js.map +1 -0
- package/lib/commonjs/utils/hooks/core/wallet-unit.js +9 -2
- package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.js +2 -2
- package/lib/commonjs/utils/parsers/query.js.map +1 -1
- package/lib/module/components/history/history-list-item-icon.js +6 -2
- package/lib/module/components/history/history-list-item-icon.js.map +1 -1
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/trust-info/index.js +4 -0
- package/lib/module/components/trust-info/index.js.map +1 -0
- package/lib/module/components/trust-info/trust-info.js +70 -0
- package/lib/module/components/trust-info/trust-info.js.map +1 -0
- package/lib/module/ui-components/control/checkbox.js +1 -0
- package/lib/module/ui-components/control/checkbox.js.map +1 -1
- package/lib/module/ui-components/header/header.js +2 -0
- package/lib/module/ui-components/header/header.js.map +1 -1
- package/lib/module/ui-components/icons/contact.js +34 -0
- package/lib/module/ui-components/icons/contact.js.map +1 -0
- package/lib/module/ui-components/icons/index.js +1 -0
- package/lib/module/ui-components/icons/index.js.map +1 -1
- package/lib/module/ui-components/screens/index.js +2 -0
- package/lib/module/ui-components/screens/index.js.map +1 -1
- package/lib/module/ui-components/screens/nerd-mode-screen.js +46 -16
- package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/module/ui-components/screens/trust-info-details-screen.js +375 -0
- package/lib/module/ui-components/screens/trust-info-details-screen.js.map +1 -0
- package/lib/module/utils/hooks/core/cache.js +2 -1
- package/lib/module/utils/hooks/core/cache.js.map +1 -1
- package/lib/module/utils/hooks/core/core-init.js +4 -2
- package/lib/module/utils/hooks/core/core-init.js.map +1 -1
- package/lib/module/utils/hooks/core/credentials.js +24 -1
- package/lib/module/utils/hooks/core/credentials.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 +10 -0
- package/lib/module/utils/hooks/core/proofs.js.map +1 -1
- package/lib/module/utils/hooks/core/trust-list.js.map +1 -1
- package/lib/module/utils/hooks/core/verifier-instance.js +43 -0
- package/lib/module/utils/hooks/core/verifier-instance.js.map +1 -0
- package/lib/module/utils/hooks/core/wallet-unit.js +9 -2
- package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/module/utils/parsers/query.js +2 -2
- package/lib/module/utils/parsers/query.js.map +1 -1
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/trust-info/index.d.ts +3 -0
- package/lib/typescript/components/trust-info/trust-info.d.ts +19 -0
- package/lib/typescript/ui-components/header/header.d.ts +2 -0
- package/lib/typescript/ui-components/icons/contact.d.ts +4 -0
- package/lib/typescript/ui-components/icons/index.d.ts +1 -0
- package/lib/typescript/ui-components/screens/index.d.ts +3 -0
- package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +6 -1
- package/lib/typescript/ui-components/screens/trust-info-details-screen.d.ts +32 -0
- package/lib/typescript/utils/hooks/core/core-init.d.ts +1 -1
- package/lib/typescript/utils/hooks/core/credentials.d.ts +5 -9
- package/lib/typescript/utils/hooks/core/index.d.ts +1 -0
- package/lib/typescript/utils/hooks/core/proofs.d.ts +2 -0
- package/lib/typescript/utils/hooks/core/verifier-instance.d.ts +8 -0
- package/lib/typescript/utils/parsers/query.d.ts +1 -1
- package/package.json +8 -8
- package/src/components/history/history-list-item-icon.tsx +4 -0
- package/src/components/index.ts +1 -0
- package/src/components/trust-info/index.ts +4 -0
- package/src/components/trust-info/trust-info.tsx +90 -0
- package/src/ui-components/control/checkbox.tsx +1 -1
- package/src/ui-components/header/header.tsx +9 -3
- package/src/ui-components/icons/contact.tsx +26 -0
- package/src/ui-components/icons/index.ts +1 -0
- package/src/ui-components/screens/index.ts +3 -0
- package/src/ui-components/screens/nerd-mode-screen.tsx +80 -22
- package/src/ui-components/screens/trust-info-details-screen.tsx +472 -0
- package/src/utils/hooks/core/cache.ts +2 -1
- package/src/utils/hooks/core/core-init.ts +3 -4
- package/src/utils/hooks/core/credentials.ts +32 -11
- package/src/utils/hooks/core/index.ts +1 -0
- package/src/utils/hooks/core/proofs.ts +14 -0
- package/src/utils/hooks/core/trust-list.ts +1 -1
- package/src/utils/hooks/core/verifier-instance.ts +54 -0
- package/src/utils/hooks/core/wallet-unit.ts +9 -2
- package/src/utils/parsers/query.ts +8 -0
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { TrustInformationDetail } from '@procivis/react-native-one-core';
|
|
2
|
+
import React, { FC, useCallback, useState } from 'react';
|
|
3
|
+
import { Linking, SectionList, SectionListData, StyleSheet, View } from 'react-native';
|
|
4
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
+
import { SvgProps } from 'react-native-svg';
|
|
6
|
+
|
|
7
|
+
import TrustInfo, { TrustInfoLabels } from '../../components/trust-info/trust-info';
|
|
8
|
+
import { concatTestID, nonEmptyFilter, reportException } from '../../utils';
|
|
9
|
+
import { TouchableOpacity } from '../accessibility';
|
|
10
|
+
import { BackButton } from '../buttons';
|
|
11
|
+
import { NavigationHeader } from '../header';
|
|
12
|
+
import { LinkIcon, MailIcon, PhoneIcon } from '../icons';
|
|
13
|
+
import { Typography } from '../text';
|
|
14
|
+
import { useAppColorScheme } from '../theme';
|
|
15
|
+
|
|
16
|
+
type TrustInfoDetailItem =
|
|
17
|
+
| {
|
|
18
|
+
name: string;
|
|
19
|
+
type: 'trustInfo';
|
|
20
|
+
}
|
|
21
|
+
| {
|
|
22
|
+
title: string;
|
|
23
|
+
type: 'subsection';
|
|
24
|
+
}
|
|
25
|
+
| {
|
|
26
|
+
action?: {
|
|
27
|
+
icon: FC<SvgProps>;
|
|
28
|
+
onPress: () => void;
|
|
29
|
+
};
|
|
30
|
+
title: string;
|
|
31
|
+
type: 'item';
|
|
32
|
+
value?: string;
|
|
33
|
+
}
|
|
34
|
+
| {
|
|
35
|
+
email?: string;
|
|
36
|
+
phone?: string;
|
|
37
|
+
type: 'contact';
|
|
38
|
+
website?: string;
|
|
39
|
+
}
|
|
40
|
+
| {
|
|
41
|
+
type: 'expand';
|
|
42
|
+
}
|
|
43
|
+
| {
|
|
44
|
+
type: 'collapse';
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
type TrustInfoDetailSection = {
|
|
48
|
+
title?: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type TrustInfoDetailsScreenLabels = TrustInfoLabels & {
|
|
52
|
+
collapse: string;
|
|
53
|
+
country: string;
|
|
54
|
+
email: string;
|
|
55
|
+
expand: string;
|
|
56
|
+
identifier: string;
|
|
57
|
+
isPublicSector: string;
|
|
58
|
+
phone: string;
|
|
59
|
+
privacyPolicy: string;
|
|
60
|
+
serviceDescription: string;
|
|
61
|
+
supervisoryAuthority: string;
|
|
62
|
+
support: string;
|
|
63
|
+
title: string;
|
|
64
|
+
true: string;
|
|
65
|
+
website: string;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type SeparatorProps = {
|
|
69
|
+
dark?: boolean;
|
|
70
|
+
leadingItem?: TrustInfoDetailItem;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const Separator: FC<SeparatorProps> = ({ dark, leadingItem }) => {
|
|
74
|
+
const colorScheme = useAppColorScheme();
|
|
75
|
+
if (leadingItem?.type === 'subsection' || (leadingItem?.type === 'item' && !leadingItem?.value)) {
|
|
76
|
+
return <View style={styles.emptyItem} />;
|
|
77
|
+
}
|
|
78
|
+
return (
|
|
79
|
+
<View style={{ backgroundColor: dark ? colorScheme.background : colorScheme.white }}>
|
|
80
|
+
<View style={[styles.separator, { backgroundColor: colorScheme.grayDark }]} />
|
|
81
|
+
</View>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
type ListButtonProps = {
|
|
86
|
+
label: string;
|
|
87
|
+
onPress: () => void;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const ListButton: FC<ListButtonProps> = ({ label, onPress }) => {
|
|
91
|
+
const colorScheme = useAppColorScheme();
|
|
92
|
+
return (
|
|
93
|
+
<TouchableOpacity
|
|
94
|
+
onPress={onPress}
|
|
95
|
+
style={[styles.button, styles.lastItem, { backgroundColor: colorScheme.white }]}>
|
|
96
|
+
<Typography align="center" color={colorScheme.text}>
|
|
97
|
+
{label}
|
|
98
|
+
</Typography>
|
|
99
|
+
</TouchableOpacity>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
type ListItemProps = {
|
|
104
|
+
action?: {
|
|
105
|
+
icon: FC<SvgProps>;
|
|
106
|
+
onPress: () => void;
|
|
107
|
+
};
|
|
108
|
+
dark?: boolean;
|
|
109
|
+
title: string;
|
|
110
|
+
value: string;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const ListItem: FC<ListItemProps> = ({ action, dark, title, value }) => {
|
|
114
|
+
const colorScheme = useAppColorScheme();
|
|
115
|
+
return (
|
|
116
|
+
<View style={[styles.item, { backgroundColor: dark ? undefined : colorScheme.white }]}>
|
|
117
|
+
<View style={styles.itemLabels}>
|
|
118
|
+
<Typography
|
|
119
|
+
color={colorScheme.text}
|
|
120
|
+
numberOfLines={1}
|
|
121
|
+
preset="s/line-height-capped"
|
|
122
|
+
style={styles.itemTitleLabel}>
|
|
123
|
+
{title}
|
|
124
|
+
</Typography>
|
|
125
|
+
<Typography color={colorScheme.text} numberOfLines={1} preset="s/line-height-capped">
|
|
126
|
+
{value}
|
|
127
|
+
</Typography>
|
|
128
|
+
</View>
|
|
129
|
+
{action && (
|
|
130
|
+
<TouchableOpacity
|
|
131
|
+
onPress={action.onPress}
|
|
132
|
+
style={[styles.actionButton, { backgroundColor: dark ? colorScheme.white : colorScheme.grayDark }]}>
|
|
133
|
+
<action.icon color={colorScheme.black} />
|
|
134
|
+
</TouchableOpacity>
|
|
135
|
+
)}
|
|
136
|
+
</View>
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
type ContactItemProps = {
|
|
141
|
+
email?: string;
|
|
142
|
+
labels: TrustInfoDetailsScreenLabels;
|
|
143
|
+
onPress: (url: string) => () => void;
|
|
144
|
+
phone?: string;
|
|
145
|
+
website?: string;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const ContactItem: FC<ContactItemProps> = ({ email, labels, onPress, phone, website }) => {
|
|
149
|
+
const colorScheme = useAppColorScheme();
|
|
150
|
+
return (
|
|
151
|
+
<View style={[styles.contactItemWrapper, { backgroundColor: colorScheme.white }]}>
|
|
152
|
+
<View style={[styles.contactItem, { backgroundColor: colorScheme.background }]}>
|
|
153
|
+
{website && (
|
|
154
|
+
<ListItem
|
|
155
|
+
action={{ icon: LinkIcon, onPress: onPress(website) }}
|
|
156
|
+
dark
|
|
157
|
+
title={labels.website}
|
|
158
|
+
value={website}
|
|
159
|
+
/>
|
|
160
|
+
)}
|
|
161
|
+
{website && (email || phone) && <Separator dark />}
|
|
162
|
+
{email && (
|
|
163
|
+
<ListItem
|
|
164
|
+
action={{ icon: MailIcon, onPress: onPress(`mailto:${email}`) }}
|
|
165
|
+
dark
|
|
166
|
+
title={labels.email}
|
|
167
|
+
value={email}
|
|
168
|
+
/>
|
|
169
|
+
)}
|
|
170
|
+
{email && phone && <Separator dark />}
|
|
171
|
+
{phone && (
|
|
172
|
+
<ListItem
|
|
173
|
+
action={{ icon: PhoneIcon, onPress: onPress(`tel:${phone}`) }}
|
|
174
|
+
dark
|
|
175
|
+
title={labels.phone}
|
|
176
|
+
value={phone}
|
|
177
|
+
/>
|
|
178
|
+
)}
|
|
179
|
+
</View>
|
|
180
|
+
</View>
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export type TrustInfoDetailsScreenProps = {
|
|
185
|
+
countries: {
|
|
186
|
+
display: Record<string, string>;
|
|
187
|
+
value: string;
|
|
188
|
+
}[];
|
|
189
|
+
labels: TrustInfoDetailsScreenLabels;
|
|
190
|
+
language: string;
|
|
191
|
+
onClose: () => void;
|
|
192
|
+
testID: string;
|
|
193
|
+
trustInformation: TrustInformationDetail;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const TrustInfoDetailsScreen: FC<TrustInfoDetailsScreenProps> = ({
|
|
197
|
+
countries,
|
|
198
|
+
labels,
|
|
199
|
+
language,
|
|
200
|
+
onClose,
|
|
201
|
+
testID,
|
|
202
|
+
trustInformation,
|
|
203
|
+
}) => {
|
|
204
|
+
const insets = useSafeAreaInsets();
|
|
205
|
+
const colorScheme = useAppColorScheme();
|
|
206
|
+
const [expanded, setExpanded] = useState(false);
|
|
207
|
+
|
|
208
|
+
const linkHandler = useCallback(
|
|
209
|
+
(url: string) => () => {
|
|
210
|
+
Linking.openURL(url).catch((e) => {
|
|
211
|
+
reportException(e, `Error opening contact link ${url}`);
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
[],
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
const trustDetails = trustInformation.eudiEcosystem;
|
|
218
|
+
if (!trustDetails) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const countryDisplay = countries.find((c) => c.value === trustDetails.country)?.display;
|
|
223
|
+
const country = countryDisplay?.[language] ?? countryDisplay?.en;
|
|
224
|
+
|
|
225
|
+
const baseInfo: TrustInfoDetailItem[] = [
|
|
226
|
+
{
|
|
227
|
+
name: trustDetails.name,
|
|
228
|
+
type: 'trustInfo',
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
title: labels.isPublicSector,
|
|
232
|
+
type: 'item',
|
|
233
|
+
value: trustDetails.isPublicSector ? labels.true : undefined,
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
title: labels.serviceDescription,
|
|
237
|
+
type: 'item',
|
|
238
|
+
value: trustDetails.serviceDescription[0]?.[language],
|
|
239
|
+
},
|
|
240
|
+
];
|
|
241
|
+
|
|
242
|
+
const expandItem: TrustInfoDetailItem[] = !expanded ? [{ type: 'expand' }] : [];
|
|
243
|
+
|
|
244
|
+
const supervisoryAuthority: TrustInfoDetailItem[] = trustDetails.supervisoryAuthority
|
|
245
|
+
? [
|
|
246
|
+
{
|
|
247
|
+
title: labels.supervisoryAuthority,
|
|
248
|
+
type: 'subsection',
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
...trustDetails.supervisoryAuthority,
|
|
252
|
+
type: 'contact',
|
|
253
|
+
website: trustDetails.supervisoryAuthority.uri,
|
|
254
|
+
},
|
|
255
|
+
]
|
|
256
|
+
: [];
|
|
257
|
+
|
|
258
|
+
const extraInfo: TrustInfoDetailItem[] = expanded
|
|
259
|
+
? [
|
|
260
|
+
{
|
|
261
|
+
title: labels.country,
|
|
262
|
+
type: 'item',
|
|
263
|
+
value: country,
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
title: labels.identifier,
|
|
267
|
+
type: 'item',
|
|
268
|
+
value: trustDetails.identifier,
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
title: labels.support,
|
|
272
|
+
type: 'subsection',
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
type: 'contact',
|
|
276
|
+
...trustDetails,
|
|
277
|
+
},
|
|
278
|
+
...supervisoryAuthority,
|
|
279
|
+
{ type: 'collapse' },
|
|
280
|
+
]
|
|
281
|
+
: [];
|
|
282
|
+
|
|
283
|
+
const trustDetailsSection = baseInfo.concat(expandItem).concat(extraInfo);
|
|
284
|
+
|
|
285
|
+
const intermediaryName: TrustInfoDetailItem[] = trustDetails.intermediary?.name
|
|
286
|
+
? [
|
|
287
|
+
{
|
|
288
|
+
name: trustDetails.intermediary.name,
|
|
289
|
+
type: 'trustInfo',
|
|
290
|
+
},
|
|
291
|
+
]
|
|
292
|
+
: [];
|
|
293
|
+
|
|
294
|
+
const intermediarySection: TrustInfoDetailItem[] = trustDetails.intermediary
|
|
295
|
+
? [
|
|
296
|
+
...intermediaryName,
|
|
297
|
+
{
|
|
298
|
+
title: labels.country,
|
|
299
|
+
type: 'item',
|
|
300
|
+
value: trustDetails.intermediary.country,
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
title: labels.identifier,
|
|
304
|
+
type: 'item',
|
|
305
|
+
value: trustDetails.intermediary.identifier,
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
title: labels.support,
|
|
309
|
+
type: 'subsection',
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
type: 'contact',
|
|
313
|
+
...trustDetails.intermediary,
|
|
314
|
+
},
|
|
315
|
+
]
|
|
316
|
+
: [];
|
|
317
|
+
|
|
318
|
+
const sections: SectionListData<TrustInfoDetailItem, TrustInfoDetailSection>[] = [
|
|
319
|
+
{
|
|
320
|
+
ItemSeparatorComponent: Separator,
|
|
321
|
+
data: trustDetailsSection,
|
|
322
|
+
},
|
|
323
|
+
intermediarySection.length
|
|
324
|
+
? {
|
|
325
|
+
ItemSeparatorComponent: Separator,
|
|
326
|
+
data: intermediarySection,
|
|
327
|
+
title: 'Intermediary',
|
|
328
|
+
}
|
|
329
|
+
: undefined,
|
|
330
|
+
].filter(nonEmptyFilter);
|
|
331
|
+
|
|
332
|
+
return (
|
|
333
|
+
<View style={styles.container}>
|
|
334
|
+
<NavigationHeader
|
|
335
|
+
leftItem={<BackButton onPress={onClose} />}
|
|
336
|
+
style={{
|
|
337
|
+
paddingTop: insets.top,
|
|
338
|
+
}}
|
|
339
|
+
title={labels.title}
|
|
340
|
+
/>
|
|
341
|
+
<SectionList<TrustInfoDetailItem, TrustInfoDetailSection>
|
|
342
|
+
contentInset={insets}
|
|
343
|
+
renderItem={({ item, section }) => {
|
|
344
|
+
switch (item.type) {
|
|
345
|
+
case 'subsection':
|
|
346
|
+
return (
|
|
347
|
+
<View
|
|
348
|
+
style={[styles.subsection, { backgroundColor: colorScheme.white }]}
|
|
349
|
+
testID={concatTestID(testID, section.title)}>
|
|
350
|
+
<Typography color={colorScheme.text} preset="m/heading">
|
|
351
|
+
{item.title}
|
|
352
|
+
</Typography>
|
|
353
|
+
</View>
|
|
354
|
+
);
|
|
355
|
+
case 'trustInfo':
|
|
356
|
+
return (
|
|
357
|
+
<TrustInfo
|
|
358
|
+
labels={labels}
|
|
359
|
+
style={[styles.trustInfoItem, styles.firstItem, { backgroundColor: colorScheme.white }]}
|
|
360
|
+
trustInformation={item}
|
|
361
|
+
/>
|
|
362
|
+
);
|
|
363
|
+
case 'item':
|
|
364
|
+
if (!item.value) {
|
|
365
|
+
return <View style={styles.emptyItem} />;
|
|
366
|
+
}
|
|
367
|
+
return <ListItem {...item} value={item.value} />;
|
|
368
|
+
case 'contact':
|
|
369
|
+
if (!item.website && !item.phone && !item.email) {
|
|
370
|
+
return <View style={styles.emptyItem} />;
|
|
371
|
+
}
|
|
372
|
+
return <ContactItem labels={labels} onPress={linkHandler} {...item} />;
|
|
373
|
+
case 'expand':
|
|
374
|
+
return <ListButton label={labels.expand} onPress={() => setExpanded(true)} />;
|
|
375
|
+
case 'collapse':
|
|
376
|
+
return <ListButton label={labels.collapse} onPress={() => setExpanded(false)} />;
|
|
377
|
+
}
|
|
378
|
+
}}
|
|
379
|
+
renderSectionHeader={({ section }) => {
|
|
380
|
+
return section.title ? (
|
|
381
|
+
<View style={styles.sectionHeaderContainer} testID={concatTestID(testID, section.title)}>
|
|
382
|
+
<Typography color={colorScheme.text} preset="m/heading" style={styles.sectionHeaderText}>
|
|
383
|
+
{section.title}
|
|
384
|
+
</Typography>
|
|
385
|
+
</View>
|
|
386
|
+
) : null;
|
|
387
|
+
}}
|
|
388
|
+
scrollEventThrottle={16}
|
|
389
|
+
sections={sections}
|
|
390
|
+
showsVerticalScrollIndicator={false}
|
|
391
|
+
stickySectionHeadersEnabled={false}
|
|
392
|
+
style={styles.list}
|
|
393
|
+
testID={testID}
|
|
394
|
+
/>
|
|
395
|
+
</View>
|
|
396
|
+
);
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
const styles = StyleSheet.create({
|
|
400
|
+
actionButton: {
|
|
401
|
+
alignItems: 'center',
|
|
402
|
+
borderRadius: 19,
|
|
403
|
+
height: 38,
|
|
404
|
+
justifyContent: 'center',
|
|
405
|
+
width: 38,
|
|
406
|
+
},
|
|
407
|
+
button: {
|
|
408
|
+
height: 64,
|
|
409
|
+
justifyContent: 'center',
|
|
410
|
+
paddingBottom: 8,
|
|
411
|
+
width: '100%',
|
|
412
|
+
},
|
|
413
|
+
contactItem: {
|
|
414
|
+
borderRadius: 8,
|
|
415
|
+
},
|
|
416
|
+
contactItemWrapper: {
|
|
417
|
+
padding: 12,
|
|
418
|
+
},
|
|
419
|
+
container: {
|
|
420
|
+
flex: 1,
|
|
421
|
+
},
|
|
422
|
+
emptyItem: {
|
|
423
|
+
height: 0,
|
|
424
|
+
},
|
|
425
|
+
firstItem: {
|
|
426
|
+
borderTopLeftRadius: 8,
|
|
427
|
+
borderTopRightRadius: 8,
|
|
428
|
+
},
|
|
429
|
+
item: {
|
|
430
|
+
alignItems: 'center',
|
|
431
|
+
flexDirection: 'row',
|
|
432
|
+
justifyContent: 'space-between',
|
|
433
|
+
padding: 12,
|
|
434
|
+
},
|
|
435
|
+
itemLabels: {
|
|
436
|
+
flexDirection: 'column',
|
|
437
|
+
},
|
|
438
|
+
itemTitleLabel: {
|
|
439
|
+
opacity: 0.5,
|
|
440
|
+
},
|
|
441
|
+
lastItem: {
|
|
442
|
+
borderBottomLeftRadius: 8,
|
|
443
|
+
borderBottomRightRadius: 8,
|
|
444
|
+
},
|
|
445
|
+
list: {
|
|
446
|
+
marginHorizontal: 16,
|
|
447
|
+
},
|
|
448
|
+
sectionHeaderContainer: {
|
|
449
|
+
justifyContent: 'center',
|
|
450
|
+
marginTop: 20,
|
|
451
|
+
paddingVertical: 16,
|
|
452
|
+
},
|
|
453
|
+
sectionHeaderText: {
|
|
454
|
+
opacity: 0.7,
|
|
455
|
+
paddingHorizontal: 20,
|
|
456
|
+
},
|
|
457
|
+
separator: {
|
|
458
|
+
height: 1,
|
|
459
|
+
marginHorizontal: 12,
|
|
460
|
+
opacity: 0.4,
|
|
461
|
+
},
|
|
462
|
+
subsection: {
|
|
463
|
+
paddingBottom: 8,
|
|
464
|
+
paddingHorizontal: 12,
|
|
465
|
+
paddingTop: 22,
|
|
466
|
+
},
|
|
467
|
+
trustInfoItem: {
|
|
468
|
+
padding: 8,
|
|
469
|
+
},
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
export default TrustInfoDetailsScreen;
|
|
@@ -18,7 +18,8 @@ const cacheTypeToQueryKeys: Record<CacheType, string[]> = {
|
|
|
18
18
|
[CacheType.TRUST_LIST]: [...TRUST_ENTITY_QUERY_KEYS, ...CREDENTIAL_QUERY_KEYS],
|
|
19
19
|
[CacheType.X509_CRL]: CREDENTIAL_QUERY_KEYS,
|
|
20
20
|
[CacheType.ANDROID_ATTESTATION_CRL]: CREDENTIAL_QUERY_KEYS,
|
|
21
|
-
[CacheType.
|
|
21
|
+
[CacheType.OPEN_ID_METADATA_HOLDER]: CREDENTIAL_QUERY_KEYS,
|
|
22
|
+
[CacheType.OPEN_ID_METADATA_ISSUER]: CREDENTIAL_QUERY_KEYS,
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
export const useCacheClear = () => {
|
|
@@ -43,6 +43,7 @@ export const generateHwIdentifier = async (core: ONECore, organisationId: string
|
|
|
43
43
|
},
|
|
44
44
|
name: HW_DID_NAME_PREFIX,
|
|
45
45
|
organisationId,
|
|
46
|
+
trustInformation: [],
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -74,6 +75,7 @@ export const generateSwIdentifier = async (core: ONECore, organisationId: string
|
|
|
74
75
|
},
|
|
75
76
|
name: SW_DID_NAME_PREFIX,
|
|
76
77
|
organisationId,
|
|
78
|
+
trustInformation: [],
|
|
77
79
|
});
|
|
78
80
|
};
|
|
79
81
|
|
|
@@ -87,10 +89,7 @@ export interface IdentifiersInitializationConfig {
|
|
|
87
89
|
* @param {IdentifiersInitializationConfig} config Select desired keys/dids to be created
|
|
88
90
|
* @returns [hwIdentifierId, swIdentifierId]
|
|
89
91
|
*/
|
|
90
|
-
export const useInitializeONECoreIdentifiers = ({
|
|
91
|
-
generateHwKey,
|
|
92
|
-
generateSwKey,
|
|
93
|
-
}: IdentifiersInitializationConfig) => {
|
|
92
|
+
export const useInitializeONECoreIdentifiers = ({ generateHwKey, generateSwKey }: IdentifiersInitializationConfig) => {
|
|
94
93
|
const { core, organisationId } = useONECore();
|
|
95
94
|
|
|
96
95
|
return useCallback(async () => {
|
|
@@ -3,10 +3,11 @@ import {
|
|
|
3
3
|
CredentialState,
|
|
4
4
|
HandleInvitationRequest,
|
|
5
5
|
HandleInvitationResponse,
|
|
6
|
+
HolderAcceptCredentialRequest,
|
|
6
7
|
InitiateIssuanceRequest,
|
|
7
8
|
OneError,
|
|
8
9
|
} from '@procivis/react-native-one-core';
|
|
9
|
-
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from 'react-query';
|
|
10
|
+
import { useInfiniteQuery, useMutation, useQueries, useQuery, useQueryClient } from 'react-query';
|
|
10
11
|
|
|
11
12
|
import { getQueryKeyFromCredentialListQueryParams } from '../../parsers/query';
|
|
12
13
|
import { useONECore } from './core-context';
|
|
@@ -19,6 +20,7 @@ const PAGE_SIZE = 20;
|
|
|
19
20
|
export const CREDENTIAL_LIST_QUERY_KEY = 'credential-list';
|
|
20
21
|
export const CREDENTIAL_LIST_PAGED_QUERY_KEY = 'credential-list-paged';
|
|
21
22
|
export const CREDENTIAL_DETAIL_QUERY_KEY = 'credential-detail';
|
|
23
|
+
export const CREDENTIAL_TRUST_INFORMATION_QUERY_KEY = 'credential-trust-information';
|
|
22
24
|
|
|
23
25
|
export const useCredentials = (queryParams?: Partial<CredentialListQuery>) => {
|
|
24
26
|
const { core, organisationId } = useONECore();
|
|
@@ -105,17 +107,8 @@ export const useCredentialAccept = () => {
|
|
|
105
107
|
const queryClient = useQueryClient();
|
|
106
108
|
const { core } = useONECore();
|
|
107
109
|
|
|
108
|
-
type CredentialAcceptHookParams = {
|
|
109
|
-
didId?: string;
|
|
110
|
-
identifierId?: string;
|
|
111
|
-
interactionId: string;
|
|
112
|
-
keyId?: string;
|
|
113
|
-
txCode?: string;
|
|
114
|
-
holderWalletUnitId?: string;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
110
|
return useMutation(
|
|
118
|
-
async (credentialAcceptHookParams:
|
|
111
|
+
async (credentialAcceptHookParams: HolderAcceptCredentialRequest) =>
|
|
119
112
|
core.holderAcceptCredential(credentialAcceptHookParams),
|
|
120
113
|
{
|
|
121
114
|
onSuccess: async () => {
|
|
@@ -212,3 +205,31 @@ export const useContinueIssuance = () => {
|
|
|
212
205
|
},
|
|
213
206
|
});
|
|
214
207
|
};
|
|
208
|
+
|
|
209
|
+
export const useCredentialTrustInformation = (credentialId: string | undefined) => {
|
|
210
|
+
const { core } = useONECore();
|
|
211
|
+
|
|
212
|
+
return useQuery(
|
|
213
|
+
[CREDENTIAL_TRUST_INFORMATION_QUERY_KEY, credentialId],
|
|
214
|
+
() => (credentialId ? core.getCredentialTrustInformation(credentialId) : undefined),
|
|
215
|
+
{
|
|
216
|
+
enabled: Boolean(credentialId),
|
|
217
|
+
keepPreviousData: true,
|
|
218
|
+
},
|
|
219
|
+
);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export const useCredentialsTrustInformation = (credentialIds: string[]) => {
|
|
223
|
+
const { core } = useONECore();
|
|
224
|
+
|
|
225
|
+
return useQueries(
|
|
226
|
+
credentialIds.map((id) => ({
|
|
227
|
+
keepPreviousData: true,
|
|
228
|
+
meta: {
|
|
229
|
+
id,
|
|
230
|
+
},
|
|
231
|
+
queryFn: () => core.getCredentialTrustInformation(id),
|
|
232
|
+
queryKey: [CREDENTIAL_TRUST_INFORMATION_QUERY_KEY, id],
|
|
233
|
+
})),
|
|
234
|
+
);
|
|
235
|
+
};
|
|
@@ -30,6 +30,7 @@ const PAGE_SIZE = 10;
|
|
|
30
30
|
export const PROOF_DETAIL_QUERY_KEY = 'proof-detail';
|
|
31
31
|
export const PROOF_STATE_QUERY_KEY = 'proof-state';
|
|
32
32
|
export const PROOF_LIST_QUERY_KEY = 'proof-list';
|
|
33
|
+
export const PROOF_REQUEST_TRUST_INFORMATION_QUERY_KEY = 'proof-request-trust-information';
|
|
33
34
|
|
|
34
35
|
export const useProofDetail = (proofId: string | undefined) => {
|
|
35
36
|
const { core } = useONECore();
|
|
@@ -464,3 +465,16 @@ export const useDeleteAllProofsData = (schemaId: string) => {
|
|
|
464
465
|
},
|
|
465
466
|
);
|
|
466
467
|
};
|
|
468
|
+
|
|
469
|
+
export const useProofRequestTrustInformation = (credentialId: string | undefined) => {
|
|
470
|
+
const { core } = useONECore();
|
|
471
|
+
|
|
472
|
+
return useQuery(
|
|
473
|
+
[PROOF_REQUEST_TRUST_INFORMATION_QUERY_KEY, credentialId],
|
|
474
|
+
() => (credentialId ? core.getProofTrustInformation(credentialId) : undefined),
|
|
475
|
+
{
|
|
476
|
+
enabled: Boolean(credentialId),
|
|
477
|
+
keepPreviousData: true,
|
|
478
|
+
},
|
|
479
|
+
);
|
|
480
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { HolderWalletUnit } from '@procivis/react-native-one-core';
|
|
1
2
|
import { useMutation } from 'react-query';
|
|
2
3
|
|
|
3
4
|
import { reportException } from '../../reporting';
|
|
4
5
|
import { useONECore } from './core-context';
|
|
5
|
-
import { HolderWalletUnit } from '@procivis/react-native-one-core';
|
|
6
6
|
|
|
7
7
|
export const useTrustCollectionSync = () => {
|
|
8
8
|
const { core } = useONECore();
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { RegisterVerifierInstanceRequest, UpdateVerifierInstanceRequest } from '@procivis/react-native-one-core';
|
|
2
|
+
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
3
|
+
|
|
4
|
+
import { reportException } from '../../reporting';
|
|
5
|
+
import { useONECore } from './core-context';
|
|
6
|
+
|
|
7
|
+
export const VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY = 'verifier-instance-trust-collections';
|
|
8
|
+
|
|
9
|
+
export const useVerifierInstanceTrustCollections = (verifierInstanceId: string | undefined, active = true) => {
|
|
10
|
+
const { core } = useONECore();
|
|
11
|
+
|
|
12
|
+
return useQuery(
|
|
13
|
+
[VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY, verifierInstanceId],
|
|
14
|
+
() => (verifierInstanceId ? core.getVerifierInstanceTrustCollections(verifierInstanceId) : undefined),
|
|
15
|
+
{
|
|
16
|
+
enabled: active && Boolean(verifierInstanceId),
|
|
17
|
+
keepPreviousData: true,
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const useRegisterVerifierInstance = () => {
|
|
23
|
+
const queryClient = useQueryClient();
|
|
24
|
+
const { core, organisationId } = useONECore();
|
|
25
|
+
|
|
26
|
+
return useMutation(
|
|
27
|
+
async (request: Omit<RegisterVerifierInstanceRequest, 'organisationId'>) =>
|
|
28
|
+
core.registerVerifierInstance({
|
|
29
|
+
organisationId,
|
|
30
|
+
...request,
|
|
31
|
+
}),
|
|
32
|
+
|
|
33
|
+
{
|
|
34
|
+
onSuccess: () => queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY),
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const useVerifierInstanceUpdate = () => {
|
|
40
|
+
const queryClient = useQueryClient();
|
|
41
|
+
const { core } = useONECore();
|
|
42
|
+
|
|
43
|
+
return useMutation(
|
|
44
|
+
async ({ verifierInstanceId, update }: { verifierInstanceId: string; update: UpdateVerifierInstanceRequest }) =>
|
|
45
|
+
core.updateVerifierInstance(verifierInstanceId, update),
|
|
46
|
+
{
|
|
47
|
+
onError: async (err) => {
|
|
48
|
+
reportException(err, 'Update verifier instance failure');
|
|
49
|
+
await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
|
|
50
|
+
},
|
|
51
|
+
onSuccess: () => queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY),
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
};
|
|
@@ -52,7 +52,10 @@ export const useRegisterWalletUnit = () => {
|
|
|
52
52
|
}),
|
|
53
53
|
|
|
54
54
|
{
|
|
55
|
-
onSuccess: () =>
|
|
55
|
+
onSuccess: async () => {
|
|
56
|
+
await queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY);
|
|
57
|
+
await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
|
|
58
|
+
},
|
|
56
59
|
},
|
|
57
60
|
);
|
|
58
61
|
};
|
|
@@ -81,8 +84,12 @@ export const useWalletUnitUpdate = () => {
|
|
|
81
84
|
onError: async (err) => {
|
|
82
85
|
reportException(err, 'Update wallet unit failure');
|
|
83
86
|
await queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY);
|
|
87
|
+
await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
|
|
88
|
+
},
|
|
89
|
+
onSuccess: async () => {
|
|
90
|
+
await queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY);
|
|
91
|
+
await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
|
|
84
92
|
},
|
|
85
|
-
onSuccess: () => queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY),
|
|
86
93
|
},
|
|
87
94
|
);
|
|
88
95
|
};
|