@procivis/one-react-native-components 0.3.121 → 0.3.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/credential/credential.js +2 -1
- package/lib/commonjs/components/credential/credential.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item-icon.js +3 -3
- package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item.js +5 -12
- package/lib/commonjs/components/history/history-list-item.js.map +1 -1
- package/lib/commonjs/components/history/history-list-screen.js +1 -1
- package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
- package/lib/commonjs/components/index.js +0 -11
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/select-credential.js +2 -1
- package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js +2 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js +2 -1
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js +3 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +7 -3
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js +3 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
- package/lib/commonjs/ui-components/header/header.js.map +1 -1
- package/lib/commonjs/ui-components/history/history-details.js +2 -2
- package/lib/commonjs/ui-components/history/history-details.js.map +1 -1
- package/lib/commonjs/ui-components/history/history-section-list-item.js +2 -2
- package/lib/commonjs/ui-components/history/history-section-list-item.js.map +1 -1
- package/lib/commonjs/ui-components/history/index.js +0 -8
- package/lib/commonjs/ui-components/history/index.js.map +1 -1
- package/lib/commonjs/ui-components/icons/contact.js.map +1 -1
- package/lib/commonjs/ui-components/icons/credential.js +3 -3
- package/lib/commonjs/ui-components/icons/credential.js.map +1 -1
- package/lib/commonjs/ui-components/icons/icons.js +20 -1
- package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
- package/lib/commonjs/ui-components/list/index.js +8 -0
- package/lib/commonjs/ui-components/list/index.js.map +1 -1
- package/lib/commonjs/ui-components/{history/history-item.js → list/list-item.js} +32 -22
- package/lib/commonjs/ui-components/list/list-item.js.map +1 -0
- package/lib/commonjs/ui-components/loader/loading-result.js +2 -0
- package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js +7 -33
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/commonjs/utils/date.js +4 -5
- package/lib/commonjs/utils/date.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/cache.js +7 -4
- package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-config.js +1 -6
- package/lib/commonjs/utils/hooks/core/core-config.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-context.js +0 -15
- package/lib/commonjs/utils/hooks/core/core-context.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credentials.js +15 -1
- package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/index.js +0 -11
- package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/trust-list.js +19 -3
- package/lib/commonjs/utils/hooks/core/trust-list.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/verifier-instance.js +22 -3
- package/lib/commonjs/utils/hooks/core/verifier-instance.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js +2 -2
- package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js +23 -18
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing.js +20 -18
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +36 -22
- package/lib/commonjs/utils/parsers/credential.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.js +2 -2
- package/lib/commonjs/utils/parsers/query.js.map +1 -1
- package/lib/commonjs/utils/translations.js +15 -0
- package/lib/commonjs/utils/translations.js.map +1 -0
- package/lib/module/components/credential/credential.js +2 -1
- package/lib/module/components/credential/credential.js.map +1 -1
- package/lib/module/components/history/history-list-item-icon.js +3 -3
- package/lib/module/components/history/history-list-item-icon.js.map +1 -1
- package/lib/module/components/history/history-list-item.js +7 -14
- package/lib/module/components/history/history-list-item.js.map +1 -1
- package/lib/module/components/history/history-list-screen.js +1 -1
- package/lib/module/components/history/history-list-screen.js.map +1 -1
- package/lib/module/components/index.js +0 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/proof-request/v1/select-credential.js +2 -1
- package/lib/module/components/proof-request/v1/select-credential.js.map +1 -1
- package/lib/module/components/proof-request/v1/share-credential.js +2 -1
- package/lib/module/components/proof-request/v1/share-credential.js.map +1 -1
- package/lib/module/components/proof-request/v2/select-credential-v2.js +2 -1
- package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js +3 -1
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2.js +7 -3
- package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js +3 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/module/ui-components/header/foldable-header.js.map +1 -1
- package/lib/module/ui-components/header/header.js.map +1 -1
- package/lib/module/ui-components/history/history-details.js +3 -3
- package/lib/module/ui-components/history/history-details.js.map +1 -1
- package/lib/module/ui-components/history/history-section-list-item.js +2 -2
- package/lib/module/ui-components/history/history-section-list-item.js.map +1 -1
- package/lib/module/ui-components/history/index.js +0 -2
- package/lib/module/ui-components/history/index.js.map +1 -1
- package/lib/module/ui-components/icons/contact.js.map +1 -1
- package/lib/module/ui-components/icons/credential.js +1 -1
- package/lib/module/ui-components/icons/credential.js.map +1 -1
- package/lib/module/ui-components/icons/icons.js +18 -0
- package/lib/module/ui-components/icons/icons.js.map +1 -1
- package/lib/module/ui-components/list/index.js +2 -0
- package/lib/module/ui-components/list/index.js.map +1 -1
- package/lib/module/ui-components/{history/history-item.js → list/list-item.js} +32 -22
- package/lib/module/ui-components/list/list-item.js.map +1 -0
- package/lib/module/ui-components/loader/loading-result.js +2 -0
- package/lib/module/ui-components/loader/loading-result.js.map +1 -1
- package/lib/module/ui-components/screens/nerd-mode-screen.js +7 -33
- package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/module/utils/date.js +4 -5
- package/lib/module/utils/date.js.map +1 -1
- package/lib/module/utils/hooks/core/cache.js +7 -4
- package/lib/module/utils/hooks/core/cache.js.map +1 -1
- package/lib/module/utils/hooks/core/core-config.js +0 -4
- package/lib/module/utils/hooks/core/core-config.js.map +1 -1
- package/lib/module/utils/hooks/core/core-context.js +0 -15
- package/lib/module/utils/hooks/core/core-context.js.map +1 -1
- package/lib/module/utils/hooks/core/credentials.js +13 -0
- package/lib/module/utils/hooks/core/credentials.js.map +1 -1
- package/lib/module/utils/hooks/core/index.js +0 -1
- package/lib/module/utils/hooks/core/index.js.map +1 -1
- package/lib/module/utils/hooks/core/trust-list.js +20 -4
- package/lib/module/utils/hooks/core/trust-list.js.map +1 -1
- package/lib/module/utils/hooks/core/verifier-instance.js +20 -2
- package/lib/module/utils/hooks/core/verifier-instance.js.map +1 -1
- package/lib/module/utils/hooks/core/wallet-unit.js +2 -2
- package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing-v2.js +24 -19
- package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing.js +20 -18
- package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +37 -23
- package/lib/module/utils/parsers/credential.js.map +1 -1
- package/lib/module/utils/parsers/query.js +2 -2
- package/lib/module/utils/parsers/query.js.map +1 -1
- package/lib/module/utils/translations.js +8 -0
- package/lib/module/utils/translations.js.map +1 -0
- package/lib/typescript/components/credential/credential.d.ts +1 -0
- package/lib/typescript/components/history/history-list-item.d.ts +1 -1
- package/lib/typescript/components/index.d.ts +0 -1
- package/lib/typescript/components/proof-request/v1/select-credential.d.ts +1 -0
- package/lib/typescript/components/proof-request/v1/share-credential.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +1 -0
- package/lib/typescript/ui-components/history/history-details.d.ts +2 -2
- package/lib/typescript/ui-components/history/history-section-list-item.d.ts +2 -2
- package/lib/typescript/ui-components/history/index.d.ts +0 -3
- package/lib/typescript/ui-components/icons/credential.d.ts +1 -1
- package/lib/typescript/ui-components/icons/icons.d.ts +1 -0
- package/lib/typescript/ui-components/list/index.d.ts +3 -0
- package/lib/typescript/ui-components/{history/history-item.d.ts → list/list-item.d.ts} +4 -4
- package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +0 -12
- package/lib/typescript/utils/hooks/core/core-config.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/core-context.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/credentials.d.ts +1 -0
- package/lib/typescript/utils/hooks/core/index.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/trust-list.d.ts +1 -4
- package/lib/typescript/utils/hooks/core/verifier-instance.d.ts +2 -0
- package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +2 -2
- package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +3 -3
- package/lib/typescript/utils/parsers/credential-sharing.d.ts +6 -6
- package/lib/typescript/utils/parsers/credential.d.ts +5 -5
- package/lib/typescript/utils/parsers/query.d.ts +2 -2
- package/lib/typescript/utils/translations.d.ts +1 -0
- package/package.json +3 -3
- package/src/components/credential/credential.tsx +3 -0
- package/src/components/history/history-list-item-icon.tsx +2 -2
- package/src/components/history/history-list-item.tsx +7 -12
- package/src/components/history/history-list-screen.tsx +1 -1
- package/src/components/index.ts +0 -1
- package/src/components/proof-request/v1/select-credential.tsx +3 -1
- package/src/components/proof-request/v1/share-credential.tsx +3 -0
- package/src/components/proof-request/v2/select-credential-v2.tsx +3 -1
- package/src/components/proof-request/v2/share-credential-v2-group.tsx +4 -0
- package/src/components/proof-request/v2/share-credential-v2.tsx +7 -0
- package/src/ui-components/credential/card/credential-details-card.tsx +3 -2
- package/src/ui-components/header/foldable-header.tsx +10 -9
- package/src/ui-components/header/header.tsx +10 -1
- package/src/ui-components/history/history-details.tsx +4 -4
- package/src/ui-components/history/history-section-list-item.tsx +3 -3
- package/src/ui-components/history/index.ts +0 -3
- package/src/ui-components/icons/contact.tsx +1 -1
- package/src/ui-components/icons/credential.tsx +1 -1
- package/src/ui-components/icons/icons.tsx +18 -0
- package/src/ui-components/list/index.ts +3 -0
- package/src/ui-components/{history/history-item.tsx → list/list-item.tsx} +36 -33
- package/src/ui-components/loader/loading-result.tsx +7 -1
- package/src/ui-components/screens/nerd-mode-screen.tsx +2 -52
- package/src/utils/date.ts +7 -14
- package/src/utils/hooks/core/cache.ts +10 -3
- package/src/utils/hooks/core/core-config.ts +1 -6
- package/src/utils/hooks/core/core-context.tsx +0 -24
- package/src/utils/hooks/core/credentials.ts +13 -0
- package/src/utils/hooks/core/index.ts +0 -1
- package/src/utils/hooks/core/trust-list.ts +22 -11
- package/src/utils/hooks/core/verifier-instance.ts +23 -2
- package/src/utils/hooks/core/wallet-unit.ts +3 -3
- package/src/utils/parsers/credential-sharing-v2.tsx +34 -14
- package/src/utils/parsers/credential-sharing.tsx +33 -16
- package/src/utils/parsers/credential.ts +45 -14
- package/src/utils/parsers/query.ts +5 -0
- package/src/utils/translations.ts +10 -0
- package/lib/commonjs/components/entity/EntityButtons.js +0 -64
- package/lib/commonjs/components/entity/EntityButtons.js.map +0 -1
- package/lib/commonjs/components/entity/entity-attributes.js +0 -65
- package/lib/commonjs/components/entity/entity-attributes.js.map +0 -1
- package/lib/commonjs/components/entity/entity-details-with-buttons.js +0 -67
- package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +0 -1
- package/lib/commonjs/components/entity/entity-details.js +0 -101
- package/lib/commonjs/components/entity/entity-details.js.map +0 -1
- package/lib/commonjs/components/entity/index.js +0 -14
- package/lib/commonjs/components/entity/index.js.map +0 -1
- package/lib/commonjs/ui-components/history/history-item.js.map +0 -1
- package/lib/commonjs/utils/hooks/core/trust-entity.js +0 -147
- package/lib/commonjs/utils/hooks/core/trust-entity.js.map +0 -1
- package/lib/module/components/entity/EntityButtons.js +0 -56
- package/lib/module/components/entity/EntityButtons.js.map +0 -1
- package/lib/module/components/entity/entity-attributes.js +0 -57
- package/lib/module/components/entity/entity-attributes.js.map +0 -1
- package/lib/module/components/entity/entity-details-with-buttons.js +0 -58
- package/lib/module/components/entity/entity-details-with-buttons.js.map +0 -1
- package/lib/module/components/entity/entity-details.js +0 -92
- package/lib/module/components/entity/entity-details.js.map +0 -1
- package/lib/module/components/entity/index.js +0 -3
- package/lib/module/components/entity/index.js.map +0 -1
- package/lib/module/ui-components/history/history-item.js.map +0 -1
- package/lib/module/utils/hooks/core/trust-entity.js +0 -136
- package/lib/module/utils/hooks/core/trust-entity.js.map +0 -1
- package/lib/typescript/components/entity/EntityButtons.d.ts +0 -14
- package/lib/typescript/components/entity/entity-attributes.d.ts +0 -15
- package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +0 -18
- package/lib/typescript/components/entity/entity-details.d.ts +0 -21
- package/lib/typescript/components/entity/index.d.ts +0 -3
- package/lib/typescript/utils/hooks/core/trust-entity.d.ts +0 -17
- package/src/components/entity/EntityButtons.tsx +0 -79
- package/src/components/entity/entity-attributes.tsx +0 -80
- package/src/components/entity/entity-details-with-buttons.tsx +0 -75
- package/src/components/entity/entity-details.tsx +0 -145
- package/src/components/entity/index.ts +0 -4
- package/src/utils/hooks/core/trust-entity.ts +0 -172
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_nerdView","_nerdModeScreen","_array","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","EntityAttributes","certificate","did","trustEntity","trusted","labels","entityType","testID","onCopyToClipboard","_did$split","didSections","split","identifier","pop","didMethod","join","attributes","addElementIf","attributeKey","trustRegistry","highlightedText","trustAnchor","name","Boolean","EntityType","CredentialEntity","issuerIdentifier","entityIdentifier","attributeText","canBeCopied","role","createElement","View","style","styles","wrapper","map","attribute","NerdModeItem","key","StyleSheet","create","marginBottom","_default","exports","memo"],"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 = StyleSheet.create({\n wrapper: {\n marginBottom: 20,\n },\n});\n\nexport default memo(EntityAttributes);\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAAiD,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAA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E,IAAI;IACjBtB,MAAM,EAAE;EACV,CAAC,CAAC,EACF,GAAG,IAAAU,mBAAY,EAACb,OAAO,IAAImB,OAAO,CAACpB,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAE2B,IAAI,CAAC,EAAE;IACrDZ,YAAY,EAAEb,MAAM,CAACyB,IAAI;IACzBV,eAAe,EAAEjB,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAE2B,IAAI;IAClCvB,MAAM,EAAE;EACV,CAAC,CAAC,CACH;EACD,oBACExC,MAAA,CAAAa,OAAA,CAAAmD,aAAA,CAAC7D,YAAA,CAAA8D,IAAI;IAACC,KAAK,EAAEC,MAAM,CAACC;EAAQ,GACzBnB,UAAU,CAACoB,GAAG,CAAEC,SAAS,iBACxBtE,MAAA,CAAAa,OAAA,CAAAmD,aAAA,CAAC5D,SAAA,CAAAmE,YAAY,EAAA5C,QAAA;IACX6C,GAAG,EAAEF,SAAS,CAACnB;EAAa,GACxBmB,SAAS;IACbhC,MAAM,EAAEA,MAAO;IACfG,iBAAiB,EAAEA,iBAAkB;IACrCD,MAAM,EAAEA;EAAO,EAChB,CACF,CACG,CAAC;AAEX,CAAC;AAED,MAAM2B,MAAM,GAAGM,uBAAU,CAACC,MAAM,CAAC;EAC/BN,OAAO,EAAE;IACPO,YAAY,EAAE;EAChB;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhE,OAAA,gBAEY,IAAAiE,WAAI,EAAC7C,gBAAgB,CAAC","ignoreList":[]}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _reactNativeOneCore = require("@procivis/react-native-one-core");
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
var _colorSchemeContext = require("../../ui-components/theme/color-scheme-context");
|
|
11
|
-
var _utils = require("../../utils");
|
|
12
|
-
var _trustEntity = require("../../utils/hooks/core/trust-entity");
|
|
13
|
-
var _entityAttributes = _interopRequireDefault(require("./entity-attributes"));
|
|
14
|
-
var _entityDetails = _interopRequireDefault(require("./entity-details"));
|
|
15
|
-
var _EntityButtons = _interopRequireDefault(require("./EntityButtons"));
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
-
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); }
|
|
20
|
-
const EntityDetailsWithButtons = ({
|
|
21
|
-
identifier,
|
|
22
|
-
entityLabels,
|
|
23
|
-
attributesLabels,
|
|
24
|
-
onCopyToClipboard,
|
|
25
|
-
role,
|
|
26
|
-
entityType,
|
|
27
|
-
testID,
|
|
28
|
-
...props
|
|
29
|
-
}) => {
|
|
30
|
-
var _identifierDetail$cer, _identifierDetail$did;
|
|
31
|
-
let {
|
|
32
|
-
data
|
|
33
|
-
} = (0, _trustEntity.useTrustEntity)(identifier === null || identifier === void 0 ? void 0 : identifier.id);
|
|
34
|
-
let {
|
|
35
|
-
data: identifierDetail
|
|
36
|
-
} = (0, _utils.useIdentifierDetails)(identifier === null || identifier === void 0 ? void 0 : identifier.id);
|
|
37
|
-
const trustEntity = data !== null && data !== void 0 ? data : undefined;
|
|
38
|
-
const colorScheme = (0, _colorSchemeContext.useAppColorScheme)();
|
|
39
|
-
const trusted = Boolean(trustEntity && trustEntity.state === _reactNativeOneCore.TrustEntityState.ACTIVE && (trustEntity.role === _reactNativeOneCore.TrustEntityRole.BOTH || trustEntity.role === role));
|
|
40
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
41
|
-
style: {
|
|
42
|
-
backgroundColor: colorScheme.nerdView.background
|
|
43
|
-
}
|
|
44
|
-
}, /*#__PURE__*/_react.default.createElement(_entityDetails.default, _extends({
|
|
45
|
-
identifier: identifier,
|
|
46
|
-
labels: {
|
|
47
|
-
unknown: role === _reactNativeOneCore.TrustEntityRole.ISSUER ? entityLabels.unknownIssuer : entityLabels.unknownVerifier
|
|
48
|
-
},
|
|
49
|
-
role: role,
|
|
50
|
-
testID: testID
|
|
51
|
-
}, props)), trusted && /*#__PURE__*/_react.default.createElement(_EntityButtons.default, {
|
|
52
|
-
entity: trustEntity,
|
|
53
|
-
labels: entityLabels,
|
|
54
|
-
testID: (0, _utils.concatTestID)(testID, 'links')
|
|
55
|
-
}), /*#__PURE__*/_react.default.createElement(_entityAttributes.default, {
|
|
56
|
-
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,
|
|
57
|
-
did: identifierDetail === null || identifierDetail === void 0 || (_identifierDetail$did = identifierDetail.did) === null || _identifierDetail$did === void 0 ? void 0 : _identifierDetail$did.did,
|
|
58
|
-
trustEntity: trustEntity,
|
|
59
|
-
trusted: trusted,
|
|
60
|
-
labels: attributesLabels,
|
|
61
|
-
onCopyToClipboard: onCopyToClipboard,
|
|
62
|
-
entityType: entityType,
|
|
63
|
-
testID: testID
|
|
64
|
-
}));
|
|
65
|
-
};
|
|
66
|
-
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(EntityDetailsWithButtons);
|
|
67
|
-
//# sourceMappingURL=entity-details-with-buttons.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeOneCore","require","_react","_interopRequireWildcard","_reactNative","_colorSchemeContext","_utils","_trustEntity","_entityAttributes","_interopRequireDefault","_entityDetails","_EntityButtons","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","EntityDetailsWithButtons","identifier","entityLabels","attributesLabels","onCopyToClipboard","role","entityType","testID","props","_identifierDetail$cer","_identifierDetail$did","data","useTrustEntity","id","identifierDetail","useIdentifierDetails","trustEntity","undefined","colorScheme","useAppColorScheme","trusted","Boolean","state","TrustEntityState","ACTIVE","TrustEntityRole","BOTH","createElement","View","style","backgroundColor","nerdView","background","labels","unknown","ISSUER","unknownIssuer","unknownVerifier","entity","concatTestID","certificate","certificates","chain","did","_default","exports","memo"],"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,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAGA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAC,sBAAA,CAAAR,OAA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IACvBC,MAAM,EAAEA;EAAO,CAChB,CACG,CAAC;AAEX,CAAC;AAAC,IAAAqC,QAAA,GAAAC,OAAA,CAAArE,OAAA,gBAEa,IAAAsE,WAAI,EAAC9C,wBAAwB,CAAC","ignoreList":[]}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _reactNativeOneCore = require("@procivis/react-native-one-core");
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _entityCluster = _interopRequireDefault(require("../../ui-components/entity/entity-cluster"));
|
|
10
|
-
var _icons = require("../../ui-components/icons");
|
|
11
|
-
var _utils = require("../../utils");
|
|
12
|
-
var _trustEntity = require("../../utils/hooks/core/trust-entity");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
-
const getCertificateCommonName = certificate => {
|
|
17
|
-
var _certificate$x509Attr;
|
|
18
|
-
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();
|
|
19
|
-
};
|
|
20
|
-
const EntityDetails = ({
|
|
21
|
-
labels,
|
|
22
|
-
renderMore,
|
|
23
|
-
role,
|
|
24
|
-
style,
|
|
25
|
-
testID,
|
|
26
|
-
sublineColor,
|
|
27
|
-
textColor,
|
|
28
|
-
...props
|
|
29
|
-
}) => {
|
|
30
|
-
var _props$identifier, _props$identifier2;
|
|
31
|
-
const {
|
|
32
|
-
data,
|
|
33
|
-
isLoading: isLoadingTrustEntity
|
|
34
|
-
} = (0, _trustEntity.useTrustEntity)('identifier' in props ? (_props$identifier = props.identifier) === null || _props$identifier === void 0 ? void 0 : _props$identifier.id : undefined);
|
|
35
|
-
const trustEntity = 'entity' in props ? props.entity : data !== null && data !== void 0 ? data : undefined;
|
|
36
|
-
const {
|
|
37
|
-
data: identifierDetail,
|
|
38
|
-
isLoading: isLoadingIdentifier
|
|
39
|
-
} = (0, _utils.useIdentifierDetails)('identifier' in props ? (_props$identifier2 = props.identifier) === null || _props$identifier2 === void 0 ? void 0 : _props$identifier2.id : undefined);
|
|
40
|
-
const trusted = trustEntity && trustEntity.state === _reactNativeOneCore.TrustEntityState.ACTIVE && (trustEntity.role === _reactNativeOneCore.TrustEntityRole.BOTH || trustEntity.role === role);
|
|
41
|
-
const isLoading = isLoadingIdentifier || isLoadingTrustEntity;
|
|
42
|
-
const avatarProps = (0, _react.useMemo)(() => {
|
|
43
|
-
var _identifierDetail$cer, _getCertificateCommon;
|
|
44
|
-
if (isLoading) {
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
const avatar = trusted && (identifierDetail === null || identifierDetail === void 0 ? void 0 : identifierDetail.type) === 'DID' && trustEntity.logo ? {
|
|
48
|
-
imageSource: {
|
|
49
|
-
uri: trustEntity.logo
|
|
50
|
-
}
|
|
51
|
-
} : undefined;
|
|
52
|
-
const placeholderText = (identifierDetail === null || identifierDetail === void 0 ? void 0 : identifierDetail.type) === _reactNativeOneCore.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';
|
|
53
|
-
const statusIcon = trusted ? /*#__PURE__*/_react.default.createElement(_icons.EntityTrustedIcon, {
|
|
54
|
-
testID: (0, _utils.concatTestID)(testID, 'statusIcon', 'trusted')
|
|
55
|
-
}) : /*#__PURE__*/_react.default.createElement(_icons.EntityNotTrustedIcon, {
|
|
56
|
-
testID: (0, _utils.concatTestID)(testID, 'statusIcon', 'notTrusted')
|
|
57
|
-
});
|
|
58
|
-
if (trustEntity) {
|
|
59
|
-
return {
|
|
60
|
-
avatar,
|
|
61
|
-
placeholderText: trusted && (identifierDetail === null || identifierDetail === void 0 ? void 0 : identifierDetail.type) === 'DID' ? trustEntity.name.substring(0, 1) : placeholderText,
|
|
62
|
-
statusIcon,
|
|
63
|
-
testID: (0, _utils.concatTestID)(testID, 'avatar')
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
placeholderText,
|
|
68
|
-
statusIcon
|
|
69
|
-
};
|
|
70
|
-
}, [trustEntity, trusted, identifierDetail, isLoading, testID]);
|
|
71
|
-
const trustEntityName = (0, _react.useMemo)(() => {
|
|
72
|
-
var _identifierDetail$cer2, _identifierDetail$did;
|
|
73
|
-
if (isLoading) {
|
|
74
|
-
return '';
|
|
75
|
-
}
|
|
76
|
-
if ((identifierDetail === null || identifierDetail === void 0 ? void 0 : identifierDetail.type) === _reactNativeOneCore.IdentifierType.CERTIFICATE && (_identifierDetail$cer2 = identifierDetail.certificates) !== null && _identifierDetail$cer2 !== void 0 && _identifierDetail$cer2[0]) {
|
|
77
|
-
const commonName = getCertificateCommonName(identifierDetail.certificates[0]);
|
|
78
|
-
if (commonName) {
|
|
79
|
-
return commonName;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (trustEntity) {
|
|
83
|
-
return trustEntity.name;
|
|
84
|
-
}
|
|
85
|
-
if (identifierDetail !== null && identifierDetail !== void 0 && (_identifierDetail$did = identifierDetail.did) !== null && _identifierDetail$did !== void 0 && _identifierDetail$did.did) {
|
|
86
|
-
return (0, _utils.replaceBreakingHyphens)(identifierDetail.did.did);
|
|
87
|
-
}
|
|
88
|
-
return labels.unknown;
|
|
89
|
-
}, [labels.unknown, trustEntity, identifierDetail, isLoading]);
|
|
90
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_entityCluster.default, {
|
|
91
|
-
avatar: avatarProps,
|
|
92
|
-
entityName: trustEntityName,
|
|
93
|
-
style: style,
|
|
94
|
-
testID: testID,
|
|
95
|
-
textColor: textColor,
|
|
96
|
-
sublineColor: sublineColor,
|
|
97
|
-
isLoading: isLoading
|
|
98
|
-
}), trustEntity && renderMore && renderMore(trustEntity));
|
|
99
|
-
};
|
|
100
|
-
var _default = exports.default = EntityDetails;
|
|
101
|
-
//# sourceMappingURL=entity-details.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeOneCore","require","_react","_interopRequireWildcard","_entityCluster","_interopRequireDefault","_icons","_utils","_trustEntity","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","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","useTrustEntity","identifier","id","undefined","trustEntity","entity","identifierDetail","isLoadingIdentifier","useIdentifierDetails","trusted","state","TrustEntityState","ACTIVE","TrustEntityRole","BOTH","avatarProps","useMemo","_identifierDetail$cer","_getCertificateCommon","avatar","type","logo","imageSource","uri","placeholderText","IdentifierType","CERTIFICATE","certificates","substring","statusIcon","createElement","EntityTrustedIcon","concatTestID","EntityNotTrustedIcon","name","trustEntityName","_identifierDetail$cer2","_identifierDetail$did","commonName","did","replaceBreakingHyphens","unknown","Fragment","entityName","_default","exports"],"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\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5B,gBAAgB,aAAhBA,gBAAgB,gBAAA+B,qBAAA,GAAhB/B,gBAAgB,CAAEiC,GAAG,cAAAF,qBAAA,eAArBA,qBAAA,CAAuBE,GAAG,EAAE;MAC9B,OAAO,IAAAC,6BAAsB,EAAClC,gBAAgB,CAACiC,GAAG,CAACA,GAAG,CAAC;IACzD;IAEA,OAAOpD,MAAM,CAACsD,OAAO;EACvB,CAAC,EAAE,CAACtD,MAAM,CAACsD,OAAO,EAAErC,WAAW,EAAEE,gBAAgB,EAAER,SAAS,CAAC,CAAC;EAE9D,oBACEjD,MAAA,CAAAS,OAAA,CAAAwE,aAAA,CAAAjF,MAAA,CAAAS,OAAA,CAAAoF,QAAA,qBACE7F,MAAA,CAAAS,OAAA,CAAAwE,aAAA,CAAC/E,cAAA,CAAAO,OAAa;IACZ6D,MAAM,EAAEJ,WAAY;IACpB4B,UAAU,EAAER,eAAgB;IAC5B7C,KAAK,EAAEA,KAAM;IACbC,MAAM,EAAEA,MAAO;IACfE,SAAS,EAAEA,SAAU;IACrBD,YAAY,EAAEA,YAAa;IAC3BM,SAAS,EAAEA;EAAU,CACtB,CAAC,EACDM,WAAW,IAAIhB,UAAU,IAAIA,UAAU,CAACgB,WAAW,CACpD,CAAC;AAEP,CAAC;AAAC,IAAAwC,QAAA,GAAAC,OAAA,CAAAvF,OAAA,GAEa4B,aAAa","ignoreList":[]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "EntityDetails", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _entityDetails.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _entityDetails = _interopRequireDefault(require("./entity-details"));
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_entityDetails","_interopRequireDefault","require","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["import type { EntityDetailsLabels, EntityDetailsProps } from './entity-details';\nimport EntityDetails from './entity-details';\n\nexport { EntityDetails, EntityDetailsLabels, EntityDetailsProps };\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_testID","_accessibilityHistoryWrappers","_typography","_interopRequireDefault","_colorSchemeContext","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","HistoryItemView","first","icon","label","info","last","style","time","onPress","testID","colorScheme","useAppColorScheme","iconView","useMemo","React","isValidElement","IconComponent","createElement","TouchableOpacity","disabled","styles","historyItemContainer","backgroundColor","white","containerFirst","containerLast","View","historyItemWrapper","borderColor","background","wrapperLast","labelAndInfo","color","text","numberOfLines","preset","concatTestID","Boolean","shaded","StyleSheet","create","borderTopLeftRadius","borderTopRightRadius","marginTop","paddingTop","borderBottomLeftRadius","borderBottomRightRadius","marginBottom","paddingBottom","paddingHorizontal","alignItems","borderBottomWidth","flexDirection","paddingVertical","flex","marginHorizontal","opacity","marginRight","_default","exports"],"sources":["history-item.tsx"],"sourcesContent":["import React, { ComponentType, FC, ReactElement, useMemo } from 'react';\nimport { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport { concatTestID } from '../../utils/testID';\nimport { TouchableOpacity } from '../accessibility/accessibilityHistoryWrappers';\nimport Typography from '../text/typography';\nimport { useAppColorScheme } from '../theme/color-scheme-context';\n\nexport type HistoryItemViewProps = {\n first?: boolean;\n icon: ComponentType<any> | ReactElement;\n info?: string;\n label: string;\n last?: boolean;\n onPress?: () => void;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n time: string;\n};\n\nconst HistoryItemView: FC<HistoryItemViewProps> = ({\n first,\n icon,\n label,\n info,\n last,\n style,\n time,\n onPress,\n testID,\n}) => {\n const colorScheme = useAppColorScheme();\n\n const iconView: ReactElement | undefined = useMemo(() => {\n if (React.isValidElement(icon)) {\n return icon;\n } else if (icon) {\n const IconComponent = icon as ComponentType<any>;\n return <IconComponent />;\n }\n }, [icon]);\n\n return (\n <TouchableOpacity\n disabled={!onPress}\n onPress={() => onPress?.()}\n style={[\n styles.historyItemContainer,\n {\n backgroundColor: colorScheme.white,\n },\n first && styles.containerFirst,\n last && styles.containerLast,\n style,\n ]}\n testID={testID}>\n <View\n style={[\n styles.historyItemWrapper,\n {\n backgroundColor: colorScheme.white,\n borderColor: colorScheme.background,\n },\n last && styles.wrapperLast,\n ]}>\n {iconView}\n <View style={styles.labelAndInfo}>\n <Typography\n color={colorScheme.text}\n numberOfLines={1}\n preset=\"s\"\n style={styles.label}\n testID={concatTestID(testID, 'label')}>\n {label}\n </Typography>\n {Boolean(info) && (\n <Typography\n color={colorScheme.text}\n numberOfLines={1}\n preset=\"s/line-height-small\"\n style={styles.shaded}\n testID={concatTestID(testID, 'info')}>\n {info}\n </Typography>\n )}\n </View>\n <Typography\n color={colorScheme.text}\n numberOfLines={1}\n preset=\"xs/line-height-small\"\n style={styles.time}\n testID={concatTestID(testID, 'timeLabel')}>\n {time}\n </Typography>\n </View>\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n containerFirst: {\n borderTopLeftRadius: 20,\n borderTopRightRadius: 20,\n marginTop: 8,\n paddingTop: 12,\n },\n containerLast: {\n borderBottomLeftRadius: 20,\n borderBottomRightRadius: 20,\n marginBottom: 12,\n paddingBottom: 12,\n },\n historyItemContainer: {\n paddingHorizontal: 12,\n },\n historyItemWrapper: {\n alignItems: 'center',\n borderBottomWidth: 1,\n flexDirection: 'row',\n paddingVertical: 12,\n },\n label: {\n marginBottom: 2,\n },\n labelAndInfo: {\n flex: 1,\n marginHorizontal: 12,\n },\n shaded: {\n opacity: 0.7,\n },\n time: {\n marginRight: 8,\n opacity: 0.7,\n },\n wrapperLast: {\n borderBottomWidth: 0,\n },\n});\n\nexport default HistoryItemView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,6BAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AAAkE,SAAAK,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAA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
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useUpdateRemoteTrustEntity = exports.useTrustEntity = exports.useRemoteTrustEntity = exports.useCreateTrustAnchor = exports.useCreateRemoteTrustEntity = exports.TrustManagementEnum = exports.TRUST_ENTITY_DETAIL_QUERY_KEY = exports.REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY = void 0;
|
|
7
|
-
var _reactNativeOneCore = require("@procivis/react-native-one-core");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _reactQuery = require("react-query");
|
|
10
|
-
var _reporting = require("../../reporting");
|
|
11
|
-
var _client = require("../http/client");
|
|
12
|
-
var _coreContext = require("./core-context");
|
|
13
|
-
var _errorCode = require("./error-code");
|
|
14
|
-
var _history = require("./history");
|
|
15
|
-
var _identifiers = require("./identifiers");
|
|
16
|
-
const TRUST_ENTITY_DETAIL_QUERY_KEY = exports.TRUST_ENTITY_DETAIL_QUERY_KEY = 'trust-entity-detail';
|
|
17
|
-
const REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY = exports.REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY = 'remote-trust-entity-detail';
|
|
18
|
-
const useCreateTrustAnchor = () => {
|
|
19
|
-
const httpClient = (0, _client.useHTTPClient)();
|
|
20
|
-
return (0, _react.useCallback)(async (core, publisherReference) => {
|
|
21
|
-
const trustAnchors = await core.listTrustAnchors({
|
|
22
|
-
page: 0,
|
|
23
|
-
pageSize: 1
|
|
24
|
-
});
|
|
25
|
-
if (trustAnchors.values.length > 0) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const response = await httpClient.get(publisherReference);
|
|
29
|
-
if (!response.ok || !response.data) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const trustAnchor = response.data;
|
|
33
|
-
await core.createTrustAnchor({
|
|
34
|
-
isPublisher: false,
|
|
35
|
-
name: trustAnchor.name,
|
|
36
|
-
publisherReference,
|
|
37
|
-
type: TrustManagementEnum.SimpleTrustList
|
|
38
|
-
}).catch(err => {
|
|
39
|
-
(0, _reporting.reportException)(err, 'Failed to create trust anchor');
|
|
40
|
-
throw err;
|
|
41
|
-
});
|
|
42
|
-
}, [httpClient]);
|
|
43
|
-
};
|
|
44
|
-
exports.useCreateTrustAnchor = useCreateTrustAnchor;
|
|
45
|
-
const useTrustEntity = identifierId => {
|
|
46
|
-
const {
|
|
47
|
-
core
|
|
48
|
-
} = (0, _coreContext.useONECore)();
|
|
49
|
-
const {
|
|
50
|
-
data: identifierDetail
|
|
51
|
-
} = (0, _identifiers.useIdentifierDetails)(identifierId);
|
|
52
|
-
return (0, _reactQuery.useQuery)([TRUST_ENTITY_DETAIL_QUERY_KEY, identifierId], () => {
|
|
53
|
-
var _identifierDetail$cer;
|
|
54
|
-
return identifierId && identifierDetail ? core.resolveTrustEntityByIdentifier({
|
|
55
|
-
identifiers: [{
|
|
56
|
-
certificateId: (identifierDetail === null || identifierDetail === void 0 ? void 0 : identifierDetail.type) === _reactNativeOneCore.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,
|
|
57
|
-
id: identifierId
|
|
58
|
-
}]
|
|
59
|
-
}).then(result => {
|
|
60
|
-
var _result$identifierId$, _result$identifierId;
|
|
61
|
-
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;
|
|
62
|
-
}).catch(e => {
|
|
63
|
-
if (e instanceof _reactNativeOneCore.OneError && e.code === _errorCode.OneErrorCode.NoTrustEntityFound) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
throw e;
|
|
67
|
-
}) : undefined;
|
|
68
|
-
}, {
|
|
69
|
-
enabled: Boolean(identifierDetail),
|
|
70
|
-
keepPreviousData: true
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
exports.useTrustEntity = useTrustEntity;
|
|
74
|
-
const useRemoteTrustEntity = identifierId => {
|
|
75
|
-
const {
|
|
76
|
-
core
|
|
77
|
-
} = (0, _coreContext.useONECore)();
|
|
78
|
-
const {
|
|
79
|
-
data: identifierDetail
|
|
80
|
-
} = (0, _identifiers.useIdentifierDetails)(identifierId);
|
|
81
|
-
return (0, _reactQuery.useQuery)([REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY, identifierId], () => identifierDetail !== null && identifierDetail !== void 0 && identifierDetail.did ? core.getRemoteTrustEntity(identifierDetail.did.id) : undefined, {
|
|
82
|
-
enabled: Boolean(identifierDetail === null || identifierDetail === void 0 ? void 0 : identifierDetail.did),
|
|
83
|
-
keepPreviousData: true
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
exports.useRemoteTrustEntity = useRemoteTrustEntity;
|
|
87
|
-
const useCreateRemoteTrustEntity = () => {
|
|
88
|
-
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
89
|
-
const {
|
|
90
|
-
core
|
|
91
|
-
} = (0, _coreContext.useONECore)();
|
|
92
|
-
return (0, _reactQuery.useMutation)(async request => {
|
|
93
|
-
const {
|
|
94
|
-
identifierId,
|
|
95
|
-
didId
|
|
96
|
-
} = request;
|
|
97
|
-
let entityDidId = didId;
|
|
98
|
-
if (identifierId) {
|
|
99
|
-
var _identifierDetail$did;
|
|
100
|
-
const identifierDetail = await core.getIdentifier(identifierId);
|
|
101
|
-
entityDidId = identifierDetail === null || identifierDetail === void 0 || (_identifierDetail$did = identifierDetail.did) === null || _identifierDetail$did === void 0 ? void 0 : _identifierDetail$did.id;
|
|
102
|
-
}
|
|
103
|
-
return core.createRemoteTrustEntity({
|
|
104
|
-
...request,
|
|
105
|
-
didId: entityDidId
|
|
106
|
-
});
|
|
107
|
-
}, {
|
|
108
|
-
onSuccess: async () => {
|
|
109
|
-
await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);
|
|
110
|
-
await queryClient.invalidateQueries(_history.HISTORY_LIST_QUERY_KEY);
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
exports.useCreateRemoteTrustEntity = useCreateRemoteTrustEntity;
|
|
115
|
-
const useUpdateRemoteTrustEntity = () => {
|
|
116
|
-
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
117
|
-
const {
|
|
118
|
-
core
|
|
119
|
-
} = (0, _coreContext.useONECore)();
|
|
120
|
-
return (0, _reactQuery.useMutation)(async request => {
|
|
121
|
-
const {
|
|
122
|
-
identifierId,
|
|
123
|
-
didId
|
|
124
|
-
} = request;
|
|
125
|
-
let entityDidId = didId;
|
|
126
|
-
if (identifierId) {
|
|
127
|
-
var _identifierDetail$did2;
|
|
128
|
-
const identifierDetail = await core.getIdentifier(identifierId);
|
|
129
|
-
entityDidId = identifierDetail === null || identifierDetail === void 0 || (_identifierDetail$did2 = identifierDetail.did) === null || _identifierDetail$did2 === void 0 ? void 0 : _identifierDetail$did2.id;
|
|
130
|
-
}
|
|
131
|
-
return core.updateRemoteTrustEntity({
|
|
132
|
-
...request,
|
|
133
|
-
didId: entityDidId
|
|
134
|
-
});
|
|
135
|
-
}, {
|
|
136
|
-
onSuccess: async () => {
|
|
137
|
-
await queryClient.invalidateQueries(REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY);
|
|
138
|
-
await queryClient.invalidateQueries(_history.HISTORY_LIST_QUERY_KEY);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
exports.useUpdateRemoteTrustEntity = useUpdateRemoteTrustEntity;
|
|
143
|
-
let TrustManagementEnum = exports.TrustManagementEnum = /*#__PURE__*/function (TrustManagementEnum) {
|
|
144
|
-
TrustManagementEnum["SimpleTrustList"] = "SIMPLE_TRUST_LIST";
|
|
145
|
-
return TrustManagementEnum;
|
|
146
|
-
}({});
|
|
147
|
-
//# sourceMappingURL=trust-entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeOneCore","require","_react","_reactQuery","_reporting","_client","_coreContext","_errorCode","_history","_identifiers","TRUST_ENTITY_DETAIL_QUERY_KEY","exports","REMOTE_TRUST_ENTITY_DETAIL_QUERY_KEY","useCreateTrustAnchor","httpClient","useHTTPClient","useCallback","core","publisherReference","trustAnchors","listTrustAnchors","page","pageSize","values","length","response","get","ok","data","trustAnchor","createTrustAnchor","isPublisher","name","type","TrustManagementEnum","SimpleTrustList","catch","err","reportException","useTrustEntity","identifierId","useONECore","identifierDetail","useIdentifierDetails","useQuery","_identifierDetail$cer","resolveTrustEntityByIdentifier","identifiers","certificateId","IdentifierType","CERTIFICATE","certificates","id","undefined","then","result","_result$identifierId$","_result$identifierId","trustEntity","e","OneError","code","OneErrorCode","NoTrustEntityFound","enabled","Boolean","keepPreviousData","useRemoteTrustEntity","did","getRemoteTrustEntity","useCreateRemoteTrustEntity","queryClient","useQueryClient","useMutation","request","didId","entityDidId","_identifierDetail$did","getIdentifier","createRemoteTrustEntity","onSuccess","invalidateQueries","HISTORY_LIST_QUERY_KEY","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(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport enum TrustManagementEnum {\n SimpleTrustList = 'SIMPLE_TRUST_LIST',\n}\n"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAEO,MAAMS,6BAA6B,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AA,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA","ignoreList":[]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React, { memo, useCallback, useMemo } from 'react';
|
|
2
|
-
import { Linking, StyleSheet, View } from 'react-native';
|
|
3
|
-
import { Button, ButtonType } from '../../ui-components/buttons';
|
|
4
|
-
import { concatTestID, reportException } from '../../utils';
|
|
5
|
-
const EntityButtons = ({
|
|
6
|
-
entity,
|
|
7
|
-
labels,
|
|
8
|
-
testID
|
|
9
|
-
}) => {
|
|
10
|
-
const buttons = useMemo(() => [{
|
|
11
|
-
label: labels.visitWebsite,
|
|
12
|
-
url: (entity === null || entity === void 0 ? void 0 : entity.website) || '',
|
|
13
|
-
testID: 'website'
|
|
14
|
-
}, {
|
|
15
|
-
label: labels.termsAndServices,
|
|
16
|
-
url: (entity === null || entity === void 0 ? void 0 : entity.termsUrl) || '',
|
|
17
|
-
testID: 'termsOfService'
|
|
18
|
-
}, {
|
|
19
|
-
label: labels.privacyPolicy,
|
|
20
|
-
url: (entity === null || entity === void 0 ? void 0 : entity.privacyUrl) || '',
|
|
21
|
-
testID: 'privacyPolicy'
|
|
22
|
-
}].filter(btn => Boolean(btn.url)), [entity, labels]);
|
|
23
|
-
const openURL = useCallback(url => () => {
|
|
24
|
-
Linking.openURL(url).catch(e => {
|
|
25
|
-
reportException(e, 'Error opening entity link');
|
|
26
|
-
});
|
|
27
|
-
}, []);
|
|
28
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
29
|
-
style: [styles.buttons],
|
|
30
|
-
testID: testID
|
|
31
|
-
}, buttons.map(({
|
|
32
|
-
label,
|
|
33
|
-
url,
|
|
34
|
-
testID: testIdSuffix
|
|
35
|
-
}) => /*#__PURE__*/React.createElement(Button, {
|
|
36
|
-
key: label,
|
|
37
|
-
title: label,
|
|
38
|
-
onPress: openURL(url),
|
|
39
|
-
style: styles.urlButton,
|
|
40
|
-
testID: concatTestID(testID, testIdSuffix),
|
|
41
|
-
type: ButtonType.SmallTech
|
|
42
|
-
})));
|
|
43
|
-
};
|
|
44
|
-
const styles = StyleSheet.create({
|
|
45
|
-
buttons: {
|
|
46
|
-
paddingBottom: 10,
|
|
47
|
-
paddingHorizontal: 12
|
|
48
|
-
},
|
|
49
|
-
urlButton: {
|
|
50
|
-
borderRadius: 4,
|
|
51
|
-
borderWidth: 0,
|
|
52
|
-
marginTop: 4
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
export default /*#__PURE__*/memo(EntityButtons);
|
|
56
|
-
//# sourceMappingURL=EntityButtons.js.map
|
|
@@ -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,gBAAgB;IAC9BF,GAAG,EAAE,CAAAN,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAES,QAAQ,KAAI,EAAE;IAC3BP,MAAM,EAAE;EACV,CAAC,EACD;IACEE,KAAK,EAAEH,MAAM,CAACS,aAAa;IAC3BJ,GAAG,EAAE,CAAA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AAe7C,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 = StyleSheet.create({\n wrapper: {\n marginBottom: 20,\n },\n});\n\nexport default memo(EntityAttributes);\n"],"mappings":";AACA,OAAOA,KAAK,IAAQC,IAAI,QAAQ,OAAO;AACvC,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,SAASC,YAAY,QAAQ,+BAA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