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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/lib/commonjs/components/proof-request/index.js +1 -12
  2. package/lib/commonjs/components/proof-request/index.js.map +1 -1
  3. package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  4. package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
  5. package/lib/commonjs/utils/hooks/core/proofs.js +1 -1
  6. package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
  7. package/lib/commonjs/utils/parsers/credential-sharing-v2.js +34 -3
  8. package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
  9. package/lib/commonjs/utils/parsers/index.js +0 -11
  10. package/lib/commonjs/utils/parsers/index.js.map +1 -1
  11. package/lib/commonjs/utils/parsers/query.js +1 -1
  12. package/lib/commonjs/utils/parsers/query.js.map +1 -1
  13. package/lib/module/components/proof-request/index.js +0 -1
  14. package/lib/module/components/proof-request/index.js.map +1 -1
  15. package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  16. package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
  17. package/lib/module/utils/hooks/core/proofs.js +1 -1
  18. package/lib/module/utils/hooks/core/proofs.js.map +1 -1
  19. package/lib/module/utils/parsers/credential-sharing-v2.js +31 -1
  20. package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
  21. package/lib/module/utils/parsers/index.js +0 -1
  22. package/lib/module/utils/parsers/index.js.map +1 -1
  23. package/lib/module/utils/parsers/query.js +1 -1
  24. package/lib/module/utils/parsers/query.js.map +1 -1
  25. package/lib/typescript/components/proof-request/index.d.ts +0 -1
  26. package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +8 -1
  27. package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +1 -1
  28. package/lib/typescript/ui-components/text/typography.d.ts +13 -13
  29. package/lib/typescript/utils/hooks/core/proofs.d.ts +2 -2
  30. package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +10 -2
  31. package/lib/typescript/utils/parsers/index.d.ts +0 -1
  32. package/package.json +5 -4
  33. package/src/components/proof-request/index.ts +0 -1
  34. package/src/components/proof-request/v2/share-credential-v2-group.tsx +9 -2
  35. package/src/components/proof-request/v2/share-credential-v2.tsx +1 -1
  36. package/src/utils/hooks/core/proofs.ts +3 -3
  37. package/src/utils/parsers/credential-sharing-v2.tsx +70 -1
  38. package/src/utils/parsers/index.ts +0 -1
  39. package/src/utils/parsers/query.ts +0 -1
  40. package/lib/commonjs/components/proof-request/v1/group.js +0 -35
  41. package/lib/commonjs/components/proof-request/v1/group.js.map +0 -1
  42. package/lib/commonjs/components/proof-request/v1/index.js +0 -39
  43. package/lib/commonjs/components/proof-request/v1/index.js.map +0 -1
  44. package/lib/commonjs/components/proof-request/v1/select-credential.js +0 -53
  45. package/lib/commonjs/components/proof-request/v1/select-credential.js.map +0 -1
  46. package/lib/commonjs/components/proof-request/v1/share-credential.js +0 -110
  47. package/lib/commonjs/components/proof-request/v1/share-credential.js.map +0 -1
  48. package/lib/commonjs/utils/parsers/credential-sharing.js +0 -269
  49. package/lib/commonjs/utils/parsers/credential-sharing.js.map +0 -1
  50. package/lib/module/components/proof-request/v1/group.js +0 -27
  51. package/lib/module/components/proof-request/v1/group.js.map +0 -1
  52. package/lib/module/components/proof-request/v1/index.js +0 -4
  53. package/lib/module/components/proof-request/v1/index.js.map +0 -1
  54. package/lib/module/components/proof-request/v1/select-credential.js +0 -44
  55. package/lib/module/components/proof-request/v1/select-credential.js.map +0 -1
  56. package/lib/module/components/proof-request/v1/share-credential.js +0 -101
  57. package/lib/module/components/proof-request/v1/share-credential.js.map +0 -1
  58. package/lib/module/utils/parsers/credential-sharing.js +0 -256
  59. package/lib/module/utils/parsers/credential-sharing.js.map +0 -1
  60. package/lib/typescript/components/proof-request/v1/group.d.ts +0 -2
  61. package/lib/typescript/components/proof-request/v1/index.d.ts +0 -3
  62. package/lib/typescript/components/proof-request/v1/select-credential.d.ts +0 -15
  63. package/lib/typescript/components/proof-request/v1/share-credential.d.ts +0 -27
  64. package/lib/typescript/utils/parsers/credential-sharing.d.ts +0 -21
  65. package/src/components/proof-request/v1/group.tsx +0 -26
  66. package/src/components/proof-request/v1/index.ts +0 -3
  67. package/src/components/proof-request/v1/select-credential.tsx +0 -55
  68. package/src/components/proof-request/v1/share-credential.tsx +0 -159
  69. package/src/utils/parsers/credential-sharing.tsx +0 -415
