@novasamatech/host-papp-react-ui 0.9.4 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/flow/PairingModal.js +74 -112
- package/dist/flow/PairingPopover.js +91 -137
- package/dist/flow/PappProvider.js +12 -20
- package/dist/hooks/authStatus.js +6 -15
- package/dist/providers/SessionsProvider.js +15 -22
- package/dist/providers/TranslationProvider.js +13 -18
- package/dist/ui/LogoSmall.js +35 -41
- package/dist/ui/Modal.js +22 -36
- package/package.json +6 -6
|
@@ -7,126 +7,88 @@ import { QrCode as a } from "../ui/QrCode.js";
|
|
|
7
7
|
import o from "./Pairing.module.css.js";
|
|
8
8
|
import { Button as s } from "@novasamatech/tr-ui";
|
|
9
9
|
import { memo as c, useEffect as l } from "react";
|
|
10
|
-
import {
|
|
11
|
-
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
12
11
|
//#region src/flow/PairingModal.tsx
|
|
13
|
-
var
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
_.authUIMode === "modal" && v.step === "finished" && _.abortAuthentication();
|
|
23
|
-
}, C = [_, v.step], r[5] = _, r[6] = v.step, r[7] = S, r[8] = C) : (S = r[7], C = r[8]), l(S, C);
|
|
24
|
-
let w;
|
|
25
|
-
r[9] !== p || r[10] !== v.payload || r[11] !== v.step || r[12] !== s ? (w = v.step === "pairing" && /* @__PURE__ */ d(m, {
|
|
26
|
-
theme: s,
|
|
27
|
-
size: p,
|
|
28
|
-
payload: v.payload
|
|
29
|
-
}), r[9] = p, r[10] = v.payload, r[11] = v.step, r[12] = s, r[13] = w) : w = r[13];
|
|
30
|
-
let T;
|
|
31
|
-
r[14] !== v.stage || r[15] !== v.step ? (T = v.step === "pending" && /* @__PURE__ */ d(h, { stage: v.stage }), r[14] = v.stage, r[15] = v.step, r[16] = T) : T = r[16];
|
|
32
|
-
let E;
|
|
33
|
-
r[17] !== v.message || r[18] !== v.step ? (E = v.step === "pairingError" && /* @__PURE__ */ d(g, { message: v.message }), r[17] = v.message, r[18] = v.step, r[19] = E) : E = r[19];
|
|
34
|
-
let D;
|
|
35
|
-
r[20] !== w || r[21] !== T || r[22] !== E ? (D = /* @__PURE__ */ f("div", {
|
|
36
|
-
className: o.container,
|
|
37
|
-
children: [
|
|
38
|
-
w,
|
|
39
|
-
T,
|
|
40
|
-
E
|
|
41
|
-
]
|
|
42
|
-
}), r[20] = w, r[21] = T, r[22] = E, r[23] = D) : D = r[23];
|
|
43
|
-
let O;
|
|
44
|
-
return r[24] !== y || r[25] !== D || r[26] !== x ? (O = /* @__PURE__ */ d(i, {
|
|
45
|
-
open: y,
|
|
46
|
-
onOpenChange: x,
|
|
12
|
+
var f = c(({ theme: e, size: r = 280 } = {}) => {
|
|
13
|
+
let a = t(), { status: s } = n(), c = a.authUIMode === "modal" && s.step !== "none" && s.step !== "finished";
|
|
14
|
+
return l(() => {
|
|
15
|
+
a.authUIMode === "modal" && s.step === "finished" && a.abortAuthentication();
|
|
16
|
+
}, [a, s.step]), /* @__PURE__ */ u(i, {
|
|
17
|
+
open: c,
|
|
18
|
+
onOpenChange: (e) => {
|
|
19
|
+
!e && s.step !== "pending" && a.abortAuthentication();
|
|
20
|
+
},
|
|
47
21
|
width: "fit-content",
|
|
48
|
-
children:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
size: i,
|
|
65
|
-
theme: s
|
|
66
|
-
}), n[4] = r, n[5] = i, n[6] = s, n[7] = g) : g = n[7];
|
|
67
|
-
let _;
|
|
68
|
-
n[8] !== h || n[9] !== g ? (_ = /* @__PURE__ */ d("div", {
|
|
69
|
-
className: h,
|
|
70
|
-
children: g
|
|
71
|
-
}), n[8] = h, n[9] = g, n[10] = _) : _ = n[10];
|
|
72
|
-
let v;
|
|
73
|
-
n[11] === c.pairingDescription ? v = n[12] : (v = /* @__PURE__ */ d("span", {
|
|
74
|
-
className: o.pairingDescription,
|
|
75
|
-
children: c.pairingDescription
|
|
76
|
-
}), n[11] = c.pairingDescription, n[12] = v);
|
|
77
|
-
let y;
|
|
78
|
-
return n[13] !== p || n[14] !== m || n[15] !== _ || n[16] !== v ? (y = /* @__PURE__ */ f("div", {
|
|
22
|
+
children: /* @__PURE__ */ d("div", {
|
|
23
|
+
className: o.container,
|
|
24
|
+
children: [
|
|
25
|
+
s.step === "pairing" && /* @__PURE__ */ u(p, {
|
|
26
|
+
theme: e,
|
|
27
|
+
size: r,
|
|
28
|
+
payload: s.payload
|
|
29
|
+
}),
|
|
30
|
+
s.step === "pending" && /* @__PURE__ */ u(m, { stage: s.stage }),
|
|
31
|
+
s.step === "pairingError" && /* @__PURE__ */ u(h, { message: s.message })
|
|
32
|
+
]
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}), p = ({ payload: t, size: n, theme: r }) => {
|
|
36
|
+
let i = e(), s = r === "dark";
|
|
37
|
+
return /* @__PURE__ */ d("div", {
|
|
79
38
|
className: o.pairingContainer,
|
|
80
39
|
children: [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
40
|
+
/* @__PURE__ */ u("span", {
|
|
41
|
+
className: o.pairingHeader,
|
|
42
|
+
children: i.pairingHeader
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ u("span", {
|
|
45
|
+
className: o.scanCallToAction,
|
|
46
|
+
children: i.pairingScanCallToAction
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ u("div", {
|
|
49
|
+
className: s ? o.qrSurfaceDark : o.qrSurfaceLight,
|
|
50
|
+
children: /* @__PURE__ */ u(a, {
|
|
51
|
+
value: t,
|
|
52
|
+
size: n,
|
|
53
|
+
theme: r
|
|
54
|
+
})
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ u("span", {
|
|
57
|
+
className: o.pairingDescription,
|
|
58
|
+
children: i.pairingDescription
|
|
59
|
+
})
|
|
85
60
|
]
|
|
86
|
-
})
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
|
|
61
|
+
});
|
|
62
|
+
}, m = ({ stage: e }) => /* @__PURE__ */ d("div", {
|
|
63
|
+
className: o.loaderContainer,
|
|
64
|
+
children: [/* @__PURE__ */ u("div", {
|
|
90
65
|
className: o.loaderLogo,
|
|
91
|
-
children: /* @__PURE__ */
|
|
92
|
-
}),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
})]
|
|
100
|
-
}), t[1] = n, t[2] = a), a;
|
|
101
|
-
}, g = (n) => {
|
|
102
|
-
let r = u(13), { message: i } = n, a = t(), c = e(), l;
|
|
103
|
-
r[0] === c.pairingError ? l = r[1] : (l = /* @__PURE__ */ d("span", {
|
|
104
|
-
className: o.errorTitle,
|
|
105
|
-
children: c.pairingError
|
|
106
|
-
}), r[0] = c.pairingError, r[1] = l);
|
|
107
|
-
let p;
|
|
108
|
-
r[2] === i ? p = r[3] : (p = /* @__PURE__ */ d("span", {
|
|
109
|
-
className: o.errorGenericText,
|
|
110
|
-
children: i
|
|
111
|
-
}), r[2] = i, r[3] = p);
|
|
112
|
-
let m;
|
|
113
|
-
r[4] === a ? m = r[5] : (m = () => a.authenticate(), r[4] = a, r[5] = m);
|
|
114
|
-
let h;
|
|
115
|
-
r[6] !== m || r[7] !== c.pairingRetry ? (h = /* @__PURE__ */ d(s, {
|
|
116
|
-
variant: "secondary",
|
|
117
|
-
type: "button",
|
|
118
|
-
onClick: m,
|
|
119
|
-
children: c.pairingRetry
|
|
120
|
-
}), r[6] = m, r[7] = c.pairingRetry, r[8] = h) : h = r[8];
|
|
121
|
-
let g;
|
|
122
|
-
return r[9] !== l || r[10] !== p || r[11] !== h ? (g = /* @__PURE__ */ f("div", {
|
|
66
|
+
children: /* @__PURE__ */ u(r, { size: 100 })
|
|
67
|
+
}), /* @__PURE__ */ u("span", {
|
|
68
|
+
className: o.loaderText,
|
|
69
|
+
children: e
|
|
70
|
+
})]
|
|
71
|
+
}), h = ({ message: n }) => {
|
|
72
|
+
let r = t(), i = e();
|
|
73
|
+
return /* @__PURE__ */ d("div", {
|
|
123
74
|
className: o.errorContainer,
|
|
124
75
|
children: [
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
76
|
+
/* @__PURE__ */ u("span", {
|
|
77
|
+
className: o.errorTitle,
|
|
78
|
+
children: i.pairingError
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ u("span", {
|
|
81
|
+
className: o.errorGenericText,
|
|
82
|
+
children: n
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ u(s, {
|
|
85
|
+
variant: "secondary",
|
|
86
|
+
type: "button",
|
|
87
|
+
onClick: () => r.authenticate(),
|
|
88
|
+
children: i.pairingRetry
|
|
89
|
+
})
|
|
128
90
|
]
|
|
129
|
-
})
|
|
91
|
+
});
|
|
130
92
|
};
|
|
131
93
|
//#endregion
|
|
132
|
-
export {
|
|
94
|
+
export { f as PairingModal };
|
|
@@ -4,155 +4,109 @@ import { useAuthStatus as n } from "../hooks/authStatus.js";
|
|
|
4
4
|
import { LogoSmall as r } from "../ui/LogoSmall.js";
|
|
5
5
|
import { QrCode as i } from "../ui/QrCode.js";
|
|
6
6
|
import a from "./Pairing.module.css.js";
|
|
7
|
-
import { memo as o,
|
|
8
|
-
import { c } from "react/compiler-runtime";
|
|
7
|
+
import { memo as o, useCallback as s, useEffect as c } from "react";
|
|
9
8
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
10
9
|
import * as d from "@radix-ui/react-popover";
|
|
11
10
|
import "@radix-ui/react-popper";
|
|
12
11
|
//#region src/flow/PairingPopover.tsx
|
|
13
|
-
var f = o((e) => {
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
]
|
|
58
|
-
}), r[27] = I, r[28] = L, r[29] = R, r[30] = z) : z = r[30];
|
|
59
|
-
let B;
|
|
60
|
-
r[31] !== f || r[32] !== _ || r[33] !== g || r[34] !== S || r[35] !== P || r[36] !== z || r[37] !== F ? (B = /* @__PURE__ */ l(d.Portal, { children: /* @__PURE__ */ l(d.Content, {
|
|
61
|
-
side: g,
|
|
62
|
-
align: f,
|
|
63
|
-
sideOffset: S,
|
|
64
|
-
alignOffset: _,
|
|
65
|
-
className: a.popoverContent,
|
|
66
|
-
onInteractOutside: F,
|
|
67
|
-
onEscapeKeyDown: P,
|
|
68
|
-
children: z
|
|
69
|
-
}) }), r[31] = f, r[32] = _, r[33] = g, r[34] = S, r[35] = P, r[36] = z, r[37] = F, r[38] = B) : B = r[38];
|
|
70
|
-
let V;
|
|
71
|
-
return r[39] !== E || r[40] !== B || r[41] !== N || r[42] !== A ? (V = /* @__PURE__ */ u(d.Root, {
|
|
72
|
-
open: E,
|
|
73
|
-
onOpenChange: A,
|
|
74
|
-
children: [N, B]
|
|
75
|
-
}), r[39] = E, r[40] = B, r[41] = N, r[42] = A, r[43] = V) : V = r[43], V;
|
|
76
|
-
}), p = (t) => {
|
|
77
|
-
let n = c(18), { payload: r, size: o, theme: s } = t, d = s === void 0 ? "light" : s, f = e(), p = d === "dark", m;
|
|
78
|
-
n[0] === f.pairingPopoverWelcome ? m = n[1] : (m = /* @__PURE__ */ l("span", {
|
|
79
|
-
className: a.pairingPopoverHeader,
|
|
80
|
-
children: f.pairingPopoverWelcome
|
|
81
|
-
}), n[0] = f.pairingPopoverWelcome, n[1] = m);
|
|
82
|
-
let h = p ? a.qrSurfaceDark : a.qrSurfaceLight, g;
|
|
83
|
-
n[2] !== r || n[3] !== o || n[4] !== d ? (g = /* @__PURE__ */ l(i, {
|
|
84
|
-
value: r,
|
|
85
|
-
size: o,
|
|
86
|
-
theme: d
|
|
87
|
-
}), n[2] = r, n[3] = o, n[4] = d, n[5] = g) : g = n[5];
|
|
88
|
-
let _;
|
|
89
|
-
n[6] !== h || n[7] !== g ? (_ = /* @__PURE__ */ l("div", {
|
|
90
|
-
className: h,
|
|
91
|
-
children: g
|
|
92
|
-
}), n[6] = h, n[7] = g, n[8] = _) : _ = n[8];
|
|
93
|
-
let v;
|
|
94
|
-
n[9] === f.pairingPopoverLoginHeading ? v = n[10] : (v = /* @__PURE__ */ l("span", {
|
|
95
|
-
className: a.scanCallToActionPopover,
|
|
96
|
-
children: f.pairingPopoverLoginHeading
|
|
97
|
-
}), n[9] = f.pairingPopoverLoginHeading, n[10] = v);
|
|
98
|
-
let y;
|
|
99
|
-
n[11] === f.pairingPopoverScanDescription ? y = n[12] : (y = /* @__PURE__ */ l("span", {
|
|
100
|
-
className: a.pairingDescriptionPopover,
|
|
101
|
-
children: f.pairingPopoverScanDescription
|
|
102
|
-
}), n[11] = f.pairingPopoverScanDescription, n[12] = y);
|
|
103
|
-
let b;
|
|
104
|
-
return n[13] !== m || n[14] !== _ || n[15] !== v || n[16] !== y ? (b = /* @__PURE__ */ u("div", {
|
|
12
|
+
var f = o(({ theme: e = "dark", size: r = 240, align: i, side: o, alignOffset: f, sizeOffset: g = 4, children: _ }) => {
|
|
13
|
+
let v = t(), { status: y } = n(), b = typeof process < "u" && process.env?.STORYBOOK === "true", x = v.authUIMode === "popover" && (b || y.step !== "none"), S = s(() => {
|
|
14
|
+
y.step === "none" && v.authenticate("popover");
|
|
15
|
+
}, [v, y.step]), C = s((e) => {
|
|
16
|
+
!e && y.step !== "pending" && v.abortAuthentication();
|
|
17
|
+
}, [v, y.step]);
|
|
18
|
+
return c(() => () => {
|
|
19
|
+
v.abortAuthentication();
|
|
20
|
+
}, [v.abortAuthentication]), /* @__PURE__ */ u(d.Root, {
|
|
21
|
+
open: x,
|
|
22
|
+
onOpenChange: C,
|
|
23
|
+
children: [/* @__PURE__ */ l(d.Trigger, {
|
|
24
|
+
asChild: !0,
|
|
25
|
+
onClick: S,
|
|
26
|
+
children: _
|
|
27
|
+
}), /* @__PURE__ */ l(d.Portal, { children: /* @__PURE__ */ l(d.Content, {
|
|
28
|
+
side: o,
|
|
29
|
+
align: i,
|
|
30
|
+
sideOffset: g,
|
|
31
|
+
alignOffset: f,
|
|
32
|
+
className: a.popoverContent,
|
|
33
|
+
onInteractOutside: (e) => {
|
|
34
|
+
y.step === "pending" && e.preventDefault();
|
|
35
|
+
},
|
|
36
|
+
onEscapeKeyDown: (e) => {
|
|
37
|
+
y.step === "pending" && e.preventDefault();
|
|
38
|
+
},
|
|
39
|
+
children: /* @__PURE__ */ u("div", {
|
|
40
|
+
className: a.popoverContainer,
|
|
41
|
+
children: [
|
|
42
|
+
y.step === "pairing" && /* @__PURE__ */ l(p, {
|
|
43
|
+
theme: e,
|
|
44
|
+
size: r,
|
|
45
|
+
payload: y.payload
|
|
46
|
+
}),
|
|
47
|
+
y.step === "pending" && /* @__PURE__ */ l(m, { stage: y.stage }),
|
|
48
|
+
y.step === "pairingError" && /* @__PURE__ */ l(h, { message: y.message })
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
}) })]
|
|
52
|
+
});
|
|
53
|
+
}), p = ({ payload: t, size: n, theme: r = "light" }) => {
|
|
54
|
+
let o = e(), s = r === "dark";
|
|
55
|
+
return /* @__PURE__ */ u("div", {
|
|
105
56
|
className: a.pairingPopoverContainer,
|
|
106
57
|
children: [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
58
|
+
/* @__PURE__ */ l("span", {
|
|
59
|
+
className: a.pairingPopoverHeader,
|
|
60
|
+
children: o.pairingPopoverWelcome
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ l("div", {
|
|
63
|
+
className: s ? a.qrSurfaceDark : a.qrSurfaceLight,
|
|
64
|
+
children: /* @__PURE__ */ l(i, {
|
|
65
|
+
value: t,
|
|
66
|
+
size: n,
|
|
67
|
+
theme: r
|
|
68
|
+
})
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ l("span", {
|
|
71
|
+
className: a.scanCallToActionPopover,
|
|
72
|
+
children: o.pairingPopoverLoginHeading
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ l("span", {
|
|
75
|
+
className: a.pairingDescriptionPopover,
|
|
76
|
+
children: o.pairingPopoverScanDescription
|
|
77
|
+
})
|
|
111
78
|
]
|
|
112
|
-
})
|
|
113
|
-
}, m = (e) => {
|
|
114
|
-
|
|
115
|
-
|
|
79
|
+
});
|
|
80
|
+
}, m = ({ stage: e }) => /* @__PURE__ */ u("div", {
|
|
81
|
+
className: a.loaderContainerPopover,
|
|
82
|
+
children: [/* @__PURE__ */ l("div", {
|
|
116
83
|
className: a.loaderLogo,
|
|
117
84
|
children: /* @__PURE__ */ l(r, { size: 100 })
|
|
118
|
-
}),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
})]
|
|
126
|
-
}), t[1] = n, t[2] = o), o;
|
|
127
|
-
}, h = (n) => {
|
|
128
|
-
let r = c(13), { message: i } = n, o = t(), s = e(), d;
|
|
129
|
-
r[0] === s.pairingError ? d = r[1] : (d = /* @__PURE__ */ l("span", {
|
|
130
|
-
className: a.errorTitlePopover,
|
|
131
|
-
children: s.pairingError
|
|
132
|
-
}), r[0] = s.pairingError, r[1] = d);
|
|
133
|
-
let f;
|
|
134
|
-
r[2] === i ? f = r[3] : (f = i && /* @__PURE__ */ l("span", {
|
|
135
|
-
className: a.errorGenericText,
|
|
136
|
-
children: i
|
|
137
|
-
}), r[2] = i, r[3] = f);
|
|
138
|
-
let p;
|
|
139
|
-
r[4] === o ? p = r[5] : (p = () => o.authenticate(), r[4] = o, r[5] = p);
|
|
140
|
-
let m;
|
|
141
|
-
r[6] !== p || r[7] !== s.pairingRetry ? (m = /* @__PURE__ */ l("button", {
|
|
142
|
-
className: a.retryButton,
|
|
143
|
-
type: "button",
|
|
144
|
-
onClick: p,
|
|
145
|
-
children: s.pairingRetry
|
|
146
|
-
}), r[6] = p, r[7] = s.pairingRetry, r[8] = m) : m = r[8];
|
|
147
|
-
let h;
|
|
148
|
-
return r[9] !== d || r[10] !== f || r[11] !== m ? (h = /* @__PURE__ */ u("div", {
|
|
85
|
+
}), /* @__PURE__ */ l("span", {
|
|
86
|
+
className: a.loaderText,
|
|
87
|
+
children: e
|
|
88
|
+
})]
|
|
89
|
+
}), h = ({ message: n }) => {
|
|
90
|
+
let r = t(), i = e();
|
|
91
|
+
return /* @__PURE__ */ u("div", {
|
|
149
92
|
className: a.errorContainerPopover,
|
|
150
93
|
children: [
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
94
|
+
/* @__PURE__ */ l("span", {
|
|
95
|
+
className: a.errorTitlePopover,
|
|
96
|
+
children: i.pairingError
|
|
97
|
+
}),
|
|
98
|
+
n && /* @__PURE__ */ l("span", {
|
|
99
|
+
className: a.errorGenericText,
|
|
100
|
+
children: n
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ l("button", {
|
|
103
|
+
className: a.retryButton,
|
|
104
|
+
type: "button",
|
|
105
|
+
onClick: () => r.authenticate(),
|
|
106
|
+
children: i.pairingRetry
|
|
107
|
+
})
|
|
154
108
|
]
|
|
155
|
-
})
|
|
109
|
+
});
|
|
156
110
|
};
|
|
157
111
|
//#endregion
|
|
158
112
|
export { f as PairingPopover };
|
|
@@ -2,27 +2,19 @@ import { SessionsProvider as e } from "../providers/SessionsProvider.js";
|
|
|
2
2
|
import { TranslationProvider as t } from "../providers/TranslationProvider.js";
|
|
3
3
|
import { AuthProvider as n } from "../providers/AuthProvider.js";
|
|
4
4
|
import { createContext as r, useContext as i } from "react";
|
|
5
|
-
import {
|
|
6
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
6
|
//#region src/flow/PappProvider.tsx
|
|
8
|
-
var
|
|
9
|
-
let e = i(
|
|
7
|
+
var o = r(null), s = () => {
|
|
8
|
+
let e = i(o);
|
|
10
9
|
if (e === null) throw Error("Polkadot app Provider must be defined.");
|
|
11
10
|
return e;
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}), i[2] = l, i[3] = f, i[4] = u, i[5] = p) : p = i[5];
|
|
21
|
-
let m;
|
|
22
|
-
return i[6] !== c || i[7] !== p ? (m = /* @__PURE__ */ o(s.Provider, {
|
|
23
|
-
value: c,
|
|
24
|
-
children: p
|
|
25
|
-
}), i[6] = c, i[7] = p, i[8] = m) : m = i[8], m;
|
|
26
|
-
};
|
|
11
|
+
}, c = ({ adapter: r, language: i, translations: s, children: c }) => /* @__PURE__ */ a(o.Provider, {
|
|
12
|
+
value: r,
|
|
13
|
+
children: /* @__PURE__ */ a(t, {
|
|
14
|
+
language: i,
|
|
15
|
+
keys: s,
|
|
16
|
+
children: /* @__PURE__ */ a(n, { children: /* @__PURE__ */ a(e, { children: c }) })
|
|
17
|
+
})
|
|
18
|
+
});
|
|
27
19
|
//#endregion
|
|
28
|
-
export {
|
|
20
|
+
export { c as PappProvider, s as usePapp };
|
package/dist/hooks/authStatus.js
CHANGED
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
import { useAuthentication as e } from "../providers/AuthProvider.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import { c as t } from "react/compiler-runtime";
|
|
2
|
+
import { useMemo as t } from "react";
|
|
4
3
|
//#region src/hooks/authStatus.ts
|
|
5
4
|
var n = () => {
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
i = null;
|
|
13
|
-
}
|
|
14
|
-
let a = i, o;
|
|
15
|
-
return n[0] !== r || n[1] !== a ? (o = {
|
|
16
|
-
status: r,
|
|
17
|
-
signedInUser: a
|
|
18
|
-
}, n[0] = r, n[1] = a, n[2] = o) : o = n[2], o;
|
|
5
|
+
let { pairingStatus: n } = e();
|
|
6
|
+
return {
|
|
7
|
+
status: n,
|
|
8
|
+
signedInUser: t(() => n.step === "finished" ? n.session : null, [n])
|
|
9
|
+
};
|
|
19
10
|
};
|
|
20
11
|
//#endregion
|
|
21
12
|
export { n as useAuthStatus };
|
|
@@ -1,30 +1,23 @@
|
|
|
1
1
|
import { usePapp as e } from "../flow/PappProvider.js";
|
|
2
2
|
import { createContext as t, useContext as n, useDebugValue as r, useEffect as i, useState as a } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
5
4
|
//#region src/providers/SessionsProvider.tsx
|
|
6
|
-
var
|
|
7
|
-
let e = n(
|
|
5
|
+
var s = t(null), c = () => {
|
|
6
|
+
let e = n(s);
|
|
8
7
|
if (e === null) throw Error("User provider is not defined");
|
|
9
8
|
return e;
|
|
10
|
-
},
|
|
11
|
-
let t =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
}, l = ({ children: e }) => {
|
|
10
|
+
let t = { session: d() };
|
|
11
|
+
return /* @__PURE__ */ o(s.Provider, {
|
|
12
|
+
value: t,
|
|
13
|
+
children: e
|
|
14
|
+
});
|
|
15
|
+
}, u = () => {
|
|
16
|
+
let t = e(), [n, o] = a([]);
|
|
17
|
+
return i(() => t.sessions.sessions.subscribe(o), [t]), r(`Sessions: ${n.length}`), n;
|
|
18
18
|
}, d = () => {
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
let [c, l] = a(s), u;
|
|
22
|
-
t[1] === n.sessions.sessions ? u = t[2] : (u = () => n.sessions.sessions.subscribe(l), t[1] = n.sessions.sessions, t[2] = u);
|
|
23
|
-
let d;
|
|
24
|
-
return t[3] === n ? d = t[4] : (d = [n], t[3] = n, t[4] = d), i(u, d), r(`Sessions: ${c.length}`), c;
|
|
25
|
-
}, f = () => {
|
|
26
|
-
let e = o(4), t = d(), n, i, a;
|
|
27
|
-
return e[0] === t ? (n = e[1], i = e[2], a = e[3]) : (n = t.at(0) ?? null, a = r, i = n?.localAccount.accountId.toString() ?? "None", e[0] = t, e[1] = n, e[2] = i, e[3] = a), a(`Selected user: ${i}`), n;
|
|
19
|
+
let e = u().at(0) ?? null;
|
|
20
|
+
return r(`Selected user: ${e?.localAccount.accountId.toString() ?? "None"}`), e;
|
|
28
21
|
};
|
|
29
22
|
//#endregion
|
|
30
|
-
export {
|
|
23
|
+
export { l as SessionsProvider, c as useSession, d as useUserSession };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { createContext as e, useContext as t } from "react";
|
|
2
|
-
import { c as n } from "react/compiler-runtime";
|
|
1
|
+
import { createContext as e, useContext as t, useMemo as n } from "react";
|
|
3
2
|
import { jsx as r } from "react/jsx-runtime";
|
|
4
3
|
//#region src/providers/TranslationProvider.tsx
|
|
5
4
|
var i = "en", a = { [i]: {
|
|
@@ -15,22 +14,18 @@ var i = "en", a = { [i]: {
|
|
|
15
14
|
} }, o = e({
|
|
16
15
|
language: i,
|
|
17
16
|
keys: a
|
|
18
|
-
}), s = (e) => {
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return t[5] !== l || t[6] !== p ? (m = /* @__PURE__ */ r(o.Provider, {
|
|
31
|
-
value: p,
|
|
32
|
-
children: l
|
|
33
|
-
}), t[5] = l, t[6] = p, t[7] = m) : m = t[7], m;
|
|
17
|
+
}), s = ({ language: e = i, keys: t, children: s }) => {
|
|
18
|
+
let c = n(() => ({
|
|
19
|
+
language: e,
|
|
20
|
+
keys: {
|
|
21
|
+
...a,
|
|
22
|
+
...t
|
|
23
|
+
}
|
|
24
|
+
}), [e, t]);
|
|
25
|
+
return /* @__PURE__ */ r(o.Provider, {
|
|
26
|
+
value: c,
|
|
27
|
+
children: s
|
|
28
|
+
});
|
|
34
29
|
}, c = () => {
|
|
35
30
|
let e = t(o), n = e.keys[e.language];
|
|
36
31
|
if (!n) throw Error(`Papp integration: translation keys for "${e.language}" not found`);
|
package/dist/ui/LogoSmall.js
CHANGED
|
@@ -1,44 +1,38 @@
|
|
|
1
1
|
import { memo as e } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
3
|
//#region src/ui/LogoSmall.tsx
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
p,
|
|
39
|
-
m
|
|
40
|
-
]
|
|
41
|
-
}), a[6] = s, a[7] = c, a[8] = h) : h = a[8], h;
|
|
42
|
-
});
|
|
4
|
+
var r = 58 / 65, i = e(({ size: e = 65 }) => /* @__PURE__ */ n("svg", {
|
|
5
|
+
width: e * r,
|
|
6
|
+
height: e,
|
|
7
|
+
viewBox: "0 0 58 65",
|
|
8
|
+
fill: "none",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: [
|
|
11
|
+
/* @__PURE__ */ t("path", {
|
|
12
|
+
d: "M3.26397 13.7265C-0.989772 18.6817 -1.10194 25.5792 3.02237 29.1187C7.14669 32.6667 13.9371 31.5186 18.1995 26.5547C22.4532 21.5995 22.5654 14.702 18.4411 11.1626C16.8276 9.77271 14.7913 9.10799 12.6688 9.10799C9.37277 9.10799 5.85245 10.7137 3.26397 13.7265Z",
|
|
13
|
+
fill: "currentColor"
|
|
14
|
+
}),
|
|
15
|
+
/* @__PURE__ */ t("path", {
|
|
16
|
+
d: "M2.03001 39.3657C-1.17108 43.1641 0.218066 49.6128 5.13618 53.7651C10.0543 57.9174 16.6463 58.211 19.8474 54.4126C23.0485 50.6142 21.6593 44.1655 16.7412 40.0132C14.1355 37.8118 11.0638 36.6982 8.27687 36.6982C5.80055 36.6982 3.53996 37.5787 2.03864 39.3657",
|
|
17
|
+
fill: "currentColor"
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ t("path", {
|
|
20
|
+
d: "M30.9087 53.2643C25.1364 55.0859 21.1588 58.7979 22.0216 61.5518C22.8931 64.3056 28.2771 65.0653 34.0494 63.2351C39.8217 61.4136 43.7994 57.7016 42.9366 54.9477C42.3843 53.2126 40.0375 52.263 36.9313 52.263C35.1107 52.263 33.0399 52.5824 30.9087 53.2557",
|
|
21
|
+
fill: "currentColor"
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ t("path", {
|
|
24
|
+
d: "M21.8749 3.53942C20.6842 6.97524 24.4634 11.4125 30.3306 13.4584C36.1979 15.5044 41.9184 14.3735 43.1091 10.9377C44.2998 7.50184 40.5206 3.06462 34.6534 1.01866C32.6775 0.328044 30.7103 0 28.9329 0C25.4384 0 22.6601 1.26038 21.8749 3.53942Z",
|
|
25
|
+
fill: "currentColor"
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ t("path", {
|
|
28
|
+
d: "M48.2516 10.4638C46.5519 11.1458 46.9574 16.1096 49.149 21.5309C51.3406 26.9609 54.4899 30.8025 56.1897 30.1205C57.8808 29.4385 57.4839 24.4833 55.2923 19.0534C53.2733 14.0464 50.4346 10.3861 48.6744 10.3861C48.5277 10.3861 48.3897 10.412 48.2516 10.4638Z",
|
|
29
|
+
fill: "currentColor"
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ t("path", {
|
|
32
|
+
d: "M49.5544 43.4491C47.1385 48.6892 46.3015 53.4631 47.6907 54.1019C49.0798 54.7407 52.1688 51.0114 54.5847 45.7713C57.0092 40.5313 57.8376 35.7574 56.457 35.1185C56.3535 35.0667 56.2413 35.0495 56.1119 35.0495C54.602 35.0495 51.7891 38.6062 49.5544 43.4491Z",
|
|
33
|
+
fill: "currentColor"
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
}));
|
|
43
37
|
//#endregion
|
|
44
|
-
export {
|
|
38
|
+
export { i as LogoSmall };
|
package/dist/ui/Modal.js
CHANGED
|
@@ -1,40 +1,26 @@
|
|
|
1
1
|
import e from "./Modal.module.css.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Content as i, Overlay as a, Portal as o, Root as s, Title as c } from "@radix-ui/react-dialog";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { Content as r, Overlay as i, Portal as a, Root as o, Title as s } from "@radix-ui/react-dialog";
|
|
5
4
|
//#region src/ui/Modal.tsx
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
children: [_, h]
|
|
5
|
+
var c = ({ open: c, onOpenChange: l, width: u, container: d, children: f }) => c ? /* @__PURE__ */ t(o, {
|
|
6
|
+
modal: !0,
|
|
7
|
+
open: c,
|
|
8
|
+
onOpenChange: l,
|
|
9
|
+
children: /* @__PURE__ */ t(a, {
|
|
10
|
+
container: d,
|
|
11
|
+
children: /* @__PURE__ */ t(i, {
|
|
12
|
+
className: e.backdrop,
|
|
13
|
+
children: /* @__PURE__ */ n(r, {
|
|
14
|
+
className: e.modal,
|
|
15
|
+
style: { width: u },
|
|
16
|
+
"aria-describedby": void 0,
|
|
17
|
+
children: [/* @__PURE__ */ t(s, {
|
|
18
|
+
style: { display: "none" },
|
|
19
|
+
children: "Modal"
|
|
20
|
+
}), f]
|
|
21
|
+
})
|
|
24
22
|
})
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
u[6] !== m || u[7] !== v ? (y = /* @__PURE__ */ n(o, {
|
|
28
|
-
container: m,
|
|
29
|
-
children: v
|
|
30
|
-
}), u[6] = m, u[7] = v, u[8] = y) : y = u[8];
|
|
31
|
-
let b;
|
|
32
|
-
return u[9] !== f || u[10] !== d || u[11] !== y ? (b = /* @__PURE__ */ n(s, {
|
|
33
|
-
modal: !0,
|
|
34
|
-
open: d,
|
|
35
|
-
onOpenChange: f,
|
|
36
|
-
children: y
|
|
37
|
-
}), u[9] = f, u[10] = d, u[11] = y, u[12] = b) : b = u[12], b;
|
|
38
|
-
};
|
|
23
|
+
})
|
|
24
|
+
}) : null;
|
|
39
25
|
//#endregion
|
|
40
|
-
export {
|
|
26
|
+
export { c as Modal };
|
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.
|
|
4
|
+
"version": "0.10.1",
|
|
5
5
|
"description": "Polkadot app UI Flow",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
"react-dom": ">=18"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@novasamatech/host-papp": "0.
|
|
37
|
-
"@novasamatech/statement-store": "0.
|
|
36
|
+
"@novasamatech/host-papp": "0.10.1",
|
|
37
|
+
"@novasamatech/statement-store": "0.10.1",
|
|
38
38
|
"@polkadot-api/utils": "^0.4.0",
|
|
39
39
|
"@radix-ui/react-dialog": "1.1.23",
|
|
40
40
|
"@radix-ui/react-popover": "1.1.23",
|
|
41
41
|
"qrcode": "^1.5.4",
|
|
42
|
-
"@novasamatech/tr-ui": "^0.3.
|
|
42
|
+
"@novasamatech/tr-ui": "^0.3.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/qrcode": "^1.5.6",
|
|
46
46
|
"@types/react": "19.2.18",
|
|
47
|
-
"@types/react-dom": "19.2.
|
|
48
|
-
"@polkadot-api/substrate-bindings": "^0.
|
|
47
|
+
"@types/react-dom": "19.2.5",
|
|
48
|
+
"@polkadot-api/substrate-bindings": "^0.21.0",
|
|
49
49
|
"react": "19.2.8",
|
|
50
50
|
"react-dom": "19.2.8",
|
|
51
51
|
"typescript-plugin-css-modules": "5.2.0",
|