@procivis/one-react-native-components 0.3.132 → 0.3.143

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 (139) hide show
  1. package/lib/commonjs/components/history/history-list-item-icon.js +2 -0
  2. package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
  3. package/lib/commonjs/components/proof-request/index.js +1 -12
  4. package/lib/commonjs/components/proof-request/index.js.map +1 -1
  5. package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  6. package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
  7. package/lib/commonjs/ui-components/buttons/scan-button.js +122 -27
  8. package/lib/commonjs/ui-components/buttons/scan-button.js.map +1 -1
  9. package/lib/commonjs/ui-components/credential/card/credential-details-card.js +37 -18
  10. package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
  11. package/lib/commonjs/ui-components/credential/credential-attribute-item.js +13 -4
  12. package/lib/commonjs/ui-components/credential/credential-attribute-item.js.map +1 -1
  13. package/lib/commonjs/ui-components/icons/icons.js +36 -2
  14. package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
  15. package/lib/commonjs/ui-components/list/wallet/empty-list.js +2 -1
  16. package/lib/commonjs/ui-components/list/wallet/empty-list.js.map +1 -1
  17. package/lib/commonjs/ui-components/notice/wallet-notice.js +4 -2
  18. package/lib/commonjs/ui-components/notice/wallet-notice.js.map +1 -1
  19. package/lib/commonjs/ui-components/text/expandableTypography.js +64 -0
  20. package/lib/commonjs/ui-components/text/expandableTypography.js.map +1 -0
  21. package/lib/commonjs/ui-components/text/index.js +15 -0
  22. package/lib/commonjs/ui-components/text/index.js.map +1 -1
  23. package/lib/commonjs/utils/hooks/core/credential-schemas.js +24 -1
  24. package/lib/commonjs/utils/hooks/core/credential-schemas.js.map +1 -1
  25. package/lib/commonjs/utils/hooks/core/proofs.js +1 -1
  26. package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
  27. package/lib/commonjs/utils/hooks/core/wallet-unit.js +20 -1
  28. package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
  29. package/lib/commonjs/utils/parsers/credential-sharing-v2.js +34 -7
  30. package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
  31. package/lib/commonjs/utils/parsers/credential.js +12 -4
  32. package/lib/commonjs/utils/parsers/credential.js.map +1 -1
  33. package/lib/commonjs/utils/parsers/index.js +0 -11
  34. package/lib/commonjs/utils/parsers/index.js.map +1 -1
  35. package/lib/commonjs/utils/parsers/query.js +1 -1
  36. package/lib/commonjs/utils/parsers/query.js.map +1 -1
  37. package/lib/module/components/history/history-list-item-icon.js +2 -0
  38. package/lib/module/components/history/history-list-item-icon.js.map +1 -1
  39. package/lib/module/components/proof-request/index.js +0 -1
  40. package/lib/module/components/proof-request/index.js.map +1 -1
  41. package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  42. package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
  43. package/lib/module/ui-components/buttons/scan-button.js +124 -29
  44. package/lib/module/ui-components/buttons/scan-button.js.map +1 -1
  45. package/lib/module/ui-components/credential/card/credential-details-card.js +37 -18
  46. package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
  47. package/lib/module/ui-components/credential/credential-attribute-item.js +13 -4
  48. package/lib/module/ui-components/credential/credential-attribute-item.js.map +1 -1
  49. package/lib/module/ui-components/icons/icons.js +32 -0
  50. package/lib/module/ui-components/icons/icons.js.map +1 -1
  51. package/lib/module/ui-components/list/wallet/empty-list.js +2 -1
  52. package/lib/module/ui-components/list/wallet/empty-list.js.map +1 -1
  53. package/lib/module/ui-components/notice/wallet-notice.js +4 -2
  54. package/lib/module/ui-components/notice/wallet-notice.js.map +1 -1
  55. package/lib/module/ui-components/text/expandableTypography.js +55 -0
  56. package/lib/module/ui-components/text/expandableTypography.js.map +1 -0
  57. package/lib/module/ui-components/text/index.js +2 -1
  58. package/lib/module/ui-components/text/index.js.map +1 -1
  59. package/lib/module/utils/hooks/core/credential-schemas.js +24 -1
  60. package/lib/module/utils/hooks/core/credential-schemas.js.map +1 -1
  61. package/lib/module/utils/hooks/core/proofs.js +1 -1
  62. package/lib/module/utils/hooks/core/proofs.js.map +1 -1
  63. package/lib/module/utils/hooks/core/wallet-unit.js +18 -0
  64. package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
  65. package/lib/module/utils/parsers/credential-sharing-v2.js +32 -6
  66. package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
  67. package/lib/module/utils/parsers/credential.js +10 -4
  68. package/lib/module/utils/parsers/credential.js.map +1 -1
  69. package/lib/module/utils/parsers/index.js +0 -1
  70. package/lib/module/utils/parsers/index.js.map +1 -1
  71. package/lib/module/utils/parsers/query.js +1 -1
  72. package/lib/module/utils/parsers/query.js.map +1 -1
  73. package/lib/typescript/components/proof-request/index.d.ts +0 -1
  74. package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +8 -1
  75. package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +1 -1
  76. package/lib/typescript/ui-components/buttons/scan-button.d.ts +9 -3
  77. package/lib/typescript/ui-components/credential/card/credential-details-card.d.ts +3 -0
  78. package/lib/typescript/ui-components/credential/credential-attribute-item.d.ts +3 -0
  79. package/lib/typescript/ui-components/icons/icons.d.ts +2 -0
  80. package/lib/typescript/ui-components/list/wallet/empty-list.d.ts +2 -2
  81. package/lib/typescript/ui-components/text/expandableTypography.d.ts +10 -0
  82. package/lib/typescript/ui-components/text/index.d.ts +2 -1
  83. package/lib/typescript/ui-components/text/typography.d.ts +14 -14
  84. package/lib/typescript/utils/hooks/app-state.d.ts +1 -1
  85. package/lib/typescript/utils/hooks/core/proofs.d.ts +2 -2
  86. package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +5 -1
  87. package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +10 -2
  88. package/lib/typescript/utils/parsers/credential.d.ts +2 -1
  89. package/lib/typescript/utils/parsers/index.d.ts +0 -1
  90. package/package.json +5 -4
  91. package/src/components/history/history-list-item-icon.tsx +2 -0
  92. package/src/components/proof-request/index.ts +0 -1
  93. package/src/components/proof-request/v2/share-credential-v2-group.tsx +9 -2
  94. package/src/components/proof-request/v2/share-credential-v2.tsx +1 -1
  95. package/src/ui-components/buttons/scan-button.tsx +130 -38
  96. package/src/ui-components/credential/card/credential-details-card.tsx +46 -19
  97. package/src/ui-components/credential/credential-attribute-item.tsx +15 -3
  98. package/src/ui-components/icons/icons.tsx +24 -0
  99. package/src/ui-components/list/wallet/empty-list.tsx +11 -8
  100. package/src/ui-components/notice/wallet-notice.tsx +4 -2
  101. package/src/ui-components/text/expandableTypography.tsx +71 -0
  102. package/src/ui-components/text/index.ts +2 -1
  103. package/src/utils/hooks/core/credential-schemas.ts +23 -1
  104. package/src/utils/hooks/core/proofs.ts +3 -3
  105. package/src/utils/hooks/core/wallet-unit.ts +21 -0
  106. package/src/utils/parsers/credential-sharing-v2.tsx +71 -6
  107. package/src/utils/parsers/credential.ts +14 -3
  108. package/src/utils/parsers/index.ts +0 -1
  109. package/src/utils/parsers/query.ts +0 -1
  110. package/lib/commonjs/components/proof-request/v1/group.js +0 -35
  111. package/lib/commonjs/components/proof-request/v1/group.js.map +0 -1
  112. package/lib/commonjs/components/proof-request/v1/index.js +0 -39
  113. package/lib/commonjs/components/proof-request/v1/index.js.map +0 -1
  114. package/lib/commonjs/components/proof-request/v1/select-credential.js +0 -53
  115. package/lib/commonjs/components/proof-request/v1/select-credential.js.map +0 -1
  116. package/lib/commonjs/components/proof-request/v1/share-credential.js +0 -110
  117. package/lib/commonjs/components/proof-request/v1/share-credential.js.map +0 -1
  118. package/lib/commonjs/utils/parsers/credential-sharing.js +0 -263
  119. package/lib/commonjs/utils/parsers/credential-sharing.js.map +0 -1
  120. package/lib/module/components/proof-request/v1/group.js +0 -27
  121. package/lib/module/components/proof-request/v1/group.js.map +0 -1
  122. package/lib/module/components/proof-request/v1/index.js +0 -4
  123. package/lib/module/components/proof-request/v1/index.js.map +0 -1
  124. package/lib/module/components/proof-request/v1/select-credential.js +0 -44
  125. package/lib/module/components/proof-request/v1/select-credential.js.map +0 -1
  126. package/lib/module/components/proof-request/v1/share-credential.js +0 -101
  127. package/lib/module/components/proof-request/v1/share-credential.js.map +0 -1
  128. package/lib/module/utils/parsers/credential-sharing.js +0 -250
  129. package/lib/module/utils/parsers/credential-sharing.js.map +0 -1
  130. package/lib/typescript/components/proof-request/v1/group.d.ts +0 -2
  131. package/lib/typescript/components/proof-request/v1/index.d.ts +0 -3
  132. package/lib/typescript/components/proof-request/v1/select-credential.d.ts +0 -15
  133. package/lib/typescript/components/proof-request/v1/share-credential.d.ts +0 -27
  134. package/lib/typescript/utils/parsers/credential-sharing.d.ts +0 -20
  135. package/src/components/proof-request/v1/group.tsx +0 -26
  136. package/src/components/proof-request/v1/index.ts +0 -3
  137. package/src/components/proof-request/v1/select-credential.tsx +0 -55
  138. package/src/components/proof-request/v1/share-credential.tsx +0 -159
  139. package/src/utils/parsers/credential-sharing.tsx +0 -404
