@novasamatech/host-papp-ui 0.5.0-0 → 0.5.0-2
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,21 +1,34 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { memo as
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as r } from "react/jsx-runtime";
|
|
2
|
+
import { memo as l } from "react";
|
|
3
3
|
import { Modal as a } from "../ui/Modal.js";
|
|
4
|
-
import { QrCode as
|
|
4
|
+
import { QrCode as d } from "../ui/QrCode.js";
|
|
5
5
|
import { useSignInFlow as p } from "./SignInStateProvider.js";
|
|
6
|
-
const u =
|
|
7
|
-
const n = p(),
|
|
8
|
-
return /* @__PURE__ */ e(a, { isOpen:
|
|
9
|
-
|
|
10
|
-
}, width: 300, children: /* @__PURE__ */
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
const t = ({ children: n }) => /* @__PURE__ */ e("span", { style: { fontSize: "16px", textAlign: "center", flexShrink: 0, color: "white", fontFamily: "sans-serif" }, children: n }), u = l(() => {
|
|
7
|
+
const n = p(), o = n.signInStatus.step !== "none" && n.initiatedByUser;
|
|
8
|
+
return /* @__PURE__ */ e(a, { isOpen: o, onOpenChange: (s) => {
|
|
9
|
+
s || n.abort();
|
|
10
|
+
}, width: 300, children: /* @__PURE__ */ i(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
style: {
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "column",
|
|
16
|
+
gap: 16,
|
|
17
|
+
paddingInline: 8,
|
|
18
|
+
paddingBlock: 16,
|
|
19
|
+
alignItems: "center"
|
|
20
|
+
},
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ e(t, { children: "Sign in Polkadot app" }),
|
|
23
|
+
n.signInStatus.step === "pairing" && /* @__PURE__ */ e(d, { value: n.signInStatus.payload, size: 270 }),
|
|
24
|
+
n.signInStatus.step === "finished" && /* @__PURE__ */ e(r, { children: /* @__PURE__ */ i(t, { children: [
|
|
25
|
+
"Welcome back, ",
|
|
26
|
+
n.identity?.liteUsername ?? "User",
|
|
27
|
+
"!"
|
|
28
|
+
] }) })
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
) });
|
|
19
32
|
});
|
|
20
33
|
export {
|
|
21
34
|
u as PairingModal
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { usePapp as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as I } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as p, useContext as h, useState as s, useSyncExternalStore as m, useEffect as y, useCallback as x } from "react";
|
|
3
|
+
import { usePapp as C } from "./PappProvider.js";
|
|
4
|
+
const a = p({
|
|
5
5
|
identity: null,
|
|
6
6
|
signInStatus: { step: "none" },
|
|
7
7
|
pending: !1,
|
|
8
|
+
initiatedByUser: !1,
|
|
8
9
|
signIn: () => Promise.resolve(null),
|
|
9
10
|
abort() {
|
|
10
11
|
}
|
|
11
|
-
}),
|
|
12
|
-
const [
|
|
13
|
-
|
|
14
|
-
let
|
|
15
|
-
return
|
|
16
|
-
|
|
12
|
+
}), U = () => h(a), B = ({ children: i }) => {
|
|
13
|
+
const [o, n] = s(!1), [u, l] = s(!1), [g, r] = s(null), t = C(), c = m(t.auth.onSignInStatusChange, t.auth.getSignInStatus);
|
|
14
|
+
y(() => {
|
|
15
|
+
let e = !0;
|
|
16
|
+
return n(!0), t.auth.getCurrentUser().then((d) => {
|
|
17
|
+
e && (r(d), n(!1));
|
|
17
18
|
}), () => {
|
|
18
|
-
|
|
19
|
+
e = !1;
|
|
19
20
|
};
|
|
20
21
|
}, [t]);
|
|
21
|
-
const
|
|
22
|
-
pending:
|
|
23
|
-
signInStatus:
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const f = x(() => (n(!0), l(!0), t.auth.signIn().then((e) => (r(e), e)).finally(() => n(!1))), [t]), S = {
|
|
23
|
+
pending: o,
|
|
24
|
+
signInStatus: c,
|
|
25
|
+
initiatedByUser: u,
|
|
26
|
+
identity: g,
|
|
27
|
+
signIn: f,
|
|
26
28
|
abort: t.auth.abortSignIn
|
|
27
29
|
};
|
|
28
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ I(a.Provider, { value: S, children: i });
|
|
29
31
|
};
|
|
30
32
|
export {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
B as SignInStateProvider,
|
|
34
|
+
U as useSignInFlow
|
|
33
35
|
};
|
package/dist/ui/QrCode.js
CHANGED
|
@@ -9,7 +9,7 @@ const C = Q, M = S(({ value: g, size: A }) => {
|
|
|
9
9
|
shape: "square",
|
|
10
10
|
width: A,
|
|
11
11
|
height: A,
|
|
12
|
-
margin:
|
|
12
|
+
margin: 0,
|
|
13
13
|
image: `data:image/png;base64,${J}`,
|
|
14
14
|
imageOptions: {
|
|
15
15
|
hideBackgroundDots: !0,
|
|
@@ -17,7 +17,7 @@ const C = Q, M = S(({ value: g, size: A }) => {
|
|
|
17
17
|
margin: 4
|
|
18
18
|
},
|
|
19
19
|
dotsOptions: {
|
|
20
|
-
type: "
|
|
20
|
+
type: "square",
|
|
21
21
|
color: "#ffffff"
|
|
22
22
|
},
|
|
23
23
|
backgroundOptions: {
|
|
@@ -32,7 +32,7 @@ const C = Q, M = S(({ value: g, size: A }) => {
|
|
|
32
32
|
color: "#ffffff"
|
|
33
33
|
},
|
|
34
34
|
qrOptions: {
|
|
35
|
-
errorCorrectionLevel: "
|
|
35
|
+
errorCorrectionLevel: "H"
|
|
36
36
|
}
|
|
37
37
|
}), [A]);
|
|
38
38
|
return E(() => (e && o.append(e), () => {
|