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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/lib/commonjs/components/credential/credential.js +2 -1
  2. package/lib/commonjs/components/credential/credential.js.map +1 -1
  3. package/lib/commonjs/components/history/history-list-item-icon.js +2 -3
  4. package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
  5. package/lib/commonjs/components/history/history-list-item.js +2 -8
  6. package/lib/commonjs/components/history/history-list-item.js.map +1 -1
  7. package/lib/commonjs/components/history/history-list-screen.js +1 -1
  8. package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
  9. package/lib/commonjs/components/index.js +0 -11
  10. package/lib/commonjs/components/index.js.map +1 -1
  11. package/lib/commonjs/components/proof-request/v1/select-credential.js +2 -1
  12. package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -1
  13. package/lib/commonjs/components/proof-request/v1/share-credential.js +2 -1
  14. package/lib/commonjs/components/proof-request/v1/share-credential.js.map +1 -1
  15. package/lib/commonjs/components/proof-request/v2/select-credential-v2.js +2 -1
  16. package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -1
  17. package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js +3 -1
  18. package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  19. package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +4 -2
  20. package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
  21. package/lib/commonjs/ui-components/credential/card/credential-details-card.js +3 -1
  22. package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
  23. package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
  24. package/lib/commonjs/ui-components/header/header.js.map +1 -1
  25. package/lib/commonjs/ui-components/history/history-details.js +2 -2
  26. package/lib/commonjs/ui-components/history/history-details.js.map +1 -1
  27. package/lib/commonjs/ui-components/icons/contact.js.map +1 -1
  28. package/lib/commonjs/ui-components/icons/credential.js +3 -3
  29. package/lib/commonjs/ui-components/icons/credential.js.map +1 -1
  30. package/lib/commonjs/ui-components/icons/icons.js +20 -1
  31. package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
  32. package/lib/commonjs/ui-components/loader/loading-result.js +2 -0
  33. package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
  34. package/lib/commonjs/ui-components/screens/nerd-mode-screen.js +7 -33
  35. package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
  36. package/lib/commonjs/utils/date.js +4 -5
  37. package/lib/commonjs/utils/date.js.map +1 -1
  38. package/lib/commonjs/utils/hooks/core/cache.js +7 -4
  39. package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
  40. package/lib/commonjs/utils/hooks/core/core-config.js +1 -6
  41. package/lib/commonjs/utils/hooks/core/core-config.js.map +1 -1
  42. package/lib/commonjs/utils/hooks/core/core-context.js +0 -15
  43. package/lib/commonjs/utils/hooks/core/core-context.js.map +1 -1
  44. package/lib/commonjs/utils/hooks/core/credentials.js +15 -1
  45. package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
  46. package/lib/commonjs/utils/hooks/core/index.js +0 -11
  47. package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
  48. package/lib/commonjs/utils/hooks/core/trust-list.js +19 -3
  49. package/lib/commonjs/utils/hooks/core/trust-list.js.map +1 -1
  50. package/lib/commonjs/utils/hooks/core/verifier-instance.js +22 -3
  51. package/lib/commonjs/utils/hooks/core/verifier-instance.js.map +1 -1
  52. package/lib/commonjs/utils/hooks/core/wallet-unit.js +2 -2
  53. package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
  54. package/lib/commonjs/utils/parsers/credential-sharing-v2.js +14 -14
  55. package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
  56. package/lib/commonjs/utils/parsers/credential-sharing.js +20 -18
  57. package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
  58. package/lib/commonjs/utils/parsers/credential.js +36 -22
  59. package/lib/commonjs/utils/parsers/credential.js.map +1 -1
  60. package/lib/commonjs/utils/parsers/query.js +1 -1
  61. package/lib/commonjs/utils/parsers/query.js.map +1 -1
  62. package/lib/commonjs/utils/translations.js +15 -0
  63. package/lib/commonjs/utils/translations.js.map +1 -0
  64. package/lib/module/components/credential/credential.js +2 -1
  65. package/lib/module/components/credential/credential.js.map +1 -1
  66. package/lib/module/components/history/history-list-item-icon.js +2 -3
  67. package/lib/module/components/history/history-list-item-icon.js.map +1 -1
  68. package/lib/module/components/history/history-list-item.js +3 -9
  69. package/lib/module/components/history/history-list-item.js.map +1 -1
  70. package/lib/module/components/history/history-list-screen.js +1 -1
  71. package/lib/module/components/history/history-list-screen.js.map +1 -1
  72. package/lib/module/components/index.js +0 -1
  73. package/lib/module/components/index.js.map +1 -1
  74. package/lib/module/components/proof-request/v1/select-credential.js +2 -1
  75. package/lib/module/components/proof-request/v1/select-credential.js.map +1 -1
  76. package/lib/module/components/proof-request/v1/share-credential.js +2 -1
  77. package/lib/module/components/proof-request/v1/share-credential.js.map +1 -1
  78. package/lib/module/components/proof-request/v2/select-credential-v2.js +2 -1
  79. package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -1
  80. package/lib/module/components/proof-request/v2/share-credential-v2-group.js +3 -1
  81. package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  82. package/lib/module/components/proof-request/v2/share-credential-v2.js +4 -2
  83. package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
  84. package/lib/module/ui-components/credential/card/credential-details-card.js +3 -1
  85. package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
  86. package/lib/module/ui-components/header/foldable-header.js.map +1 -1
  87. package/lib/module/ui-components/header/header.js.map +1 -1
  88. package/lib/module/ui-components/history/history-details.js +3 -3
  89. package/lib/module/ui-components/history/history-details.js.map +1 -1
  90. package/lib/module/ui-components/icons/contact.js.map +1 -1
  91. package/lib/module/ui-components/icons/credential.js +1 -1
  92. package/lib/module/ui-components/icons/credential.js.map +1 -1
  93. package/lib/module/ui-components/icons/icons.js +18 -0
  94. package/lib/module/ui-components/icons/icons.js.map +1 -1
  95. package/lib/module/ui-components/loader/loading-result.js +2 -0
  96. package/lib/module/ui-components/loader/loading-result.js.map +1 -1
  97. package/lib/module/ui-components/screens/nerd-mode-screen.js +7 -33
  98. package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
  99. package/lib/module/utils/date.js +4 -5
  100. package/lib/module/utils/date.js.map +1 -1
  101. package/lib/module/utils/hooks/core/cache.js +7 -4
  102. package/lib/module/utils/hooks/core/cache.js.map +1 -1
  103. package/lib/module/utils/hooks/core/core-config.js +0 -4
  104. package/lib/module/utils/hooks/core/core-config.js.map +1 -1
  105. package/lib/module/utils/hooks/core/core-context.js +0 -15
  106. package/lib/module/utils/hooks/core/core-context.js.map +1 -1
  107. package/lib/module/utils/hooks/core/credentials.js +13 -0
  108. package/lib/module/utils/hooks/core/credentials.js.map +1 -1
  109. package/lib/module/utils/hooks/core/index.js +0 -1
  110. package/lib/module/utils/hooks/core/index.js.map +1 -1
  111. package/lib/module/utils/hooks/core/trust-list.js +20 -4
  112. package/lib/module/utils/hooks/core/trust-list.js.map +1 -1
  113. package/lib/module/utils/hooks/core/verifier-instance.js +20 -2
  114. package/lib/module/utils/hooks/core/verifier-instance.js.map +1 -1
  115. package/lib/module/utils/hooks/core/wallet-unit.js +2 -2
  116. package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
  117. package/lib/module/utils/parsers/credential-sharing-v2.js +15 -15
  118. package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
  119. package/lib/module/utils/parsers/credential-sharing.js +20 -18
  120. package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
  121. package/lib/module/utils/parsers/credential.js +37 -23
  122. package/lib/module/utils/parsers/credential.js.map +1 -1
  123. package/lib/module/utils/parsers/query.js +1 -1
  124. package/lib/module/utils/parsers/query.js.map +1 -1
  125. package/lib/module/utils/translations.js +8 -0
  126. package/lib/module/utils/translations.js.map +1 -0
  127. package/lib/typescript/components/credential/credential.d.ts +1 -0
  128. package/lib/typescript/components/history/history-list-item.d.ts +1 -1
  129. package/lib/typescript/components/index.d.ts +0 -1
  130. package/lib/typescript/components/proof-request/v1/select-credential.d.ts +1 -0
  131. package/lib/typescript/components/proof-request/v1/share-credential.d.ts +1 -0
  132. package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +1 -0
  133. package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +1 -0
  134. package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +1 -0
  135. package/lib/typescript/ui-components/history/history-details.d.ts +2 -2
  136. package/lib/typescript/ui-components/icons/credential.d.ts +1 -1
  137. package/lib/typescript/ui-components/icons/icons.d.ts +1 -0
  138. package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +0 -12
  139. package/lib/typescript/utils/hooks/core/core-config.d.ts +0 -1
  140. package/lib/typescript/utils/hooks/core/core-context.d.ts +0 -1
  141. package/lib/typescript/utils/hooks/core/credentials.d.ts +2 -1
  142. package/lib/typescript/utils/hooks/core/index.d.ts +0 -1
  143. package/lib/typescript/utils/hooks/core/trust-list.d.ts +1 -4
  144. package/lib/typescript/utils/hooks/core/verifier-instance.d.ts +2 -0
  145. package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +2 -2
  146. package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +3 -3
  147. package/lib/typescript/utils/parsers/credential-sharing.d.ts +6 -6
  148. package/lib/typescript/utils/parsers/credential.d.ts +5 -5
  149. package/lib/typescript/utils/parsers/query.d.ts +1 -1
  150. package/lib/typescript/utils/translations.d.ts +1 -0
  151. package/package.json +3 -3
  152. package/src/components/credential/credential.tsx +3 -0
  153. package/src/components/history/history-list-item-icon.tsx +1 -2
  154. package/src/components/history/history-list-item.tsx +4 -9
  155. package/src/components/history/history-list-screen.tsx +1 -1
  156. package/src/components/index.ts +0 -1
  157. package/src/components/proof-request/v1/select-credential.tsx +3 -1
  158. package/src/components/proof-request/v1/share-credential.tsx +3 -0
  159. package/src/components/proof-request/v2/select-credential-v2.tsx +3 -1
  160. package/src/components/proof-request/v2/share-credential-v2-group.tsx +4 -0
  161. package/src/components/proof-request/v2/share-credential-v2.tsx +5 -0
  162. package/src/ui-components/credential/card/credential-details-card.tsx +3 -2
  163. package/src/ui-components/header/foldable-header.tsx +10 -9
  164. package/src/ui-components/header/header.tsx +10 -1
  165. package/src/ui-components/history/history-details.tsx +4 -4
  166. package/src/ui-components/icons/contact.tsx +1 -1
  167. package/src/ui-components/icons/credential.tsx +1 -1
  168. package/src/ui-components/icons/icons.tsx +18 -0
  169. package/src/ui-components/loader/loading-result.tsx +7 -1
  170. package/src/ui-components/screens/nerd-mode-screen.tsx +2 -52
  171. package/src/utils/date.ts +7 -14
  172. package/src/utils/hooks/core/cache.ts +10 -3
  173. package/src/utils/hooks/core/core-config.ts +1 -6
  174. package/src/utils/hooks/core/core-context.tsx +0 -24
  175. package/src/utils/hooks/core/credentials.ts +13 -0
  176. package/src/utils/hooks/core/index.ts +0 -1
  177. package/src/utils/hooks/core/trust-list.ts +22 -11
  178. package/src/utils/hooks/core/verifier-instance.ts +23 -2
  179. package/src/utils/hooks/core/wallet-unit.ts +3 -3
  180. package/src/utils/parsers/credential-sharing-v2.tsx +29 -12
  181. package/src/utils/parsers/credential-sharing.tsx +33 -16
  182. package/src/utils/parsers/credential.ts +45 -14
  183. package/src/utils/parsers/query.ts +3 -0
  184. package/src/utils/translations.ts +10 -0
  185. package/lib/commonjs/components/entity/EntityButtons.js +0 -64
  186. package/lib/commonjs/components/entity/EntityButtons.js.map +0 -1
  187. package/lib/commonjs/components/entity/entity-attributes.js +0 -65
  188. package/lib/commonjs/components/entity/entity-attributes.js.map +0 -1
  189. package/lib/commonjs/components/entity/entity-details-with-buttons.js +0 -67
  190. package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +0 -1
  191. package/lib/commonjs/components/entity/entity-details.js +0 -101
  192. package/lib/commonjs/components/entity/entity-details.js.map +0 -1
  193. package/lib/commonjs/components/entity/index.js +0 -14
  194. package/lib/commonjs/components/entity/index.js.map +0 -1
  195. package/lib/commonjs/utils/hooks/core/trust-entity.js +0 -147
  196. package/lib/commonjs/utils/hooks/core/trust-entity.js.map +0 -1
  197. package/lib/module/components/entity/EntityButtons.js +0 -56
  198. package/lib/module/components/entity/EntityButtons.js.map +0 -1
  199. package/lib/module/components/entity/entity-attributes.js +0 -57
  200. package/lib/module/components/entity/entity-attributes.js.map +0 -1
  201. package/lib/module/components/entity/entity-details-with-buttons.js +0 -58
  202. package/lib/module/components/entity/entity-details-with-buttons.js.map +0 -1
  203. package/lib/module/components/entity/entity-details.js +0 -92
  204. package/lib/module/components/entity/entity-details.js.map +0 -1
  205. package/lib/module/components/entity/index.js +0 -3
  206. package/lib/module/components/entity/index.js.map +0 -1
  207. package/lib/module/utils/hooks/core/trust-entity.js +0 -136
  208. package/lib/module/utils/hooks/core/trust-entity.js.map +0 -1
  209. package/lib/typescript/components/entity/EntityButtons.d.ts +0 -14
  210. package/lib/typescript/components/entity/entity-attributes.d.ts +0 -15
  211. package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +0 -18
  212. package/lib/typescript/components/entity/entity-details.d.ts +0 -21
  213. package/lib/typescript/components/entity/index.d.ts +0 -3
  214. package/lib/typescript/utils/hooks/core/trust-entity.d.ts +0 -17
  215. package/src/components/entity/EntityButtons.tsx +0 -79
  216. package/src/components/entity/entity-attributes.tsx +0 -80
  217. package/src/components/entity/entity-details-with-buttons.tsx +0 -75
  218. package/src/components/entity/entity-details.tsx +0 -145
  219. package/src/components/entity/index.ts +0 -4
  220. package/src/utils/hooks/core/trust-entity.ts +0 -172
