@novasamatech/host-papp-react-ui 0.8.0-1 → 0.8.0

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.
@@ -1,36 +1,33 @@
1
- import { c as y } from "react/compiler-runtime";
2
- import { toHex as g } from "@polkadot-api/utils";
3
- import { useState as a, useEffect as x } from "react";
4
- import { usePapp as I } from "../flow/PappProvider.js";
5
- function h(t) {
6
- const e = y(10), o = I(), [u, i] = a(!1), [m, c] = a(null);
7
- let l;
8
- e[0] !== t ? (l = t ? g(t) : null, e[0] = t, e[1] = l) : l = e[1];
9
- const n = l;
10
- let f;
11
- e[2] !== n || e[3] !== o ? (f = () => {
12
- if (!n) {
13
- i(!1);
1
+ import { toHex as p } from "@polkadot-api/utils";
2
+ import { useState as o, useRef as a, useEffect as d } from "react";
3
+ import { usePapp as m } from "../flow/PappProvider.js";
4
+ function y(t) {
5
+ const u = m(), [i, e] = o(!1), [c, n] = o(null), s = a(u);
6
+ s.current = u;
7
+ const r = t ? p(t) : null;
8
+ return d(() => {
9
+ if (n(null), !r) {
10
+ e(!1);
14
11
  return;
15
12
  }
16
- let p = !0;
17
- return i(!0), o.identity.getIdentity(n).match((d) => {
18
- p && (c(d), i(!1));
19
- }, () => {
20
- p && (c(null), i(!1));
21
- }), () => {
22
- i(!1), p = !1;
13
+ e(!0);
14
+ const f = s.current.identity.watchIdentity(r).subscribe({
15
+ next: (l) => {
16
+ n(l), e(!1);
17
+ },
18
+ error: () => {
19
+ n(null), e(!1);
20
+ }
21
+ });
22
+ return () => {
23
+ f.unsubscribe();
23
24
  };
24
- }, e[2] = n, e[3] = o, e[4] = f) : f = e[4];
25
- let s;
26
- e[5] !== n ? (s = [n], e[5] = n, e[6] = s) : s = e[6], x(f, s);
27
- let r;
28
- return e[7] !== m || e[8] !== u ? (r = [m, u], e[7] = m, e[8] = u, e[9] = r) : r = e[9], r;
25
+ }, [r]), [c, i];
29
26
  }
30
- function H(t) {
31
- return h(t ? t.remoteAccount.accountId : null);
27
+ function g(t) {
28
+ return y(t ? t.remoteAccount.accountId : null);
32
29
  }
33
30
  export {
34
- h as useIdentity,
35
- H as useSessionIdentity
31
+ y as useIdentity,
32
+ g as useSessionIdentity
36
33
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@novasamatech/host-papp-react-ui",
3
3
  "type": "module",
4
- "version": "0.8.0-1",
4
+ "version": "0.8.0",
5
5
  "description": "Polkadot app UI Flow",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -25,13 +25,16 @@
25
25
  "dist",
26
26
  "README.md"
27
27
  ],
28
+ "scripts": {
29
+ "build": "vite build"
30
+ },
28
31
  "peerDependencies": {
29
32
  "react": ">=18",
30
33
  "react-dom": ">=18"
31
34
  },
32
35
  "dependencies": {
33
- "@novasamatech/host-papp": "0.8.0-1",
34
- "@novasamatech/statement-store": "0.8.0-1",
36
+ "@novasamatech/host-papp": "0.8.0",
37
+ "@novasamatech/statement-store": "0.8.0",
35
38
  "@polkadot-api/utils": "^0.4.0",
36
39
  "@radix-ui/react-dialog": "1.1.15",
37
40
  "@radix-ui/react-popover": "1.1.15",