@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
@@ -7,7 +7,10 @@ import {
7
7
  CredentialStateEnum,
8
8
  DataTypeEnum,
9
9
  FormatFeatureEnum,
10
+ WalletStorageType,
10
11
  } from '@procivis/react-native-one-core';
12
+ import { FC } from 'react';
13
+ import { SvgProps } from 'react-native-svg';
11
14
 
12
15
  import {
13
16
  CredentialAttribute,
@@ -20,6 +23,7 @@ import { CredentialCardNotice } from '../../ui-components/credential/card/creden
20
23
  import { CredentialErrorIcon, CredentialNoticeWarningIcon, CredentialWarningIcon } from '../../ui-components/icons';
21
24
  import { formatDateLocalized, formatDateTimeLocalized } from '../date';
22
25
  import { concatTestID } from '../testID';
26
+ import { WUAState } from '../wallet-unit';
23
27
  import { getCarouselImagesFromClaims } from './credential-images';
24
28
 
25
29
  export enum ValidityState {
@@ -82,62 +86,109 @@ export type CardHeaderLabels = {
82
86
  revoked: string;
83
87
  suspended: string;
84
88
  suspendedUntil: (date: string) => string;
89
+ wuaExpired: string;
90
+ wuaRevoked: string;
85
91
  };
86
92
 
87
- export const cardHeaderFromCredential = (
93
+ const credentialDetailFromCredential = (
88
94
  credential: CredentialDetail,
89
95
  claims: Claim[] = [],
90
96
  config: Config,
97
+ wuaState: WUAState | undefined,
91
98
  testID: string,
92
99
  labels: CardHeaderLabels,
93
- ): Omit<CredentialHeaderProps, 'style'> => {
94
- let credentialDetailPrimary =
95
- formatDateTimeLocalized(new Date(credential.issuanceDate ?? credential.createdDate)) ?? '';
96
-
97
- let credentialDetailSecondary: string | undefined;
98
- let credentialDetailErrorColor: boolean | undefined;
99
- let credentialDetailTestID: string | undefined;
100
- let statusIcon;
101
-
100
+ ): {
101
+ credentialDetailPrimary?: string;
102
+ credentialDetailSecondary?: string;
103
+ credentialDetailErrorColor?: boolean;
104
+ credentialDetailTestID?: string;
105
+ statusIcon?: FC<SvgProps>;
106
+ } => {
102
107
  const { layoutProperties } = credential.schema;
103
108
 
109
+ if (credential.schema.walletStorageType === WalletStorageType.EUDI_COMPLIANT && wuaState === WUAState.Revoked) {
110
+ return {
111
+ credentialDetailPrimary: labels.wuaRevoked,
112
+ credentialDetailErrorColor: true,
113
+ credentialDetailTestID: concatTestID(testID, 'wua', 'revoked'),
114
+ statusIcon: CredentialErrorIcon,
115
+ };
116
+ }
117
+
104
118
  switch (credential.state) {
105
119
  case CredentialStateEnum.SUSPENDED:
106
- credentialDetailPrimary = credential.suspendEndDate
107
- ? labels.suspendedUntil(formatDateTimeLocalized(new Date(credential.suspendEndDate))!)
108
- : labels.suspended;
109
- credentialDetailTestID = concatTestID(testID, 'suspended');
110
- statusIcon = CredentialWarningIcon;
111
- break;
120
+ return {
121
+ credentialDetailPrimary: credential.suspendEndDate
122
+ ? labels.suspendedUntil(formatDateTimeLocalized(new Date(credential.suspendEndDate))!)
123
+ : labels.suspended,
124
+ credentialDetailTestID: concatTestID(testID, 'suspended'),
125
+ statusIcon: CredentialWarningIcon,
126
+ };
112
127
  case CredentialStateEnum.REVOKED:
113
- credentialDetailPrimary = labels.revoked;
114
- credentialDetailErrorColor = true;
115
- credentialDetailTestID = concatTestID(testID, 'revoked');
116
- statusIcon = CredentialErrorIcon;
117
- break;
118
- default: {
119
- if (hasMsoValidityIssues(credential)) {
120
- credentialDetailPrimary = labels.validityIssues;
121
- credentialDetailTestID = concatTestID(testID, 'validity-issue');
122
- statusIcon = CredentialWarningIcon;
123
- } else {
124
- const primary = findClaimByPath(layoutProperties?.primaryAttribute, claims);
128
+ return {
129
+ credentialDetailPrimary: labels.revoked,
130
+ credentialDetailErrorColor: true,
131
+ credentialDetailTestID: concatTestID(testID, 'revoked'),
132
+ statusIcon: CredentialErrorIcon,
133
+ };
134
+ }
125
135
 
126
- if (primary) {
127
- credentialDetailPrimary = formatCredentialDetail(primary, config, concatTestID(testID, 'primary'));
128
- }
136
+ if (credential.schema.walletStorageType === WalletStorageType.EUDI_COMPLIANT && wuaState === WUAState.Expired) {
137
+ return {
138
+ credentialDetailPrimary: labels.wuaExpired,
139
+ credentialDetailTestID: concatTestID(testID, 'wua', 'suspended'),
140
+ statusIcon: CredentialWarningIcon,
141
+ };
142
+ }
129
143
 
130
- const secondary = findClaimByPath(layoutProperties?.secondaryAttribute, claims);
144
+ if (hasMsoValidityIssues(credential)) {
145
+ return {
146
+ credentialDetailPrimary: labels.validityIssues,
147
+ credentialDetailTestID: concatTestID(testID, 'validity-issue'),
148
+ statusIcon: CredentialWarningIcon,
149
+ };
150
+ }
131
151
 
132
- if (secondary) {
133
- credentialDetailSecondary = formatCredentialDetail(secondary, config, concatTestID(testID, 'secondary'));
134
- }
152
+ let credentialDetailPrimary =
153
+ formatDateTimeLocalized(new Date(credential.issuanceDate ?? credential.createdDate)) ?? '';
154
+ let credentialDetailSecondary: string | undefined;
135
155
 
136
- credentialDetailTestID = concatTestID(testID, 'detail');
137
- }
138
- break;
139
- }
156
+ const primary = findClaimByPath(layoutProperties?.primaryAttribute, claims);
157
+
158
+ if (primary) {
159
+ credentialDetailPrimary = formatCredentialDetail(primary, config, concatTestID(testID, 'primary'));
140
160
  }
161
+
162
+ const secondary = findClaimByPath(layoutProperties?.secondaryAttribute, claims);
163
+
164
+ if (secondary) {
165
+ credentialDetailSecondary = formatCredentialDetail(secondary, config, concatTestID(testID, 'secondary'));
166
+ }
167
+
168
+ return {
169
+ credentialDetailPrimary,
170
+ credentialDetailSecondary,
171
+ credentialDetailTestID: concatTestID(testID, 'detail'),
172
+ };
173
+ };
174
+
175
+ export const cardHeaderFromCredential = (
176
+ credential: CredentialDetail,
177
+ claims: Claim[] = [],
178
+ config: Config,
179
+ wuaState: WUAState | undefined,
180
+ testID: string,
181
+ labels: CardHeaderLabels,
182
+ ): Omit<CredentialHeaderProps, 'style'> => {
183
+ const {
184
+ credentialDetailPrimary,
185
+ credentialDetailSecondary,
186
+ credentialDetailErrorColor,
187
+ credentialDetailTestID,
188
+ statusIcon,
189
+ } = credentialDetailFromCredential(credential, claims, config, wuaState, testID, labels);
190
+ const { layoutProperties } = credential.schema;
191
+
141
192
  return {
142
193
  color: layoutProperties?.logo?.backgroundColor,
143
194
  credentialDetailErrorColor,
@@ -166,6 +217,7 @@ export const getCredentialCardPropsFromCredential = (
166
217
  credential: CredentialDetail,
167
218
  claims: Claim[] = [],
168
219
  config: Config,
220
+ wuaState: WUAState | undefined,
169
221
  notice: CredentialCardNotice | undefined,
170
222
  testID: string,
171
223
  labels: CardLabels,
@@ -185,7 +237,7 @@ export const getCredentialCardPropsFromCredential = (
185
237
  ? { imageSource: { uri: layoutProperties.background.image } }
186
238
  : undefined,
187
239
  color: layoutProperties?.background?.color,
188
- header: cardHeaderFromCredential(credential, claims, config, concatTestID(testID, 'header'), labels),
240
+ header: cardHeaderFromCredential(credential, claims, config, wuaState, concatTestID(testID, 'header'), labels),
189
241
  testID,
190
242
  notice,
191
243
  };
@@ -242,7 +294,8 @@ const detailsCardAttributeValueFromClaim = (claim: Claim, config: Config, testID
242
294
  value: formatDateLocalized(new Date(date)) ?? date,
243
295
  };
244
296
  }
245
- case DataTypeEnum.File: {
297
+ case DataTypeEnum.Picture: // fallback
298
+ case DataTypeEnum.SwiyuPicture: {
246
299
  if (typeConfig.params?.showAs === 'IMAGE') {
247
300
  return { image: { uri: claim.value as string }, testID: testID };
248
301
  } else {
@@ -257,21 +310,23 @@ const detailsCardAttributeValueFromClaim = (claim: Claim, config: Config, testID
257
310
 
258
311
  export type CredentialDetailsCardPropsWithoutWidth = Omit<CredentialDetailsCardProps, 'expanded' | 'card'> & {
259
312
  card: Omit<CredentialCardProps, 'width'>;
260
- }
313
+ };
261
314
 
262
315
  export const detailsCardFromCredential = (
263
316
  credential: CredentialDetail,
264
317
  config: Config,
318
+ wuaState: WUAState | undefined,
265
319
  testID: string,
266
320
  labels: CardLabels,
267
321
  ): CredentialDetailsCardPropsWithoutWidth => {
268
- return detailsCardFromCredentialWithClaims(credential, credential.claims, config, testID, labels);
322
+ return detailsCardFromCredentialWithClaims(credential, credential.claims, config, wuaState, testID, labels);
269
323
  };
270
324
 
271
325
  export const detailsCardFromCredentialWithClaims = (
272
326
  credential: CredentialDetail,
273
327
  claims: Claim[],
274
328
  config: Config,
329
+ wuaState: WUAState | undefined,
275
330
  testID: string,
276
331
  labels: CardLabels,
277
332
  ): CredentialDetailsCardPropsWithoutWidth => {
@@ -283,6 +338,7 @@ export const detailsCardFromCredentialWithClaims = (
283
338
  credential,
284
339
  claims,
285
340
  config,
341
+ wuaState,
286
342
  undefined,
287
343
  concatTestID(testID, 'card'),
288
344
  labels,
@@ -307,9 +363,9 @@ export const nestAttributes = (attributes: CredentialAttribute[]): CredentialAtt
307
363
  const [first, ...rest] = attributePath;
308
364
  const parent = result.find((a) => a.name === first);
309
365
  if (parent) {
310
- insertAttributeInObject({ ...attribute, path: rest.join('/') }, parent);
366
+ insertAttributeInParent({ ...attribute, path: rest.join('/') }, parent);
311
367
  } else {
312
- result.push(nestAttributeInDummyObject(attribute));
368
+ result.push(nestAttributeInDummyParent(attribute));
313
369
  }
314
370
  }
315
371
  }
@@ -319,7 +375,7 @@ export const nestAttributes = (attributes: CredentialAttribute[]): CredentialAtt
319
375
 
320
376
  // We nest the leaf node in a (one or more) nested object(s)
321
377
  // to make sure the tree structure is correctly rendered in proof request screens.
322
- const nestAttributeInDummyObject = (attribute: CredentialAttribute): CredentialAttribute => {
378
+ const nestAttributeInDummyParent = (attribute: CredentialAttribute): CredentialAttribute => {
323
379
  const pathParts = attribute.path.split('/');
324
380
  const [first, ...rest] = pathParts;
325
381
  if (!rest.length) {
@@ -328,27 +384,41 @@ const nestAttributeInDummyObject = (attribute: CredentialAttribute): CredentialA
328
384
 
329
385
  // The dummy object is not selectable, and contains a placeholder ID
330
386
  // the user can't interact with it.
331
- return {
332
- attributes: [nestAttributeInDummyObject({ ...attribute, path: rest.join('/') })],
333
- disabled: true,
334
- id: `${attribute.id}/${first}`,
335
- name: first,
336
- path: attribute.path,
337
- };
387
+ if (attribute.listValue) {
388
+ return {
389
+ values: [nestAttributeInDummyParent({ ...attribute, path: rest.join('/') })],
390
+ disabled: true,
391
+ id: `${attribute.id}/${first}`,
392
+ name: first,
393
+ path: first,
394
+ };
395
+ } else {
396
+ return {
397
+ attributes: [nestAttributeInDummyParent({ ...attribute, path: rest.join('/') })],
398
+ disabled: true,
399
+ id: `${attribute.id}/${first}`,
400
+ name: first,
401
+ path: first,
402
+ };
403
+ }
338
404
  };
339
405
 
340
- // Recursively insert an attribute into an object
341
- // Will create nested objects if necessary
342
- const insertAttributeInObject = (attribute: CredentialAttribute, object: CredentialAttribute) => {
406
+ // Recursively insert an attribute into an parent
407
+ // Will create nested parents if necessary
408
+ const insertAttributeInParent = (attribute: CredentialAttribute, parent: CredentialAttribute) => {
343
409
  const pathParts = attribute.path.split('/');
344
410
  const [first, ...rest] = pathParts;
345
411
 
346
- const nextParent = object.attributes?.find((a) => a.name === first);
412
+ const nextParent = parent.attributes?.find((a) => a.name === first);
347
413
 
348
414
  if (!nextParent) {
349
- object.attributes?.push(nestAttributeInDummyObject(attribute));
415
+ if (attribute.listValue) {
416
+ parent.values?.push(nestAttributeInDummyParent(attribute));
417
+ } else {
418
+ parent.attributes?.push(nestAttributeInDummyParent(attribute));
419
+ }
350
420
  } else {
351
- insertAttributeInObject({ ...attribute, path: rest.join('/') }, nextParent);
421
+ insertAttributeInParent({ ...attribute, path: rest.join('/') }, nextParent);
352
422
  }
353
423
  };
354
424
 
@@ -1,5 +1,6 @@
1
1
  export * from './credential';
2
2
  export * from './credential-images';
3
3
  export * from './credential-sharing';
4
+ export * from './credential-sharing-v2';
4
5
  export * from './query';
5
6
  export * from './universal-links';
@@ -33,11 +33,12 @@ export const getQueryKeyFromCredentialListQueryParams = (queryParams: Partial<Cr
33
33
  'sort',
34
34
  'sortDirection',
35
35
  'exact',
36
- 'role',
36
+ 'roles',
37
37
  'ids',
38
- 'status',
38
+ 'states',
39
39
  'include',
40
- 'profile',
40
+ 'profiles',
41
+ 'credentialSchemaIds',
41
42
  'createdDateAfter',
42
43
  'createdDateBefore',
43
44
  'lastModifiedAfter',
@@ -64,6 +65,7 @@ export const getQueryKeyFromHistoryListQueryParams = (queryParams: Partial<Histo
64
65
  'credentialSchemaId',
65
66
  'proofSchemaId',
66
67
  'search',
68
+ 'user',
67
69
  ]);
68
70
  };
69
71
 
@@ -120,7 +122,7 @@ export const getQueryKeyFromProofListQueryParams = (queryParams: Partial<ProofLi
120
122
  'proofRoles',
121
123
  'proofSchemaIds',
122
124
  'exact',
123
- 'profile',
125
+ 'profiles',
124
126
  'createdDateAfter',
125
127
  'createdDateBefore',
126
128
  'lastModifiedAfter',
@@ -161,7 +163,7 @@ export const getQueryKeyFromIdentifierListQueryParams = (queryParams: Partial<Id
161
163
  'sortDirection',
162
164
  'name',
163
165
  'types',
164
- 'state',
166
+ 'states',
165
167
  'exact',
166
168
  'didMethods',
167
169
  'isRemote',
@@ -0,0 +1,61 @@
1
+ import { Platform } from 'react-native';
2
+ import Share from 'react-native-share';
3
+
4
+ /**
5
+ * Check URL validity
6
+ * @param {string} urlString URL to validate.
7
+ * @returns {boolean}
8
+ */
9
+ export const isUrlValid = (urlString: string): boolean => {
10
+ try {
11
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
+ const url = new URL(urlString);
13
+ return true;
14
+ } catch {
15
+ return false;
16
+ }
17
+ };
18
+
19
+ /**
20
+ * Check URL http(s) validity
21
+ * @param {string} urlString URL to validate.
22
+ * @returns {boolean}
23
+ */
24
+ export const isValidHttpUrl = (urlString: string): boolean => {
25
+ try {
26
+ const url = new URL(urlString);
27
+ return url?.protocol === 'http:' || url?.protocol === 'https:';
28
+ } catch {
29
+ return false;
30
+ }
31
+ };
32
+
33
+ /**
34
+ * Share URL via share sheet
35
+ * @param {string} url URL to share.
36
+ * @param {string} title _(optional)_ title for iOS share sheet.
37
+ * @returns {boolean}
38
+ */
39
+ export const shareUrl = async (url: string, title?: string) => {
40
+ if (Platform.OS === 'ios') {
41
+ await Share.open({
42
+ activityItemSources: [
43
+ {
44
+ placeholderItem: { type: 'url', content: url },
45
+ item: {
46
+ default: { type: 'url', content: url },
47
+ },
48
+ subject: title
49
+ ? {
50
+ default: title,
51
+ }
52
+ : undefined,
53
+ linkMetadata: { originalUrl: url, url, title },
54
+ },
55
+ ],
56
+ failOnCancel: false,
57
+ });
58
+ } else {
59
+ await Share.open({ url, failOnCancel: false });
60
+ }
61
+ };
@@ -0,0 +1,30 @@
1
+ import { HolderAttestationWalletUnitResponse, WalletUnitStatusEnum } from '@procivis/react-native-one-core';
2
+
3
+ export const isWalletAttestationExpired = (
4
+ walletUnitAttestation: HolderAttestationWalletUnitResponse | undefined,
5
+ ) => {
6
+ return (
7
+ walletUnitAttestation?.expirationDate &&
8
+ Date.parse(walletUnitAttestation.expirationDate) < Date.now()
9
+ );
10
+ };
11
+
12
+ export enum WUAState {
13
+ Revoked = "revoked",
14
+ Expired = "expired",
15
+ Valid = "valid"
16
+ }
17
+
18
+ export const walletUnitAttestationState = (
19
+ walletUnitAttestation: HolderAttestationWalletUnitResponse | undefined,
20
+ ): WUAState | undefined => {
21
+ if (!walletUnitAttestation) {
22
+ return undefined;
23
+ }
24
+ if (walletUnitAttestation.status === WalletUnitStatusEnum.REVOKED) {
25
+ return WUAState.Revoked;
26
+ } else if (isWalletAttestationExpired(walletUnitAttestation)) {
27
+ return WUAState.Expired;
28
+ }
29
+ return WUAState.Valid;
30
+ };
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_theme","e","__esModule","default","ProofRequestGroup","children","colorScheme","useAppColorScheme","createElement","View","style","styles","group","separator","backgroundColor","grayDark","exports","StyleSheet","create","marginTop","height","marginBottom","marginHorizontal","opacity"],"sources":["group.tsx"],"sourcesContent":["import React, { FunctionComponent, PropsWithChildren } from 'react';\nimport { StyleSheet, View } from 'react-native';\n\nimport { useAppColorScheme } from '../../ui-components/theme';\n\nexport const ProofRequestGroup: FunctionComponent<PropsWithChildren> = ({ children }) => {\n const colorScheme = useAppColorScheme();\n return (\n <View style={styles.group}>\n <View style={[styles.separator, { backgroundColor: colorScheme.grayDark }]} />\n {children}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n group: {\n marginTop: 16,\n },\n separator: {\n height: 1,\n marginBottom: 16,\n marginHorizontal: 4,\n opacity: 0.5,\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAA8D,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEvD,MAAMG,iBAAuD,GAAGA,CAAC;EAAEC;AAAS,CAAC,KAAK;EACvF,MAAMC,WAAW,GAAG,IAAAC,wBAAiB,EAAC,CAAC;EACvC,oBACEX,MAAA,CAAAO,OAAA,CAAAK,aAAA,CAACT,YAAA,CAAAU,IAAI;IAACC,KAAK,EAAEC,MAAM,CAACC;EAAM,gBACxBhB,MAAA,CAAAO,OAAA,CAAAK,aAAA,CAACT,YAAA,CAAAU,IAAI;IAACC,KAAK,EAAE,CAACC,MAAM,CAACE,SAAS,EAAE;MAAEC,eAAe,EAAER,WAAW,CAACS;IAAS,CAAC;EAAE,CAAE,CAAC,EAC7EV,QACG,CAAC;AAEX,CAAC;AAACW,OAAA,CAAAZ,iBAAA,GAAAA,iBAAA;AAEF,MAAMO,MAAM,GAAGM,uBAAU,CAACC,MAAM,CAAC;EAC/BN,KAAK,EAAE;IACLO,SAAS,EAAE;EACb,CAAC;EACDN,SAAS,EAAE;IACTO,MAAM,EAAE,CAAC;IACTC,YAAY,EAAE,EAAE;IAChBC,gBAAgB,EAAE,CAAC;IACnBC,OAAO,EAAE;EACX;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_uiComponents","_coreConfig","_credentials","_credentialSharing","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","SelectCredential","credentialId","labels","lastItem","onImagePreview","onPress","request","selected","testID","data","credential","useCredentialDetail","config","useCoreConfig","cardWidth","useMemo","Dimensions","width","card","attributes","selectCredentialCardFromCredential","createElement","CredentialDetailsCardListItem","onHeaderPress","expanded","exports"],"sources":["select-credential.tsx"],"sourcesContent":["import { PresentationDefinitionRequestedCredential } from '@procivis/react-native-one-core';\nimport React, { FC, useMemo } from 'react';\nimport { Dimensions, ImageSourcePropType } from 'react-native';\n\nimport { CredentialDetailsCardListItem } from '../../ui-components';\nimport { useCoreConfig } from '../../utils/hooks/core/core-config';\nimport { useCredentialDetail } from '../../utils/hooks/core/credentials';\nimport { selectCredentialCardFromCredential, ShareCredentialCardLabels } from '../../utils/parsers/credential-sharing';\n\nexport const SelectCredential: FC<{\n credentialId: string;\n labels: ShareCredentialCardLabels;\n lastItem: boolean;\n onImagePreview: (title: string, image: ImageSourcePropType) => void;\n onPress?: () => void;\n request: PresentationDefinitionRequestedCredential;\n selected: boolean;\n testID: string;\n}> = ({ credentialId, labels, lastItem, onImagePreview, onPress, request, selected, testID }) => {\n const { data: credential } = useCredentialDetail(credentialId);\n const { data: config } = useCoreConfig();\n const cardWidth = useMemo(() => Dimensions.get('window').width - 32, []);\n\n if (!credential || !config) {\n return null;\n }\n\n const { card, attributes } = selectCredentialCardFromCredential(\n credential,\n selected,\n request,\n config,\n testID,\n labels,\n );\n\n return (\n <CredentialDetailsCardListItem\n attributes={attributes}\n card={{\n ...card,\n onHeaderPress: onPress,\n width: cardWidth,\n }}\n expanded={selected}\n lastItem={lastItem}\n onImagePreview={onImagePreview}\n />\n );\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AAAuH,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA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EAExE,IAAI,CAACP,UAAU,IAAI,CAACE,MAAM,EAAE;IAC1B,OAAO,IAAI;EACb;EAEA,MAAM;IAAEM,IAAI;IAAEC;EAAW,CAAC,GAAG,IAAAC,qDAAkC,EAC7DV,UAAU,EACVH,QAAQ,EACRD,OAAO,EACPM,MAAM,EACNJ,MAAM,EACNN,MACF,CAAC;EAED,oBACE9B,MAAA,CAAAc,OAAA,CAAAmC,aAAA,CAAC7C,aAAA,CAAA8C,6BAA6B;IAC5BH,UAAU,EAAEA,UAAW;IACvBD,IAAI,EAAE;MACJ,GAAGA,IAAI;MACPK,aAAa,EAAElB,OAAO;MACtBY,KAAK,EAAEH;IACT,CAAE;IACFU,QAAQ,EAAEjB,QAAS;IACnBJ,QAAQ,EAAEA,QAAS;IACnBC,cAAc,EAAEA;EAAe,CAChC,CAAC;AAEN,CAAC;AAACqB,OAAA,CAAAzB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNativeOneCore","require","_react","_interopRequireWildcard","_reactNative","_uiComponents","_utils","_coreConfig","_credential","_credentialSharing","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ShareCredential","allCredentials","expanded","labels","lastItem","onHeaderPress","onImagePreview","onSelectCredential","onSelectField","request","selectedCredentialId","selectedFields","style","testID","_credential$issuer","colorScheme","useAppColorScheme","credential","find","c","id","data","config","useCoreConfig","cardWidth","useMemo","Dimensions","width","selectionOptions","applicableCredentials","filter","applicableCredentialId","some","state","CredentialStateEnum","ACCEPTED","multipleCredentialsAvailable","length","validityState","getValidityState","issuer","undefined","invalid","lvvcIssuanceDate","validityCredentialNbf","Date","footer","ValidityState","Revoked","createElement","View","styles","notice","backgroundColor","background","concatTestID","Typography","align","color","text","preset","revokedCredentialNotice","Suspended","suspendedCredentialNotice","invalidCredentialNotice","multipleCredentialsNotice","Button","onPress","noticeButton","title","multipleCredentialsSelect","type","ButtonType","Secondary","card","attributes","shareCredentialCardFromCredential","Boolean","CredentialDetailsCardListItem","credentialId","onAttributeSelected","borderColor","exports","StyleSheet","create","borderRadius","borderWidth","marginBottom","marginHorizontal","padding","marginTop","paddingVertical"],"sources":["share-credential.tsx"],"sourcesContent":["import {\n CredentialDetail,\n CredentialListItem,\n CredentialStateEnum,\n PresentationDefinitionField,\n PresentationDefinitionRequestedCredential,\n} from '@procivis/react-native-one-core';\nimport React, { FunctionComponent, useMemo } from 'react';\nimport { Dimensions, ImageSourcePropType, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport { Button, ButtonType, CredentialDetailsCardListItem, Typography, useAppColorScheme } from '../../ui-components';\nimport { concatTestID } from '../../utils';\nimport { useCoreConfig } from '../../utils/hooks/core/core-config';\nimport { getValidityState, ValidityState } from '../../utils/parsers/credential';\nimport { shareCredentialCardFromCredential, ShareCredentialCardLabels } from '../../utils/parsers/credential-sharing';\n\nexport type ShareCredentialLabels = ShareCredentialCardLabels & {\n invalidCredentialNotice: string;\n multipleCredentialsNotice: string;\n multipleCredentialsSelect: string;\n revokedCredentialNotice: string;\n suspendedCredentialNotice: string;\n};\n\nexport const ShareCredential: FunctionComponent<{\n allCredentials: CredentialDetail[];\n expanded?: boolean;\n labels: ShareCredentialLabels;\n lastItem?: boolean;\n onHeaderPress?: (_credentialId?: string) => void;\n onImagePreview: (title: string, image: ImageSourcePropType) => void;\n onSelectCredential?: () => void;\n onSelectField: (_id: PresentationDefinitionField['id'], _selected: boolean) => void;\n request: PresentationDefinitionRequestedCredential;\n selectedCredentialId?: CredentialListItem['id'];\n selectedFields?: Array<PresentationDefinitionField['id']>;\n style?: StyleProp<ViewStyle>;\n testID: string;\n}> = ({\n allCredentials,\n expanded,\n labels,\n lastItem,\n onHeaderPress,\n onImagePreview,\n onSelectCredential,\n onSelectField,\n request,\n selectedCredentialId,\n selectedFields,\n style,\n testID,\n}) => {\n const colorScheme = useAppColorScheme();\n const credential = allCredentials.find((c) => c.id === selectedCredentialId);\n const { data: config } = useCoreConfig();\n const cardWidth = useMemo(() => Dimensions.get('window').width - 32, []);\n\n const selectionOptions = useMemo(\n () =>\n request.applicableCredentials.filter((applicableCredentialId) =>\n allCredentials.some(({ id, state }) => id === applicableCredentialId && state === CredentialStateEnum.ACCEPTED),\n ),\n [allCredentials, request],\n );\n const multipleCredentialsAvailable = selectionOptions.length > 1;\n\n const validityState = getValidityState(\n credential\n ? {\n ...credential,\n issuer: credential?.issuer?.id,\n }\n : undefined,\n );\n\n const invalid = useMemo(() => {\n if (!credential?.lvvcIssuanceDate || !request.validityCredentialNbf) {\n return false;\n }\n return new Date(credential.lvvcIssuanceDate) < new Date(request.validityCredentialNbf);\n }, [credential, request]);\n\n const footer = useMemo(() => {\n if (!expanded) {\n return;\n }\n if (validityState === ValidityState.Revoked) {\n return (\n <View\n style={[styles.notice, { backgroundColor: colorScheme.background }]}\n testID={concatTestID(testID, 'notice.revoked')}>\n <Typography align=\"center\" color={colorScheme.text} preset=\"s/line-height-capped\">\n {labels.revokedCredentialNotice}\n </Typography>\n </View>\n );\n }\n if (validityState === ValidityState.Suspended) {\n return (\n <View\n style={[styles.notice, { backgroundColor: colorScheme.background }]}\n testID={concatTestID(testID, 'notice.suspended')}>\n <Typography align=\"center\" color={colorScheme.text} preset=\"s/line-height-capped\">\n {labels.suspendedCredentialNotice}\n </Typography>\n </View>\n );\n }\n\n if (invalid) {\n return (\n <View\n style={[styles.notice, { backgroundColor: colorScheme.background }]}\n testID={concatTestID(testID, 'notice.invalid')}>\n <Typography align=\"center\" color={colorScheme.text} preset=\"s/line-height-capped\">\n {labels.invalidCredentialNotice}\n </Typography>\n </View>\n );\n }\n\n if (multipleCredentialsAvailable) {\n return (\n <View\n style={[styles.notice, { backgroundColor: colorScheme.background }]}\n testID={concatTestID(testID, 'notice.multiple')}>\n <Typography align=\"center\" color={colorScheme.text} preset=\"s/line-height-capped\">\n {labels.multipleCredentialsNotice}\n </Typography>\n <Button\n onPress={onSelectCredential}\n style={styles.noticeButton}\n testID={concatTestID(testID, 'notice.multiple.button')}\n title={labels.multipleCredentialsSelect}\n type={ButtonType.Secondary}\n />\n </View>\n );\n }\n }, [colorScheme, expanded, invalid, labels, multipleCredentialsAvailable, onSelectCredential, testID, validityState]);\n\n if (!config) {\n return null;\n }\n\n const { card, attributes } = shareCredentialCardFromCredential(\n credential,\n invalid,\n Boolean(expanded),\n multipleCredentialsAvailable,\n request,\n selectedFields,\n config,\n testID,\n labels,\n );\n\n return (\n <CredentialDetailsCardListItem\n attributes={attributes}\n card={{\n ...card,\n credentialId: request.id,\n onHeaderPress,\n width: cardWidth,\n }}\n expanded={expanded}\n footer={footer}\n lastItem={lastItem}\n onAttributeSelected={onSelectField}\n onImagePreview={onImagePreview}\n style={[styles.credential, { borderColor: colorScheme.background }, style]}\n testID={testID}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n credential: {\n borderRadius: 10,\n borderWidth: 1,\n marginBottom: 8,\n },\n notice: {\n marginBottom: 22,\n marginHorizontal: 12,\n padding: 12,\n },\n noticeButton: {\n marginTop: 24,\n paddingVertical: 11,\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAOA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAEA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AAAsH,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAA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nB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","StyleSheet","View","useAppColorScheme","ProofRequestGroup","children","colorScheme","createElement","style","styles","group","separator","backgroundColor","grayDark","create","marginTop","height","marginBottom","marginHorizontal","opacity"],"sources":["group.tsx"],"sourcesContent":["import React, { FunctionComponent, PropsWithChildren } from 'react';\nimport { StyleSheet, View } from 'react-native';\n\nimport { useAppColorScheme } from '../../ui-components/theme';\n\nexport const ProofRequestGroup: FunctionComponent<PropsWithChildren> = ({ children }) => {\n const colorScheme = useAppColorScheme();\n return (\n <View style={styles.group}>\n <View style={[styles.separator, { backgroundColor: colorScheme.grayDark }]} />\n {children}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n group: {\n marginTop: 16,\n },\n separator: {\n height: 1,\n marginBottom: 16,\n marginHorizontal: 4,\n opacity: 0.5,\n },\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAgD,OAAO;AACnE,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,SAASC,iBAAiB,QAAQ,2BAA2B;AAE7D,OAAO,MAAMC,iBAAuD,GAAGA,CAAC;EAAEC;AAAS,CAAC,KAAK;EACvF,MAAMC,WAAW,GAAGH,iBAAiB,CAAC,CAAC;EACvC,oBACEH,KAAA,CAAAO,aAAA,CAACL,IAAI;IAACM,KAAK,EAAEC,MAAM,CAACC;EAAM,gBACxBV,KAAA,CAAAO,aAAA,CAACL,IAAI;IAACM,KAAK,EAAE,CAACC,MAAM,CAACE,SAAS,EAAE;MAAEC,eAAe,EAAEN,WAAW,CAACO;IAAS,CAAC;EAAE,CAAE,CAAC,EAC7ER,QACG,CAAC;AAEX,CAAC;AAED,MAAMI,MAAM,GAAGR,UAAU,CAACa,MAAM,CAAC;EAC/BJ,KAAK,EAAE;IACLK,SAAS,EAAE;EACb,CAAC;EACDJ,SAAS,EAAE;IACTK,MAAM,EAAE,CAAC;IACTC,YAAY,EAAE,EAAE;IAChBC,gBAAgB,EAAE,CAAC;IACnBC,OAAO,EAAE;EACX;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useMemo","Dimensions","CredentialDetailsCardListItem","useCoreConfig","useCredentialDetail","selectCredentialCardFromCredential","SelectCredential","credentialId","labels","lastItem","onImagePreview","onPress","request","selected","testID","data","credential","config","cardWidth","get","width","card","attributes","createElement","onHeaderPress","expanded"],"sources":["select-credential.tsx"],"sourcesContent":["import { PresentationDefinitionRequestedCredential } from '@procivis/react-native-one-core';\nimport React, { FC, useMemo } from 'react';\nimport { Dimensions, ImageSourcePropType } from 'react-native';\n\nimport { CredentialDetailsCardListItem } from '../../ui-components';\nimport { useCoreConfig } from '../../utils/hooks/core/core-config';\nimport { useCredentialDetail } from '../../utils/hooks/core/credentials';\nimport { selectCredentialCardFromCredential, ShareCredentialCardLabels } from '../../utils/parsers/credential-sharing';\n\nexport const SelectCredential: FC<{\n credentialId: string;\n labels: ShareCredentialCardLabels;\n lastItem: boolean;\n onImagePreview: (title: string, image: ImageSourcePropType) => void;\n onPress?: () => void;\n request: PresentationDefinitionRequestedCredential;\n selected: boolean;\n testID: string;\n}> = ({ credentialId, labels, lastItem, onImagePreview, onPress, request, selected, testID }) => {\n const { data: credential } = useCredentialDetail(credentialId);\n const { data: config } = useCoreConfig();\n const cardWidth = useMemo(() => Dimensions.get('window').width - 32, []);\n\n if (!credential || !config) {\n return null;\n }\n\n const { card, attributes } = selectCredentialCardFromCredential(\n credential,\n selected,\n request,\n config,\n testID,\n labels,\n );\n\n return (\n <CredentialDetailsCardListItem\n attributes={attributes}\n card={{\n ...card,\n onHeaderPress: onPress,\n width: cardWidth,\n }}\n expanded={selected}\n lastItem={lastItem}\n onImagePreview={onImagePreview}\n />\n );\n};\n"],"mappings":"AACA,OAAOA,KAAK,IAAQC,OAAO,QAAQ,OAAO;AAC1C,SAASC,UAAU,QAA6B,cAAc;AAE9D,SAASC,6BAA6B,QAAQ,qBAAqB;AACnE,SAASC,aAAa,QAAQ,oCAAoC;AAClE,SAASC,mBAAmB,QAAQ,oCAAoC;AACxE,SAASC,kCAAkC,QAAmC,wCAAwC;AAEtH,OAAO,MAAMC,gBASX,GAAGA,CAAC;EAAEC,YAAY;EAAEC,MAAM;EAAEC,QAAQ;EAAEC,cAAc;EAAEC,OAAO;EAAEC,OAAO;EAAEC,QAAQ;EAAEC;AAAO,CAAC,KAAK;EAC/F,MAAM;IAAEC,IAAI,EAAEC;EAAW,CAAC,GAAGZ,mBAAmB,CAACG,YAAY,CAAC;EAC9D,MAAM;IAAEQ,IAAI,EAAEE;EAAO,CAAC,GAAGd,aAAa,CAAC,CAAC;EACxC,MAAMe,SAAS,GAAGlB,OAAO,CAAC,MAAMC,UAAU,CAACkB,GAAG,CAAC,QAAQ,CAAC,CAACC,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC;EAExE,IAAI,CAACJ,UAAU,IAAI,CAACC,MAAM,EAAE;IAC1B,OAAO,IAAI;EACb;EAEA,MAAM;IAAEI,IAAI;IAAEC;EAAW,CAAC,GAAGjB,kCAAkC,CAC7DW,UAAU,EACVH,QAAQ,EACRD,OAAO,EACPK,MAAM,EACNH,MAAM,EACNN,MACF,CAAC;EAED,oBACET,KAAA,CAAAwB,aAAA,CAACrB,6BAA6B;IAC5BoB,UAAU,EAAEA,UAAW;IACvBD,IAAI,EAAE;MACJ,GAAGA,IAAI;MACPG,aAAa,EAAEb,OAAO;MACtBS,KAAK,EAAEF;IACT,CAAE;IACFO,QAAQ,EAAEZ,QAAS;IACnBJ,QAAQ,EAAEA,QAAS;IACnBC,cAAc,EAAEA;EAAe,CAChC,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -1,147 +0,0 @@
1
- import { CredentialStateEnum } from '@procivis/react-native-one-core';
2
- import React, { useMemo } from 'react';
3
- import { Dimensions, StyleSheet, View } from 'react-native';
4
- import { Button, ButtonType, CredentialDetailsCardListItem, Typography, useAppColorScheme } from '../../ui-components';
5
- import { concatTestID } from '../../utils';
6
- import { useCoreConfig } from '../../utils/hooks/core/core-config';
7
- import { getValidityState, ValidityState } from '../../utils/parsers/credential';
8
- import { shareCredentialCardFromCredential } from '../../utils/parsers/credential-sharing';
9
- export const ShareCredential = ({
10
- allCredentials,
11
- expanded,
12
- labels,
13
- lastItem,
14
- onHeaderPress,
15
- onImagePreview,
16
- onSelectCredential,
17
- onSelectField,
18
- request,
19
- selectedCredentialId,
20
- selectedFields,
21
- style,
22
- testID
23
- }) => {
24
- var _credential$issuer;
25
- const colorScheme = useAppColorScheme();
26
- const credential = allCredentials.find(c => c.id === selectedCredentialId);
27
- const {
28
- data: config
29
- } = useCoreConfig();
30
- const cardWidth = useMemo(() => Dimensions.get('window').width - 32, []);
31
- const selectionOptions = useMemo(() => request.applicableCredentials.filter(applicableCredentialId => allCredentials.some(({
32
- id,
33
- state
34
- }) => id === applicableCredentialId && state === CredentialStateEnum.ACCEPTED)), [allCredentials, request]);
35
- const multipleCredentialsAvailable = selectionOptions.length > 1;
36
- const validityState = getValidityState(credential ? {
37
- ...credential,
38
- issuer: credential === null || credential === void 0 || (_credential$issuer = credential.issuer) === null || _credential$issuer === void 0 ? void 0 : _credential$issuer.id
39
- } : undefined);
40
- const invalid = useMemo(() => {
41
- if (!(credential !== null && credential !== void 0 && credential.lvvcIssuanceDate) || !request.validityCredentialNbf) {
42
- return false;
43
- }
44
- return new Date(credential.lvvcIssuanceDate) < new Date(request.validityCredentialNbf);
45
- }, [credential, request]);
46
- const footer = useMemo(() => {
47
- if (!expanded) {
48
- return;
49
- }
50
- if (validityState === ValidityState.Revoked) {
51
- return /*#__PURE__*/React.createElement(View, {
52
- style: [styles.notice, {
53
- backgroundColor: colorScheme.background
54
- }],
55
- testID: concatTestID(testID, 'notice.revoked')
56
- }, /*#__PURE__*/React.createElement(Typography, {
57
- align: "center",
58
- color: colorScheme.text,
59
- preset: "s/line-height-capped"
60
- }, labels.revokedCredentialNotice));
61
- }
62
- if (validityState === ValidityState.Suspended) {
63
- return /*#__PURE__*/React.createElement(View, {
64
- style: [styles.notice, {
65
- backgroundColor: colorScheme.background
66
- }],
67
- testID: concatTestID(testID, 'notice.suspended')
68
- }, /*#__PURE__*/React.createElement(Typography, {
69
- align: "center",
70
- color: colorScheme.text,
71
- preset: "s/line-height-capped"
72
- }, labels.suspendedCredentialNotice));
73
- }
74
- if (invalid) {
75
- return /*#__PURE__*/React.createElement(View, {
76
- style: [styles.notice, {
77
- backgroundColor: colorScheme.background
78
- }],
79
- testID: concatTestID(testID, 'notice.invalid')
80
- }, /*#__PURE__*/React.createElement(Typography, {
81
- align: "center",
82
- color: colorScheme.text,
83
- preset: "s/line-height-capped"
84
- }, labels.invalidCredentialNotice));
85
- }
86
- if (multipleCredentialsAvailable) {
87
- return /*#__PURE__*/React.createElement(View, {
88
- style: [styles.notice, {
89
- backgroundColor: colorScheme.background
90
- }],
91
- testID: concatTestID(testID, 'notice.multiple')
92
- }, /*#__PURE__*/React.createElement(Typography, {
93
- align: "center",
94
- color: colorScheme.text,
95
- preset: "s/line-height-capped"
96
- }, labels.multipleCredentialsNotice), /*#__PURE__*/React.createElement(Button, {
97
- onPress: onSelectCredential,
98
- style: styles.noticeButton,
99
- testID: concatTestID(testID, 'notice.multiple.button'),
100
- title: labels.multipleCredentialsSelect,
101
- type: ButtonType.Secondary
102
- }));
103
- }
104
- }, [colorScheme, expanded, invalid, labels, multipleCredentialsAvailable, onSelectCredential, testID, validityState]);
105
- if (!config) {
106
- return null;
107
- }
108
- const {
109
- card,
110
- attributes
111
- } = shareCredentialCardFromCredential(credential, invalid, Boolean(expanded), multipleCredentialsAvailable, request, selectedFields, config, testID, labels);
112
- return /*#__PURE__*/React.createElement(CredentialDetailsCardListItem, {
113
- attributes: attributes,
114
- card: {
115
- ...card,
116
- credentialId: request.id,
117
- onHeaderPress,
118
- width: cardWidth
119
- },
120
- expanded: expanded,
121
- footer: footer,
122
- lastItem: lastItem,
123
- onAttributeSelected: onSelectField,
124
- onImagePreview: onImagePreview,
125
- style: [styles.credential, {
126
- borderColor: colorScheme.background
127
- }, style],
128
- testID: testID
129
- });
130
- };
131
- const styles = StyleSheet.create({
132
- credential: {
133
- borderRadius: 10,
134
- borderWidth: 1,
135
- marginBottom: 8
136
- },
137
- notice: {
138
- marginBottom: 22,
139
- marginHorizontal: 12,
140
- padding: 12
141
- },
142
- noticeButton: {
143
- marginTop: 24,
144
- paddingVertical: 11
145
- }
146
- });
147
- //# sourceMappingURL=share-credential.js.map