@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.
Files changed (220) hide show
  1. package/lib/commonjs/components/credential/credential.js +2 -1
  2. package/lib/commonjs/components/credential/credential.js.map +1 -1
  3. package/lib/commonjs/components/history/history-list-item-icon.js +2 -3
  4. package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
  5. package/lib/commonjs/components/history/history-list-item.js +2 -8
  6. package/lib/commonjs/components/history/history-list-item.js.map +1 -1
  7. package/lib/commonjs/components/history/history-list-screen.js +1 -1
  8. package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
  9. package/lib/commonjs/components/index.js +0 -11
  10. package/lib/commonjs/components/index.js.map +1 -1
  11. package/lib/commonjs/components/proof-request/v1/select-credential.js +2 -1
  12. package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -1
  13. package/lib/commonjs/components/proof-request/v1/share-credential.js +2 -1
  14. package/lib/commonjs/components/proof-request/v1/share-credential.js.map +1 -1
  15. package/lib/commonjs/components/proof-request/v2/select-credential-v2.js +2 -1
  16. package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -1
  17. package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js +3 -1
  18. package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  19. package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +4 -2
  20. package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
  21. package/lib/commonjs/ui-components/credential/card/credential-details-card.js +3 -1
  22. package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
  23. package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
  24. package/lib/commonjs/ui-components/header/header.js.map +1 -1
  25. package/lib/commonjs/ui-components/history/history-details.js +2 -2
  26. package/lib/commonjs/ui-components/history/history-details.js.map +1 -1
  27. package/lib/commonjs/ui-components/icons/contact.js.map +1 -1
  28. package/lib/commonjs/ui-components/icons/credential.js +3 -3
  29. package/lib/commonjs/ui-components/icons/credential.js.map +1 -1
  30. package/lib/commonjs/ui-components/icons/icons.js +20 -1
  31. package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
  32. package/lib/commonjs/ui-components/loader/loading-result.js +2 -0
  33. package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
  34. package/lib/commonjs/ui-components/screens/nerd-mode-screen.js +7 -33
  35. package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
  36. package/lib/commonjs/utils/date.js +4 -5
  37. package/lib/commonjs/utils/date.js.map +1 -1
  38. package/lib/commonjs/utils/hooks/core/cache.js +7 -4
  39. package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
  40. package/lib/commonjs/utils/hooks/core/core-config.js +1 -6
  41. package/lib/commonjs/utils/hooks/core/core-config.js.map +1 -1
  42. package/lib/commonjs/utils/hooks/core/core-context.js +0 -15
  43. package/lib/commonjs/utils/hooks/core/core-context.js.map +1 -1
  44. package/lib/commonjs/utils/hooks/core/credentials.js +15 -1
  45. package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
  46. package/lib/commonjs/utils/hooks/core/index.js +0 -11
  47. package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
  48. package/lib/commonjs/utils/hooks/core/trust-list.js +19 -3
  49. package/lib/commonjs/utils/hooks/core/trust-list.js.map +1 -1
  50. package/lib/commonjs/utils/hooks/core/verifier-instance.js +22 -3
  51. package/lib/commonjs/utils/hooks/core/verifier-instance.js.map +1 -1
  52. package/lib/commonjs/utils/hooks/core/wallet-unit.js +2 -2
  53. package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
  54. package/lib/commonjs/utils/parsers/credential-sharing-v2.js +14 -14
  55. package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
  56. package/lib/commonjs/utils/parsers/credential-sharing.js +20 -18
  57. package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
  58. package/lib/commonjs/utils/parsers/credential.js +36 -22
  59. package/lib/commonjs/utils/parsers/credential.js.map +1 -1
  60. package/lib/commonjs/utils/parsers/query.js +1 -1
  61. package/lib/commonjs/utils/parsers/query.js.map +1 -1
  62. package/lib/commonjs/utils/translations.js +15 -0
  63. package/lib/commonjs/utils/translations.js.map +1 -0
  64. package/lib/module/components/credential/credential.js +2 -1
  65. package/lib/module/components/credential/credential.js.map +1 -1
  66. package/lib/module/components/history/history-list-item-icon.js +2 -3
  67. package/lib/module/components/history/history-list-item-icon.js.map +1 -1
  68. package/lib/module/components/history/history-list-item.js +3 -9
  69. package/lib/module/components/history/history-list-item.js.map +1 -1
  70. package/lib/module/components/history/history-list-screen.js +1 -1
  71. package/lib/module/components/history/history-list-screen.js.map +1 -1
  72. package/lib/module/components/index.js +0 -1
  73. package/lib/module/components/index.js.map +1 -1
  74. package/lib/module/components/proof-request/v1/select-credential.js +2 -1
  75. package/lib/module/components/proof-request/v1/select-credential.js.map +1 -1
  76. package/lib/module/components/proof-request/v1/share-credential.js +2 -1
  77. package/lib/module/components/proof-request/v1/share-credential.js.map +1 -1
  78. package/lib/module/components/proof-request/v2/select-credential-v2.js +2 -1
  79. package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -1
  80. package/lib/module/components/proof-request/v2/share-credential-v2-group.js +3 -1
  81. package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
  82. package/lib/module/components/proof-request/v2/share-credential-v2.js +4 -2
  83. package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
  84. package/lib/module/ui-components/credential/card/credential-details-card.js +3 -1
  85. package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
  86. package/lib/module/ui-components/header/foldable-header.js.map +1 -1
  87. package/lib/module/ui-components/header/header.js.map +1 -1
  88. package/lib/module/ui-components/history/history-details.js +3 -3
  89. package/lib/module/ui-components/history/history-details.js.map +1 -1
  90. package/lib/module/ui-components/icons/contact.js.map +1 -1
  91. package/lib/module/ui-components/icons/credential.js +1 -1
  92. package/lib/module/ui-components/icons/credential.js.map +1 -1
  93. package/lib/module/ui-components/icons/icons.js +18 -0
  94. package/lib/module/ui-components/icons/icons.js.map +1 -1
  95. package/lib/module/ui-components/loader/loading-result.js +2 -0
  96. package/lib/module/ui-components/loader/loading-result.js.map +1 -1
  97. package/lib/module/ui-components/screens/nerd-mode-screen.js +7 -33
  98. package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
  99. package/lib/module/utils/date.js +4 -5
  100. package/lib/module/utils/date.js.map +1 -1
  101. package/lib/module/utils/hooks/core/cache.js +7 -4
  102. package/lib/module/utils/hooks/core/cache.js.map +1 -1
  103. package/lib/module/utils/hooks/core/core-config.js +0 -4
  104. package/lib/module/utils/hooks/core/core-config.js.map +1 -1
  105. package/lib/module/utils/hooks/core/core-context.js +0 -15
  106. package/lib/module/utils/hooks/core/core-context.js.map +1 -1
  107. package/lib/module/utils/hooks/core/credentials.js +13 -0
  108. package/lib/module/utils/hooks/core/credentials.js.map +1 -1
  109. package/lib/module/utils/hooks/core/index.js +0 -1
  110. package/lib/module/utils/hooks/core/index.js.map +1 -1
  111. package/lib/module/utils/hooks/core/trust-list.js +20 -4
  112. package/lib/module/utils/hooks/core/trust-list.js.map +1 -1
  113. package/lib/module/utils/hooks/core/verifier-instance.js +20 -2
  114. package/lib/module/utils/hooks/core/verifier-instance.js.map +1 -1
  115. package/lib/module/utils/hooks/core/wallet-unit.js +2 -2
  116. package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
  117. package/lib/module/utils/parsers/credential-sharing-v2.js +15 -15
  118. package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
  119. package/lib/module/utils/parsers/credential-sharing.js +20 -18
  120. package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
  121. package/lib/module/utils/parsers/credential.js +37 -23
  122. package/lib/module/utils/parsers/credential.js.map +1 -1
  123. package/lib/module/utils/parsers/query.js +1 -1
  124. package/lib/module/utils/parsers/query.js.map +1 -1
  125. package/lib/module/utils/translations.js +8 -0
  126. package/lib/module/utils/translations.js.map +1 -0
  127. package/lib/typescript/components/credential/credential.d.ts +1 -0
  128. package/lib/typescript/components/history/history-list-item.d.ts +1 -1
  129. package/lib/typescript/components/index.d.ts +0 -1
  130. package/lib/typescript/components/proof-request/v1/select-credential.d.ts +1 -0
  131. package/lib/typescript/components/proof-request/v1/share-credential.d.ts +1 -0
  132. package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +1 -0
  133. package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +1 -0
  134. package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +1 -0
  135. package/lib/typescript/ui-components/history/history-details.d.ts +2 -2
  136. package/lib/typescript/ui-components/icons/credential.d.ts +1 -1
  137. package/lib/typescript/ui-components/icons/icons.d.ts +1 -0
  138. package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +0 -12
  139. package/lib/typescript/utils/hooks/core/core-config.d.ts +0 -1
  140. package/lib/typescript/utils/hooks/core/core-context.d.ts +0 -1
  141. package/lib/typescript/utils/hooks/core/credentials.d.ts +2 -1
  142. package/lib/typescript/utils/hooks/core/index.d.ts +0 -1
  143. package/lib/typescript/utils/hooks/core/trust-list.d.ts +1 -4
  144. package/lib/typescript/utils/hooks/core/verifier-instance.d.ts +2 -0
  145. package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +2 -2
  146. package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +3 -3
  147. package/lib/typescript/utils/parsers/credential-sharing.d.ts +6 -6
  148. package/lib/typescript/utils/parsers/credential.d.ts +5 -5
  149. package/lib/typescript/utils/parsers/query.d.ts +1 -1
  150. package/lib/typescript/utils/translations.d.ts +1 -0
  151. package/package.json +3 -3
  152. package/src/components/credential/credential.tsx +3 -0
  153. package/src/components/history/history-list-item-icon.tsx +1 -2
  154. package/src/components/history/history-list-item.tsx +4 -9
  155. package/src/components/history/history-list-screen.tsx +1 -1
  156. package/src/components/index.ts +0 -1
  157. package/src/components/proof-request/v1/select-credential.tsx +3 -1
  158. package/src/components/proof-request/v1/share-credential.tsx +3 -0
  159. package/src/components/proof-request/v2/select-credential-v2.tsx +3 -1
  160. package/src/components/proof-request/v2/share-credential-v2-group.tsx +4 -0
  161. package/src/components/proof-request/v2/share-credential-v2.tsx +5 -0
  162. package/src/ui-components/credential/card/credential-details-card.tsx +3 -2
  163. package/src/ui-components/header/foldable-header.tsx +10 -9
  164. package/src/ui-components/header/header.tsx +10 -1
  165. package/src/ui-components/history/history-details.tsx +4 -4
  166. package/src/ui-components/icons/contact.tsx +1 -1
  167. package/src/ui-components/icons/credential.tsx +1 -1
  168. package/src/ui-components/icons/icons.tsx +18 -0
  169. package/src/ui-components/loader/loading-result.tsx +7 -1
  170. package/src/ui-components/screens/nerd-mode-screen.tsx +2 -52
  171. package/src/utils/date.ts +7 -14
  172. package/src/utils/hooks/core/cache.ts +10 -3
  173. package/src/utils/hooks/core/core-config.ts +1 -6
  174. package/src/utils/hooks/core/core-context.tsx +0 -24
  175. package/src/utils/hooks/core/credentials.ts +13 -0
  176. package/src/utils/hooks/core/index.ts +0 -1
  177. package/src/utils/hooks/core/trust-list.ts +22 -11
  178. package/src/utils/hooks/core/verifier-instance.ts +23 -2
  179. package/src/utils/hooks/core/wallet-unit.ts +3 -3
  180. package/src/utils/parsers/credential-sharing-v2.tsx +29 -12
  181. package/src/utils/parsers/credential-sharing.tsx +33 -16
  182. package/src/utils/parsers/credential.ts +45 -14
  183. package/src/utils/parsers/query.ts +3 -0
  184. package/src/utils/translations.ts +10 -0
  185. package/lib/commonjs/components/entity/EntityButtons.js +0 -64
  186. package/lib/commonjs/components/entity/EntityButtons.js.map +0 -1
  187. package/lib/commonjs/components/entity/entity-attributes.js +0 -65
  188. package/lib/commonjs/components/entity/entity-attributes.js.map +0 -1
  189. package/lib/commonjs/components/entity/entity-details-with-buttons.js +0 -67
  190. package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +0 -1
  191. package/lib/commonjs/components/entity/entity-details.js +0 -101
  192. package/lib/commonjs/components/entity/entity-details.js.map +0 -1
  193. package/lib/commonjs/components/entity/index.js +0 -14
  194. package/lib/commonjs/components/entity/index.js.map +0 -1
  195. package/lib/commonjs/utils/hooks/core/trust-entity.js +0 -147
  196. package/lib/commonjs/utils/hooks/core/trust-entity.js.map +0 -1
  197. package/lib/module/components/entity/EntityButtons.js +0 -56
  198. package/lib/module/components/entity/EntityButtons.js.map +0 -1
  199. package/lib/module/components/entity/entity-attributes.js +0 -57
  200. package/lib/module/components/entity/entity-attributes.js.map +0 -1
  201. package/lib/module/components/entity/entity-details-with-buttons.js +0 -58
  202. package/lib/module/components/entity/entity-details-with-buttons.js.map +0 -1
  203. package/lib/module/components/entity/entity-details.js +0 -92
  204. package/lib/module/components/entity/entity-details.js.map +0 -1
  205. package/lib/module/components/entity/index.js +0 -3
  206. package/lib/module/components/entity/index.js.map +0 -1
  207. package/lib/module/utils/hooks/core/trust-entity.js +0 -136
  208. package/lib/module/utils/hooks/core/trust-entity.js.map +0 -1
  209. package/lib/typescript/components/entity/EntityButtons.d.ts +0 -14
  210. package/lib/typescript/components/entity/entity-attributes.d.ts +0 -15
  211. package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +0 -18
  212. package/lib/typescript/components/entity/entity-details.d.ts +0 -21
  213. package/lib/typescript/components/entity/index.d.ts +0 -3
  214. package/lib/typescript/utils/hooks/core/trust-entity.d.ts +0 -17
  215. package/src/components/entity/EntityButtons.tsx +0 -79
  216. package/src/components/entity/entity-attributes.tsx +0 -80
  217. package/src/components/entity/entity-details-with-buttons.tsx +0 -75
  218. package/src/components/entity/entity-details.tsx +0 -145
  219. package/src/components/entity/index.ts +0 -4
  220. package/src/utils/hooks/core/trust-entity.ts +0 -172
