{"_id":"@akashaorg/ui-core-hooks","_rev":"7-a8eebb7eb9619b6934834d9fd830960b","name":"@akashaorg/ui-core-hooks","dist-tags":{"latest":"0.1.8"},"versions":{"0.1.2":{"name":"@akashaorg/ui-core-hooks","version":"0.1.2","author":{"url":"https://akasha.org/","name":"AKASHA Foundation","email":"hello@akasha.org"},"license":"Apache-2.0","_id":"@akashaorg/ui-core-hooks@0.1.2","maintainers":[{"name":"mariusdarila","email":"marius.darila@akasha.world"},{"name":"severs","email":"sever.abibula@akasha.world"},{"name":"valicotea","email":"valentin.cotea@akasha.world"},{"name":"josenriagu","email":"josemaria.nriagu@akasha.world"}],"homepage":"https://github.com/AKASHAorg/akasha-core#readme","bugs":{"url":"https://github.com/AKASHAorg/akasha-core/issues"},"dist":{"shasum":"e470eefe098a1da22340367fe5b8a5435ddb9c54","tarball":"https://registry.npmjs.org/@akashaorg/ui-core-hooks/-/ui-core-hooks-0.1.2.tgz","fileCount":116,"integrity":"sha512-D5sqadQR1+Cp43swshZQR+I8AoS0eyCCePxRumS/GZE2KFjzqnQLjjUd6CvfLr1aqBCTKP3eOgRfPpXuMQ0XRQ==","signatures":[{"sig":"MEQCIAqFaNyp9wJQ/n6yeFTr3BBYInlP1IN3K5yFCXAoR4YyAiB6IE4p7TSr0gayTNXcHNbA6vfBJr96svA+gC94c4e/2g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@akashaorg%2fui-core-hooks@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":430719},"main":"lib/index.js","type":"module","types":"./lib/index.d.ts","gitHead":"cc40686a4147e7bddd931fb4e8d7c5e965495487","_npmUser":{"name":"mariusdarila","email":"marius.darila@akasha.world"},"repository":{"url":"git+https://github.com/AKASHAorg/akasha-core.git","type":"git"},"_npmVersion":"10.8.2","description":"Reusable hooks for akasha-core","directories":{"lib":"lib"},"_nodeVersion":"20.18.1","dependencies":{"rxjs":"7.8.1","immer":"9.0.21","jotai":"2.8.0","graphql":"16.8.1","jotai-immer":"0.3.0","@apollo/client":"3.11.8"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/ui-core-hooks_0.1.2_1737027986398_0.22151701630853138","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@akashaorg/ui-core-hooks","version":"0.1.3","author":{"url":"https://akasha.org/","name":"AKASHA Foundation","email":"hello@akasha.org"},"license":"Apache-2.0","_id":"@akashaorg/ui-core-hooks@0.1.3","maintainers":[{"name":"mariusdarila","email":"marius.darila@akasha.world"},{"name":"severs","email":"sever.abibula@akasha.world"},{"name":"valicotea","email":"valentin.cotea@akasha.world"},{"name":"josenriagu","email":"josemaria.nriagu@akasha.world"}],"homepage":"https://github.com/AKASHAorg/akasha-core#readme","bugs":{"url":"https://github.com/AKASHAorg/akasha-core/issues"},"dist":{"shasum":"ed87f57531d074842947328127c30a8afede7d99","tarball":"https://registry.npmjs.org/@akashaorg/ui-core-hooks/-/ui-core-hooks-0.1.3.tgz","fileCount":116,"integrity":"sha512-nAymmbiXBSrTgQH1QaHmZ0Ldswc65biqfzY+b6FjlIxW2ibb58z29zTjbWSKHhzuKELWx832CQzLrpSgMxIyhA==","signatures":[{"sig":"MEYCIQDlFaF81T7/qW6NuobEKoIPGJtHzGPpSx2Q+JiLVw+nNAIhAMB0pLicJSkT/LRMf+uWLovw8F756v9obFrwP31iwER8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@akashaorg%2fui-core-hooks@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":430719},"main":"lib/index.js","type":"module","types":"./lib/index.d.ts","gitHead":"72d124e8480b5f0441fc2ca73b1e5ff5092260d8","_npmUser":{"name":"mariusdarila","email":"marius.darila@akasha.world"},"repository":{"url":"git+https://github.com/AKASHAorg/akasha-core.git","type":"git"},"_npmVersion":"10.8.2","description":"Reusable hooks for akasha-core","directories":{"lib":"lib"},"_nodeVersion":"20.18.1","dependencies":{"rxjs":"7.8.1","immer":"9.0.21","jotai":"2.8.0","graphql":"16.8.1","jotai-immer":"0.3.0","@apollo/client":"3.11.8"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/ui-core-hooks_0.1.3_1737391040078_0.910637794235351","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@akashaorg/ui-core-hooks","version":"0.1.4","author":{"url":"https://akasha.org/","name":"AKASHA Foundation","email":"hello@akasha.org"},"license":"Apache-2.0","_id":"@akashaorg/ui-core-hooks@0.1.4","maintainers":[{"name":"mariusdarila","email":"marius.darila@akasha.world"},{"name":"severs","email":"sever.abibula@akasha.world"},{"name":"valicotea","email":"valentin.cotea@akasha.world"},{"name":"josenriagu","email":"josemaria.nriagu@akasha.world"}],"homepage":"https://github.com/AKASHAorg/akasha-core#readme","bugs":{"url":"https://github.com/AKASHAorg/akasha-core/issues"},"dist":{"shasum":"7cf0137529ead0ef252ebf97078dd21d0e2c4c46","tarball":"https://registry.npmjs.org/@akashaorg/ui-core-hooks/-/ui-core-hooks-0.1.4.tgz","fileCount":116,"integrity":"sha512-kHOO5nVjVAEcZP0MK20ZwMZbHrjgh2/0PebsjWL32LuanZl6uQZ8fEShSCyIydbjww2d112q8IEbMxjp1uryow==","signatures":[{"sig":"MEQCIQDgFAG3v+1XAdlkJsMQwW1T8GfpUgUH6TgdFCQtcY3W6gIfBfn8SEW+dtQmWSq3BKavZRpPvDsFMKw9XPcckidILQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@akashaorg%2fui-core-hooks@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":430719},"main":"lib/index.js","type":"module","types":"./lib/index.d.ts","gitHead":"7091c6e75a98a1ec1df26226b7417ea7b54a8a2c","_npmUser":{"name":"mariusdarila","email":"marius.darila@akasha.world"},"repository":{"url":"git+https://github.com/AKASHAorg/akasha-core.git","type":"git"},"_npmVersion":"10.8.2","description":"Reusable hooks for akasha-core","directories":{"lib":"lib"},"_nodeVersion":"20.18.1","dependencies":{"rxjs":"7.8.1","immer":"9.0.21","jotai":"2.8.0","graphql":"16.8.1","jotai-immer":"0.3.0","@apollo/client":"3.11.8"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/ui-core-hooks_0.1.4_1737564136506_0.6667323597463011","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@akashaorg/ui-core-hooks","version":"0.1.5","author":{"url":"https://akasha.org/","name":"AKASHA Foundation","email":"hello@akasha.org"},"license":"Apache-2.0","_id":"@akashaorg/ui-core-hooks@0.1.5","maintainers":[{"name":"mariusdarila","email":"marius.darila@akasha.world"},{"name":"severs","email":"sever.abibula@akasha.world"},{"name":"valicotea","email":"valentin.cotea@akasha.world"},{"name":"josenriagu","email":"josemaria.nriagu@akasha.world"}],"homepage":"https://github.com/AKASHAorg/akasha-core#readme","bugs":{"url":"https://github.com/AKASHAorg/akasha-core/issues"},"dist":{"shasum":"409d699a5b6be42e709990e631e4c0b0e5c35d08","tarball":"https://registry.npmjs.org/@akashaorg/ui-core-hooks/-/ui-core-hooks-0.1.5.tgz","fileCount":116,"integrity":"sha512-O1gCC+BY1mxKjzXvBNoz1fpH+DZOKpmChsn9NYz2+AqN5j2qWuQ8zYCdFPONDjTNfbAXfHXTjVY1gMW+q8XMCw==","signatures":[{"sig":"MEQCIHj9w8uTSNC0MTUMTP/YT9O4NB5NTns9Hx3C138KnFSgAiBSAuRQtcrIzBKMgS5ps1jbqGFQPAUovaaANDnokrqXuw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@akashaorg%2fui-core-hooks@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":430719},"main":"lib/index.js","type":"module","types":"./lib/index.d.ts","gitHead":"5ab3cf5ae237db0265536c29f0c3e17fafddfe41","_npmUser":{"name":"mariusdarila","email":"marius.darila@akasha.world"},"repository":{"url":"git+https://github.com/AKASHAorg/akasha-core.git","type":"git"},"_npmVersion":"10.8.2","description":"Reusable hooks for akasha-core","directories":{"lib":"lib"},"_nodeVersion":"20.18.1","dependencies":{"rxjs":"7.8.1","immer":"9.0.21","jotai":"2.8.0","graphql":"16.8.1","jotai-immer":"0.3.0","@apollo/client":"3.11.8"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/ui-core-hooks_0.1.5_1737576182624_0.19635762316366545","host":"s3://npm-registry-packages-npm-production"}},"0.1.6":{"name":"@akashaorg/ui-core-hooks","version":"0.1.6","author":{"url":"https://akasha.org/","name":"AKASHA Foundation","email":"hello@akasha.org"},"license":"Apache-2.0","_id":"@akashaorg/ui-core-hooks@0.1.6","maintainers":[{"name":"mariusdarila","email":"marius.darila@akasha.world"},{"name":"severs","email":"sever.abibula@akasha.world"},{"name":"valicotea","email":"valentin.cotea@akasha.world"},{"name":"josenriagu","email":"josemaria.nriagu@akasha.world"}],"homepage":"https://github.com/AKASHAorg/akasha-core#readme","bugs":{"url":"https://github.com/AKASHAorg/akasha-core/issues"},"dist":{"shasum":"5197100dc135d91221d6cde744b662859a8c65d7","tarball":"https://registry.npmjs.org/@akashaorg/ui-core-hooks/-/ui-core-hooks-0.1.6.tgz","fileCount":114,"integrity":"sha512-CcwO00wvq9ybsERMTZbnmBuu6hpAVA4uqRe3fO8AzbAB45JIAKiB76SHAQIaGL6x/qTU2JTfkd8RV8XwHFTJjA==","signatures":[{"sig":"MEUCIGbBD0G67AELVW3L5jhjakRppldoJOmFnnn3yCpjqTNmAiEAzF4WzzxSj8bmLkCAmaSgm/WhC4bSdS4xWxmPy783UB8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@akashaorg%2fui-core-hooks@0.1.6","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":491448},"main":"lib/index.js","type":"module","types":"./lib/index.d.ts","gitHead":"1bd1bddba52d4084d83a43738612dcda3ad95d64","_npmUser":{"name":"mariusdarila","email":"marius.darila@akasha.world"},"repository":{"url":"git+https://github.com/AKASHAorg/akasha-core.git","type":"git"},"_npmVersion":"10.8.2","description":"Reusable hooks for akasha-core","directories":{"lib":"lib"},"_nodeVersion":"20.18.2","dependencies":{"rxjs":"7.8.1","immer":"9.0.21","jotai":"2.8.0","graphql":"16.8.1","jotai-immer":"0.3.0","@apollo/client":"3.11.8"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/ui-core-hooks_0.1.6_1739344939435_0.3934689798946778","host":"s3://npm-registry-packages-npm-production"}},"0.1.7":{"name":"@akashaorg/ui-core-hooks","version":"0.1.7","author":{"url":"https://akasha.org/","name":"AKASHA Foundation","email":"hello@akasha.org"},"license":"Apache-2.0","_id":"@akashaorg/ui-core-hooks@0.1.7","maintainers":[{"name":"mariusdarila","email":"marius.darila@akasha.world"},{"name":"severs","email":"sever.abibula@akasha.world"},{"name":"valicotea","email":"valentin.cotea@akasha.world"},{"name":"josenriagu","email":"josemaria.nriagu@akasha.world"}],"homepage":"https://github.com/AKASHAorg/akasha-core#readme","bugs":{"url":"https://github.com/AKASHAorg/akasha-core/issues"},"dist":{"shasum":"60fa169f2c6daee83533e2b3c0254bb7ab0d19ca","tarball":"https://registry.npmjs.org/@akashaorg/ui-core-hooks/-/ui-core-hooks-0.1.7.tgz","fileCount":124,"integrity":"sha512-ZbREMH6+Zn+KF3DJIA1xSKPPoT6474eVy4PSkG6+s4svRHr2IOG00SX8UUpyIoiIvG8Yp2trBvxppcAc0rEQPg==","signatures":[{"sig":"MEQCICqRe4JBfiKzlQuIeSWhXVRe3hMo1RXIOuP7BUyBe+dgAiBPnRPcZYTz7w63bdhor7BV/uV4yewBPsoLXXlp12tfwA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@akashaorg%2fui-core-hooks@0.1.7","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":521389},"main":"lib/index.js","type":"module","types":"./lib/index.d.ts","gitHead":"ecac8e309380d28a3961539ac57a84298b30c918","_npmUser":{"name":"mariusdarila","email":"marius.darila@akasha.world"},"repository":{"url":"git+https://github.com/AKASHAorg/akasha-core.git","type":"git"},"_npmVersion":"10.8.2","description":"Reusable hooks for akasha-core","directories":{"lib":"lib"},"_nodeVersion":"20.18.3","dependencies":{"rxjs":"7.8.1","immer":"9.0.21","jotai":"2.8.0","graphql":"16.8.1","jotai-immer":"0.3.0","@apollo/client":"3.11.8"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/ui-core-hooks_0.1.7_1741735222966_0.4034896804017616","host":"s3://npm-registry-packages-npm-production"}},"0.1.8":{"name":"@akashaorg/ui-core-hooks","version":"0.1.8","type":"module","description":"Reusable hooks for akasha-core","author":{"name":"AKASHA Foundation","email":"hello@akasha.org","url":"https://akasha.org/"},"license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/AKASHAorg/akasha-core.git"},"main":"lib/index.js","directories":{"lib":"lib"},"dependencies":{"@apollo/client":"3.11.8","graphql":"16.8.1","immer":"9.0.21","jotai":"2.8.0","jotai-immer":"0.3.0","rxjs":"7.8.1"},"_id":"@akashaorg/ui-core-hooks@0.1.8","gitHead":"35834d8601f8f27521d4298a4482391e53a24278","types":"./lib/index.d.ts","bugs":{"url":"https://github.com/AKASHAorg/akasha-core/issues"},"homepage":"https://github.com/AKASHAorg/akasha-core#readme","_nodeVersion":"20.19.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-vnoePTPtjPqAkgju3qiGQ2YGHfWijLO1pIiFEnjJqANkLWPSECAVHF4EowQUaFLxgnFdTiQOlwsUg/IOdZWHYA==","shasum":"60d77bf5eb06defb26a0bfb16de236e7fcb3bee2","tarball":"https://registry.npmjs.org/@akashaorg/ui-core-hooks/-/ui-core-hooks-0.1.8.tgz","fileCount":126,"unpackedSize":523937,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@akashaorg%2fui-core-hooks@0.1.8","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFVzoQp8z7FLJAdZqrRbV4K5hXeEBbdbcqNUHLPydttWAiAgdgj/wzJdIJMb5EqAHPK4fx8TBeIcSByB5cEsrdI3PA=="}]},"_npmUser":{"name":"mariusdarila","email":"marius.darila@akasha.world"},"maintainers":[{"name":"mariusdarila","email":"marius.darila@akasha.world"},{"name":"severs","email":"sever.abibula@akasha.world"},{"name":"valicotea","email":"valentin.cotea@akasha.world"},{"name":"josenriagu","email":"josemaria.nriagu@akasha.world"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ui-core-hooks_0.1.8_1742481344191_0.595746797041383"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-16T11:46:26.321Z","modified":"2025-03-20T14:35:44.887Z","0.1.2":"2025-01-16T11:46:26.578Z","0.1.3":"2025-01-20T16:37:20.356Z","0.1.4":"2025-01-22T16:42:16.685Z","0.1.5":"2025-01-22T20:03:02.818Z","0.1.6":"2025-02-12T07:22:19.604Z","0.1.7":"2025-03-11T23:20:23.207Z","0.1.8":"2025-03-20T14:35:44.361Z"},"bugs":{"url":"https://github.com/AKASHAorg/akasha-core/issues"},"author":{"name":"AKASHA Foundation","email":"hello@akasha.org","url":"https://akasha.org/"},"license":"Apache-2.0","homepage":"https://github.com/AKASHAorg/akasha-core#readme","repository":{"type":"git","url":"git+https://github.com/AKASHAorg/akasha-core.git"},"description":"Reusable hooks for akasha-core","maintainers":[{"name":"mariusdarila","email":"marius.darila@akasha.world"},{"name":"severs","email":"sever.abibula@akasha.world"},{"name":"valicotea","email":"valentin.cotea@akasha.world"},{"name":"josenriagu","email":"josemaria.nriagu@akasha.world"}],"readme":"# Custom Hooks\n\nThis section provides in-depth information on the custom hooks used in the Akasha Core.\n\n### useRootComponentProps\n\nManage and access props received by the root component.\nThese props may contain the context of the plugins for routing, translation, and extensions.\nIt also exposes some utility functions which may be used across the World.\n\nFor example, the `worldConfig` object can be used to access the configuration info related to the application's World.\nThe `navigateToModal` method helps to load the matching modal from the modal params.\nThe `getCorePlugins` method exposes the main plugins used in Core, such as the routing plugin, which is useful for navigation within an application.\n\n:::info\nThis hook requires that the root component app be wrapped with the accompanying provider.\nThe Akasha Core hooks package exposes a Higher Order Component called `withProviders` that takes care of this, in addition to other providers.\nAlternatively, you can also directly use the `RootComponentPropsProvider` required for the `useRootComponentProps` hook\n:::\n\n**Example usage**\n\n```tsx\nimport { useRootComponentProps, RootComponentPropsProvider } from '@akashaorg/ui-core-hooks';\n\nconst Component = () => {\n  const {\n    baseRouteName,\n    uiEvents,\n    worldConfig,\n    getCorePlugins,\n    getTranslationPlugin,\n    navigateToModal,\n    // ...\n  } = useRootComponentProps();\n\n  // get i18n instance from the translation plugin\n  const i18n = getTranslationPlugin().i18n;\n\n  // handle navigation using the routing from core plugins\n  const handleNavigate = () => {\n    getCorePlugins().routing.navigateTo({\n      appName: 'applicaton namspace',\n      getNavigationUrl: () => {\n        // ...\n      },\n    });\n  };\n};\n\nexport default (\n  <RootComponentPropsProvider>\n    <Component />\n  </RootComponentPropsProvider>\n);\n```\n\n---\n\n### useAkashaStore\n\nSubscribe to changes in the application's authentication state, trigger login and logout actions, and access logged user's profile information\n\n> The useAkashaStore hook provides access to the authentication state and authenticated user profile. It subscribes to AuthenticationStore via React’s useSyncExternalStore, ensuring components update when authentication state changes. The AuthenticationStore manages authentication logic, including login, logout, session state, and authentication state updates.\n\n**Example usage**\n\n```tsx\nimport { useAkashaStore } from '@akashaorg/ui-core-hooks';\n\nconst Component = () => {\n  const {\n    data: {\n      authenticatedDID,\n      isAuthenticating,\n      authenticatedProfile,\n      authenticatedProfileError,\n      authenticationError,\n    },\n  } = useAkashaStore();\n\n  if (!isAuthenticating && !authenticatedDID) {\n    return <div>No Authenticated user found</div>;\n  }\n\n  if (authenticationError || authenticatedProfileError) {\n    return <div>Error authenticating or getting profile data</div>;\n  }\n\n  return (\n    <div>\n      Authenticated profile details:\n      <p>{authenticatedProfile.name}</p>\n      <p>{authenticatedProfile.description}</p>\n    </div>\n  );\n};\n```\n\n---\n\n### useAnalytics\n\nHandle analytics in your applications\n\n> This hook is helpful in managing opt-in analytics functionality in a world.\n\n**Example usage**\n\n```tsx\nimport { AnalyticsCategories } from '@akashaorg/typings/lib/ui';\nimport { useAnalytics } from '@akashaorg/ui-core-hooks';\n\nconst Component = () => {\n  const [analyticsActions] = useAnalytics();\n\n  const subscribed = true;\n\n  // handle navigation using the routing from core plugins\n  const handleTopicSubscription = () => {\n    analyticsActions.trackEvent({\n      category: AnalyticsCategories.FILTER_SEARCH,\n      action: subscribed ? 'Topic Subscribed' : 'Topic Unsubscribed',\n    });\n  };\n};\n```\n\n---\n\n### useConnectWallet\n\nConnect to a user's wallet during user profile authentication\n\n> This hook provides seamless way to connect to a user's web3 wallet during authentication (first time or returning user)\n\n**Example usage**\n\n```tsx\nimport { useConnectWallet } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\n  const connectWalletCall = useConnectWallet();\n\n  useEffect(() => {\n    connectWalletCall.connect(); // trigger the connect method when the component mounts\n  }, [])\n}\n```\n\n---\n\n### useRequiredNetwork\n\nGet the required network details from the SDK.\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an object containing:\n\n- `data` - an object containing required network's details such as name and chainId\n- `isLoading` - loading state of the request\n- `isSuccess` - true, if the request is successfully completed\n- `error` - error object from the request, if any\n\n**Example usage**\n\n```tsx\nimport { useRequiredNetwork } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\n\nconst { data, isLoading, error } = useRequiredNetwork();\n\nconst chainId = data.chainId;\n\nif (isLoading) {\n  return (\n    <div>loading ...</div>\n  )\n};\n\nif (error) {\n  return (\n    <div>An error has occured: {error.message}</div>\n  )\n};\n\nreturn (\n  <div>\n    {/** do something with `chainId`*/}\n  </div>\n)\n```\n\n---\n\n### useNetworkChangeListener\n\nListen for changes in logged user provider's current network.\nIt can be used in conjunction with [useRequiredNetwork](#userequirednetwork) to determine when to prompt user to switch back to the correct network.\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an array containing:\n\n- `currentNetwork` - an object containing details of provider's current network\n- `unsubscribe` - an utility function to unsubscribe from globalChannel\n\n**Example usage**\n\n```tsx\nimport { useNetworkChangeListener, useRequiredNetwork } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\n\nconst [ changedNetwork, changedNetworkUnsubscribe ] = useNetworkChangeListener();\nconst requiredNetwork = useRequiredNetwork();\n\nif (requiredNetwork.data.chainId !== changedNetwork.chainId) {\n  return <div>\n  Hello, please switch back to {requiredNetwork.data.name}\n  </div>\n}\n\nuseEffect(() => {\nreturn () => changedNetworkUnsubscribe(); // unsubscribe from the globalChannel when component unmounts.\n}, [ changedNetwork ])\n\nreturn (\n  <div>\n    {/** do something with `changedNetwork`*/}\n  </div>\n)\n```\n\n---\n\n### useLegalDoc\n\nRetrieve legal docs stored on IPFS\n\n#### Required variables\n\n- docName: `string` - the name of doc to be retrieved\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an object containing:\n\n- `data` - an object containing fetchd legal doc\n- `isLoading` - loading state of the request\n- `error` - error object from the request, if any\n- `isFetched` - boolean value that checks if the returned data is defined\n\n**Example usage**\n\n```tsx\nimport { useLegalDoc } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\nconst { data, isLoading, error, isFetched } = useLegalDoc();\n\nif (isLoading) return <div>loading ...</div>;\n\nif (error) return <div>An error has occured: {error.message}</div>;\n\nreturn (\n  <div>\n  {\n    isFetched ? <div>\n    {/** do something with the returned `data` */}\n    </div>\n  }\n  </div>\n)\n}\n```\n\n---\n\n### usePlaformHealthCheck\n\nCheck the overall status of the Akasha World Platform and its acssociated services. This hook plays a crucial role in informing the user of any downtime when maintenance mode is triggered or enabled.\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an object containing:\n\n- `data` - an object containing the `statusCode` and `success` values of the request.\n- `isLoading` - loading state of the request\n\n**Example usage**\n\n```tsx\nimport { usePlaformHealthCheck } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\nconst { data, isLoading} = usePlaformHealthCheck();\n\nif (isLoading) return <div>loading ...</div>;\n\nreturn (\n  <div>\n    platform status: { statusCode }\n  </div>\n)\n}\n```\n\n---\n\n### useDismissedCard\n\nManage information cards displayed in the sidebar or inside the apps which users can dismiss by clicking the close button.\n\n#### Required variables\n\n- id: `string` - unique id of the information card\n\n#### Optional variables\n\n- statusStorage: `IStorage` - type of local storage\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an array containing:\n\n- `dismissed` - boolean value indicating whether te card has been dismissed or not\n- `dismissCard` - an utility function to dismiss cards\n\n**Example usage**\n\n```tsx\nimport { useDismissedCard } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\nconst profileDID = 'profile DID'\nconst [ dismissed, dismissCard ] = useDismissedCard('@akashaorg/ui-widget-layout_version-info-card');\n\nreturn (\n  <div>\n    {\n      !dismissed && <div onClick={dismissCard}>information card</div>\n    }\n  </div>\n)\n}\n```\n\n---\n\n### useValidDid\n\nCheck the validity of an account's Decentralized IDentity (DID) address using the SDK's services.\n\n#### Required variables\n\n- profileId: `string` - DID of the profile to be checked for validity\n\n#### Optional variables\n\n- enabled: `boolean` - indicate when to run the query\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an object containing:\n\n- `validDid` - boolean value indicating whether the passed DID is valid or not\n- `isLoading` - loading state of the request\n- `isEthAddress` - boolean value indicating whether the valid DID is also a valid ETH Address\n\n**Example usage**\n\n```tsx\nimport { useValidDid } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\nconst profileDID = 'profile DID'\nconst { validDid, isLoading } = useValidDid(profileDID, true);\n\nif (isLoading) return <div>loading ...</div>;\n\nreturn (\n  <div>\n    {/** do something with `validDid` */}\n  </div>\n)\n}\n```\n\n---\n\n### useAccordion\n\nHandle state of Accordion component especially when systematic control is required in a component containing more than one accordion element.\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an object containing:\n\n- `activeAccordionId` - id of the active accordion\n- `setActiveAccordionId` - useState hook to set the active accordion id\n- `handleAccordionClick` - an utility function to handle acordion click\n\n**Example usage**\n\n```tsx\nimport { useAccordion } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\nconst { activeAccordionId, handleAccordionClick } = useAccordion();\n\nreturn (\n  <Accordion\n  open={elementId === activeAccordionId}\n  handleClick={handleAccordionClick}\n  />\n)\n}\n```\n\n---\n\n### useModalData\n\nHandle data supplied to the modal extension. This hook uses a helper utility method `getModalFromParams` from [useRootComponentProps](#userootcomponentprops). It needs to be called in a modal component so it can have access to the modal params.\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an object containing:\n\n- `modalData` - an object containing important information for rendering a modal, such as name, message, title.\n\n**Example usage**\n\n```tsx\nimport { useModalData } from '@akashaorg/ui-core-hooks',\n\nconst BeamRemoveComponent = () => {\nconst { modalData } = useModalData();\n\nconst beamId = modalData('beamId');\n\nreturn (\n  <div>\n    {/** do something with beamId*/}\n  </div>\n)\n}\n```\n\n---\n\n### useListenForMutationEvents\n\nListen for GraphQL mutation events emitted from the SDk's globalChannel.\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an object containing:\n\n- `data` - response from GraphQL mutation events' subscription to the globalChannel.\n\n**Example usage**\n\n```tsx\nimport { useListenForMutationEvents } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\nconst mutationEvents = useListenForMutationEvents();\n\nuseEffect(() => {\n  if (mutationEvents) {\n    const {\n      messageObj,\n      appid,\n      success,\n      pending\n    } = mutationEvents\n\n    // do something with returned data\n  }\n}, [mutationEvents])\n}\n```\n\n---\n\n### useTheme\n\nCheck or set user's UI theme preference (Light or Dark theme)\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an object containing:\n\n- `theme` - the current theme preference\n- `propagateTheme` - an utility function to update the theme preference\n\n**Example usage**\n\n```tsx\nimport { useTheme } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\nconst { theme, propagateTheme } = useTheme();\n\nconst handleThemeSwitch = (value: string) => () => {\n  propagateTheme(value, true);\n};\n\nreturn (\n  <div>\n    User's current theme is: {theme}\n    <button onClick={handleThemeSwitch('Light Theme')}>\n      Set Theme\n    </button>\n  </div>\n)\n}\n```\n\n---\n\n### useProfileStats\n\nGet a profile's statistics (number of beams, followers, following, interests) from the SDK profile service.\n\n#### Required variables\n\n- profileId: `string` - id of the profile whose stats is to be read\n\n#### Optional variables\n\n- readCache: `boolean` - indicate whether or not to read value from cache\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an object containing:\n\n- `data` - app settings from the SDK\n- `loading` - loading state of the request\n- `error` - error object from the request, if any\n\n**Example usage**\n\n```tsx\nimport { useProfileStats } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\nconst { data, loading, error } = useProfileStats('some profile id');\n\nif (loading) return <div>loading ...</div>;\n\nif (error) return <div>An error has occured: {error.message}</div>;\n\nreturn (\n  <div>\n    {/** do something with `data` */}\n  </div>\n)\n```\n\n---\n\n### useSaveSettings\n\nSave an application's settings using SDK settings service\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an object containing:\n\n- `saveNotificationSettings` - an utility function to save the settings\n- `data` - data from the request\n- `isLoading` - loading state of the request\n- `error` - error object from the request, if any\n\n**Example usage**\n\n```tsx\nimport { useSaveSettings } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\nconst { saveNotificationSettings, data, isLoading, error } = useSaveSettings();\n\nconst handleSaveSettings = () => {\n  saveNotificationSettings(\n    {\n      app: \"@akashaorg/app-notifications\",\n      options: {\n        // ...\n      }\n    },\n    {\n      onComplete: () => {\n        // ...\n      }\n    },\n  );\n}\n\nif (isLoading) return <div>loading ...</div>;\n\nif (error) return <div>An error has occured: {error.message}</div>;\n\nreturn (\n  <div>\n    {/** do something with `data` */}\n  </div>\n)\n}\n```\n\n---\n\n### useGetSettings\n\nGet saved settings for a given application from the SDK\n\n#### Required variables\n\n- app: `string` - name of the application (eg: @akashaorg/app-extensions)\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an object containing:\n\n- `data` - app settings from the SDK\n- `isLoading` - loading state of the request\n- `error` - error object from the request, if any\n\n**Example usage**\n\n```tsx\nimport { useGetSettings } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\nconst { data, isLoading, error } = useGetSettings(\"@akashaorg/app-notifications\");\n\nif (isLoading) return <div>loading ...</div>;\n\nif (error) return <div>An error has occured: {error.message}</div>;\n\nreturn (\n  <div>\n    {/** do something with `data` */}\n  </div>\n)\n}\n```\n\n---\n\n### useNsfwToggling\n\nGet and set user's preference for displaying `Not Safe For Work` (NSFW) contents\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an object containing:\n\n- `showNsfw` - a boolean value indicating user's preference\n- `toggleShowNsfw` - an utility function for toggling user's preference\n\n**Example usage**\n\n```tsx\nimport { useNsfwToggling } from '@akashaorg/ui-core-hooks',\n\nconst Component = () => {\nconst { showNsfw, toggleShowNsfw } = useNsfwToggling();\n\nconst handleToggleNSFW = (value: boolean) => () => {\n  toggleShowNsfw(value);\n};\n\nreturn (\n  <div>\n    Can user currently see nsfw content? {showNsfw}\n    <button onClick={handleToggleNSFW(false)}>\n    Hide Nsfw\n    </button>\n  </div>\n)\n}\n```\n\n---\n\n### useMentions\n\nRetrieve and/or set the mentions associated with a profile\n\n#### Required variables\n\n- authenticatedDID: `string` - id of the authenticated profile\n\n#### Returned data object\n\nWhen the hook has successfully run, it returns an object containing:\n\n- `setMentionQuery` - a useState hook that sets the provided mention(s).\n- `mentions` - a list of mentions object\n- `allFollowing` - a list of the profiles, the logged user is following\n\n**Example usage**\n\n```tsx\nimport { useMentions } from '@akashaorg/ui-core-hooks',\n\nconst Component = ({ authenticatedDID }) => {\nconst { setMentionQuery, mentions } = useMentions(authenticatedDID);\n\nconst handleGetMentions = (query: string) => {\n  setMentionQuery(query);\n};\n\nreturn (\n  <div>\n  {/** do something with `mentions` */}\n  </div>\n)\n}\n```\n","readmeFilename":"README.md"}