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