@declarion/react 0.153.0 → 0.162.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.
- package/dist-lib/api/access-expiry.js +6 -5
- package/dist-lib/api/auth.js +37 -28
- package/dist-lib/api/client.js +54 -53
- package/dist-lib/api/oauth.js +12 -0
- package/dist-lib/api/schema.js +35 -32
- package/dist-lib/app.js +160 -144
- package/dist-lib/components/layout/Layout.impl.js +666 -0
- package/dist-lib/components/layout/Layout.js +19 -690
- package/dist-lib/components/pages/SSOCallbackPage.js +9 -7
- package/dist-lib/components/pages/auth/OAuthConsent.impl.js +168 -0
- package/dist-lib/components/pages/auth/OAuthConsent.js +11 -0
- package/dist-lib/components/pages/auth/SignIn.js +91 -85
- package/dist-lib/components/pages/auth/SignUp.impl.js +2 -5
- package/dist-lib/components/params/param-editors.js +2 -1
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/hooks/useFollowAgentOpen.js +1 -1
- package/dist-lib/hooks/useSignInData.js +20 -0
- package/dist-lib/index.d.ts +2 -2
- package/dist-lib/lib/capabilityPrefetch.js +19 -18
- package/dist-lib/lib/schema-routing.js +5 -1
- package/dist-lib/stores/auth.js +1 -1
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/{useResponsiveMode-BElw02Gh.d.ts → useResponsiveMode-BGMnPC4S.d.ts} +1 -0
- package/package.json +1 -1
- package/dist-lib/components/pages/SSOCallbackPage.impl.js +0 -27
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useAuthStore as e } from "../../stores/auth.js";
|
|
2
|
+
import { sanitizeRedirectPath as t } from "../../api/auth-redirect.js";
|
|
2
3
|
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import { Navigate as r, useSearchParams as i } from "react-router";
|
|
3
5
|
// src/components/pages/SSOCallbackPage.tsx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return /* @__PURE__ */ n(
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function a() {
|
|
7
|
+
let [a] = i(), o = e((e) => e.isAuthenticated) ? t(a.get("redirect")) : "/login?sso_error=auth.unauthorized";
|
|
8
|
+
return /* @__PURE__ */ n(r, {
|
|
9
|
+
to: o,
|
|
10
|
+
replace: !0
|
|
9
11
|
});
|
|
10
12
|
}
|
|
11
|
-
export {
|
|
13
|
+
export { a as SSOCallbackPage };
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { AuthShell as e } from "./AuthShell.js";
|
|
2
|
+
import { Btn as t } from "../../primitives/Btn.js";
|
|
3
|
+
import { Icon as n } from "../../primitives/Icons.js";
|
|
4
|
+
import { useText as r } from "../../../hooks/useText.js";
|
|
5
|
+
import { useAuthStore as i } from "../../../stores/auth.js";
|
|
6
|
+
import { logout as a } from "../../../api/auth.js";
|
|
7
|
+
import { loginPathForCurrentLocation as o } from "../../../api/auth-redirect.js";
|
|
8
|
+
import { continueAuthorization as s, decideAuthorization as c } from "../../../api/oauth.js";
|
|
9
|
+
import { failureTitle as l } from "../../../lib/failure.js";
|
|
10
|
+
import { useEffect as u, useState as d } from "react";
|
|
11
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
|
+
import { useNavigate as h, useSearchParams as g } from "react-router";
|
|
13
|
+
// src/components/pages/auth/OAuthConsent.impl.tsx
|
|
14
|
+
function _(e, t) {
|
|
15
|
+
switch (t) {
|
|
16
|
+
case "openid": return e("oauth.consent.scope.openid", "Confirm that it is you");
|
|
17
|
+
case "profile": return e("oauth.consent.scope.profile", "Your name");
|
|
18
|
+
case "email": return e("oauth.consent.scope.email", "Your email address");
|
|
19
|
+
default: return t;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function v(e, t) {
|
|
23
|
+
switch (t) {
|
|
24
|
+
case "unknown_client": return e("oauth.consent.error.unknown_client", "This application is not registered here, or it is disabled.");
|
|
25
|
+
case "invalid_redirect": return e("oauth.consent.error.invalid_redirect", "This application asked to return you to an address it did not register.");
|
|
26
|
+
case "expired": return e("oauth.consent.error.expired", "This sign-in request has expired. Start again from the application.");
|
|
27
|
+
default: return e("oauth.consent.error.invalid_request", "This sign-in request is not valid. Start again from the application.");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function y() {
|
|
31
|
+
let y = r(), b = r("errors"), x = h(), [S] = g(), C = S.get("transaction_id") ?? "", w = S.get("error") ?? (C ? null : "invalid_request"), T = i((e) => e.isAuthenticated), [E, D] = d(null), [O, k] = d(null), [A, j] = d(!1);
|
|
32
|
+
u(() => {
|
|
33
|
+
if (w) return;
|
|
34
|
+
if (!T) {
|
|
35
|
+
x(o(), { replace: !0 });
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
let e = !1;
|
|
39
|
+
return s(C).then((t) => {
|
|
40
|
+
e || (t.next === "redirect" && t.redirect_to ? window.location.assign(t.redirect_to) : t.next === "sign_in" ? x(o(), { replace: !0 }) : D(t));
|
|
41
|
+
}).catch((t) => {
|
|
42
|
+
e || k(l(b, t));
|
|
43
|
+
}), () => {
|
|
44
|
+
e = !0;
|
|
45
|
+
};
|
|
46
|
+
}, [
|
|
47
|
+
b,
|
|
48
|
+
T,
|
|
49
|
+
x,
|
|
50
|
+
w,
|
|
51
|
+
C
|
|
52
|
+
]);
|
|
53
|
+
async function M(e) {
|
|
54
|
+
if (!A) {
|
|
55
|
+
j(!0);
|
|
56
|
+
try {
|
|
57
|
+
let t = await c(C, e);
|
|
58
|
+
if (t.redirect_to) {
|
|
59
|
+
window.location.assign(t.redirect_to);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
D(t);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
k(l(b, e));
|
|
65
|
+
} finally {
|
|
66
|
+
j(!1);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function N() {
|
|
71
|
+
j(!0);
|
|
72
|
+
try {
|
|
73
|
+
await a();
|
|
74
|
+
} finally {
|
|
75
|
+
window.location.assign(o());
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
let P = w ? v(y, w) : O;
|
|
79
|
+
return /* @__PURE__ */ p(e, { children: /* @__PURE__ */ m("div", {
|
|
80
|
+
"data-testid": "oauth-consent",
|
|
81
|
+
className: "flex flex-col gap-4",
|
|
82
|
+
children: [/* @__PURE__ */ p("div", {
|
|
83
|
+
className: "text-accent-text text-xs font-bold uppercase tracking-widest",
|
|
84
|
+
children: y("oauth.consent.eyebrow", "Sign in to an application")
|
|
85
|
+
}), P ? /* @__PURE__ */ m("div", {
|
|
86
|
+
role: "alert",
|
|
87
|
+
"data-testid": "oauth-consent-error",
|
|
88
|
+
className: "bg-destructive/10 text-destructive flex items-start gap-2 rounded-md p-3 text-sm",
|
|
89
|
+
children: [/* @__PURE__ */ p(n.shield, { size: 14 }), /* @__PURE__ */ p("div", { children: P })]
|
|
90
|
+
}) : E ? E.next === "reauthenticate" ? /* @__PURE__ */ m(f, { children: [
|
|
91
|
+
/* @__PURE__ */ p("h2", {
|
|
92
|
+
className: "text-2xl font-semibold",
|
|
93
|
+
children: E.client_name
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ p("p", {
|
|
96
|
+
className: "text-muted-foreground text-sm",
|
|
97
|
+
children: y("oauth.consent.reauthenticate", "This application asks you to sign in again before it continues.")
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ p(t, {
|
|
100
|
+
kind: "primary",
|
|
101
|
+
size: "md",
|
|
102
|
+
className: "w-full justify-center",
|
|
103
|
+
disabled: A,
|
|
104
|
+
onClick: () => void N(),
|
|
105
|
+
children: y("oauth.consent.sign_in_again", "Sign in again")
|
|
106
|
+
})
|
|
107
|
+
] }) : /* @__PURE__ */ m(f, { children: [
|
|
108
|
+
/* @__PURE__ */ p("h2", {
|
|
109
|
+
className: "text-2xl font-semibold",
|
|
110
|
+
"data-testid": "oauth-consent-client",
|
|
111
|
+
children: E.client_name
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ p("p", {
|
|
114
|
+
className: "text-muted-foreground text-sm",
|
|
115
|
+
children: y("oauth.consent.asks", "This application asks to sign you in and to receive:")
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ p("ul", {
|
|
118
|
+
className: "flex flex-col gap-2 text-sm",
|
|
119
|
+
"data-testid": "oauth-consent-scopes",
|
|
120
|
+
children: (E.scopes ?? []).map((e) => /* @__PURE__ */ m("li", {
|
|
121
|
+
className: "flex items-center gap-2",
|
|
122
|
+
children: [/* @__PURE__ */ p(n.check, { size: 13 }), /* @__PURE__ */ p("span", {
|
|
123
|
+
className: e.includes(":") ? "font-mono" : void 0,
|
|
124
|
+
children: _(y, e)
|
|
125
|
+
})]
|
|
126
|
+
}, e))
|
|
127
|
+
}),
|
|
128
|
+
(E.withheld_scopes ?? []).length > 0 && /* @__PURE__ */ m("div", {
|
|
129
|
+
className: "text-muted-foreground text-xs",
|
|
130
|
+
"data-testid": "oauth-consent-withheld",
|
|
131
|
+
children: [/* @__PURE__ */ p("div", { children: y("oauth.consent.withheld", "It also asked for access you do not hold, which it will not receive:") }), /* @__PURE__ */ p("ul", {
|
|
132
|
+
className: "mt-1 flex flex-col gap-1 font-mono",
|
|
133
|
+
children: (E.withheld_scopes ?? []).map((e) => /* @__PURE__ */ p("li", { children: e }, e))
|
|
134
|
+
})]
|
|
135
|
+
}),
|
|
136
|
+
(E.resources ?? []).length > 0 && /* @__PURE__ */ m("div", {
|
|
137
|
+
className: "text-muted-foreground text-xs",
|
|
138
|
+
children: [/* @__PURE__ */ p("div", { children: y("oauth.consent.resources", "It may call:") }), /* @__PURE__ */ p("ul", {
|
|
139
|
+
className: "mt-1 flex flex-col gap-1 font-mono",
|
|
140
|
+
children: (E.resources ?? []).map((e) => /* @__PURE__ */ p("li", { children: e }, e))
|
|
141
|
+
})]
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ m("div", {
|
|
144
|
+
className: "flex gap-2",
|
|
145
|
+
children: [/* @__PURE__ */ p(t, {
|
|
146
|
+
size: "md",
|
|
147
|
+
className: "flex-1 justify-center",
|
|
148
|
+
disabled: A,
|
|
149
|
+
onClick: () => void M("deny"),
|
|
150
|
+
"data-testid": "oauth-consent-deny",
|
|
151
|
+
children: y("oauth.consent.deny", "Deny")
|
|
152
|
+
}), /* @__PURE__ */ p(t, {
|
|
153
|
+
kind: "primary",
|
|
154
|
+
size: "md",
|
|
155
|
+
className: "flex-1 justify-center",
|
|
156
|
+
disabled: A,
|
|
157
|
+
onClick: () => void M("approve"),
|
|
158
|
+
"data-testid": "oauth-consent-approve",
|
|
159
|
+
children: y("oauth.consent.approve", "Allow")
|
|
160
|
+
})]
|
|
161
|
+
})
|
|
162
|
+
] }) : /* @__PURE__ */ p("p", {
|
|
163
|
+
className: "text-muted-foreground text-sm",
|
|
164
|
+
children: y("oauth.consent.loading", "Checking the sign-in request…")
|
|
165
|
+
})]
|
|
166
|
+
}) });
|
|
167
|
+
}
|
|
168
|
+
export { y as OAuthConsent };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Suspense as e, lazy as t } from "react";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
// src/components/pages/auth/OAuthConsent.tsx
|
|
4
|
+
var r = t(() => import("./OAuthConsent.impl.js").then((e) => ({ default: e.OAuthConsent })));
|
|
5
|
+
function i() {
|
|
6
|
+
return /* @__PURE__ */ n(e, {
|
|
7
|
+
fallback: null,
|
|
8
|
+
children: /* @__PURE__ */ n(r, {})
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export { i as OAuthConsent };
|
|
@@ -7,75 +7,80 @@ import { Icon as s } from "../../primitives/Icons.js";
|
|
|
7
7
|
import { FieldLabel as c, PasswordInput as l, TextInput as u } from "../../primitives/Fields.js";
|
|
8
8
|
import { useAuth as d } from "../../../hooks/useAuth.js";
|
|
9
9
|
import { useSchema as f } from "../../../hooks/useSchema.js";
|
|
10
|
-
import {
|
|
10
|
+
import { ssoAuthorizeUrl as p, waitForLogout as m } from "../../../api/auth.js";
|
|
11
|
+
import { useSignInData as h } from "../../../hooks/useSignInData.js";
|
|
11
12
|
import { sanitizeRedirectPath as g } from "../../../api/auth-redirect.js";
|
|
12
13
|
import { accessibleRedirectPath as _ } from "../../../lib/schema-routing.js";
|
|
13
14
|
import { useText as v } from "../../../hooks/useText.js";
|
|
14
15
|
import { failureTitle as y } from "../../../lib/failure.js";
|
|
15
16
|
import { useEffect as b, useState as x } from "react";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { Link as E, useNavigate as D, useSearchParams as O } from "react-router";
|
|
17
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
18
|
+
import { Link as T, useNavigate as E, useSearchParams as D } from "react-router";
|
|
19
19
|
// src/components/pages/auth/SignIn.tsx
|
|
20
|
-
var
|
|
20
|
+
var O = "sso-failure", k = "password-failure", A = {
|
|
21
21
|
google: {
|
|
22
22
|
name: "Google",
|
|
23
|
-
icon: /* @__PURE__ */
|
|
23
|
+
icon: /* @__PURE__ */ C(i, { size: 14 })
|
|
24
24
|
},
|
|
25
25
|
microsoft: {
|
|
26
26
|
name: "Microsoft",
|
|
27
|
-
icon: /* @__PURE__ */
|
|
27
|
+
icon: /* @__PURE__ */ C(a, { size: 14 })
|
|
28
28
|
},
|
|
29
29
|
azure: {
|
|
30
30
|
name: "Microsoft",
|
|
31
|
-
icon: /* @__PURE__ */
|
|
31
|
+
icon: /* @__PURE__ */ C(a, { size: 14 })
|
|
32
32
|
},
|
|
33
33
|
github: {
|
|
34
34
|
name: "GitHub",
|
|
35
|
-
icon: /* @__PURE__ */
|
|
35
|
+
icon: /* @__PURE__ */ C(r, { size: 14 })
|
|
36
36
|
},
|
|
37
37
|
apple: {
|
|
38
38
|
name: "Apple",
|
|
39
|
-
icon: /* @__PURE__ */
|
|
39
|
+
icon: /* @__PURE__ */ C(s.shield, { size: 13 })
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
function
|
|
43
|
-
let r =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
function j() {
|
|
43
|
+
let r = E(), [i] = D(), { login: a, isLoginPending: j, isAuthenticated: N } = d(), { data: P } = f(), F = v(), [I, L] = x(""), [R, z] = x(""), [B, V] = x(null), H = j || B !== null, [U, W] = x(!0), G = g(i.get("next") || i.get("redirect")), K = i.get("sso_error"), q = v("errors");
|
|
44
|
+
b(() => {
|
|
45
|
+
if (B === null) return;
|
|
46
|
+
let e = !0, t = (e) => {
|
|
47
|
+
e.persisted && V(null);
|
|
48
|
+
};
|
|
49
|
+
return window.addEventListener("pageshow", t), m().then(() => {
|
|
50
|
+
e && (window.location.href = p(B, void 0, G));
|
|
51
|
+
}), () => {
|
|
52
|
+
e = !1, window.removeEventListener("pageshow", t);
|
|
53
|
+
};
|
|
54
|
+
}, [B, G]);
|
|
55
|
+
let { setupStatus: J, isSetupPending: Y, ssoProviders: X } = h();
|
|
51
56
|
if (b(() => {
|
|
52
|
-
|
|
53
|
-
}, [
|
|
54
|
-
if (!
|
|
55
|
-
let t = _(
|
|
56
|
-
|
|
57
|
+
J?.needs_setup && r("/signup", { replace: !0 });
|
|
58
|
+
}, [J, r]), b(() => {
|
|
59
|
+
if (!N || (e.dismiss(k), e.dismiss(O), !P)) return;
|
|
60
|
+
let t = _(G, P);
|
|
61
|
+
M(G, t) && e.warning(F("auth.inaccessible_redirect", "You do not have access to that page. We opened your default page instead.")), r(t, { replace: !0 });
|
|
57
62
|
}, [
|
|
58
|
-
|
|
63
|
+
N,
|
|
59
64
|
r,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
G,
|
|
66
|
+
P,
|
|
67
|
+
F
|
|
63
68
|
]), b(() => {
|
|
64
|
-
|
|
65
|
-
}, [
|
|
66
|
-
function
|
|
67
|
-
t.preventDefault(), a({
|
|
68
|
-
email:
|
|
69
|
-
password:
|
|
70
|
-
remember:
|
|
69
|
+
K && e.error(q(K, "Sign-in failed."), void 0, { id: O });
|
|
70
|
+
}, [q, K]), Y || J?.needs_setup) return /* @__PURE__ */ C(n, {});
|
|
71
|
+
function Z(t) {
|
|
72
|
+
t.preventDefault(), H || a({
|
|
73
|
+
email: I,
|
|
74
|
+
password: R,
|
|
75
|
+
remember: U
|
|
71
76
|
}, { onError: (t) => {
|
|
72
|
-
e.error(y(
|
|
77
|
+
e.error(y(q, t), void 0, { id: k });
|
|
73
78
|
} });
|
|
74
79
|
}
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
onSubmit:
|
|
80
|
+
return /* @__PURE__ */ C(t, { children: /* @__PURE__ */ w("form", {
|
|
81
|
+
onSubmit: Z,
|
|
77
82
|
children: [
|
|
78
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ C("div", {
|
|
79
84
|
style: {
|
|
80
85
|
fontSize: 10.5,
|
|
81
86
|
fontWeight: 700,
|
|
@@ -83,51 +88,52 @@ function M() {
|
|
|
83
88
|
letterSpacing: "0.1em",
|
|
84
89
|
textTransform: "uppercase"
|
|
85
90
|
},
|
|
86
|
-
children:
|
|
91
|
+
children: F("auth.signin.eyebrow", "Welcome back")
|
|
87
92
|
}),
|
|
88
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ C("h2", {
|
|
89
94
|
style: {
|
|
90
95
|
margin: "6px 0 4px",
|
|
91
96
|
fontSize: 24,
|
|
92
97
|
fontWeight: 600,
|
|
93
98
|
letterSpacing: "-0.018em"
|
|
94
99
|
},
|
|
95
|
-
children:
|
|
100
|
+
children: F("auth.signin.title", "Sign in")
|
|
96
101
|
}),
|
|
97
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ C("p", {
|
|
98
103
|
style: {
|
|
99
104
|
margin: "0 0 20px",
|
|
100
105
|
fontSize: 13,
|
|
101
106
|
color: "var(--text-3)"
|
|
102
107
|
},
|
|
103
|
-
children:
|
|
108
|
+
children: F("auth.signin.subtitle", "Use your corporate SSO or email & password.")
|
|
104
109
|
}),
|
|
105
|
-
|
|
110
|
+
X && X.length > 0 && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", {
|
|
106
111
|
style: {
|
|
107
112
|
display: "flex",
|
|
108
113
|
flexDirection: "column",
|
|
109
114
|
gap: 6,
|
|
110
115
|
marginBottom: 12
|
|
111
116
|
},
|
|
112
|
-
children:
|
|
113
|
-
let t =
|
|
117
|
+
children: X.map((e) => {
|
|
118
|
+
let t = A[e.slug.toLowerCase()] ?? {
|
|
114
119
|
name: e.name,
|
|
115
|
-
icon: /* @__PURE__ */
|
|
120
|
+
icon: /* @__PURE__ */ C(s.shield, { size: 13 })
|
|
116
121
|
};
|
|
117
|
-
return /* @__PURE__ */
|
|
122
|
+
return /* @__PURE__ */ C(o, {
|
|
118
123
|
size: "md",
|
|
119
124
|
style: {
|
|
120
125
|
justifyContent: "center",
|
|
121
126
|
width: "100%"
|
|
122
127
|
},
|
|
123
128
|
icon: t.icon,
|
|
129
|
+
disabled: H,
|
|
124
130
|
onClick: (t) => {
|
|
125
|
-
t.preventDefault(),
|
|
131
|
+
t.preventDefault(), V(e.slug);
|
|
126
132
|
},
|
|
127
|
-
children:
|
|
133
|
+
children: F("auth.signin.sso_continue", "Continue with {provider}", { provider: t.name })
|
|
128
134
|
}, e.slug);
|
|
129
135
|
})
|
|
130
|
-
}), /* @__PURE__ */
|
|
136
|
+
}), /* @__PURE__ */ w("div", {
|
|
131
137
|
style: {
|
|
132
138
|
display: "flex",
|
|
133
139
|
alignItems: "center",
|
|
@@ -135,51 +141,51 @@ function M() {
|
|
|
135
141
|
margin: "16px 0"
|
|
136
142
|
},
|
|
137
143
|
children: [
|
|
138
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ C("span", { style: {
|
|
139
145
|
flex: 1,
|
|
140
146
|
height: 1,
|
|
141
147
|
background: "var(--divider)"
|
|
142
148
|
} }),
|
|
143
|
-
/* @__PURE__ */
|
|
149
|
+
/* @__PURE__ */ C("span", {
|
|
144
150
|
style: {
|
|
145
151
|
fontSize: 10.5,
|
|
146
152
|
color: "var(--text-4)",
|
|
147
153
|
letterSpacing: "0.08em",
|
|
148
154
|
textTransform: "uppercase"
|
|
149
155
|
},
|
|
150
|
-
children:
|
|
156
|
+
children: F("auth.signin.sso_divider", "or with email")
|
|
151
157
|
}),
|
|
152
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ C("span", { style: {
|
|
153
159
|
flex: 1,
|
|
154
160
|
height: 1,
|
|
155
161
|
background: "var(--divider)"
|
|
156
162
|
} })
|
|
157
163
|
]
|
|
158
164
|
})] }),
|
|
159
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ w("div", {
|
|
160
166
|
style: {
|
|
161
167
|
display: "flex",
|
|
162
168
|
flexDirection: "column",
|
|
163
169
|
gap: 12
|
|
164
170
|
},
|
|
165
171
|
children: [
|
|
166
|
-
/* @__PURE__ */
|
|
167
|
-
value:
|
|
168
|
-
onChange:
|
|
169
|
-
prefix: /* @__PURE__ */
|
|
170
|
-
placeholder:
|
|
172
|
+
/* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C(c, { children: F("auth.field.email", "Email") }), /* @__PURE__ */ C(u, {
|
|
173
|
+
value: I,
|
|
174
|
+
onChange: L,
|
|
175
|
+
prefix: /* @__PURE__ */ C(s.email, { size: 13 }),
|
|
176
|
+
placeholder: F("auth.field.email_placeholder", "you@company.com"),
|
|
171
177
|
autoFocus: !0,
|
|
172
178
|
required: !0
|
|
173
179
|
})] }),
|
|
174
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ w("div", { children: [/* @__PURE__ */ w("div", {
|
|
175
181
|
style: {
|
|
176
182
|
display: "flex",
|
|
177
183
|
alignItems: "center"
|
|
178
184
|
},
|
|
179
185
|
children: [
|
|
180
|
-
/* @__PURE__ */
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ C(c, { children: F("auth.field.password", "Password") }),
|
|
187
|
+
/* @__PURE__ */ C("div", { style: { flex: 1 } }),
|
|
188
|
+
/* @__PURE__ */ C(T, {
|
|
183
189
|
to: "/forgot",
|
|
184
190
|
style: {
|
|
185
191
|
fontSize: 11,
|
|
@@ -187,15 +193,15 @@ function M() {
|
|
|
187
193
|
marginBottom: 4,
|
|
188
194
|
textDecoration: "none"
|
|
189
195
|
},
|
|
190
|
-
children:
|
|
196
|
+
children: F("auth.signin.forgot_link", "Forgot?")
|
|
191
197
|
})
|
|
192
198
|
]
|
|
193
|
-
}), /* @__PURE__ */
|
|
194
|
-
value:
|
|
195
|
-
onChange:
|
|
196
|
-
placeholder:
|
|
199
|
+
}), /* @__PURE__ */ C(l, {
|
|
200
|
+
value: R,
|
|
201
|
+
onChange: z,
|
|
202
|
+
placeholder: F("auth.signin.password_placeholder", "Your password")
|
|
197
203
|
})] }),
|
|
198
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ w("label", {
|
|
199
205
|
style: {
|
|
200
206
|
display: "flex",
|
|
201
207
|
alignItems: "center",
|
|
@@ -204,17 +210,17 @@ function M() {
|
|
|
204
210
|
color: "var(--text-2)"
|
|
205
211
|
},
|
|
206
212
|
children: [
|
|
207
|
-
/* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ C("input", {
|
|
208
214
|
type: "checkbox",
|
|
209
215
|
name: "remember",
|
|
210
|
-
checked:
|
|
211
|
-
onChange: (e) =>
|
|
216
|
+
checked: U,
|
|
217
|
+
onChange: (e) => W(e.target.checked)
|
|
212
218
|
}),
|
|
213
219
|
" ",
|
|
214
|
-
|
|
220
|
+
F("auth.signin.remember", "Keep me signed in on this device")
|
|
215
221
|
]
|
|
216
222
|
}),
|
|
217
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ C(o, {
|
|
218
224
|
type: "submit",
|
|
219
225
|
size: "md",
|
|
220
226
|
kind: "primary",
|
|
@@ -222,10 +228,10 @@ function M() {
|
|
|
222
228
|
justifyContent: "center",
|
|
223
229
|
width: "100%"
|
|
224
230
|
},
|
|
225
|
-
disabled:
|
|
226
|
-
children:
|
|
231
|
+
disabled: H,
|
|
232
|
+
children: j ? F("auth.signin.submitting", "Signing in…") : F("auth.signin.submit", "Continue")
|
|
227
233
|
}),
|
|
228
|
-
|
|
234
|
+
J?.signup_enabled && /* @__PURE__ */ w("div", {
|
|
229
235
|
style: {
|
|
230
236
|
fontSize: 12,
|
|
231
237
|
color: "var(--text-3)",
|
|
@@ -233,16 +239,16 @@ function M() {
|
|
|
233
239
|
marginTop: 4
|
|
234
240
|
},
|
|
235
241
|
children: [
|
|
236
|
-
|
|
242
|
+
F("auth.signin.new_here", "New here?"),
|
|
237
243
|
" ",
|
|
238
|
-
/* @__PURE__ */
|
|
244
|
+
/* @__PURE__ */ C(T, {
|
|
239
245
|
to: "/signup",
|
|
240
246
|
style: {
|
|
241
247
|
color: "var(--accent-text)",
|
|
242
248
|
fontWeight: 500,
|
|
243
249
|
textDecoration: "none"
|
|
244
250
|
},
|
|
245
|
-
children:
|
|
251
|
+
children: F("auth.signin.request_access", "Create an account")
|
|
246
252
|
})
|
|
247
253
|
]
|
|
248
254
|
})
|
|
@@ -251,9 +257,9 @@ function M() {
|
|
|
251
257
|
]
|
|
252
258
|
}) });
|
|
253
259
|
}
|
|
254
|
-
function
|
|
260
|
+
function M(e, t) {
|
|
255
261
|
if (e === t) return !1;
|
|
256
262
|
let n = e.split(/[?#]/, 1)[0].replace(/\/+$/, "") || "/";
|
|
257
263
|
return n !== "/" && n !== "/admin";
|
|
258
264
|
}
|
|
259
|
-
export {
|
|
265
|
+
export { j as SignIn };
|
|
@@ -7,7 +7,7 @@ import { FieldLabel as a, PasswordInput as o, TextInput as s } from "../../primi
|
|
|
7
7
|
import { useAuth as c } from "../../../hooks/useAuth.js";
|
|
8
8
|
import { usePublicParams as l } from "../../../hooks/useParams.js";
|
|
9
9
|
import { useResponsiveMode as u } from "../../../hooks/useResponsiveMode.js";
|
|
10
|
-
import {
|
|
10
|
+
import { setupQueryOptions as d } from "../../../hooks/useSignInData.js";
|
|
11
11
|
import { SignUpCode as f } from "./SignUpCode.js";
|
|
12
12
|
import { getBrandingIdentity as p } from "../../../lib/branding.js";
|
|
13
13
|
import { textWithNodes as m } from "../../../lib/language.js";
|
|
@@ -17,10 +17,7 @@ import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
|
17
17
|
import { Link as b, useNavigate as x } from "react-router";
|
|
18
18
|
// src/components/pages/auth/SignUp.impl.tsx
|
|
19
19
|
function S() {
|
|
20
|
-
let m = x(), { signup: S, isSignupPending: w, isAuthenticated: T } = c(), [E, D] = g(null), O = u(), k = n(), [A, j] = g(""), [M, N] = g(""), [P, F] = g(""), [I, L] = g(""), [R, z] = g(!1), { data: B } = l(), V = p(B), H = V?.legal_links?.terms_url ?? "", U = V?.legal_links?.privacy_url ?? "", W = O.isPhone, { data: G, isPending: K } = _(
|
|
21
|
-
queryKey: ["check-setup"],
|
|
22
|
-
queryFn: d
|
|
23
|
-
}), q = G?.needs_setup || G?.signup_enabled;
|
|
20
|
+
let m = x(), { signup: S, isSignupPending: w, isAuthenticated: T } = c(), [E, D] = g(null), O = u(), k = n(), [A, j] = g(""), [M, N] = g(""), [P, F] = g(""), [I, L] = g(""), [R, z] = g(!1), { data: B } = l(), V = p(B), H = V?.legal_links?.terms_url ?? "", U = V?.legal_links?.privacy_url ?? "", W = O.isPhone, { data: G, isPending: K } = _(d), q = G?.needs_setup || G?.signup_enabled;
|
|
24
21
|
if (h(() => {
|
|
25
22
|
G && !q && m("/login", { replace: !0 });
|
|
26
23
|
}, [
|
|
@@ -180,6 +180,7 @@ function T({ param: e, value: t, onChange: n }) {
|
|
|
180
180
|
let r = d(), i = {
|
|
181
181
|
type: e.type,
|
|
182
182
|
structure: e.structure,
|
|
183
|
+
array: e.array,
|
|
183
184
|
values: e.values,
|
|
184
185
|
ref: e.ref
|
|
185
186
|
};
|
|
@@ -193,7 +194,7 @@ function T({ param: e, value: t, onChange: n }) {
|
|
|
193
194
|
}) });
|
|
194
195
|
}
|
|
195
196
|
function E(e, t) {
|
|
196
|
-
return e.type === "bool" ? t === !0 : e.type === "structure" ? t ?? {} : t ?? null;
|
|
197
|
+
return e.type === "bool" ? t === !0 : e.type === "structure" ? t ?? (e.array ? [] : {}) : t ?? null;
|
|
197
198
|
}
|
|
198
199
|
function D(e, t) {
|
|
199
200
|
if (t == null) throw Error(e("params.value.required", "Enter a value."));
|