@@ -1,101 +0,0 @@
1
- import { CredentialState } from '@procivis/react-native-one-core';
2
- import React, { useMemo } from 'react';
3
- import { Dimensions, StyleSheet } from 'react-native';
4
- import { CredentialDetailsCardListItem, useAppColorScheme } from '../../../ui-components';
5
- import { concatTestID } from '../../../utils';
6
- import { useCoreConfig } from '../../../utils/hooks/core/core-config';
7
- import { getValidityState, ValidityState } from '../../../utils/parsers/credential';
8
- import { shareCredentialCardFromCredential } from '../../../utils/parsers/credential-sharing';
9
- import { SelectShareCredentialCardNotice } from '../select-share-credential-card-notice';
10
- import { ShareCredentialCardNotice } from '../share-credential-card-notice';
11
- export const ShareCredential = ({
12
- allCredentials,
13
- expanded,
14
- labels,
15
- language,
16
- lastItem,
17
- onHeaderPress,
18
- onImagePreview,
19
- onSelectCredential,
20
- onSelectField,
21
- request,
22
- selectedCredentialId,
23
- selectedFields,
24
- style,
25
- testID
26
- }) => {
27
- var _credential$issuer;
28
- const colorScheme = useAppColorScheme();
29
- const credential = allCredentials.find(c => c.id === selectedCredentialId);
30
- const {
31
- data: config
32
- } = useCoreConfig();
33
- const cardWidth = useMemo(() => Dimensions.get('window').width - 32, []);
34
- const selectionOptions = useMemo(() => request.applicableCredentials.filter(applicableCredentialId => allCredentials.some(({
35
- id,
36
- state
37
- }) => id === applicableCredentialId && state === CredentialState.ACCEPTED)), [allCredentials, request]);
38
- const multipleCredentialsAvailable = selectionOptions.length > 1;
39
- const validityState = getValidityState(credential ? {
40
- ...credential,
41
- issuer: credential === null || credential === void 0 || (_credential$issuer = credential.issuer) === null || _credential$issuer === void 0 ? void 0 : _credential$issuer.id
42
- } : undefined);
43
- const footer = useMemo(() => {
44
- if (!expanded) {
45
- return;
46
- }
47
- if (validityState === ValidityState.Revoked) {
48
- return /*#__PURE__*/React.createElement(ShareCredentialCardNotice, {
49
- testID: concatTestID(testID, 'notice.revoked'),
50
- text: labels.revokedCredentialNotice
51
- });
52
- }
53
- if (validityState === ValidityState.Suspended) {
54
- return /*#__PURE__*/React.createElement(ShareCredentialCardNotice, {
55
- testID: concatTestID(testID, 'notice.suspended'),
56
- text: labels.suspendedCredentialNotice
57
- });
58
- }
59
- if (multipleCredentialsAvailable) {
60
- return /*#__PURE__*/React.createElement(SelectShareCredentialCardNotice, {
61
- buttonTitle: labels.multipleCredentialsSelect,
62
- onPress: onSelectCredential,
63
- testID: concatTestID(testID, 'notice.multiple'),
64
- text: labels.multipleCredentialsNotice
65
- });
66
- }
67
- }, [expanded, labels, multipleCredentialsAvailable, onSelectCredential, testID, validityState]);
68
- if (!config) {
69
- return null;
70
- }
71
- const {
72
- card,
73
- attributes
74
- } = shareCredentialCardFromCredential(credential, Boolean(expanded), multipleCredentialsAvailable, request, selectedFields, config, testID, labels, language);
75
- return /*#__PURE__*/React.createElement(CredentialDetailsCardListItem, {
76
- attributes: attributes,
77
- card: {
78
- ...card,
79
- credentialId: request.id,
80
- onHeaderPress,
81
- width: cardWidth
82
- },
83
- expanded: expanded,
84
- footer: footer,
85
- lastItem: lastItem,
86
- onAttributeSelected: onSelectField,
87
- onImagePreview: onImagePreview,
88
- style: [styles.credential, {
89
- borderColor: colorScheme.background
90
- }, style],
91
- testID: testID
92
- });
93
- };
94
- const styles = StyleSheet.create({
95
- credential: {
96
- borderRadius: 10,
97
- borderWidth: 1,
98
- marginBottom: 8
99
- }
100
- });
101
- //# sourceMappingURL=share-credential.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["CredentialState","React","useMemo","Dimensions","StyleSheet","CredentialDetailsCardListItem","useAppColorScheme","concatTestID","useCoreConfig","getValidityState","ValidityState","shareCredentialCardFromCredential","SelectShareCredentialCardNotice","ShareCredentialCardNotice","ShareCredential","allCredentials","expanded","labels","language","lastItem","onHeaderPress","onImagePreview","onSelectCredential","onSelectField","request","selectedCredentialId","selectedFields","style","testID","_credential$issuer","colorScheme","credential","find","c","id","data","config","cardWidth","get","width","selectionOptions","applicableCredentials","filter","applicableCredentialId","some","state","ACCEPTED","multipleCredentialsAvailable","length","validityState","issuer","undefined","footer","Revoked","createElement","text","revokedCredentialNotice","Suspended","suspendedCredentialNotice","buttonTitle","multipleCredentialsSelect","onPress","multipleCredentialsNotice","card","attributes","Boolean","credentialId","onAttributeSelected","styles","borderColor","background","create","borderRadius","borderWidth","marginBottom"],"sources":["share-credential.tsx"],"sourcesContent":["import {\n CredentialDetail,\n CredentialListItem,\n CredentialState,\n PresentationDefinitionField,\n PresentationDefinitionRequestedCredential,\n} from '@procivis/react-native-one-core';\nimport React, { FunctionComponent, useMemo } from 'react';\nimport { Dimensions, ImageSourcePropType, StyleProp, StyleSheet, ViewStyle } from 'react-native';\n\nimport { CredentialDetailsCardListItem, useAppColorScheme } from '../../../ui-components';\nimport { concatTestID } from '../../../utils';\nimport { useCoreConfig } from '../../../utils/hooks/core/core-config';\nimport { getValidityState, ValidityState } from '../../../utils/parsers/credential';\nimport {\n shareCredentialCardFromCredential,\n ShareCredentialCardLabels,\n} from '../../../utils/parsers/credential-sharing';\nimport { SelectShareCredentialCardNotice } from '../select-share-credential-card-notice';\nimport { ShareCredentialCardNotice } from '../share-credential-card-notice';\n\nexport type ShareCredentialLabels = ShareCredentialCardLabels & {\n invalidCredentialNotice: string;\n multipleCredentialsNotice: string;\n multipleCredentialsSelect: string;\n revokedCredentialNotice: string;\n suspendedCredentialNotice: string;\n};\n\nexport const ShareCredential: FunctionComponent<{\n allCredentials: CredentialDetail[];\n expanded?: boolean;\n labels: ShareCredentialLabels;\n language?: string;\n lastItem?: boolean;\n onHeaderPress?: (_credentialId?: string) => void;\n onImagePreview: (title: string, image: ImageSourcePropType) => void;\n onSelectCredential?: () => void;\n onSelectField: (_id: PresentationDefinitionField['id'], _selected: boolean) => void;\n request: PresentationDefinitionRequestedCredential;\n selectedCredentialId?: CredentialListItem['id'];\n selectedFields?: Array<PresentationDefinitionField['id']>;\n style?: StyleProp<ViewStyle>;\n testID: string;\n}> = ({\n allCredentials,\n expanded,\n labels,\n language,\n lastItem,\n onHeaderPress,\n onImagePreview,\n onSelectCredential,\n onSelectField,\n request,\n selectedCredentialId,\n selectedFields,\n style,\n testID,\n}) => {\n const colorScheme = useAppColorScheme();\n const credential = allCredentials.find((c) => c.id === selectedCredentialId);\n const { data: config } = useCoreConfig();\n const cardWidth = useMemo(() => Dimensions.get('window').width - 32, []);\n\n const selectionOptions = useMemo(\n () =>\n request.applicableCredentials.filter((applicableCredentialId) =>\n allCredentials.some(({ id, state }) => id === applicableCredentialId && state === CredentialState.ACCEPTED),\n ),\n [allCredentials, request],\n );\n const multipleCredentialsAvailable = selectionOptions.length > 1;\n\n const validityState = getValidityState(\n credential\n ? {\n ...credential,\n issuer: credential?.issuer?.id,\n }\n : undefined,\n );\n\n const footer = useMemo(() => {\n if (!expanded) {\n return;\n }\n if (validityState === ValidityState.Revoked) {\n return (\n <ShareCredentialCardNotice\n testID={concatTestID(testID, 'notice.revoked')}\n text={labels.revokedCredentialNotice}\n />\n );\n }\n if (validityState === ValidityState.Suspended) {\n return (\n <ShareCredentialCardNotice\n testID={concatTestID(testID, 'notice.suspended')}\n text={labels.suspendedCredentialNotice}\n />\n );\n }\n\n if (multipleCredentialsAvailable) {\n return (\n <SelectShareCredentialCardNotice\n buttonTitle={labels.multipleCredentialsSelect}\n onPress={onSelectCredential}\n testID={concatTestID(testID, 'notice.multiple')}\n text={labels.multipleCredentialsNotice}\n />\n );\n }\n }, [expanded, labels, multipleCredentialsAvailable, onSelectCredential, testID, validityState]);\n\n if (!config) {\n return null;\n }\n\n const { card, attributes } = shareCredentialCardFromCredential(\n credential,\n Boolean(expanded),\n multipleCredentialsAvailable,\n request,\n selectedFields,\n config,\n testID,\n labels,\n language,\n );\n\n return (\n <CredentialDetailsCardListItem\n attributes={attributes}\n card={{\n ...card,\n credentialId: request.id,\n onHeaderPress,\n width: cardWidth,\n }}\n expanded={expanded}\n footer={footer}\n lastItem={lastItem}\n onAttributeSelected={onSelectField}\n onImagePreview={onImagePreview}\n style={[styles.credential, { borderColor: colorScheme.background }, style]}\n testID={testID}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n credential: {\n borderRadius: 10,\n borderWidth: 1,\n marginBottom: 8,\n },\n});\n"],"mappings":"AAAA,SAGEA,eAAe,QAGV,iCAAiC;AACxC,OAAOC,KAAK,IAAuBC,OAAO,QAAQ,OAAO;AACzD,SAASC,UAAU,EAAkCC,UAAU,QAAmB,cAAc;AAEhG,SAASC,6BAA6B,EAAEC,iBAAiB,QAAQ,wBAAwB;AACzF,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,aAAa,QAAQ,uCAAuC;AACrE,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,mCAAmC;AACnF,SACEC,iCAAiC,QAE5B,2CAA2C;AAClD,SAASC,+BAA+B,QAAQ,wCAAwC;AACxF,SAASC,yBAAyB,QAAQ,iCAAiC;AAU3E,OAAO,MAAMC,eAeX,GAAGA,CAAC;EACJC,cAAc;EACdC,QAAQ;EACRC,MAAM;EACNC,QAAQ;EACRC,QAAQ;EACRC,aAAa;EACbC,cAAc;EACdC,kBAAkB;EAClBC,aAAa;EACbC,OAAO;EACPC,oBAAoB;EACpBC,cAAc;EACdC,KAAK;EACLC;AACF,CAAC,KAAK;EAAA,IAAAC,kBAAA;EACJ,MAAMC,WAAW,GAAGxB,iBAAiB,CAAC,CAAC;EACvC,MAAMyB,UAAU,GAAGhB,cAAc,CAACiB,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,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CAAC,EAAE3C,KAAK,CAAE;IAC3EC,MAAM,EAAEA;EAAO,CAChB,CAAC;AAEN,CAAC;AAED,MAAMwC,MAAM,GAAGhE,UAAU,CAACmE,MAAM,CAAC;EAC/BxC,UAAU,EAAE;IACVyC,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE,CAAC;IACdC,YAAY,EAAE;EAChB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,256 +0,0 @@
1
- import { CredentialType } from '@procivis/react-native-one-core';
2
- import React from 'react';
3
- import { Selector, SelectorStatus } from '../../ui-components/credential';
4
- import { CredentialNoticeWarningIcon, CredentialWarningIcon, RequiredAttributeIcon } from '../../ui-components/icons';
5
- import { concatTestID } from '../testID';
6
- import { credentialDetailFromPresentationV2Credential, detailsCardAttributeFromClaim, getCredentialCardPropsFromCredential, getValidityState, nestAttributes, supportsSelectiveDisclosure, ValidityState } from './credential';
7
- export const validityCheckedCardFromCredential = (credential, expanded, selectiveDisclosureSupported, multipleCredentialsAvailable, config, notice, testID, labels, language) => {
8
- let credentialHeaderDetail;
9
- if (selectiveDisclosureSupported === false) {
10
- credentialHeaderDetail = {
11
- credentialDetailPrimary: labels.selectiveDisclosure,
12
- credentialDetailTestID: concatTestID(testID, 'header.nonSelectiveDisclosure'),
13
- statusIcon: CredentialWarningIcon
14
- };
15
- } else if ('embeddedDisclosurePolicyViolation' in credential) {
16
- credentialHeaderDetail = {
17
- credentialDetailPrimary: labels.disclosurePolicyViolation,
18
- credentialDetailTestID: concatTestID(testID, 'header.dislosurePolicyViolation'),
19
- statusIcon: CredentialWarningIcon
20
- };
21
- } else if (!expanded && multipleCredentialsAvailable) {
22
- credentialHeaderDetail = {
23
- credentialDetailPrimary: labels.multipleCredentials,
24
- credentialDetailTestID: concatTestID(testID, 'header.multiple'),
25
- statusIcon: CredentialWarningIcon
26
- };
27
- }
28
- const card = getCredentialCardPropsFromCredential(credentialDetailFromPresentationV2Credential(credential), credential.claims, config, notice, testID, labels, language);
29
- return {
30
- ...card,
31
- header: {
32
- ...card.header,
33
- ...credentialHeaderDetail
34
- }
35
- };
36
- };
37
- export const missingCredentialCardFromRequest = (request, notice, testID, labels) => {
38
- var _request$name;
39
- return {
40
- cardImage: undefined,
41
- color: undefined,
42
- testID,
43
- header: {
44
- credentialDetailErrorColor: true,
45
- credentialDetailPrimary: labels.missingCredential,
46
- credentialDetailTestID: concatTestID(testID, 'header.missing'),
47
- credentialName: (_request$name = request.name) !== null && _request$name !== void 0 ? _request$name : request.id,
48
- statusIcon: CredentialWarningIcon
49
- },
50
- ...notice
51
- };
52
- };
53
- const getAttributeSelectorStatus = (field, validityState, credential, claim, selected) => {
54
- if (!credential || validityState !== ValidityState.Valid) {
55
- return SelectorStatus.Rejected;
56
- }
57
- if (field.required) {
58
- if (claim) {
59
- return SelectorStatus.Required;
60
- } else {
61
- return SelectorStatus.Rejected;
62
- }
63
- }
64
- if (!claim) {
65
- return SelectorStatus.Disabled;
66
- }
67
- return selected ? SelectorStatus.SelectedCheckmark : SelectorStatus.Empty;
68
- };
69
- // Returns a spread list of all claims with their full JSON path as key, including all intermediate objects
70
- const spreadClaims = claims => {
71
- return claims.reduce((acc, claim) => {
72
- const result = [claim];
73
- if (claim.value.type_ === 'NESTED') {
74
- const nestedClaimsWithPath = claim.value.value.map(c => ({
75
- ...c,
76
- isArrayElement: claim.schema.array && claim.path.split('/').pop() !== claim.schema.key
77
- }));
78
- result.push(...spreadClaims(nestedClaimsWithPath));
79
- }
80
- return [...acc, ...result];
81
- }, []);
82
- };
83
- const getDisplayedAttributes = (request, validityState, credential, selectiveDisclosureSupported, selectedFields) => {
84
- const claims = credential ? spreadClaims(credential.claims) : undefined;
85
- const isApplicable = credential ? request.applicableCredentials.includes(credential.id) : false;
86
- let fields = request.fields;
87
- if (credential) {
88
- const fieldsWithNoKeyMapping = request.fields.filter(field => !(credential.id in field.keyMap)).filter(field => !isApplicable || !field.required);
89
- const fullyNestedFields = getFullyNestedFields(request.fields, credential.id);
90
- fields = [...fieldsWithNoKeyMapping, ...fullyNestedFields];
91
- }
92
- return fields.map(field => {
93
- const selected = !field.required && (selectedFields === null || selectedFields === void 0 ? void 0 : selectedFields.includes(field.id));
94
- const claim = credential ? claims === null || claims === void 0 ? void 0 : claims.find(({
95
- path
96
- }) => {
97
- return path === field.keyMap[credential.id];
98
- }) : undefined;
99
- const status = selectiveDisclosureSupported === false ? SelectorStatus.Required : getAttributeSelectorStatus(field, validityState, credential, claim, selected);
100
- return {
101
- claim,
102
- field,
103
- id: field.id,
104
- selected,
105
- status
106
- };
107
- });
108
- };
109
- const getFullyNestedFields = (fields, credentialId) => {
110
- const allKeys = fields.filter(field => credentialId in field.keyMap).map(field => field.keyMap[credentialId]);
111
- return fields.map(field => ({
112
- field,
113
- key: field.keyMap[credentialId]
114
- })).filter(({
115
- key
116
- }) => key && allKeys.every(k => !k.startsWith(`${key}/`))).map(({
117
- field
118
- }) => field);
119
- };
120
- export const shareCredentialCardAttributeFromClaim = (id, config, testID, labels, language, claim, field) => {
121
- var _field$name$split$pop, _field$name, _field$name2;
122
- if (claim) {
123
- return {
124
- ...detailsCardAttributeFromClaim(claim, config, testID, language),
125
- id,
126
- path: claim.path,
127
- listValue: claim.isArrayElement
128
- };
129
- }
130
- return {
131
- id,
132
- name: (_field$name$split$pop = field === null || field === void 0 || (_field$name = field.name) === null || _field$name === void 0 ? void 0 : _field$name.split('/').pop()) !== null && _field$name$split$pop !== void 0 ? _field$name$split$pop : id,
133
- path: (_field$name2 = field === null || field === void 0 ? void 0 : field.name) !== null && _field$name2 !== void 0 ? _field$name2 : id,
134
- value: labels.missingAttribute,
135
- valueErrorColor: true
136
- };
137
- };
138
-
139
- // Will propagate the attribute status (right accessory + selected?) for all nested attributes
140
- // Note: This function MUTATES the input attribute
141
- const setStatusForNestedObjectOrArrayFields = (attribute, status, disabled) => {
142
- const accessory = status && /*#__PURE__*/React.createElement(Selector, {
143
- status: status
144
- });
145
- const isObject = attribute.attributes && attribute.attributes.length > 0;
146
- const isArray = attribute.values && attribute.values.length > 0;
147
-
148
- // If the attribute is not an object or array, we update the attribute and return
149
- if (!isObject && !isArray) {
150
- attribute.rightAccessory = accessory;
151
- attribute.disabled = disabled;
152
- return attribute;
153
- }
154
-
155
- // The object can be optional (tappable radio-checkmark), or required (checkmark)
156
- if (status === SelectorStatus.SelectedCheckmark || status === SelectorStatus.Empty) {
157
- // If it's a selectable object, the accessory is rendered next to the object title,
158
- // The nested attributes have no accessory, and can not be selected
159
- attribute.rightAccessory = accessory;
160
- setStatusForNestedObjectOrArrayFields(attribute, undefined, true);
161
- } else {
162
- var _attribute$attributes;
163
- const nested = (_attribute$attributes = attribute.attributes) !== null && _attribute$attributes !== void 0 ? _attribute$attributes : attribute.values;
164
- // If the object is required / rejected, the accessory is rendered next to each nested attribute (except other object titles)
165
- // all fields are disabled
166
- for (const nestedAttribute of nested) {
167
- setStatusForNestedObjectOrArrayFields(nestedAttribute, status, true);
168
- }
169
- }
170
- };
171
- export const shareCredentialCardFromCredential = (credential, expanded, multipleCredentialsAvailable, request, selectedFields, config, testID, labels, language) => {
172
- var _credential$issuer;
173
- const credentialAsListItem = credential ? {
174
- type: CredentialType.SINGLE,
175
- ...credential,
176
- issuer: (_credential$issuer = credential.issuer) === null || _credential$issuer === void 0 ? void 0 : _credential$issuer.id
177
- } : undefined;
178
- const selectiveDisclosureSupported = supportsSelectiveDisclosure(credentialAsListItem, config);
179
- const cardTestId = concatTestID(testID, 'card');
180
- const card = credential ? validityCheckedCardFromCredential(credential, expanded, selectiveDisclosureSupported, multipleCredentialsAvailable, config, undefined, cardTestId, labels, language) : missingCredentialCardFromRequest(request, undefined, cardTestId, labels);
181
- const validityState = getValidityState(credentialAsListItem);
182
- const displayedAttributes = getDisplayedAttributes(request, validityState, credential ? credentialDetailFromPresentationV2Credential(credential) : undefined, selectiveDisclosureSupported, selectedFields);
183
- const attributes = displayedAttributes.map(({
184
- claim,
185
- field,
186
- id,
187
- selected,
188
- status
189
- }, index) => {
190
- const disabled = !credential || !field || field.required || !claim;
191
- const attribute = {
192
- ...shareCredentialCardAttributeFromClaim(id, config, concatTestID(testID, 'attribute', `${index}`), labels, language, claim, field),
193
- selected
194
- };
195
- setStatusForNestedObjectOrArrayFields(attribute, status, disabled);
196
- return attribute;
197
- });
198
- return {
199
- attributes: nestAttributes(attributes),
200
- card
201
- };
202
- };
203
- export const selectCredentialCardAttributeFromClaim = (id, config, testID, labels, language, claim, field) => {
204
- const attribute = shareCredentialCardAttributeFromClaim(id, config, testID, labels, language, claim, field);
205
- if (!claim) {
206
- return attribute;
207
- }
208
- return {
209
- ...attribute,
210
- rightAccessory: RequiredAttributeIcon
211
- };
212
- };
213
- export const selectCredentialCardFromCredential = (credential, selected, request, config, testID, labels, language) => {
214
- var _credential$issuer2;
215
- const selectiveDisclosureSupported = supportsSelectiveDisclosure(credential ? {
216
- ...credential,
217
- issuer: (_credential$issuer2 = credential.issuer) === null || _credential$issuer2 === void 0 ? void 0 : _credential$issuer2.id
218
- } : undefined, config);
219
- const rightAccessory = /*#__PURE__*/React.createElement(Selector, {
220
- status: selected ? SelectorStatus.SelectedRadio : SelectorStatus.Empty
221
- });
222
- const notice = selectiveDisclosureSupported === false ? {
223
- text: labels.selectiveDisclosure,
224
- noticeIcon: CredentialNoticeWarningIcon
225
- } : undefined;
226
- const {
227
- header,
228
- ...cardProps
229
- } = getCredentialCardPropsFromCredential(credential, credential.claims, config, notice, testID, labels, language);
230
- const card = {
231
- header: {
232
- ...header,
233
- accessory: rightAccessory
234
- },
235
- ...cardProps
236
- };
237
- const attributes = getFullyNestedFields(request.fields, credential.id).map(field => {
238
- const claim = spreadClaims(credential.claims).find(({
239
- path
240
- }) => {
241
- return path === field.keyMap[credential.id];
242
- });
243
- const attribute = selectCredentialCardAttributeFromClaim(field.id, config, testID, labels, language, claim, field);
244
- return {
245
- ...attribute,
246
- rightAccessory: /*#__PURE__*/React.createElement(Selector, {
247
- status: field.required && !claim ? SelectorStatus.Rejected : SelectorStatus.Required
248
- })
249
- };
250
- });
251
- return {
252
- attributes: nestAttributes(attributes),
253
- card
254
- };
255
- };
256
- //# sourceMappingURL=credential-sharing.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["CredentialType","React","Selector","SelectorStatus","CredentialNoticeWarningIcon","CredentialWarningIcon","RequiredAttributeIcon","concatTestID","credentialDetailFromPresentationV2Credential","detailsCardAttributeFromClaim","getCredentialCardPropsFromCredential","getValidityState","nestAttributes","supportsSelectiveDisclosure","ValidityState","validityCheckedCardFromCredential","credential","expanded","selectiveDisclosureSupported","multipleCredentialsAvailable","config","notice","testID","labels","language","credentialHeaderDetail","credentialDetailPrimary","selectiveDisclosure","credentialDetailTestID","statusIcon","disclosurePolicyViolation","multipleCredentials","card","claims","header","missingCredentialCardFromRequest","request","_request$name","cardImage","undefined","color","credentialDetailErrorColor","missingCredential","credentialName","name","id","getAttributeSelectorStatus","field","validityState","claim","selected","Valid","Rejected","required","Required","Disabled","SelectedCheckmark","Empty","spreadClaims","reduce","acc","result","value","type_","nestedClaimsWithPath","map","c","isArrayElement","schema","array","path","split","pop","key","push","getDisplayedAttributes","selectedFields","isApplicable","applicableCredentials","includes","fields","fieldsWithNoKeyMapping","filter","keyMap","fullyNestedFields","getFullyNestedFields","find","status","credentialId","allKeys","every","k","startsWith","shareCredentialCardAttributeFromClaim","_field$name$split$pop","_field$name","_field$name2","listValue","missingAttribute","valueErrorColor","setStatusForNestedObjectOrArrayFields","attribute","disabled","accessory","createElement","isObject","attributes","length","isArray","values","rightAccessory","_attribute$attributes","nested","nestedAttribute","shareCredentialCardFromCredential","_credential$issuer","credentialAsListItem","type","SINGLE","issuer","cardTestId","displayedAttributes","index","selectCredentialCardAttributeFromClaim","selectCredentialCardFromCredential","_credential$issuer2","SelectedRadio","text","noticeIcon","cardProps"],"sources":["credential-sharing.tsx"],"sourcesContent":["import {\n Claim,\n CoreConfig,\n CredentialDetail,\n CredentialListItem,\n CredentialType,\n PresentationDefinitionField,\n PresentationDefinitionRequestedCredential,\n PresentationDefinitionV2Credential,\n} from '@procivis/react-native-one-core';\nimport React from 'react';\n\nimport {\n CredentialAttribute,\n CredentialCardProps,\n CredentialHeaderProps,\n Selector,\n SelectorStatus,\n} from '../../ui-components/credential';\nimport { CredentialCardNotice } from '../../ui-components/credential/card/credential-card';\nimport { CredentialNoticeWarningIcon, CredentialWarningIcon, RequiredAttributeIcon } from '../../ui-components/icons';\nimport { concatTestID } from '../testID';\nimport {\n CardLabels,\n credentialDetailFromPresentationV2Credential,\n CredentialDetailsCardPropsWithoutWidth,\n detailsCardAttributeFromClaim,\n getCredentialCardPropsFromCredential,\n getValidityState,\n nestAttributes,\n supportsSelectiveDisclosure,\n ValidityState,\n} from './credential';\n\nexport const validityCheckedCardFromCredential = (\n credential: CredentialDetail | PresentationDefinitionV2Credential,\n expanded: boolean,\n selectiveDisclosureSupported: boolean | undefined,\n multipleCredentialsAvailable: boolean,\n config: CoreConfig,\n notice: CredentialCardNotice | undefined,\n testID: string,\n labels: ShareCredentialCardLabels,\n language: string | undefined,\n): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'testID' | 'width'> => {\n let credentialHeaderDetail:\n | Pick<\n CredentialHeaderProps,\n | 'credentialDetailPrimary'\n | 'credentialDetailSecondary'\n | 'credentialDetailErrorColor'\n | 'credentialDetailTestID'\n | 'statusIcon'\n >\n | undefined;\n if (selectiveDisclosureSupported === false) {\n credentialHeaderDetail = {\n credentialDetailPrimary: labels.selectiveDisclosure,\n credentialDetailTestID: concatTestID(testID, 'header.nonSelectiveDisclosure'),\n statusIcon: CredentialWarningIcon,\n };\n } else if ('embeddedDisclosurePolicyViolation' in credential) {\n credentialHeaderDetail = {\n credentialDetailPrimary: labels.disclosurePolicyViolation,\n credentialDetailTestID: concatTestID(testID, 'header.dislosurePolicyViolation'),\n statusIcon: CredentialWarningIcon,\n };\n } else if (!expanded && multipleCredentialsAvailable) {\n credentialHeaderDetail = {\n credentialDetailPrimary: labels.multipleCredentials,\n credentialDetailTestID: concatTestID(testID, 'header.multiple'),\n statusIcon: CredentialWarningIcon,\n };\n }\n\n const card = getCredentialCardPropsFromCredential(\n credentialDetailFromPresentationV2Credential(credential),\n credential.claims,\n config,\n notice,\n testID,\n labels,\n language,\n );\n return {\n ...card,\n header: {\n ...card.header,\n ...credentialHeaderDetail,\n },\n };\n};\n\nexport const missingCredentialCardFromRequest = (\n request: PresentationDefinitionRequestedCredential,\n notice: CredentialCardNotice | undefined,\n testID: string,\n labels: ShareCredentialCardLabels,\n): Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'width'> => {\n return {\n cardImage: undefined,\n color: undefined,\n testID,\n header: {\n credentialDetailErrorColor: true,\n credentialDetailPrimary: labels.missingCredential,\n credentialDetailTestID: concatTestID(testID, 'header.missing'),\n credentialName: request.name ?? request.id,\n statusIcon: CredentialWarningIcon,\n },\n ...notice,\n };\n};\n\ninterface DisplayedAttribute {\n claim?: FlatClaim;\n field?: PresentationDefinitionField;\n id: string;\n selected?: boolean;\n status: SelectorStatus;\n}\n\nconst getAttributeSelectorStatus = (\n field: PresentationDefinitionField,\n validityState: ValidityState,\n credential?: CredentialDetail,\n claim?: Claim,\n selected?: boolean,\n): SelectorStatus => {\n if (!credential || validityState !== ValidityState.Valid) {\n return SelectorStatus.Rejected;\n }\n if (field.required) {\n if (claim) {\n return SelectorStatus.Required;\n } else {\n return SelectorStatus.Rejected;\n }\n }\n if (!claim) {\n return SelectorStatus.Disabled;\n }\n return selected ? SelectorStatus.SelectedCheckmark : SelectorStatus.Empty;\n};\n\ntype FlatClaim = Claim & {\n isArrayElement?: boolean;\n};\n\n// Returns a spread list of all claims with their full JSON path as key, including all intermediate objects\nconst spreadClaims = (claims: Claim[]): FlatClaim[] => {\n return claims.reduce((acc, claim) => {\n const result = [claim];\n if (claim.value.type_ === 'NESTED') {\n const nestedClaimsWithPath: FlatClaim[] = claim.value.value.map((c) => ({\n ...c,\n isArrayElement: claim.schema.array && claim.path.split('/').pop() !== claim.schema.key,\n }));\n result.push(...spreadClaims(nestedClaimsWithPath));\n }\n return [...acc, ...result];\n }, [] as FlatClaim[]);\n};\n\nconst getDisplayedAttributes = (\n request: PresentationDefinitionRequestedCredential,\n validityState: ValidityState,\n credential?: CredentialDetail,\n selectiveDisclosureSupported?: boolean,\n selectedFields?: string[],\n): DisplayedAttribute[] => {\n const claims = credential ? spreadClaims(credential.claims) : undefined;\n const isApplicable = credential ? request.applicableCredentials.includes(credential.id) : false;\n\n let fields = request.fields;\n if (credential) {\n const fieldsWithNoKeyMapping = request.fields\n .filter((field) => !(credential.id in field.keyMap))\n .filter((field) => !isApplicable || !field.required);\n const fullyNestedFields = getFullyNestedFields(request.fields, credential.id);\n\n fields = [...fieldsWithNoKeyMapping, ...fullyNestedFields];\n }\n\n return fields.map((field) => {\n const selected = !field.required && selectedFields?.includes(field.id);\n const claim = credential\n ? claims?.find(({ path }) => {\n return path === field.keyMap[credential.id];\n })\n : undefined;\n const status =\n selectiveDisclosureSupported === false\n ? SelectorStatus.Required\n : getAttributeSelectorStatus(field, validityState, credential, claim, selected);\n return { claim, field, id: field.id, selected, status };\n });\n};\n\nconst getFullyNestedFields = (\n fields: PresentationDefinitionRequestedCredential['fields'],\n credentialId: CredentialDetail['id'],\n) => {\n const allKeys = fields.filter((field) => credentialId in field.keyMap).map((field) => field.keyMap[credentialId]);\n\n return fields\n .map((field) => ({ field, key: field.keyMap[credentialId] }))\n .filter(({ key }) => key && allKeys.every((k) => !k.startsWith(`${key}/`)))\n .map(({ field }) => field);\n};\n\nexport const shareCredentialCardAttributeFromClaim = (\n id: string,\n config: CoreConfig,\n testID: string,\n labels: ShareCredentialCardLabels,\n language: string | undefined,\n claim?: FlatClaim,\n field?: PresentationDefinitionField,\n): CredentialAttribute => {\n if (claim) {\n return {\n ...detailsCardAttributeFromClaim(claim, config, testID, language),\n id,\n path: claim.path,\n listValue: claim.isArrayElement,\n };\n }\n return {\n id,\n name: field?.name?.split('/').pop() ?? id,\n path: field?.name ?? id,\n value: labels.missingAttribute,\n valueErrorColor: true,\n };\n};\n\n// Will propagate the attribute status (right accessory + selected?) for all nested attributes\n// Note: This function MUTATES the input attribute\nconst setStatusForNestedObjectOrArrayFields = (\n attribute: CredentialAttribute,\n status?: SelectorStatus,\n disabled?: boolean,\n) => {\n const accessory = status && <Selector status={status} />;\n const isObject = attribute.attributes && attribute.attributes.length > 0;\n const isArray = attribute.values && attribute.values.length > 0;\n\n // If the attribute is not an object or array, we update the attribute and return\n if (!isObject && !isArray) {\n attribute.rightAccessory = accessory;\n attribute.disabled = disabled;\n return attribute;\n }\n\n // The object can be optional (tappable radio-checkmark), or required (checkmark)\n if (status === SelectorStatus.SelectedCheckmark || status === SelectorStatus.Empty) {\n // If it's a selectable object, the accessory is rendered next to the object title,\n // The nested attributes have no accessory, and can not be selected\n attribute.rightAccessory = accessory;\n setStatusForNestedObjectOrArrayFields(attribute, undefined, true);\n } else {\n const nested = attribute.attributes ?? attribute.values;\n // If the object is required / rejected, the accessory is rendered next to each nested attribute (except other object titles)\n // all fields are disabled\n for (const nestedAttribute of nested) {\n setStatusForNestedObjectOrArrayFields(nestedAttribute, status, true);\n }\n }\n};\n\nexport type ShareCredentialCardLabels = CardLabels & {\n selectiveDisclosure: string;\n missingAttribute: string;\n missingCredential: string;\n multipleCredentials: string;\n disclosurePolicyViolation: string;\n};\n\nexport const shareCredentialCardFromCredential = (\n credential: CredentialDetail | PresentationDefinitionV2Credential | undefined,\n expanded: boolean,\n multipleCredentialsAvailable: boolean,\n request: PresentationDefinitionRequestedCredential,\n selectedFields: string[] | undefined,\n config: CoreConfig,\n testID: string,\n labels: ShareCredentialCardLabels,\n language: string | undefined,\n): CredentialDetailsCardPropsWithoutWidth => {\n const credentialAsListItem: CredentialListItem | undefined = credential\n ? { type: CredentialType.SINGLE, ...credential, issuer: credential.issuer?.id }\n : undefined;\n const selectiveDisclosureSupported = supportsSelectiveDisclosure(credentialAsListItem, config);\n const cardTestId = concatTestID(testID, 'card');\n const card = credential\n ? validityCheckedCardFromCredential(\n credential,\n expanded,\n selectiveDisclosureSupported,\n multipleCredentialsAvailable,\n config,\n undefined,\n cardTestId,\n labels,\n language,\n )\n : missingCredentialCardFromRequest(request, undefined, cardTestId, labels);\n const validityState = getValidityState(credentialAsListItem);\n const displayedAttributes = getDisplayedAttributes(\n request,\n validityState,\n credential ? credentialDetailFromPresentationV2Credential(credential) : undefined,\n selectiveDisclosureSupported,\n selectedFields,\n );\n\n const attributes: CredentialAttribute[] = displayedAttributes.map(({ claim, field, id, selected, status }, index) => {\n const disabled = !credential || !field || field.required || !claim;\n const attribute: CredentialAttribute = {\n ...shareCredentialCardAttributeFromClaim(\n id,\n config,\n concatTestID(testID, 'attribute', `${index}`),\n labels,\n language,\n claim,\n field,\n ),\n selected,\n };\n\n setStatusForNestedObjectOrArrayFields(attribute, status, disabled);\n return attribute;\n });\n return {\n attributes: nestAttributes(attributes),\n card,\n };\n};\n\nexport const selectCredentialCardAttributeFromClaim = (\n id: string,\n config: CoreConfig,\n testID: string,\n labels: ShareCredentialCardLabels,\n language: string | undefined,\n claim?: FlatClaim,\n field?: PresentationDefinitionField,\n): CredentialAttribute => {\n const attribute = shareCredentialCardAttributeFromClaim(id, config, testID, labels, language, claim, field);\n if (!claim) {\n return attribute;\n }\n return {\n ...attribute,\n rightAccessory: RequiredAttributeIcon,\n };\n};\n\nexport const selectCredentialCardFromCredential = (\n credential: CredentialDetail,\n selected: boolean,\n request: PresentationDefinitionRequestedCredential,\n config: CoreConfig,\n testID: string,\n labels: ShareCredentialCardLabels,\n language: string | undefined,\n): CredentialDetailsCardPropsWithoutWidth => {\n const selectiveDisclosureSupported = supportsSelectiveDisclosure(\n credential ? { ...credential, issuer: credential.issuer?.id } : undefined,\n config,\n );\n const rightAccessory = <Selector status={selected ? SelectorStatus.SelectedRadio : SelectorStatus.Empty} />;\n const notice: CredentialCardNotice | undefined =\n selectiveDisclosureSupported === false\n ? {\n text: labels.selectiveDisclosure,\n noticeIcon: CredentialNoticeWarningIcon,\n }\n : undefined;\n const { header, ...cardProps } = getCredentialCardPropsFromCredential(\n credential,\n credential.claims,\n config,\n notice,\n testID,\n labels,\n language,\n );\n const card = {\n header: {\n ...header,\n accessory: rightAccessory,\n },\n ...cardProps,\n };\n const attributes: CredentialAttribute[] = getFullyNestedFields(request.fields, credential.id).map((field) => {\n const claim = spreadClaims(credential.claims).find(({ path }) => {\n return path === field.keyMap[credential.id];\n });\n\n const attribute = selectCredentialCardAttributeFromClaim(field.id, config, testID, labels, language, claim, field);\n return {\n ...attribute,\n rightAccessory: (\n <Selector status={field.required && !claim ? SelectorStatus.Rejected : SelectorStatus.Required} />\n ),\n };\n });\n return {\n attributes: nestAttributes(attributes),\n card,\n };\n};\n"],"mappings":"AAAA,SAKEA,cAAc,QAIT,iCAAiC;AACxC,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAIEC,QAAQ,EACRC,cAAc,QACT,gCAAgC;AAEvC,SAASC,2BAA2B,EAAEC,qBAAqB,EAAEC,qBAAqB,QAAQ,2BAA2B;AACrH,SAASC,YAAY,QAAQ,WAAW;AACxC,SAEEC,4CAA4C,EAE5CC,6BAA6B,EAC7BC,oCAAoC,EACpCC,gBAAgB,EAChBC,cAAc,EACdC,2BAA2B,EAC3BC,aAAa,QACR,cAAc;AAErB,OAAO,MAAMC,iCAAiC,GAAGA,CAC/CC,UAAiE,EACjEC,QAAiB,EACjBC,4BAAiD,EACjDC,4BAAqC,EACrCC,MAAkB,EAClBC,MAAwC,EACxCC,MAAc,EACdC,MAAiC,EACjCC,QAA4B,KACkD;EAC9E,IAAIC,sBASS;EACb,IAAIP,4BAA4B,KAAK,KAAK,EAAE;IAC1CO,sBAAsB,GAAG;MACvBC,uBAAuB,EAAEH,MAAM,CAACI,mBAAmB;MACnDC,sBAAsB,EAAErB,YAAY,CAACe,MAAM,EAAE,+BAA+B,CAAC;MAC7EO,UAAU,EAAExB;IACd,CAAC;EACH,CAAC,MAAM,IAAI,mCAAmC,IAAIW,UAAU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AY,CAAC1C,UAAU,CAACiB,MAAM,CAAC,CAACqD,IAAI,CAAC,CAAC;MAAEhB;IAAK,CAAC,KAAK;MAC/D,OAAOA,IAAI,KAAKvB,KAAK,CAACoC,MAAM,CAACnE,UAAU,CAAC6B,EAAE,CAAC;IAC7C,CAAC,CAAC;IAEF,MAAMwD,SAAS,GAAGsB,sCAAsC,CAAC5E,KAAK,CAACF,EAAE,EAAEzB,MAAM,EAAEE,MAAM,EAAEC,MAAM,EAAEC,QAAQ,EAAEyB,KAAK,EAAEF,KAAK,CAAC;IAClH,OAAO;MACL,GAAGsD,SAAS;MACZS,cAAc,eACZ7G,KAAA,CAAAuG,aAAA,CAACtG,QAAQ;QAACqF,MAAM,EAAExC,KAAK,CAACM,QAAQ,IAAI,CAACJ,KAAK,GAAG9C,cAAc,CAACiD,QAAQ,GAAGjD,cAAc,CAACmD;MAAS,CAAE;IAErG,CAAC;EACH,CAAC,CAAC;EACF,OAAO;IACLoD,UAAU,EAAE9F,cAAc,CAAC8F,UAAU,CAAC;IACtC1E;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import { FunctionComponent, PropsWithChildren } from 'react';
2
- export declare const ProofRequestGroup: FunctionComponent<PropsWithChildren>;
@@ -1,3 +0,0 @@
1
- export * from './group';
2
- export * from './select-credential';
3
- export * from './share-credential';
@@ -1,15 +0,0 @@
1
- import { PresentationDefinitionRequestedCredential } from '@procivis/react-native-one-core';
2
- import { FC } from 'react';
3
- import { ImageSourcePropType } from 'react-native';
4
- import { ShareCredentialCardLabels } from '../../../utils/parsers/credential-sharing';
5
- export declare const SelectCredential: FC<{
6
- credentialId: string;
7
- labels: ShareCredentialCardLabels;
8
- language?: string;
9
- lastItem: boolean;
10
- onImagePreview: (title: string, image: ImageSourcePropType) => void;
11
- onPress?: () => void;
12
- request: PresentationDefinitionRequestedCredential;
13
- selected: boolean;
14
- testID: string;
15
- }>;
@@ -1,27 +0,0 @@
1
- import { CredentialDetail, CredentialListItem, PresentationDefinitionField, PresentationDefinitionRequestedCredential } from '@procivis/react-native-one-core';
2
- import { FunctionComponent } from 'react';
3
- import { ImageSourcePropType, StyleProp, ViewStyle } from 'react-native';
4
- import { ShareCredentialCardLabels } from '../../../utils/parsers/credential-sharing';
5
- export type ShareCredentialLabels = ShareCredentialCardLabels & {
6
- invalidCredentialNotice: string;
7
- multipleCredentialsNotice: string;
8
- multipleCredentialsSelect: string;
9
- revokedCredentialNotice: string;
10
- suspendedCredentialNotice: string;
11
- };
12
- export declare const ShareCredential: FunctionComponent<{
13
- allCredentials: CredentialDetail[];
14
- expanded?: boolean;
15
- labels: ShareCredentialLabels;
16
- language?: string;
17
- lastItem?: boolean;
18
- onHeaderPress?: (_credentialId?: string) => void;
19
- onImagePreview: (title: string, image: ImageSourcePropType) => void;
20
- onSelectCredential?: () => void;
21
- onSelectField: (_id: PresentationDefinitionField['id'], _selected: boolean) => void;
22
- request: PresentationDefinitionRequestedCredential;
23
- selectedCredentialId?: CredentialListItem['id'];
24
- selectedFields?: Array<PresentationDefinitionField['id']>;
25
- style?: StyleProp<ViewStyle>;
26
- testID: string;
27
- }>;
@@ -1,21 +0,0 @@
1
- import { Claim, CoreConfig, CredentialDetail, PresentationDefinitionField, PresentationDefinitionRequestedCredential, PresentationDefinitionV2Credential } from '@procivis/react-native-one-core';
2
- import { CredentialAttribute, CredentialCardProps } from '../../ui-components/credential';
3
- import { CredentialCardNotice } from '../../ui-components/credential/card/credential-card';
4
- import { CardLabels, CredentialDetailsCardPropsWithoutWidth } from './credential';
5
- export declare const validityCheckedCardFromCredential: (credential: CredentialDetail | PresentationDefinitionV2Credential, expanded: boolean, selectiveDisclosureSupported: boolean | undefined, multipleCredentialsAvailable: boolean, config: CoreConfig, notice: CredentialCardNotice | undefined, testID: string, labels: ShareCredentialCardLabels, language: string | undefined) => Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'testID' | 'width'>;
6
- export declare const missingCredentialCardFromRequest: (request: PresentationDefinitionRequestedCredential, notice: CredentialCardNotice | undefined, testID: string, labels: ShareCredentialCardLabels) => Omit<CredentialCardProps, 'onHeaderPress' | 'style' | 'width'>;
7
- type FlatClaim = Claim & {
8
- isArrayElement?: boolean;
9
- };
10
- export declare const shareCredentialCardAttributeFromClaim: (id: string, config: CoreConfig, testID: string, labels: ShareCredentialCardLabels, language: string | undefined, claim?: FlatClaim, field?: PresentationDefinitionField) => CredentialAttribute;
11
- export type ShareCredentialCardLabels = CardLabels & {
12
- selectiveDisclosure: string;
13
- missingAttribute: string;
14
- missingCredential: string;
15
- multipleCredentials: string;
16
- disclosurePolicyViolation: string;
17
- };
18
- export declare const shareCredentialCardFromCredential: (credential: CredentialDetail | PresentationDefinitionV2Credential | undefined, expanded: boolean, multipleCredentialsAvailable: boolean, request: PresentationDefinitionRequestedCredential, selectedFields: string[] | undefined, config: CoreConfig, testID: string, labels: ShareCredentialCardLabels, language: string | undefined) => CredentialDetailsCardPropsWithoutWidth;
19
- export declare const selectCredentialCardAttributeFromClaim: (id: string, config: CoreConfig, testID: string, labels: ShareCredentialCardLabels, language: string | undefined, claim?: FlatClaim, field?: PresentationDefinitionField) => CredentialAttribute;
20
- export declare const selectCredentialCardFromCredential: (credential: CredentialDetail, selected: boolean, request: PresentationDefinitionRequestedCredential, config: CoreConfig, testID: string, labels: ShareCredentialCardLabels, language: string | undefined) => CredentialDetailsCardPropsWithoutWidth;
21
- export {};
@@ -1,26 +0,0 @@
1
- import React, { FunctionComponent, PropsWithChildren } from 'react';
2
- import { StyleSheet, View } from 'react-native';
3
-
4
- import { useAppColorScheme } from '../../../ui-components/theme';
5
-
6
- export const ProofRequestGroup: FunctionComponent<PropsWithChildren> = ({ children }) => {
7
- const colorScheme = useAppColorScheme();
8
- return (
9
- <View style={styles.group}>
10
- <View style={[styles.separator, { backgroundColor: colorScheme.grayDark }]} />
11
- {children}
12
- </View>
13
- );
14
- };
15
-
16
- const styles = StyleSheet.create({
17
- group: {
18
- marginTop: 16,
19
- },
20
- separator: {
21
- height: 1,
22
- marginBottom: 16,
23
- marginHorizontal: 4,
24
- opacity: 0.5,
25
- },
26
- });
@@ -1,3 +0,0 @@
1
- export * from './group';
2
- export * from './select-credential';
3
- export * from './share-credential';
@@ -1,55 +0,0 @@
1
- import { PresentationDefinitionRequestedCredential } from '@procivis/react-native-one-core';
2
- import React, { FC, useMemo } from 'react';
3
- import { Dimensions, ImageSourcePropType } from 'react-native';
4
-
5
- import { CredentialDetailsCardListItem } from '../../../ui-components';
6
- import { useCoreConfig } from '../../../utils/hooks/core/core-config';
7
- import { useCredentialDetail } from '../../../utils/hooks/core/credentials';
8
- import {
9
- selectCredentialCardFromCredential,
10
- ShareCredentialCardLabels,
11
- } from '../../../utils/parsers/credential-sharing';
12
-
13
- export const SelectCredential: FC<{
14
- credentialId: string;
15
- labels: ShareCredentialCardLabels;
16
- language?: string;
17
- lastItem: boolean;
18
- onImagePreview: (title: string, image: ImageSourcePropType) => void;
19
- onPress?: () => void;
20
- request: PresentationDefinitionRequestedCredential;
21
- selected: boolean;
22
- testID: string;
23
- }> = ({ credentialId, labels, language, lastItem, onImagePreview, onPress, request, selected, testID }) => {
24
- const { data: credential } = useCredentialDetail(credentialId);
25
- const { data: config } = useCoreConfig();
26
- const cardWidth = useMemo(() => Dimensions.get('window').width - 32, []);
27
-
28
- if (!credential || !config) {
29
- return null;
30
- }
31
-
32
- const { card, attributes } = selectCredentialCardFromCredential(
33
- credential,
34
- selected,
35
- request,
36
- config,
37
- testID,
38
- labels,
39
- language,
40
- );
41
-
42
- return (
43
- <CredentialDetailsCardListItem
44
- attributes={attributes}
45
- card={{
46
- ...card,
47
- onHeaderPress: onPress,
48
- width: cardWidth,
49
- }}
50
- expanded={selected}
51
- lastItem={lastItem}
52
- onImagePreview={onImagePreview}
53
- />
54
- );
55
- };