@@ -1,29 +1,40 @@
1
- import { HolderWalletUnit } from '@procivis/react-native-one-core';
2
- import { useMutation } from 'react-query';
1
+ import { useMutation, useQueryClient } from 'react-query';
3
2
 
4
3
  import { reportException } from '../../reporting';
5
4
  import { useONECore } from './core-context';
5
+ import { VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY } from './verifier-instance';
6
+ import { WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY } from './wallet-unit';
6
7
 
7
8
  export const useTrustCollectionSync = () => {
9
+ const queryClient = useQueryClient();
8
10
  const { core } = useONECore();
9
11
 
10
- return useMutation(
11
- async (params: { holderWalletUnitId?: HolderWalletUnit['id']; verifierInstanceId?: string }) =>
12
- core.runTask('TRUST_COLLECTION_SYNC', JSON.stringify(params)),
13
- {
14
- onError: (err) => {
15
- reportException(err, 'TRUST_COLLECTION_SYNC error');
16
- },
12
+ return useMutation(async () => core.runTask('TRUST_COLLECTION_SYNC', undefined), {
13
+ onError: async (err) => {
14
+ reportException(err, 'TRUST_COLLECTION_SYNC error');
15
+ await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
16
+ await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
17
17
  },
18
- );
18
+ onSuccess: async () => {
19
+ await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
20
+ await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
21
+ },
22
+ });
19
23
  };
20
24
 
21
25
  export const useTrustListSubscriptionUpdate = () => {
26
+ const queryClient = useQueryClient();
22
27
  const { core } = useONECore();
23
28
 
24
29
  return useMutation(async () => core.runTask('TRUST_LIST_SUBSCRIPTION_UPDATE', undefined), {
25
- onError: (err) => {
30
+ onError: async (err) => {
26
31
  reportException(err, 'TRUST_LIST_SUBSCRIPTION_UPDATE error');
32
+ await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
33
+ await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
34
+ },
35
+ onSuccess: async () => {
36
+ await queryClient.invalidateQueries(WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY);
37
+ await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
27
38
  },
28
39
  });
29
40
  };
@@ -4,8 +4,22 @@ import { useMutation, useQuery, useQueryClient } from 'react-query';
4
4
  import { reportException } from '../../reporting';
5
5
  import { useONECore } from './core-context';
6
6
 
7
+ export const VERIFIER_INSTANCE_QUERY_KEY = 'verifier-instance';
7
8
  export const VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY = 'verifier-instance-trust-collections';
8
9
 
10
+ export const useVerifierInstance = (active = true) => {
11
+ const { core, organisationId } = useONECore();
12
+
13
+ return useQuery(
14
+ [VERIFIER_INSTANCE_QUERY_KEY],
15
+ () => core.getOrganisation(organisationId).then((org) => org.verifierInstance),
16
+ {
17
+ enabled: active,
18
+ keepPreviousData: true,
19
+ },
20
+ );
21
+ };
22
+
9
23
  export const useVerifierInstanceTrustCollections = (verifierInstanceId: string | undefined, active = true) => {
10
24
  const { core } = useONECore();
11
25
 
@@ -31,7 +45,10 @@ export const useRegisterVerifierInstance = () => {
31
45
  }),
32
46
 
33
47
  {
34
- onSuccess: () => queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY),
48
+ onSuccess: async () => {
49
+ await queryClient.invalidateQueries(VERIFIER_INSTANCE_QUERY_KEY);
50
+ await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
51
+ },
35
52
  },
36
53
  );
