@procivis/one-react-native-components 0.3.86 → 0.3.91
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 -8
- package/lib/commonjs/components/credential/credential.js.map +1 -1
- package/lib/commonjs/components/entity/entity-attributes.js +3 -1
- package/lib/commonjs/components/entity/entity-attributes.js.map +1 -1
- package/lib/commonjs/components/entity/entity-details-with-buttons.js +2 -1
- package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/select-credential.js +2 -8
- package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js +2 -8
- 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 -6
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +2 -6
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/cache.js +4 -1
- package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credentials.js +1 -7
- package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/proofs.js +2 -5
- package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js +28 -37
- package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/commonjs/utils/index.js +0 -12
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js +4 -4
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing.js +6 -6
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +9 -25
- package/lib/commonjs/utils/parsers/credential.js.map +1 -1
- package/lib/module/components/credential/credential.js +2 -8
- package/lib/module/components/credential/credential.js.map +1 -1
- package/lib/module/components/entity/entity-attributes.js +3 -1
- package/lib/module/components/entity/entity-attributes.js.map +1 -1
- package/lib/module/components/entity/entity-details-with-buttons.js +2 -1
- package/lib/module/components/entity/entity-details-with-buttons.js.map +1 -1
- package/lib/module/components/proof-request/v1/select-credential.js +2 -8
- package/lib/module/components/proof-request/v1/select-credential.js.map +1 -1
- package/lib/module/components/proof-request/v1/share-credential.js +2 -8
- package/lib/module/components/proof-request/v1/share-credential.js.map +1 -1
- package/lib/module/components/proof-request/v2/select-credential-v2.js +3 -7
- package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2.js +3 -7
- package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/module/utils/hooks/core/cache.js +4 -1
- package/lib/module/utils/hooks/core/cache.js.map +1 -1
- package/lib/module/utils/hooks/core/credentials.js +1 -7
- package/lib/module/utils/hooks/core/credentials.js.map +1 -1
- package/lib/module/utils/hooks/core/proofs.js +2 -5
- package/lib/module/utils/hooks/core/proofs.js.map +1 -1
- package/lib/module/utils/hooks/core/wallet-unit.js +26 -35
- package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/module/utils/index.js +0 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing-v2.js +4 -4
- package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing.js +6 -6
- package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +10 -26
- package/lib/module/utils/parsers/credential.js.map +1 -1
- package/lib/typescript/components/entity/entity-attributes.d.ts +1 -0
- package/lib/typescript/utils/hooks/core/credentials.d.ts +1 -0
- package/lib/typescript/utils/hooks/core/proofs.d.ts +0 -3
- package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +7 -7
- package/lib/typescript/utils/index.d.ts +0 -1
- package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +2 -3
- package/lib/typescript/utils/parsers/credential-sharing.d.ts +3 -4
- package/lib/typescript/utils/parsers/credential.d.ts +6 -10
- package/package.json +4 -4
- package/src/components/credential/credential.tsx +1 -5
- package/src/components/entity/entity-attributes.tsx +3 -0
- package/src/components/entity/entity-details-with-buttons.tsx +1 -0
- package/src/components/proof-request/v1/select-credential.tsx +1 -5
- package/src/components/proof-request/v1/share-credential.tsx +1 -5
- package/src/components/proof-request/v2/select-credential-v2.tsx +2 -9
- package/src/components/proof-request/v2/share-credential-v2.tsx +2 -11
- package/src/utils/hooks/core/cache.ts +3 -0
- package/src/utils/hooks/core/credentials.ts +3 -2
- package/src/utils/hooks/core/proofs.ts +4 -10
- package/src/utils/hooks/core/wallet-unit.ts +31 -37
- package/src/utils/index.ts +0 -1
- package/src/utils/parsers/credential-sharing-v2.tsx +0 -5
- package/src/utils/parsers/credential-sharing.tsx +34 -35
- package/src/utils/parsers/credential.ts +3 -30
- package/lib/commonjs/utils/wallet-unit.js +0 -30
- package/lib/commonjs/utils/wallet-unit.js.map +0 -1
- package/lib/module/utils/wallet-unit.js +0 -22
- package/lib/module/utils/wallet-unit.js.map +0 -1
- package/lib/typescript/utils/wallet-unit.d.ts +0 -8
- package/src/utils/wallet-unit.ts +0 -30
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import { WalletProvider,
|
|
1
|
+
import { HolderWalletUnitDetail, WalletProvider, WalletUnitStatus } from '@procivis/react-native-one-core';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
4
4
|
|
|
5
5
|
import { reportException } from '../../reporting';
|
|
6
6
|
import { useONECore } from './core-context';
|
|
7
7
|
|
|
8
|
-
export const
|
|
8
|
+
export const WALLET_UNIT_QUERY_KEY = 'wallet-unit';
|
|
9
9
|
|
|
10
|
-
export const
|
|
11
|
-
const { core
|
|
10
|
+
export const useWalletUnitDetail = (walletUnitId: HolderWalletUnitDetail['id'] | undefined, active = true) => {
|
|
11
|
+
const { core } = useONECore();
|
|
12
12
|
|
|
13
|
-
return useQuery(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
return useQuery(
|
|
14
|
+
[WALLET_UNIT_QUERY_KEY, walletUnitId],
|
|
15
|
+
() => (walletUnitId ? core.holderGetWalletUnit(walletUnitId) : undefined),
|
|
16
|
+
{
|
|
17
|
+
enabled: active && Boolean(walletUnitId),
|
|
18
|
+
keepPreviousData: true,
|
|
19
|
+
},
|
|
20
|
+
);
|
|
18
21
|
};
|
|
19
22
|
|
|
20
23
|
export const useRegisterWalletUnit = () => {
|
|
@@ -22,56 +25,47 @@ export const useRegisterWalletUnit = () => {
|
|
|
22
25
|
const { core, organisationId } = useONECore();
|
|
23
26
|
|
|
24
27
|
return useMutation(
|
|
25
|
-
async (walletProvider: WalletProvider) =>
|
|
26
|
-
|
|
28
|
+
async (walletProvider: WalletProvider) =>
|
|
29
|
+
core.holderRegisterWalletUnit({
|
|
27
30
|
keyType: 'ECDSA',
|
|
28
31
|
organisationId,
|
|
29
32
|
walletProvider,
|
|
30
|
-
})
|
|
33
|
+
}),
|
|
31
34
|
|
|
32
|
-
return result;
|
|
33
|
-
},
|
|
34
35
|
{
|
|
35
|
-
onSuccess: () => queryClient.invalidateQueries(
|
|
36
|
+
onSuccess: () => queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY),
|
|
36
37
|
},
|
|
37
38
|
);
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
export const
|
|
41
|
+
export const useWalletUnitStatus = () => {
|
|
41
42
|
const queryClient = useQueryClient();
|
|
42
|
-
const { core
|
|
43
|
+
const { core } = useONECore();
|
|
43
44
|
|
|
44
|
-
return useMutation(
|
|
45
|
-
async (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
organisationId,
|
|
49
|
-
}),
|
|
50
|
-
{
|
|
51
|
-
onError: async (err) => {
|
|
52
|
-
reportException(err, 'Refresh wallet unit failure');
|
|
53
|
-
await queryClient.invalidateQueries([ATTESTATION_QUERY_KEY, organisationId]);
|
|
54
|
-
},
|
|
55
|
-
onSuccess: () => queryClient.invalidateQueries([ATTESTATION_QUERY_KEY, organisationId]),
|
|
45
|
+
return useMutation(async (walletUnitId: HolderWalletUnitDetail['id']) => core.holderWalletUnitStatus(walletUnitId), {
|
|
46
|
+
onError: async (err) => {
|
|
47
|
+
reportException(err, 'Refresh wallet unit failure');
|
|
48
|
+
await queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY);
|
|
56
49
|
},
|
|
57
|
-
|
|
50
|
+
onSuccess: () => queryClient.invalidateQueries(WALLET_UNIT_QUERY_KEY),
|
|
51
|
+
});
|
|
58
52
|
};
|
|
59
53
|
|
|
60
|
-
export const useWalletUnitCheck = (
|
|
61
|
-
const { data:
|
|
62
|
-
const { mutateAsync: refreshWalletUnit, isLoading: isRefreshing, status: refreshStatus } =
|
|
54
|
+
export const useWalletUnitCheck = (walletUnitId: HolderWalletUnitDetail['id'] | undefined) => {
|
|
55
|
+
const { data: walletUnitDetail, isLoading } = useWalletUnitDetail(walletUnitId);
|
|
56
|
+
const { mutateAsync: refreshWalletUnit, isLoading: isRefreshing, status: refreshStatus } = useWalletUnitStatus();
|
|
63
57
|
|
|
64
58
|
useEffect(() => {
|
|
65
59
|
if (isLoading || refreshStatus !== 'idle') {
|
|
66
60
|
return;
|
|
67
61
|
}
|
|
68
|
-
if (
|
|
69
|
-
void refreshWalletUnit(
|
|
62
|
+
if (walletUnitId && walletUnitDetail?.status === WalletUnitStatus.ACTIVE) {
|
|
63
|
+
void refreshWalletUnit(walletUnitId);
|
|
70
64
|
}
|
|
71
|
-
}, [isLoading, refreshStatus,
|
|
65
|
+
}, [isLoading, refreshStatus, walletUnitDetail, refreshWalletUnit, walletUnitId]);
|
|
72
66
|
|
|
73
67
|
return {
|
|
74
68
|
isLoading: isLoading || isRefreshing,
|
|
75
|
-
|
|
69
|
+
walletUnitDetail: isLoading || isRefreshing ? undefined : walletUnitDetail,
|
|
76
70
|
};
|
|
77
71
|
};
|
package/src/utils/index.ts
CHANGED
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
SelectorStatus,
|
|
20
20
|
} from '../../ui-components';
|
|
21
21
|
import { concatTestID } from '../testID';
|
|
22
|
-
import { WUAState } from '../wallet-unit';
|
|
23
22
|
import {
|
|
24
23
|
CredentialDetailsCardPropsWithoutWidth,
|
|
25
24
|
detailsCardAttributeFromClaim,
|
|
@@ -179,7 +178,6 @@ export const shareCredentialCardFromV2PresentationCredential = (
|
|
|
179
178
|
multipleCredentialsAvailable: boolean,
|
|
180
179
|
selectedFields: string[] | undefined,
|
|
181
180
|
config: Config,
|
|
182
|
-
wuaState: WUAState | undefined,
|
|
183
181
|
testID: string,
|
|
184
182
|
labels: ShareCredentialCardLabels,
|
|
185
183
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
@@ -205,7 +203,6 @@ export const shareCredentialCardFromV2PresentationCredential = (
|
|
|
205
203
|
expanded,
|
|
206
204
|
multipleCredentialsAvailable,
|
|
207
205
|
config,
|
|
208
|
-
wuaState,
|
|
209
206
|
notice,
|
|
210
207
|
cardTestId,
|
|
211
208
|
labels,
|
|
@@ -226,7 +223,6 @@ export const selectCredentialCardFromV2Credential = (
|
|
|
226
223
|
selected: boolean,
|
|
227
224
|
multiple: boolean,
|
|
228
225
|
config: Config,
|
|
229
|
-
wuaState: WUAState | undefined,
|
|
230
226
|
testID: string,
|
|
231
227
|
labels: ShareCredentialCardLabels,
|
|
232
228
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
@@ -250,7 +246,6 @@ export const selectCredentialCardFromV2Credential = (
|
|
|
250
246
|
},
|
|
251
247
|
credential.claims.map(v2PresentationClaimToClaim),
|
|
252
248
|
config,
|
|
253
|
-
wuaState,
|
|
254
249
|
notice,
|
|
255
250
|
testID,
|
|
256
251
|
labels,
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
import { CredentialCardNotice } from '../../ui-components/credential/card/credential-card';
|
|
18
18
|
import { CredentialNoticeWarningIcon, CredentialWarningIcon, RequiredAttributeIcon } from '../../ui-components/icons';
|
|
19
19
|
import { concatTestID } from '../testID';
|
|
20
|
-
import { WUAState } from '../wallet-unit';
|
|
21
20
|
import {
|
|
22
21
|
CardLabels,
|
|
23
22
|
CredentialDetailsCardPropsWithoutWidth,
|
|
@@ -35,20 +34,19 @@ export const validityCheckedCardFromCredential = (
|
|
|
35
34
|
expanded: boolean,
|
|
36
35
|
multipleCredentialsAvailable: boolean,
|
|
37
36
|
config: Config,
|
|
38
|
-
wuaState: WUAState | undefined,
|
|
39
37
|
notice: CredentialCardNotice | undefined,
|
|
40
38
|
testID: string,
|
|
41
39
|
labels: ShareCredentialCardLabels,
|
|
42
40
|
): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'testID' | 'width'> => {
|
|
43
41
|
let credentialHeaderDetail:
|
|
44
42
|
| Pick<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
CredentialHeaderProps,
|
|
44
|
+
| 'credentialDetailPrimary'
|
|
45
|
+
| 'credentialDetailSecondary'
|
|
46
|
+
| 'credentialDetailErrorColor'
|
|
47
|
+
| 'credentialDetailTestID'
|
|
48
|
+
| 'statusIcon'
|
|
49
|
+
>
|
|
52
50
|
| undefined;
|
|
53
51
|
if (invalidLVVC) {
|
|
54
52
|
credentialHeaderDetail = {
|
|
@@ -64,7 +62,7 @@ export const validityCheckedCardFromCredential = (
|
|
|
64
62
|
};
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
const card = getCredentialCardPropsFromCredential(credential, credential.claims, config,
|
|
65
|
+
const card = getCredentialCardPropsFromCredential(credential, credential.claims, config, notice, testID, labels);
|
|
68
66
|
return {
|
|
69
67
|
...card,
|
|
70
68
|
header: {
|
|
@@ -167,7 +165,9 @@ const getDisplayedAttributes = (
|
|
|
167
165
|
|
|
168
166
|
let fields = request.fields;
|
|
169
167
|
if (credential) {
|
|
170
|
-
const fieldsWithNoKeyMapping = request.fields
|
|
168
|
+
const fieldsWithNoKeyMapping = request.fields
|
|
169
|
+
.filter((field) => !(credential.id in field.keyMap))
|
|
170
|
+
.filter((field) => !isApplicable || !field.required);
|
|
171
171
|
const fullyNestedFields = getFullyNestedFields(request.fields, credential.id);
|
|
172
172
|
|
|
173
173
|
fields = [...fieldsWithNoKeyMapping, ...fullyNestedFields];
|
|
@@ -177,7 +177,7 @@ const getDisplayedAttributes = (
|
|
|
177
177
|
const selected = !field.required && selectedFields?.includes(field.id);
|
|
178
178
|
const claim = credential
|
|
179
179
|
? claims?.find(({ path }) => {
|
|
180
|
-
|
|
180
|
+
return path === field.keyMap[credential.id];
|
|
181
181
|
})
|
|
182
182
|
: undefined;
|
|
183
183
|
const status =
|
|
@@ -209,7 +209,12 @@ export const shareCredentialCardAttributeFromClaim = (
|
|
|
209
209
|
field?: PresentationDefinitionField,
|
|
210
210
|
): CredentialAttribute => {
|
|
211
211
|
if (claim) {
|
|
212
|
-
return {
|
|
212
|
+
return {
|
|
213
|
+
...detailsCardAttributeFromClaim(claim, config, testID),
|
|
214
|
+
id,
|
|
215
|
+
path: claim.path,
|
|
216
|
+
listValue: claim.isArrayElement,
|
|
217
|
+
};
|
|
213
218
|
}
|
|
214
219
|
return {
|
|
215
220
|
id,
|
|
@@ -269,7 +274,6 @@ export const shareCredentialCardFromCredential = (
|
|
|
269
274
|
request: PresentationDefinitionRequestedCredential,
|
|
270
275
|
selectedFields: string[] | undefined,
|
|
271
276
|
config: Config,
|
|
272
|
-
wuaState: WUAState | undefined,
|
|
273
277
|
testID: string,
|
|
274
278
|
labels: ShareCredentialCardLabels,
|
|
275
279
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
@@ -280,27 +284,24 @@ export const shareCredentialCardFromCredential = (
|
|
|
280
284
|
const notice: CredentialCardNotice | undefined =
|
|
281
285
|
selectiveDisclosureSupported === false
|
|
282
286
|
? {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
287
|
+
text: labels.selectiveDisclosureNotice,
|
|
288
|
+
noticeIcon: CredentialNoticeWarningIcon,
|
|
289
|
+
}
|
|
286
290
|
: undefined;
|
|
287
291
|
const cardTestId = concatTestID(testID, 'card');
|
|
288
292
|
const card = credential
|
|
289
293
|
? validityCheckedCardFromCredential(
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
)
|
|
294
|
+
credential,
|
|
295
|
+
invalidLVVC,
|
|
296
|
+
expanded,
|
|
297
|
+
multipleCredentialsAvailable,
|
|
298
|
+
config,
|
|
299
|
+
notice,
|
|
300
|
+
cardTestId,
|
|
301
|
+
labels,
|
|
302
|
+
)
|
|
300
303
|
: missingCredentialCardFromRequest(request, notice, cardTestId, labels);
|
|
301
|
-
const validityState = getValidityState(
|
|
302
|
-
credential ? { ...credential, issuer: credential.issuer?.id } : undefined,
|
|
303
|
-
);
|
|
304
|
+
const validityState = getValidityState(credential ? { ...credential, issuer: credential.issuer?.id } : undefined);
|
|
304
305
|
const displayedAttributes = getDisplayedAttributes(
|
|
305
306
|
request,
|
|
306
307
|
validityState,
|
|
@@ -355,7 +356,6 @@ export const selectCredentialCardFromCredential = (
|
|
|
355
356
|
selected: boolean,
|
|
356
357
|
request: PresentationDefinitionRequestedCredential,
|
|
357
358
|
config: Config,
|
|
358
|
-
wuaState: WUAState | undefined,
|
|
359
359
|
testID: string,
|
|
360
360
|
labels: ShareCredentialCardLabels,
|
|
361
361
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
@@ -367,15 +367,14 @@ export const selectCredentialCardFromCredential = (
|
|
|
367
367
|
const notice: CredentialCardNotice | undefined =
|
|
368
368
|
selectiveDisclosureSupported === false
|
|
369
369
|
? {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
370
|
+
text: labels.selectiveDisclosureNotice,
|
|
371
|
+
noticeIcon: CredentialNoticeWarningIcon,
|
|
372
|
+
}
|
|
373
373
|
: undefined;
|
|
374
374
|
const { header, ...cardProps } = getCredentialCardPropsFromCredential(
|
|
375
375
|
credential,
|
|
376
376
|
credential.claims,
|
|
377
377
|
config,
|
|
378
|
-
wuaState,
|
|
379
378
|
notice,
|
|
380
379
|
testID,
|
|
381
380
|
labels,
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
CredentialStateEnum,
|
|
8
8
|
DataTypeEnum,
|
|
9
9
|
FormatFeatureEnum,
|
|
10
|
-
WalletStorageType,
|
|
11
10
|
} from '@procivis/react-native-one-core';
|
|
12
11
|
import { FC } from 'react';
|
|
13
12
|
import { SvgProps } from 'react-native-svg';
|
|
@@ -23,7 +22,6 @@ import { CredentialCardNotice } from '../../ui-components/credential/card/creden
|
|
|
23
22
|
import { CredentialErrorIcon, CredentialNoticeWarningIcon, CredentialWarningIcon } from '../../ui-components/icons';
|
|
24
23
|
import { formatDateLocalized, formatDateTimeLocalized } from '../date';
|
|
25
24
|
import { concatTestID } from '../testID';
|
|
26
|
-
import { WUAState } from '../wallet-unit';
|
|
27
25
|
import { getCarouselImagesFromClaims } from './credential-images';
|
|
28
26
|
|
|
29
27
|
export enum ValidityState {
|
|
@@ -86,15 +84,12 @@ export type CardHeaderLabels = {
|
|
|
86
84
|
revoked: string;
|
|
87
85
|
suspended: string;
|
|
88
86
|
suspendedUntil: (date: string) => string;
|
|
89
|
-
wuaExpired: string;
|
|
90
|
-
wuaRevoked: string;
|
|
91
87
|
};
|
|
92
88
|
|
|
93
89
|
const credentialDetailFromCredential = (
|
|
94
90
|
credential: CredentialDetail,
|
|
95
91
|
claims: Claim[] = [],
|
|
96
92
|
config: Config,
|
|
97
|
-
wuaState: WUAState | undefined,
|
|
98
93
|
testID: string,
|
|
99
94
|
labels: CardHeaderLabels,
|
|
100
95
|
): {
|
|
@@ -106,15 +101,6 @@ const credentialDetailFromCredential = (
|
|
|
106
101
|
} => {
|
|
107
102
|
const { layoutProperties } = credential.schema;
|
|
108
103
|
|
|
109
|
-
if (credential.schema.walletStorageType === WalletStorageType.EUDI_COMPLIANT && wuaState === WUAState.Revoked) {
|
|
110
|
-
return {
|
|
111
|
-
credentialDetailPrimary: labels.wuaRevoked,
|
|
112
|
-
credentialDetailErrorColor: true,
|
|
113
|
-
credentialDetailTestID: concatTestID(testID, 'wua', 'revoked'),
|
|
114
|
-
statusIcon: CredentialErrorIcon,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
104
|
switch (credential.state) {
|
|
119
105
|
case CredentialStateEnum.SUSPENDED:
|
|
120
106
|
return {
|
|
@@ -133,14 +119,6 @@ const credentialDetailFromCredential = (
|
|
|
133
119
|
};
|
|
134
120
|
}
|
|
135
121
|
|
|
136
|
-
if (credential.schema.walletStorageType === WalletStorageType.EUDI_COMPLIANT && wuaState === WUAState.Expired) {
|
|
137
|
-
return {
|
|
138
|
-
credentialDetailPrimary: labels.wuaExpired,
|
|
139
|
-
credentialDetailTestID: concatTestID(testID, 'wua', 'suspended'),
|
|
140
|
-
statusIcon: CredentialWarningIcon,
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
122
|
if (hasMsoValidityIssues(credential)) {
|
|
145
123
|
return {
|
|
146
124
|
credentialDetailPrimary: labels.validityIssues,
|
|
@@ -176,7 +154,6 @@ export const cardHeaderFromCredential = (
|
|
|
176
154
|
credential: CredentialDetail,
|
|
177
155
|
claims: Claim[] = [],
|
|
178
156
|
config: Config,
|
|
179
|
-
wuaState: WUAState | undefined,
|
|
180
157
|
testID: string,
|
|
181
158
|
labels: CardHeaderLabels,
|
|
182
159
|
): Omit<CredentialHeaderProps, 'style'> => {
|
|
@@ -186,7 +163,7 @@ export const cardHeaderFromCredential = (
|
|
|
186
163
|
credentialDetailErrorColor,
|
|
187
164
|
credentialDetailTestID,
|
|
188
165
|
statusIcon,
|
|
189
|
-
} = credentialDetailFromCredential(credential, claims, config,
|
|
166
|
+
} = credentialDetailFromCredential(credential, claims, config, testID, labels);
|
|
190
167
|
const { layoutProperties } = credential.schema;
|
|
191
168
|
|
|
192
169
|
return {
|
|
@@ -217,7 +194,6 @@ export const getCredentialCardPropsFromCredential = (
|
|
|
217
194
|
credential: CredentialDetail,
|
|
218
195
|
claims: Claim[] = [],
|
|
219
196
|
config: Config,
|
|
220
|
-
wuaState: WUAState | undefined,
|
|
221
197
|
notice: CredentialCardNotice | undefined,
|
|
222
198
|
testID: string,
|
|
223
199
|
labels: CardLabels,
|
|
@@ -237,7 +213,7 @@ export const getCredentialCardPropsFromCredential = (
|
|
|
237
213
|
? { imageSource: { uri: layoutProperties.background.image } }
|
|
238
214
|
: undefined,
|
|
239
215
|
color: layoutProperties?.background?.color,
|
|
240
|
-
header: cardHeaderFromCredential(credential, claims, config,
|
|
216
|
+
header: cardHeaderFromCredential(credential, claims, config, concatTestID(testID, 'header'), labels),
|
|
241
217
|
testID,
|
|
242
218
|
notice,
|
|
243
219
|
};
|
|
@@ -315,18 +291,16 @@ export type CredentialDetailsCardPropsWithoutWidth = Omit<CredentialDetailsCardP
|
|
|
315
291
|
export const detailsCardFromCredential = (
|
|
316
292
|
credential: CredentialDetail,
|
|
317
293
|
config: Config,
|
|
318
|
-
wuaState: WUAState | undefined,
|
|
319
294
|
testID: string,
|
|
320
295
|
labels: CardLabels,
|
|
321
296
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
322
|
-
return detailsCardFromCredentialWithClaims(credential, credential.claims, config,
|
|
297
|
+
return detailsCardFromCredentialWithClaims(credential, credential.claims, config, testID, labels);
|
|
323
298
|
};
|
|
324
299
|
|
|
325
300
|
export const detailsCardFromCredentialWithClaims = (
|
|
326
301
|
credential: CredentialDetail,
|
|
327
302
|
claims: Claim[],
|
|
328
303
|
config: Config,
|
|
329
|
-
wuaState: WUAState | undefined,
|
|
330
304
|
testID: string,
|
|
331
305
|
labels: CardLabels,
|
|
332
306
|
): CredentialDetailsCardPropsWithoutWidth => {
|
|
@@ -338,7 +312,6 @@ export const detailsCardFromCredentialWithClaims = (
|
|
|
338
312
|
credential,
|
|
339
313
|
claims,
|
|
340
314
|
config,
|
|
341
|
-
wuaState,
|
|
342
315
|
undefined,
|
|
343
316
|
concatTestID(testID, 'card'),
|
|
344
317
|
labels,
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.walletUnitAttestationState = exports.isWalletAttestationExpired = exports.WUAState = void 0;
|
|
7
|
-
var _reactNativeOneCore = require("@procivis/react-native-one-core");
|
|
8
|
-
const isWalletAttestationExpired = walletUnitAttestation => {
|
|
9
|
-
return (walletUnitAttestation === null || walletUnitAttestation === void 0 ? void 0 : walletUnitAttestation.expirationDate) && Date.parse(walletUnitAttestation.expirationDate) < Date.now();
|
|
10
|
-
};
|
|
11
|
-
exports.isWalletAttestationExpired = isWalletAttestationExpired;
|
|
12
|
-
let WUAState = exports.WUAState = /*#__PURE__*/function (WUAState) {
|
|
13
|
-
WUAState["Revoked"] = "revoked";
|
|
14
|
-
WUAState["Expired"] = "expired";
|
|
15
|
-
WUAState["Valid"] = "valid";
|
|
16
|
-
return WUAState;
|
|
17
|
-
}({});
|
|
18
|
-
const walletUnitAttestationState = walletUnitAttestation => {
|
|
19
|
-
if (!walletUnitAttestation) {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
if (walletUnitAttestation.status === _reactNativeOneCore.WalletUnitStatusEnum.REVOKED) {
|
|
23
|
-
return WUAState.Revoked;
|
|
24
|
-
} else if (isWalletAttestationExpired(walletUnitAttestation)) {
|
|
25
|
-
return WUAState.Expired;
|
|
26
|
-
}
|
|
27
|
-
return WUAState.Valid;
|
|
28
|
-
};
|
|
29
|
-
exports.walletUnitAttestationState = walletUnitAttestationState;
|
|
30
|
-
//# sourceMappingURL=wallet-unit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeOneCore","require","isWalletAttestationExpired","walletUnitAttestation","expirationDate","Date","parse","now","exports","WUAState","walletUnitAttestationState","undefined","status","WalletUnitStatusEnum","REVOKED","Revoked","Expired","Valid"],"sources":["wallet-unit.ts"],"sourcesContent":["import { HolderAttestationWalletUnitResponse, WalletUnitStatusEnum } from '@procivis/react-native-one-core';\n\nexport const isWalletAttestationExpired = (\n walletUnitAttestation: HolderAttestationWalletUnitResponse | undefined,\n) => {\n return (\n walletUnitAttestation?.expirationDate &&\n Date.parse(walletUnitAttestation.expirationDate) < Date.now()\n );\n};\n\nexport enum WUAState {\n Revoked = \"revoked\",\n Expired = \"expired\",\n Valid = \"valid\"\n}\n\nexport const walletUnitAttestationState = (\n walletUnitAttestation: HolderAttestationWalletUnitResponse | undefined,\n): WUAState | undefined => {\n if (!walletUnitAttestation) {\n return undefined;\n }\n if (walletUnitAttestation.status === WalletUnitStatusEnum.REVOKED) {\n return WUAState.Revoked;\n } else if (isWalletAttestationExpired(walletUnitAttestation)) {\n return WUAState.Expired;\n }\n return WUAState.Valid;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAEO,MAAMC,0BAA0B,GACrCC,qBAAsE,IACnE;EACH,OACE,CAAAA,qBAAqB,aAArBA,qBAAqB,uBAArBA,qBAAqB,CAAEC,cAAc,KACrCC,IAAI,CAACC,KAAK,CAACH,qBAAqB,CAACC,cAAc,CAAC,GAAGC,IAAI,CAACE,GAAG,CAAC,CAAC;AAEjE,CAAC;AAACC,OAAA,CAAAN,0BAAA,GAAAA,0BAAA;AAAA,IAEUO,QAAQ,GAAAD,OAAA,CAAAC,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAMb,MAAMC,0BAA0B,GACrCP,qBAAsE,IAC7C;EACzB,IAAI,CAACA,qBAAqB,EAAE;IAC1B,OAAOQ,SAAS;EAClB;EACA,IAAIR,qBAAqB,CAACS,MAAM,KAAKC,wCAAoB,CAACC,OAAO,EAAE;IACjE,OAAOL,QAAQ,CAACM,OAAO;EACzB,CAAC,MAAM,IAAIb,0BAA0B,CAACC,qBAAqB,CAAC,EAAE;IAC5D,OAAOM,QAAQ,CAACO,OAAO;EACzB;EACA,OAAOP,QAAQ,CAACQ,KAAK;AACvB,CAAC;AAACT,OAAA,CAAAE,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { WalletUnitStatusEnum } from '@procivis/react-native-one-core';
|
|
2
|
-
export const isWalletAttestationExpired = walletUnitAttestation => {
|
|
3
|
-
return (walletUnitAttestation === null || walletUnitAttestation === void 0 ? void 0 : walletUnitAttestation.expirationDate) && Date.parse(walletUnitAttestation.expirationDate) < Date.now();
|
|
4
|
-
};
|
|
5
|
-
export let WUAState = /*#__PURE__*/function (WUAState) {
|
|
6
|
-
WUAState["Revoked"] = "revoked";
|
|
7
|
-
WUAState["Expired"] = "expired";
|
|
8
|
-
WUAState["Valid"] = "valid";
|
|
9
|
-
return WUAState;
|
|
10
|
-
}({});
|
|
11
|
-
export const walletUnitAttestationState = walletUnitAttestation => {
|
|
12
|
-
if (!walletUnitAttestation) {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
if (walletUnitAttestation.status === WalletUnitStatusEnum.REVOKED) {
|
|
16
|
-
return WUAState.Revoked;
|
|
17
|
-
} else if (isWalletAttestationExpired(walletUnitAttestation)) {
|
|
18
|
-
return WUAState.Expired;
|
|
19
|
-
}
|
|
20
|
-
return WUAState.Valid;
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=wallet-unit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["WalletUnitStatusEnum","isWalletAttestationExpired","walletUnitAttestation","expirationDate","Date","parse","now","WUAState","walletUnitAttestationState","undefined","status","REVOKED","Revoked","Expired","Valid"],"sources":["wallet-unit.ts"],"sourcesContent":["import { HolderAttestationWalletUnitResponse, WalletUnitStatusEnum } from '@procivis/react-native-one-core';\n\nexport const isWalletAttestationExpired = (\n walletUnitAttestation: HolderAttestationWalletUnitResponse | undefined,\n) => {\n return (\n walletUnitAttestation?.expirationDate &&\n Date.parse(walletUnitAttestation.expirationDate) < Date.now()\n );\n};\n\nexport enum WUAState {\n Revoked = \"revoked\",\n Expired = \"expired\",\n Valid = \"valid\"\n}\n\nexport const walletUnitAttestationState = (\n walletUnitAttestation: HolderAttestationWalletUnitResponse | undefined,\n): WUAState | undefined => {\n if (!walletUnitAttestation) {\n return undefined;\n }\n if (walletUnitAttestation.status === WalletUnitStatusEnum.REVOKED) {\n return WUAState.Revoked;\n } else if (isWalletAttestationExpired(walletUnitAttestation)) {\n return WUAState.Expired;\n }\n return WUAState.Valid;\n};\n"],"mappings":"AAAA,SAA8CA,oBAAoB,QAAQ,iCAAiC;AAE3G,OAAO,MAAMC,0BAA0B,GACrCC,qBAAsE,IACnE;EACH,OACE,CAAAA,qBAAqB,aAArBA,qBAAqB,uBAArBA,qBAAqB,CAAEC,cAAc,KACrCC,IAAI,CAACC,KAAK,CAACH,qBAAqB,CAACC,cAAc,CAAC,GAAGC,IAAI,CAACE,GAAG,CAAC,CAAC;AAEjE,CAAC;AAED,WAAYC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAMpB,OAAO,MAAMC,0BAA0B,GACrCN,qBAAsE,IAC7C;EACzB,IAAI,CAACA,qBAAqB,EAAE;IAC1B,OAAOO,SAAS;EAClB;EACA,IAAIP,qBAAqB,CAACQ,MAAM,KAAKV,oBAAoB,CAACW,OAAO,EAAE;IACjE,OAAOJ,QAAQ,CAACK,OAAO;EACzB,CAAC,MAAM,IAAIX,0BAA0B,CAACC,qBAAqB,CAAC,EAAE;IAC5D,OAAOK,QAAQ,CAACM,OAAO;EACzB;EACA,OAAON,QAAQ,CAACO,KAAK;AACvB,CAAC","ignoreList":[]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { HolderAttestationWalletUnitResponse } from '@procivis/react-native-one-core';
|
|
2
|
-
export declare const isWalletAttestationExpired: (walletUnitAttestation: HolderAttestationWalletUnitResponse | undefined) => boolean | "" | undefined;
|
|
3
|
-
export declare enum WUAState {
|
|
4
|
-
Revoked = "revoked",
|
|
5
|
-
Expired = "expired",
|
|
6
|
-
Valid = "valid"
|
|
7
|
-
}
|
|
8
|
-
export declare const walletUnitAttestationState: (walletUnitAttestation: HolderAttestationWalletUnitResponse | undefined) => WUAState | undefined;
|
package/src/utils/wallet-unit.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { HolderAttestationWalletUnitResponse, WalletUnitStatusEnum } from '@procivis/react-native-one-core';
|
|
2
|
-
|
|
3
|
-
export const isWalletAttestationExpired = (
|
|
4
|
-
walletUnitAttestation: HolderAttestationWalletUnitResponse | undefined,
|
|
5
|
-
) => {
|
|
6
|
-
return (
|
|
7
|
-
walletUnitAttestation?.expirationDate &&
|
|
8
|
-
Date.parse(walletUnitAttestation.expirationDate) < Date.now()
|
|
9
|
-
);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export enum WUAState {
|
|
13
|
-
Revoked = "revoked",
|
|
14
|
-
Expired = "expired",
|
|
15
|
-
Valid = "valid"
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const walletUnitAttestationState = (
|
|
19
|
-
walletUnitAttestation: HolderAttestationWalletUnitResponse | undefined,
|
|
20
|
-
): WUAState | undefined => {
|
|
21
|
-
if (!walletUnitAttestation) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
if (walletUnitAttestation.status === WalletUnitStatusEnum.REVOKED) {
|
|
25
|
-
return WUAState.Revoked;
|
|
26
|
-
} else if (isWalletAttestationExpired(walletUnitAttestation)) {
|
|
27
|
-
return WUAState.Expired;
|
|
28
|
-
}
|
|
29
|
-
return WUAState.Valid;
|
|
30
|
-
};
|