@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,375 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React, { useCallback, useState } from 'react';
|
|
3
|
+
import { Linking, SectionList, StyleSheet, View } from 'react-native';
|
|
4
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
+
import TrustInfo from '../../components/trust-info/trust-info';
|
|
6
|
+
import { concatTestID, nonEmptyFilter, reportException } from '../../utils';
|
|
7
|
+
import { TouchableOpacity } from '../accessibility';
|
|
8
|
+
import { BackButton } from '../buttons';
|
|
9
|
+
import { NavigationHeader } from '../header';
|
|
10
|
+
import { LinkIcon, MailIcon, PhoneIcon } from '../icons';
|
|
11
|
+
import { Typography } from '../text';
|
|
12
|
+
import { useAppColorScheme } from '../theme';
|
|
13
|
+
const Separator = ({
|
|
14
|
+
dark,
|
|
15
|
+
leadingItem
|
|
16
|
+
}) => {
|
|
17
|
+
const colorScheme = useAppColorScheme();
|
|
18
|
+
if ((leadingItem === null || leadingItem === void 0 ? void 0 : leadingItem.type) === 'subsection' || (leadingItem === null || leadingItem === void 0 ? void 0 : leadingItem.type) === 'item' && !(leadingItem !== null && leadingItem !== void 0 && leadingItem.value)) {
|
|
19
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
20
|
+
style: styles.emptyItem
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
24
|
+
style: {
|
|
25
|
+
backgroundColor: dark ? colorScheme.background : colorScheme.white
|
|
26
|
+
}
|
|
27
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
28
|
+
style: [styles.separator, {
|
|
29
|
+
backgroundColor: colorScheme.grayDark
|
|
30
|
+
}]
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
const ListButton = ({
|
|
34
|
+
label,
|
|
35
|
+
onPress
|
|
36
|
+
}) => {
|
|
37
|
+
const colorScheme = useAppColorScheme();
|
|
38
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
39
|
+
onPress: onPress,
|
|
40
|
+
style: [styles.button, styles.lastItem, {
|
|
41
|
+
backgroundColor: colorScheme.white
|
|
42
|
+
}]
|
|
43
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
44
|
+
align: "center",
|
|
45
|
+
color: colorScheme.text
|
|
46
|
+
}, label));
|
|
47
|
+
};
|
|
48
|
+
const ListItem = ({
|
|
49
|
+
action,
|
|
50
|
+
dark,
|
|
51
|
+
title,
|
|
52
|
+
value
|
|
53
|
+
}) => {
|
|
54
|
+
const colorScheme = useAppColorScheme();
|
|
55
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
56
|
+
style: [styles.item, {
|
|
57
|
+
backgroundColor: dark ? undefined : colorScheme.white
|
|
58
|
+
}]
|
|
59
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
60
|
+
style: styles.itemLabels
|
|
61
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
62
|
+
color: colorScheme.text,
|
|
63
|
+
numberOfLines: 1,
|
|
64
|
+
preset: "s/line-height-capped",
|
|
65
|
+
style: styles.itemTitleLabel
|
|
66
|
+
}, title), /*#__PURE__*/React.createElement(Typography, {
|
|
67
|
+
color: colorScheme.text,
|
|
68
|
+
numberOfLines: 1,
|
|
69
|
+
preset: "s/line-height-capped"
|
|
70
|
+
}, value)), action && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
71
|
+
onPress: action.onPress,
|
|
72
|
+
style: [styles.actionButton, {
|
|
73
|
+
backgroundColor: dark ? colorScheme.white : colorScheme.grayDark
|
|
74
|
+
}]
|
|
75
|
+
}, /*#__PURE__*/React.createElement(action.icon, {
|
|
76
|
+
color: colorScheme.black
|
|
77
|
+
})));
|
|
78
|
+
};
|
|
79
|
+
const ContactItem = ({
|
|
80
|
+
email,
|
|
81
|
+
labels,
|
|
82
|
+
onPress,
|
|
83
|
+
phone,
|
|
84
|
+
website
|
|
85
|
+
}) => {
|
|
86
|
+
const colorScheme = useAppColorScheme();
|
|
87
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
88
|
+
style: [styles.contactItemWrapper, {
|
|
89
|
+
backgroundColor: colorScheme.white
|
|
90
|
+
}]
|
|
91
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
92
|
+
style: [styles.contactItem, {
|
|
93
|
+
backgroundColor: colorScheme.background
|
|
94
|
+
}]
|
|
95
|
+
}, website && /*#__PURE__*/React.createElement(ListItem, {
|
|
96
|
+
action: {
|
|
97
|
+
icon: LinkIcon,
|
|
98
|
+
onPress: onPress(website)
|
|
99
|
+
},
|
|
100
|
+
dark: true,
|
|
101
|
+
title: labels.website,
|
|
102
|
+
value: website
|
|
103
|
+
}), website && (email || phone) && /*#__PURE__*/React.createElement(Separator, {
|
|
104
|
+
dark: true
|
|
105
|
+
}), email && /*#__PURE__*/React.createElement(ListItem, {
|
|
106
|
+
action: {
|
|
107
|
+
icon: MailIcon,
|
|
108
|
+
onPress: onPress(`mailto:${email}`)
|
|
109
|
+
},
|
|
110
|
+
dark: true,
|
|
111
|
+
title: labels.email,
|
|
112
|
+
value: email
|
|
113
|
+
}), email && phone && /*#__PURE__*/React.createElement(Separator, {
|
|
114
|
+
dark: true
|
|
115
|
+
}), phone && /*#__PURE__*/React.createElement(ListItem, {
|
|
116
|
+
action: {
|
|
117
|
+
icon: PhoneIcon,
|
|
118
|
+
onPress: onPress(`tel:${phone}`)
|
|
119
|
+
},
|
|
120
|
+
dark: true,
|
|
121
|
+
title: labels.phone,
|
|
122
|
+
value: phone
|
|
123
|
+
})));
|
|
124
|
+
};
|
|
125
|
+
const TrustInfoDetailsScreen = ({
|
|
126
|
+
countries,
|
|
127
|
+
labels,
|
|
128
|
+
language,
|
|
129
|
+
onClose,
|
|
130
|
+
testID,
|
|
131
|
+
trustInformation
|
|
132
|
+
}) => {
|
|
133
|
+
var _countries$find, _countryDisplay$langu, _trustDetails$service, _trustDetails$interme;
|
|
134
|
+
const insets = useSafeAreaInsets();
|
|
135
|
+
const colorScheme = useAppColorScheme();
|
|
136
|
+
const [expanded, setExpanded] = useState(false);
|
|
137
|
+
const linkHandler = useCallback(url => () => {
|
|
138
|
+
Linking.openURL(url).catch(e => {
|
|
139
|
+
reportException(e, `Error opening contact link ${url}`);
|
|
140
|
+
});
|
|
141
|
+
}, []);
|
|
142
|
+
const trustDetails = trustInformation.eudiEcosystem;
|
|
143
|
+
if (!trustDetails) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
const countryDisplay = (_countries$find = countries.find(c => c.value === trustDetails.country)) === null || _countries$find === void 0 ? void 0 : _countries$find.display;
|
|
147
|
+
const country = (_countryDisplay$langu = countryDisplay === null || countryDisplay === void 0 ? void 0 : countryDisplay[language]) !== null && _countryDisplay$langu !== void 0 ? _countryDisplay$langu : countryDisplay === null || countryDisplay === void 0 ? void 0 : countryDisplay.en;
|
|
148
|
+
const baseInfo = [{
|
|
149
|
+
name: trustDetails.name,
|
|
150
|
+
type: 'trustInfo'
|
|
151
|
+
}, {
|
|
152
|
+
title: labels.isPublicSector,
|
|
153
|
+
type: 'item',
|
|
154
|
+
value: trustDetails.isPublicSector ? labels.true : undefined
|
|
155
|
+
}, {
|
|
156
|
+
title: labels.serviceDescription,
|
|
157
|
+
type: 'item',
|
|
158
|
+
value: (_trustDetails$service = trustDetails.serviceDescription[0]) === null || _trustDetails$service === void 0 ? void 0 : _trustDetails$service[language]
|
|
159
|
+
}];
|
|
160
|
+
const expandItem = !expanded ? [{
|
|
161
|
+
type: 'expand'
|
|
162
|
+
}] : [];
|
|
163
|
+
const supervisoryAuthority = trustDetails.supervisoryAuthority ? [{
|
|
164
|
+
title: labels.supervisoryAuthority,
|
|
165
|
+
type: 'subsection'
|
|
166
|
+
}, {
|
|
167
|
+
...trustDetails.supervisoryAuthority,
|
|
168
|
+
type: 'contact',
|
|
169
|
+
website: trustDetails.supervisoryAuthority.uri
|
|
170
|
+
}] : [];
|
|
171
|
+
const extraInfo = expanded ? [{
|
|
172
|
+
title: labels.country,
|
|
173
|
+
type: 'item',
|
|
174
|
+
value: country
|
|
175
|
+
}, {
|
|
176
|
+
title: labels.identifier,
|
|
177
|
+
type: 'item',
|
|
178
|
+
value: trustDetails.identifier
|
|
179
|
+
}, {
|
|
180
|
+
title: labels.support,
|
|
181
|
+
type: 'subsection'
|
|
182
|
+
}, {
|
|
183
|
+
type: 'contact',
|
|
184
|
+
...trustDetails
|
|
185
|
+
}, ...supervisoryAuthority, {
|
|
186
|
+
type: 'collapse'
|
|
187
|
+
}] : [];
|
|
188
|
+
const trustDetailsSection = baseInfo.concat(expandItem).concat(extraInfo);
|
|
189
|
+
const intermediaryName = (_trustDetails$interme = trustDetails.intermediary) !== null && _trustDetails$interme !== void 0 && _trustDetails$interme.name ? [{
|
|
190
|
+
name: trustDetails.intermediary.name,
|
|
191
|
+
type: 'trustInfo'
|
|
192
|
+
}] : [];
|
|
193
|
+
const intermediarySection = trustDetails.intermediary ? [...intermediaryName, {
|
|
194
|
+
title: labels.country,
|
|
195
|
+
type: 'item',
|
|
196
|
+
value: trustDetails.intermediary.country
|
|
197
|
+
}, {
|
|
198
|
+
title: labels.identifier,
|
|
199
|
+
type: 'item',
|
|
200
|
+
value: trustDetails.intermediary.identifier
|
|
201
|
+
}, {
|
|
202
|
+
title: labels.support,
|
|
203
|
+
type: 'subsection'
|
|
204
|
+
}, {
|
|
205
|
+
type: 'contact',
|
|
206
|
+
...trustDetails.intermediary
|
|
207
|
+
}] : [];
|
|
208
|
+
const sections = [{
|
|
209
|
+
ItemSeparatorComponent: Separator,
|
|
210
|
+
data: trustDetailsSection
|
|
211
|
+
}, intermediarySection.length ? {
|
|
212
|
+
ItemSeparatorComponent: Separator,
|
|
213
|
+
data: intermediarySection,
|
|
214
|
+
title: 'Intermediary'
|
|
215
|
+
} : undefined].filter(nonEmptyFilter);
|
|
216
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
217
|
+
style: styles.container
|
|
218
|
+
}, /*#__PURE__*/React.createElement(NavigationHeader, {
|
|
219
|
+
leftItem: /*#__PURE__*/React.createElement(BackButton, {
|
|
220
|
+
onPress: onClose
|
|
221
|
+
}),
|
|
222
|
+
style: {
|
|
223
|
+
paddingTop: insets.top
|
|
224
|
+
},
|
|
225
|
+
title: labels.title
|
|
226
|
+
}), /*#__PURE__*/React.createElement(SectionList, {
|
|
227
|
+
contentInset: insets,
|
|
228
|
+
renderItem: ({
|
|
229
|
+
item,
|
|
230
|
+
section
|
|
231
|
+
}) => {
|
|
232
|
+
switch (item.type) {
|
|
233
|
+
case 'subsection':
|
|
234
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
235
|
+
style: [styles.subsection, {
|
|
236
|
+
backgroundColor: colorScheme.white
|
|
237
|
+
}],
|
|
238
|
+
testID: concatTestID(testID, section.title)
|
|
239
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
240
|
+
color: colorScheme.text,
|
|
241
|
+
preset: "m/heading"
|
|
242
|
+
}, item.title));
|
|
243
|
+
case 'trustInfo':
|
|
244
|
+
return /*#__PURE__*/React.createElement(TrustInfo, {
|
|
245
|
+
labels: labels,
|
|
246
|
+
style: [styles.trustInfoItem, styles.firstItem, {
|
|
247
|
+
backgroundColor: colorScheme.white
|
|
248
|
+
}],
|
|
249
|
+
trustInformation: item
|
|
250
|
+
});
|
|
251
|
+
case 'item':
|
|
252
|
+
if (!item.value) {
|
|
253
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
254
|
+
style: styles.emptyItem
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
return /*#__PURE__*/React.createElement(ListItem, _extends({}, item, {
|
|
258
|
+
value: item.value
|
|
259
|
+
}));
|
|
260
|
+
case 'contact':
|
|
261
|
+
if (!item.website && !item.phone && !item.email) {
|
|
262
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
263
|
+
style: styles.emptyItem
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
return /*#__PURE__*/React.createElement(ContactItem, _extends({
|
|
267
|
+
labels: labels,
|
|
268
|
+
onPress: linkHandler
|
|
269
|
+
}, item));
|
|
270
|
+
case 'expand':
|
|
271
|
+
return /*#__PURE__*/React.createElement(ListButton, {
|
|
272
|
+
label: labels.expand,
|
|
273
|
+
onPress: () => setExpanded(true)
|
|
274
|
+
});
|
|
275
|
+
case 'collapse':
|
|
276
|
+
return /*#__PURE__*/React.createElement(ListButton, {
|
|
277
|
+
label: labels.collapse,
|
|
278
|
+
onPress: () => setExpanded(false)
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
renderSectionHeader: ({
|
|
283
|
+
section
|
|
284
|
+
}) => {
|
|
285
|
+
return section.title ? /*#__PURE__*/React.createElement(View, {
|
|
286
|
+
style: styles.sectionHeaderContainer,
|
|
287
|
+
testID: concatTestID(testID, section.title)
|
|
288
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
289
|
+
color: colorScheme.text,
|
|
290
|
+
preset: "m/heading",
|
|
291
|
+
style: styles.sectionHeaderText
|
|
292
|
+
}, section.title)) : null;
|
|
293
|
+
},
|
|
294
|
+
scrollEventThrottle: 16,
|
|
295
|
+
sections: sections,
|
|
296
|
+
showsVerticalScrollIndicator: false,
|
|
297
|
+
stickySectionHeadersEnabled: false,
|
|
298
|
+
style: styles.list,
|
|
299
|
+
testID: testID
|
|
300
|
+
}));
|
|
301
|
+
};
|
|
302
|
+
const styles = StyleSheet.create({
|
|
303
|
+
actionButton: {
|
|
304
|
+
alignItems: 'center',
|
|
305
|
+
borderRadius: 19,
|
|
306
|
+
height: 38,
|
|
307
|
+
justifyContent: 'center',
|
|
308
|
+
width: 38
|
|
309
|
+
},
|
|
310
|
+
button: {
|
|
311
|
+
height: 64,
|
|
312
|
+
justifyContent: 'center',
|
|
313
|
+
paddingBottom: 8,
|
|
314
|
+
width: '100%'
|
|
315
|
+
},
|
|
316
|
+
contactItem: {
|
|
317
|
+
borderRadius: 8
|
|
318
|
+
},
|
|
319
|
+
contactItemWrapper: {
|
|
320
|
+
padding: 12
|
|
321
|
+
},
|
|
322
|
+
container: {
|
|
323
|
+
flex: 1
|
|
324
|
+
},
|
|
325
|
+
emptyItem: {
|
|
326
|
+
height: 0
|
|
327
|
+
},
|
|
328
|
+
firstItem: {
|
|
329
|
+
borderTopLeftRadius: 8,
|
|
330
|
+
borderTopRightRadius: 8
|
|
331
|
+
},
|
|
332
|
+
item: {
|
|
333
|
+
alignItems: 'center',
|
|
334
|
+
flexDirection: 'row',
|
|
335
|
+
justifyContent: 'space-between',
|
|
336
|
+
padding: 12
|
|
337
|
+
},
|
|
338
|
+
itemLabels: {
|
|
339
|
+
flexDirection: 'column'
|
|
340
|
+
},
|
|
341
|
+
itemTitleLabel: {
|
|
342
|
+
opacity: 0.5
|
|
343
|
+
},
|
|
344
|
+
lastItem: {
|
|
345
|
+
borderBottomLeftRadius: 8,
|
|
346
|
+
borderBottomRightRadius: 8
|
|
347
|
+
},
|
|
348
|
+
list: {
|
|
349
|
+
marginHorizontal: 16
|
|
350
|
+
},
|
|
351
|
+
sectionHeaderContainer: {
|
|
352
|
+
justifyContent: 'center',
|
|
353
|
+
marginTop: 20,
|
|
354
|
+
paddingVertical: 16
|
|
355
|
+
},
|
|
356
|
+
sectionHeaderText: {
|
|
357
|
+
opacity: 0.7,
|
|
358
|
+
paddingHorizontal: 20
|
|
359
|
+
},
|
|
360
|
+
separator: {
|
|
361
|
+
height: 1,
|
|
362
|
+
marginHorizontal: 12,
|
|
363
|
+
opacity: 0.4
|
|
364
|
+
},
|
|
365
|
+
subsection: {
|
|
366
|
+
paddingBottom: 8,
|
|
367
|
+
paddingHorizontal: 12,
|
|
368
|
+
paddingTop: 22
|
|
369
|
+
},
|
|
370
|
+
trustInfoItem: {
|
|
371
|
+
padding: 8
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
export default TrustInfoDetailsScreen;
|
|
375
|
+
//# sourceMappingURL=trust-info-details-screen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","useState","Linking","SectionList","StyleSheet","View","useSafeAreaInsets","TrustInfo","concatTestID","nonEmptyFilter","reportException","TouchableOpacity","BackButton","NavigationHeader","LinkIcon","MailIcon","PhoneIcon","Typography","useAppColorScheme","Separator","dark","leadingItem","colorScheme","type","value","createElement","style","styles","emptyItem","backgroundColor","background","white","separator","grayDark","ListButton","label","onPress","button","lastItem","align","color","text","ListItem","action","title","item","undefined","itemLabels","numberOfLines","preset","itemTitleLabel","actionButton","icon","black","ContactItem","email","labels","phone","website","contactItemWrapper","contactItem","TrustInfoDetailsScreen","countries","language","onClose","testID","trustInformation","_countries$find","_countryDisplay$langu","_trustDetails$service","_trustDetails$interme","insets","expanded","setExpanded","linkHandler","url","openURL","catch","e","trustDetails","eudiEcosystem","countryDisplay","find","c","country","display","en","baseInfo","name","isPublicSector","true","serviceDescription","expandItem","supervisoryAuthority","uri","extraInfo","identifier","support","trustDetailsSection","concat","intermediaryName","intermediary","intermediarySection","sections","ItemSeparatorComponent","data","length","filter","container","leftItem","paddingTop","top","contentInset","renderItem","section","subsection","trustInfoItem","firstItem","_extends","expand","collapse","renderSectionHeader","sectionHeaderContainer","sectionHeaderText","scrollEventThrottle","showsVerticalScrollIndicator","stickySectionHeadersEnabled","list","create","alignItems","borderRadius","height","justifyContent","width","paddingBottom","padding","flex","borderTopLeftRadius","borderTopRightRadius","flexDirection","opacity","borderBottomLeftRadius","borderBottomRightRadius","marginHorizontal","marginTop","paddingVertical","paddingHorizontal"],"sources":["trust-info-details-screen.tsx"],"sourcesContent":["import { TrustInformationDetail } from '@procivis/react-native-one-core';\nimport React, { FC, useCallback, useState } from 'react';\nimport { Linking, SectionList, SectionListData, StyleSheet, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { SvgProps } from 'react-native-svg';\n\nimport TrustInfo, { TrustInfoLabels } from '../../components/trust-info/trust-info';\nimport { concatTestID, nonEmptyFilter, reportException } from '../../utils';\nimport { TouchableOpacity } from '../accessibility';\nimport { BackButton } from '../buttons';\nimport { NavigationHeader } from '../header';\nimport { LinkIcon, MailIcon, PhoneIcon } from '../icons';\nimport { Typography } from '../text';\nimport { useAppColorScheme } from '../theme';\n\ntype TrustInfoDetailItem =\n | {\n name: string;\n type: 'trustInfo';\n }\n | {\n title: string;\n type: 'subsection';\n }\n | {\n action?: {\n icon: FC<SvgProps>;\n onPress: () => void;\n };\n title: string;\n type: 'item';\n value?: string;\n }\n | {\n email?: string;\n phone?: string;\n type: 'contact';\n website?: string;\n }\n | {\n type: 'expand';\n }\n | {\n type: 'collapse';\n };\n\ntype TrustInfoDetailSection = {\n title?: string;\n};\n\nexport type TrustInfoDetailsScreenLabels = TrustInfoLabels & {\n collapse: string;\n country: string;\n email: string;\n expand: string;\n identifier: string;\n isPublicSector: string;\n phone: string;\n privacyPolicy: string;\n serviceDescription: string;\n supervisoryAuthority: string;\n support: string;\n title: string;\n true: string;\n website: string;\n};\n\ntype SeparatorProps = {\n dark?: boolean;\n leadingItem?: TrustInfoDetailItem;\n};\n\nconst Separator: FC<SeparatorProps> = ({ dark, leadingItem }) => {\n const colorScheme = useAppColorScheme();\n if (leadingItem?.type === 'subsection' || (leadingItem?.type === 'item' && !leadingItem?.value)) {\n return <View style={styles.emptyItem} />;\n }\n return (\n <View style={{ backgroundColor: dark ? colorScheme.background : colorScheme.white }}>\n <View style={[styles.separator, { backgroundColor: colorScheme.grayDark }]} />\n </View>\n );\n};\n\ntype ListButtonProps = {\n label: string;\n onPress: () => void;\n};\n\nconst ListButton: FC<ListButtonProps> = ({ label, onPress }) => {\n const colorScheme = useAppColorScheme();\n return (\n <TouchableOpacity\n onPress={onPress}\n style={[styles.button, styles.lastItem, { backgroundColor: colorScheme.white }]}>\n <Typography align=\"center\" color={colorScheme.text}>\n {label}\n </Typography>\n </TouchableOpacity>\n );\n};\n\ntype ListItemProps = {\n action?: {\n icon: FC<SvgProps>;\n onPress: () => void;\n };\n dark?: boolean;\n title: string;\n value: string;\n};\n\nconst ListItem: FC<ListItemProps> = ({ action, dark, title, value }) => {\n const colorScheme = useAppColorScheme();\n return (\n <View style={[styles.item, { backgroundColor: dark ? undefined : colorScheme.white }]}>\n <View style={styles.itemLabels}>\n <Typography\n color={colorScheme.text}\n numberOfLines={1}\n preset=\"s/line-height-capped\"\n style={styles.itemTitleLabel}>\n {title}\n </Typography>\n <Typography color={colorScheme.text} numberOfLines={1} preset=\"s/line-height-capped\">\n {value}\n </Typography>\n </View>\n {action && (\n <TouchableOpacity\n onPress={action.onPress}\n style={[styles.actionButton, { backgroundColor: dark ? colorScheme.white : colorScheme.grayDark }]}>\n <action.icon color={colorScheme.black} />\n </TouchableOpacity>\n )}\n </View>\n );\n};\n\ntype ContactItemProps = {\n email?: string;\n labels: TrustInfoDetailsScreenLabels;\n onPress: (url: string) => () => void;\n phone?: string;\n website?: string;\n};\n\nconst ContactItem: FC<ContactItemProps> = ({ email, labels, onPress, phone, website }) => {\n const colorScheme = useAppColorScheme();\n return (\n <View style={[styles.contactItemWrapper, { backgroundColor: colorScheme.white }]}>\n <View style={[styles.contactItem, { backgroundColor: colorScheme.background }]}>\n {website && (\n <ListItem\n action={{ icon: LinkIcon, onPress: onPress(website) }}\n dark\n title={labels.website}\n value={website}\n />\n )}\n {website && (email || phone) && <Separator dark />}\n {email && (\n <ListItem\n action={{ icon: MailIcon, onPress: onPress(`mailto:${email}`) }}\n dark\n title={labels.email}\n value={email}\n />\n )}\n {email && phone && <Separator dark />}\n {phone && (\n <ListItem\n action={{ icon: PhoneIcon, onPress: onPress(`tel:${phone}`) }}\n dark\n title={labels.phone}\n value={phone}\n />\n )}\n </View>\n </View>\n );\n};\n\nexport type TrustInfoDetailsScreenProps = {\n countries: {\n display: Record<string, string>;\n value: string;\n }[];\n labels: TrustInfoDetailsScreenLabels;\n language: string;\n onClose: () => void;\n testID: string;\n trustInformation: TrustInformationDetail;\n};\n\nconst TrustInfoDetailsScreen: FC<TrustInfoDetailsScreenProps> = ({\n countries,\n labels,\n language,\n onClose,\n testID,\n trustInformation,\n}) => {\n const insets = useSafeAreaInsets();\n const colorScheme = useAppColorScheme();\n const [expanded, setExpanded] = useState(false);\n\n const linkHandler = useCallback(\n (url: string) => () => {\n Linking.openURL(url).catch((e) => {\n reportException(e, `Error opening contact link ${url}`);\n });\n },\n [],\n );\n\n const trustDetails = trustInformation.eudiEcosystem;\n if (!trustDetails) {\n return null;\n }\n\n const countryDisplay = countries.find((c) => c.value === trustDetails.country)?.display;\n const country = countryDisplay?.[language] ?? countryDisplay?.en;\n\n const baseInfo: TrustInfoDetailItem[] = [\n {\n name: trustDetails.name,\n type: 'trustInfo',\n },\n {\n title: labels.isPublicSector,\n type: 'item',\n value: trustDetails.isPublicSector ? labels.true : undefined,\n },\n {\n title: labels.serviceDescription,\n type: 'item',\n value: trustDetails.serviceDescription[0]?.[language],\n },\n ];\n\n const expandItem: TrustInfoDetailItem[] = !expanded ? [{ type: 'expand' }] : [];\n\n const supervisoryAuthority: TrustInfoDetailItem[] = trustDetails.supervisoryAuthority\n ? [\n {\n title: labels.supervisoryAuthority,\n type: 'subsection',\n },\n {\n ...trustDetails.supervisoryAuthority,\n type: 'contact',\n website: trustDetails.supervisoryAuthority.uri,\n },\n ]\n : [];\n\n const extraInfo: TrustInfoDetailItem[] = expanded\n ? [\n {\n title: labels.country,\n type: 'item',\n value: country,\n },\n {\n title: labels.identifier,\n type: 'item',\n value: trustDetails.identifier,\n },\n {\n title: labels.support,\n type: 'subsection',\n },\n {\n type: 'contact',\n ...trustDetails,\n },\n ...supervisoryAuthority,\n { type: 'collapse' },\n ]\n : [];\n\n const trustDetailsSection = baseInfo.concat(expandItem).concat(extraInfo);\n\n const intermediaryName: TrustInfoDetailItem[] = trustDetails.intermediary?.name\n ? [\n {\n name: trustDetails.intermediary.name,\n type: 'trustInfo',\n },\n ]\n : [];\n\n const intermediarySection: TrustInfoDetailItem[] = trustDetails.intermediary\n ? [\n ...intermediaryName,\n {\n title: labels.country,\n type: 'item',\n value: trustDetails.intermediary.country,\n },\n {\n title: labels.identifier,\n type: 'item',\n value: trustDetails.intermediary.identifier,\n },\n {\n title: labels.support,\n type: 'subsection',\n },\n {\n type: 'contact',\n ...trustDetails.intermediary,\n },\n ]\n : [];\n\n const sections: SectionListData<TrustInfoDetailItem, TrustInfoDetailSection>[] = [\n {\n ItemSeparatorComponent: Separator,\n data: trustDetailsSection,\n },\n intermediarySection.length\n ? {\n ItemSeparatorComponent: Separator,\n data: intermediarySection,\n title: 'Intermediary',\n }\n : undefined,\n ].filter(nonEmptyFilter);\n\n return (\n <View style={styles.container}>\n <NavigationHeader\n leftItem={<BackButton onPress={onClose} />}\n style={{\n paddingTop: insets.top,\n }}\n title={labels.title}\n />\n <SectionList<TrustInfoDetailItem, TrustInfoDetailSection>\n contentInset={insets}\n renderItem={({ item, section }) => {\n switch (item.type) {\n case 'subsection':\n return (\n <View\n style={[styles.subsection, { backgroundColor: colorScheme.white }]}\n testID={concatTestID(testID, section.title)}>\n <Typography color={colorScheme.text} preset=\"m/heading\">\n {item.title}\n </Typography>\n </View>\n );\n case 'trustInfo':\n return (\n <TrustInfo\n labels={labels}\n style={[styles.trustInfoItem, styles.firstItem, { backgroundColor: colorScheme.white }]}\n trustInformation={item}\n />\n );\n case 'item':\n if (!item.value) {\n return <View style={styles.emptyItem} />;\n }\n return <ListItem {...item} value={item.value} />;\n case 'contact':\n if (!item.website && !item.phone && !item.email) {\n return <View style={styles.emptyItem} />;\n }\n return <ContactItem labels={labels} onPress={linkHandler} {...item} />;\n case 'expand':\n return <ListButton label={labels.expand} onPress={() => setExpanded(true)} />;\n case 'collapse':\n return <ListButton label={labels.collapse} onPress={() => setExpanded(false)} />;\n }\n }}\n renderSectionHeader={({ section }) => {\n return section.title ? (\n <View style={styles.sectionHeaderContainer} testID={concatTestID(testID, section.title)}>\n <Typography color={colorScheme.text} preset=\"m/heading\" style={styles.sectionHeaderText}>\n {section.title}\n </Typography>\n </View>\n ) : null;\n }}\n scrollEventThrottle={16}\n sections={sections}\n showsVerticalScrollIndicator={false}\n stickySectionHeadersEnabled={false}\n style={styles.list}\n testID={testID}\n />\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n actionButton: {\n alignItems: 'center',\n borderRadius: 19,\n height: 38,\n justifyContent: 'center',\n width: 38,\n },\n button: {\n height: 64,\n justifyContent: 'center',\n paddingBottom: 8,\n width: '100%',\n },\n contactItem: {\n borderRadius: 8,\n },\n contactItemWrapper: {\n padding: 12,\n },\n container: {\n flex: 1,\n },\n emptyItem: {\n height: 0,\n },\n firstItem: {\n borderTopLeftRadius: 8,\n borderTopRightRadius: 8,\n },\n item: {\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 12,\n },\n itemLabels: {\n flexDirection: 'column',\n },\n itemTitleLabel: {\n opacity: 0.5,\n },\n lastItem: {\n borderBottomLeftRadius: 8,\n borderBottomRightRadius: 8,\n },\n list: {\n marginHorizontal: 16,\n },\n sectionHeaderContainer: {\n justifyContent: 'center',\n marginTop: 20,\n paddingVertical: 16,\n },\n sectionHeaderText: {\n opacity: 0.7,\n paddingHorizontal: 20,\n },\n separator: {\n height: 1,\n marginHorizontal: 12,\n opacity: 0.4,\n },\n subsection: {\n paddingBottom: 8,\n paddingHorizontal: 12,\n paddingTop: 22,\n },\n trustInfoItem: {\n padding: 8,\n },\n});\n\nexport default TrustInfoDetailsScreen;\n"],"mappings":";AACA,OAAOA,KAAK,IAAQC,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AACxD,SAASC,OAAO,EAAEC,WAAW,EAAmBC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACtF,SAASC,iBAAiB,QAAQ,gCAAgC;AAGlE,OAAOC,SAAS,MAA2B,wCAAwC;AACnF,SAASC,YAAY,EAAEC,cAAc,EAAEC,eAAe,QAAQ,aAAa;AAC3E,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,UAAU,QAAQ,YAAY;AACvC,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,UAAU;AACxD,SAASC,UAAU,QAAQ,SAAS;AACpC,SAASC,iBAAiB,QAAQ,UAAU;AA2D5C,MAAMC,SAA6B,GAAGA,CAAC;EAAEC,IAAI;EAAEC;AAAY,CAAC,KAAK;EAC/D,MAAMC,WAAW,GAAGJ,iBAAiB,CAAC,CAAC;EACvC,IAAI,CAAAG,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEE,IAAI,MAAK,YAAY,IAAK,CAAAF,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEE,IAAI,MAAK,MAAM,IAAI,EAACF,WAAW,aAAXA,WAAW,eAAXA,WAAW,CAAEG,KAAK,CAAC,EAAE;IAC/F,oBAAOzB,KAAA,CAAA0B,aAAA,CAACpB,IAAI;MAACqB,KAAK,EAAEC,MAAM,CAACC;IAAU,CAAE,CAAC;EAC1C;EACA,oBACE7B,KAAA,CAAA0B,aAAA,CAACpB,IAAI;IAACqB,KAAK,EAAE;MAAEG,eAAe,EAAET,IAAI,GAAGE,WAAW,CAACQ,UAAU,GAAGR,W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@@ -16,7 +16,8 @@ const cacheTypeToQueryKeys = {
|
|
|
16
16
|
[CacheType.TRUST_LIST]: [...TRUST_ENTITY_QUERY_KEYS, ...CREDENTIAL_QUERY_KEYS],
|
|
17
17
|
[CacheType.X509_CRL]: CREDENTIAL_QUERY_KEYS,
|
|
18
18
|
[CacheType.ANDROID_ATTESTATION_CRL]: CREDENTIAL_QUERY_KEYS,
|
|
19
|
-
[CacheType.
|
|
19
|
+
[CacheType.OPEN_ID_METADATA_HOLDER]: CREDENTIAL_QUERY_KEYS,
|
|
20
|
+
[CacheType.OPEN_ID_METADATA_ISSUER]: CREDENTIAL_QUERY_KEYS
|
|
20
21
|
};
|
|
21
22
|
export const useCacheClear = () => {
|
|
22
23
|
const queryClient = useQueryClient();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CacheType","useMutation","useQueryClient","useONECore","CREDENTIAL_DETAIL_QUERY_KEY","CREDENTIAL_LIST_PAGED_QUERY_KEY","CREDENTIAL_LIST_QUERY_KEY","REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY","TRUST_ENTITY_DETAIL_QUERY_KEY","CREDENTIAL_QUERY_KEYS","TRUST_ENTITY_QUERY_KEYS","cacheTypeToQueryKeys","DID_DOCUMENT","JSON_LD_CONTEXT","STATUS_LIST_CREDENTIAL","VCT_METADATA","JSON_SCHEMA","TRUST_LIST","X509_CRL","ANDROID_ATTESTATION_CRL","
|
|
1
|
+
{"version":3,"names":["CacheType","useMutation","useQueryClient","useONECore","CREDENTIAL_DETAIL_QUERY_KEY","CREDENTIAL_LIST_PAGED_QUERY_KEY","CREDENTIAL_LIST_QUERY_KEY","REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY","TRUST_ENTITY_DETAIL_QUERY_KEY","CREDENTIAL_QUERY_KEYS","TRUST_ENTITY_QUERY_KEYS","cacheTypeToQueryKeys","DID_DOCUMENT","JSON_LD_CONTEXT","STATUS_LIST_CREDENTIAL","VCT_METADATA","JSON_SCHEMA","TRUST_LIST","X509_CRL","ANDROID_ATTESTATION_CRL","OPEN_ID_METADATA_HOLDER","OPEN_ID_METADATA_ISSUER","useCacheClear","queryClient","core","cacheTypes","deleteCache","onSuccess","_","queryKeysToInvalidate","Set","forEach","cacheType","keys","key","add","Promise","all","map","queryKey","invalidateQueries"],"sources":["cache.ts"],"sourcesContent":["import { CacheType } from '@procivis/react-native-one-core';\nimport { useMutation, useQueryClient } from 'react-query';\n\nimport { useONECore } from './core-context';\nimport { CREDENTIAL_DETAIL_QUERY_KEY, CREDENTIAL_LIST_PAGED_QUERY_KEY, CREDENTIAL_LIST_QUERY_KEY } from './credentials';\nimport { REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY, TRUST_ENTITY_DETAIL_QUERY_KEY } from './trust-entity';\n\nconst CREDENTIAL_QUERY_KEYS = [CREDENTIAL_LIST_QUERY_KEY, CREDENTIAL_LIST_PAGED_QUERY_KEY, CREDENTIAL_DETAIL_QUERY_KEY];\nconst TRUST_ENTITY_QUERY_KEYS = [TRUST_ENTITY_DETAIL_QUERY_KEY, REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY];\n\n// Map each CacheType to the query keys that should be invalidated when that cache is cleared.\nconst cacheTypeToQueryKeys: Record<CacheType, string[]> = {\n [CacheType.DID_DOCUMENT]: CREDENTIAL_QUERY_KEYS,\n [CacheType.JSON_LD_CONTEXT]: CREDENTIAL_QUERY_KEYS,\n [CacheType.STATUS_LIST_CREDENTIAL]: CREDENTIAL_QUERY_KEYS,\n [CacheType.VCT_METADATA]: CREDENTIAL_QUERY_KEYS,\n [CacheType.JSON_SCHEMA]: CREDENTIAL_QUERY_KEYS,\n [CacheType.TRUST_LIST]: [...TRUST_ENTITY_QUERY_KEYS, ...CREDENTIAL_QUERY_KEYS],\n [CacheType.X509_CRL]: CREDENTIAL_QUERY_KEYS,\n [CacheType.ANDROID_ATTESTATION_CRL]: CREDENTIAL_QUERY_KEYS,\n [CacheType.OPEN_ID_METADATA_HOLDER]: CREDENTIAL_QUERY_KEYS,\n [CacheType.OPEN_ID_METADATA_ISSUER]: CREDENTIAL_QUERY_KEYS,\n};\n\nexport const useCacheClear = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (cacheTypes: CacheType[]) => {\n await core.deleteCache(cacheTypes);\n return cacheTypes;\n },\n {\n onSuccess: async (_, cacheTypes) => {\n const queryKeysToInvalidate = new Set<string>();\n\n cacheTypes.forEach((cacheType) => {\n const keys = cacheTypeToQueryKeys[cacheType] || [];\n keys.forEach((key) => queryKeysToInvalidate.add(key));\n });\n\n await Promise.all([...queryKeysToInvalidate].map((queryKey) => queryClient.invalidateQueries(queryKey)));\n },\n },\n );\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,iCAAiC;AAC3D,SAASC,WAAW,EAAEC,cAAc,QAAQ,aAAa;AAEzD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,2BAA2B,EAAEC,+BAA+B,EAAEC,yBAAyB,QAAQ,eAAe;AACvH,SAASC,oCAAoC,EAAEC,6BAA6B,QAAQ,gBAAgB;AAEpG,MAAMC,qBAAqB,GAAG,CAACH,yBAAyB,EAAED,+BAA+B,EAAED,2BAA2B,CAAC;AACvH,MAAMM,uBAAuB,GAAG,CAACF,6BAA6B,EAAED,oCAAoC,CAAC;;AAErG;AACA,MAAMI,oBAAiD,GAAG;EACxD,CAACX,SAAS,CAACY,YAAY,GAAGH,qBAAqB;EAC/C,CAACT,SAAS,CAACa,eAAe,GAAGJ,qBAAqB;EAClD,CAACT,SAAS,CAACc,sBAAsB,GAAGL,qBAAqB;EACzD,CAACT,SAAS,CAACe,YAAY,GAAGN,qBAAqB;EAC/C,CAACT,SAAS,CAACgB,WAAW,GAAGP,qBAAqB;EAC9C,CAACT,SAAS,CAACiB,UAAU,GAAG,CAAC,GAAGP,uBAAuB,EAAE,GAAGD,qBAAqB,CAAC;EAC9E,CAACT,SAAS,CAACkB,QAAQ,GAAGT,qBAAqB;EAC3C,CAACT,SAAS,CAACmB,uBAAuB,GAAGV,qBAAqB;EAC1D,CAACT,SAAS,CAACoB,uBAAuB,GAAGX,qBAAqB;EAC1D,CAACT,SAAS,CAACqB,uBAAuB,GAAGZ;AACvC,CAAC;AAED,OAAO,MAAMa,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAMC,WAAW,GAAGrB,cAAc,CAAC,CAAC;EACpC,MAAM;IAAEsB;EAAK,CAAC,GAAGrB,UAAU,CAAC,CAAC;EAE7B,OAAOF,WAAW,CAChB,MAAOwB,UAAuB,IAAK;IACjC,MAAMD,IAAI,CAACE,WAAW,CAACD,UAAU,CAAC;IAClC,OAAOA,UAAU;EACnB,CAAC,EACD;IACEE,SAAS,EAAE,MAAAA,CAAOC,CAAC,EAAEH,UAAU,KAAK;MAClC,MAAMI,qBAAqB,GAAG,IAAIC,GAAG,CAAS,CAAC;MAE/CL,UAAU,CAACM,OAAO,CAAEC,SAAS,IAAK;QAChC,MAAMC,IAAI,GAAGtB,oBAAoB,CAACqB,SAAS,CAAC,IAAI,EAAE;QAClDC,IAAI,CAACF,OAAO,CAAEG,GAAG,IAAKL,qBAAqB,CAACM,GAAG,CAACD,GAAG,CAAC,CAAC;MACvD,CAAC,CAAC;MAEF,MAAME,OAAO,CAACC,GAAG,CAAC,CAAC,GAAGR,qBAAqB,CAAC,CAACS,GAAG,CAAEC,QAAQ,IAAKhB,WAAW,CAACiB,iBAAiB,CAACD,QAAQ,CAAC,CAAC,CAAC;IAC1G;EACF,CACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -36,7 +36,8 @@ export const generateHwIdentifier = async (core, organisationId) => {
|
|
|
36
36
|
params: {}
|
|
37
37
|
},
|
|
38
38
|
name: HW_DID_NAME_PREFIX,
|
|
39
|
-
organisationId
|
|
39
|
+
organisationId,
|
|
40
|
+
trustInformation: []
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
return null;
|
|
@@ -64,7 +65,8 @@ export const generateSwIdentifier = async (core, organisationId) => {
|
|
|
64
65
|
params: {}
|
|
65
66
|
},
|
|
66
67
|
name: SW_DID_NAME_PREFIX,
|
|
67
|
-
organisationId
|
|
68
|
+
organisationId,
|
|
69
|
+
trustInformation: []
|
|
68
70
|
});
|
|
69
71
|
};
|
|
70
72
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["OneError","useCallback","reportException","useONECore","OneErrorCode","SW_DID_NAME_PREFIX","HW_DID_NAME_PREFIX","ATTESTATION_DID_NAME_PREFIX","generateHwIdentifier","core","organisationId","hwKeyId","generateKey","keyParams","keyType","name","storageParams","storageType","catch","e","code","KeyStorageNotSupported","createIdentifier","did","method","keys","assertionMethod","authentication","capabilityDelegation","capabilityInvocation","keyAgreement","params","generateSwIdentifier","swKeyId","useInitializeONECoreIdentifiers","generateHwKey","generateSwKey","createOrganisation","id","OrganisationAlreadyExists","then","Promise","all","err"],"sources":["core-init.ts"],"sourcesContent":["import { ONECore, OneError } from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\n\nimport { reportException } from '../../reporting';\nimport { useONECore } from './core-context';\nimport { OneErrorCode } from './error-code';\n\nexport const SW_DID_NAME_PREFIX = 'holder-did-sw-key';\nexport const HW_DID_NAME_PREFIX = 'holder-did-hw-key';\nexport const ATTESTATION_DID_NAME_PREFIX = 'holder-did-attestation-key';\n\nexport const generateHwIdentifier = async (core: ONECore, organisationId: string) => {\n const hwKeyId = await core\n .generateKey({\n keyParams: {},\n keyType: 'ECDSA',\n name: 'holder-key-hw',\n organisationId,\n storageParams: {},\n storageType: 'SECURE_ELEMENT',\n })\n .catch((e) => {\n // ignore if HW keys not supported by device\n if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {\n return null;\n }\n throw e;\n });\n\n if (hwKeyId) {\n return core.createIdentifier({\n did: {\n method: 'KEY',\n name: HW_DID_NAME_PREFIX,\n keys: {\n assertionMethod: [hwKeyId],\n authentication: [hwKeyId],\n capabilityDelegation: [hwKeyId],\n capabilityInvocation: [hwKeyId],\n keyAgreement: [hwKeyId],\n },\n params: {},\n },\n name: HW_DID_NAME_PREFIX,\n organisationId,\n });\n }\n\n return null;\n};\n\nexport const generateSwIdentifier = async (core: ONECore, organisationId: string) => {\n const swKeyId = await core.generateKey({\n keyParams: {},\n keyType: 'ECDSA',\n name: 'holder-key-sw',\n organisationId,\n storageParams: {},\n storageType: 'INTERNAL',\n });\n\n return core.createIdentifier({\n did: {\n method: 'KEY',\n name: SW_DID_NAME_PREFIX,\n keys: {\n assertionMethod: [swKeyId],\n authentication: [swKeyId],\n capabilityDelegation: [swKeyId],\n capabilityInvocation: [swKeyId],\n keyAgreement: [swKeyId],\n },\n params: {},\n },\n name: SW_DID_NAME_PREFIX,\n organisationId,\n });\n};\n\nexport interface IdentifiersInitializationConfig {\n generateHwKey: boolean;\n generateSwKey: boolean;\n}\n\n/**\n * Create base local identifiers\n * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be created\n * @returns [hwIdentifierId, swIdentifierId]\n */\nexport const useInitializeONECoreIdentifiers = ({
|
|
1
|
+
{"version":3,"names":["OneError","useCallback","reportException","useONECore","OneErrorCode","SW_DID_NAME_PREFIX","HW_DID_NAME_PREFIX","ATTESTATION_DID_NAME_PREFIX","generateHwIdentifier","core","organisationId","hwKeyId","generateKey","keyParams","keyType","name","storageParams","storageType","catch","e","code","KeyStorageNotSupported","createIdentifier","did","method","keys","assertionMethod","authentication","capabilityDelegation","capabilityInvocation","keyAgreement","params","trustInformation","generateSwIdentifier","swKeyId","useInitializeONECoreIdentifiers","generateHwKey","generateSwKey","createOrganisation","id","OrganisationAlreadyExists","then","Promise","all","err"],"sources":["core-init.ts"],"sourcesContent":["import { ONECore, OneError } from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\n\nimport { reportException } from '../../reporting';\nimport { useONECore } from './core-context';\nimport { OneErrorCode } from './error-code';\n\nexport const SW_DID_NAME_PREFIX = 'holder-did-sw-key';\nexport const HW_DID_NAME_PREFIX = 'holder-did-hw-key';\nexport const ATTESTATION_DID_NAME_PREFIX = 'holder-did-attestation-key';\n\nexport const generateHwIdentifier = async (core: ONECore, organisationId: string) => {\n const hwKeyId = await core\n .generateKey({\n keyParams: {},\n keyType: 'ECDSA',\n name: 'holder-key-hw',\n organisationId,\n storageParams: {},\n storageType: 'SECURE_ELEMENT',\n })\n .catch((e) => {\n // ignore if HW keys not supported by device\n if (e instanceof OneError && e.code === OneErrorCode.KeyStorageNotSupported) {\n return null;\n }\n throw e;\n });\n\n if (hwKeyId) {\n return core.createIdentifier({\n did: {\n method: 'KEY',\n name: HW_DID_NAME_PREFIX,\n keys: {\n assertionMethod: [hwKeyId],\n authentication: [hwKeyId],\n capabilityDelegation: [hwKeyId],\n capabilityInvocation: [hwKeyId],\n keyAgreement: [hwKeyId],\n },\n params: {},\n },\n name: HW_DID_NAME_PREFIX,\n organisationId,\n trustInformation: [],\n });\n }\n\n return null;\n};\n\nexport const generateSwIdentifier = async (core: ONECore, organisationId: string) => {\n const swKeyId = await core.generateKey({\n keyParams: {},\n keyType: 'ECDSA',\n name: 'holder-key-sw',\n organisationId,\n storageParams: {},\n storageType: 'INTERNAL',\n });\n\n return core.createIdentifier({\n did: {\n method: 'KEY',\n name: SW_DID_NAME_PREFIX,\n keys: {\n assertionMethod: [swKeyId],\n authentication: [swKeyId],\n capabilityDelegation: [swKeyId],\n capabilityInvocation: [swKeyId],\n keyAgreement: [swKeyId],\n },\n params: {},\n },\n name: SW_DID_NAME_PREFIX,\n organisationId,\n trustInformation: [],\n });\n};\n\nexport interface IdentifiersInitializationConfig {\n generateHwKey: boolean;\n generateSwKey: boolean;\n}\n\n/**\n * Create base local identifiers\n * @param {IdentifiersInitializationConfig} config Select desired keys/dids to be created\n * @returns [hwIdentifierId, swIdentifierId]\n */\nexport const useInitializeONECoreIdentifiers = ({ generateHwKey, generateSwKey }: IdentifiersInitializationConfig) => {\n const { core, organisationId } = useONECore();\n\n return useCallback(async () => {\n return await core\n .createOrganisation({ id: organisationId })\n .catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.OrganisationAlreadyExists) {\n return;\n }\n throw e;\n })\n .then(() =>\n Promise.all([\n generateHwKey ? generateHwIdentifier(core, organisationId) : null,\n generateSwKey ? generateSwIdentifier(core, organisationId) : null,\n ]),\n )\n .catch((err) => {\n reportException(err, 'Failed to create base identifiers');\n throw err;\n });\n }, [core, organisationId, generateHwKey, generateSwKey]);\n};\n"],"mappings":"AAAA,SAAkBA,QAAQ,QAAQ,iCAAiC;AACnE,SAASC,WAAW,QAAQ,OAAO;AAEnC,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,YAAY,QAAQ,cAAc;AAE3C,OAAO,MAAMC,kBAAkB,GAAG,mBAAmB;AACrD,OAAO,MAAMC,kBAAkB,GAAG,mBAAmB;AACrD,OAAO,MAAMC,2BAA2B,GAAG,4BAA4B;AAEvE,OAAO,MAAMC,oBAAoB,GAAG,MAAAA,CAAOC,IAAa,EAAEC,cAAsB,KAAK;EACnF,MAAMC,OAAO,GAAG,MAAMF,IAAI,CACvBG,WAAW,CAAC;IACXC,SAAS,EAAE,CAAC,CAAC;IACbC,OAAO,EAAE,OAAO;IAChBC,IAAI,EAAE,eAAe;IACrBL,cAAc;IACdM,aAAa,EAAE,CAAC,CAAC;IACjBC,WAAW,EAAE;EACf,CAAC,CAAC,CACDC,KAAK,CAAEC,CAAC,IAAK;IACZ;IACA,IAAIA,CAAC,YAAYnB,QAAQ,IAAImB,CAAC,CAACC,IAAI,KAAKhB,YAAY,CAACiB,sBAAsB,EAAE;MAC3E,OAAO,IAAI;IACb;IACA,MAAMF,CAAC;EACT,CAAC,CAAC;EAEJ,IAAIR,OAAO,EAAE;IACX,OAAOF,IAAI,CAACa,gBAAgB,CAAC;MAC3BC,GAAG,EAAE;QACHC,MAAM,EAAE,KAAK;QACbT,IAAI,EAAET,kBAAkB;QACxBmB,IAAI,EAAE;UACJC,eAAe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IAAI;IAAEC;EAAe,CAAC,GAAGP,UAAU,CAAC,CAAC;EAE7C,OAAOF,WAAW,CAAC,YAAY;IAC7B,OAAO,MAAMQ,IAAI,CACd6B,kBAAkB,CAAC;MAAEC,EAAE,EAAE7B;IAAe,CAAC,CAAC,CAC1CQ,KAAK,CAAEC,CAAC,IAAK;MACZ,IAAIA,CAAC,YAAYnB,QAAQ,IAAImB,CAAC,CAACC,IAAI,KAAKhB,YAAY,CAACoC,yBAAyB,EAAE;QAC9E;MACF;MACA,MAAMrB,CAAC;IACT,CAAC,CAAC,CACDsB,IAAI,CAAC,MACJC,OAAO,CAACC,GAAG,CAAC,CACVP,aAAa,GAAG5B,oBAAoB,CAACC,IAAI,EAAEC,cAAc,CAAC,GAAG,IAAI,EACjE2B,aAAa,GAAGJ,oBAAoB,CAACxB,IAAI,EAAEC,cAAc,CAAC,GAAG,IAAI,CAClE,CACH,CAAC,CACAQ,KAAK,CAAE0B,GAAG,IAAK;MACd1C,eAAe,CAAC0C,GAAG,EAAE,mCAAmC,CAAC;MACzD,MAAMA,GAAG;IACX,CAAC,CAAC;EACN,CAAC,EAAE,CAACnC,IAAI,EAAEC,cAAc,EAAE0B,aAAa,EAAEC,aAAa,CAAC,CAAC;AAC1D,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CredentialState, OneError } from '@procivis/react-native-one-core';
|
|
2
|
-
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from 'react-query';
|
|
2
|
+
import { useInfiniteQuery, useMutation, useQueries, useQuery, useQueryClient } from 'react-query';
|
|
3
3
|
import { getQueryKeyFromCredentialListQueryParams } from '../../parsers/query';
|
|
4
4
|
import { useONECore } from './core-context';
|
|
5
5
|
import { CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY, CREDENTIAL_SCHEMA_LIST_QUERY_KEY } from './credential-schemas';
|
|
@@ -10,6 +10,7 @@ const PAGE_SIZE = 20;
|
|
|
10
10
|
export const CREDENTIAL_LIST_QUERY_KEY = 'credential-list';
|
|
11
11
|
export const CREDENTIAL_LIST_PAGED_QUERY_KEY = 'credential-list-paged';
|
|
12
12
|
export const CREDENTIAL_DETAIL_QUERY_KEY = 'credential-detail';
|
|
13
|
+
export const CREDENTIAL_TRUST_INFORMATION_QUERY_KEY = 'credential-trust-information';
|
|
13
14
|
export const useCredentials = queryParams => {
|
|
14
15
|
const {
|
|
15
16
|
core,
|
|
@@ -172,4 +173,26 @@ export const useContinueIssuance = () => {
|
|
|
172
173
|
}
|
|
173
174
|
});
|
|
174
175
|
};
|
|
176
|
+
export const useCredentialTrustInformation = credentialId => {
|
|
177
|
+
const {
|
|
178
|
+
core
|
|
179
|
+
} = useONECore();
|
|
180
|
+
return useQuery([CREDENTIAL_TRUST_INFORMATION_QUERY_KEY, credentialId], () => credentialId ? core.getCredentialTrustInformation(credentialId) : undefined, {
|
|
181
|
+
enabled: Boolean(credentialId),
|
|
182
|
+
keepPreviousData: true
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
export const useCredentialsTrustInformation = credentialIds => {
|
|
186
|
+
const {
|
|
187
|
+
core
|
|
188
|
+
} = useONECore();
|
|
189
|
+
return useQueries(credentialIds.map(id => ({
|
|
190
|
+
keepPreviousData: true,
|
|
191
|
+
meta: {
|
|
192
|
+
id
|
|
193
|
+
},
|
|
194
|
+
queryFn: () => core.getCredentialTrustInformation(id),
|
|
195
|
+
queryKey: [CREDENTIAL_TRUST_INFORMATION_QUERY_KEY, id]
|
|
196
|
+
})));
|
|
197
|
+
};
|
|
175
198
|
//# sourceMappingURL=credentials.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CredentialState","OneError","useInfiniteQuery","useMutation","useQuery","useQueryClient","getQueryKeyFromCredentialListQueryParams","useONECore","CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY","CREDENTIAL_SCHEMA_LIST_QUERY_KEY","OneErrorCode","HISTORY_LIST_QUERY_KEY","PROOF_LIST_QUERY_KEY","PAGE_SIZE","CREDENTIAL_LIST_QUERY_KEY","CREDENTIAL_LIST_PAGED_QUERY_KEY","CREDENTIAL_DETAIL_QUERY_KEY","useCredentials","queryParams","core","organisationId","values","listCredentials","page","pageSize","states","ACCEPTED","SUSPENDED","REVOKED","keepPreviousData","usePagedCredentials","pageParam","getNextPageParam","lastPage","allPages","length","totalPages","undefined","useCredentialDetail","credentialId","active","getCredential","enabled","Boolean","useInvitationHandler","queryClient","request","handleInvitation","onSuccess","result","type_","invalidateQueries","useCredentialAccept","credentialAcceptHookParams","holderAcceptCredential","useCredentialReject","interactionId","holderRejectCredential","catch","e","code","OperationNotSupported","useCredentialRevocationCheck","forceRefresh","credentialIds","checkRevocation","useCredentialDelete","deleteCredential","_","removeQueries","useInvalidateCredentialDetails","useInitiateIssuance","initiateIssuance","useContinueIssuance","url","continueIssuance"],"sources":["credentials.ts"],"sourcesContent":["import {\n CredentialListQuery,\n CredentialState,\n HandleInvitationRequest,\n HandleInvitationResponse,\n InitiateIssuanceRequest,\n OneError,\n} from '@procivis/react-native-one-core';\nimport { useInfiniteQuery, useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { getQueryKeyFromCredentialListQueryParams } from '../../parsers/query';\nimport { useONECore } from './core-context';\nimport { CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY, CREDENTIAL_SCHEMA_LIST_QUERY_KEY } from './credential-schemas';\nimport { OneErrorCode } from './error-code';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\nimport { PROOF_LIST_QUERY_KEY } from './proofs';\n\nconst PAGE_SIZE = 20;\nexport const CREDENTIAL_LIST_QUERY_KEY = 'credential-list';\nexport const CREDENTIAL_LIST_PAGED_QUERY_KEY = 'credential-list-paged';\nexport const CREDENTIAL_DETAIL_QUERY_KEY = 'credential-detail';\n\nexport const useCredentials = (queryParams?: Partial<CredentialListQuery>) => {\n const { core, organisationId } = useONECore();\n\n return useQuery(\n [CREDENTIAL_LIST_QUERY_KEY, ...getQueryKeyFromCredentialListQueryParams(queryParams)],\n async () => {\n const { values } = await core.listCredentials({\n organisationId,\n page: 0,\n // TODO: workaround pagination for now, until it's supported by UI\n pageSize: 10000,\n states: [CredentialState.ACCEPTED, CredentialState.SUSPENDED, CredentialState.REVOKED],\n ...queryParams,\n });\n return values;\n },\n {\n keepPreviousData: true,\n },\n );\n};\n\nexport const usePagedCredentials = (queryParams?: Partial<CredentialListQuery>) => {\n const { core, organisationId } = useONECore();\n\n return useInfiniteQuery(\n [\n CREDENTIAL_LIST_QUERY_KEY,\n CREDENTIAL_LIST_PAGED_QUERY_KEY,\n ...getQueryKeyFromCredentialListQueryParams(queryParams),\n ],\n ({ pageParam = 0 }) =>\n core.listCredentials({\n organisationId,\n page: pageParam,\n pageSize: PAGE_SIZE,\n states: [CredentialState.ACCEPTED, CredentialState.SUSPENDED, CredentialState.REVOKED],\n ...queryParams,\n }),\n {\n getNextPageParam: (lastPage, allPages) => (allPages.length < lastPage.totalPages ? allPages.length : undefined),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useCredentialDetail = (credentialId: string | undefined, active = true) => {\n const { core } = useONECore();\n\n return useQuery(\n [CREDENTIAL_DETAIL_QUERY_KEY, credentialId],\n () => (credentialId ? core.getCredential(credentialId) : undefined),\n {\n enabled: active && Boolean(credentialId),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useInvitationHandler = () => {\n const queryClient = useQueryClient();\n const { core, organisationId } = useONECore();\n\n return useMutation(\n async (request: Omit<HandleInvitationRequest, 'organisationId'>) =>\n core.handleInvitation({ organisationId, ...request }),\n {\n onSuccess: async (result: HandleInvitationResponse) => {\n if (result.type_ === 'PROOF_REQUEST') {\n await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);\n } else {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);\n }\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useCredentialAccept = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n type CredentialAcceptHookParams = {\n didId?: string;\n identifierId?: string;\n interactionId: string;\n keyId?: string;\n txCode?: string;\n holderWalletUnitId?: string;\n };\n\n return useMutation(\n async (credentialAcceptHookParams: CredentialAcceptHookParams) =>\n core.holderAcceptCredential(credentialAcceptHookParams),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useCredentialReject = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (interactionId: string) =>\n core.holderRejectCredential(interactionId).catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.OperationNotSupported) {\n return;\n }\n throw e;\n }),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useCredentialRevocationCheck = (forceRefresh: boolean) => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (credentialIds: string[]) => core.checkRevocation(credentialIds, forceRefresh), {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useCredentialDelete = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (credentialId: string) => core.deleteCredential(credentialId), {\n onSuccess: async (_, credentialId) => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.removeQueries([CREDENTIAL_DETAIL_QUERY_KEY, credentialId]);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useInvalidateCredentialDetails = () => {\n const queryClient = useQueryClient();\n\n return (credentialId: string | undefined) =>\n queryClient.invalidateQueries([CREDENTIAL_DETAIL_QUERY_KEY, credentialId]);\n};\n\nexport const useInitiateIssuance = () => {\n const queryClient = useQueryClient();\n const { core, organisationId } = useONECore();\n\n return useMutation(\n async (request: Omit<InitiateIssuanceRequest, 'organisationId'>) =>\n core.initiateIssuance({ organisationId, ...request }),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useContinueIssuance = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (url: string) => core.continueIssuance(url), {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n"],"mappings":"AAAA,SAEEA,eAAe,EAIfC,QAAQ,QACH,iCAAiC;AACxC,SAASC,gBAAgB,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,aAAa;AAErF,SAASC,wCAAwC,QAAQ,qBAAqB;AAC9E,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,kCAAkC,EAAEC,gCAAgC,QAAQ,sBAAsB;AAC3G,SAASC,YAAY,QAAQ,cAAc;AAC3C,SAASC,sBAAsB,QAAQ,WAAW;AACl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Queries","useQuery","useQueryClient","getQueryKeyFromCredentialListQueryParams","useONECore","CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY","CREDENTIAL_SCHEMA_LIST_QUERY_KEY","OneErrorCode","HISTORY_LIST_QUERY_KEY","PROOF_LIST_QUERY_KEY","PAGE_SIZE","CREDENTIAL_LIST_QUERY_KEY","CREDENTIAL_LIST_PAGED_QUERY_KEY","CREDENTIAL_DETAIL_QUERY_KEY","CREDENTIAL_TRUST_INFORMATION_QUERY_KEY","useCredentials","queryParams","core","organisationId","values","listCredentials","page","pageSize","states","ACCEPTED","SUSPENDED","REVOKED","keepPreviousData","usePagedCredentials","pageParam","getNextPageParam","lastPage","allPages","length","totalPages","undefined","useCredentialDetail","credentialId","active","getCredential","enabled","Boolean","useInvitationHandler","queryClient","request","handleInvitation","onSuccess","result","type_","invalidateQueries","useCredentialAccept","credentialAcceptHookParams","holderAcceptCredential","useCredentialReject","interactionId","holderRejectCredential","catch","e","code","OperationNotSupported","useCredentialRevocationCheck","forceRefresh","credentialIds","checkRevocation","useCredentialDelete","deleteCredential","_","removeQueries","useInvalidateCredentialDetails","useInitiateIssuance","initiateIssuance","useContinueIssuance","url","continueIssuance","useCredentialTrustInformation","getCredentialTrustInformation","useCredentialsTrustInformation","map","id","meta","queryFn","queryKey"],"sources":["credentials.ts"],"sourcesContent":["import {\n CredentialListQuery,\n CredentialState,\n HandleInvitationRequest,\n HandleInvitationResponse,\n HolderAcceptCredentialRequest,\n InitiateIssuanceRequest,\n OneError,\n} from '@procivis/react-native-one-core';\nimport { useInfiniteQuery, useMutation, useQueries, useQuery, useQueryClient } from 'react-query';\n\nimport { getQueryKeyFromCredentialListQueryParams } from '../../parsers/query';\nimport { useONECore } from './core-context';\nimport { CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY, CREDENTIAL_SCHEMA_LIST_QUERY_KEY } from './credential-schemas';\nimport { OneErrorCode } from './error-code';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\nimport { PROOF_LIST_QUERY_KEY } from './proofs';\n\nconst PAGE_SIZE = 20;\nexport const CREDENTIAL_LIST_QUERY_KEY = 'credential-list';\nexport const CREDENTIAL_LIST_PAGED_QUERY_KEY = 'credential-list-paged';\nexport const CREDENTIAL_DETAIL_QUERY_KEY = 'credential-detail';\nexport const CREDENTIAL_TRUST_INFORMATION_QUERY_KEY = 'credential-trust-information';\n\nexport const useCredentials = (queryParams?: Partial<CredentialListQuery>) => {\n const { core, organisationId } = useONECore();\n\n return useQuery(\n [CREDENTIAL_LIST_QUERY_KEY, ...getQueryKeyFromCredentialListQueryParams(queryParams)],\n async () => {\n const { values } = await core.listCredentials({\n organisationId,\n page: 0,\n // TODO: workaround pagination for now, until it's supported by UI\n pageSize: 10000,\n states: [CredentialState.ACCEPTED, CredentialState.SUSPENDED, CredentialState.REVOKED],\n ...queryParams,\n });\n return values;\n },\n {\n keepPreviousData: true,\n },\n );\n};\n\nexport const usePagedCredentials = (queryParams?: Partial<CredentialListQuery>) => {\n const { core, organisationId } = useONECore();\n\n return useInfiniteQuery(\n [\n CREDENTIAL_LIST_QUERY_KEY,\n CREDENTIAL_LIST_PAGED_QUERY_KEY,\n ...getQueryKeyFromCredentialListQueryParams(queryParams),\n ],\n ({ pageParam = 0 }) =>\n core.listCredentials({\n organisationId,\n page: pageParam,\n pageSize: PAGE_SIZE,\n states: [CredentialState.ACCEPTED, CredentialState.SUSPENDED, CredentialState.REVOKED],\n ...queryParams,\n }),\n {\n getNextPageParam: (lastPage, allPages) => (allPages.length < lastPage.totalPages ? allPages.length : undefined),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useCredentialDetail = (credentialId: string | undefined, active = true) => {\n const { core } = useONECore();\n\n return useQuery(\n [CREDENTIAL_DETAIL_QUERY_KEY, credentialId],\n () => (credentialId ? core.getCredential(credentialId) : undefined),\n {\n enabled: active && Boolean(credentialId),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useInvitationHandler = () => {\n const queryClient = useQueryClient();\n const { core, organisationId } = useONECore();\n\n return useMutation(\n async (request: Omit<HandleInvitationRequest, 'organisationId'>) =>\n core.handleInvitation({ organisationId, ...request }),\n {\n onSuccess: async (result: HandleInvitationResponse) => {\n if (result.type_ === 'PROOF_REQUEST') {\n await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);\n } else {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);\n }\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useCredentialAccept = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (credentialAcceptHookParams: HolderAcceptCredentialRequest) =>\n core.holderAcceptCredential(credentialAcceptHookParams),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useCredentialReject = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (interactionId: string) =>\n core.holderRejectCredential(interactionId).catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.OperationNotSupported) {\n return;\n }\n throw e;\n }),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useCredentialRevocationCheck = (forceRefresh: boolean) => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (credentialIds: string[]) => core.checkRevocation(credentialIds, forceRefresh), {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useCredentialDelete = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (credentialId: string) => core.deleteCredential(credentialId), {\n onSuccess: async (_, credentialId) => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.removeQueries([CREDENTIAL_DETAIL_QUERY_KEY, credentialId]);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useInvalidateCredentialDetails = () => {\n const queryClient = useQueryClient();\n\n return (credentialId: string | undefined) =>\n queryClient.invalidateQueries([CREDENTIAL_DETAIL_QUERY_KEY, credentialId]);\n};\n\nexport const useInitiateIssuance = () => {\n const queryClient = useQueryClient();\n const { core, organisationId } = useONECore();\n\n return useMutation(\n async (request: Omit<InitiateIssuanceRequest, 'organisationId'>) =>\n core.initiateIssuance({ organisationId, ...request }),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useContinueIssuance = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (url: string) => core.continueIssuance(url), {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useCredentialTrustInformation = (credentialId: string | undefined) => {\n const { core } = useONECore();\n\n return useQuery(\n [CREDENTIAL_TRUST_INFORMATION_QUERY_KEY, credentialId],\n () => (credentialId ? core.getCredentialTrustInformation(credentialId) : undefined),\n {\n enabled: Boolean(credentialId),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useCredentialsTrustInformation = (credentialIds: string[]) => {\n const { core } = useONECore();\n\n return useQueries(\n credentialIds.map((id) => ({\n keepPreviousData: true,\n meta: {\n id,\n },\n queryFn: () => core.getCredentialTrustInformation(id),\n queryKey: [CREDENTIAL_TRUST_INFORMATION_QUERY_KEY, id],\n })),\n );\n};\n"],"mappings":"AAAA,SAEEA,eAAe,EAKfC,QAAQ,QACH,iCAAiC;AACxC,SAASC,gBAAgB,EAAEC,WAAW,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,aAAa;AAEjG,SAASC,wCAAwC,QAAQ,qBAAqB;AAC9E,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,kCAAkC,EAAEC,gCAAgC,QAAQ,sBAAsB;AAC3G,SAASC,YAAY,QAAQ,cAAc;AAC3C,SAASC,sBAAsB,QAAQ,WAAW;AAClD,SAASC,oBAAoB,QAAQ,UAAU;AAE/C,MAAMC,SAAS,GAAG,EAAE;AACpB,OAAO,MAAMC,yBAAyB,GAAG,iBAAiB;AAC1D,OAAO,MAAMC,+BAA+B,GAAG,uBAAuB;AACtE,OAAO,MAAMC,2BAA2B,GAAG,mBAAmB;AAC9D,OAAO,MAAMC,sCAAsC,GAAG,8BAA8B;AAEpF,OAAO,MAAMC,cAAc,GAAIC,WAA0C,IAAK;EAC5E,MAAM;IAAEC,IAAI;IAAEC;EAAe,CAAC,GAAGd,UAAU,CAAC,CAAC;EAE7C,OAAOH,QAAQ,CACb,CAACU,yBAAyB,EAAE,GAAGR,wCAAwC,CAACa,WAAW,CAAC,CAAC,EACrF,YAAY;IACV,MAAM;MAAEG;IAAO,CAAC,GAAG,MAAMF,IAAI,CAACG,eAAe,CAAC;MAC5CF,cAAc;MACdG,IAAI,EAAE,CAAC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