@procivis/one-react-native-components 0.3.121 → 0.3.132
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.
- package/lib/commonjs/components/credential/credential.js +2 -1
- package/lib/commonjs/components/credential/credential.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item-icon.js +3 -3
- package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item.js +5 -12
- package/lib/commonjs/components/history/history-list-item.js.map +1 -1
- package/lib/commonjs/components/history/history-list-screen.js +1 -1
- package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
- package/lib/commonjs/components/index.js +0 -11
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/select-credential.js +2 -1
- package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js +2 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js +2 -1
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js +3 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +7 -3
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js +3 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
- package/lib/commonjs/ui-components/header/header.js.map +1 -1
- package/lib/commonjs/ui-components/history/history-details.js +2 -2
- package/lib/commonjs/ui-components/history/history-details.js.map +1 -1
- package/lib/commonjs/ui-components/history/history-section-list-item.js +2 -2
- package/lib/commonjs/ui-components/history/history-section-list-item.js.map +1 -1
- package/lib/commonjs/ui-components/history/index.js +0 -8
- package/lib/commonjs/ui-components/history/index.js.map +1 -1
- package/lib/commonjs/ui-components/icons/contact.js.map +1 -1
- package/lib/commonjs/ui-components/icons/credential.js +3 -3
- package/lib/commonjs/ui-components/icons/credential.js.map +1 -1
- package/lib/commonjs/ui-components/icons/icons.js +20 -1
- package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
- package/lib/commonjs/ui-components/list/index.js +8 -0
- package/lib/commonjs/ui-components/list/index.js.map +1 -1
- package/lib/commonjs/ui-components/{history/history-item.js → list/list-item.js} +32 -22
- package/lib/commonjs/ui-components/list/list-item.js.map +1 -0
- package/lib/commonjs/ui-components/loader/loading-result.js +2 -0
- package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js +7 -33
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/commonjs/utils/date.js +4 -5
- package/lib/commonjs/utils/date.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/cache.js +7 -4
- package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-config.js +1 -6
- package/lib/commonjs/utils/hooks/core/core-config.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-context.js +0 -15
- package/lib/commonjs/utils/hooks/core/core-context.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credentials.js +15 -1
- package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/index.js +0 -11
- package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/trust-list.js +19 -3
- package/lib/commonjs/utils/hooks/core/trust-list.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/verifier-instance.js +22 -3
- package/lib/commonjs/utils/hooks/core/verifier-instance.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js +2 -2
- package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js +23 -18
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing.js +20 -18
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +36 -22
- package/lib/commonjs/utils/parsers/credential.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.js +2 -2
- package/lib/commonjs/utils/parsers/query.js.map +1 -1
- package/lib/commonjs/utils/translations.js +15 -0
- package/lib/commonjs/utils/translations.js.map +1 -0
- package/lib/module/components/credential/credential.js +2 -1
- package/lib/module/components/credential/credential.js.map +1 -1
- package/lib/module/components/history/history-list-item-icon.js +3 -3
- package/lib/module/components/history/history-list-item-icon.js.map +1 -1
- package/lib/module/components/history/history-list-item.js +7 -14
- package/lib/module/components/history/history-list-item.js.map +1 -1
- package/lib/module/components/history/history-list-screen.js +1 -1
- package/lib/module/components/history/history-list-screen.js.map +1 -1
- package/lib/module/components/index.js +0 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/proof-request/v1/select-credential.js +2 -1
- package/lib/module/components/proof-request/v1/select-credential.js.map +1 -1
- package/lib/module/components/proof-request/v1/share-credential.js +2 -1
- package/lib/module/components/proof-request/v1/share-credential.js.map +1 -1
- package/lib/module/components/proof-request/v2/select-credential-v2.js +2 -1
- package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js +3 -1
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2.js +7 -3
- package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js +3 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/module/ui-components/header/foldable-header.js.map +1 -1
- package/lib/module/ui-components/header/header.js.map +1 -1
- package/lib/module/ui-components/history/history-details.js +3 -3
- package/lib/module/ui-components/history/history-details.js.map +1 -1
- package/lib/module/ui-components/history/history-section-list-item.js +2 -2
- package/lib/module/ui-components/history/history-section-list-item.js.map +1 -1
- package/lib/module/ui-components/history/index.js +0 -2
- package/lib/module/ui-components/history/index.js.map +1 -1
- package/lib/module/ui-components/icons/contact.js.map +1 -1
- package/lib/module/ui-components/icons/credential.js +1 -1
- package/lib/module/ui-components/icons/credential.js.map +1 -1
- package/lib/module/ui-components/icons/icons.js +18 -0
- package/lib/module/ui-components/icons/icons.js.map +1 -1
- package/lib/module/ui-components/list/index.js +2 -0
- package/lib/module/ui-components/list/index.js.map +1 -1
- package/lib/module/ui-components/{history/history-item.js → list/list-item.js} +32 -22
- package/lib/module/ui-components/list/list-item.js.map +1 -0
- package/lib/module/ui-components/loader/loading-result.js +2 -0
- package/lib/module/ui-components/loader/loading-result.js.map +1 -1
- package/lib/module/ui-components/screens/nerd-mode-screen.js +7 -33
- package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/module/utils/date.js +4 -5
- package/lib/module/utils/date.js.map +1 -1
- package/lib/module/utils/hooks/core/cache.js +7 -4
- package/lib/module/utils/hooks/core/cache.js.map +1 -1
- package/lib/module/utils/hooks/core/core-config.js +0 -4
- package/lib/module/utils/hooks/core/core-config.js.map +1 -1
- package/lib/module/utils/hooks/core/core-context.js +0 -15
- package/lib/module/utils/hooks/core/core-context.js.map +1 -1
- package/lib/module/utils/hooks/core/credentials.js +13 -0
- package/lib/module/utils/hooks/core/credentials.js.map +1 -1
- package/lib/module/utils/hooks/core/index.js +0 -1
- package/lib/module/utils/hooks/core/index.js.map +1 -1
- package/lib/module/utils/hooks/core/trust-list.js +20 -4
- package/lib/module/utils/hooks/core/trust-list.js.map +1 -1
- package/lib/module/utils/hooks/core/verifier-instance.js +20 -2
- package/lib/module/utils/hooks/core/verifier-instance.js.map +1 -1
- package/lib/module/utils/hooks/core/wallet-unit.js +2 -2
- package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing-v2.js +24 -19
- package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing.js +20 -18
- package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +37 -23
- package/lib/module/utils/parsers/credential.js.map +1 -1
- package/lib/module/utils/parsers/query.js +2 -2
- package/lib/module/utils/parsers/query.js.map +1 -1
- package/lib/module/utils/translations.js +8 -0
- package/lib/module/utils/translations.js.map +1 -0
- package/lib/typescript/components/credential/credential.d.ts +1 -0
- package/lib/typescript/components/history/history-list-item.d.ts +1 -1
- package/lib/typescript/components/index.d.ts +0 -1
- package/lib/typescript/components/proof-request/v1/select-credential.d.ts +1 -0
- package/lib/typescript/components/proof-request/v1/share-credential.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +1 -0
- package/lib/typescript/ui-components/history/history-details.d.ts +2 -2
- package/lib/typescript/ui-components/history/history-section-list-item.d.ts +2 -2
- package/lib/typescript/ui-components/history/index.d.ts +0 -3
- package/lib/typescript/ui-components/icons/credential.d.ts +1 -1
- package/lib/typescript/ui-components/icons/icons.d.ts +1 -0
- package/lib/typescript/ui-components/list/index.d.ts +3 -0
- package/lib/typescript/ui-components/{history/history-item.d.ts → list/list-item.d.ts} +4 -4
- package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +0 -12
- package/lib/typescript/utils/hooks/core/core-config.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/core-context.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/credentials.d.ts +1 -0
- package/lib/typescript/utils/hooks/core/index.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/trust-list.d.ts +1 -4
- package/lib/typescript/utils/hooks/core/verifier-instance.d.ts +2 -0
- package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +2 -2
- package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +3 -3
- package/lib/typescript/utils/parsers/credential-sharing.d.ts +6 -6
- package/lib/typescript/utils/parsers/credential.d.ts +5 -5
- package/lib/typescript/utils/parsers/query.d.ts +2 -2
- package/lib/typescript/utils/translations.d.ts +1 -0
- package/package.json +3 -3
- package/src/components/credential/credential.tsx +3 -0
- package/src/components/history/history-list-item-icon.tsx +2 -2
- package/src/components/history/history-list-item.tsx +7 -12
- package/src/components/history/history-list-screen.tsx +1 -1
- package/src/components/index.ts +0 -1
- package/src/components/proof-request/v1/select-credential.tsx +3 -1
- package/src/components/proof-request/v1/share-credential.tsx +3 -0
- package/src/components/proof-request/v2/select-credential-v2.tsx +3 -1
- package/src/components/proof-request/v2/share-credential-v2-group.tsx +4 -0
- package/src/components/proof-request/v2/share-credential-v2.tsx +7 -0
- package/src/ui-components/credential/card/credential-details-card.tsx +3 -2
- package/src/ui-components/header/foldable-header.tsx +10 -9
- package/src/ui-components/header/header.tsx +10 -1
- package/src/ui-components/history/history-details.tsx +4 -4
- package/src/ui-components/history/history-section-list-item.tsx +3 -3
- package/src/ui-components/history/index.ts +0 -3
- package/src/ui-components/icons/contact.tsx +1 -1
- package/src/ui-components/icons/credential.tsx +1 -1
- package/src/ui-components/icons/icons.tsx +18 -0
- package/src/ui-components/list/index.ts +3 -0
- package/src/ui-components/{history/history-item.tsx → list/list-item.tsx} +36 -33
- package/src/ui-components/loader/loading-result.tsx +7 -1
- package/src/ui-components/screens/nerd-mode-screen.tsx +2 -52
- package/src/utils/date.ts +7 -14
- package/src/utils/hooks/core/cache.ts +10 -3
- package/src/utils/hooks/core/core-config.ts +1 -6
- package/src/utils/hooks/core/core-context.tsx +0 -24
- package/src/utils/hooks/core/credentials.ts +13 -0
- package/src/utils/hooks/core/index.ts +0 -1
- package/src/utils/hooks/core/trust-list.ts +22 -11
- package/src/utils/hooks/core/verifier-instance.ts +23 -2
- package/src/utils/hooks/core/wallet-unit.ts +3 -3
- package/src/utils/parsers/credential-sharing-v2.tsx +34 -14
- package/src/utils/parsers/credential-sharing.tsx +33 -16
- package/src/utils/parsers/credential.ts +45 -14
- package/src/utils/parsers/query.ts +5 -0
- package/src/utils/translations.ts +10 -0
- package/lib/commonjs/components/entity/EntityButtons.js +0 -64
- package/lib/commonjs/components/entity/EntityButtons.js.map +0 -1
- package/lib/commonjs/components/entity/entity-attributes.js +0 -65
- package/lib/commonjs/components/entity/entity-attributes.js.map +0 -1
- package/lib/commonjs/components/entity/entity-details-with-buttons.js +0 -67
- package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +0 -1
- package/lib/commonjs/components/entity/entity-details.js +0 -101
- package/lib/commonjs/components/entity/entity-details.js.map +0 -1
- package/lib/commonjs/components/entity/index.js +0 -14
- package/lib/commonjs/components/entity/index.js.map +0 -1
- package/lib/commonjs/ui-components/history/history-item.js.map +0 -1
- package/lib/commonjs/utils/hooks/core/trust-entity.js +0 -147
- package/lib/commonjs/utils/hooks/core/trust-entity.js.map +0 -1
- package/lib/module/components/entity/EntityButtons.js +0 -56
- package/lib/module/components/entity/EntityButtons.js.map +0 -1
- package/lib/module/components/entity/entity-attributes.js +0 -57
- package/lib/module/components/entity/entity-attributes.js.map +0 -1
- package/lib/module/components/entity/entity-details-with-buttons.js +0 -58
- package/lib/module/components/entity/entity-details-with-buttons.js.map +0 -1
- package/lib/module/components/entity/entity-details.js +0 -92
- package/lib/module/components/entity/entity-details.js.map +0 -1
- package/lib/module/components/entity/index.js +0 -3
- package/lib/module/components/entity/index.js.map +0 -1
- package/lib/module/ui-components/history/history-item.js.map +0 -1
- package/lib/module/utils/hooks/core/trust-entity.js +0 -136
- package/lib/module/utils/hooks/core/trust-entity.js.map +0 -1
- package/lib/typescript/components/entity/EntityButtons.d.ts +0 -14
- package/lib/typescript/components/entity/entity-attributes.d.ts +0 -15
- package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +0 -18
- package/lib/typescript/components/entity/entity-details.d.ts +0 -21
- package/lib/typescript/components/entity/index.d.ts +0 -3
- package/lib/typescript/utils/hooks/core/trust-entity.d.ts +0 -17
- package/src/components/entity/EntityButtons.tsx +0 -79
- package/src/components/entity/entity-attributes.tsx +0 -80
- package/src/components/entity/entity-details-with-buttons.tsx +0 -75
- package/src/components/entity/entity-details.tsx +0 -145
- package/src/components/entity/index.ts +0 -4
- package/src/utils/hooks/core/trust-entity.ts +0 -172
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ClaimValue,
|
|
4
4
|
CoreConfig,
|
|
5
5
|
CredentialQueryFailureHint,
|
|
6
|
+
CredentialType,
|
|
6
7
|
PresentationDefinitionV2Claim,
|
|
7
8
|
PresentationDefinitionV2ClaimValue,
|
|
8
9
|
PresentationDefinitionV2Credential,
|
|
@@ -15,6 +16,7 @@ import {
|
|
|
15
16
|
CredentialCardProps,
|
|
16
17
|
CredentialNoticeWarningIcon,
|
|
17
18
|
CredentialWarningIcon,
|
|
19
|
+
PurposeInfoIcon,
|
|
18
20
|
Selector,
|
|
19
21
|
SelectorStatus,
|
|
20
22
|
} from '../../ui-components';
|
|
@@ -72,6 +74,7 @@ export const shareCredentialCardAttributeFromV2Claim = (
|
|
|
72
74
|
parentUserSelected: boolean,
|
|
73
75
|
config: CoreConfig,
|
|
74
76
|
testID: string,
|
|
77
|
+
language: string | undefined,
|
|
75
78
|
nested?: boolean,
|
|
76
79
|
listValue?: boolean,
|
|
77
80
|
): CredentialAttribute => {
|
|
@@ -82,7 +85,7 @@ export const shareCredentialCardAttributeFromV2Claim = (
|
|
|
82
85
|
const status = selection
|
|
83
86
|
? getAttributeSelectorStatus(claim, attributeShared, parentUserSelected || (attributeShared && !userSelected))
|
|
84
87
|
: undefined;
|
|
85
|
-
const attribute = detailsCardAttributeFromClaim(v2PresentationClaimToClaim(claim), config, testID);
|
|
88
|
+
const attribute = detailsCardAttributeFromClaim(v2PresentationClaimToClaim(claim), config, testID, language);
|
|
86
89
|
const disabledStatus = [SelectorStatus.Disabled, SelectorStatus.Rejected, SelectorStatus.Required];
|
|
87
90
|
const disabled = attribute.disabled || !status || disabledStatus.includes(status);
|
|
88
91
|
const credentialAttribute: CredentialAttribute = {
|
|
@@ -111,6 +114,7 @@ export const shareCredentialCardAttributeFromV2Claim = (
|
|
|
111
114
|
userSelected,
|
|
112
115
|
config,
|
|
113
116
|
testID,
|
|
117
|
+
language,
|
|
114
118
|
true,
|
|
115
119
|
false,
|
|
116
120
|
),
|
|
@@ -120,7 +124,16 @@ export const shareCredentialCardAttributeFromV2Claim = (
|
|
|
120
124
|
return {
|
|
121
125
|
...credentialAttribute,
|
|
122
126
|
attributes: claim.value.value.map((v) =>
|
|
123
|
-
shareCredentialCardAttributeFromV2Claim(
|
|
127
|
+
shareCredentialCardAttributeFromV2Claim(
|
|
128
|
+
v,
|
|
129
|
+
selection,
|
|
130
|
+
attributeShared,
|
|
131
|
+
userSelected,
|
|
132
|
+
config,
|
|
133
|
+
testID,
|
|
134
|
+
language,
|
|
135
|
+
true,
|
|
136
|
+
),
|
|
124
137
|
),
|
|
125
138
|
image: undefined,
|
|
126
139
|
value: undefined,
|
|
@@ -158,42 +171,46 @@ export const shareCredentialCardFromV2PresentationCredential = (
|
|
|
158
171
|
failureHint: CredentialQueryFailureHint | undefined,
|
|
159
172
|
expanded: boolean,
|
|
160
173
|
multipleCredentialsAvailable: boolean,
|
|
174
|
+
purpose: string | undefined,
|
|
161
175
|
selectedFields: string[] | undefined,
|
|
162
176
|
config: CoreConfig,
|
|
163
177
|
testID: string,
|
|
164
178
|
labels: ShareCredentialCardLabels,
|
|
179
|
+
language: string | undefined,
|
|
165
180
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
166
181
|
const selectiveDisclosureSupported = supportsSelectiveDisclosure(
|
|
167
|
-
credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
|
|
182
|
+
credential ? { ...credential, issuer: credential.issuer?.id, type: CredentialType.SINGLE } : undefined,
|
|
168
183
|
config,
|
|
169
184
|
);
|
|
170
|
-
const notice: CredentialCardNotice | undefined =
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
: undefined;
|
|
185
|
+
const notice: CredentialCardNotice | undefined = purpose
|
|
186
|
+
? {
|
|
187
|
+
noticeIcon: PurposeInfoIcon,
|
|
188
|
+
text: purpose,
|
|
189
|
+
}
|
|
190
|
+
: undefined;
|
|
177
191
|
const cardTestId = concatTestID(testID, 'card');
|
|
178
192
|
const card = credential
|
|
179
193
|
? validityCheckedCardFromCredential(
|
|
180
194
|
{
|
|
181
195
|
...credential,
|
|
182
196
|
claims: [],
|
|
197
|
+
type: CredentialType.SINGLE,
|
|
183
198
|
},
|
|
184
199
|
expanded,
|
|
200
|
+
selectiveDisclosureSupported,
|
|
185
201
|
multipleCredentialsAvailable,
|
|
186
202
|
config,
|
|
187
203
|
notice,
|
|
188
204
|
cardTestId,
|
|
189
205
|
labels,
|
|
206
|
+
language,
|
|
190
207
|
)
|
|
191
208
|
: missingCredentialCardFromFailureHint(failureHint, notice, cardTestId, labels);
|
|
192
209
|
|
|
193
210
|
return {
|
|
194
211
|
attributes:
|
|
195
212
|
credential?.claims.map((v) =>
|
|
196
|
-
shareCredentialCardAttributeFromV2Claim(v, selectedFields ?? [], true, false, config, testID),
|
|
213
|
+
shareCredentialCardAttributeFromV2Claim(v, selectedFields ?? [], true, false, config, testID, language),
|
|
197
214
|
) ?? [],
|
|
198
215
|
card,
|
|
199
216
|
};
|
|
@@ -206,9 +223,10 @@ export const selectCredentialCardFromV2Credential = (
|
|
|
206
223
|
config: CoreConfig,
|
|
207
224
|
testID: string,
|
|
208
225
|
labels: ShareCredentialCardLabels,
|
|
226
|
+
language: string | undefined,
|
|
209
227
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
210
228
|
const selectiveDisclosureSupported = supportsSelectiveDisclosure(
|
|
211
|
-
credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
|
|
229
|
+
credential ? { ...credential, issuer: credential.issuer?.id, type: CredentialType.SINGLE } : undefined,
|
|
212
230
|
config,
|
|
213
231
|
);
|
|
214
232
|
const selectedStatus = multiple ? SelectorStatus.SelectedCheckmark : SelectorStatus.SelectedRadio;
|
|
@@ -217,19 +235,21 @@ export const selectCredentialCardFromV2Credential = (
|
|
|
217
235
|
selectiveDisclosureSupported === false
|
|
218
236
|
? {
|
|
219
237
|
noticeIcon: CredentialNoticeWarningIcon,
|
|
220
|
-
text: labels.
|
|
238
|
+
text: labels.selectiveDisclosure,
|
|
221
239
|
}
|
|
222
240
|
: undefined;
|
|
223
241
|
const { header, ...cardProps } = getCredentialCardPropsFromCredential(
|
|
224
242
|
{
|
|
225
243
|
...credential,
|
|
226
244
|
claims: credential.claims.map(v2PresentationClaimToClaim),
|
|
245
|
+
type: CredentialType.SINGLE,
|
|
227
246
|
},
|
|
228
247
|
credential.claims.map(v2PresentationClaimToClaim),
|
|
229
248
|
config,
|
|
230
249
|
notice,
|
|
231
250
|
testID,
|
|
232
251
|
labels,
|
|
252
|
+
language,
|
|
233
253
|
);
|
|
234
254
|
const card = {
|
|
235
255
|
header: {
|
|
@@ -241,7 +261,7 @@ export const selectCredentialCardFromV2Credential = (
|
|
|
241
261
|
return {
|
|
242
262
|
attributes:
|
|
243
263
|
credential?.claims.map((v) =>
|
|
244
|
-
shareCredentialCardAttributeFromV2Claim(v, undefined, false, false, config, testID),
|
|
264
|
+
shareCredentialCardAttributeFromV2Claim(v, undefined, false, false, config, testID, language),
|
|
245
265
|
) ?? [],
|
|
246
266
|
card,
|
|
247
267
|
};
|
|
@@ -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 (
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
292
|
+
undefined,
|
|
281
293
|
cardTestId,
|
|
282
294
|
labels,
|
|
295
|
+
language,
|
|
283
296
|
)
|
|
284
|
-
: missingCredentialCardFromRequest(request,
|
|
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.
|
|
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 {
|
|
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 = (
|
|
72
|
-
|
|
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:
|
|
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 {
|
|
@@ -47,6 +47,8 @@ export const getQueryKeyFromCredentialListQueryParams = (queryParams: Partial<Cr
|
|
|
47
47
|
'issuanceDateBefore',
|
|
48
48
|
'revocationDateAfter',
|
|
49
49
|
'revocationDateBefore',
|
|
50
|
+
'types',
|
|
51
|
+
'parentId',
|
|
50
52
|
]);
|
|
51
53
|
};
|
|
52
54
|
|
|
@@ -86,7 +88,10 @@ export const getQueryKeyFromCredentialSchemaListQueryParams = (
|
|
|
86
88
|
'ids',
|
|
87
89
|
'include',
|
|
88
90
|
'schemaId',
|
|
91
|
+
'schemaIds',
|
|
89
92
|
'formats',
|
|
93
|
+
'usesBatchIssuance',
|
|
94
|
+
'isMultiformatSchema',
|
|
90
95
|
'createdDateAfter',
|
|
91
96
|
'createdDateBefore',
|
|
92
97
|
'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
|
+
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _buttons = require("../../ui-components/buttons");
|
|
10
|
-
var _utils = require("../../utils");
|
|
11
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
-
const EntityButtons = ({
|
|
14
|
-
entity,
|
|
15
|
-
labels,
|
|
16
|
-
testID
|
|
17
|
-
}) => {
|
|
18
|
-
const buttons = (0, _react.useMemo)(() => [{
|
|
19
|
-
label: labels.visitWebsite,
|
|
20
|
-
url: (entity === null || entity === void 0 ? void 0 : entity.website) || '',
|
|
21
|
-
testID: 'website'
|
|
22
|
-
}, {
|
|
23
|
-
label: labels.termsAndServices,
|
|
24
|
-
url: (entity === null || entity === void 0 ? void 0 : entity.termsUrl) || '',
|
|
25
|
-
testID: 'termsOfService'
|
|
26
|
-
}, {
|
|
27
|
-
label: labels.privacyPolicy,
|
|
28
|
-
url: (entity === null || entity === void 0 ? void 0 : entity.privacyUrl) || '',
|
|
29
|
-
testID: 'privacyPolicy'
|
|
30
|
-
}].filter(btn => Boolean(btn.url)), [entity, labels]);
|
|
31
|
-
const openURL = (0, _react.useCallback)(url => () => {
|
|
32
|
-
_reactNative.Linking.openURL(url).catch(e => {
|
|
33
|
-
(0, _utils.reportException)(e, 'Error opening entity link');
|
|
34
|
-
});
|
|
35
|
-
}, []);
|
|
36
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
37
|
-
style: [styles.buttons],
|
|
38
|
-
testID: testID
|
|
39
|
-
}, buttons.map(({
|
|
40
|
-
label,
|
|
41
|
-
url,
|
|
42
|
-
testID: testIdSuffix
|
|
43
|
-
}) => /*#__PURE__*/_react.default.createElement(_buttons.Button, {
|
|
44
|
-
key: label,
|
|
45
|
-
title: label,
|
|
46
|
-
onPress: openURL(url),
|
|
47
|
-
style: styles.urlButton,
|
|
48
|
-
testID: (0, _utils.concatTestID)(testID, testIdSuffix),
|
|
49
|
-
type: _buttons.ButtonType.SmallTech
|
|
50
|
-
})));
|
|
51
|
-
};
|
|
52
|
-
const styles = _reactNative.StyleSheet.create({
|
|
53
|
-
buttons: {
|
|
54
|
-
paddingBottom: 10,
|
|
55
|
-
paddingHorizontal: 12
|
|
56
|
-
},
|
|
57
|
-
urlButton: {
|
|
58
|
-
borderRadius: 4,
|
|
59
|
-
borderWidth: 0,
|
|
60
|
-
marginTop: 4
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(EntityButtons);
|
|
64
|
-
//# sourceMappingURL=EntityButtons.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_buttons","_utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","EntityButtons","entity","labels","testID","buttons","useMemo","label","visitWebsite","url","website","termsAndServices","termsUrl","privacyPolicy","privacyUrl","filter","btn","Boolean","openURL","useCallback","Linking","catch","reportException","createElement","View","style","styles","map","testIdSuffix","Button","key","title","onPress","urlButton","concatTestID","type","ButtonType","SmallTech","StyleSheet","create","paddingBottom","paddingHorizontal","borderRadius","borderWidth","marginTop","_default","exports","memo"],"sources":["EntityButtons.tsx"],"sourcesContent":["import { TrustEntityDetail } from '@procivis/react-native-one-core';\nimport React, { FC, memo, useCallback, useMemo } from 'react';\nimport { Linking, StyleSheet, View } from 'react-native';\n\nimport { Button, ButtonType } from '../../ui-components/buttons';\nimport { EntityLabels } from '../../ui-components/screens/nerd-mode-screen';\nimport { concatTestID, reportException } from '../../utils';\n\nexport interface EntityButton {\n url: string;\n label: string;\n}\n\ninterface EntityButtonsProps {\n entity?: TrustEntityDetail;\n labels: EntityLabels;\n testID?: string;\n}\n\nconst EntityButtons: FC<EntityButtonsProps> = ({ entity, labels, testID }) => {\n const buttons = useMemo(\n () =>\n [\n {\n label: labels.visitWebsite,\n url: entity?.website || '',\n testID: 'website',\n },\n {\n label: labels.termsAndServices,\n url: entity?.termsUrl || '',\n testID: 'termsOfService',\n },\n {\n label: labels.privacyPolicy,\n url: entity?.privacyUrl || '',\n testID: 'privacyPolicy',\n },\n ].filter((btn) => Boolean(btn.url)),\n [entity, labels],\n );\n\n const openURL = useCallback(\n (url: string) => () => {\n Linking.openURL(url).catch((e) => {\n reportException(e, 'Error opening entity link');\n });\n },\n [],\n );\n return (\n <View style={[styles.buttons]} testID={testID}>\n {buttons.map(({ label, url, testID: testIdSuffix }) => (\n <Button\n key={label}\n title={label}\n onPress={openURL(url)}\n style={styles.urlButton}\n testID={concatTestID(testID, testIdSuffix)}\n type={ButtonType.SmallTech}\n />\n ))}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n buttons: {\n paddingBottom: 10,\n paddingHorizontal: 12,\n },\n urlButton: {\n borderRadius: 4,\n borderWidth: 0,\n marginTop: 4,\n },\n});\n\nexport default memo(EntityButtons);\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _nerdView = require("../../ui-components/nerd-view");
|
|
10
|
-
var _nerdModeScreen = require("../../ui-components/screens/nerd-mode-screen");
|
|
11
|
-
var _array = require("../../utils/array");
|
|
12
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
15
|
-
const EntityAttributes = ({
|
|
16
|
-
certificate,
|
|
17
|
-
did,
|
|
18
|
-
trustEntity,
|
|
19
|
-
trusted,
|
|
20
|
-
labels,
|
|
21
|
-
entityType,
|
|
22
|
-
testID,
|
|
23
|
-
onCopyToClipboard
|
|
24
|
-
}) => {
|
|
25
|
-
var _did$split;
|
|
26
|
-
const didSections = (_did$split = did === null || did === void 0 ? void 0 : did.split(':')) !== null && _did$split !== void 0 ? _did$split : [];
|
|
27
|
-
const identifier = didSections.pop();
|
|
28
|
-
const didMethod = didSections.length ? didSections.join(':') + ':' : '';
|
|
29
|
-
const attributes = [...(0, _array.addElementIf)(trusted, {
|
|
30
|
-
attributeKey: labels.trustRegistry,
|
|
31
|
-
highlightedText: trustEntity === null || trustEntity === void 0 ? void 0 : trustEntity.trustAnchor.name,
|
|
32
|
-
testID: 'trustRegistry'
|
|
33
|
-
}), ...(0, _array.addElementIf)(Boolean(did), {
|
|
34
|
-
attributeKey: entityType === _nerdModeScreen.EntityType.CredentialEntity ? labels.issuerIdentifier : labels.entityIdentifier,
|
|
35
|
-
attributeText: identifier,
|
|
36
|
-
canBeCopied: true,
|
|
37
|
-
highlightedText: didMethod,
|
|
38
|
-
testID: 'issuerDID'
|
|
39
|
-
}), ...(0, _array.addElementIf)(Boolean(certificate), {
|
|
40
|
-
attributeKey: entityType === _nerdModeScreen.EntityType.CredentialEntity ? labels.issuerIdentifier : labels.entityIdentifier,
|
|
41
|
-
attributeText: certificate,
|
|
42
|
-
canBeCopied: true,
|
|
43
|
-
testID: 'issuerCertificate'
|
|
44
|
-
}), ...(0, _array.addElementIf)(trusted && Boolean(trustEntity === null || trustEntity === void 0 ? void 0 : trustEntity.role), {
|
|
45
|
-
attributeKey: labels.role,
|
|
46
|
-
highlightedText: trustEntity === null || trustEntity === void 0 ? void 0 : trustEntity.role,
|
|
47
|
-
testID: 'role'
|
|
48
|
-
})];
|
|
49
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
50
|
-
style: styles.wrapper
|
|
51
|
-
}, attributes.map(attribute => /*#__PURE__*/_react.default.createElement(_nerdView.NerdModeItem, _extends({
|
|
52
|
-
key: attribute.attributeKey
|
|
53
|
-
}, attribute, {
|
|
54
|
-
labels: labels,
|
|
55
|
-
onCopyToClipboard: onCopyToClipboard,
|
|
56
|
-
testID: testID
|
|
57
|
-
}))));
|
|
58
|
-
};
|
|
59
|
-
const styles = _reactNative.StyleSheet.create({
|
|
60
|
-
wrapper: {
|
|
61
|
-
marginBottom: 20
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(EntityAttributes);
|
|
65
|
-
//# sourceMappingURL=entity-attributes.js.map
|