@procivis/one-react-native-components 0.3.115 → 0.3.130

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.
Files changed (262) hide show
  1. package/lib/commonjs/components/credential/credential.js +2 -1
  2. package/lib/commonjs/components/credential/credential.js.map +1 -1
  3. package/lib/commonjs/components/history/history-list-item-icon.js +3 -3
  4. package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
  5. package/lib/commonjs/components/history/history-list-item.js +2 -8
  6. package/lib/commonjs/components/history/history-list-item.js.map +1 -1
  7. package/lib/commonjs/components/history/history-list-screen.js +1 -1
  8. package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
  9. package/lib/commonjs/components/index.js +11 -11
  10. package/lib/commonjs/components/index.js.map +1 -1
  11. package/lib/commonjs/components/proof-request/v1/select-credential.js +2 -1
  12. package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -1
  13. package/lib/commonjs/components/proof-request/v1/share-credential.js +2 -1
  14. package/lib/commonjs/components/proof-request/v1/share-credential.js.map +1 -1
  15. package/lib/commonjs/components/proof-request/v2/select-credential-v2.js +2 -1
  16. package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -1
  17. package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js +3 -1
  18. package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  19. package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +4 -2
  20. package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
  21. package/lib/commonjs/components/trust-info/index.js +29 -0
  22. package/lib/commonjs/components/trust-info/index.js.map +1 -0
  23. package/lib/commonjs/components/trust-info/trust-info.js +79 -0
  24. package/lib/commonjs/components/trust-info/trust-info.js.map +1 -0
  25. package/lib/commonjs/ui-components/credential/card/credential-details-card.js +3 -1
  26. package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
  27. package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
  28. package/lib/commonjs/ui-components/header/header.js +2 -0
  29. package/lib/commonjs/ui-components/header/header.js.map +1 -1
  30. package/lib/commonjs/ui-components/history/history-details.js +2 -2
  31. package/lib/commonjs/ui-components/history/history-details.js.map +1 -1
  32. package/lib/commonjs/ui-components/icons/contact.js +45 -0
  33. package/lib/commonjs/ui-components/icons/contact.js.map +1 -0
  34. package/lib/commonjs/ui-components/icons/credential.js +3 -3
  35. package/lib/commonjs/ui-components/icons/credential.js.map +1 -1
  36. package/lib/commonjs/ui-components/icons/icons.js +20 -1
  37. package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
  38. package/lib/commonjs/ui-components/icons/index.js +11 -0
  39. package/lib/commonjs/ui-components/icons/index.js.map +1 -1
  40. package/lib/commonjs/ui-components/loader/loading-result.js +2 -0
  41. package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
  42. package/lib/commonjs/ui-components/screens/index.js +7 -0
  43. package/lib/commonjs/ui-components/screens/index.js.map +1 -1
  44. package/lib/commonjs/ui-components/screens/nerd-mode-screen.js +28 -24
  45. package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
  46. package/lib/commonjs/ui-components/screens/trust-info-details-screen.js +384 -0
  47. package/lib/commonjs/ui-components/screens/trust-info-details-screen.js.map +1 -0
  48. package/lib/commonjs/utils/date.js +4 -5
  49. package/lib/commonjs/utils/date.js.map +1 -1
  50. package/lib/commonjs/utils/hooks/core/cache.js +8 -4
  51. package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
  52. package/lib/commonjs/utils/hooks/core/core-config.js +1 -6
  53. package/lib/commonjs/utils/hooks/core/core-config.js.map +1 -1
  54. package/lib/commonjs/utils/hooks/core/core-context.js +0 -15
  55. package/lib/commonjs/utils/hooks/core/core-context.js.map +1 -1
  56. package/lib/commonjs/utils/hooks/core/credentials.js +40 -1
  57. package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
  58. package/lib/commonjs/utils/hooks/core/index.js +0 -11
  59. package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
  60. package/lib/commonjs/utils/hooks/core/proofs.js +12 -1
  61. package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
  62. package/lib/commonjs/utils/hooks/core/trust-list.js +19 -3
  63. package/lib/commonjs/utils/hooks/core/trust-list.js.map +1 -1
  64. package/lib/commonjs/utils/hooks/core/verifier-instance.js +22 -3
  65. package/lib/commonjs/utils/hooks/core/verifier-instance.js.map +1 -1
  66. package/lib/commonjs/utils/hooks/core/wallet-unit.js +2 -2
  67. package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
  68. package/lib/commonjs/utils/parsers/credential-sharing-v2.js +14 -14
  69. package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
  70. package/lib/commonjs/utils/parsers/credential-sharing.js +20 -18
  71. package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
  72. package/lib/commonjs/utils/parsers/credential.js +36 -22
  73. package/lib/commonjs/utils/parsers/credential.js.map +1 -1
  74. package/lib/commonjs/utils/parsers/query.js +1 -1
  75. package/lib/commonjs/utils/parsers/query.js.map +1 -1
  76. package/lib/commonjs/utils/translations.js +15 -0
  77. package/lib/commonjs/utils/translations.js.map +1 -0
  78. package/lib/module/components/credential/credential.js +2 -1
  79. package/lib/module/components/credential/credential.js.map +1 -1
  80. package/lib/module/components/history/history-list-item-icon.js +3 -3
  81. package/lib/module/components/history/history-list-item-icon.js.map +1 -1
  82. package/lib/module/components/history/history-list-item.js +3 -9
  83. package/lib/module/components/history/history-list-item.js.map +1 -1
  84. package/lib/module/components/history/history-list-screen.js +1 -1
  85. package/lib/module/components/history/history-list-screen.js.map +1 -1
  86. package/lib/module/components/index.js +1 -1
  87. package/lib/module/components/index.js.map +1 -1
  88. package/lib/module/components/proof-request/v1/select-credential.js +2 -1
  89. package/lib/module/components/proof-request/v1/select-credential.js.map +1 -1
  90. package/lib/module/components/proof-request/v1/share-credential.js +2 -1
  91. package/lib/module/components/proof-request/v1/share-credential.js.map +1 -1
  92. package/lib/module/components/proof-request/v2/select-credential-v2.js +2 -1
  93. package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -1
  94. package/lib/module/components/proof-request/v2/share-credential-v2-group.js +3 -1
  95. package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  96. package/lib/module/components/proof-request/v2/share-credential-v2.js +4 -2
  97. package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
  98. package/lib/module/components/trust-info/index.js +4 -0
  99. package/lib/module/components/trust-info/index.js.map +1 -0
  100. package/lib/module/components/trust-info/trust-info.js +70 -0
  101. package/lib/module/components/trust-info/trust-info.js.map +1 -0
  102. package/lib/module/ui-components/credential/card/credential-details-card.js +3 -1
  103. package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
  104. package/lib/module/ui-components/header/foldable-header.js.map +1 -1
  105. package/lib/module/ui-components/header/header.js +2 -0
  106. package/lib/module/ui-components/header/header.js.map +1 -1
  107. package/lib/module/ui-components/history/history-details.js +3 -3
  108. package/lib/module/ui-components/history/history-details.js.map +1 -1
  109. package/lib/module/ui-components/icons/contact.js +34 -0
  110. package/lib/module/ui-components/icons/contact.js.map +1 -0
  111. package/lib/module/ui-components/icons/credential.js +1 -1
  112. package/lib/module/ui-components/icons/credential.js.map +1 -1
  113. package/lib/module/ui-components/icons/icons.js +18 -0
  114. package/lib/module/ui-components/icons/icons.js.map +1 -1
  115. package/lib/module/ui-components/icons/index.js +1 -0
  116. package/lib/module/ui-components/icons/index.js.map +1 -1
  117. package/lib/module/ui-components/loader/loading-result.js +2 -0
  118. package/lib/module/ui-components/loader/loading-result.js.map +1 -1
  119. package/lib/module/ui-components/screens/index.js +2 -0
  120. package/lib/module/ui-components/screens/index.js.map +1 -1
  121. package/lib/module/ui-components/screens/nerd-mode-screen.js +29 -25
  122. package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
  123. package/lib/module/ui-components/screens/trust-info-details-screen.js +375 -0
  124. package/lib/module/ui-components/screens/trust-info-details-screen.js.map +1 -0
  125. package/lib/module/utils/date.js +4 -5
  126. package/lib/module/utils/date.js.map +1 -1
  127. package/lib/module/utils/hooks/core/cache.js +8 -4
  128. package/lib/module/utils/hooks/core/cache.js.map +1 -1
  129. package/lib/module/utils/hooks/core/core-config.js +0 -4
  130. package/lib/module/utils/hooks/core/core-config.js.map +1 -1
  131. package/lib/module/utils/hooks/core/core-context.js +0 -15
  132. package/lib/module/utils/hooks/core/core-context.js.map +1 -1
  133. package/lib/module/utils/hooks/core/credentials.js +37 -1
  134. package/lib/module/utils/hooks/core/credentials.js.map +1 -1
  135. package/lib/module/utils/hooks/core/index.js +0 -1
  136. package/lib/module/utils/hooks/core/index.js.map +1 -1
  137. package/lib/module/utils/hooks/core/proofs.js +10 -0
  138. package/lib/module/utils/hooks/core/proofs.js.map +1 -1
  139. package/lib/module/utils/hooks/core/trust-list.js +20 -4
  140. package/lib/module/utils/hooks/core/trust-list.js.map +1 -1
  141. package/lib/module/utils/hooks/core/verifier-instance.js +20 -2
  142. package/lib/module/utils/hooks/core/verifier-instance.js.map +1 -1
  143. package/lib/module/utils/hooks/core/wallet-unit.js +2 -2
  144. package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
  145. package/lib/module/utils/parsers/credential-sharing-v2.js +15 -15
  146. package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
  147. package/lib/module/utils/parsers/credential-sharing.js +20 -18
  148. package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
  149. package/lib/module/utils/parsers/credential.js +37 -23
  150. package/lib/module/utils/parsers/credential.js.map +1 -1
  151. package/lib/module/utils/parsers/query.js +1 -1
  152. package/lib/module/utils/parsers/query.js.map +1 -1
  153. package/lib/module/utils/translations.js +8 -0
  154. package/lib/module/utils/translations.js.map +1 -0
  155. package/lib/typescript/components/credential/credential.d.ts +1 -0
  156. package/lib/typescript/components/history/history-list-item.d.ts +1 -1
  157. package/lib/typescript/components/index.d.ts +1 -1
  158. package/lib/typescript/components/proof-request/v1/select-credential.d.ts +1 -0
  159. package/lib/typescript/components/proof-request/v1/share-credential.d.ts +1 -0
  160. package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +1 -0
  161. package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +1 -0
  162. package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +1 -0
  163. package/lib/typescript/components/trust-info/index.d.ts +3 -0
  164. package/lib/typescript/components/trust-info/trust-info.d.ts +19 -0
  165. package/lib/typescript/ui-components/header/header.d.ts +2 -0
  166. package/lib/typescript/ui-components/history/history-details.d.ts +2 -2
  167. package/lib/typescript/ui-components/icons/contact.d.ts +4 -0
  168. package/lib/typescript/ui-components/icons/credential.d.ts +1 -1
  169. package/lib/typescript/ui-components/icons/icons.d.ts +1 -0
  170. package/lib/typescript/ui-components/icons/index.d.ts +1 -0
  171. package/lib/typescript/ui-components/screens/index.d.ts +3 -0
  172. package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +5 -12
  173. package/lib/typescript/ui-components/screens/trust-info-details-screen.d.ts +32 -0
  174. package/lib/typescript/utils/hooks/core/core-config.d.ts +0 -1
  175. package/lib/typescript/utils/hooks/core/core-context.d.ts +0 -1
  176. package/lib/typescript/utils/hooks/core/credentials.d.ts +5 -1
  177. package/lib/typescript/utils/hooks/core/index.d.ts +0 -1
  178. package/lib/typescript/utils/hooks/core/proofs.d.ts +2 -0
  179. package/lib/typescript/utils/hooks/core/trust-list.d.ts +1 -4
  180. package/lib/typescript/utils/hooks/core/verifier-instance.d.ts +2 -0
  181. package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +2 -2
  182. package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +3 -3
  183. package/lib/typescript/utils/parsers/credential-sharing.d.ts +6 -6
  184. package/lib/typescript/utils/parsers/credential.d.ts +5 -5
  185. package/lib/typescript/utils/parsers/query.d.ts +1 -1
  186. package/lib/typescript/utils/translations.d.ts +1 -0
  187. package/package.json +8 -8
  188. package/src/components/credential/credential.tsx +3 -0
  189. package/src/components/history/history-list-item-icon.tsx +2 -2
  190. package/src/components/history/history-list-item.tsx +4 -9
  191. package/src/components/history/history-list-screen.tsx +1 -1
  192. package/src/components/index.ts +1 -1
  193. package/src/components/proof-request/v1/select-credential.tsx +3 -1
  194. package/src/components/proof-request/v1/share-credential.tsx +3 -0
  195. package/src/components/proof-request/v2/select-credential-v2.tsx +3 -1
  196. package/src/components/proof-request/v2/share-credential-v2-group.tsx +4 -0
  197. package/src/components/proof-request/v2/share-credential-v2.tsx +5 -0
  198. package/src/components/trust-info/index.ts +4 -0
  199. package/src/components/trust-info/trust-info.tsx +90 -0
  200. package/src/ui-components/credential/card/credential-details-card.tsx +3 -2
  201. package/src/ui-components/header/foldable-header.tsx +10 -9
  202. package/src/ui-components/header/header.tsx +18 -3
  203. package/src/ui-components/history/history-details.tsx +4 -4
  204. package/src/ui-components/icons/contact.tsx +26 -0
  205. package/src/ui-components/icons/credential.tsx +1 -1
  206. package/src/ui-components/icons/icons.tsx +18 -0
  207. package/src/ui-components/icons/index.ts +1 -0
  208. package/src/ui-components/loader/loading-result.tsx +7 -1
  209. package/src/ui-components/screens/index.ts +3 -0
  210. package/src/ui-components/screens/nerd-mode-screen.tsx +49 -41
  211. package/src/ui-components/screens/trust-info-details-screen.tsx +472 -0
  212. package/src/utils/date.ts +7 -14
  213. package/src/utils/hooks/core/cache.ts +12 -4
  214. package/src/utils/hooks/core/core-config.ts +1 -6
  215. package/src/utils/hooks/core/core-context.tsx +0 -24
  216. package/src/utils/hooks/core/credentials.ts +43 -1
  217. package/src/utils/hooks/core/index.ts +0 -1
  218. package/src/utils/hooks/core/proofs.ts +14 -0
  219. package/src/utils/hooks/core/trust-list.ts +22 -11
  220. package/src/utils/hooks/core/verifier-instance.ts +23 -2
  221. package/src/utils/hooks/core/wallet-unit.ts +3 -3
  222. package/src/utils/parsers/credential-sharing-v2.tsx +29 -12
  223. package/src/utils/parsers/credential-sharing.tsx +33 -16
  224. package/src/utils/parsers/credential.ts +45 -14
  225. package/src/utils/parsers/query.ts +3 -0
  226. package/src/utils/translations.ts +10 -0
  227. package/lib/commonjs/components/entity/EntityButtons.js +0 -64
  228. package/lib/commonjs/components/entity/EntityButtons.js.map +0 -1
  229. package/lib/commonjs/components/entity/entity-attributes.js +0 -65
  230. package/lib/commonjs/components/entity/entity-attributes.js.map +0 -1
  231. package/lib/commonjs/components/entity/entity-details-with-buttons.js +0 -67
  232. package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +0 -1
  233. package/lib/commonjs/components/entity/entity-details.js +0 -101
  234. package/lib/commonjs/components/entity/entity-details.js.map +0 -1
  235. package/lib/commonjs/components/entity/index.js +0 -14
  236. package/lib/commonjs/components/entity/index.js.map +0 -1
  237. package/lib/commonjs/utils/hooks/core/trust-entity.js +0 -147
  238. package/lib/commonjs/utils/hooks/core/trust-entity.js.map +0 -1
  239. package/lib/module/components/entity/EntityButtons.js +0 -56
  240. package/lib/module/components/entity/EntityButtons.js.map +0 -1
  241. package/lib/module/components/entity/entity-attributes.js +0 -57
  242. package/lib/module/components/entity/entity-attributes.js.map +0 -1
  243. package/lib/module/components/entity/entity-details-with-buttons.js +0 -58
  244. package/lib/module/components/entity/entity-details-with-buttons.js.map +0 -1
  245. package/lib/module/components/entity/entity-details.js +0 -92
  246. package/lib/module/components/entity/entity-details.js.map +0 -1
  247. package/lib/module/components/entity/index.js +0 -3
  248. package/lib/module/components/entity/index.js.map +0 -1
  249. package/lib/module/utils/hooks/core/trust-entity.js +0 -136
  250. package/lib/module/utils/hooks/core/trust-entity.js.map +0 -1
  251. package/lib/typescript/components/entity/EntityButtons.d.ts +0 -14
  252. package/lib/typescript/components/entity/entity-attributes.d.ts +0 -15
  253. package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +0 -18
  254. package/lib/typescript/components/entity/entity-details.d.ts +0 -21
  255. package/lib/typescript/components/entity/index.d.ts +0 -3
  256. package/lib/typescript/utils/hooks/core/trust-entity.d.ts +0 -17
  257. package/src/components/entity/EntityButtons.tsx +0 -79
  258. package/src/components/entity/entity-attributes.tsx +0 -80
  259. package/src/components/entity/entity-details-with-buttons.tsx +0 -75
  260. package/src/components/entity/entity-details.tsx +0 -145
  261. package/src/components/entity/index.ts +0 -4
  262. package/src/utils/hooks/core/trust-entity.ts +0 -172
