@procivis/one-react-native-components 0.3.94 → 0.3.99

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 (263) hide show
  1. package/lib/commonjs/components/backup/preview-credentials.js.map +1 -1
  2. package/lib/commonjs/components/credential/credential.js.map +1 -1
  3. package/lib/commonjs/components/entity/EntityButtons.js.map +1 -1
  4. package/lib/commonjs/components/entity/entity-attributes.js.map +1 -1
  5. package/lib/commonjs/components/entity/entity-details-with-buttons.js +2 -2
  6. package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +1 -1
  7. package/lib/commonjs/components/entity/entity-details.js +3 -3
  8. package/lib/commonjs/components/entity/entity-details.js.map +1 -1
  9. package/lib/commonjs/components/history/history-details-screen.js +10 -10
  10. package/lib/commonjs/components/history/history-details-screen.js.map +1 -1
  11. package/lib/commonjs/components/history/history-list-item-icon.js +12 -8
  12. package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
  13. package/lib/commonjs/components/history/history-list-item.js.map +1 -1
  14. package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
  15. package/lib/commonjs/components/history/history-list-section-header.js +1 -1
  16. package/lib/commonjs/components/history/history-list-section-header.js.map +1 -1
  17. package/lib/commonjs/components/history/history-list.js.map +1 -1
  18. package/lib/commonjs/components/proof-request/share-credential-card-notice.js.map +1 -1
  19. package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -1
  20. package/lib/commonjs/components/proof-request/v1/share-credential.js +1 -1
  21. package/lib/commonjs/components/proof-request/v1/share-credential.js.map +1 -1
  22. package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -1
  23. package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js +2 -2
  24. package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  25. package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +2 -2
  26. package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
  27. package/lib/commonjs/ui-components/accessibility/accessibilityHistoryWrappers.js.map +1 -1
  28. package/lib/commonjs/ui-components/accessibility/locale/fi.json +1 -1
  29. package/lib/commonjs/ui-components/entity/entity-cluster.js.map +1 -1
  30. package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
  31. package/lib/commonjs/ui-components/history/history-section-header.js +1 -1
  32. package/lib/commonjs/ui-components/history/history-section-header.js.map +1 -1
  33. package/lib/commonjs/ui-components/history/history-section-list-item.js +1 -1
  34. package/lib/commonjs/ui-components/history/history-section-list-item.js.map +1 -1
  35. package/lib/commonjs/ui-components/icons/entity.js.map +1 -1
  36. package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
  37. package/lib/commonjs/ui-components/screens/section-list-screen.js.map +1 -1
  38. package/lib/commonjs/ui-components/settings/button-setting.js +3 -1
  39. package/lib/commonjs/ui-components/settings/button-setting.js.map +1 -1
  40. package/lib/commonjs/ui-components/settings/setting-item.js +4 -2
  41. package/lib/commonjs/ui-components/settings/setting-item.js.map +1 -1
  42. package/lib/commonjs/ui-components/settings/switch-setting.js +4 -2
  43. package/lib/commonjs/ui-components/settings/switch-setting.js.map +1 -1
  44. package/lib/commonjs/utils/date.js.map +1 -1
  45. package/lib/commonjs/utils/history.js +1 -41
  46. package/lib/commonjs/utils/history.js.map +1 -1
  47. package/lib/commonjs/utils/hooks/connectivity/connectivity.test.js.map +1 -1
  48. package/lib/commonjs/utils/hooks/core/backup.js +3 -3
  49. package/lib/commonjs/utils/hooks/core/backup.js.map +1 -1
  50. package/lib/commonjs/utils/hooks/core/cache.js +10 -10
  51. package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
  52. package/lib/commonjs/utils/hooks/core/core-context.js +5 -5
  53. package/lib/commonjs/utils/hooks/core/core-context.js.map +1 -1
  54. package/lib/commonjs/utils/hooks/core/credential-schemas.js.map +1 -1
  55. package/lib/commonjs/utils/hooks/core/credentials.js +3 -3
  56. package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
  57. package/lib/commonjs/utils/hooks/core/dids.js +1 -1
  58. package/lib/commonjs/utils/hooks/core/dids.js.map +1 -1
  59. package/lib/commonjs/utils/hooks/core/history.js +1 -1
  60. package/lib/commonjs/utils/hooks/core/history.js.map +1 -1
  61. package/lib/commonjs/utils/hooks/core/identifiers.js +3 -3
  62. package/lib/commonjs/utils/hooks/core/identifiers.js.map +1 -1
  63. package/lib/commonjs/utils/hooks/core/proof-schemas.js.map +1 -1
  64. package/lib/commonjs/utils/hooks/core/proofs.js +9 -9
  65. package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
  66. package/lib/commonjs/utils/hooks/core/trust-entity.js +5 -5
  67. package/lib/commonjs/utils/hooks/core/trust-entity.js.map +1 -1
  68. package/lib/commonjs/utils/hooks/core/wallet-unit.js +1 -1
  69. package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
  70. package/lib/commonjs/utils/hooks/navigation/open-settings.js.map +1 -1
  71. package/lib/commonjs/utils/hooks/revocation/credential-status.js +1 -1
  72. package/lib/commonjs/utils/hooks/revocation/credential-status.js.map +1 -1
  73. package/lib/commonjs/utils/parsers/credential-images.js +11 -10
  74. package/lib/commonjs/utils/parsers/credential-images.js.map +1 -1
  75. package/lib/commonjs/utils/parsers/credential-sharing-v2.js +14 -33
  76. package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
  77. package/lib/commonjs/utils/parsers/credential-sharing.js +4 -12
  78. package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
  79. package/lib/commonjs/utils/parsers/credential.js +31 -32
  80. package/lib/commonjs/utils/parsers/credential.js.map +1 -1
  81. package/lib/commonjs/utils/parsers/query.js.map +1 -1
  82. package/lib/commonjs/utils/url.js.map +1 -1
  83. package/lib/module/components/backup/preview-credentials.js.map +1 -1
  84. package/lib/module/components/credential/credential.js.map +1 -1
  85. package/lib/module/components/entity/EntityButtons.js.map +1 -1
  86. package/lib/module/components/entity/entity-attributes.js.map +1 -1
  87. package/lib/module/components/entity/entity-details-with-buttons.js +3 -3
  88. package/lib/module/components/entity/entity-details-with-buttons.js.map +1 -1
  89. package/lib/module/components/entity/entity-details.js +4 -4
  90. package/lib/module/components/entity/entity-details.js.map +1 -1
  91. package/lib/module/components/history/history-details-screen.js +11 -11
  92. package/lib/module/components/history/history-details-screen.js.map +1 -1
  93. package/lib/module/components/history/history-list-item-icon.js +13 -9
  94. package/lib/module/components/history/history-list-item-icon.js.map +1 -1
  95. package/lib/module/components/history/history-list-item.js.map +1 -1
  96. package/lib/module/components/history/history-list-screen.js.map +1 -1
  97. package/lib/module/components/history/history-list-section-header.js +1 -1
  98. package/lib/module/components/history/history-list-section-header.js.map +1 -1
  99. package/lib/module/components/history/history-list.js.map +1 -1
  100. package/lib/module/components/proof-request/share-credential-card-notice.js.map +1 -1
  101. package/lib/module/components/proof-request/v1/select-credential.js.map +1 -1
  102. package/lib/module/components/proof-request/v1/share-credential.js +2 -2
  103. package/lib/module/components/proof-request/v1/share-credential.js.map +1 -1
  104. package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -1
  105. package/lib/module/components/proof-request/v2/share-credential-v2-group.js +2 -2
  106. package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  107. package/lib/module/components/proof-request/v2/share-credential-v2.js +2 -2
  108. package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
  109. package/lib/module/ui-components/accessibility/accessibilityHistoryWrappers.js.map +1 -1
  110. package/lib/module/ui-components/accessibility/locale/fi.json +1 -1
  111. package/lib/module/ui-components/entity/entity-cluster.js.map +1 -1
  112. package/lib/module/ui-components/header/foldable-header.js.map +1 -1
  113. package/lib/module/ui-components/history/history-section-header.js +1 -1
  114. package/lib/module/ui-components/history/history-section-header.js.map +1 -1
  115. package/lib/module/ui-components/history/history-section-list-item.js +1 -1
  116. package/lib/module/ui-components/history/history-section-list-item.js.map +1 -1
  117. package/lib/module/ui-components/icons/entity.js.map +1 -1
  118. package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
  119. package/lib/module/ui-components/screens/section-list-screen.js.map +1 -1
  120. package/lib/module/ui-components/settings/button-setting.js +3 -1
  121. package/lib/module/ui-components/settings/button-setting.js.map +1 -1
  122. package/lib/module/ui-components/settings/setting-item.js +4 -2
  123. package/lib/module/ui-components/settings/setting-item.js.map +1 -1
  124. package/lib/module/ui-components/settings/switch-setting.js +4 -2
  125. package/lib/module/ui-components/settings/switch-setting.js.map +1 -1
  126. package/lib/module/utils/date.js.map +1 -1
  127. package/lib/module/utils/history.js +0 -38
  128. package/lib/module/utils/history.js.map +1 -1
  129. package/lib/module/utils/hooks/connectivity/connectivity.test.js.map +1 -1
  130. package/lib/module/utils/hooks/core/backup.js +4 -4
  131. package/lib/module/utils/hooks/core/backup.js.map +1 -1
  132. package/lib/module/utils/hooks/core/cache.js +11 -11
  133. package/lib/module/utils/hooks/core/cache.js.map +1 -1
  134. package/lib/module/utils/hooks/core/core-context.js +5 -5
  135. package/lib/module/utils/hooks/core/core-context.js.map +1 -1
  136. package/lib/module/utils/hooks/core/credential-schemas.js.map +1 -1
  137. package/lib/module/utils/hooks/core/credentials.js +4 -4
  138. package/lib/module/utils/hooks/core/credentials.js.map +1 -1
  139. package/lib/module/utils/hooks/core/dids.js +2 -2
  140. package/lib/module/utils/hooks/core/dids.js.map +1 -1
  141. package/lib/module/utils/hooks/core/history.js +1 -1
  142. package/lib/module/utils/hooks/core/history.js.map +1 -1
  143. package/lib/module/utils/hooks/core/identifiers.js +4 -4
  144. package/lib/module/utils/hooks/core/identifiers.js.map +1 -1
  145. package/lib/module/utils/hooks/core/proof-schemas.js.map +1 -1
  146. package/lib/module/utils/hooks/core/proofs.js +10 -10
  147. package/lib/module/utils/hooks/core/proofs.js.map +1 -1
  148. package/lib/module/utils/hooks/core/trust-entity.js +6 -6
  149. package/lib/module/utils/hooks/core/trust-entity.js.map +1 -1
  150. package/lib/module/utils/hooks/core/wallet-unit.js +2 -2
  151. package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
  152. package/lib/module/utils/hooks/navigation/open-settings.js.map +1 -1
  153. package/lib/module/utils/hooks/revocation/credential-status.js +2 -2
  154. package/lib/module/utils/hooks/revocation/credential-status.js.map +1 -1
  155. package/lib/module/utils/parsers/credential-images.js +12 -11
  156. package/lib/module/utils/parsers/credential-images.js.map +1 -1
  157. package/lib/module/utils/parsers/credential-sharing-v2.js +14 -33
  158. package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
  159. package/lib/module/utils/parsers/credential-sharing.js +4 -12
  160. package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
  161. package/lib/module/utils/parsers/credential.js +32 -33
  162. package/lib/module/utils/parsers/credential.js.map +1 -1
  163. package/lib/module/utils/parsers/query.js.map +1 -1
  164. package/lib/module/utils/url.js.map +1 -1
  165. package/lib/typescript/components/backup/preview-credentials.d.ts +2 -2
  166. package/lib/typescript/components/credential/credential.d.ts +2 -2
  167. package/lib/typescript/components/entity/EntityButtons.d.ts +2 -2
  168. package/lib/typescript/components/entity/entity-attributes.d.ts +2 -2
  169. package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +3 -3
  170. package/lib/typescript/components/entity/entity-details.d.ts +5 -5
  171. package/lib/typescript/components/history/history-details-screen.d.ts +2 -2
  172. package/lib/typescript/components/history/history-list-item-icon.d.ts +3 -3
  173. package/lib/typescript/components/history/history-list-item.d.ts +5 -5
  174. package/lib/typescript/components/history/history-list-screen.d.ts +4 -4
  175. package/lib/typescript/components/history/history-list.d.ts +5 -5
  176. package/lib/typescript/components/proof-request/v1/select-credential.d.ts +2 -2
  177. package/lib/typescript/components/proof-request/v1/share-credential.d.ts +6 -6
  178. package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +3 -3
  179. package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +4 -4
  180. package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +5 -5
  181. package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +2 -2
  182. package/lib/typescript/ui-components/settings/setting-item.d.ts +1 -0
  183. package/lib/typescript/utils/history.d.ts +3 -5
  184. package/lib/typescript/utils/hooks/core/backup.d.ts +3 -3
  185. package/lib/typescript/utils/hooks/core/cache.d.ts +2 -2
  186. package/lib/typescript/utils/hooks/core/core-context.d.ts +1 -1
  187. package/lib/typescript/utils/hooks/core/credential-schemas.d.ts +6 -6
  188. package/lib/typescript/utils/hooks/core/credentials.d.ts +8 -8
  189. package/lib/typescript/utils/hooks/core/dids.d.ts +2 -2
  190. package/lib/typescript/utils/hooks/core/history.d.ts +2 -2
  191. package/lib/typescript/utils/hooks/core/identifiers.d.ts +3 -3
  192. package/lib/typescript/utils/hooks/core/proof-schemas.d.ts +7 -7
  193. package/lib/typescript/utils/hooks/core/proofs.d.ts +9 -9
  194. package/lib/typescript/utils/hooks/core/trust-entity.d.ts +6 -6
  195. package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +5 -5
  196. package/lib/typescript/utils/parsers/credential-images.d.ts +2 -2
  197. package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +7 -7
  198. package/lib/typescript/utils/parsers/credential-sharing.d.ts +8 -9
  199. package/lib/typescript/utils/parsers/credential.d.ts +15 -35
  200. package/lib/typescript/utils/parsers/query.d.ts +8 -8
  201. package/package.json +6 -4
  202. package/src/components/backup/preview-credentials.tsx +2 -2
  203. package/src/components/credential/credential.tsx +2 -2
  204. package/src/components/entity/EntityButtons.tsx +2 -2
  205. package/src/components/entity/entity-attributes.tsx +4 -4
  206. package/src/components/entity/entity-details-with-buttons.tsx +11 -6
  207. package/src/components/entity/entity-details.tsx +17 -16
  208. package/src/components/history/history-details-screen.tsx +13 -16
  209. package/src/components/history/history-list-item-icon.tsx +19 -11
  210. package/src/components/history/history-list-item.tsx +9 -5
  211. package/src/components/history/history-list-screen.tsx +4 -4
  212. package/src/components/history/history-list-section-header.tsx +1 -1
  213. package/src/components/history/history-list.tsx +6 -6
  214. package/src/components/proof-request/share-credential-card-notice.tsx +1 -1
  215. package/src/components/proof-request/v1/select-credential.tsx +2 -2
  216. package/src/components/proof-request/v1/share-credential.tsx +13 -11
  217. package/src/components/proof-request/v2/select-credential-v2.tsx +6 -3
  218. package/src/components/proof-request/v2/share-credential-v2-group.tsx +12 -12
  219. package/src/components/proof-request/v2/share-credential-v2.tsx +11 -11
  220. package/src/ui-components/accessibility/accessibilityHistoryWrappers.tsx +4 -1
  221. package/src/ui-components/accessibility/locale/fi.json +1 -1
  222. package/src/ui-components/buttons/ghost-button.stories.tsx +0 -1
  223. package/src/ui-components/control/checkbox.stories.tsx +1 -1
  224. package/src/ui-components/control/switch.stories.tsx +1 -1
  225. package/src/ui-components/credential/card/credential-header.stories.tsx +0 -1
  226. package/src/ui-components/entity/entity-cluster.tsx +7 -6
  227. package/src/ui-components/header/foldable-header.tsx +8 -11
  228. package/src/ui-components/history/history-section-header.tsx +1 -1
  229. package/src/ui-components/history/history-section-list-item.tsx +1 -1
  230. package/src/ui-components/icons/entity.tsx +2 -2
  231. package/src/ui-components/pin/pin-code-screen.stories.tsx +1 -1
  232. package/src/ui-components/screens/image-preview-screen.stories.tsx +1 -1
  233. package/src/ui-components/screens/nerd-mode-screen.tsx +2 -2
  234. package/src/ui-components/screens/qr-code-scanner-screen.stories.tsx +1 -1
  235. package/src/ui-components/screens/section-list-screen.tsx +10 -1
  236. package/src/ui-components/searchbar/search-bar.stories.tsx +0 -1
  237. package/src/ui-components/settings/button-setting.tsx +2 -1
  238. package/src/ui-components/settings/setting-item.tsx +9 -2
  239. package/src/ui-components/settings/switch-setting.tsx +9 -2
  240. package/src/ui-components/text/typography.stories.tsx +2 -2
  241. package/src/utils/date.ts +2 -2
  242. package/src/utils/history.ts +4 -45
  243. package/src/utils/hooks/connectivity/connectivity.test.ts +2 -2
  244. package/src/utils/hooks/core/backup.ts +4 -4
  245. package/src/utils/hooks/core/cache.ts +13 -13
  246. package/src/utils/hooks/core/core-context.tsx +6 -6
  247. package/src/utils/hooks/core/credential-schemas.ts +7 -4
  248. package/src/utils/hooks/core/credentials.ts +21 -13
  249. package/src/utils/hooks/core/dids.ts +3 -3
  250. package/src/utils/hooks/core/history.ts +3 -3
  251. package/src/utils/hooks/core/identifiers.ts +9 -5
  252. package/src/utils/hooks/core/proof-schemas.ts +21 -16
  253. package/src/utils/hooks/core/proofs.ts +31 -27
  254. package/src/utils/hooks/core/trust-entity.ts +19 -12
  255. package/src/utils/hooks/core/wallet-unit.ts +21 -11
  256. package/src/utils/hooks/navigation/open-settings.ts +1 -1
  257. package/src/utils/hooks/revocation/credential-status.ts +2 -2
  258. package/src/utils/parsers/credential-images.tsx +19 -13
  259. package/src/utils/parsers/credential-sharing-v2.tsx +32 -48
  260. package/src/utils/parsers/credential-sharing.tsx +26 -36
  261. package/src/utils/parsers/credential.ts +64 -61
  262. package/src/utils/parsers/query.ts +16 -14
  263. package/src/utils/url.ts +1 -1
