@procivis/one-react-native-components 0.3.121 → 0.3.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/credential/credential.js +2 -1
- package/lib/commonjs/components/credential/credential.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item-icon.js +2 -3
- package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item.js +2 -8
- package/lib/commonjs/components/history/history-list-item.js.map +1 -1
- package/lib/commonjs/components/history/history-list-screen.js +1 -1
- package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
- package/lib/commonjs/components/index.js +0 -11
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/select-credential.js +2 -1
- package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js +2 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js +2 -1
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js +3 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +4 -2
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js +3 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
- package/lib/commonjs/ui-components/header/header.js.map +1 -1
- package/lib/commonjs/ui-components/history/history-details.js +2 -2
- package/lib/commonjs/ui-components/history/history-details.js.map +1 -1
- package/lib/commonjs/ui-components/icons/contact.js.map +1 -1
- package/lib/commonjs/ui-components/icons/credential.js +3 -3
- package/lib/commonjs/ui-components/icons/credential.js.map +1 -1
- package/lib/commonjs/ui-components/icons/icons.js +20 -1
- package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
- package/lib/commonjs/ui-components/loader/loading-result.js +2 -0
- package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js +7 -33
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/commonjs/utils/date.js +4 -5
- package/lib/commonjs/utils/date.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/cache.js +7 -4
- package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-config.js +1 -6
- package/lib/commonjs/utils/hooks/core/core-config.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-context.js +0 -15
- package/lib/commonjs/utils/hooks/core/core-context.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credentials.js +15 -1
- package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/index.js +0 -11
- package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/trust-list.js +19 -3
- package/lib/commonjs/utils/hooks/core/trust-list.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/verifier-instance.js +22 -3
- package/lib/commonjs/utils/hooks/core/verifier-instance.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js +2 -2
- package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js +14 -14
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing.js +20 -18
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +36 -22
- package/lib/commonjs/utils/parsers/credential.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.js +1 -1
- package/lib/commonjs/utils/parsers/query.js.map +1 -1
- package/lib/commonjs/utils/translations.js +15 -0
- package/lib/commonjs/utils/translations.js.map +1 -0
- package/lib/module/components/credential/credential.js +2 -1
- package/lib/module/components/credential/credential.js.map +1 -1
- package/lib/module/components/history/history-list-item-icon.js +2 -3
- package/lib/module/components/history/history-list-item-icon.js.map +1 -1
- package/lib/module/components/history/history-list-item.js +3 -9
- package/lib/module/components/history/history-list-item.js.map +1 -1
- package/lib/module/components/history/history-list-screen.js +1 -1
- package/lib/module/components/history/history-list-screen.js.map +1 -1
- package/lib/module/components/index.js +0 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/proof-request/v1/select-credential.js +2 -1
- package/lib/module/components/proof-request/v1/select-credential.js.map +1 -1
- package/lib/module/components/proof-request/v1/share-credential.js +2 -1
- package/lib/module/components/proof-request/v1/share-credential.js.map +1 -1
- package/lib/module/components/proof-request/v2/select-credential-v2.js +2 -1
- package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js +3 -1
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2.js +4 -2
- package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js +3 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/module/ui-components/header/foldable-header.js.map +1 -1
- package/lib/module/ui-components/header/header.js.map +1 -1
- package/lib/module/ui-components/history/history-details.js +3 -3
- package/lib/module/ui-components/history/history-details.js.map +1 -1
- package/lib/module/ui-components/icons/contact.js.map +1 -1
- package/lib/module/ui-components/icons/credential.js +1 -1
- package/lib/module/ui-components/icons/credential.js.map +1 -1
- package/lib/module/ui-components/icons/icons.js +18 -0
- package/lib/module/ui-components/icons/icons.js.map +1 -1
- package/lib/module/ui-components/loader/loading-result.js +2 -0
- package/lib/module/ui-components/loader/loading-result.js.map +1 -1
- package/lib/module/ui-components/screens/nerd-mode-screen.js +7 -33
- package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/module/utils/date.js +4 -5
- package/lib/module/utils/date.js.map +1 -1
- package/lib/module/utils/hooks/core/cache.js +7 -4
- package/lib/module/utils/hooks/core/cache.js.map +1 -1
- package/lib/module/utils/hooks/core/core-config.js +0 -4
- package/lib/module/utils/hooks/core/core-config.js.map +1 -1
- package/lib/module/utils/hooks/core/core-context.js +0 -15
- package/lib/module/utils/hooks/core/core-context.js.map +1 -1
- package/lib/module/utils/hooks/core/credentials.js +13 -0
- package/lib/module/utils/hooks/core/credentials.js.map +1 -1
- package/lib/module/utils/hooks/core/index.js +0 -1
- package/lib/module/utils/hooks/core/index.js.map +1 -1
- package/lib/module/utils/hooks/core/trust-list.js +20 -4
- package/lib/module/utils/hooks/core/trust-list.js.map +1 -1
- package/lib/module/utils/hooks/core/verifier-instance.js +20 -2
- package/lib/module/utils/hooks/core/verifier-instance.js.map +1 -1
- package/lib/module/utils/hooks/core/wallet-unit.js +2 -2
- package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing-v2.js +15 -15
- package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing.js +20 -18
- package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +37 -23
- package/lib/module/utils/parsers/credential.js.map +1 -1
- package/lib/module/utils/parsers/query.js +1 -1
- package/lib/module/utils/parsers/query.js.map +1 -1
- package/lib/module/utils/translations.js +8 -0
- package/lib/module/utils/translations.js.map +1 -0
- package/lib/typescript/components/credential/credential.d.ts +1 -0
- package/lib/typescript/components/history/history-list-item.d.ts +1 -1
- package/lib/typescript/components/index.d.ts +0 -1
- package/lib/typescript/components/proof-request/v1/select-credential.d.ts +1 -0
- package/lib/typescript/components/proof-request/v1/share-credential.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +1 -0
- package/lib/typescript/ui-components/history/history-details.d.ts +2 -2
- package/lib/typescript/ui-components/icons/credential.d.ts +1 -1
- package/lib/typescript/ui-components/icons/icons.d.ts +1 -0
- package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +0 -12
- package/lib/typescript/utils/hooks/core/core-config.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/core-context.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/credentials.d.ts +2 -1
- package/lib/typescript/utils/hooks/core/index.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/trust-list.d.ts +1 -4
- package/lib/typescript/utils/hooks/core/verifier-instance.d.ts +2 -0
- package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +2 -2
- package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +3 -3
- package/lib/typescript/utils/parsers/credential-sharing.d.ts +6 -6
- package/lib/typescript/utils/parsers/credential.d.ts +5 -5
- package/lib/typescript/utils/parsers/query.d.ts +1 -1
- package/lib/typescript/utils/translations.d.ts +1 -0
- package/package.json +3 -3
- package/src/components/credential/credential.tsx +3 -0
- package/src/components/history/history-list-item-icon.tsx +1 -2
- package/src/components/history/history-list-item.tsx +4 -9
- package/src/components/history/history-list-screen.tsx +1 -1
- package/src/components/index.ts +0 -1
- package/src/components/proof-request/v1/select-credential.tsx +3 -1
- package/src/components/proof-request/v1/share-credential.tsx +3 -0
- package/src/components/proof-request/v2/select-credential-v2.tsx +3 -1
- package/src/components/proof-request/v2/share-credential-v2-group.tsx +4 -0
- package/src/components/proof-request/v2/share-credential-v2.tsx +5 -0
- package/src/ui-components/credential/card/credential-details-card.tsx +3 -2
- package/src/ui-components/header/foldable-header.tsx +10 -9
- package/src/ui-components/header/header.tsx +10 -1
- package/src/ui-components/history/history-details.tsx +4 -4
- package/src/ui-components/icons/contact.tsx +1 -1
- package/src/ui-components/icons/credential.tsx +1 -1
- package/src/ui-components/icons/icons.tsx +18 -0
- package/src/ui-components/loader/loading-result.tsx +7 -1
- package/src/ui-components/screens/nerd-mode-screen.tsx +2 -52
- package/src/utils/date.ts +7 -14
- package/src/utils/hooks/core/cache.ts +10 -3
- package/src/utils/hooks/core/core-config.ts +1 -6
- package/src/utils/hooks/core/core-context.tsx +0 -24
- package/src/utils/hooks/core/credentials.ts +13 -0
- package/src/utils/hooks/core/index.ts +0 -1
- package/src/utils/hooks/core/trust-list.ts +22 -11
- package/src/utils/hooks/core/verifier-instance.ts +23 -2
- package/src/utils/hooks/core/wallet-unit.ts +3 -3
- package/src/utils/parsers/credential-sharing-v2.tsx +29 -12
- package/src/utils/parsers/credential-sharing.tsx +33 -16
- package/src/utils/parsers/credential.ts +45 -14
- package/src/utils/parsers/query.ts +3 -0
- package/src/utils/translations.ts +10 -0
- package/lib/commonjs/components/entity/EntityButtons.js +0 -64
- package/lib/commonjs/components/entity/EntityButtons.js.map +0 -1
- package/lib/commonjs/components/entity/entity-attributes.js +0 -65
- package/lib/commonjs/components/entity/entity-attributes.js.map +0 -1
- package/lib/commonjs/components/entity/entity-details-with-buttons.js +0 -67
- package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +0 -1
- package/lib/commonjs/components/entity/entity-details.js +0 -101
- package/lib/commonjs/components/entity/entity-details.js.map +0 -1
- package/lib/commonjs/components/entity/index.js +0 -14
- package/lib/commonjs/components/entity/index.js.map +0 -1
- package/lib/commonjs/utils/hooks/core/trust-entity.js +0 -147
- package/lib/commonjs/utils/hooks/core/trust-entity.js.map +0 -1
- package/lib/module/components/entity/EntityButtons.js +0 -56
- package/lib/module/components/entity/EntityButtons.js.map +0 -1
- package/lib/module/components/entity/entity-attributes.js +0 -57
- package/lib/module/components/entity/entity-attributes.js.map +0 -1
- package/lib/module/components/entity/entity-details-with-buttons.js +0 -58
- package/lib/module/components/entity/entity-details-with-buttons.js.map +0 -1
- package/lib/module/components/entity/entity-details.js +0 -92
- package/lib/module/components/entity/entity-details.js.map +0 -1
- package/lib/module/components/entity/index.js +0 -3
- package/lib/module/components/entity/index.js.map +0 -1
- package/lib/module/utils/hooks/core/trust-entity.js +0 -136
- package/lib/module/utils/hooks/core/trust-entity.js.map +0 -1
- package/lib/typescript/components/entity/EntityButtons.d.ts +0 -14
- package/lib/typescript/components/entity/entity-attributes.d.ts +0 -15
- package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +0 -18
- package/lib/typescript/components/entity/entity-details.d.ts +0 -21
- package/lib/typescript/components/entity/index.d.ts +0 -3
- package/lib/typescript/utils/hooks/core/trust-entity.d.ts +0 -17
- package/src/components/entity/EntityButtons.tsx +0 -79
- package/src/components/entity/entity-attributes.tsx +0 -80
- package/src/components/entity/entity-details-with-buttons.tsx +0 -75
- package/src/components/entity/entity-details.tsx +0 -145
- package/src/components/entity/index.ts +0 -4
- package/src/utils/hooks/core/trust-entity.ts +0 -172
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","memo","useCallback","useMemo","Linking","StyleSheet","View","Button","ButtonType","concatTestID","reportException","EntityButtons","entity","labels","testID","buttons","label","visitWebsite","url","website","termsAndServices","termsUrl","privacyPolicy","privacyUrl","filter","btn","Boolean","openURL","catch","e","createElement","style","styles","map","testIdSuffix","key","title","onPress","urlButton","type","SmallTech","create","paddingBottom","paddingHorizontal","borderRadius","borderWidth","marginTop"],"sources":["EntityButtons.tsx"],"sourcesContent":["import { TrustEntityDetail } from '@procivis/react-native-one-core';\nimport React, { FC, memo, useCallback, useMemo } from 'react';\nimport { Linking, StyleSheet, View } from 'react-native';\n\nimport { Button, ButtonType } from '../../ui-components/buttons';\nimport { EntityLabels } from '../../ui-components/screens/nerd-mode-screen';\nimport { concatTestID, reportException } from '../../utils';\n\nexport interface EntityButton {\n url: string;\n label: string;\n}\n\ninterface EntityButtonsProps {\n entity?: TrustEntityDetail;\n labels: EntityLabels;\n testID?: string;\n}\n\nconst EntityButtons: FC<EntityButtonsProps> = ({ entity, labels, testID }) => {\n const buttons = useMemo(\n () =>\n [\n {\n label: labels.visitWebsite,\n url: entity?.website || '',\n testID: 'website',\n },\n {\n label: labels.termsAndServices,\n url: entity?.termsUrl || '',\n testID: 'termsOfService',\n },\n {\n label: labels.privacyPolicy,\n url: entity?.privacyUrl || '',\n testID: 'privacyPolicy',\n },\n ].filter((btn) => Boolean(btn.url)),\n [entity, labels],\n );\n\n const openURL = useCallback(\n (url: string) => () => {\n Linking.openURL(url).catch((e) => {\n reportException(e, 'Error opening entity link');\n });\n },\n [],\n );\n return (\n <View style={[styles.buttons]} testID={testID}>\n {buttons.map(({ label, url, testID: testIdSuffix }) => (\n <Button\n key={label}\n title={label}\n onPress={openURL(url)}\n style={styles.urlButton}\n testID={concatTestID(testID, testIdSuffix)}\n type={ButtonType.SmallTech}\n />\n ))}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n buttons: {\n paddingBottom: 10,\n paddingHorizontal: 12,\n },\n urlButton: {\n borderRadius: 4,\n borderWidth: 0,\n marginTop: 4,\n },\n});\n\nexport default memo(EntityButtons);\n"],"mappings":"AACA,OAAOA,KAAK,IAAQC,IAAI,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC7D,SAASC,OAAO,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAExD,SAASC,MAAM,EAAEC,UAAU,QAAQ,6BAA6B;AAEhE,SAASC,YAAY,EAAEC,eAAe,QAAQ,aAAa;AAa3D,MAAMC,aAAqC,GAAGA,CAAC;EAAEC,MAAM;EAAEC,MAAM;EAAEC;AAAO,CAAC,KAAK;EAC5E,MAAMC,OAAO,GAAGZ,OAAO,CACrB,MACE,CACE;IACEa,KAAK,EAAEH,MAAM,CAACI,YAAY;IAC1BC,GAAG,EAAE,CAAAN,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEO,OAAO,KAAI,EAAE;IAC1BL,MAAM,EAAE;EACV,CAAC,EACD;IACEE,KAAK,EAAEH,MAAM,CAACO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AC/B1B,OAAO,EAAE;IACP2B,aAAa,EAAE,EAAE;IACjBC,iBAAiB,EAAE;EACrB,CAAC;EACDL,SAAS,EAAE;IACTM,YAAY,EAAE,CAAC;IACfC,WAAW,EAAE,CAAC;IACdC,SAAS,EAAE;EACb;AACF,CAAC,CAAC;AAEF,4BAAe7C,IAAI,CAACU,aAAa,CAAC","ignoreList":[]}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { memo } from 'react';
|
|
3
|
-
import { StyleSheet, View } from 'react-native';
|
|
4
|
-
import { NerdModeItem } from '../../ui-components/nerd-view';
|
|
5
|
-
import { EntityType } from '../../ui-components/screens/nerd-mode-screen';
|
|
6
|
-
import { addElementIf } from '../../utils/array';
|
|
7
|
-
const EntityAttributes = ({
|
|
8
|
-
certificate,
|
|
9
|
-
did,
|
|
10
|
-
trustEntity,
|
|
11
|
-
trusted,
|
|
12
|
-
labels,
|
|
13
|
-
entityType,
|
|
14
|
-
testID,
|
|
15
|
-
onCopyToClipboard
|
|
16
|
-
}) => {
|
|
17
|
-
var _did$split;
|
|
18
|
-
const didSections = (_did$split = did === null || did === void 0 ? void 0 : did.split(':')) !== null && _did$split !== void 0 ? _did$split : [];
|
|
19
|
-
const identifier = didSections.pop();
|
|
20
|
-
const didMethod = didSections.length ? didSections.join(':') + ':' : '';
|
|
21
|
-
const attributes = [...addElementIf(trusted, {
|
|
22
|
-
attributeKey: labels.trustRegistry,
|
|
23
|
-
highlightedText: trustEntity === null || trustEntity === void 0 ? void 0 : trustEntity.trustAnchor.name,
|
|
24
|
-
testID: 'trustRegistry'
|
|
25
|
-
}), ...addElementIf(Boolean(did), {
|
|
26
|
-
attributeKey: entityType === EntityType.CredentialEntity ? labels.issuerIdentifier : labels.entityIdentifier,
|
|
27
|
-
attributeText: identifier,
|
|
28
|
-
canBeCopied: true,
|
|
29
|
-
highlightedText: didMethod,
|
|
30
|
-
testID: 'issuerDID'
|
|
31
|
-
}), ...addElementIf(Boolean(certificate), {
|
|
32
|
-
attributeKey: entityType === EntityType.CredentialEntity ? labels.issuerIdentifier : labels.entityIdentifier,
|
|
33
|
-
attributeText: certificate,
|
|
34
|
-
canBeCopied: true,
|
|
35
|
-
testID: 'issuerCertificate'
|
|
36
|
-
}), ...addElementIf(trusted && Boolean(trustEntity === null || trustEntity === void 0 ? void 0 : trustEntity.role), {
|
|
37
|
-
attributeKey: labels.role,
|
|
38
|
-
highlightedText: trustEntity === null || trustEntity === void 0 ? void 0 : trustEntity.role,
|
|
39
|
-
testID: 'role'
|
|
40
|
-
})];
|
|
41
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
42
|
-
style: styles.wrapper
|
|
43
|
-
}, attributes.map(attribute => /*#__PURE__*/React.createElement(NerdModeItem, _extends({
|
|
44
|
-
key: attribute.attributeKey
|
|
45
|
-
}, attribute, {
|
|
46
|
-
labels: labels,
|
|
47
|
-
onCopyToClipboard: onCopyToClipboard,
|
|
48
|
-
testID: testID
|
|
49
|
-
}))));
|
|
50
|
-
};
|
|
51
|
-
const styles = StyleSheet.create({
|
|
52
|
-
wrapper: {
|
|
53
|
-
marginBottom: 20
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
export default /*#__PURE__*/memo(EntityAttributes);
|
|
57
|
-
//# sourceMappingURL=entity-attributes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","memo","StyleSheet","View","NerdModeItem","EntityType","addElementIf","EntityAttributes","certificate","did","trustEntity","trusted","labels","entityType","testID","onCopyToClipboard","_did$split","didSections","split","identifier","pop","didMethod","length","join","attributes","attributeKey","trustRegistry","highlightedText","trustAnchor","name","Boolean","CredentialEntity","issuerIdentifier","entityIdentifier","attributeText","canBeCopied","role","createElement","style","styles","wrapper","map","attribute","_extends","key","create","marginBottom"],"sources":["entity-attributes.tsx"],"sourcesContent":["import { TrustEntityDetail, TrustEntityListItem } from '@procivis/react-native-one-core';\nimport React, { FC, memo } from 'react';\nimport { StyleSheet, View } from 'react-native';\n\nimport { NerdModeItem } from '../../ui-components/nerd-view';\nimport { AttributesLabels, EntityType } from '../../ui-components/screens/nerd-mode-screen';\nimport { addElementIf } from '../../utils/array';\n\ninterface EntityAttributesProps {\n certificate?: string;\n did?: string;\n trustEntity?: TrustEntityDetail | TrustEntityListItem;\n trusted: boolean;\n labels: AttributesLabels;\n onCopyToClipboard: (value: string) => void;\n entityType: EntityType;\n testID?: string;\n}\n\nconst EntityAttributes: FC<EntityAttributesProps> = ({\n certificate,\n did,\n trustEntity,\n trusted,\n labels,\n entityType,\n testID,\n onCopyToClipboard,\n}) => {\n const didSections = did?.split(':') ?? [];\n const identifier = didSections.pop();\n const didMethod = didSections.length ? didSections.join(':') + ':' : '';\n\n const attributes = [\n ...addElementIf(trusted, {\n attributeKey: labels.trustRegistry,\n highlightedText: trustEntity?.trustAnchor.name,\n testID: 'trustRegistry',\n }),\n ...addElementIf(Boolean(did), {\n attributeKey: entityType === EntityType.CredentialEntity ? labels.issuerIdentifier : labels.entityIdentifier,\n attributeText: identifier,\n canBeCopied: true,\n highlightedText: didMethod,\n testID: 'issuerDID',\n }),\n ...addElementIf(Boolean(certificate), {\n attributeKey: entityType === EntityType.CredentialEntity ? labels.issuerIdentifier : labels.entityIdentifier,\n attributeText: certificate,\n canBeCopied: true,\n testID: 'issuerCertificate',\n }),\n ...addElementIf(trusted && Boolean(trustEntity?.role), {\n attributeKey: labels.role,\n highlightedText: trustEntity?.role,\n testID: 'role',\n }),\n ];\n return (\n <View style={styles.wrapper}>\n {attributes.map((attribute) => (\n <NerdModeItem\n key={attribute.attributeKey}\n {...attribute}\n labels={labels}\n onCopyToClipboard={onCopyToClipboard}\n testID={testID}\n />\n ))}\n </View>\n );\n};\n\nconst styles = St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,MAAM,EAAE;EACV,CAAC,CAAC,EACF,GAAGR,YAAY,CAACwB,OAAO,CAACtB,WAAW,CAAC,EAAE;IACpCiB,YAAY,EAAEZ,UAAU,KAAKR,UAAU,CAAC0B,gBAAgB,GAAGnB,MAAM,CAACoB,gBAAgB,GAAGpB,MAAM,CAACqB,gBAAgB;IAC5GC,aAAa,EAAE1B,WAAW;IAC1B2B,WAAW,EAAE,IAAI;IACjBrB,MAAM,EAAE;EACV,CAAC,CAAC,EACF,GAAGR,YAAY,CAACK,OAAO,IAAImB,OAAO,CAACpB,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAE0B,IAAI,CAAC,EAAE;IACrDX,YAAY,EAAEb,MAAM,CAACwB,IAAI;IACzBT,eAAe,EAAEjB,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAE0B,IAAI;IAClCtB,MAAM,EAAE;EACV,CAAC,CAAC,CACH;EACD,oBACEd,KAAA,CAAAqC,aAAA,CAAClC,IAAI;IAACmC,KAAK,EAAEC,MAAM,CAACC;EAAQ,GACzBhB,UAAU,CAACiB,GAAG,CAAEC,SAAS,iBACxB1C,KAAA,CAAAqC,aAAA,CAACjC,YAAY,EAAAuC,QAAA;IACXC,GAAG,EAAEF,SAAS,CAACjB;EAAa,GACxBiB,SAAS;IACb9B,MAAM,EAAEA,MAAO;IACfG,iBAAiB,EAAEA,iBAAkB;IACrCD,MAAM,EAAEA;EAAO,EAChB,CACF,CACG,CAAC;AAEX,CAAC;AAED,MAAMyB,MAAM,GAAGrC,UAAU,CAAC2C,MAAM,CAAC;EAC/BL,OAAO,EAAE;IACPM,YAAY,EAAE;EAChB;AACF,CAAC,CAAC;AAEF,4BAAe7C,IAAI,CAACM,gBAAgB,CAAC","ignoreList":[]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import { TrustEntityRole, TrustEntityState } from '@procivis/react-native-one-core';
|
|
3
|
-
import React, { memo } from 'react';
|
|
4
|
-
import { View } from 'react-native';
|
|
5
|
-
import { useAppColorScheme } from '../../ui-components/theme/color-scheme-context';
|
|
6
|
-
import { concatTestID, useIdentifierDetails } from '../../utils';
|
|
7
|
-
import { useTrustEntity } from '../../utils/hooks/core/trust-entity';
|
|
8
|
-
import EntityAttributes from './entity-attributes';
|
|
9
|
-
import EntityDetails from './entity-details';
|
|
10
|
-
import EntityButtons from './EntityButtons';
|
|
11
|
-
const EntityDetailsWithButtons = ({
|
|
12
|
-
identifier,
|
|
13
|
-
entityLabels,
|
|
14
|
-
attributesLabels,
|
|
15
|
-
onCopyToClipboard,
|
|
16
|
-
role,
|
|
17
|
-
entityType,
|
|
18
|
-
testID,
|
|
19
|
-
...props
|
|
20
|
-
}) => {
|
|
21
|
-
var _identifierDetail$cer, _identifierDetail$did;
|
|
22
|
-
let {
|
|
23
|
-
data
|
|
24
|
-
} = useTrustEntity(identifier === null || identifier === void 0 ? void 0 : identifier.id);
|
|
25
|
-
let {
|
|
26
|
-
data: identifierDetail
|
|
27
|
-
} = useIdentifierDetails(identifier === null || identifier === void 0 ? void 0 : identifier.id);
|
|
28
|
-
const trustEntity = data !== null && data !== void 0 ? data : undefined;
|
|
29
|
-
const colorScheme = useAppColorScheme();
|
|
30
|
-
const trusted = Boolean(trustEntity && trustEntity.state === TrustEntityState.ACTIVE && (trustEntity.role === TrustEntityRole.BOTH || trustEntity.role === role));
|
|
31
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
32
|
-
style: {
|
|
33
|
-
backgroundColor: colorScheme.nerdView.background
|
|
34
|
-
}
|
|
35
|
-
}, /*#__PURE__*/React.createElement(EntityDetails, _extends({
|
|
36
|
-
identifier: identifier,
|
|
37
|
-
labels: {
|
|
38
|
-
unknown: role === TrustEntityRole.ISSUER ? entityLabels.unknownIssuer : entityLabels.unknownVerifier
|
|
39
|
-
},
|
|
40
|
-
role: role,
|
|
41
|
-
testID: testID
|
|
42
|
-
}, props)), trusted && /*#__PURE__*/React.createElement(EntityButtons, {
|
|
43
|
-
entity: trustEntity,
|
|
44
|
-
labels: entityLabels,
|
|
45
|
-
testID: concatTestID(testID, 'links')
|
|
46
|
-
}), /*#__PURE__*/React.createElement(EntityAttributes, {
|
|
47
|
-
certificate: identifierDetail === null || identifierDetail === void 0 || (_identifierDetail$cer = identifierDetail.certificates) === null || _identifierDetail$cer === void 0 || (_identifierDetail$cer = _identifierDetail$cer[0]) === null || _identifierDetail$cer === void 0 ? void 0 : _identifierDetail$cer.chain,
|
|
48
|
-
did: identifierDetail === null || identifierDetail === void 0 || (_identifierDetail$did = identifierDetail.did) === null || _identifierDetail$did === void 0 ? void 0 : _identifierDetail$did.did,
|
|
49
|
-
trustEntity: trustEntity,
|
|
50
|
-
trusted: trusted,
|
|
51
|
-
labels: attributesLabels,
|
|
52
|
-
onCopyToClipboard: onCopyToClipboard,
|
|
53
|
-
entityType: entityType,
|
|
54
|
-
testID: testID
|
|
55
|
-
}));
|
|
56
|
-
};
|
|
57
|
-
export default /*#__PURE__*/memo(EntityDetailsWithButtons);
|
|
58
|
-
//# sourceMappingURL=entity-details-with-buttons.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TrustEntityRole","TrustEntityState","React","memo","View","useAppColorScheme","concatTestID","useIdentifierDetails","useTrustEntity","EntityAttributes","EntityDetails","EntityButtons","EntityDetailsWithButtons","identifier","entityLabels","attributesLabels","onCopyToClipboard","role","entityType","testID","props","_identifierDetail$cer","_identifierDetail$did","data","id","identifierDetail","trustEntity","undefined","colorScheme","trusted","Boolean","state","ACTIVE","BOTH","createElement","style","backgroundColor","nerdView","background","_extends","labels","unknown","ISSUER","unknownIssuer","unknownVerifier","entity","certificate","certificates","chain","did"],"sources":["entity-details-with-buttons.tsx"],"sourcesContent":["import { IdentifierListItem, TrustEntityRole, TrustEntityState } from '@procivis/react-native-one-core';\nimport React, { FC, memo } from 'react';\nimport { StyleProp, View, ViewStyle } from 'react-native';\n\nimport { AttributesLabels, EntityLabels, EntityType } from '../../ui-components/screens/nerd-mode-screen';\nimport { useAppColorScheme } from '../../ui-components/theme/color-scheme-context';\nimport { concatTestID, useIdentifierDetails } from '../../utils';\nimport { useTrustEntity } from '../../utils/hooks/core/trust-entity';\nimport EntityAttributes from './entity-attributes';\nimport EntityDetails from './entity-details';\nimport EntityButtons from './EntityButtons';\n\nexport type ContextRole = Exclude<TrustEntityRole, TrustEntityRole.BOTH>;\n\ninterface EntityDetailsWithButtonsProps {\n identifier?: IdentifierListItem;\n entityLabels: EntityLabels;\n attributesLabels: AttributesLabels;\n style?: StyleProp<ViewStyle>;\n textColor?: string;\n testID?: string;\n role: ContextRole;\n onCopyToClipboard: (value: string) => void;\n entityType: EntityType;\n}\n\nconst EntityDetailsWithButtons: FC<EntityDetailsWithButtonsProps> = ({\n identifier,\n entityLabels,\n attributesLabels,\n onCopyToClipboard,\n role,\n entityType,\n testID,\n ...props\n}) => {\n let { data } = useTrustEntity(identifier?.id);\n let { data: identifierDetail } = useIdentifierDetails(identifier?.id);\n const trustEntity = data ?? undefined;\n\n const colorScheme = useAppColorScheme();\n\n const trusted = Boolean(\n trustEntity &&\n trustEntity.state === TrustEntityState.ACTIVE &&\n (trustEntity.role === TrustEntityRole.BOTH || trustEntity.role === role),\n );\n\n return (\n <View style={{ backgroundColor: colorScheme.nerdView.background }}>\n <EntityDetails\n identifier={identifier}\n labels={{\n unknown: role === TrustEntityRole.ISSUER ? entityLabels.unknownIssuer : entityLabels.unknownVerifier,\n }}\n role={role}\n testID={testID}\n {...props}\n />\n {trusted && <EntityButtons entity={trustEntity} labels={entityLabels} testID={concatTestID(testID, 'links')} />}\n <EntityAttributes\n certificate={identifierDetail?.certificates?.[0]?.chain}\n did={identifierDetail?.did?.did}\n trustEntity={trustEntity}\n trusted={trusted}\n labels={attributesLabels}\n onCopyToClipboard={onCopyToClipboard}\n entityType={entityType}\n testID={testID}\n />\n </View>\n );\n};\n\nexport default memo(EntityDetailsWithButtons);\n"],"mappings":";AAAA,SAA6BA,eAAe,EAAEC,gBAAgB,QAAQ,iCAAiC;AACvG,OAAOC,KAAK,IAAQC,IAAI,QAAQ,OAAO;AACvC,SAAoBC,IAAI,QAAmB,cAAc;AAGzD,SAASC,iBAAiB,QAAQ,gDAAgD;AAClF,SAASC,YAAY,EAAEC,oBAAoB,QAAQ,aAAa;AAChE,SAASC,cAAc,QAAQ,qCAAqC;AACpE,OAAOC,gBAAgB,MAAM,qBAAqB;AAClD,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,aAAa,MAAM,iBAAiB;AAgB3C,MAAMC,wBAA2D,GAAGA,CAAC;EACnEC,UAAU;EACVC,YAAY;EACZC,gBAAgB;EAChBC,iBAAiB;EACjBC,IAAI;EACJC,UAAU;EACVC,MAAM;EACN,GAAGC;AACL,CAAC,KAAK;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EACJ,IAAI;IAAEC;EAAK,CAAC,GAAGf,cAAc,CAACK,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEW,EAAE,CAAC;EAC7C,IAAI;IAAED,IAAI,EAAEE;EAAiB,CAAC,GAAGlB,oBAAoB,CAACM,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEW,EAAE,CAAC;EACrE,MAAME,WAAW,GAAGH,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAII,SAAS;EAErC,MAAMC,WAAW,GAAGvB,iBAAiB,CAAC,CAAC;EAEvC,MAAMwB,OAAO,GAAGC,OAAO,CACrBJ,WAAW,IACTA,WAAW,CAACK,KAAK,KAAK9B,gBAAgB,CAAC+B,MAAM,KAC5CN,WAAW,CAACT,IAAI,KAAKjB,eAAe,CAACiC,IAAI,IAAIP,WAAW,CAACT,IAAI,KAAKA,IAAI,CAC3E,CAAC;EAED,oBACEf,KAAA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 -1,92 +0,0 @@
|
|
|
1
|
-
import { IdentifierType, TrustEntityRole, TrustEntityState } from '@procivis/react-native-one-core';
|
|
2
|
-
import React, { useMemo } from 'react';
|
|
3
|
-
import EntityCluster from '../../ui-components/entity/entity-cluster';
|
|
4
|
-
import { EntityNotTrustedIcon, EntityTrustedIcon } from '../../ui-components/icons';
|
|
5
|
-
import { concatTestID, replaceBreakingHyphens, useIdentifierDetails } from '../../utils';
|
|
6
|
-
import { useTrustEntity } from '../../utils/hooks/core/trust-entity';
|
|
7
|
-
const getCertificateCommonName = certificate => {
|
|
8
|
-
var _certificate$x509Attr;
|
|
9
|
-
return (_certificate$x509Attr = certificate.x509Attributes.subject.split(', ').find(s => s.startsWith('CN'))) === null || _certificate$x509Attr === void 0 || (_certificate$x509Attr = _certificate$x509Attr.split('=')) === null || _certificate$x509Attr === void 0 ? void 0 : _certificate$x509Attr.pop();
|
|
10
|
-
};
|
|
11
|
-
const EntityDetails = ({
|
|
12
|
-
labels,
|
|
13
|
-
renderMore,
|
|
14
|
-
role,
|
|
15
|
-
style,
|
|
16
|
-
testID,
|
|
17
|
-
sublineColor,
|
|
18
|
-
textColor,
|
|
19
|
-
...props
|
|
20
|
-
}) => {
|
|
21
|
-
var _props$identifier, _props$identifier2;
|
|
22
|
-
const {
|
|
23
|
-
data,
|
|
24
|
-
isLoading: isLoadingTrustEntity
|
|
25
|
-
} = useTrustEntity('identifier' in props ? (_props$identifier = props.identifier) === null || _props$identifier === void 0 ? void 0 : _props$identifier.id : undefined);
|
|
26
|
-
const trustEntity = 'entity' in props ? props.entity : data !== null && data !== void 0 ? data : undefined;
|
|
27
|
-
const {
|
|
28
|
-
data: identifierDetail,
|
|
29
|
-
isLoading: isLoadingIdentifier
|
|
30
|
-
} = useIdentifierDetails('identifier' in props ? (_props$identifier2 = props.identifier) === null || _props$identifier2 === void 0 ? void 0 : _props$identifier2.id : undefined);
|
|
31
|
-
const trusted = trustEntity && trustEntity.state === TrustEntityState.ACTIVE && (trustEntity.role === TrustEntityRole.BOTH || trustEntity.role === role);
|
|
32
|
-
const isLoading = isLoadingIdentifier || isLoadingTrustEntity;
|
|
33
|
-
const avatarProps = useMemo(() => {
|
|
34
|
-
var _identifierDetail$cer, _getCertificateCommon;
|
|
35
|
-
if (isLoading) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
const avatar = trusted && (identifierDetail === null || identifierDetail === void 0 ? void 0 : identifierDetail.type) === 'DID' && trustEntity.logo ? {
|
|
39
|
-
imageSource: {
|
|
40
|
-
uri: trustEntity.logo
|
|
41
|
-
}
|
|
42
|
-
} : undefined;
|
|
43
|
-
const placeholderText = (identifierDetail === null || identifierDetail === void 0 ? void 0 : identifierDetail.type) === IdentifierType.CERTIFICATE && (_identifierDetail$cer = identifierDetail.certificates) !== null && _identifierDetail$cer !== void 0 && _identifierDetail$cer[0] ? (_getCertificateCommon = getCertificateCommonName(identifierDetail.certificates[0])) === null || _getCertificateCommon === void 0 ? void 0 : _getCertificateCommon.substring(0, 1) : 'D';
|
|
44
|
-
const statusIcon = trusted ? /*#__PURE__*/React.createElement(EntityTrustedIcon, {
|
|
45
|
-
testID: concatTestID(testID, 'statusIcon', 'trusted')
|
|
46
|
-
}) : /*#__PURE__*/React.createElement(EntityNotTrustedIcon, {
|
|
47
|
-
testID: concatTestID(testID, 'statusIcon', 'notTrusted')
|
|
48
|
-
});
|
|
49
|
-
if (trustEntity) {
|
|
50
|
-
return {
|
|
51
|
-
avatar,
|
|
52
|
-
placeholderText: trusted && (identifierDetail === null || identifierDetail === void 0 ? void 0 : identifierDetail.type) === 'DID' ? trustEntity.name.substring(0, 1) : placeholderText,
|
|
53
|
-
statusIcon,
|
|
54
|
-
testID: concatTestID(testID, 'avatar')
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
placeholderText,
|
|
59
|
-
statusIcon
|
|
60
|
-
};
|
|
61
|
-
}, [trustEntity, trusted, identifierDetail, isLoading, testID]);
|
|
62
|
-
const trustEntityName = useMemo(() => {
|
|
63
|
-
var _identifierDetail$cer2, _identifierDetail$did;
|
|
64
|
-
if (isLoading) {
|
|
65
|
-
return '';
|
|
66
|
-
}
|
|
67
|
-
if ((identifierDetail === null || identifierDetail === void 0 ? void 0 : identifierDetail.type) === IdentifierType.CERTIFICATE && (_identifierDetail$cer2 = identifierDetail.certificates) !== null && _identifierDetail$cer2 !== void 0 && _identifierDetail$cer2[0]) {
|
|
68
|
-
const commonName = getCertificateCommonName(identifierDetail.certificates[0]);
|
|
69
|
-
if (commonName) {
|
|
70
|
-
return commonName;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (trustEntity) {
|
|
74
|
-
return trustEntity.name;
|
|
75
|
-
}
|
|
76
|
-
if (identifierDetail !== null && identifierDetail !== void 0 && (_identifierDetail$did = identifierDetail.did) !== null && _identifierDetail$did !== void 0 && _identifierDetail$did.did) {
|
|
77
|
-
return replaceBreakingHyphens(identifierDetail.did.did);
|
|
78
|
-
}
|
|
79
|
-
return labels.unknown;
|
|
80
|
-
}, [labels.unknown, trustEntity, identifierDetail, isLoading]);
|
|
81
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EntityCluster, {
|
|
82
|
-
avatar: avatarProps,
|
|
83
|
-
entityName: trustEntityName,
|
|
84
|
-
style: style,
|
|
85
|
-
testID: testID,
|
|
86
|
-
textColor: textColor,
|
|
87
|
-
sublineColor: sublineColor,
|
|
88
|
-
isLoading: isLoading
|
|
89
|
-
}), trustEntity && renderMore && renderMore(trustEntity));
|
|
90
|
-
};
|
|
91
|
-
export default EntityDetails;
|
|
92
|
-
//# sourceMappingURL=entity-details.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["IdentifierType","TrustEntityRole","TrustEntityState","React","useMemo","EntityCluster","EntityNotTrustedIcon","EntityTrustedIcon","concatTestID","replaceBreakingHyphens","useIdentifierDetails","useTrustEntity","getCertificateCommonName","certificate","_certificate$x509Attr","x509Attributes","subject","split","find","s","startsWith","pop","EntityDetails","labels","renderMore","role","style","testID","sublineColor","textColor","props","_props$identifier","_props$identifier2","data","isLoading","isLoadingTrustEntity","identifier","id","undefined","trustEntity","entity","identifierDetail","isLoadingIdentifier","trusted","state","ACTIVE","BOTH","avatarProps","_identifierDetail$cer","_getCertificateCommon","avatar","type","logo","imageSource","uri","placeholderText","CERTIFICATE","certificates","substring","statusIcon","createElement","name","trustEntityName","_identifierDetail$cer2","_identifierDetail$did","commonName","did","unknown","Fragment","entityName"],"sources":["entity-details.tsx"],"sourcesContent":["import {\n CertificateDetail,\n IdentifierListItem,\n IdentifierType,\n TrustEntityDetail,\n TrustEntityRole,\n TrustEntityState,\n} from '@procivis/react-native-one-core';\nimport React, { FC, ReactNode, useMemo } from 'react';\nimport { StyleProp, ViewStyle } from 'react-native';\n\nimport { AvatarProps } from '../../ui-components';\nimport EntityCluster from '../../ui-components/entity/entity-cluster';\nimport { EntityNotTrustedIcon, EntityTrustedIcon } from '../../ui-components/icons';\nimport { concatTestID, replaceBreakingHyphens, useIdentifierDetails } from '../../utils';\nimport { useTrustEntity } from '../../utils/hooks/core/trust-entity';\n\nexport type EntityDetailsLabels = {\n unknown: string;\n};\n\nexport type EntityDetailsProps = {\n labels: EntityDetailsLabels;\n renderMore?: (trustEntity: TrustEntityDetail) => ReactNode;\n role: Exclude<TrustEntityRole, TrustEntityRole.BOTH>;\n style?: StyleProp<ViewStyle>;\n sublineColor?: string;\n textColor?: string;\n testID?: string;\n} & (\n | {\n identifier?: IdentifierListItem;\n }\n | {\n entity: TrustEntityDetail;\n }\n);\n\nconst getCertificateCommonName = (certificate: CertificateDetail): string | undefined => {\n return certificate.x509Attributes.subject\n .split(', ')\n .find((s) => s.startsWith('CN'))\n ?.split('=')\n ?.pop();\n};\n\nconst EntityDetails: FC<EntityDetailsProps> = ({\n labels,\n renderMore,\n role,\n style,\n testID,\n sublineColor,\n textColor,\n ...props\n}) => {\n const { data, isLoading: isLoadingTrustEntity } = useTrustEntity(\n 'identifier' in props ? props.identifier?.id : undefined,\n );\n const trustEntity = 'entity' in props ? props.entity : data ?? undefined;\n const { data: identifierDetail, isLoading: isLoadingIdentifier } = useIdentifierDetails(\n 'identifier' in props ? props.identifier?.id : undefined,\n );\n\n const trusted =\n trustEntity &&\n trustEntity.state === TrustEntityState.ACTIVE &&\n (trustEntity.role === TrustEntityRole.BOTH || trustEntity.role === role);\n\n const isLoading = isLoadingIdentifier || isLoadingTrustEntity;\n\n const avatarProps: AvatarProps | undefined = useMemo(() => {\n if (isLoading) {\n return undefined;\n }\n\n const avatar =\n trusted && identifierDetail?.type === 'DID' && trustEntity.logo\n ? { imageSource: { uri: trustEntity.logo } }\n : undefined;\n\n const placeholderText =\n identifierDetail?.type === IdentifierType.CERTIFICATE && identifierDetail.certificates?.[0]\n ? getCertificateCommonName(identifierDetail.certificates[0])?.substring(0, 1)\n : 'D';\n\n const statusIcon = trusted ? (\n <EntityTrustedIcon testID={concatTestID(testID, 'statusIcon', 'trusted')} />\n ) : (\n <EntityNotTrustedIcon testID={concatTestID(testID, 'statusIcon', 'notTrusted')} />\n );\n\n if (trustEntity) {\n return {\n avatar,\n placeholderText:\n trusted && identifierDetail?.type === 'DID' ? trustEntity.name.substring(0, 1) : placeholderText,\n statusIcon,\n testID: concatTestID(testID, 'avatar'),\n };\n }\n\n return {\n placeholderText,\n statusIcon,\n };\n }, [trustEntity, trusted, identifierDetail, isLoading, testID]);\n\n const trustEntityName = useMemo(() => {\n if (isLoading) {\n return '';\n }\n if (identifierDetail?.type === IdentifierType.CERTIFICATE && identifierDetail.certificates?.[0]) {\n const commonName = getCertificateCommonName(identifierDetail.certificates[0]);\n if (commonName) {\n return commonName;\n }\n }\n if (trustEntity) {\n return trustEntity.name;\n }\n if (identifierDetail?.did?.did) {\n return replaceBreakingHyphens(identifierDetail.did.did);\n }\n\n return labels.unknown;\n }, [labels.unknown, trustEntity, identifierDetail, isLoading]);\n\n return (\n <>\n <EntityCluster\n avatar={avatarProps}\n entityName={trustEntityName}\n style={style}\n testID={testID}\n textColor={textColor}\n sublineColor={sublineColor}\n isLoading={isLoading}\n />\n {trustEntity && renderMore && renderMore(trustEntity)}\n </>\n );\n};\n\nexport default EntityDetails;\n"],"mappings":"AAAA,SAGEA,cAAc,EAEdC,eAAe,EACfC,gBAAgB,QACX,iCAAiC;AACxC,OAAOC,KAAK,IAAmBC,OAAO,QAAQ,OAAO;AAIrD,OAAOC,aAAa,MAAM,2CAA2C;AACrE,SAASC,oBAAoB,EAAEC,iBAAiB,QAAQ,2BAA2B;AACnF,SAASC,YAAY,EAAEC,sBAAsB,EAAEC,oBAAoB,QAAQ,aAAa;AACxF,SAASC,cAAc,QAAQ,qCAAqC;AAuBpE,MAAMC,wBAAwB,GAAIC,WAA8B,IAAyB;EAAA,IAAAC,qBAAA;EACvF,QAAAA,qBAAA,GAAOD,WAAW,CAACE,cAAc,CAACC,OAAO,CACtCC,KAAK,CAAC,IAAI,CAAC,CACXC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,UAAU,CAAC,IAAI,CAAC,CAAC,cAAAN,qBAAA,gBAAAA,qBAAA,GAF3BA,qBAAA,CAGHG,KAAK,CAAC,GAAG,CAAC,cAAAH,qBAAA,uBAHPA,qBAAA,CAIHO,GAAG,CAAC,CAAC;AACX,CAAC;AAED,MAAMC,aAAqC,GAAGA,CAAC;EAC7CC,MAAM;EACNC,UAAU;EACVC,IAAI;EACJC,KAAK;EACLC,MAAM;EACNC,YAAY;EACZC,SAAS;EACT,GAAGC;AACL,CAAC,KAAK;EAAA,IAAAC,iBAAA,EAAAC,kBAAA;EACJ,MAAM;IAAEC,IAAI;IAAEC,SAAS,EAAEC;EAAqB,CAAC,GAAGxB,cAAc,CAC9D,YAAY,IAAImB,KAAK,IAAAC,iBAAA,GAAGD,KAAK,CAACM,UAAU,cAAAL,iBAAA,uBAAhBA,iBAAA,CAAkBM,EAAE,GAAGC,SACjD,CAAC;EACD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,gBAAgB,CAACgB,YAAY,CAAC,CAAC,CAAC,CAAC;MAC7E,IAAIQ,UAAU,EAAE;QACd,OAAOA,UAAU;MACnB;IACF;IACA,IAAI1B,WAAW,EAAE;MACf,OAAOA,WAAW,CAACsB,IAAI;IACzB;IACA,IAAIpB,gBAAgB,aAAhBA,gBAAgB,gBAAAuB,qBAAA,GAAhBvB,gBAAgB,CAAEyB,GAAG,cAAAF,qBAAA,eAArBA,qBAAA,CAAuBE,GAAG,EAAE;MAC9B,OAAOzD,sBAAsB,CAACgC,gBAAgB,CAACyB,GAAG,CAACA,GAAG,CAAC;IACzD;IAEA,OAAO3C,MAAM,CAAC4C,OAAO;EACvB,CAAC,EAAE,CAAC5C,MAAM,CAAC4C,OAAO,EAAE5B,WAAW,EAAEE,gBAAgB,EAAEP,SAAS,CAAC,CAAC;EAE9D,oBACE/B,KAAA,CAAAyD,aAAA,CAAAzD,KAAA,CAAAiE,QAAA,qBACEjE,KAAA,CAAAyD,aAAA,CAACvD,aAAa;IACZ6C,MAAM,EAAEH,WAAY;IACpBsB,UAAU,EAAEP,eAAgB;IAC5BpC,KAAK,EAAEA,KAAM;IACbC,MAAM,EAAEA,MAAO;IACfE,SAAS,EAAEA,SAAU;IACrBD,YAAY,EAAEA,YAAa;IAC3BM,SAAS,EAAEA;EAAU,CACtB,CAAC,EACDK,WAAW,IAAIf,UAAU,IAAIA,UAAU,CAACe,WAAW,CACpD,CAAC;AAEP,CAAC;AAED,eAAejB,aAAa","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["EntityDetails"],"sources":["index.ts"],"sourcesContent":["import type { EntityDetailsLabels, EntityDetailsProps } from './entity-details';\nimport EntityDetails from './entity-details';\n\nexport { EntityDetails, EntityDetailsLabels, EntityDetailsProps };\n"],"mappings":"AACA,OAAOA,aAAa,MAAM,kBAAkB;AAE5C,SAASA,aAAa","ignoreList":[]}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { IdentifierType, OneError } from '@procivis/react-native-one-core';
|
|
2
|
-
import { useCallback } from 'react';
|
|
3
|
-
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
4
|
-
import { reportException } from '../../reporting';
|
|
5
|
-
import { useHTTPClient } from '../http/client';
|
|
6
|
-
import { useONECore } from './core-context';
|
|
7
|
-
import { OneErrorCode } from './error-code';
|
|
8
|
-
import { HISTORY_LIST_QUERY_KEY } from './history';
|
|
9
|
-
import { useIdentifierDetails } from './identifiers';
|
|
10
|
-
export const TRUST_ENTITY_DETAIL_QUERY_KEY = 'trust-entity-detail';
|
|
11
|
-
export const REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY = 'remote-trust-entity-detail';
|
|
12
|
-
export const useCreateTrustAnchor = () => {
|
|
13
|
-
const httpClient = useHTTPClient();
|
|
14
|
-
return useCallback(async (core, publisherReference) => {
|
|
15
|
-
const trustAnchors = await core.listTrustAnchors({
|
|
16
|
-
page: 0,
|
|
17
|
-
pageSize: 1
|
|
18
|
-
});
|
|
19
|
-
if (trustAnchors.values.length > 0) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const response = await httpClient.get(publisherReference);
|
|
23
|
-
if (!response.ok || !response.data) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const trustAnchor = response.data;
|
|
27
|
-
await core.createTrustAnchor({
|
|
28
|
-
isPublisher: false,
|
|
29
|
-
name: trustAnchor.name,
|
|
30
|
-
publisherReference,
|
|
31
|
-
type: TrustManagementEnum.SimpleTrustList
|
|
32
|
-
}).catch(err => {
|
|
33
|
-
reportException(err, 'Failed to create trust anchor');
|
|
34
|
-
throw err;
|
|
35
|
-
});
|
|
36
|
-
}, [httpClient]);
|
|
37
|
-
};
|
|
38
|
-
export const useTrustEntity = identifierId => {
|
|
39
|
-
const {
|
|
40
|
-
core
|
|
41
|
-
} = useONECore();
|
|
42
|
-
const {
|
|
43
|
-
data: identifierDetail
|
|
44
|
-
} = useIdentifierDetails(identifierId);
|
|
45
|
-
return useQuery([TRUST_ENTITY_DETAIL_QUERY_KEY, identifierId], () => {
|
|
46
|
-
var _identifierDetail$cer;
|
|
47
|
-
return identifierId && identifierDetail ? core.resolveTrustEntityByIdentifier({
|
|
48
|
-
identifiers: [{
|
|
49
|
-
certificateId: (identifierDetail === null || identifierDetail === void 0 ? void 0 : identifierDetail.type) === IdentifierType.CERTIFICATE ? (_identifierDetail$cer = identifierDetail.certificates) === null || _identifierDetail$cer === void 0 || (_identifierDetail$cer = _identifierDetail$cer[0]) === null || _identifierDetail$cer === void 0 ? void 0 : _identifierDetail$cer.id : undefined,
|
|
50
|
-
id: identifierId
|
|
51
|
-
}]
|
|
52
|
-
}).then(result => {
|
|
53
|
-
var _result$identifierId$, _result$identifierId;
|
|
54
|
-
return (_result$identifierId$ = (_result$identifierId = result[identifierId]) === null || _result$identifierId === void 0 || (_result$identifierId = _result$identifierId[0]) === null || _result$identifierId === void 0 ? void 0 : _result$identifierId.trustEntity) !== null && _result$identifierId$ !== void 0 ? _result$identifierId$ : null;
|
|
55
|
-
}).catch(e => {
|
|
56
|
-
if (e instanceof OneError && e.code === OneErrorCode.NoTrustEntityFound) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
throw e;
|
|
60
|
-
}) : undefined;
|
|
61
|
-
}, {
|
|
62
|
-
enabled: Boolean(identifierDetail),
|
|
63
|
-
keepPreviousData: true
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
export const useRemoteTrustEntity = identifierId => {
|
|
67
|
-
const {
|
|
68
|
-
core
|
|
69
|
-
} = useONECore();
|
|
70
|
-
const {
|
|
71
|
-
data: identifierDetail
|
|
72
|
-
} = useIdentifierDetails(identifierId);
|
|
73
|
-
return useQuery([REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY, identifierId], () => identifierDetail !== null && identifierDetail !== void 0 && identifierDetail.did ? core.getRemoteTrustEntity(identifierDetail.did.id) : undefined, {
|
|
74
|
-
enabled: Boolean(identifierDetail === null || identifierDetail === void 0 ? void 0 : identifierDetail.did),
|
|
75
|
-
keepPreviousData: true
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
export const useCreateRemoteTrustEntity = () => {
|
|
79
|
-
const queryClient = useQueryClient();
|
|
80
|
-
const {
|
|
81
|
-
core
|
|
82
|
-
} = useONECore();
|
|
83
|
-
return useMutation(async request => {
|
|
84
|
-
const {
|
|
85
|
-
identifierId,
|
|
86
|
-
didId
|
|
87
|
-
} = request;
|
|
88
|
-
let entityDidId = didId;
|
|
89
|
-
if (identifierId) {
|
|
90
|
-
var _identifierDetail$did;
|
|
91
|
-
const identifierDetail = await core.getIdentifier(identifierId);
|
|
92
|
-
entityDidId = identifierDetail === null || identifierDetail === void 0 || (_identifierDetail$did = identifierDetail.did) === null || _identifierDetail$did === void 0 ? void 0 : _identifierDetail$did.id;
|
|
93
|
-
}
|
|
94
|
-
return core.createRemoteTrustEntity({
|
|
95
|
-
...request,
|
|
96
|
-
didId: entityDidId
|
|
97
|
-
});
|
|
98
|
-
}, {
|
|
99
|
-
onSuccess: async () => {
|
|
100
|
-
await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);
|
|
101
|
-
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
export const useUpdateRemoteTrustEntity = () => {
|
|
106
|
-
const queryClient = useQueryClient();
|
|
107
|
-
const {
|
|
108
|
-
core
|
|
109
|
-
} = useONECore();
|
|
110
|
-
return useMutation(async request => {
|
|
111
|
-
const {
|
|
112
|
-
identifierId,
|
|
113
|
-
didId
|
|
114
|
-
} = request;
|
|
115
|
-
let entityDidId = didId;
|
|
116
|
-
if (identifierId) {
|
|
117
|
-
var _identifierDetail$did2;
|
|
118
|
-
const identifierDetail = await core.getIdentifier(identifierId);
|
|
119
|
-
entityDidId = identifierDetail === null || identifierDetail === void 0 || (_identifierDetail$did2 = identifierDetail.did) === null || _identifierDetail$did2 === void 0 ? void 0 : _identifierDetail$did2.id;
|
|
120
|
-
}
|
|
121
|
-
return core.updateRemoteTrustEntity({
|
|
122
|
-
...request,
|
|
123
|
-
didId: entityDidId
|
|
124
|
-
});
|
|
125
|
-
}, {
|
|
126
|
-
onSuccess: async () => {
|
|
127
|
-
await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);
|
|
128
|
-
await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
export let TrustManagementEnum = /*#__PURE__*/function (TrustManagementEnum) {
|
|
133
|
-
TrustManagementEnum["SimpleTrustList"] = "SIMPLE_TRUST_LIST";
|
|
134
|
-
return TrustManagementEnum;
|
|
135
|
-
}({});
|
|
136
|
-
//# sourceMappingURL=trust-entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["IdentifierType","OneError","useCallback","useMutation","useQuery","useQueryClient","reportException","useHTTPClient","useONECore","OneErrorCode","HISTORY_LIST_QUERY_KEY","useIdentifierDetails","TRUST_ENTITY_DETAIL_QUERY_KEY","REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY","useCreateTrustAnchor","httpClient","core","publisherReference","trustAnchors","listTrustAnchors","page","pageSize","values","length","response","get","ok","data","trustAnchor","createTrustAnchor","isPublisher","name","type","TrustManagementEnum","SimpleTrustList","catch","err","useTrustEntity","identifierId","identifierDetail","_identifierDetail$cer","resolveTrustEntityByIdentifier","identifiers","certificateId","CERTIFICATE","certificates","id","undefined","then","result","_result$identifierId$","_result$identifierId","trustEntity","e","code","NoTrustEntityFound","enabled","Boolean","keepPreviousData","useRemoteTrustEntity","did","getRemoteTrustEntity","useCreateRemoteTrustEntity","queryClient","request","didId","entityDidId","_identifierDetail$did","getIdentifier","createRemoteTrustEntity","onSuccess","invalidateQueries","useUpdateRemoteTrustEntity","_identifierDetail$did2","updateRemoteTrustEntity"],"sources":["trust-entity.ts"],"sourcesContent":["import {\n CreateRemoteTrustEntityRequest,\n IdentifierType,\n ONECore,\n OneError,\n TrustAnchorDetail,\n UpdateRemoteTrustEntityRequest,\n} from '@procivis/react-native-one-core';\nimport { useCallback } from 'react';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { reportException } from '../../reporting';\nimport { useHTTPClient } from '../http/client';\nimport { useONECore } from './core-context';\nimport { OneErrorCode } from './error-code';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\nimport { useIdentifierDetails } from './identifiers';\n\nexport const TRUST_ENTITY_DETAIL_QUERY_KEY = 'trust-entity-detail';\nexport const REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY = 'remote-trust-entity-detail';\n\nexport const useCreateTrustAnchor = () => {\n const httpClient = useHTTPClient();\n\n return useCallback(\n async (core: ONECore, publisherReference: string) => {\n const trustAnchors = await core.listTrustAnchors({\n page: 0,\n pageSize: 1,\n });\n if (trustAnchors.values.length > 0) {\n return;\n }\n const response = await httpClient.get<TrustAnchorDetail>(publisherReference);\n if (!response.ok || !response.data) {\n return;\n }\n const trustAnchor = response.data;\n await core\n .createTrustAnchor({\n isPublisher: false,\n name: trustAnchor.name,\n publisherReference,\n type: TrustManagementEnum.SimpleTrustList,\n })\n .catch((err) => {\n reportException(err, 'Failed to create trust anchor');\n throw err;\n });\n },\n [httpClient],\n );\n};\n\nexport const useTrustEntity = (identifierId: string | undefined) => {\n const { core } = useONECore();\n\n const { data: identifierDetail } = useIdentifierDetails(identifierId);\n\n return useQuery(\n [TRUST_ENTITY_DETAIL_QUERY_KEY, identifierId],\n () =>\n identifierId && identifierDetail\n ? core\n .resolveTrustEntityByIdentifier({\n identifiers: [\n {\n certificateId:\n identifierDetail?.type === IdentifierType.CERTIFICATE\n ? identifierDetail.certificates?.[0]?.id\n : undefined,\n id: identifierId,\n },\n ],\n })\n .then((result) => {\n return result[identifierId]?.[0]?.trustEntity ?? null;\n })\n .catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.NoTrustEntityFound) {\n return null;\n }\n throw e;\n })\n : undefined,\n {\n enabled: Boolean(identifierDetail),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useRemoteTrustEntity = (identifierId: string | undefined) => {\n const { core } = useONECore();\n\n const { data: identifierDetail } = useIdentifierDetails(identifierId);\n\n return useQuery(\n [REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY, identifierId],\n () => (identifierDetail?.did ? core.getRemoteTrustEntity(identifierDetail.did.id) : undefined),\n {\n enabled: Boolean(identifierDetail?.did),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useCreateRemoteTrustEntity = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (request: Omit<CreateRemoteTrustEntityRequest, 'didId'> & { identifierId?: string; didId?: string }) => {\n const { identifierId, didId } = request;\n\n let entityDidId = didId;\n\n if (identifierId) {\n const identifierDetail = await core.getIdentifier(identifierId);\n entityDidId = identifierDetail?.did?.id;\n }\n\n return core.createRemoteTrustEntity({\n ...request,\n didId: entityDidId!,\n });\n },\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useUpdateRemoteTrustEntity = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (\n request: Omit<UpdateRemoteTrustEntityRequest, 'didId'> & {\n identifierId?: string;\n didId?: string;\n },\n ) => {\n const { identifierId, didId } = request;\n\n let entityDidId = didId;\n if (identifierId) {\n const identifierDetail = await core.getIdentifier(identifierId);\n entityDidId = identifierDetail?.did?.id;\n }\n\n return core.updateRemoteTrustEntity({\n ...request,\n didId: entityDidId!,\n });\n },\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(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AC1D,oCAAoC,CAAC;MACzE,MAAMkD,WAAW,CAACQ,iBAAiB,CAAC7D,sBAAsB,CAAC;IAC7D;EACF,CACF,CAAC;AACH,CAAC;AAED,WAAYuB,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA","ignoreList":[]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TrustEntityDetail } from '@procivis/react-native-one-core';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { EntityLabels } from '../../ui-components/screens/nerd-mode-screen';
|
|
4
|
-
export interface EntityButton {
|
|
5
|
-
url: string;
|
|
6
|
-
label: string;
|
|
7
|
-
}
|
|
8
|
-
interface EntityButtonsProps {
|
|
9
|
-
entity?: TrustEntityDetail;
|
|
10
|
-
labels: EntityLabels;
|
|
11
|
-
testID?: string;
|
|
12
|
-
}
|
|
13
|
-
declare const _default: React.NamedExoticComponent<EntityButtonsProps>;
|
|
14
|
-
export default _default;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TrustEntityDetail, TrustEntityListItem } from '@procivis/react-native-one-core';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { AttributesLabels, EntityType } from '../../ui-components/screens/nerd-mode-screen';
|
|
4
|
-
interface EntityAttributesProps {
|
|
5
|
-
certificate?: string;
|
|
6
|
-
did?: string;
|
|
7
|
-
trustEntity?: TrustEntityDetail | TrustEntityListItem;
|
|
8
|
-
trusted: boolean;
|
|
9
|
-
labels: AttributesLabels;
|
|
10
|
-
onCopyToClipboard: (value: string) => void;
|
|
11
|
-
entityType: EntityType;
|
|
12
|
-
testID?: string;
|
|
13
|
-
}
|
|
14
|
-
declare const _default: React.NamedExoticComponent<EntityAttributesProps>;
|
|
15
|
-
export default _default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { IdentifierListItem, TrustEntityRole } from '@procivis/react-native-one-core';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
-
import { AttributesLabels, EntityLabels, EntityType } from '../../ui-components/screens/nerd-mode-screen';
|
|
5
|
-
export type ContextRole = Exclude<TrustEntityRole, TrustEntityRole.BOTH>;
|
|
6
|
-
interface EntityDetailsWithButtonsProps {
|
|
7
|
-
identifier?: IdentifierListItem;
|
|
8
|
-
entityLabels: EntityLabels;
|
|
9
|
-
attributesLabels: AttributesLabels;
|
|
10
|
-
style?: StyleProp<ViewStyle>;
|
|
11
|
-
textColor?: string;
|
|
12
|
-
testID?: string;
|
|
13
|
-
role: ContextRole;
|
|
14
|
-
onCopyToClipboard: (value: string) => void;
|
|
15
|
-
entityType: EntityType;
|
|
16
|
-
}
|
|
17
|
-
declare const _default: React.NamedExoticComponent<EntityDetailsWithButtonsProps>;
|
|
18
|
-
export default _default;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { IdentifierListItem, TrustEntityDetail, TrustEntityRole } from '@procivis/react-native-one-core';
|
|
2
|
-
import { FC, ReactNode } from 'react';
|
|
3
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
-
export type EntityDetailsLabels = {
|
|
5
|
-
unknown: string;
|
|
6
|
-
};
|
|
7
|
-
export type EntityDetailsProps = {
|
|
8
|
-
labels: EntityDetailsLabels;
|
|
9
|
-
renderMore?: (trustEntity: TrustEntityDetail) => ReactNode;
|
|
10
|
-
role: Exclude<TrustEntityRole, TrustEntityRole.BOTH>;
|
|
11
|
-
style?: StyleProp<ViewStyle>;
|
|
12
|
-
sublineColor?: string;
|
|
13
|
-
textColor?: string;
|
|
14
|
-
testID?: string;
|
|
15
|
-
} & ({
|
|
16
|
-
identifier?: IdentifierListItem;
|
|
17
|
-
} | {
|
|
18
|
-
entity: TrustEntityDetail;
|
|
19
|
-
});
|
|
20
|
-
declare const EntityDetails: FC<EntityDetailsProps>;
|
|
21
|
-
export default EntityDetails;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CreateRemoteTrustEntityRequest, ONECore, UpdateRemoteTrustEntityRequest } from '@procivis/react-native-one-core';
|
|
2
|
-
export declare const TRUST_ENTITY_DETAIL_QUERY_KEY = "trust-entity-detail";
|
|
3
|
-
export declare const REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY = "remote-trust-entity-detail";
|
|
4
|
-
export declare const useCreateTrustAnchor: () => (core: ONECore, publisherReference: string) => Promise<void>;
|
|
5
|
-
export declare const useTrustEntity: (identifierId: string | undefined) => import("react-query").UseQueryResult<import("@procivis/react-native-one-core").TrustEntityDetail | null | undefined, unknown>;
|
|
6
|
-
export declare const useRemoteTrustEntity: (identifierId: string | undefined) => import("react-query").UseQueryResult<import("@procivis/react-native-one-core").RemoteTrustEntityDetail | undefined, unknown>;
|
|
7
|
-
export declare const useCreateRemoteTrustEntity: () => import("react-query").UseMutationResult<string, unknown, Omit<CreateRemoteTrustEntityRequest, "didId"> & {
|
|
8
|
-
identifierId?: string | undefined;
|
|
9
|
-
didId?: string | undefined;
|
|
10
|
-
}, unknown>;
|
|
11
|
-
export declare const useUpdateRemoteTrustEntity: () => import("react-query").UseMutationResult<void, unknown, Omit<UpdateRemoteTrustEntityRequest, "didId"> & {
|
|
12
|
-
identifierId?: string | undefined;
|
|
13
|
-
didId?: string | undefined;
|
|
14
|
-
}, unknown>;
|
|
15
|
-
export declare enum TrustManagementEnum {
|
|
16
|
-
SimpleTrustList = "SIMPLE_TRUST_LIST"
|
|
17
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { TrustEntityDetail } from '@procivis/react-native-one-core';
|
|
2
|
-
import React, { FC, memo, useCallback, useMemo } from 'react';
|
|
3
|
-
import { Linking, StyleSheet, View } from 'react-native';
|
|
4
|
-
|
|
5
|
-
import { Button, ButtonType } from '../../ui-components/buttons';
|
|
6
|
-
import { EntityLabels } from '../../ui-components/screens/nerd-mode-screen';
|
|
7
|
-
import { concatTestID, reportException } from '../../utils';
|
|
8
|
-
|
|
9
|
-
export interface EntityButton {
|
|
10
|
-
url: string;
|
|
11
|
-
label: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface EntityButtonsProps {
|
|
15
|
-
entity?: TrustEntityDetail;
|
|
16
|
-
labels: EntityLabels;
|
|
17
|
-
testID?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const EntityButtons: FC<EntityButtonsProps> = ({ entity, labels, testID }) => {
|
|
21
|
-
const buttons = useMemo(
|
|
22
|
-
() =>
|
|
23
|
-
[
|
|
24
|
-
{
|
|
25
|
-
label: labels.visitWebsite,
|
|
26
|
-
url: entity?.website || '',
|
|
27
|
-
testID: 'website',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
label: labels.termsAndServices,
|
|
31
|
-
url: entity?.termsUrl || '',
|
|
32
|
-
testID: 'termsOfService',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
label: labels.privacyPolicy,
|
|
36
|
-
url: entity?.privacyUrl || '',
|
|
37
|
-
testID: 'privacyPolicy',
|
|
38
|
-
},
|
|
39
|
-
].filter((btn) => Boolean(btn.url)),
|
|
40
|
-
[entity, labels],
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
const openURL = useCallback(
|
|
44
|
-
(url: string) => () => {
|
|
45
|
-
Linking.openURL(url).catch((e) => {
|
|
46
|
-
reportException(e, 'Error opening entity link');
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
[],
|
|
50
|
-
);
|
|
51
|
-
return (
|
|
52
|
-
<View style={[styles.buttons]} testID={testID}>
|
|
53
|
-
{buttons.map(({ label, url, testID: testIdSuffix }) => (
|
|
54
|
-
<Button
|
|
55
|
-
key={label}
|
|
56
|
-
title={label}
|
|
57
|
-
onPress={openURL(url)}
|
|
58
|
-
style={styles.urlButton}
|
|
59
|
-
testID={concatTestID(testID, testIdSuffix)}
|
|
60
|
-
type={ButtonType.SmallTech}
|
|
61
|
-
/>
|
|
62
|
-
))}
|
|
63
|
-
</View>
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const styles = StyleSheet.create({
|
|
68
|
-
buttons: {
|
|
69
|
-
paddingBottom: 10,
|
|
70
|
-
paddingHorizontal: 12,
|
|
71
|
-
},
|
|
72
|
-
urlButton: {
|
|
73
|
-
borderRadius: 4,
|
|
74
|
-
borderWidth: 0,
|
|
75
|
-
marginTop: 4,
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
export default memo(EntityButtons);
|