@@ -1,64 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- var _buttons = require("../../ui-components/buttons");
10
- var _utils = require("../../utils");
11
- 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); }
12
- 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; }
13
- const EntityButtons = ({
14
- entity,
15
- labels,
16
- testID
17
- }) => {
18
- const buttons = (0, _react.useMemo)(() => [{
19
- label: labels.visitWebsite,
20
- url: (entity === null || entity === void 0 ? void 0 : entity.website) || '',
21
- testID: 'website'
22
- }, {
23
- label: labels.termsAndServices,
24
- url: (entity === null || entity === void 0 ? void 0 : entity.termsUrl) || '',
25
- testID: 'termsOfService'
26
- }, {
27
- label: labels.privacyPolicy,
28
- url: (entity === null || entity === void 0 ? void 0 : entity.privacyUrl) || '',
29
- testID: 'privacyPolicy'
30
- }].filter(btn => Boolean(btn.url)), [entity, labels]);
31
- const openURL = (0, _react.useCallback)(url => () => {
32
- _reactNative.Linking.openURL(url).catch(e => {
33
- (0, _utils.reportException)(e, 'Error opening entity link');
34
- });
35
- }, []);
36
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
37
- style: [styles.buttons],
38
- testID: testID
39
- }, buttons.map(({
40
- label,
41
- url,
42
- testID: testIdSuffix
43
- }) => /*#__PURE__*/_react.default.createElement(_buttons.Button, {
44
- key: label,
45
- title: label,
46
- onPress: openURL(url),
47
- style: styles.urlButton,
48
- testID: (0, _utils.concatTestID)(testID, testIdSuffix),
49
- type: _buttons.ButtonType.SmallTech
50
- })));
51
- };
52
- const styles = _reactNative.StyleSheet.create({
53
- buttons: {
54
- paddingBottom: 10,
55
- paddingHorizontal: 12
56
- },
57
- urlButton: {
58
- borderRadius: 4,
59
- borderWidth: 0,
60
- marginTop: 4
61
- }
62
- });
63
- var _default = exports.default = /*#__PURE__*/(0, _react.memo)(EntityButtons);
64
- //# sourceMappingURL=EntityButtons.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_buttons","_utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","EntityButtons","entity","labels","testID","buttons","useMemo","label","visitWebsite","url","website","termsAndServices","termsUrl","privacyPolicy","privacyUrl","filter","btn","Boolean","openURL","useCallback","Linking","catch","reportException","createElement","View","style","styles","map","testIdSuffix","Button","key","title","onPress","urlButton","concatTestID","type","ButtonType","SmallTech","StyleSheet","create","paddingBottom","paddingHorizontal","borderRadius","borderWidth","marginTop","_default","exports","memo"],"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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAA4D,SAAAI,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,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,I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use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- var _nerdView = require("../../ui-components/nerd-view");
10
- var _nerdModeScreen = require("../../ui-components/screens/nerd-mode-screen");
11
- var _array = require("../../utils/array");
12
- 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); }
13
- 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; }
14
- 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); }
15
- const EntityAttributes = ({
16
- certificate,
17
- did,
18
- trustEntity,
19
- trusted,
20
- labels,
21
- entityType,
22
- testID,
23
- onCopyToClipboard
24
- }) => {
25
- var _did$split;
26
- const didSections = (_did$split = did === null || did === void 0 ? void 0 : did.split(':')) !== null && _did$split !== void 0 ? _did$split : [];
27
- const identifier = didSections.pop();
28
- const didMethod = didSections.length ? didSections.join(':') + ':' : '';
29
- const attributes = [...(0, _array.addElementIf)(trusted, {
30
- attributeKey: labels.trustRegistry,
31
- highlightedText: trustEntity === null || trustEntity === void 0 ? void 0 : trustEntity.trustAnchor.name,
32
- testID: 'trustRegistry'
33
- }), ...(0, _array.addElementIf)(Boolean(did), {
34
- attributeKey: entityType === _nerdModeScreen.EntityType.CredentialEntity ? labels.issuerIdentifier : labels.entityIdentifier,
35
- attributeText: identifier,
36
- canBeCopied: true,
37
- highlightedText: didMethod,
38
- testID: 'issuerDID'
39
- }), ...(0, _array.addElementIf)(Boolean(certificate), {
40
- attributeKey: entityType === _nerdModeScreen.EntityType.CredentialEntity ? labels.issuerIdentifier : labels.entityIdentifier,
41
- attributeText: certificate,
42
- canBeCopied: true,
43
- testID: 'issuerCertificate'
44
- }), ...(0, _array.addElementIf)(trusted && Boolean(trustEntity === null || trustEntity === void 0 ? void 0 : trustEntity.role), {
45
- attributeKey: labels.role,
46
- highlightedText: trustEntity === null || trustEntity === void 0 ? void 0 : trustEntity.role,
47
- testID: 'role'
48
- })];
49
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
50
- style: styles.wrapper
51
- }, attributes.map(attribute => /*#__PURE__*/_react.default.createElement(_nerdView.NerdModeItem, _extends({
52
- key: attribute.attributeKey
53
- }, attribute, {
54
- labels: labels,
55
- onCopyToClipboard: onCopyToClipboard,
56
- testID: testID
57
- }))));
58
- };
59
- const styles = _reactNative.StyleSheet.create({
60
- wrapper: {
61
- marginBottom: 20
62
- }
63
- });
64
- var _default = exports.default = /*#__PURE__*/(0, _react.memo)(EntityAttributes);
65
- //# sourceMappingURL=entity-attributes.js.map
@@ -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>\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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,OAAA;AACA,IAAAS,cAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAA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AC,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\nexport default EntityDetails;\n"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAIA,IAAAG,cAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAAqE,SAAAI,uBAAAI,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,SAAAN,wBAAAM,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,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- });
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,147 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
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,GAAAC,OAAA,CAAAD,6BAAA,GAAG,qBAAqB;AAC3D,MAAME,oCAAoC,GAAAD,OAAA,CAAAC,oCAAA,GAAG,4BAA4B;AAEzE,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACxC,MAAMC,UAAU,GAAG,IAAAC,qBAAa,EAAC,CAAC;EAElC,OAAO,IAAAC,kBAAW,EAChB,OAAOC,IAAa,EAAEC,kBAA0B,KAAK;IACnD,MAAMC,YAAY,GAAG,MAAMF,IAAI,CAACG,gBAAgB,CAAC;MAC/CC,IAAI,EAAE,CAAC;MACPC,QAAQ,EAAE;IACZ,CAAC,CAAC;IACF,IAAIH,YAAY,CAACI,MAAM,CAACC,MAAM,GAAG,CAAC,EAAE;MAClC;IACF;IACA,MAAMC,QAAQ,GAAG,MAAMX,UAAU,CAACY,GAAG,CAAoBR,kBAAkB,CAAC;IAC5E,IAAI,CAACO,QAAQ,CAACE,EAAE,IAAI,CAACF,QAAQ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AE;MAAA,IAAA4C,sBAAA;MAChB,MAAM1C,gBAAgB,GAAG,MAAMzB,IAAI,CAAC6D,aAAa,CAACtC,YAAY,CAAC;MAC/DoC,WAAW,GAAGlC,gBAAgB,aAAhBA,gBAAgB,gBAAA0C,sBAAA,GAAhB1C,gBAAgB,CAAE0B,GAAG,cAAAgB,sBAAA,uBAArBA,sBAAA,CAAuBhC,EAAE;IACzC;IAEA,OAAOnC,IAAI,CAACoE,uBAAuB,CAAC;MAClC,GAAGX,OAAO;MACVC,KAAK,EAAEC;IACT,CAAC,CAAC;EACJ,CAAC,EACD;IACEI,SAAS,EAAE,MAAAA,CAAA,KAAY;MACrB,MAAMT,WAAW,CAACU,iBAAiB,CAACrE,oCAAoC,CAAC;MACzE,MAAM2D,WAAW,CAACU,iBAAiB,CAACC,+BAAsB,CAAC;IAC7D;EACF,CACF,CAAC;AACH,CAAC;AAACvE,OAAA,CAAAwE,0BAAA,GAAAA,0BAAA;AAAA,IAEUjD,mBAAmB,GAAAvB,OAAA,CAAAuB,mBAAA,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