@novasamatech/host-papp-react-ui 0.8.11 → 0.8.12

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,51 +1,39 @@
1
- const r = "papp_Pairing-module_popoverContent_3xnU8", o = "papp_Pairing-module_container_gH7WU", e = "papp_Pairing-module_pairingContainer_R5atH", n = "papp_Pairing-module_pairingHeader_bpfNW", i = "papp_Pairing-module_scanCallToAction_lOQ-T", a = "papp_Pairing-module_pairingDescription_UJE0U", p = "papp_Pairing-module_qrSurfaceLight_dIa-z papp_Pairing-module_qrSurface_wDMjT", t = "papp_Pairing-module_qrSurfaceDark_2icM9 papp_Pairing-module_qrSurface_wDMjT", _ = "papp_Pairing-module_loaderLogo_iHsP9", c = "papp_Pairing-module_loaderContainer_cR46U", l = "papp_Pairing-module_loaderText_beteT", g = "papp_Pairing-module_loaderContainerPopover_n1-JJ", P = "papp_Pairing-module_errorContainer_KW5T-", d = "papp_Pairing-module_errorTitle_qokH0", s = "papp_Pairing-module_popoverContainer_fOWoF", u = "papp_Pairing-module_pairingPopoverHeader_PAQot", C = "papp_Pairing-module_scanCallToActionPopover_Irz-z", v = "papp_Pairing-module_pairingDescriptionPopover_z71yj", m = "papp_Pairing-module_errorContainerPopover_4mELg", T = "papp_Pairing-module_pairingPopoverContainer_RvVnH", f = "papp_Pairing-module_errorTitlePopover_-FPrd", D = "papp_Pairing-module_errorGenericText_ZPwQb", H = "papp_Pairing-module_retryButton_kWeRx", q = {
2
- popoverContent: r,
3
- container: o,
4
- pairingContainer: e,
5
- pairingHeader: n,
6
- scanCallToAction: i,
7
- pairingDescription: a,
8
- qrSurfaceLight: p,
9
- qrSurfaceDark: t,
10
- loaderLogo: _,
11
- loaderContainer: c,
12
- loaderText: l,
13
- loaderContainerPopover: g,
14
- errorContainer: P,
15
- errorTitle: d,
16
- popoverContainer: s,
17
- pairingPopoverHeader: u,
18
- scanCallToActionPopover: C,
19
- pairingDescriptionPopover: v,
20
- errorContainerPopover: m,
21
- pairingPopoverContainer: T,
22
- errorTitlePopover: f,
23
- errorGenericText: D,
24
- retryButton: H
25
- };
26
- export {
27
- o as container,
28
- q as default,
29
- P as errorContainer,
30
- m as errorContainerPopover,
31
- D as errorGenericText,
32
- d as errorTitle,
33
- f as errorTitlePopover,
34
- c as loaderContainer,
35
- g as loaderContainerPopover,
36
- _ as loaderLogo,
37
- l as loaderText,
38
- e as pairingContainer,
39
- a as pairingDescription,
40
- v as pairingDescriptionPopover,
41
- n as pairingHeader,
42
- T as pairingPopoverContainer,
43
- u as pairingPopoverHeader,
44
- s as popoverContainer,
45
- r as popoverContent,
46
- t as qrSurfaceDark,
47
- p as qrSurfaceLight,
48
- H as retryButton,
49
- i as scanCallToAction,
50
- C as scanCallToActionPopover
1
+ //#region src/flow/Pairing.module.css
2
+ var e = "papp_Pairing-module_popoverContent_3xnU8", t = "papp_Pairing-module_container_gH7WU", n = "papp_Pairing-module_genericText_zDzqC", r = "papp_Pairing-module_pairingContainer_R5atH", i = "papp_Pairing-module_pairingHeader_bpfNW", a = "papp_Pairing-module_scanCallToAction_lOQ-T", o = "papp_Pairing-module_pairingDescription_UJE0U", s = "papp_Pairing-module_qrSurface_wDMjT", c = "papp_Pairing-module_qrSurfaceLight_dIa-z papp_Pairing-module_qrSurface_wDMjT", l = "papp_Pairing-module_qrSurfaceDark_2icM9 papp_Pairing-module_qrSurface_wDMjT", u = "papp_Pairing-module_loaderLogo_iHsP9", d = "papp_Pairing-module_loader_S62aK", f = "papp_Pairing-module_loaderContainer_cR46U", p = "papp_Pairing-module_loaderText_beteT", m = "papp_Pairing-module_loaderContainerPopover_n1-JJ", h = "papp_Pairing-module_finishedContainer_FtMTm", g = "papp_Pairing-module_finishedLogo_jkEDX", _ = "papp_Pairing-module_finishedLogoSeparator_iRufd", v = "papp_Pairing-module_finishedLogoTitle_qKs3e", y = "papp_Pairing-module_finishedWelcome_Zvm-X", b = "papp_Pairing-module_finishedUsername_RIpsa", x = "papp_Pairing-module_finishedVoucher_rR0jH", S = "papp_Pairing-module_finishedButton_iuvIR", C = "papp_Pairing-module_errorContainer_KW5T-", w = "papp_Pairing-module_errorTitle_qokH0", T = "papp_Pairing-module_popoverContainer_fOWoF", E = "papp_Pairing-module_pairingPopoverHeader_PAQot", D = "papp_Pairing-module_scanCallToActionPopover_Irz-z", O = "papp_Pairing-module_pairingDescriptionPopover_z71yj", k = "papp_Pairing-module_errorContainerPopover_4mELg", A = "papp_Pairing-module_pairingPopoverContainer_RvVnH", j = "papp_Pairing-module_errorTitlePopover_-FPrd", M = "papp_Pairing-module_errorGenericText_ZPwQb", N = "papp_Pairing-module_retryButton_kWeRx", P = {
3
+ popoverContent: e,
4
+ container: t,
5
+ genericText: n,
6
+ pairingContainer: r,
7
+ pairingHeader: i,
8
+ scanCallToAction: a,
9
+ pairingDescription: o,
10
+ qrSurface: s,
11
+ qrSurfaceLight: c,
12
+ qrSurfaceDark: l,
13
+ loaderLogo: u,
14
+ loader: d,
15
+ loaderContainer: f,
16
+ loaderText: p,
17
+ loaderContainerPopover: m,
18
+ finishedContainer: h,
19
+ finishedLogo: g,
20
+ finishedLogoSeparator: _,
21
+ finishedLogoTitle: v,
22
+ finishedWelcome: y,
23
+ finishedUsername: b,
24
+ finishedVoucher: x,
25
+ finishedButton: S,
26
+ errorContainer: C,
27
+ errorTitle: w,
28
+ popoverContainer: T,
29
+ pairingPopoverHeader: E,
30
+ scanCallToActionPopover: D,
31
+ pairingDescriptionPopover: O,
32
+ errorContainerPopover: k,
33
+ pairingPopoverContainer: A,
34
+ errorTitlePopover: j,
35
+ errorGenericText: M,
36
+ retryButton: N
51
37
  };
38
+ //#endregion
39
+ export { t as container, P as default, C as errorContainer, k as errorContainerPopover, M as errorGenericText, w as errorTitle, j as errorTitlePopover, S as finishedButton, h as finishedContainer, g as finishedLogo, _ as finishedLogoSeparator, v as finishedLogoTitle, b as finishedUsername, x as finishedVoucher, y as finishedWelcome, n as genericText, d as loader, f as loaderContainer, m as loaderContainerPopover, u as loaderLogo, p as loaderText, r as pairingContainer, o as pairingDescription, O as pairingDescriptionPopover, i as pairingHeader, A as pairingPopoverContainer, E as pairingPopoverHeader, T as popoverContainer, e as popoverContent, s as qrSurface, l as qrSurfaceDark, c as qrSurfaceLight, N as retryButton, a as scanCallToAction, D as scanCallToActionPopover };
@@ -1,101 +1,132 @@
1
- import { jsx as l, jsxs as v } from "react/jsx-runtime";
2
- import { c as C } from "react/compiler-runtime";
3
- import { Button as E } from "@novasamatech/tr-ui";
4
- import { memo as x, useEffect as M } from "react";
5
- import { useAuthStatus as b } from "../hooks/authStatus.js";
6
- import { useAuthentication as A } from "../providers/AuthProvider.js";
7
- import { useTranslations as T } from "../providers/TranslationProvider.js";
8
- import { LogoSmall as k } from "../ui/LogoSmall.js";
9
- import { Modal as z } from "../ui/Modal.js";
10
- import { QrCode as H } from "../ui/QrCode.js";
11
- import p from "./Pairing.module.css.js";
12
- const F = x((g) => {
13
- const e = C(28);
14
- let n;
15
- e[0] !== g ? (n = g === void 0 ? {} : g, e[0] = g, e[1] = n) : n = e[1];
16
- const {
17
- theme: o,
18
- size: s
19
- } = n, i = s === void 0 ? 280 : s, a = A(), {
20
- status: t
21
- } = b(), r = a.authUIMode === "modal" && t.step !== "none" && t.step !== "finished";
22
- let c;
23
- e[2] !== a || e[3] !== t.step ? (c = (D) => {
24
- !D && t.step !== "pending" && a.abortAuthentication();
25
- }, e[2] = a, e[3] = t.step, e[4] = c) : c = e[4];
26
- const h = c;
27
- let d, m;
28
- e[5] !== a || e[6] !== t.step ? (d = () => {
29
- a.authUIMode === "modal" && t.step === "finished" && a.abortAuthentication();
30
- }, m = [a, t.step], e[5] = a, e[6] = t.step, e[7] = d, e[8] = m) : (d = e[7], m = e[8]), M(d, m);
31
- let f;
32
- e[9] !== i || e[10] !== t.payload || e[11] !== t.step || e[12] !== o ? (f = t.step === "pairing" && /* @__PURE__ */ l(L, { theme: o, size: i, payload: t.payload }), e[9] = i, e[10] = t.payload, e[11] = t.step, e[12] = o, e[13] = f) : f = e[13];
33
- let u;
34
- e[14] !== t.stage || e[15] !== t.step ? (u = t.step === "pending" && /* @__PURE__ */ l($, { stage: t.stage }), e[14] = t.stage, e[15] = t.step, e[16] = u) : u = e[16];
35
- let y;
36
- e[17] !== t.message || e[18] !== t.step ? (y = t.step === "pairingError" && /* @__PURE__ */ l(P, { message: t.message }), e[17] = t.message, e[18] = t.step, e[19] = y) : y = e[19];
37
- let N;
38
- e[20] !== f || e[21] !== u || e[22] !== y ? (N = /* @__PURE__ */ v("div", { className: p.container, children: [
39
- f,
40
- u,
41
- y
42
- ] }), e[20] = f, e[21] = u, e[22] = y, e[23] = N) : N = e[23];
43
- let S;
44
- return e[24] !== r || e[25] !== N || e[26] !== h ? (S = /* @__PURE__ */ l(z, { open: r, onOpenChange: h, width: "fit-content", children: N }), e[24] = r, e[25] = N, e[26] = h, e[27] = S) : S = e[27], S;
45
- }), L = (g) => {
46
- const e = C(18), {
47
- payload: n,
48
- size: o,
49
- theme: s
50
- } = g, i = T(), a = s === "dark";
51
- let t;
52
- e[0] !== i.pairingHeader ? (t = /* @__PURE__ */ l("span", { className: p.pairingHeader, children: i.pairingHeader }), e[0] = i.pairingHeader, e[1] = t) : t = e[1];
53
- let r;
54
- e[2] !== i.pairingScanCallToAction ? (r = /* @__PURE__ */ l("span", { className: p.scanCallToAction, children: i.pairingScanCallToAction }), e[2] = i.pairingScanCallToAction, e[3] = r) : r = e[3];
55
- const c = a ? p.qrSurfaceDark : p.qrSurfaceLight;
56
- let h;
57
- e[4] !== n || e[5] !== o || e[6] !== s ? (h = /* @__PURE__ */ l(H, { value: n, size: o, theme: s }), e[4] = n, e[5] = o, e[6] = s, e[7] = h) : h = e[7];
58
- let d;
59
- e[8] !== c || e[9] !== h ? (d = /* @__PURE__ */ l("div", { className: c, children: h }), e[8] = c, e[9] = h, e[10] = d) : d = e[10];
60
- let m;
61
- e[11] !== i.pairingDescription ? (m = /* @__PURE__ */ l("span", { className: p.pairingDescription, children: i.pairingDescription }), e[11] = i.pairingDescription, e[12] = m) : m = e[12];
62
- let f;
63
- return e[13] !== t || e[14] !== r || e[15] !== d || e[16] !== m ? (f = /* @__PURE__ */ v("div", { className: p.pairingContainer, children: [
64
- t,
65
- r,
66
- d,
67
- m
68
- ] }), e[13] = t, e[14] = r, e[15] = d, e[16] = m, e[17] = f) : f = e[17], f;
69
- }, $ = (g) => {
70
- const e = C(3), {
71
- stage: n
72
- } = g;
73
- let o;
74
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ l("div", { className: p.loaderLogo, children: /* @__PURE__ */ l(k, { size: 100 }) }), e[0] = o) : o = e[0];
75
- let s;
76
- return e[1] !== n ? (s = /* @__PURE__ */ v("div", { className: p.loaderContainer, children: [
77
- o,
78
- /* @__PURE__ */ l("span", { className: p.loaderText, children: n })
79
- ] }), e[1] = n, e[2] = s) : s = e[2], s;
80
- }, P = (g) => {
81
- const e = C(13), {
82
- message: n
83
- } = g, o = A(), s = T();
84
- let i;
85
- e[0] !== s.pairingError ? (i = /* @__PURE__ */ l("span", { className: p.errorTitle, children: s.pairingError }), e[0] = s.pairingError, e[1] = i) : i = e[1];
86
- let a;
87
- e[2] !== n ? (a = /* @__PURE__ */ l("span", { className: p.errorGenericText, children: n }), e[2] = n, e[3] = a) : a = e[3];
88
- let t;
89
- e[4] !== o ? (t = () => o.authenticate(), e[4] = o, e[5] = t) : t = e[5];
90
- let r;
91
- e[6] !== t || e[7] !== s.pairingRetry ? (r = /* @__PURE__ */ l(E, { variant: "secondary", type: "button", onClick: t, children: s.pairingRetry }), e[6] = t, e[7] = s.pairingRetry, e[8] = r) : r = e[8];
92
- let c;
93
- return e[9] !== i || e[10] !== a || e[11] !== r ? (c = /* @__PURE__ */ v("div", { className: p.errorContainer, children: [
94
- i,
95
- a,
96
- r
97
- ] }), e[9] = i, e[10] = a, e[11] = r, e[12] = c) : c = e[12], c;
98
- };
99
- export {
100
- F as PairingModal
1
+ import { useTranslations as e } from "../providers/TranslationProvider.js";
2
+ import { useAuthentication as t } from "../providers/AuthProvider.js";
3
+ import { useAuthStatus as n } from "../hooks/authStatus.js";
4
+ import { LogoSmall as r } from "../ui/LogoSmall.js";
5
+ import { Modal as i } from "../ui/Modal.js";
6
+ import { QrCode as a } from "../ui/QrCode.js";
7
+ import o from "./Pairing.module.css.js";
8
+ import { Button as s } from "@novasamatech/tr-ui";
9
+ import { memo as c, useEffect as l } from "react";
10
+ import { c as u } from "react/compiler-runtime";
11
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
12
+ //#region src/flow/PairingModal.tsx
13
+ var p = c((e) => {
14
+ let r = u(28), a;
15
+ r[0] === e ? a = r[1] : (a = e === void 0 ? {} : e, r[0] = e, r[1] = a);
16
+ let { theme: s, size: c } = a, p = c === void 0 ? 280 : c, _ = t(), { status: v } = n(), y = _.authUIMode === "modal" && v.step !== "none" && v.step !== "finished", b;
17
+ r[2] !== _ || r[3] !== v.step ? (b = (e) => {
18
+ !e && v.step !== "pending" && _.abortAuthentication();
19
+ }, r[2] = _, r[3] = v.step, r[4] = b) : b = r[4];
20
+ let x = b, S, C;
21
+ r[5] !== _ || r[6] !== v.step ? (S = () => {
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,
47
+ width: "fit-content",
48
+ children: D
49
+ }), r[24] = y, r[25] = D, r[26] = x, r[27] = O) : O = r[27], O;
50
+ }), m = (t) => {
51
+ let n = u(18), { payload: r, size: i, theme: s } = t, c = e(), l = s === "dark", p;
52
+ n[0] === c.pairingHeader ? p = n[1] : (p = /* @__PURE__ */ d("span", {
53
+ className: o.pairingHeader,
54
+ children: c.pairingHeader
55
+ }), n[0] = c.pairingHeader, n[1] = p);
56
+ let m;
57
+ n[2] === c.pairingScanCallToAction ? m = n[3] : (m = /* @__PURE__ */ d("span", {
58
+ className: o.scanCallToAction,
59
+ children: c.pairingScanCallToAction
60
+ }), n[2] = c.pairingScanCallToAction, n[3] = m);
61
+ let h = l ? o.qrSurfaceDark : o.qrSurfaceLight, g;
62
+ n[4] !== r || n[5] !== i || n[6] !== s ? (g = /* @__PURE__ */ d(a, {
63
+ value: r,
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", {
79
+ className: o.pairingContainer,
80
+ children: [
81
+ p,
82
+ m,
83
+ _,
84
+ v
85
+ ]
86
+ }), n[13] = p, n[14] = m, n[15] = _, n[16] = v, n[17] = y) : y = n[17], y;
87
+ }, h = (e) => {
88
+ let t = u(3), { stage: n } = e, i;
89
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ d("div", {
90
+ className: o.loaderLogo,
91
+ children: /* @__PURE__ */ d(r, { size: 100 })
92
+ }), t[0] = i) : i = t[0];
93
+ let a;
94
+ return t[1] === n ? a = t[2] : (a = /* @__PURE__ */ f("div", {
95
+ className: o.loaderContainer,
96
+ children: [i, /* @__PURE__ */ d("span", {
97
+ className: o.loaderText,
98
+ children: n
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", {
123
+ className: o.errorContainer,
124
+ children: [
125
+ l,
126
+ p,
127
+ h
128
+ ]
129
+ }), r[9] = l, r[10] = p, r[11] = h, r[12] = g) : g = r[12], g;
101
130
  };
131
+ //#endregion
132
+ export { p as PairingModal };
@@ -1,122 +1,158 @@
1
- import { jsx as n, jsxs as k } from "react/jsx-runtime";
2
- import { c as R } from "react/compiler-runtime";
3
- import * as x from "@radix-ui/react-popover";
4
- import { memo as B, useEffect as I } from "react";
5
- import { useAuthStatus as K } from "../hooks/authStatus.js";
6
- import { useAuthentication as j } from "../providers/AuthProvider.js";
7
- import { useTranslations as q } from "../providers/TranslationProvider.js";
8
- import { LogoSmall as _ } from "../ui/LogoSmall.js";
9
- import { QrCode as w } from "../ui/QrCode.js";
10
- import c from "./Pairing.module.css.js";
11
- const oe = B((h) => {
12
- const e = R(44), {
13
- theme: a,
14
- size: l,
15
- align: r,
16
- side: p,
17
- alignOffset: o,
18
- sizeOffset: f,
19
- children: s
20
- } = h, g = a === void 0 ? "dark" : a, d = l === void 0 ? 240 : l, m = f === void 0 ? 4 : f, i = j(), {
21
- status: t
22
- } = K(), v = typeof process < "u" && process.env?.STORYBOOK === "true", H = i.authUIMode === "popover" && (v || t.step !== "none");
23
- let A;
24
- e[0] !== i || e[1] !== t.step ? (A = () => {
25
- t.step === "none" && i.authenticate("popover");
26
- }, e[0] = i, e[1] = t.step, e[2] = A) : A = e[2];
27
- const $ = A;
28
- let T;
29
- e[3] !== i || e[4] !== t.step ? (T = (O) => {
30
- !O && t.step !== "pending" && i.abortAuthentication();
31
- }, e[3] = i, e[4] = t.step, e[5] = T) : T = e[5];
32
- const W = T;
33
- let E;
34
- e[6] !== i ? (E = () => () => {
35
- i.abortAuthentication();
36
- }, e[6] = i, e[7] = E) : E = e[7];
37
- let L;
38
- e[8] !== i.abortAuthentication ? (L = [i.abortAuthentication], e[8] = i.abortAuthentication, e[9] = L) : L = e[9], I(E, L);
39
- let u;
40
- e[10] !== s || e[11] !== $ ? (u = /* @__PURE__ */ n(x.Trigger, { asChild: !0, onClick: $, children: s }), e[10] = s, e[11] = $, e[12] = u) : u = e[12];
41
- let P, y;
42
- e[13] !== t.step ? (y = (O) => {
43
- t.step === "pending" && O.preventDefault();
44
- }, P = (O) => {
45
- t.step === "pending" && O.preventDefault();
46
- }, e[13] = t.step, e[14] = P, e[15] = y) : (P = e[14], y = e[15]);
47
- let N;
48
- e[16] !== d || e[17] !== t.payload || e[18] !== t.step || e[19] !== g ? (N = t.step === "pairing" && /* @__PURE__ */ n(G, { theme: g, size: d, payload: t.payload }), e[16] = d, e[17] = t.payload, e[18] = t.step, e[19] = g, e[20] = N) : N = e[20];
49
- let C;
50
- e[21] !== t.stage || e[22] !== t.step ? (C = t.step === "pending" && /* @__PURE__ */ n(M, { stage: t.stage }), e[21] = t.stage, e[22] = t.step, e[23] = C) : C = e[23];
51
- let S;
52
- e[24] !== t.message || e[25] !== t.step ? (S = t.step === "pairingError" && /* @__PURE__ */ n(Q, { message: t.message }), e[24] = t.message, e[25] = t.step, e[26] = S) : S = e[26];
53
- let b;
54
- e[27] !== N || e[28] !== C || e[29] !== S ? (b = /* @__PURE__ */ k("div", { className: c.popoverContainer, children: [
55
- N,
56
- C,
57
- S
58
- ] }), e[27] = N, e[28] = C, e[29] = S, e[30] = b) : b = e[30];
59
- let D;
60
- e[31] !== r || e[32] !== o || e[33] !== p || e[34] !== m || e[35] !== P || e[36] !== b || e[37] !== y ? (D = /* @__PURE__ */ n(x.Portal, { children: /* @__PURE__ */ n(x.Content, { side: p, align: r, sideOffset: m, alignOffset: o, className: c.popoverContent, onInteractOutside: y, onEscapeKeyDown: P, children: b }) }), e[31] = r, e[32] = o, e[33] = p, e[34] = m, e[35] = P, e[36] = b, e[37] = y, e[38] = D) : D = e[38];
61
- let z;
62
- return e[39] !== H || e[40] !== D || e[41] !== u || e[42] !== W ? (z = /* @__PURE__ */ k(x.Root, { open: H, onOpenChange: W, children: [
63
- u,
64
- D
65
- ] }), e[39] = H, e[40] = D, e[41] = u, e[42] = W, e[43] = z) : z = e[43], z;
66
- }), G = (h) => {
67
- const e = R(18), {
68
- payload: a,
69
- size: l,
70
- theme: r
71
- } = h, p = r === void 0 ? "light" : r, o = q(), f = p === "dark";
72
- let s;
73
- e[0] !== o.pairingPopoverWelcome ? (s = /* @__PURE__ */ n("span", { className: c.pairingPopoverHeader, children: o.pairingPopoverWelcome }), e[0] = o.pairingPopoverWelcome, e[1] = s) : s = e[1];
74
- const g = f ? c.qrSurfaceDark : c.qrSurfaceLight;
75
- let d;
76
- e[2] !== a || e[3] !== l || e[4] !== p ? (d = /* @__PURE__ */ n(w, { value: a, size: l, theme: p }), e[2] = a, e[3] = l, e[4] = p, e[5] = d) : d = e[5];
77
- let m;
78
- e[6] !== g || e[7] !== d ? (m = /* @__PURE__ */ n("div", { className: g, children: d }), e[6] = g, e[7] = d, e[8] = m) : m = e[8];
79
- let i;
80
- e[9] !== o.pairingPopoverLoginHeading ? (i = /* @__PURE__ */ n("span", { className: c.scanCallToActionPopover, children: o.pairingPopoverLoginHeading }), e[9] = o.pairingPopoverLoginHeading, e[10] = i) : i = e[10];
81
- let t;
82
- e[11] !== o.pairingPopoverScanDescription ? (t = /* @__PURE__ */ n("span", { className: c.pairingDescriptionPopover, children: o.pairingPopoverScanDescription }), e[11] = o.pairingPopoverScanDescription, e[12] = t) : t = e[12];
83
- let v;
84
- return e[13] !== s || e[14] !== m || e[15] !== i || e[16] !== t ? (v = /* @__PURE__ */ k("div", { className: c.pairingPopoverContainer, children: [
85
- s,
86
- m,
87
- i,
88
- t
89
- ] }), e[13] = s, e[14] = m, e[15] = i, e[16] = t, e[17] = v) : v = e[17], v;
90
- }, M = (h) => {
91
- const e = R(3), {
92
- stage: a
93
- } = h;
94
- let l;
95
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ n("div", { className: c.loaderLogo, children: /* @__PURE__ */ n(_, { size: 100 }) }), e[0] = l) : l = e[0];
96
- let r;
97
- return e[1] !== a ? (r = /* @__PURE__ */ k("div", { className: c.loaderContainerPopover, children: [
98
- l,
99
- /* @__PURE__ */ n("span", { className: c.loaderText, children: a })
100
- ] }), e[1] = a, e[2] = r) : r = e[2], r;
101
- }, Q = (h) => {
102
- const e = R(13), {
103
- message: a
104
- } = h, l = j(), r = q();
105
- let p;
106
- e[0] !== r.pairingError ? (p = /* @__PURE__ */ n("span", { className: c.errorTitlePopover, children: r.pairingError }), e[0] = r.pairingError, e[1] = p) : p = e[1];
107
- let o;
108
- e[2] !== a ? (o = a && /* @__PURE__ */ n("span", { className: c.errorGenericText, children: a }), e[2] = a, e[3] = o) : o = e[3];
109
- let f;
110
- e[4] !== l ? (f = () => l.authenticate(), e[4] = l, e[5] = f) : f = e[5];
111
- let s;
112
- e[6] !== f || e[7] !== r.pairingRetry ? (s = /* @__PURE__ */ n("button", { className: c.retryButton, type: "button", onClick: f, children: r.pairingRetry }), e[6] = f, e[7] = r.pairingRetry, e[8] = s) : s = e[8];
113
- let g;
114
- return e[9] !== p || e[10] !== o || e[11] !== s ? (g = /* @__PURE__ */ k("div", { className: c.errorContainerPopover, children: [
115
- p,
116
- o,
117
- s
118
- ] }), e[9] = p, e[10] = o, e[11] = s, e[12] = g) : g = e[12], g;
119
- };
120
- export {
121
- oe as PairingPopover
1
+ import { useTranslations as e } from "../providers/TranslationProvider.js";
2
+ import { useAuthentication as t } from "../providers/AuthProvider.js";
3
+ import { useAuthStatus as n } from "../hooks/authStatus.js";
4
+ import { LogoSmall as r } from "../ui/LogoSmall.js";
5
+ import { QrCode as i } from "../ui/QrCode.js";
6
+ import a from "./Pairing.module.css.js";
7
+ import { memo as o, useEffect as s } from "react";
8
+ import { c } from "react/compiler-runtime";
9
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
10
+ import * as d from "@radix-ui/react-popover";
11
+ import "@radix-ui/react-popper";
12
+ //#region src/flow/PairingPopover.tsx
13
+ var f = o((e) => {
14
+ let r = c(44), { theme: i, size: o, align: f, side: g, alignOffset: _, sizeOffset: v, children: y } = e, b = i === void 0 ? "dark" : i, x = o === void 0 ? 240 : o, S = v === void 0 ? 4 : v, C = t(), { status: w } = n(), T = typeof process < "u" && process.env?.STORYBOOK === "true", E = C.authUIMode === "popover" && (T || w.step !== "none"), D;
15
+ r[0] !== C || r[1] !== w.step ? (D = () => {
16
+ w.step === "none" && C.authenticate("popover");
17
+ }, r[0] = C, r[1] = w.step, r[2] = D) : D = r[2];
18
+ let O = D, k;
19
+ r[3] !== C || r[4] !== w.step ? (k = (e) => {
20
+ !e && w.step !== "pending" && C.abortAuthentication();
21
+ }, r[3] = C, r[4] = w.step, r[5] = k) : k = r[5];
22
+ let A = k, j;
23
+ r[6] === C ? j = r[7] : (j = () => () => {
24
+ C.abortAuthentication();
25
+ }, r[6] = C, r[7] = j);
26
+ let M;
27
+ r[8] === C.abortAuthentication ? M = r[9] : (M = [C.abortAuthentication], r[8] = C.abortAuthentication, r[9] = M), s(j, M);
28
+ let N;
29
+ r[10] !== y || r[11] !== O ? (N = /* @__PURE__ */ l(d.Trigger, {
30
+ asChild: !0,
31
+ onClick: O,
32
+ children: y
33
+ }), r[10] = y, r[11] = O, r[12] = N) : N = r[12];
34
+ let P, F;
35
+ r[13] === w.step ? (P = r[14], F = r[15]) : (F = (e) => {
36
+ w.step === "pending" && e.preventDefault();
37
+ }, P = (e) => {
38
+ w.step === "pending" && e.preventDefault();
39
+ }, r[13] = w.step, r[14] = P, r[15] = F);
40
+ let I;
41
+ r[16] !== x || r[17] !== w.payload || r[18] !== w.step || r[19] !== b ? (I = w.step === "pairing" && /* @__PURE__ */ l(p, {
42
+ theme: b,
43
+ size: x,
44
+ payload: w.payload
45
+ }), r[16] = x, r[17] = w.payload, r[18] = w.step, r[19] = b, r[20] = I) : I = r[20];
46
+ let L;
47
+ r[21] !== w.stage || r[22] !== w.step ? (L = w.step === "pending" && /* @__PURE__ */ l(m, { stage: w.stage }), r[21] = w.stage, r[22] = w.step, r[23] = L) : L = r[23];
48
+ let R;
49
+ r[24] !== w.message || r[25] !== w.step ? (R = w.step === "pairingError" && /* @__PURE__ */ l(h, { message: w.message }), r[24] = w.message, r[25] = w.step, r[26] = R) : R = r[26];
50
+ let z;
51
+ r[27] !== I || r[28] !== L || r[29] !== R ? (z = /* @__PURE__ */ u("div", {
52
+ className: a.popoverContainer,
53
+ children: [
54
+ I,
55
+ L,
56
+ R
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", {
105
+ className: a.pairingPopoverContainer,
106
+ children: [
107
+ m,
108
+ _,
109
+ v,
110
+ y
111
+ ]
112
+ }), n[13] = m, n[14] = _, n[15] = v, n[16] = y, n[17] = b) : b = n[17], b;
113
+ }, m = (e) => {
114
+ let t = c(3), { stage: n } = e, i;
115
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ l("div", {
116
+ className: a.loaderLogo,
117
+ children: /* @__PURE__ */ l(r, { size: 100 })
118
+ }), t[0] = i) : i = t[0];
119
+ let o;
120
+ return t[1] === n ? o = t[2] : (o = /* @__PURE__ */ u("div", {
121
+ className: a.loaderContainerPopover,
122
+ children: [i, /* @__PURE__ */ l("span", {
123
+ className: a.loaderText,
124
+ children: n
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", {
149
+ className: a.errorContainerPopover,
150
+ children: [
151
+ d,
152
+ f,
153
+ m
154
+ ]
155
+ }), r[9] = d, r[10] = f, r[11] = m, r[12] = h) : h = r[12], h;
122
156
  };
157
+ //#endregion
158
+ export { f as PairingPopover };