@procivis/one-react-native-components 0.3.62 → 0.3.86

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 (303) hide show
  1. package/lib/commonjs/components/credential/credential.js +8 -2
  2. package/lib/commonjs/components/credential/credential.js.map +1 -1
  3. package/lib/commonjs/components/proof-request/index.js +23 -12
  4. package/lib/commonjs/components/proof-request/index.js.map +1 -1
  5. package/lib/commonjs/components/proof-request/select-share-credential-card-notice.js +37 -0
  6. package/lib/commonjs/components/proof-request/select-share-credential-card-notice.js.map +1 -0
  7. package/lib/commonjs/components/proof-request/share-credential-card-notice.js +36 -0
  8. package/lib/commonjs/components/proof-request/share-credential-card-notice.js.map +1 -0
  9. package/lib/commonjs/components/proof-request/{group.js → v1/group.js} +1 -1
  10. package/lib/commonjs/components/proof-request/v1/group.js.map +1 -0
  11. package/lib/commonjs/components/proof-request/v1/index.js +39 -0
  12. package/lib/commonjs/components/proof-request/v1/index.js.map +1 -0
  13. package/lib/commonjs/components/proof-request/{select-credential.js → v1/select-credential.js} +12 -6
  14. package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -0
  15. package/lib/commonjs/components/proof-request/{share-credential.js → v1/share-credential.js} +33 -62
  16. package/lib/commonjs/components/proof-request/v1/share-credential.js.map +1 -0
  17. package/lib/commonjs/components/proof-request/v2/index.js +39 -0
  18. package/lib/commonjs/components/proof-request/v2/index.js.map +1 -0
  19. package/lib/commonjs/components/proof-request/v2/select-credential-v2.js +55 -0
  20. package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -0
  21. package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js +164 -0
  22. package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -0
  23. package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +135 -0
  24. package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -0
  25. package/lib/commonjs/ui-components/buttons/index.js +7 -0
  26. package/lib/commonjs/ui-components/buttons/index.js.map +1 -1
  27. package/lib/commonjs/ui-components/buttons/share-button.js +54 -0
  28. package/lib/commonjs/ui-components/buttons/share-button.js.map +1 -0
  29. package/lib/commonjs/ui-components/camera/qr-code-scanner.js +5 -1
  30. package/lib/commonjs/ui-components/camera/qr-code-scanner.js.map +1 -1
  31. package/lib/commonjs/ui-components/credential/card/credential-details-list-item.js +16 -42
  32. package/lib/commonjs/ui-components/credential/card/credential-details-list-item.js.map +1 -1
  33. package/lib/commonjs/ui-components/credential/credential-attribute-item.js +3 -1
  34. package/lib/commonjs/ui-components/credential/credential-attribute-item.js.map +1 -1
  35. package/lib/commonjs/ui-components/credential/group/credential-group-header.js +72 -0
  36. package/lib/commonjs/ui-components/credential/group/credential-group-header.js.map +1 -0
  37. package/lib/commonjs/ui-components/credential/group/index.js +14 -0
  38. package/lib/commonjs/ui-components/credential/group/index.js.map +1 -0
  39. package/lib/commonjs/ui-components/credential/index.js +12 -0
  40. package/lib/commonjs/ui-components/credential/index.js.map +1 -1
  41. package/lib/commonjs/ui-components/header/foldable-header.js +29 -17
  42. package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
  43. package/lib/commonjs/ui-components/icons/icons.js +24 -1
  44. package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
  45. package/lib/commonjs/ui-components/index.js +22 -0
  46. package/lib/commonjs/ui-components/index.js.map +1 -1
  47. package/lib/commonjs/ui-components/loader/loading-result.js +8 -1
  48. package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
  49. package/lib/commonjs/ui-components/nfc/index.js +14 -0
  50. package/lib/commonjs/ui-components/nfc/index.js.map +1 -0
  51. package/lib/commonjs/ui-components/nfc/nfc-process.js +77 -0
  52. package/lib/commonjs/ui-components/nfc/nfc-process.js.map +1 -0
  53. package/lib/commonjs/ui-components/pin/pin-lock-animation.js +477 -475
  54. package/lib/commonjs/ui-components/pin/pin-lock-animation.js.map +1 -1
  55. package/lib/commonjs/ui-components/proof-request/index.js +13 -0
  56. package/lib/commonjs/ui-components/proof-request/index.js.map +1 -0
  57. package/lib/commonjs/ui-components/proof-request/proof-request-set.js +47 -0
  58. package/lib/commonjs/ui-components/proof-request/proof-request-set.js.map +1 -0
  59. package/lib/commonjs/ui-components/screens/section-list-screen.js +37 -8
  60. package/lib/commonjs/ui-components/screens/section-list-screen.js.map +1 -1
  61. package/lib/commonjs/utils/array.js.map +1 -1
  62. package/lib/commonjs/utils/hooks/app-state.js +33 -0
  63. package/lib/commonjs/utils/hooks/app-state.js.map +1 -0
  64. package/lib/commonjs/utils/hooks/core/backup.js +4 -5
  65. package/lib/commonjs/utils/hooks/core/backup.js.map +1 -1
  66. package/lib/commonjs/utils/hooks/core/core-init.js +4 -22
  67. package/lib/commonjs/utils/hooks/core/core-init.js.map +1 -1
  68. package/lib/commonjs/utils/hooks/core/credentials.js +10 -3
  69. package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
  70. package/lib/commonjs/utils/hooks/core/identifiers.js +1 -1
  71. package/lib/commonjs/utils/hooks/core/identifiers.js.map +1 -1
  72. package/lib/commonjs/utils/hooks/core/index.js +11 -0
  73. package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
  74. package/lib/commonjs/utils/hooks/core/proofs.js +45 -8
  75. package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
  76. package/lib/commonjs/utils/hooks/core/wallet-unit.js +85 -0
  77. package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -0
  78. package/lib/commonjs/utils/hooks/index.js +22 -0
  79. package/lib/commonjs/utils/hooks/index.js.map +1 -1
  80. package/lib/commonjs/utils/hooks/nfc/nfc-status.js +40 -0
  81. package/lib/commonjs/utils/hooks/nfc/nfc-status.js.map +1 -0
  82. package/lib/commonjs/utils/hooks/revocation/credential-status.js +1 -1
  83. package/lib/commonjs/utils/hooks/revocation/credential-status.js.map +1 -1
  84. package/lib/commonjs/utils/index.js +24 -0
  85. package/lib/commonjs/utils/index.js.map +1 -1
  86. package/lib/commonjs/utils/parsers/credential-sharing-v2.js +190 -0
  87. package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -0
  88. package/lib/commonjs/utils/parsers/credential-sharing.js +31 -18
  89. package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
  90. package/lib/commonjs/utils/parsers/credential.js +111 -63
  91. package/lib/commonjs/utils/parsers/credential.js.map +1 -1
  92. package/lib/commonjs/utils/parsers/index.js +11 -0
  93. package/lib/commonjs/utils/parsers/index.js.map +1 -1
  94. package/lib/commonjs/utils/parsers/query.js +4 -4
  95. package/lib/commonjs/utils/parsers/query.js.map +1 -1
  96. package/lib/commonjs/utils/url.js +80 -0
  97. package/lib/commonjs/utils/url.js.map +1 -0
  98. package/lib/commonjs/utils/wallet-unit.js +30 -0
  99. package/lib/commonjs/utils/wallet-unit.js.map +1 -0
  100. package/lib/module/components/credential/credential.js +8 -2
  101. package/lib/module/components/credential/credential.js.map +1 -1
  102. package/lib/module/components/proof-request/index.js +4 -3
  103. package/lib/module/components/proof-request/index.js.map +1 -1
  104. package/lib/module/components/proof-request/select-share-credential-card-notice.js +29 -0
  105. package/lib/module/components/proof-request/select-share-credential-card-notice.js.map +1 -0
  106. package/lib/module/components/proof-request/share-credential-card-notice.js +28 -0
  107. package/lib/module/components/proof-request/share-credential-card-notice.js.map +1 -0
  108. package/lib/module/components/proof-request/{group.js → v1/group.js} +1 -1
  109. package/lib/module/components/proof-request/v1/group.js.map +1 -0
  110. package/lib/module/components/proof-request/v1/index.js +4 -0
  111. package/lib/module/components/proof-request/v1/index.js.map +1 -0
  112. package/lib/module/components/proof-request/{select-credential.js → v1/select-credential.js} +12 -6
  113. package/lib/module/components/proof-request/v1/select-credential.js.map +1 -0
  114. package/lib/module/components/proof-request/v1/share-credential.js +118 -0
  115. package/lib/module/components/proof-request/v1/share-credential.js.map +1 -0
  116. package/lib/module/components/proof-request/v2/index.js +4 -0
  117. package/lib/module/components/proof-request/v2/index.js.map +1 -0
  118. package/lib/module/components/proof-request/v2/select-credential-v2.js +46 -0
  119. package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -0
  120. package/lib/module/components/proof-request/v2/share-credential-v2-group.js +154 -0
  121. package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -0
  122. package/lib/module/components/proof-request/v2/share-credential-v2.js +126 -0
  123. package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -0
  124. package/lib/module/ui-components/buttons/index.js +2 -1
  125. package/lib/module/ui-components/buttons/index.js.map +1 -1
  126. package/lib/module/ui-components/buttons/share-button.js +47 -0
  127. package/lib/module/ui-components/buttons/share-button.js.map +1 -0
  128. package/lib/module/ui-components/camera/qr-code-scanner.js +5 -1
  129. package/lib/module/ui-components/camera/qr-code-scanner.js.map +1 -1
  130. package/lib/module/ui-components/credential/card/credential-details-list-item.js +19 -45
  131. package/lib/module/ui-components/credential/card/credential-details-list-item.js.map +1 -1
  132. package/lib/module/ui-components/credential/credential-attribute-item.js +3 -1
  133. package/lib/module/ui-components/credential/credential-attribute-item.js.map +1 -1
  134. package/lib/module/ui-components/credential/group/credential-group-header.js +64 -0
  135. package/lib/module/ui-components/credential/group/credential-group-header.js.map +1 -0
  136. package/lib/module/ui-components/credential/group/index.js +3 -0
  137. package/lib/module/ui-components/credential/group/index.js.map +1 -0
  138. package/lib/module/ui-components/credential/index.js +1 -0
  139. package/lib/module/ui-components/credential/index.js.map +1 -1
  140. package/lib/module/ui-components/header/foldable-header.js +29 -17
  141. package/lib/module/ui-components/header/foldable-header.js.map +1 -1
  142. package/lib/module/ui-components/icons/icons.js +22 -0
  143. package/lib/module/ui-components/icons/icons.js.map +1 -1
  144. package/lib/module/ui-components/index.js +2 -0
  145. package/lib/module/ui-components/index.js.map +1 -1
  146. package/lib/module/ui-components/loader/loading-result.js +8 -1
  147. package/lib/module/ui-components/loader/loading-result.js.map +1 -1
  148. package/lib/module/ui-components/nfc/index.js +3 -0
  149. package/lib/module/ui-components/nfc/index.js.map +1 -0
  150. package/lib/module/ui-components/nfc/nfc-process.js +69 -0
  151. package/lib/module/ui-components/nfc/nfc-process.js.map +1 -0
  152. package/lib/module/ui-components/pin/pin-lock-animation.js +477 -475
  153. package/lib/module/ui-components/pin/pin-lock-animation.js.map +1 -1
  154. package/lib/module/ui-components/proof-request/index.js +3 -0
  155. package/lib/module/ui-components/proof-request/index.js.map +1 -0
  156. package/lib/module/ui-components/proof-request/proof-request-set.js +39 -0
  157. package/lib/module/ui-components/proof-request/proof-request-set.js.map +1 -0
  158. package/lib/module/ui-components/screens/section-list-screen.js +36 -9
  159. package/lib/module/ui-components/screens/section-list-screen.js.map +1 -1
  160. package/lib/module/utils/array.js.map +1 -1
  161. package/lib/module/utils/hooks/app-state.js +27 -0
  162. package/lib/module/utils/hooks/app-state.js.map +1 -0
  163. package/lib/module/utils/hooks/core/backup.js +5 -6
  164. package/lib/module/utils/hooks/core/backup.js.map +1 -1
  165. package/lib/module/utils/hooks/core/core-init.js +3 -20
  166. package/lib/module/utils/hooks/core/core-init.js.map +1 -1
  167. package/lib/module/utils/hooks/core/credentials.js +11 -4
  168. package/lib/module/utils/hooks/core/credentials.js.map +1 -1
  169. package/lib/module/utils/hooks/core/identifiers.js +5 -5
  170. package/lib/module/utils/hooks/core/identifiers.js.map +1 -1
  171. package/lib/module/utils/hooks/core/index.js +1 -0
  172. package/lib/module/utils/hooks/core/index.js.map +1 -1
  173. package/lib/module/utils/hooks/core/proofs.js +45 -8
  174. package/lib/module/utils/hooks/core/proofs.js.map +1 -1
  175. package/lib/module/utils/hooks/core/wallet-unit.js +75 -0
  176. package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -0
  177. package/lib/module/utils/hooks/index.js +2 -0
  178. package/lib/module/utils/hooks/index.js.map +1 -1
  179. package/lib/module/utils/hooks/nfc/nfc-status.js +32 -0
  180. package/lib/module/utils/hooks/nfc/nfc-status.js.map +1 -0
  181. package/lib/module/utils/hooks/revocation/credential-status.js +1 -1
  182. package/lib/module/utils/hooks/revocation/credential-status.js.map +1 -1
  183. package/lib/module/utils/index.js +2 -0
  184. package/lib/module/utils/index.js.map +1 -1
  185. package/lib/module/utils/parsers/credential-sharing-v2.js +177 -0
  186. package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -0
  187. package/lib/module/utils/parsers/credential-sharing.js +31 -18
  188. package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
  189. package/lib/module/utils/parsers/credential.js +112 -64
  190. package/lib/module/utils/parsers/credential.js.map +1 -1
  191. package/lib/module/utils/parsers/index.js +1 -0
  192. package/lib/module/utils/parsers/index.js.map +1 -1
  193. package/lib/module/utils/parsers/query.js +4 -4
  194. package/lib/module/utils/parsers/query.js.map +1 -1
  195. package/lib/module/utils/url.js +71 -0
  196. package/lib/module/utils/url.js.map +1 -0
  197. package/lib/module/utils/wallet-unit.js +22 -0
  198. package/lib/module/utils/wallet-unit.js.map +1 -0
  199. package/lib/typescript/components/proof-request/index.d.ts +4 -3
  200. package/lib/typescript/components/proof-request/select-share-credential-card-notice.d.ts +7 -0
  201. package/lib/typescript/components/proof-request/share-credential-card-notice.d.ts +6 -0
  202. package/lib/typescript/components/proof-request/v1/index.d.ts +3 -0
  203. package/lib/typescript/components/proof-request/{select-credential.d.ts → v1/select-credential.d.ts} +1 -1
  204. package/lib/typescript/components/proof-request/{share-credential.d.ts → v1/share-credential.d.ts} +1 -1
  205. package/lib/typescript/components/proof-request/v2/index.d.ts +3 -0
  206. package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +14 -0
  207. package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +24 -0
  208. package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +23 -0
  209. package/lib/typescript/ui-components/buttons/index.d.ts +3 -1
  210. package/lib/typescript/ui-components/buttons/share-button.d.ts +10 -0
  211. package/lib/typescript/ui-components/credential/group/credential-group-header.d.ts +10 -0
  212. package/lib/typescript/ui-components/credential/group/index.d.ts +3 -0
  213. package/lib/typescript/ui-components/credential/index.d.ts +1 -0
  214. package/lib/typescript/ui-components/header/foldable-header.d.ts +1 -0
  215. package/lib/typescript/ui-components/icons/icons.d.ts +1 -0
  216. package/lib/typescript/ui-components/index.d.ts +2 -0
  217. package/lib/typescript/ui-components/loader/loading-result.d.ts +2 -0
  218. package/lib/typescript/ui-components/nfc/index.d.ts +2 -0
  219. package/lib/typescript/ui-components/nfc/nfc-process.d.ts +17 -0
  220. package/lib/typescript/ui-components/pin/pin-lock-animation.d.ts +311 -311
  221. package/lib/typescript/ui-components/proof-request/index.d.ts +3 -0
  222. package/lib/typescript/ui-components/proof-request/proof-request-set.d.ts +7 -0
  223. package/lib/typescript/ui-components/screens/section-list-screen.d.ts +5 -2
  224. package/lib/typescript/utils/array.d.ts +1 -0
  225. package/lib/typescript/utils/hooks/app-state.d.ts +5 -0
  226. package/lib/typescript/utils/hooks/core/backup.d.ts +1 -1
  227. package/lib/typescript/utils/hooks/core/core-init.d.ts +1 -3
  228. package/lib/typescript/utils/hooks/core/credentials.d.ts +1 -1
  229. package/lib/typescript/utils/hooks/core/identifiers.d.ts +1 -1
  230. package/lib/typescript/utils/hooks/core/index.d.ts +1 -0
  231. package/lib/typescript/utils/hooks/core/proofs.d.ts +10 -3
  232. package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +9 -0
  233. package/lib/typescript/utils/hooks/index.d.ts +2 -0
  234. package/lib/typescript/utils/hooks/nfc/nfc-status.d.ts +6 -0
  235. package/lib/typescript/utils/index.d.ts +2 -0
  236. package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +11 -0
  237. package/lib/typescript/utils/parsers/credential-sharing.d.ts +11 -5
  238. package/lib/typescript/utils/parsers/credential.d.ts +9 -6
  239. package/lib/typescript/utils/parsers/index.d.ts +1 -0
  240. package/lib/typescript/utils/parsers/query.d.ts +2 -2
  241. package/lib/typescript/utils/url.d.ts +19 -0
  242. package/lib/typescript/utils/wallet-unit.d.ts +8 -0
  243. package/package.json +16 -6
  244. package/src/components/credential/credential.tsx +5 -1
  245. package/src/components/proof-request/index.ts +4 -3
  246. package/src/components/proof-request/select-share-credential-card-notice.tsx +37 -0
  247. package/src/components/proof-request/share-credential-card-notice.tsx +33 -0
  248. package/src/components/proof-request/{group.tsx → v1/group.tsx} +1 -1
  249. package/src/components/proof-request/v1/index.ts +3 -0
  250. package/src/components/proof-request/{select-credential.tsx → v1/select-credential.tsx} +12 -5
  251. package/src/components/proof-request/{share-credential.tsx → v1/share-credential.tsx} +35 -52
  252. package/src/components/proof-request/v2/index.ts +3 -0
  253. package/src/components/proof-request/v2/select-credential-v2.tsx +59 -0
  254. package/src/components/proof-request/v2/share-credential-v2-group.tsx +258 -0
  255. package/src/components/proof-request/v2/share-credential-v2.tsx +211 -0
  256. package/src/ui-components/buttons/index.ts +4 -0
  257. package/src/ui-components/buttons/share-button.stories.tsx +25 -0
  258. package/src/ui-components/buttons/share-button.tsx +55 -0
  259. package/src/ui-components/camera/qr-code-scanner.tsx +11 -2
  260. package/src/ui-components/credential/card/credential-details-list-item.tsx +27 -49
  261. package/src/ui-components/credential/credential-attribute-item.tsx +2 -0
  262. package/src/ui-components/credential/group/credential-group-header.tsx +70 -0
  263. package/src/ui-components/credential/group/index.ts +4 -0
  264. package/src/ui-components/credential/index.ts +1 -0
  265. package/src/ui-components/header/foldable-header.tsx +31 -16
  266. package/src/ui-components/icons/icons.tsx +22 -0
  267. package/src/ui-components/index.ts +2 -0
  268. package/src/ui-components/loader/loading-result.stories.tsx +4 -1
  269. package/src/ui-components/loader/loading-result.tsx +7 -0
  270. package/src/ui-components/nfc/index.ts +3 -0
  271. package/src/ui-components/nfc/nfc-process.tsx +80 -0
  272. package/src/ui-components/pin/pin-lock-animation.tsx +240 -278
  273. package/src/ui-components/proof-request/index.ts +4 -0
  274. package/src/ui-components/proof-request/proof-request-set.tsx +46 -0
  275. package/src/ui-components/screens/section-list-screen.tsx +39 -8
  276. package/src/utils/array.ts +4 -0
  277. package/src/utils/hooks/app-state.ts +29 -0
  278. package/src/utils/hooks/core/backup.ts +3 -9
  279. package/src/utils/hooks/core/core-init.ts +1 -23
  280. package/src/utils/hooks/core/credentials.ts +11 -4
  281. package/src/utils/hooks/core/identifiers.ts +15 -14
  282. package/src/utils/hooks/core/index.ts +2 -1
  283. package/src/utils/hooks/core/proofs.ts +47 -10
  284. package/src/utils/hooks/core/wallet-unit.ts +77 -0
  285. package/src/utils/hooks/index.ts +2 -0
  286. package/src/utils/hooks/nfc/nfc-status.ts +31 -0
  287. package/src/utils/hooks/revocation/credential-status.ts +1 -1
  288. package/src/utils/index.ts +2 -0
  289. package/src/utils/parsers/credential-sharing-v2.tsx +283 -0
  290. package/src/utils/parsers/credential-sharing.tsx +40 -16
  291. package/src/utils/parsers/credential.ts +129 -59
  292. package/src/utils/parsers/index.ts +1 -0
  293. package/src/utils/parsers/query.ts +7 -5
  294. package/src/utils/url.ts +61 -0
  295. package/src/utils/wallet-unit.ts +30 -0
  296. package/lib/commonjs/components/proof-request/group.js.map +0 -1
  297. package/lib/commonjs/components/proof-request/select-credential.js.map +0 -1
  298. package/lib/commonjs/components/proof-request/share-credential.js.map +0 -1
  299. package/lib/module/components/proof-request/group.js.map +0 -1
  300. package/lib/module/components/proof-request/select-credential.js.map +0 -1
  301. package/lib/module/components/proof-request/share-credential.js +0 -147
  302. package/lib/module/components/proof-request/share-credential.js.map +0 -1
  303. /package/lib/typescript/components/proof-request/{group.d.ts → v1/group.d.ts} +0 -0