@@ -252,3 +252,21 @@ export const NFCIcon: FC<SvgProps> = ({ color, ...props }) => {
252
252
  </Svg>
253
253
  );
254
254
  };
255
+
256
+ // https://www.figma.com/file/52qDYWUMjXAGre1dcnz5bz/Procivis-One-Wallet?node-id=542-90920
257
+ export const PurposeInfoIcon: FC<SvgProps> = () => {
258
+ const colorScheme = useAppColorScheme();
259
+ return (
260
+ <Svg fill="none" height={24} viewBox="0 0 24 24" width={24}>
261
+ <Path
262
+ d="M12.3609 10.7319C12.4714 10.7319 12.5609 10.8215 12.5609 10.9319V15.8C12.5609 15.9105 12.4714 16 12.3609 16H11.7C11.5895 16 11.5 15.9105 11.5 15.8V10.9319C11.5 10.8215 11.5895 10.7319 11.7 10.7319H12.3609ZM11.5 8.2C11.5 8.08954 11.5895 8 11.7 8L12.3609 8C12.4714 8 12.5609 8.08954 12.5609 8.2L12.5609 8.89863C12.5609 9.00909 12.4714 9.09863 12.3609 9.09863H11.7C11.5895 9.09863 11.5 9.00909 11.5 8.89863L11.5 8.2Z"
263
+ fill={colorScheme.text}
264
+ />
265
+ <Path
266
+ d="M12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z"
267
+ fill={colorScheme.text}
268
+ fillRule="evenodd"
269
+ />
270
+ </Svg>
271
+ );
272
+ };
@@ -1,4 +1,5 @@
1
1
  export * from './connectivity';