@@ -1,404 +0,0 @@
1
- import {
2
- Claim,
3
- CoreConfig,
4
- CredentialDetail,
5
- PresentationDefinitionField,
6
- PresentationDefinitionRequestedCredential,
7
- } from '@procivis/react-native-one-core';
8
- import React from 'react';
9
-
10
- import {
11
- CredentialAttribute,
12
- CredentialCardProps,
13
- CredentialHeaderProps,
14
- Selector,
15
- SelectorStatus,
16
- } from '../../ui-components/credential';
17
- import { CredentialCardNotice } from '../../ui-components/credential/card/credential-card';
18
- import { CredentialNoticeWarningIcon, CredentialWarningIcon, RequiredAttributeIcon } from '../../ui-components/icons';
19
- import { concatTestID } from '../testID';
20
- import {
21
- CardLabels,
22
- CredentialDetailsCardPropsWithoutWidth,
23
- detailsCardAttributeFromClaim,
24
- getCredentialCardPropsFromCredential,
25
- getValidityState,
26
- nestAttributes,
27
- supportsSelectiveDisclosure,
28
- ValidityState,
29
- } from './credential';
30
-
31
- export const validityCheckedCardFromCredential = (
32
- credential: CredentialDetail,
33
- expanded: boolean,
34
- selectiveDisclosureSupported: boolean | undefined,
35
- multipleCredentialsAvailable: boolean,
36
- config: CoreConfig,
37
- notice: CredentialCardNotice | undefined,
38
- testID: string,
39
- labels: ShareCredentialCardLabels,
40
- language: string | undefined,
41
- ): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'testID' | 'width'> => {
42
- let credentialHeaderDetail:
43
- | Pick<
44
- CredentialHeaderProps,
45
- | 'credentialDetailPrimary'
46
- | 'credentialDetailSecondary'
47
- | 'credentialDetailErrorColor'
48
- | 'credentialDetailTestID'
49
- | 'statusIcon'
50
- >
51
- | undefined;
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) {
59
- credentialHeaderDetail = {
60
- credentialDetailPrimary: labels.multipleCredentials,
61
- credentialDetailTestID: concatTestID(testID, 'header.multiple'),
62
- statusIcon: CredentialWarningIcon,
63
- };
64
- }
65
-
66
- const card = getCredentialCardPropsFromCredential(
67
- credential,
68
- credential.claims,
69
- config,
70
- notice,
71
- testID,
72
- labels,
73
- language,
74
- );
75
- return {
76
- ...card,
77
- header: {
78
- ...card.header,
79
- ...credentialHeaderDetail,
80
- },
81
- };
82
- };
83
-
84
- export const missingCredentialCardFromRequest = (
85
- request: PresentationDefinitionRequestedCredential,
86
- notice: CredentialCardNotice | undefined,
87
- testID: string,
88
- labels: ShareCredentialCardLabels,
89
- ): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'width'> => {
90
- return {
91
- cardImage: undefined,
92
- color: undefined,
93
- testID,
94
- header: {
95
- credentialDetailErrorColor: true,
96
- credentialDetailPrimary: labels.missingCredential,
97
- credentialDetailTestID: concatTestID(testID, 'header.missing'),
98
- credentialName: request.name ?? request.id,
99
- statusIcon: CredentialWarningIcon,
100
- },
101
- ...notice,
102
- };
103
- };
104
-
105
- interface DisplayedAttribute {
106
- claim?: FlatClaim;
107
- field?: PresentationDefinitionField;
108
- id: string;
109
- selected?: boolean;
110
- status: SelectorStatus;
111
- }
112
-
113
- const getAttributeSelectorStatus = (
114
- field: PresentationDefinitionField,
115
- validityState: ValidityState,
116
- credential?: CredentialDetail,
117
- claim?: Claim,
118
- selected?: boolean,
119
- ): SelectorStatus => {
120
- if (!credential || validityState !== ValidityState.Valid) {
121
- return SelectorStatus.Rejected;
122
- }
123
- if (field.required) {
124
- if (claim) {
125
- return SelectorStatus.Required;
126
- } else {
127
- return SelectorStatus.Rejected;
128
- }
129
- }
130
- if (!claim) {
131
- return SelectorStatus.Disabled;
132
- }
133
- return selected ? SelectorStatus.SelectedCheckmark : SelectorStatus.Empty;
134
- };
135
-
136
- type FlatClaim = Claim & {
137
- isArrayElement?: boolean;
138
- };
139
-
140
- // Returns a spread list of all claims with their full JSON path as key, including all intermediate objects
141
- const spreadClaims = (claims: Claim[]): FlatClaim[] => {
142
- return claims.reduce((acc, claim) => {
143
- const result = [claim];
144
- if (claim.value.type_ === 'NESTED') {
145
- const nestedClaimsWithPath: FlatClaim[] = claim.value.value.map((c) => ({
146
- ...c,
147
- isArrayElement: claim.schema.array && claim.path.split('/').pop() !== claim.schema.key,
148
- }));
149
- result.push(...spreadClaims(nestedClaimsWithPath));
150
- }
151
- return [...acc, ...result];
152
- }, [] as FlatClaim[]);
153
- };
154
-
155
- const getDisplayedAttributes = (
156
- request: PresentationDefinitionRequestedCredential,
157
- validityState: ValidityState,
158
- credential?: CredentialDetail,
159
- selectiveDisclosureSupported?: boolean,
160
- selectedFields?: string[],
161
- ): DisplayedAttribute[] => {
162
- const claims = credential ? spreadClaims(credential.claims) : undefined;
163
- const isApplicable = credential ? request.applicableCredentials.includes(credential.id) : false;
164
-
165
- let fields = request.fields;
166
- if (credential) {
167
- const fieldsWithNoKeyMapping = request.fields
168
- .filter((field) => !(credential.id in field.keyMap))
169
- .filter((field) => !isApplicable || !field.required);
170
- const fullyNestedFields = getFullyNestedFields(request.fields, credential.id);
171
-
172
- fields = [...fieldsWithNoKeyMapping, ...fullyNestedFields];
173
- }
174
-
175
- return fields.map((field) => {
176
- const selected = !field.required && selectedFields?.includes(field.id);
177
- const claim = credential
178
- ? claims?.find(({ path }) => {
179
- return path === field.keyMap[credential.id];
180
- })
181
- : undefined;
182
- const status =
183
- selectiveDisclosureSupported === false
184
- ? SelectorStatus.Required
185
- : getAttributeSelectorStatus(field, validityState, credential, claim, selected);
186
- return { claim, field, id: field.id, selected, status };
187
- });
188
- };
189
-
190
- const getFullyNestedFields = (
191
- fields: PresentationDefinitionRequestedCredential['fields'],
192
- credentialId: CredentialDetail['id'],
193
- ) => {
194
- const allKeys = fields.filter((field) => credentialId in field.keyMap).map((field) => field.keyMap[credentialId]);
195
-
196
- return fields
197
- .map((field) => ({ field, key: field.keyMap[credentialId] }))
198
- .filter(({ key }) => key && allKeys.every((k) => !k.startsWith(`${key}/`)))
199
- .map(({ field }) => field);
200
- };
201
-
202
- export const shareCredentialCardAttributeFromClaim = (
203
- id: string,
204
- config: CoreConfig,
205
- testID: string,
206
- labels: ShareCredentialCardLabels,
207
- language: string | undefined,
208
- claim?: FlatClaim,
209
- field?: PresentationDefinitionField,
210
- ): CredentialAttribute => {
211
- if (claim) {
212
- return {
213
- ...detailsCardAttributeFromClaim(claim, config, testID, language),
214
- id,
215
- path: claim.path,
216
- listValue: claim.isArrayElement,
217
- };
218
- }
219
- return {
220
- id,
221
- name: field?.name?.split('/').pop() ?? id,
222
- path: field?.name ?? id,
223
- value: labels.missingAttribute,
224
- valueErrorColor: true,
225
- };
226
- };
227
-
228
- // Will propagate the attribute status (right accessory + selected?) for all nested attributes
229
- // Note: This function MUTATES the input attribute
230
- const setStatusForNestedObjectOrArrayFields = (
231
- attribute: CredentialAttribute,
232
- status?: SelectorStatus,
233
- disabled?: boolean,
234
- ) => {
235
- const accessory = status && <Selector status={status} />;
236
- const isObject = attribute.attributes && attribute.attributes.length > 0;
237
- const isArray = attribute.values && attribute.values.length > 0;
238
-
239
- // If the attribute is not an object or array, we update the attribute and return
240
- if (!isObject && !isArray) {
241
- attribute.rightAccessory = accessory;
242
- attribute.disabled = disabled;
243
- return attribute;
244
- }
245
-
246
- // The object can be optional (tappable radio-checkmark), or required (checkmark)
247
- if (status === SelectorStatus.SelectedCheckmark || status === SelectorStatus.Empty) {
248
- // If it's a selectable object, the accessory is rendered next to the object title,
249
- // The nested attributes have no accessory, and can not be selected
250
- attribute.rightAccessory = accessory;
251
- setStatusForNestedObjectOrArrayFields(attribute, undefined, true);
252
- } else {
253
- const nested = attribute.attributes ?? attribute.values;
254
- // If the object is required / rejected, the accessory is rendered next to each nested attribute (except other object titles)
255
- // all fields are disabled
256
- for (const nestedAttribute of nested) {
257
- setStatusForNestedObjectOrArrayFields(nestedAttribute, status, true);
258
- }
259
- }
260
- };
261
-
262
- export type ShareCredentialCardLabels = CardLabels & {
263
- selectiveDisclosure: string;
264
- missingAttribute: string;
265
- missingCredential: string;
266
- multipleCredentials: string;
267
- };
268
-
269
- export const shareCredentialCardFromCredential = (
270
- credential: CredentialDetail | undefined,
271
- expanded: boolean,
272
- multipleCredentialsAvailable: boolean,
273
- request: PresentationDefinitionRequestedCredential,
274
- selectedFields: string[] | undefined,
275
- config: CoreConfig,
276
- testID: string,
277
- labels: ShareCredentialCardLabels,
278
- language: string | undefined,
279
- ): CredentialDetailsCardPropsWithoutWidth => {
280
- const selectiveDisclosureSupported = supportsSelectiveDisclosure(
281
- credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
282
- config,
283
- );
284
- const cardTestId = concatTestID(testID, 'card');
285
- const card = credential
286
- ? validityCheckedCardFromCredential(
287
- credential,
288
- expanded,
289
- selectiveDisclosureSupported,
290
- multipleCredentialsAvailable,
291
- config,
292
- undefined,
293
- cardTestId,
294
- labels,
295
- language,
296
- )
297
- : missingCredentialCardFromRequest(request, undefined, cardTestId, labels);
298
- const validityState = getValidityState(credential ? { ...credential, issuer: credential.issuer?.id } : undefined);
299
- const displayedAttributes = getDisplayedAttributes(
300
- request,
301
- validityState,
302
- credential,
303
- selectiveDisclosureSupported,
304
- selectedFields,
305
- );
306
-
307
- const attributes: CredentialAttribute[] = displayedAttributes.map(({ claim, field, id, selected, status }, index) => {
308
- const disabled = !credential || !field || field.required || !claim;
309
- const attribute: CredentialAttribute = {
310
- ...shareCredentialCardAttributeFromClaim(
311
- id,
312
- config,
313
- concatTestID(testID, 'attribute', `${index}`),
314
- labels,
315
- language,
316
- claim,
317
- field,
318
- ),
319
- selected,
320
- };
321
-
322
- setStatusForNestedObjectOrArrayFields(attribute, status, disabled);
323
- return attribute;
324
- });
325
- return {
326
- attributes: nestAttributes(attributes),
327
- card,
328
- };
329
- };
330
-
331
- export const selectCredentialCardAttributeFromClaim = (
332
- id: string,
333
- config: CoreConfig,
334
- testID: string,
335
- labels: ShareCredentialCardLabels,
336
- language: string | undefined,
337
- claim?: FlatClaim,
338
- field?: PresentationDefinitionField,
339
- ): CredentialAttribute => {
340
- const attribute = shareCredentialCardAttributeFromClaim(id, config, testID, labels, language, claim, field);
341
- if (!claim) {
342
- return attribute;
343
- }
344
- return {
345
- ...attribute,
346
- rightAccessory: RequiredAttributeIcon,
347
- };
348
- };
349
-
350
- export const selectCredentialCardFromCredential = (
351
- credential: CredentialDetail,
352
- selected: boolean,
353
- request: PresentationDefinitionRequestedCredential,
354
- config: CoreConfig,
355
- testID: string,
356
- labels: ShareCredentialCardLabels,
357
- language: string | undefined,
358
- ): CredentialDetailsCardPropsWithoutWidth => {
359
- const selectiveDisclosureSupported = supportsSelectiveDisclosure(
360
- credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
361
- config,
362
- );
363
- const rightAccessory = <Selector status={selected ? SelectorStatus.SelectedRadio : SelectorStatus.Empty} />;
364
- const notice: CredentialCardNotice | undefined =
365
- selectiveDisclosureSupported === false
366
- ? {
367
- text: labels.selectiveDisclosure,
368
- noticeIcon: CredentialNoticeWarningIcon,
369
- }
370
- : undefined;
371
- const { header, ...cardProps } = getCredentialCardPropsFromCredential(
372
- credential,
373
- credential.claims,
374
- config,
375
- notice,
376
- testID,
377
- labels,
378
- language,
379
- );
380
- const card = {
381
- header: {
382
- ...header,
383
- accessory: rightAccessory,
384
- },
385
- ...cardProps,
386
- };
387
- const attributes: CredentialAttribute[] = getFullyNestedFields(request.fields, credential.id).map((field) => {
388
- const claim = spreadClaims(credential.claims).find(({ path }) => {
389
- return path === field.keyMap[credential.id];
390
- });
391
-
392
- const attribute = selectCredentialCardAttributeFromClaim(field.id, config, testID, labels, language, claim, field);
393
- return {
394
- ...attribute,
395
- rightAccessory: (
396
- <Selector status={field.required && !claim ? SelectorStatus.Rejected : SelectorStatus.Required} />
397
- ),
398
- };
399
- });
400
- return {
401
- attributes: nestAttributes(attributes),
402
- card,
403
- };
404
- };