@@ -0,0 +1,283 @@
1
+ import {
2
+ Claim,
3
+ Config,
4
+ DataTypeEnum,
5
+ FailureHint,
6
+ PresentationDefinitionV2ClaimValue,
7
+ PresentationDefinitionV2CredentialClaim,
8
+ PresentationDefinitionV2CredentialDetail,
9
+ } from '@procivis/react-native-one-core';
10
+ import React from 'react';
11
+
12
+ import {
13
+ CredentialAttribute,
14
+ CredentialCardNotice,
15
+ CredentialCardProps,
16
+ CredentialNoticeWarningIcon,
17
+ CredentialWarningIcon,
18
+ Selector,
19
+ SelectorStatus,
20
+ } from '../../ui-components';
21
+ import { concatTestID } from '../testID';
22
+ import { WUAState } from '../wallet-unit';
23
+ import {
24
+ CredentialDetailsCardPropsWithoutWidth,
25
+ detailsCardAttributeFromClaim,
26
+ getCredentialCardPropsFromCredential,
27
+ supportsSelectiveDisclosure,
28
+ } from '.';
29
+ import { ShareCredentialCardLabels, validityCheckedCardFromCredential } from './credential-sharing';
30
+
31
+ const v2ClaimValueToClaimValue = (value: PresentationDefinitionV2ClaimValue): string | number | boolean | Claim[] => {
32
+ if (!Array.isArray(value)) {
33
+ return value;
34
+ }
35
+ return value.map((c) => v2PresentationClaimToClaim(c));
36
+ };
37
+
38
+ const v2PresentationClaimToClaim = (claim: PresentationDefinitionV2CredentialClaim): Claim => {
39
+ if (Array.isArray(claim.value)) {
40
+ if (claim.schema.array) {
41
+ return {
42
+ array: claim.schema.array,
43
+ dataType: claim.schema.datatype,
44
+ id: claim.path,
45
+ key: claim.path,
46
+ value: v2ClaimValueToClaimValue(claim.value) as Claim[],
47
+ };
48
+ } else {
49
+ return {
50
+ array: claim.schema.array,
51
+ dataType: DataTypeEnum.Object,
52
+ id: claim.path,
53
+ key: claim.path,
54
+ value: v2ClaimValueToClaimValue(claim.value) as Claim[],
55
+ };
56
+ }
57
+ }
58
+ return {
59
+ array: false,
60
+ dataType: claim.schema.datatype,
61
+ id: claim.path,
62
+ key: claim.path,
63
+ value: claim.value,
64
+ };
65
+ };
66
+
67
+ const getAttributeSelectorStatus = (
68
+ claim: PresentationDefinitionV2CredentialClaim,
69
+ selected: boolean,
70
+ force: boolean,
71
+ ): SelectorStatus | undefined => {
72
+ if (claim.required && selected) {
73
+ return SelectorStatus.Required;
74
+ }
75
+ if (force && claim.value) {
76
+ return SelectorStatus.Required;
77
+ }
78
+ if (claim.userSelection) {
79
+ if (selected) {
80
+ return SelectorStatus.SelectedCheckmark;
81
+ } else {
82
+ return SelectorStatus.Empty;
83
+ }
84
+ }
85
+ };
86
+
87
+ export const shareCredentialCardAttributeFromV2Claim = (
88
+ claim: PresentationDefinitionV2CredentialClaim,
89
+ selection: string[] | undefined,
90
+ parentShared: boolean,
91
+ parentUserSelected: boolean,
92
+ config: Config,
93
+ testID: string,
94
+ nested?: boolean,
95
+ listValue?: boolean,
96
+ ): CredentialAttribute => {
97
+ const attributeShared =
98
+ Boolean(selection?.some((path) => path.startsWith(claim.path))) || (parentShared && claim.required);
99
+ const userSelected = parentUserSelected || Boolean(selection?.includes(claim.path));
100
+ const selected = !claim.required && attributeShared;
101
+ const status = selection
102
+ ? getAttributeSelectorStatus(claim, attributeShared, parentUserSelected || (attributeShared && !userSelected))
103
+ : undefined;
104
+ const attribute = detailsCardAttributeFromClaim(v2PresentationClaimToClaim(claim), config, testID);
105
+ const disabledStatus = [SelectorStatus.Disabled, SelectorStatus.Rejected, SelectorStatus.Required];
106
+ const disabled = attribute.disabled || !status || disabledStatus.includes(status);
107
+ const credentialAttribute: CredentialAttribute = {
108
+ ...attribute,
109
+ disabled,
110
+ id: claim.path,
111
+ listValue,
112
+ nested,
113
+ path: claim.path,
114
+ rightAccessory: status && <Selector status={status} />,
115
+ selected,
116
+ testID,
117
+ };
118
+ if (Array.isArray(claim.value)) {
119
+ if (claim.schema.array) {
120
+ return {
121
+ ...credentialAttribute,
122
+ attributes: undefined,
123
+ image: undefined,
124
+ value: undefined,
125
+ values: claim.value.map((v) =>
126
+ shareCredentialCardAttributeFromV2Claim(
127
+ v,
128
+ selection,
129
+ attributeShared,
130
+ userSelected,
131
+ config,
132
+ testID,
133
+ true,
134
+ false,
135
+ ),
136
+ ),
137
+ };
138
+ } else if (claim.schema.datatype === 'OBJECT') {
139
+ return {
140
+ ...credentialAttribute,
141
+ attributes: claim.value.map((v) =>
142
+ shareCredentialCardAttributeFromV2Claim(v, selection, attributeShared, userSelected, config, testID, true),
143
+ ),
144
+ image: undefined,
145
+ value: undefined,
146
+ valueErrorColor: undefined,
147
+ values: undefined,
148
+ };
149
+ }
150
+ }
151
+ return credentialAttribute;
152
+ };
153
+
154
+ export const missingCredentialCardFromFailureHint = (
155
+ failureHint: FailureHint['failureHint'] | undefined,
156
+ notice: CredentialCardNotice | undefined,
157
+ testID: string,
158
+ labels: ShareCredentialCardLabels,
159
+ ): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'width'> => {
160
+ return {
161
+ cardImage: undefined,
162
+ color: undefined,
163
+ header: {
164
+ credentialDetailErrorColor: true,
165
+ credentialDetailPrimary: labels.missingCredential,
166
+ credentialDetailTestID: concatTestID(testID, 'header.missing'),
167
+ credentialName: failureHint?.credentialSchema?.name ?? '',
168
+ statusIcon: CredentialWarningIcon,
169
+ },
170
+ testID,
171
+ ...notice,
172
+ };
173
+ };
174
+
175
+ export const shareCredentialCardFromV2PresentationCredential = (
176
+ credential: PresentationDefinitionV2CredentialDetail | undefined,
177
+ failureHint: FailureHint['failureHint'] | undefined,
178
+ expanded: boolean,
179
+ multipleCredentialsAvailable: boolean,
180
+ selectedFields: string[] | undefined,
181
+ config: Config,
182
+ wuaState: WUAState | undefined,
183
+ testID: string,
184
+ labels: ShareCredentialCardLabels,
185
+ ): CredentialDetailsCardPropsWithoutWidth => {
186
+ const selectiveDisclosureSupported = supportsSelectiveDisclosure(
187
+ credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
188
+ config,
189
+ );
190
+ const notice: CredentialCardNotice | undefined =
191
+ selectiveDisclosureSupported === false
192
+ ? {
193
+ noticeIcon: CredentialNoticeWarningIcon,
194
+ text: labels.selectiveDisclosureNotice,
195
+ }
196
+ : undefined;
197
+ const cardTestId = concatTestID(testID, 'card');
198
+ const card = credential
199
+ ? validityCheckedCardFromCredential(
200
+ {
201
+ ...credential,
202
+ claims: [],
203
+ },
204
+ false,
205
+ expanded,
206
+ multipleCredentialsAvailable,
207
+ config,
208
+ wuaState,
209
+ notice,
210
+ cardTestId,
211
+ labels,
212
+ )
213
+ : missingCredentialCardFromFailureHint(failureHint, notice, cardTestId, labels);
214
+
215
+ return {
216
+ attributes:
217
+ credential?.claims.map((v) =>
218
+ shareCredentialCardAttributeFromV2Claim(v, selectedFields ?? [], true, false, config, testID),
219
+ ) ?? [],
220
+ card,
221
+ };
222
+ };
223
+
224
+ export const selectCredentialCardFromV2Credential = (
225
+ credential: PresentationDefinitionV2CredentialDetail,
226
+ selected: boolean,
227
+ multiple: boolean,
228
+ config: Config,
229
+ wuaState: WUAState | undefined,
230
+ testID: string,
231
+ labels: ShareCredentialCardLabels,
232
+ ): CredentialDetailsCardPropsWithoutWidth => {
233
+ const selectiveDisclosureSupported = supportsSelectiveDisclosure(
234
+ credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
235
+ config,
236
+ );
237
+ const selectedStatus = multiple ? SelectorStatus.SelectedCheckmark : SelectorStatus.SelectedRadio;
238
+ const rightAccessory = <Selector status={selected ? selectedStatus : SelectorStatus.Empty} />;
239
+ const notice: CredentialCardNotice | undefined =
240
+ selectiveDisclosureSupported === false
241
+ ? {
242
+ noticeIcon: CredentialNoticeWarningIcon,
243
+ text: labels.selectiveDisclosureNotice,
244
+ }
245
+ : undefined;
246
+ const { header, ...cardProps } = getCredentialCardPropsFromCredential(
247
+ {
248
+ ...credential,
249
+ claims: credential.claims.map(v2PresentationClaimToClaim),
250
+ },
251
+ credential.claims.map(v2PresentationClaimToClaim),
252
+ config,
253
+ wuaState,
254
+ notice,
255
+ testID,
256
+ labels,
257
+ );
258
+ const card = {
259
+ header: {
260
+ ...header,
261
+ accessory: rightAccessory,
262
+ },
263
+ ...cardProps,
264
+ };
265
+ return {
266
+ attributes:
267
+ credential?.claims.map((v) =>
268
+ shareCredentialCardAttributeFromV2Claim(v, undefined, false, false, config, testID),
269
+ ) ?? [],
270
+ card,
271
+ };
272
+ };
273
+
274
+ export const getV2CredentialClaimAllSubpaths = (claim: PresentationDefinitionV2CredentialClaim): string[] => {
275
+ if (!Array.isArray(claim.value)) {
276
+ return [claim.path];
277
+ }
278
+ return [claim.path, ...claim.value.flatMap(getV2CredentialClaimAllSubpaths)];
279
+ };
280
+
281
+ export const getV2CredentialAvailablePaths = (credential: PresentationDefinitionV2CredentialDetail): string[] => {
282
+ return credential.claims.flatMap(getV2CredentialClaimAllSubpaths);
283
+ };
@@ -17,6 +17,7 @@ import {
17
17
  import { CredentialCardNotice } from '../../ui-components/credential/card/credential-card';
18
18
  import { CredentialNoticeWarningIcon, CredentialWarningIcon, RequiredAttributeIcon } from '../../ui-components/icons';
19
19
  import { concatTestID } from '../testID';
20
+ import { WUAState } from '../wallet-unit';
20
21
  import {
21
22
  CardLabels,
22
23
  CredentialDetailsCardPropsWithoutWidth,
@@ -34,6 +35,7 @@ export const validityCheckedCardFromCredential = (
34
35
  expanded: boolean,
35
36
  multipleCredentialsAvailable: boolean,
36
37
  config: Config,
38
+ wuaState: WUAState | undefined,
37
39
  notice: CredentialCardNotice | undefined,
38
40
  testID: string,
39
41
  labels: ShareCredentialCardLabels,
@@ -62,7 +64,7 @@ export const validityCheckedCardFromCredential = (
62
64
  };
63
65
  }
64
66
 
65
- const card = getCredentialCardPropsFromCredential(credential, credential.claims, config, notice, testID, labels);
67
+ const card = getCredentialCardPropsFromCredential(credential, credential.claims, config, wuaState, notice, testID, labels);
66
68
  return {
67
69
  ...card,
68
70
  header: {
@@ -94,7 +96,7 @@ export const missingCredentialCardFromRequest = (
94
96
  };
95
97
 
96
98
  interface DisplayedAttribute {
97
- claim?: Claim;
99
+ claim?: FlatClaim;
98
100
  field?: PresentationDefinitionField;
99
101
  id: string;
100
102
  selected?: boolean;
@@ -124,16 +126,33 @@ const getAttributeSelectorStatus = (
124
126
  return selected ? SelectorStatus.SelectedCheckmark : SelectorStatus.Empty;
125
127
  };
126
128
 
129
+ type ClaimWithOptionalPath = Claim & {
130
+ path?: string;
131
+ };
132
+
133
+ type FlatClaim = Claim & {
134
+ path: string;
135
+ isArrayElement?: boolean;
136
+ };
137
+
127
138
  // Returns a spread list of all claims with their full JSON path as key, including all intermediate objects
128
- const spreadClaims = (claims: Claim[], parentClaimPath = ''): Claim[] => {
129
- return claims.reduce((acc, claim) => {
139
+ const spreadClaims = (claims: ClaimWithOptionalPath[]): FlatClaim[] => {
140
+ const claimsWithPath: FlatClaim[] = claims.map((c) => ({
141
+ ...c,
142
+ path: c.path ?? c.key,
143
+ }));
144
+ return claimsWithPath.reduce((acc, claim) => {
130
145
  const result = [claim];
131
146
  if (Array.isArray(claim.value)) {
132
- const claimPath = parentClaimPath ? `${parentClaimPath}/${claim.key}` : claim.key;
133
- result.push(...spreadClaims(claim.value, claimPath));
147
+ const nestedClaimsWithPath: FlatClaim[] = claim.value.map((c, i) => ({
148
+ ...c,
149
+ path: claim.array ? `${c.key}/${i}` : c.key,
150
+ isArrayElement: claim.array,
151
+ }));
152
+ result.push(...spreadClaims(nestedClaimsWithPath));
134
153
  }
135
154
  return [...acc, ...result];
136
- }, [] as Claim[]);
155
+ }, [] as FlatClaim[]);
137
156
  };
138
157
 
139
158
  const getDisplayedAttributes = (
@@ -144,10 +163,11 @@ const getDisplayedAttributes = (
144
163
  selectedFields?: string[],
145
164
  ): DisplayedAttribute[] => {
146
165
  const claims = credential ? spreadClaims(credential.claims) : undefined;
166
+ const isApplicable = credential ? request.applicableCredentials.includes(credential.id) : false;
147
167
 
148
168
  let fields = request.fields;
149
169
  if (credential) {
150
- const fieldsWithNoKeyMapping = request.fields.filter((field) => !(credential.id in field.keyMap));
170
+ const fieldsWithNoKeyMapping = request.fields.filter((field) => !(credential.id in field.keyMap)).filter((field) => !isApplicable || !field.required);
151
171
  const fullyNestedFields = getFullyNestedFields(request.fields, credential.id);
152
172
 
153
173
  fields = [...fieldsWithNoKeyMapping, ...fullyNestedFields];
@@ -156,8 +176,8 @@ const getDisplayedAttributes = (
156
176
  return fields.map((field) => {
157
177
  const selected = !field.required && selectedFields?.includes(field.id);
158
178
  const claim = credential
159
- ? claims?.find(({ key }) => {
160
- return key === field.keyMap[credential.id];
179
+ ? claims?.find(({ path }) => {
180
+ return path === field.keyMap[credential.id];
161
181
  })
162
182
  : undefined;
163
183
  const status =
@@ -185,11 +205,11 @@ export const shareCredentialCardAttributeFromClaim = (
185
205
  config: Config,
186
206
  testID: string,
187
207
  labels: ShareCredentialCardLabels,
188
- claim?: Claim,
208
+ claim?: FlatClaim,
189
209
  field?: PresentationDefinitionField,
190
210
  ): CredentialAttribute => {
191
211
  if (claim) {
192
- return { ...detailsCardAttributeFromClaim(claim, config, testID), id };
212
+ return { ...detailsCardAttributeFromClaim(claim, config, testID), id, path: claim.path, listValue: claim.isArrayElement };
193
213
  }
194
214
  return {
195
215
  id,
@@ -249,6 +269,7 @@ export const shareCredentialCardFromCredential = (
249
269
  request: PresentationDefinitionRequestedCredential,
250
270
  selectedFields: string[] | undefined,
251
271
  config: Config,
272
+ wuaState: WUAState | undefined,
252
273
  testID: string,
253
274
  labels: ShareCredentialCardLabels,
254
275
  ): CredentialDetailsCardPropsWithoutWidth => {
@@ -271,6 +292,7 @@ export const shareCredentialCardFromCredential = (
271
292
  expanded,
272
293
  multipleCredentialsAvailable,
273
294
  config,
295
+ wuaState,
274
296
  notice,
275
297
  cardTestId,
276
298
  labels,
@@ -315,7 +337,7 @@ export const selectCredentialCardAttributeFromClaim = (
315
337
  config: Config,
316
338
  testID: string,
317
339
  labels: ShareCredentialCardLabels,
318
- claim?: Claim,
340
+ claim?: FlatClaim,
319
341
  field?: PresentationDefinitionField,
320
342
  ): CredentialAttribute => {
321
343
  const attribute = shareCredentialCardAttributeFromClaim(id, config, testID, labels, claim, field);
@@ -333,6 +355,7 @@ export const selectCredentialCardFromCredential = (
333
355
  selected: boolean,
334
356
  request: PresentationDefinitionRequestedCredential,
335
357
  config: Config,
358
+ wuaState: WUAState | undefined,
336
359
  testID: string,
337
360
  labels: ShareCredentialCardLabels,
338
361
  ): CredentialDetailsCardPropsWithoutWidth => {
@@ -352,6 +375,7 @@ export const selectCredentialCardFromCredential = (
352
375
  credential,
353
376
  credential.claims,
354
377
  config,
378
+ wuaState,
355
379
  notice,
356
380
  testID,
357
381
  labels,
@@ -363,9 +387,9 @@ export const selectCredentialCardFromCredential = (
363
387
  },
364
388
  ...cardProps,
365
389
  };
366
- const attributes: CredentialAttribute[] = request.fields.map((field) => {
367
- const claim = spreadClaims(credential.claims).find(({ key }) => {
368
- return key === field.keyMap[credential.id];
390
+ const attributes: CredentialAttribute[] = getFullyNestedFields(request.fields, credential.id).map((field) => {
391
+ const claim = spreadClaims(credential.claims).find(({ path }) => {
392
+ return path === field.keyMap[credential.id];
369
393
  });
370
394
 
371
395
  const attribute = selectCredentialCardAttributeFromClaim(field.id, config, testID, labels, claim, field);