2
+ export * from './contact';
2
3
  export * from './credential';
3
4
  export * from './entity';
4
5
  export * from './history';
@@ -2,6 +2,7 @@ import React, { FC } from 'react';
2
2
  import { Platform, StyleSheet, View, ViewProps, ViewStyle } from 'react-native';
3
3
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
4
 
5
+ import { concatTestID } from '../../utils';
5
6
  import { Button, ButtonProps } from '../buttons/button';
6
7
  import ShareButton, { ShareButtonProps } from '../buttons/share-button';
7
8
  import NavigationHeader, { NavigationHeaderProps } from '../header/navigation-header';
@@ -53,7 +54,12 @@ const LoadingResultScreen: FC<LoadingResultScreenProps> = ({
53
54
  </View>
54
55
  <View style={styles.loaderWrapper}>
55
56
  <LoaderView {...loaderProps} />
56
- <Typography align="center" color={colorScheme.text} preset="regular" style={styles.label}>
57
+ <Typography
58
+ testID={concatTestID(viewProps.testID, 'label')}
59
+ align="center"
60
+ color={colorScheme.text}
61
+ preset="regular"
62
+ style={styles.label}>
57
63
  {label}
58
64
  </Typography>
59
65
  </View>
@@ -10,6 +10,8 @@ import type { ScrollViewScreenProps } from './scroll-view-screen';
10
10
  import ScrollViewScreen from './scroll-view-screen';
11
11
  import type { SectionListScreenProps } from './section-list-screen';
12
12
  import SectionListScreen from './section-list-screen';
13
+ import type { TrustInfoDetailsScreenLabels, TrustInfoDetailsScreenProps } from './trust-info-details-screen';
14
+ import TrustInfoDetailsScreen from './trust-info-details-screen';
13
15
 
14
16
  export { BackupScreen, BackupScreenMode, BackupScreenProps };
15
17
  export { ImagePreviewScreen, ImagePreviewScreenProps };
@@ -17,3 +19,4 @@ export { NerdModeScreen, NerdModeScreenProps, NerdModeSection };
17
19
  export { QRCodeScannerScreen, QRCodeScannerScreenProps };
18
20
  export { ScrollViewScreen, ScrollViewScreenProps };
19
21
  export { SectionListScreen, SectionListScreenProps };
22
+ export { TrustInfoDetailsScreen, TrustInfoDetailsScreenLabels, TrustInfoDetailsScreenProps };
@@ -1,10 +1,10 @@
1
- import { IdentifierListItem } from '@procivis/react-native-one-core';
2
- import React, { FunctionComponent, useState } from 'react';
1
+ import { IdentifierListItem, TrustInformationDetail } from '@procivis/react-native-one-core';
2
+ import React, { FunctionComponent, useMemo, useState } from 'react';
3
3
  import { SectionList, StyleSheet, View } from 'react-native';
4
4
  import Animated, { useAnimatedScrollHandler, useSharedValue } from 'react-native-reanimated';
5
5
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
6
 
7
- import EntityDetailsWithButtons, { ContextRole } from '../../components/entity/entity-details-with-buttons';
7
+ import { TrustInfo, TrustInfoLabels } from '../../components';
8
8
  import ContrastingStatusBar from '../../utils/contrasting-status-bar';
9
9
  import { concatTestID } from '../../utils/testID';
10
10
  import { TouchableOpacity } from '../accessibility/accessibilityHistoryWrappers';
@@ -15,15 +15,6 @@ import NerdModeItem, { NerdModeItemProps } from '../nerd-view/nerd-mode-item';
15
15
  import Typography from '../text/typography';
16
16
  import { useAppColorScheme } from '../theme/color-scheme-context';
17
17
 
18
- export interface EntityLabels {
19
- trusted: string;
20
- unknownIssuer: string;
21
- unknownVerifier: string;
22
- visitWebsite: string;
23
- termsAndServices: string;
24
- privacyPolicy: string;
25
- }
26
-
27
18
  export interface AttributesLabels {
28
19
  trustRegistry: string;
29
20
  issuerIdentifier: string;
@@ -36,9 +27,9 @@ export interface AttributesLabels {
36
27
  interface SectionEntityCluster {
37
28
  identifier?: IdentifierListItem;
38
29
  subline?: string;
39
- entityLabels: EntityLabels;
40
- role: ContextRole;
41
30
  testID?: string;
31
+ trustInfoLabels: TrustInfoLabels;
32
+ trustInformation?: TrustInformationDetail;
42
33
  }
43
34
 
44
35
  type SectionAttribute = Omit<NerdModeItemProps, 'labels' | 'onCopyToClipboard'>;
@@ -55,6 +46,7 @@ export type NerdModeScreenProps = {
55
46
  labels: AttributesLabels;
56
47
  onClose: () => void;
57
48
  onCopyToClipboard: (value: string) => void;
49
+ onOpenTrustInfoDetails?: (trustInformation: TrustInformationDetail) => void;
58
50
  sections: NerdModeSection[];
59
51
  testID: string;
60
52
  title: string;
@@ -76,6 +68,7 @@ const NerdModeScreen: FunctionComponent<NerdModeScreenProps> = ({
76
68
  labels,
77
69
  onClose,
78
70
  onCopyToClipboard,
71
+ onOpenTrustInfoDetails,
79
72
  entityCluster,
80
73
  testID,
81
74
  title,
@@ -105,6 +98,37 @@ const NerdModeScreen: FunctionComponent<NerdModeScreenProps> = ({
105
98
  };
106
99
  }, {} as Record<string, string>);
107
100
 
101
+ const listHeader = useMemo(() => {
102
+ if (!entityCluster) {
103
+ return null;
104
+ }
105
+ return (
106
+ <TrustInfo
107
+ labels={entityCluster.trustInfoLabels}
108
+ onPress={
109
+ onOpenTrustInfoDetails && entityCluster.trustInformation
110
+ ? () => onOpenTrustInfoDetails(entityCluster.trustInformation!)
111
+ : undefined
112
+ }
113
+ style={[
114
+ styles.entityCluster,
115
+ {
116
+ backgroundColor: colorScheme.nerdView.background,
117
+ },
118
+ ]}
119
+ testID={entityCluster.testID ?? concatTestID(testID, 'trustInfo')}
120
+ textColor={colorScheme.white}
121
+ trustInformation={entityCluster.trustInformation?.eudiEcosystem}
122
+ />
123
+ );
124
+ }, [
125
+ entityCluster,
126
+ colorScheme.nerdView.background,
127
+ colorScheme.white,
128
+ onOpenTrustInfoDetails,
129
+ testID,
130
+ ]);
131
+
108
132
  return (
109
133
  <>
110
134
  <ContrastingStatusBar backgroundColor={colorScheme.nerdView.background} />
@@ -122,43 +146,27 @@ const NerdModeScreen: FunctionComponent<NerdModeScreenProps> = ({
122
146
  titleColor={colorScheme.white}
123
147
  />
124
148
  <AnimatedSectionList
125
- ListHeaderComponent={
126
- entityCluster ? (
127
- <EntityDetailsWithButtons
128
- {...entityCluster}
129
- entityType={EntityType.ProofEntity}
130
- entityLabels={entityCluster.entityLabels}
131
- attributesLabels={labels}
132
- style={[
133
- styles.entityCluster,
134
- {
135
- backgroundColor: colorScheme.nerdView.background,
136
- },
137
- ]}
138
- onCopyToClipboard={onCopyToClipboard}
139
- testID={entityCluster.testID ?? concatTestID(testID, 'entityCluster')}
140
- textColor={colorScheme.white}
141
- />
142
- ) : null
143
- }
149
+ ListHeaderComponent={listHeader}
144
150
  onScroll={onScroll}
145
- renderItem={({ item, section, index }) => {
151
+ renderItem={({ item, section }) => {
146
152
  if (isSectionEntityCluster(item)) {
147
153
  return (
148
- <EntityDetailsWithButtons
149
- {...item}
150
- entityType={EntityType.CredentialEntity}
151
- entityLabels={item!.entityLabels}
152
- attributesLabels={labels}
154
+ <TrustInfo
155
+ labels={item.trustInfoLabels}
156
+ onPress={
157
+ onOpenTrustInfoDetails && item.trustInformation
158
+ ? () => onOpenTrustInfoDetails(item.trustInformation!)
159
+ : undefined
160
+ }
153
161
  style={[
154
162
  styles.entityCluster,
155
163
  {
156
164
  backgroundColor: colorScheme.nerdView.background,
157
165
  },
158
166
  ]}
159
- onCopyToClipboard={onCopyToClipboard}
160
- testID={item.testID ?? concatTestID(testID, 'sectionEntityCluster', index.toString())}
167
+ testID={item.testID ?? concatTestID(testID, 'trustInfo')}
161
168
  textColor={colorScheme.white}
169
+ trustInformation={item.trustInformation?.eudiEcosystem}
162
170
  />
163
171
  );
164
172
  } else {
@@ -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;