37
54
  };
@@ -46,9 +63,13 @@ export const useVerifierInstanceUpdate = () => {
46
63
  {
47
64
  onError: async (err) => {
48
65
  reportException(err, 'Update verifier instance failure');
66
+ await queryClient.invalidateQueries(VERIFIER_INSTANCE_QUERY_KEY);
67
+ await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
68
+ },
69
+ onSuccess: async () => {
70
+ await queryClient.invalidateQueries(VERIFIER_INSTANCE_QUERY_KEY);
49
71
  await queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY);
50
72
  },
51
- onSuccess: () => queryClient.invalidateQueries(VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY),
52
73
  },
53
74
  );
54
75
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
+ HolderRegisterWalletUnitRequest,
2
3
  HolderWalletUnit,
3
4
  HolderWalletUnitUpdateRequest,
4
- WalletProvider,
5
5
  WalletUnitStatus,
6
6
  } from '@procivis/react-native-one-core';
7
7
  import { useEffect } from 'react';
@@ -44,11 +44,11 @@ export const useRegisterWalletUnit = () => {
44
44
  const { core, organisationId } = useONECore();
45
45
 
46
46
  return useMutation(
47
- async (walletProvider: WalletProvider) =>
47
+ async (request: Omit<HolderRegisterWalletUnitRequest, 'organisationId' | 'keyType'>) =>
48
48
  core.holderRegisterWalletUnit({
49
49
  keyType: 'ECDSA',
50
50
  organisationId,
51
- walletProvider,
51
+ ...request,
52
52
  }),
53
53
 
54
54
  {
@@ -15,6 +15,7 @@ import {
15
15
  CredentialCardProps,
16
16
  CredentialNoticeWarningIcon,
17
17
  CredentialWarningIcon,
18
+ PurposeInfoIcon,
18
19
  Selector,
19
20
  SelectorStatus,
20
21
  } from '../../ui-components';
@@ -72,6 +73,7 @@ export const shareCredentialCardAttributeFromV2Claim = (
72
73
  parentUserSelected: boolean,
73
74
  config: CoreConfig,
74
75
  testID: string,
76
+ language: string | undefined,
75
77
  nested?: boolean,
76
78
  listValue?: boolean,
77
79
  ): CredentialAttribute => {
@@ -82,7 +84,7 @@ export const shareCredentialCardAttributeFromV2Claim = (
82
84
  const status = selection
83
85
  ? getAttributeSelectorStatus(claim, attributeShared, parentUserSelected || (attributeShared && !userSelected))
84
86
  : undefined;
85
- const attribute = detailsCardAttributeFromClaim(v2PresentationClaimToClaim(claim), config, testID);
87
+ const attribute = detailsCardAttributeFromClaim(v2PresentationClaimToClaim(claim), config, testID, language);
86
88
  const disabledStatus = [SelectorStatus.Disabled, SelectorStatus.Rejected, SelectorStatus.Required];
87
89
  const disabled = attribute.disabled || !status || disabledStatus.includes(status);
88
90
  const credentialAttribute: CredentialAttribute = {
@@ -111,6 +113,7 @@ export const shareCredentialCardAttributeFromV2Claim = (
111
113
  userSelected,
112
114
  config,
113
115
  testID,
116
+ language,
114
117
  true,
115
118
  false,
116
119
  ),
@@ -120,7 +123,16 @@ export const shareCredentialCardAttributeFromV2Claim = (
120
123
  return {
121
124
  ...credentialAttribute,
122
125
  attributes: claim.value.value.map((v) =>
123
- shareCredentialCardAttributeFromV2Claim(v, selection, attributeShared, userSelected, config, testID, true),
126
+ shareCredentialCardAttributeFromV2Claim(
127
+ v,
128
+ selection,
129
+ attributeShared,
130
+ userSelected,
131
+ config,
132
+ testID,
133
+ language,
134
+ true,
135
+ ),
124
136
  ),
125
137
  image: undefined,
126
138
  value: undefined,
@@ -158,22 +170,23 @@ export const shareCredentialCardFromV2PresentationCredential = (
158
170
  failureHint: CredentialQueryFailureHint | undefined,
159
171
  expanded: boolean,
160
172
  multipleCredentialsAvailable: boolean,
173
+ purpose: string | undefined,
161
174
  selectedFields: string[] | undefined,
162
175
  config: CoreConfig,
163
176
  testID: string,
164
177
  labels: ShareCredentialCardLabels,
178
+ language: string | undefined,
165
179
  ): CredentialDetailsCardPropsWithoutWidth => {
166
180
  const selectiveDisclosureSupported = supportsSelectiveDisclosure(
167
181
  credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
168
182
  config,
169
183
  );
170
- const notice: CredentialCardNotice | undefined =
171
- selectiveDisclosureSupported === false
172
- ? {
173
- noticeIcon: CredentialNoticeWarningIcon,
174
- text: labels.selectiveDisclosureNotice,
175
- }
176
- : undefined;
184
+ const notice: CredentialCardNotice | undefined = purpose
185
+ ? {
186
+ noticeIcon: PurposeInfoIcon,
187
+ text: purpose,
188
+ }
189
+ : undefined;
177
190
  const cardTestId = concatTestID(testID, 'card');
178
191
  const card = credential
179
192
  ? validityCheckedCardFromCredential(
@@ -182,18 +195,20 @@ export const shareCredentialCardFromV2PresentationCredential = (
182
195
  claims: [],
183
196
  },
184
197
  expanded,
198
+ selectiveDisclosureSupported,
185
199
  multipleCredentialsAvailable,
186
200
  config,
187
201
  notice,
188
202
  cardTestId,
189
203
  labels,
204
+ language,
190
205
  )
191
206
  : missingCredentialCardFromFailureHint(failureHint, notice, cardTestId, labels);
192
207
 
193
208
  return {
194
209
  attributes:
195
210
  credential?.claims.map((v) =>
196
- shareCredentialCardAttributeFromV2Claim(v, selectedFields ?? [], true, false, config, testID),
211
+ shareCredentialCardAttributeFromV2Claim(v, selectedFields ?? [], true, false, config, testID, language),
197
212
  ) ?? [],
198
213
  card,
199
214
  };
@@ -206,6 +221,7 @@ export const selectCredentialCardFromV2Credential = (
206
221
  config: CoreConfig,
207
222
  testID: string,
208
223
  labels: ShareCredentialCardLabels,
224
+ language: string | undefined,
209
225
  ): CredentialDetailsCardPropsWithoutWidth => {
210
226
  const selectiveDisclosureSupported = supportsSelectiveDisclosure(
211
227
  credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
@@ -217,7 +233,7 @@ export const selectCredentialCardFromV2Credential = (
217
233
  selectiveDisclosureSupported === false
218
234
  ? {
219
235
  noticeIcon: CredentialNoticeWarningIcon,
220
- text: labels.selectiveDisclosureNotice,
236
+ text: labels.selectiveDisclosure,
221
237
  }
222
238
  : undefined;
223
239
  const { header, ...cardProps } = getCredentialCardPropsFromCredential(
@@ -230,6 +246,7 @@ export const selectCredentialCardFromV2Credential = (
230
246
  notice,
231
247
  testID,
232
248
  labels,
249
+ language,
233
250
  );
234
251
  const card = {
235
252
  header: {
@@ -241,7 +258,7 @@ export const selectCredentialCardFromV2Credential = (
241
258
  return {
242
259
  attributes:
243
260
  credential?.claims.map((v) =>
244
- shareCredentialCardAttributeFromV2Claim(v, undefined, false, false, config, testID),
261
+ shareCredentialCardAttributeFromV2Claim(v, undefined, false, false, config, testID, language),
245
262
  ) ?? [],
246
263
  card,
247
264
  };
@@ -31,11 +31,13 @@ import {
31
31
  export const validityCheckedCardFromCredential = (
32
32
  credential: CredentialDetail,
33
33
  expanded: boolean,
34
+ selectiveDisclosureSupported: boolean | undefined,
34
35
  multipleCredentialsAvailable: boolean,
35
36
  config: CoreConfig,
36
37
  notice: CredentialCardNotice | undefined,
37
38
  testID: string,
38
39
  labels: ShareCredentialCardLabels,
40
+ language: string | undefined,
39
41
  ): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'testID' | 'width'> => {
40
42
  let credentialHeaderDetail:
41
43
  | Pick<
@@ -47,7 +49,13 @@ export const validityCheckedCardFromCredential = (
47
49
  | 'statusIcon'
48
50
  >
49
51
  | undefined;
50
- if (!expanded && multipleCredentialsAvailable) {
52
+ if (selectiveDisclosureSupported === false) {
53
+ credentialHeaderDetail = {
54
+ credentialDetailPrimary: labels.selectiveDisclosure,
55
+ credentialDetailTestID: concatTestID(testID, 'header.nonSelectiveDisclosure'),
56
+ statusIcon: CredentialWarningIcon,
57
+ };
58
+ } else if (!expanded && multipleCredentialsAvailable) {
51
59
  credentialHeaderDetail = {
52
60
  credentialDetailPrimary: labels.multipleCredentials,
53
61
  credentialDetailTestID: concatTestID(testID, 'header.multiple'),
@@ -55,7 +63,15 @@ export const validityCheckedCardFromCredential = (
55
63
  };
56
64
  }
57
65
 
58
- const card = getCredentialCardPropsFromCredential(credential, credential.claims, config, notice, testID, labels);
66
+ const card = getCredentialCardPropsFromCredential(
67
+ credential,
68
+ credential.claims,
69
+ config,
70
+ notice,
71
+ testID,
72
+ labels,
73
+ language,
74
+ );
59
75
  return {
60
76
  ...card,
61
77
  header: {
@@ -188,12 +204,13 @@ export const shareCredentialCardAttributeFromClaim = (
188
204
  config: CoreConfig,
189
205
  testID: string,
190
206
  labels: ShareCredentialCardLabels,
207
+ language: string | undefined,
191
208
  claim?: FlatClaim,
192
209
  field?: PresentationDefinitionField,
193
210
  ): CredentialAttribute => {
194
211
  if (claim) {
195
212
  return {
196
- ...detailsCardAttributeFromClaim(claim, config, testID),
213
+ ...detailsCardAttributeFromClaim(claim, config, testID, language),
197
214
  id,
198
215
  path: claim.path,
199
216
  listValue: claim.isArrayElement,
@@ -243,7 +260,7 @@ const setStatusForNestedObjectOrArrayFields = (
243
260
  };
244
261
 
245
262
  export type ShareCredentialCardLabels = CardLabels & {
246
- selectiveDisclosureNotice: string;
263
+ selectiveDisclosure: string;
247
264
  missingAttribute: string;
248
265
  missingCredential: string;
249
266
  multipleCredentials: string;
@@ -258,30 +275,26 @@ export const shareCredentialCardFromCredential = (
258
275
  config: CoreConfig,
259
276
  testID: string,
260
277
  labels: ShareCredentialCardLabels,
278
+ language: string | undefined,
261
279
  ): CredentialDetailsCardPropsWithoutWidth => {
262
280
  const selectiveDisclosureSupported = supportsSelectiveDisclosure(
263
281
  credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
264
282
  config,
265
283
  );
266
- const notice: CredentialCardNotice | undefined =
267
- selectiveDisclosureSupported === false
268
- ? {
269
- text: labels.selectiveDisclosureNotice,
270
- noticeIcon: CredentialNoticeWarningIcon,
271
- }
272
- : undefined;
273
284
  const cardTestId = concatTestID(testID, 'card');
274
285
  const card = credential
275
286
  ? validityCheckedCardFromCredential(
276
287
  credential,
277
288
  expanded,
289
+ selectiveDisclosureSupported,
278
290
  multipleCredentialsAvailable,
279
291
  config,
280
- notice,
292
+ undefined,
281
293
  cardTestId,
282
294
  labels,
295
+ language,
283
296
  )
284
- : missingCredentialCardFromRequest(request, notice, cardTestId, labels);
297
+ : missingCredentialCardFromRequest(request, undefined, cardTestId, labels);
285
298
  const validityState = getValidityState(credential ? { ...credential, issuer: credential.issuer?.id } : undefined);
286
299
  const displayedAttributes = getDisplayedAttributes(
287
300
  request,
@@ -299,6 +312,7 @@ export const shareCredentialCardFromCredential = (
299
312
  config,
300
313
  concatTestID(testID, 'attribute', `${index}`),
301
314
  labels,
315
+ language,
302
316
  claim,
303
317
  field,
304
318
  ),
@@ -319,10 +333,11 @@ export const selectCredentialCardAttributeFromClaim = (
319
333
  config: CoreConfig,
320
334
  testID: string,
321
335
  labels: ShareCredentialCardLabels,
336
+ language: string | undefined,
322
337
  claim?: FlatClaim,
323
338
  field?: PresentationDefinitionField,
324
339
  ): CredentialAttribute => {
325
- const attribute = shareCredentialCardAttributeFromClaim(id, config, testID, labels, claim, field);
340
+ const attribute = shareCredentialCardAttributeFromClaim(id, config, testID, labels, language, claim, field);
326
341
  if (!claim) {
327
342
  return attribute;
328
343
  }
@@ -339,6 +354,7 @@ export const selectCredentialCardFromCredential = (
339
354
  config: CoreConfig,
340
355
  testID: string,
341
356
  labels: ShareCredentialCardLabels,
357
+ language: string | undefined,
342
358
  ): CredentialDetailsCardPropsWithoutWidth => {
343
359
  const selectiveDisclosureSupported = supportsSelectiveDisclosure(
344
360
  credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
@@ -348,7 +364,7 @@ export const selectCredentialCardFromCredential = (
348
364
  const notice: CredentialCardNotice | undefined =
349
365
  selectiveDisclosureSupported === false
350
366
  ? {
351
- text: labels.selectiveDisclosureNotice,
367
+ text: labels.selectiveDisclosure,
352
368
  noticeIcon: CredentialNoticeWarningIcon,
353
369
  }
354
370
  : undefined;
@@ -359,6 +375,7 @@ export const selectCredentialCardFromCredential = (
359
375
  notice,
360
376
  testID,
361
377
  labels,
378
+ language,
362
379
  );
363
380
  const card = {
364
381
  header: {
@@ -372,7 +389,7 @@ export const selectCredentialCardFromCredential = (
372
389
  return path === field.keyMap[credential.id];
373
390
  });
374
391
 
375
- const attribute = selectCredentialCardAttributeFromClaim(field.id, config, testID, labels, claim, field);
392
+ const attribute = selectCredentialCardAttributeFromClaim(field.id, config, testID, labels, language, claim, field);
376
393
  return {
377
394
  ...attribute,
378
395
  rightAccessory: (
@@ -19,9 +19,15 @@ import {
19
19
  CredentialHeaderProps,
20
20
  } from '../../ui-components/credential';
21
21
  import { CredentialCardNotice } from '../../ui-components/credential/card/credential-card';
22
- import { CredentialErrorIcon, CredentialNoticeWarningIcon, CredentialWarningIcon } from '../../ui-components/icons';
22
+ import {
23
+ CredentialErrorIcon,
24
+ CredentialNoticeInfoIcon,
25
+ CredentialNoticeWarningIcon,
26
+ CredentialWarningIcon,
27
+ } from '../../ui-components/icons';
23
28
  import { formatDateLocalized, formatDateTimeLocalized } from '../date';
24
29
  import { concatTestID } from '../testID';
30
+ import { getTranslatedLabel } from '../translations';
25
31
  import { getCarouselImagesFromClaims } from './credential-images';
26
32
 
27
33
  export enum ValidityState {
@@ -68,8 +74,13 @@ export const findClaimByPath = (path: string | undefined, claims: Claim[]): Clai
68
74
  return undefined;
69
75
  };
70
76
 
71
- const formatCredentialDetail = (claim: Claim, config: CoreConfig, testID: string): string => {
72
- const attributeValue = detailsCardAttributeValueFromClaim(claim, config, testID);
77
+ const formatCredentialDetail = (
78
+ claim: Claim,
79
+ config: CoreConfig,
80
+ testID: string,
81
+ language: string | undefined,
82
+ ): string => {
83
+ const attributeValue = detailsCardAttributeValueFromClaim(claim, config, testID, language);
73
84
  return attributeValue.value ?? '';
74
85
  };
75
86
 
@@ -94,6 +105,7 @@ const credentialDetailFromCredential = (
94
105
  config: CoreConfig,
95
106
  testID: string,
96
107
  labels: CardHeaderLabels,
108
+ language: string | undefined,
97
109
  ): {
98
110
  credentialDetailPrimary?: string;
99
111
  credentialDetailSecondary?: string;
@@ -136,13 +148,13 @@ const credentialDetailFromCredential = (
136
148
  const primary = findClaimByPath(layoutProperties?.primaryAttribute, claims);
137
149
 
138
150
  if (primary) {
139
- credentialDetailPrimary = formatCredentialDetail(primary, config, concatTestID(testID, 'primary'));
151
+ credentialDetailPrimary = formatCredentialDetail(primary, config, concatTestID(testID, 'primary'), language);
140
152
  }
141
153
 
142
154
  const secondary = findClaimByPath(layoutProperties?.secondaryAttribute, claims);
143
155
 
144
156
  if (secondary) {
145
- credentialDetailSecondary = formatCredentialDetail(secondary, config, concatTestID(testID, 'secondary'));
157
+ credentialDetailSecondary = formatCredentialDetail(secondary, config, concatTestID(testID, 'secondary'), language);
146
158
  }
147
159
 
148
160
  return {
@@ -158,6 +170,7 @@ export const cardHeaderFromCredential = (
158
170
  config: CoreConfig,
159
171
  testID: string,
160
172
  labels: CardHeaderLabels,
173
+ language: string | undefined,
161
174
  ): Omit<CredentialHeaderProps, 'style'> => {
162
175
  const {
163
176
  credentialDetailPrimary,
@@ -165,8 +178,9 @@ export const cardHeaderFromCredential = (
165
178
  credentialDetailErrorColor,
166
179
  credentialDetailTestID,
167
180
  statusIcon,
168
- } = credentialDetailFromCredential(credential, claims, config, testID, labels);
181
+ } = credentialDetailFromCredential(credential, claims, config, testID, labels, language);
169
182
  const { layoutProperties } = credential.schema;
183
+ const defaultLanguage = config.defaultLanguage;
170
184
 
171
185
  return {
172
186
  color: layoutProperties?.logo?.backgroundColor,
@@ -174,7 +188,8 @@ export const cardHeaderFromCredential = (
174
188
  credentialDetailPrimary,
175
189
  credentialDetailSecondary,
176
190
  credentialDetailTestID,
177
- credentialName: credential.schema.name,
191
+ credentialName:
192
+ getTranslatedLabel(credential.schema.translations?.name, language, defaultLanguage) ?? credential.schema.name,
178
193
  icon: layoutProperties?.logo?.image
179
194
  ? {
180
195
  imageSource: {
@@ -199,14 +214,24 @@ export const getCredentialCardPropsFromCredential = (
199
214
  notice: CredentialCardNotice | undefined,
200
215
  testID: string,
201
216
  labels: CardLabels,
217
+ language: string | undefined,
202
218
  ): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'width'> => {
203
219
  const { layoutProperties } = credential.schema;
220
+ const defaultLanguage = config.defaultLanguage;
204
221
 
205
222
  if (hasMsoValidityIssues(credential)) {
206
223
  notice = {
207
224
  text: labels.validityIssuesNotice,
208
225
  noticeIcon: CredentialNoticeWarningIcon,
209
226
  };
227
+ } else if (!notice) {
228
+ let description = getTranslatedLabel(credential.schema.translations?.description, language, defaultLanguage);
229
+ if (description) {
230
+ notice = {
231
+ text: description,
232
+ noticeIcon: CredentialNoticeInfoIcon,
233
+ };
234
+ }
210
235
  }
211
236
 
212
237
  const result: Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'width'> = {
@@ -215,7 +240,7 @@ export const getCredentialCardPropsFromCredential = (
215
240
  ? { imageSource: { uri: layoutProperties.background.image } }
216
241
  : undefined,
217
242
  color: layoutProperties?.background?.color,
218
- header: cardHeaderFromCredential(credential, claims, config, concatTestID(testID, 'header'), labels),
243
+ header: cardHeaderFromCredential(credential, claims, config, concatTestID(testID, 'header'), labels, language),
219
244
  testID,
220
245
  notice,
221
246
  };
@@ -227,11 +252,13 @@ export const detailsCardAttributeFromClaim = (
227
252
  claim: Claim,
228
253
  config: CoreConfig,
229
254
  testID: string,
255
+ language: string | undefined,
230
256
  ): CredentialAttribute => {
231
- const value = detailsCardAttributeValueFromClaim(claim, config, testID);
257
+ const value = detailsCardAttributeValueFromClaim(claim, config, testID, language);
258
+ const defaultLanguage = config.defaultLanguage;
232
259
  return {
233
260
  id: claim.path,
234
- name: claim.path.split('/').pop(),
261
+ name: getTranslatedLabel(claim.schema.translations.name, language, defaultLanguage) ?? claim.path.split('/').pop(),
235
262
  path: claim.path,
236
263
  ...value,
237
264
  };
@@ -241,13 +268,14 @@ const detailsCardAttributeValueFromClaim = (
241
268
  claim: Claim,
242
269
  config: CoreConfig,
243
270
  testID: string,
271
+ language: string | undefined,
244
272
  ): CredentialAttributeValue => {
245
273
  const typeConfig = config?.datatype[claim.schema.datatype];
246
274
 
247
275
  if (claim.schema.array) {
248
276
  return {
249
277
  values: ((claim.value.value as Claim[]) || []).map((arrayValue, index) => {
250
- return detailsCardAttributeFromClaim(arrayValue, config, concatTestID(testID, index.toString()));
278
+ return detailsCardAttributeFromClaim(arrayValue, config, concatTestID(testID, index.toString()), language);
251
279
  }),
252
280
  };
253
281
  } else {
@@ -258,7 +286,7 @@ const detailsCardAttributeValueFromClaim = (
258
286
  }
259
287
  return {
260
288
  attributes: claim.value.value.map((nestedClaim, index) =>
261
- detailsCardAttributeFromClaim(nestedClaim, config, concatTestID(testID, index.toString())),
289
+ detailsCardAttributeFromClaim(nestedClaim, config, concatTestID(testID, index.toString()), language),
262
290
  ),
263
291
  };
264
292
  }
@@ -296,8 +324,9 @@ export const detailsCardFromCredential = (
296
324
  config: CoreConfig,
297
325
  testID: string,
298
326
  labels: CardLabels,
327
+ language: string | undefined,
299
328
  ): CredentialDetailsCardPropsWithoutWidth => {
300
- return detailsCardFromCredentialWithClaims(credential, credential.claims, config, testID, labels);
329
+ return detailsCardFromCredentialWithClaims(credential, credential.claims, config, testID, labels, language);
301
330
  };
302
331
 
303
332
  export const detailsCardFromCredentialWithClaims = (
@@ -306,9 +335,10 @@ export const detailsCardFromCredentialWithClaims = (
306
335
  config: CoreConfig,
307
336
  testID: string,
308
337
  labels: CardLabels,
338
+ language: string | undefined,
309
339
  ): CredentialDetailsCardPropsWithoutWidth => {
310
340
  const attributes: CredentialAttribute[] = claims.map((claim, index) =>
311
- detailsCardAttributeFromClaim(claim, config, concatTestID(testID, 'attribute', index.toString())),
341
+ detailsCardAttributeFromClaim(claim, config, concatTestID(testID, 'attribute', index.toString()), language),
312
342
  );
313
343
 
314
344
  const card = getCredentialCardPropsFromCredential(
@@ -318,6 +348,7 @@ export const detailsCardFromCredentialWithClaims = (
318
348
  undefined,
319
349
  concatTestID(testID, 'card'),
320
350
  labels,
351
+ language,
321
352
  );
322
353
 
323
354
  return {
@@ -86,7 +86,10 @@ export const getQueryKeyFromCredentialSchemaListQueryParams = (
86
86
  'ids',
87
87
  'include',
88
88
  'schemaId',
89
+ 'schemaIds',
89
90
  'formats',
91
+ 'usesBatchIssuance',
92
+ 'isMultiformatSchema',
90
93
  'createdDateAfter',
91
94
  'createdDateBefore',
92
95
  'lastModifiedAfter',
@@ -0,0 +1,10 @@
1
+ export const getTranslatedLabel = (
2
+ translations: Record<string, string> | undefined,
3
+ language: string | undefined,
4
+ defaultLanguage: string,
5
+ ) => {
6
+ if (!language) {
7
+ return undefined;
8
+ }
9
+ return translations?.[language] ?? translations?.[defaultLanguage];
10
+ };