@@ -1,9 +1,9 @@
1
1
  import {
2
- Claim,
2
+ ClaimBindingDto,
3
3
  Config,
4
- CredentialDetail,
5
- PresentationDefinitionField,
6
- PresentationDefinitionRequestedCredential,
4
+ CredentialDetailBindingDto,
5
+ PresentationDefinitionFieldBindingDto,
6
+ PresentationDefinitionRequestedCredentialBindingDto,
7
7
  } from '@procivis/react-native-one-core';
8
8
  import React from 'react';
9
9
 
@@ -29,7 +29,7 @@ import {
29
29
  } from './credential';
30
30
 
31
31
  export const validityCheckedCardFromCredential = (
32
- credential: CredentialDetail,
32
+ credential: CredentialDetailBindingDto,
33
33
  invalidLVVC: boolean,
34
34
  expanded: boolean,
35
35
  multipleCredentialsAvailable: boolean,
@@ -73,7 +73,7 @@ export const validityCheckedCardFromCredential = (
73
73
  };
74
74
 
75
75
  export const missingCredentialCardFromRequest = (
76
- request: PresentationDefinitionRequestedCredential,
76
+ request: PresentationDefinitionRequestedCredentialBindingDto,
77
77
  notice: CredentialCardNotice | undefined,
78
78
  testID: string,
79
79
  labels: ShareCredentialCardLabels,
@@ -95,17 +95,17 @@ export const missingCredentialCardFromRequest = (
95
95
 
96
96
  interface DisplayedAttribute {
97
97
  claim?: FlatClaim;
98
- field?: PresentationDefinitionField;
98
+ field?: PresentationDefinitionFieldBindingDto;
99
99
  id: string;
100
100
  selected?: boolean;
101
101
  status: SelectorStatus;
102
102
  }
103
103
 
104
104
  const getAttributeSelectorStatus = (
105
- field: PresentationDefinitionField,
105
+ field: PresentationDefinitionFieldBindingDto,
106
106
  validityState: ValidityState,
107
- credential?: CredentialDetail,
108
- claim?: Claim,
107
+ credential?: CredentialDetailBindingDto,
108
+ claim?: ClaimBindingDto,
109
109
  selected?: boolean,
110
110
  ): SelectorStatus => {
111
111
  if (!credential || validityState !== ValidityState.Valid) {
@@ -124,28 +124,18 @@ const getAttributeSelectorStatus = (
124
124
  return selected ? SelectorStatus.SelectedCheckmark : SelectorStatus.Empty;
125
125
  };
126
126
 
127
- type ClaimWithOptionalPath = Claim & {
128
- path?: string;
129
- };
130
-
131
- type FlatClaim = Claim & {
132
- path: string;
127
+ type FlatClaim = ClaimBindingDto & {
133
128
  isArrayElement?: boolean;
134
129
  };
135
130
 
136
131
  // Returns a spread list of all claims with their full JSON path as key, including all intermediate objects
137
- const spreadClaims = (claims: ClaimWithOptionalPath[]): FlatClaim[] => {
138
- const claimsWithPath: FlatClaim[] = claims.map((c) => ({
139
- ...c,
140
- path: c.path ?? c.key,
141
- }));
142
- return claimsWithPath.reduce((acc, claim) => {
132
+ const spreadClaims = (claims: ClaimBindingDto[]): FlatClaim[] => {
133
+ return claims.reduce((acc, claim) => {
143
134
  const result = [claim];
144
- if (Array.isArray(claim.value)) {
145
- const nestedClaimsWithPath: FlatClaim[] = claim.value.map((c, i) => ({
135
+ if (claim.value.type_ === 'NESTED') {
136
+ const nestedClaimsWithPath: FlatClaim[] = claim.value.value.map((c) => ({
146
137
  ...c,
147
- path: claim.array ? `${c.key}/${i}` : c.key,
148
- isArrayElement: claim.array,
138
+ isArrayElement: claim.schema.array && claim.path.split('/').pop() !== claim.schema.key,
149
139
  }));
150
140
  result.push(...spreadClaims(nestedClaimsWithPath));
151
141
  }
@@ -154,9 +144,9 @@ const spreadClaims = (claims: ClaimWithOptionalPath[]): FlatClaim[] => {
154
144
  };
155
145
 
156
146
  const getDisplayedAttributes = (
157
- request: PresentationDefinitionRequestedCredential,
147
+ request: PresentationDefinitionRequestedCredentialBindingDto,
158
148
  validityState: ValidityState,
159
- credential?: CredentialDetail,
149
+ credential?: CredentialDetailBindingDto,
160
150
  selectiveDisclosureSupported?: boolean,
161
151
  selectedFields?: string[],
162
152
  ): DisplayedAttribute[] => {
@@ -189,8 +179,8 @@ const getDisplayedAttributes = (
189
179
  };
190
180
 
191
181
  const getFullyNestedFields = (
192
- fields: PresentationDefinitionRequestedCredential['fields'],
193
- credentialId: CredentialDetail['id'],
182
+ fields: PresentationDefinitionRequestedCredentialBindingDto['fields'],
183
+ credentialId: CredentialDetailBindingDto['id'],
194
184
  ) => {
195
185
  const allKeys = fields.filter((field) => credentialId in field.keyMap).map((field) => field.keyMap[credentialId]);
196
186
 
@@ -206,7 +196,7 @@ export const shareCredentialCardAttributeFromClaim = (
206
196
  testID: string,
207
197
  labels: ShareCredentialCardLabels,
208
198
  claim?: FlatClaim,
209
- field?: PresentationDefinitionField,
199
+ field?: PresentationDefinitionFieldBindingDto,
210
200
  ): CredentialAttribute => {
211
201
  if (claim) {
212
202
  return {
@@ -267,11 +257,11 @@ export type ShareCredentialCardLabels = CardLabels & {
267
257
  };
268
258
 
269
259
  export const shareCredentialCardFromCredential = (
270
- credential: CredentialDetail | undefined,
260
+ credential: CredentialDetailBindingDto | undefined,
271
261
  invalidLVVC: boolean,
272
262
  expanded: boolean,
273
263
  multipleCredentialsAvailable: boolean,
274
- request: PresentationDefinitionRequestedCredential,
264
+ request: PresentationDefinitionRequestedCredentialBindingDto,
275
265
  selectedFields: string[] | undefined,
276
266
  config: Config,
277
267
  testID: string,
@@ -339,7 +329,7 @@ export const selectCredentialCardAttributeFromClaim = (
339
329
  testID: string,
340
330
  labels: ShareCredentialCardLabels,
341
331
  claim?: FlatClaim,
342
- field?: PresentationDefinitionField,
332
+ field?: PresentationDefinitionFieldBindingDto,
343
333
  ): CredentialAttribute => {
344
334
  const attribute = shareCredentialCardAttributeFromClaim(id, config, testID, labels, claim, field);
345
335
  if (!claim) {
@@ -352,9 +342,9 @@ export const selectCredentialCardAttributeFromClaim = (
352
342
  };
353
343
 
354
344
  export const selectCredentialCardFromCredential = (
355
- credential: CredentialDetail,
345
+ credential: CredentialDetailBindingDto,
356
346
  selected: boolean,
357
- request: PresentationDefinitionRequestedCredential,
347
+ request: PresentationDefinitionRequestedCredentialBindingDto,
358
348
  config: Config,
359
349
  testID: string,
360
350
  labels: ShareCredentialCardLabels,
@@ -1,10 +1,10 @@
1
1
  import {
2
- Claim,
2
+ ClaimBindingDto,
3
3
  Config,
4
- CredentialDetail,
5
- CredentialListItem,
6
- CredentialSchema,
7
- CredentialStateEnum,
4
+ CredentialDetailBindingDto,
5
+ CredentialListItemBindingDto,
6
+ CredentialSchemaDetailBindingDto,
7
+ CredentialStateBindingEnum,
8
8
  DataTypeEnum,
9
9
  FormatFeatureEnum,
10
10
  } from '@procivis/react-native-one-core';
@@ -30,50 +30,52 @@ export enum ValidityState {
30
30
  Valid = 'valid',
31
31
  }
32
32
 
33
- export const getValidityState = (credential: CredentialListItem | undefined) => {
34
- if (credential?.state === CredentialStateEnum.REVOKED) {
33
+ export const getValidityState = (credential: CredentialListItemBindingDto | undefined) => {
34
+ if (credential?.state === CredentialStateBindingEnum.REVOKED) {
35
35
  return ValidityState.Revoked;
36
36
  }
37
- if (credential?.state === CredentialStateEnum.SUSPENDED) {
37
+ if (credential?.state === CredentialStateBindingEnum.SUSPENDED) {
38
38
  return ValidityState.Suspended;
39
39
  }
40
40
  return ValidityState.Valid;
41
41
  };
42
42
 
43
- export const supportsSelectiveDisclosure = (credential: CredentialListItem | undefined, config: Config | undefined) => {
43
+ export const supportsSelectiveDisclosure = (
44
+ credential: CredentialListItemBindingDto | undefined,
45
+ config: Config | undefined,
46
+ ) => {
44
47
  const formatConfig = credential && config?.format[credential.schema.format];
45
48
  return formatConfig
46
49
  ? Boolean(formatConfig.capabilities?.features?.includes(FormatFeatureEnum.SelectiveDisclosure))
47
50
  : undefined;
48
51
  };
49
52
 
50
- const findClaimByPathParts = (path: string[], claims?: Claim[]): Claim | undefined => {
51
- if (!claims?.length) {
53
+ export const findClaimByPath = (path: string | undefined, claims: ClaimBindingDto[]): ClaimBindingDto | undefined => {
54
+ if (!path) {
52
55
  return undefined;
53
56
  }
54
- const [first, second, ...rest] = path;
55
- const claim = claims.find((c) => c.key === first);
56
- if (claim === undefined || second === undefined || claim.dataType !== DataTypeEnum.Object) {
57
- return claim;
57
+
58
+ const exactClaim = claims.find((claim) => claim.path === path);
59
+ if (exactClaim) {
60
+ return exactClaim;
58
61
  }
59
62
 
60
- return findClaimByPathParts([`${first}/${second}`, ...rest], claim.value as Claim[]);
61
- };
63
+ const parentClaim = claims.find((claim) => path.startsWith(`${claim.path}/`));
64
+ if (parentClaim && parentClaim.value.type_ === 'NESTED') {
65
+ return findClaimByPath(path, parentClaim.value.value);
66
+ }
62
67
 
63
- export const findClaimByPath = (path: string | undefined, claims: Claim[] | undefined) =>
64
- path ? findClaimByPathParts(path.split('/'), claims) : undefined;
68
+ return undefined;
69
+ };
65
70
 
66
- const formatCredentialDetail = (claim: Claim, config: Config, testID: string): string => {
71
+ const formatCredentialDetail = (claim: ClaimBindingDto, config: Config, testID: string): string => {
67
72
  const attributeValue = detailsCardAttributeValueFromClaim(claim, config, testID);
68
73
  return attributeValue.value ?? '';
69
74
  };
70
75
 
71
- export const hasMsoValidityIssues = (credential: CredentialDetail): boolean => {
72
- const mdocMsoValidity: { nextUpdate: string } | undefined =
73
- 'mdocMsoValidity' in credential ? (credential.mdocMsoValidity as { nextUpdate: string }) : undefined;
74
-
76
+ export const hasMsoValidityIssues = (credential: CredentialDetailBindingDto): boolean => {
75
77
  const mdocMsoValidityIssue = Boolean(
76
- mdocMsoValidity?.nextUpdate && new Date(mdocMsoValidity.nextUpdate) < new Date(),
78
+ credential.mdocMsoValidity?.nextUpdate && new Date(credential.mdocMsoValidity.nextUpdate) < new Date(),
77
79
  );
78
80
 
79
81
  return mdocMsoValidityIssue;
@@ -87,8 +89,8 @@ export type CardHeaderLabels = {
87
89
  };
88
90
 
89
91
  const credentialDetailFromCredential = (
90
- credential: CredentialDetail,
91
- claims: Claim[] = [],
92
+ credential: CredentialDetailBindingDto,
93
+ claims: ClaimBindingDto[] = [],
92
94
  config: Config,
93
95
  testID: string,
94
96
  labels: CardHeaderLabels,
@@ -102,7 +104,7 @@ const credentialDetailFromCredential = (
102
104
  const { layoutProperties } = credential.schema;
103
105
 
104
106
  switch (credential.state) {
105
- case CredentialStateEnum.SUSPENDED:
107
+ case CredentialStateBindingEnum.SUSPENDED:
106
108
  return {
107
109
  credentialDetailPrimary: credential.suspendEndDate
108
110
  ? labels.suspendedUntil(formatDateTimeLocalized(new Date(credential.suspendEndDate))!)
@@ -110,7 +112,7 @@ const credentialDetailFromCredential = (
110
112
  credentialDetailTestID: concatTestID(testID, 'suspended'),
111
113
  statusIcon: CredentialWarningIcon,
112
114
  };
113
- case CredentialStateEnum.REVOKED:
115
+ case CredentialStateBindingEnum.REVOKED:
114
116
  return {
115
117
  credentialDetailPrimary: labels.revoked,
116
118
  credentialDetailErrorColor: true,
@@ -151,8 +153,8 @@ const credentialDetailFromCredential = (
151
153
  };
152
154
 
153
155
  export const cardHeaderFromCredential = (
154
- credential: CredentialDetail,
155
- claims: Claim[] = [],
156
+ credential: CredentialDetailBindingDto,
157
+ claims: ClaimBindingDto[] = [],
156
158
  config: Config,
157
159
  testID: string,
158
160
  labels: CardHeaderLabels,
@@ -191,8 +193,8 @@ export type CardLabels = CardHeaderLabels & {
191
193
  };
192
194
 
193
195
  export const getCredentialCardPropsFromCredential = (
194
- credential: CredentialDetail,
195
- claims: Claim[] = [],
196
+ credential: CredentialDetailBindingDto,
197
+ claims: ClaimBindingDto[] = [],
196
198
  config: Config,
197
199
  notice: CredentialCardNotice | undefined,
198
200
  testID: string,
@@ -221,50 +223,51 @@ export const getCredentialCardPropsFromCredential = (
221
223
  return result;
222
224
  };
223
225
 
224
- export const detailsCardAttributeFromClaim = (claim: Claim, config: Config, testID: string): CredentialAttribute => {
226
+ export const detailsCardAttributeFromClaim = (
227
+ claim: ClaimBindingDto,
228
+ config: Config,
229
+ testID: string,
230
+ ): CredentialAttribute => {
225
231
  const value = detailsCardAttributeValueFromClaim(claim, config, testID);
226
232
  return {
227
- id: claim.id,
228
- name: claim.key.split('/').pop(),
229
- path: claim.key,
233
+ id: claim.path,
234
+ name: claim.path.split('/').pop(),
235
+ path: claim.path,
230
236
  ...value,
231
237
  };
232
238
  };
233
239
 
234
- const detailsCardAttributeValueFromClaim = (claim: Claim, config: Config, testID: string): CredentialAttributeValue => {
235
- const typeConfig = config?.datatype[claim.dataType];
240
+ const detailsCardAttributeValueFromClaim = (
241
+ claim: ClaimBindingDto,
242
+ config: Config,
243
+ testID: string,
244
+ ): CredentialAttributeValue => {
245
+ const typeConfig = config?.datatype[claim.schema.datatype];
236
246
 
237
- if (claim.array) {
247
+ if (claim.schema.array) {
238
248
  return {
239
- values: (claim.value || []).map((arrayValue, index) => {
240
- return detailsCardAttributeFromClaim(
241
- {
242
- ...arrayValue,
243
- id: `${arrayValue.id}/${index}`,
244
- },
245
- config,
246
- concatTestID(testID, index.toString()),
247
- );
249
+ values: ((claim.value.value as ClaimBindingDto[]) || []).map((arrayValue, index) => {
250
+ return detailsCardAttributeFromClaim(arrayValue, config, concatTestID(testID, index.toString()));
248
251
  }),
249
252
  };
250
253
  } else {
251
254
  switch (typeConfig?.type) {
252
255
  case DataTypeEnum.Object: {
253
- if (!Array.isArray(claim.value)) {
256
+ if (claim.value.type_ !== 'NESTED') {
254
257
  return { attributes: [] };
255
258
  }
256
259
  return {
257
- attributes: (claim.value as Claim[]).map((nestedClaim, index) =>
260
+ attributes: claim.value.value.map((nestedClaim, index) =>
258
261
  detailsCardAttributeFromClaim(nestedClaim, config, concatTestID(testID, index.toString())),
259
262
  ),
260
263
  };
261
264
  }
262
265
  case DataTypeEnum.Date: {
263
- if (!claim.value) {
266
+ if (!claim.value.value) {
264
267
  // Don't try to parse empty values (which will return "Invalid Date")
265
- return { testID: testID, value: String(claim.value) };
268
+ return { testID: testID, value: String(claim.value.value) };
266
269
  }
267
- const date = claim.value as string;
270
+ const date = claim.value.value as string;
268
271
  return {
269
272
  testID: testID,
270
273
  value: formatDateLocalized(new Date(date)) ?? date,
@@ -273,13 +276,13 @@ const detailsCardAttributeValueFromClaim = (claim: Claim, config: Config, testID
273
276
  case DataTypeEnum.Picture: // fallback
274
277
  case DataTypeEnum.SwiyuPicture: {
275
278
  if (typeConfig.params?.showAs === 'IMAGE') {
276
- return { image: { uri: claim.value as string }, testID: testID };
279
+ return { image: { uri: claim.value.value as string }, testID: testID };
277
280
  } else {
278
- return { testID: testID, value: claim.value as string };
281
+ return { testID: testID, value: claim.value.value as string };
279
282
  }
280
283
  }
281
284
  default:
282
- return { testID: testID, value: String(claim.value) };
285
+ return { testID: testID, value: String(claim.value.value) };
283
286
  }
284
287
  }
285
288
  };
@@ -289,7 +292,7 @@ export type CredentialDetailsCardPropsWithoutWidth = Omit<CredentialDetailsCardP
289
292
  };
290
293
 
291
294
  export const detailsCardFromCredential = (
292
- credential: CredentialDetail,
295
+ credential: CredentialDetailBindingDto,
293
296
  config: Config,
294
297
  testID: string,
295
298
  labels: CardLabels,
@@ -298,8 +301,8 @@ export const detailsCardFromCredential = (
298
301
  };
299
302
 
300
303
  export const detailsCardFromCredentialWithClaims = (
301
- credential: CredentialDetail,
302
- claims: Claim[],
304
+ credential: CredentialDetailBindingDto,
305
+ claims: ClaimBindingDto[],
303
306
  config: Config,
304
307
  testID: string,
305
308
  labels: CardLabels,
@@ -399,7 +402,7 @@ function parseBase64Image(image: string | undefined) {
399
402
  return image ? '__BASE64IMAGE__' : '';
400
403
  }
401
404
 
402
- export function getCredentialSchemaWithoutImages(credentialSchema: CredentialSchema) {
405
+ export function getCredentialSchemaWithoutImages(credentialSchema: CredentialSchemaDetailBindingDto) {
403
406
  return {
404
407
  ...credentialSchema,
405
408
  layoutProperties: {
@@ -1,11 +1,11 @@
1
1
  import {
2
- CredentialListQuery,
3
- CredentialSchemaListQuery,
4
- DidListQuery,
5
- HistoryListQuery,
6
- IdentifierListQuery,
7
- ProofListQuery,
8
- ProofSchemaListQuery,
2
+ CredentialListQueryBindingDto,
3
+ CredentialSchemaListQueryBindingDto,
4
+ DidListQueryBindingDto,
5
+ HistoryListQueryBindingDto,
6
+ IdentifierListQueryBindingDto,
7
+ ListProofSchemasFiltersBindingDto,
8
+ ProofListQueryBindingDto,
9
9
  } from '@procivis/react-native-one-core';
10
10
 
11
11
  type QueryKey<ListQuery, ParamList> = ParamList extends ReadonlyArray<keyof ListQuery> // all params are inside the ListQuery
@@ -22,7 +22,7 @@ function getQueryKey<ListQuery extends {}, ParamList extends ReadonlyArray<keyof
22
22
  return params.map((param) => queryParams[param]) as QueryKey<ListQuery, ParamList>;
23
23
  }
24
24
 
25
- export const getQueryKeyFromCredentialListQueryParams = (queryParams: Partial<CredentialListQuery> = {}) => {
25
+ export const getQueryKeyFromCredentialListQueryParams = (queryParams: Partial<CredentialListQueryBindingDto> = {}) => {
26
26
  return getQueryKey(queryParams, [
27
27
  'page',
28
28
  'pageSize',
@@ -50,7 +50,7 @@ export const getQueryKeyFromCredentialListQueryParams = (queryParams: Partial<Cr
50
50
  ]);
51
51
  };
52
52
 
53
- export const getQueryKeyFromHistoryListQueryParams = (queryParams: Partial<HistoryListQuery> = {}) => {
53
+ export const getQueryKeyFromHistoryListQueryParams = (queryParams: Partial<HistoryListQueryBindingDto> = {}) => {
54
54
  return getQueryKey(queryParams, [
55
55
  'page',
56
56
  'pageSize',
@@ -70,7 +70,7 @@ export const getQueryKeyFromHistoryListQueryParams = (queryParams: Partial<Histo
70
70
  };
71
71
 
72
72
  export const getQueryKeyFromCredentialSchemaListQueryParams = (
73
- queryParams: Partial<CredentialSchemaListQuery> = {},
73
+ queryParams: Partial<CredentialSchemaListQueryBindingDto> = {},
74
74
  ) => {
75
75
  return getQueryKey(queryParams, [
76
76
  'page',
@@ -91,7 +91,9 @@ export const getQueryKeyFromCredentialSchemaListQueryParams = (
91
91
  ]);
92
92
  };
93
93
 
94
- export const getQueryKeyFromProofSchemaListQueryParams = (queryParams: Partial<ProofSchemaListQuery> = {}) => {
94
+ export const getQueryKeyFromProofSchemaListQueryParams = (
95
+ queryParams: Partial<ListProofSchemasFiltersBindingDto> = {},
96
+ ) => {
95
97
  return getQueryKey(queryParams, [
96
98
  'page',
97
99
  'pageSize',
@@ -109,7 +111,7 @@ export const getQueryKeyFromProofSchemaListQueryParams = (queryParams: Partial<P
109
111
  ]);
110
112
  };
111
113
 
112
- export const getQueryKeyFromProofListQueryParams = (queryParams: Partial<ProofListQuery> = {}) => {
114
+ export const getQueryKeyFromProofListQueryParams = (queryParams: Partial<ProofListQueryBindingDto> = {}) => {
113
115
  return getQueryKey(queryParams, [
114
116
  'page',
115
117
  'pageSize',
@@ -134,7 +136,7 @@ export const getQueryKeyFromProofListQueryParams = (queryParams: Partial<ProofLi
134
136
  ]);
135
137
  };
136
138
 
137
- export const getQueryKeyFromDidListQueryParams = (queryParams: Partial<DidListQuery> = {}) => {
139
+ export const getQueryKeyFromDidListQueryParams = (queryParams: Partial<DidListQueryBindingDto> = {}) => {
138
140
  return getQueryKey(queryParams, [
139
141
  'page',
140
142
  'pageSize',
@@ -154,7 +156,7 @@ export const getQueryKeyFromDidListQueryParams = (queryParams: Partial<DidListQu
154
156
  ]);
155
157
  };
156
158
 
157
- export const getQueryKeyFromIdentifierListQueryParams = (queryParams: Partial<IdentifierListQuery> = {}) => {
159
+ export const getQueryKeyFromIdentifierListQueryParams = (queryParams: Partial<IdentifierListQueryBindingDto> = {}) => {
158
160
  return getQueryKey(queryParams, [
159
161
  'page',
160
162
  'pageSize',
package/src/utils/url.ts CHANGED
@@ -58,4 +58,4 @@ export const shareUrl = async (url: string, title?: string) => {
58
58
  } else {
59
59
  await Share.open({ url, failOnCancel: false });
60
60
  }
61
- };
61
+ };