@lumoauth/react 1.4.1 → 1.5.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/index.js CHANGED
@@ -52,6 +52,32 @@ var import_client4 = require("@lumoauth/client");
52
52
 
53
53
  // src/provider.tsx
54
54
  var import_react = require("react");
55
+
56
+ // src/utils/magicLink.ts
57
+ var MAGIC_LINK_CONTINUE_PARAM = "lumoauth_continue";
58
+ var MAGIC_LINK_RETURN_TO_MAX = 1024;
59
+ function defaultMagicLinkReturnTo(href) {
60
+ const page = new URL(href);
61
+ page.hash = "";
62
+ page.searchParams.set(MAGIC_LINK_CONTINUE_PARAM, "1");
63
+ if (page.href.length <= MAGIC_LINK_RETURN_TO_MAX) {
64
+ return page.href;
65
+ }
66
+ const withoutQuery = new URL(page.origin + page.pathname);
67
+ withoutQuery.searchParams.set(MAGIC_LINK_CONTINUE_PARAM, "1");
68
+ if (withoutQuery.href.length <= MAGIC_LINK_RETURN_TO_MAX) {
69
+ return withoutQuery.href;
70
+ }
71
+ return `${page.origin}/?${MAGIC_LINK_CONTINUE_PARAM}=1`;
72
+ }
73
+ function takeMagicLinkContinue(href) {
74
+ const page = new URL(href);
75
+ const found = page.searchParams.has(MAGIC_LINK_CONTINUE_PARAM);
76
+ page.searchParams.delete(MAGIC_LINK_CONTINUE_PARAM);
77
+ return { found, cleanUrl: `${page.pathname}${page.search}${page.hash}` };
78
+ }
79
+
80
+ // src/provider.tsx
55
81
  var import_client = require("@lumoauth/client");
56
82
  var import_client2 = require("@lumoauth/client");
57
83
 
@@ -71,36 +97,7 @@ function injectStyles() {
71
97
  document.head.appendChild(style);
72
98
  injected = true;
73
99
  }
74
- var CSS_CONTENT = `
75
- /* \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
76
- @lumoauth/react \u2014 Self-contained component styles
77
- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
78
-
79
- :root {
80
- --la-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
81
- --la-font-size-sm: 0.8125rem;
82
- --la-font-size-base: 0.875rem;
83
- --la-font-size-lg: 1rem;
84
- --la-font-size-xl: 1.25rem;
85
- --la-font-size-2xl: 1.5rem;
86
- --la-font-weight-normal: 400;
87
- --la-font-weight-medium: 500;
88
- --la-font-weight-semibold: 600;
89
-
90
- --la-radius-sm: 6px;
91
- --la-radius-md: 8px;
92
- --la-radius-lg: 12px;
93
- --la-radius-xl: 16px;
94
- --la-radius-full: 9999px;
95
-
96
- --la-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
97
- --la-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
98
- --la-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
99
- --la-shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
100
-
101
- --la-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
102
-
103
- /* Light theme (default) */
100
+ var LIGHT_THEME = `
104
101
  --la-bg: #ffffff;
105
102
  --la-bg-subtle: #f8f9fb;
106
103
  --la-bg-muted: #f1f3f5;
@@ -120,11 +117,13 @@ var CSS_CONTENT = `
120
117
  --la-link: #7c5cfc;
121
118
  --la-overlay: rgba(0,0,0,0.5);
122
119
  --la-card-shadow: var(--la-shadow-xl);
123
- }
124
-
125
- /* Dark theme */
126
- [data-lumoauth-theme="dark"],
127
- .la-dark {
120
+ --la-badge-success-bg: #dcfce7;
121
+ --la-badge-success-text: #166534;
122
+ --la-badge-warning-bg: #fef9c3;
123
+ --la-badge-warning-text: #854d0e;
124
+ --la-badge-muted-bg: var(--la-bg-muted);
125
+ `;
126
+ var DARK_THEME = `
128
127
  --la-bg: #1a1a2e;
129
128
  --la-bg-subtle: #16213e;
130
129
  --la-bg-muted: #0f3460;
@@ -144,32 +143,71 @@ var CSS_CONTENT = `
144
143
  --la-link: #9d85f7;
145
144
  --la-overlay: rgba(0,0,0,0.7);
146
145
  --la-card-shadow: 0 20px 25px -5px rgba(0,0,0,0.3), 0 10px 10px -5px rgba(0,0,0,0.2);
146
+ --la-badge-success-bg: rgba(22, 163, 74, 0.15);
147
+ --la-badge-success-text: #4ade80;
148
+ --la-badge-warning-bg: rgba(234, 179, 8, 0.15);
149
+ --la-badge-warning-text: #facc15;
150
+ --la-badge-muted-bg: rgba(255, 255, 255, 0.08);
151
+ `;
152
+ var CSS_CONTENT = `
153
+ /* \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
154
+ @lumoauth/react \u2014 Self-contained component styles
155
+ \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
156
+
157
+ :root {
158
+ --la-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
159
+ --la-font-size-sm: 0.8125rem;
160
+ --la-font-size-base: 0.875rem;
161
+ --la-font-size-lg: 1rem;
162
+ --la-font-size-xl: 1.25rem;
163
+ --la-font-size-2xl: 1.5rem;
164
+ --la-font-weight-normal: 400;
165
+ --la-font-weight-medium: 500;
166
+ --la-font-weight-semibold: 600;
167
+
168
+ --la-radius-sm: 6px;
169
+ --la-radius-md: 8px;
170
+ --la-radius-lg: 12px;
171
+ --la-radius-xl: 16px;
172
+ --la-radius-full: 9999px;
173
+
174
+ --la-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
175
+ --la-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
176
+ --la-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
177
+ --la-shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
178
+
179
+ --la-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
180
+ }
181
+
182
+ /*
183
+ * Colours. Three ways choose the theme, from weakest to strongest:
184
+ *
185
+ * 1. the operating system (prefers-color-scheme), when nothing else is set;
186
+ * 2. a class or attribute on an ancestor or on the component itself:
187
+ * .la-light / .la-dark, or data-lumoauth-theme="light" | "dark"
188
+ * (the appearance.theme prop sets the class on the component);
189
+ * 3. appearance.variables, which is inline style on the component.
190
+ *
191
+ * The light values are repeated under .la-light so that a component can be
192
+ * light on a page that the operating system made dark.
193
+ */
194
+ :root,
195
+ .la-light,
196
+ [data-lumoauth-theme="light"] {
197
+ ${LIGHT_THEME}
147
198
  }
148
199
 
149
200
  @media (prefers-color-scheme: dark) {
150
201
  :root:not([data-lumoauth-theme="light"]):not(.la-light) {
151
- --la-bg: #1a1a2e;
152
- --la-bg-subtle: #16213e;
153
- --la-bg-muted: #0f3460;
154
- --la-bg-hover: #1a3a6a;
155
- --la-border: #2a2a4a;
156
- --la-border-focus: #9d85f7;
157
- --la-text: #e8e8f0;
158
- --la-text-secondary: #a0a0b8;
159
- --la-text-muted: #6a6a88;
160
- --la-primary: #9d85f7;
161
- --la-primary-hover: #b39dff;
162
- --la-primary-text: #1a1a2e;
163
- --la-danger: #ff6b6b;
164
- --la-danger-bg: #2d1b1b;
165
- --la-success: #51cf66;
166
- --la-success-bg: #1b2d1b;
167
- --la-link: #9d85f7;
168
- --la-overlay: rgba(0,0,0,0.7);
169
- --la-card-shadow: 0 20px 25px -5px rgba(0,0,0,0.3), 0 10px 10px -5px rgba(0,0,0,0.2);
202
+ ${DARK_THEME}
170
203
  }
171
204
  }
172
205
 
206
+ .la-dark,
207
+ [data-lumoauth-theme="dark"] {
208
+ ${DARK_THEME}
209
+ }
210
+
173
211
  /* \u2500\u2500\u2500 Card Container \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
174
212
 
175
213
  .la-card {
@@ -659,7 +697,7 @@ var CSS_CONTENT = `
659
697
  justify-content: center;
660
698
  font-family: var(--la-font-family);
661
699
  font-weight: var(--la-font-weight-semibold);
662
- color: #fff;
700
+ color: var(--la-primary-text);
663
701
  background: var(--la-primary);
664
702
  overflow: hidden;
665
703
  flex-shrink: 0;
@@ -683,6 +721,9 @@ var CSS_CONTENT = `
683
721
 
684
722
  /* \u2500\u2500\u2500 UserProfile Card \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
685
723
 
724
+ /* --la-text-primary is an optional override that older apps set. It has no
725
+ default: the text colour is --la-text. */
726
+
686
727
  .la-profile-card {
687
728
  max-width: 420px;
688
729
  }
@@ -716,7 +757,7 @@ var CSS_CONTENT = `
716
757
  .la-profile-name {
717
758
  font-size: var(--la-font-size-lg);
718
759
  font-weight: var(--la-font-weight-semibold);
719
- color: var(--la-text-primary);
760
+ color: var(--la-text-primary, var(--la-text));
720
761
  line-height: 1.3;
721
762
  overflow: hidden;
722
763
  text-overflow: ellipsis;
@@ -750,7 +791,7 @@ var CSS_CONTENT = `
750
791
  gap: 0.625rem;
751
792
  padding: 0.5rem 0;
752
793
  font-size: var(--la-font-size-base);
753
- color: var(--la-text-primary);
794
+ color: var(--la-text-primary, var(--la-text));
754
795
  }
755
796
 
756
797
  .la-profile-row svg {
@@ -784,32 +825,17 @@ var CSS_CONTENT = `
784
825
  }
785
826
 
786
827
  .la-badge-success {
787
- background: #dcfce7;
788
- color: #166534;
828
+ background: var(--la-badge-success-bg);
829
+ color: var(--la-badge-success-text);
789
830
  }
790
831
 
791
832
  .la-badge-warning {
792
- background: #fef9c3;
793
- color: #854d0e;
833
+ background: var(--la-badge-warning-bg);
834
+ color: var(--la-badge-warning-text);
794
835
  }
795
836
 
796
837
  .la-badge-muted {
797
- background: var(--la-bg-muted);
798
- color: var(--la-text-secondary);
799
- }
800
-
801
- .la-dark .la-badge-success {
802
- background: rgba(22, 163, 74, 0.15);
803
- color: #4ade80;
804
- }
805
-
806
- .la-dark .la-badge-warning {
807
- background: rgba(234, 179, 8, 0.15);
808
- color: #facc15;
809
- }
810
-
811
- .la-dark .la-badge-muted {
812
- background: rgba(255, 255, 255, 0.08);
838
+ background: var(--la-badge-muted-bg);
813
839
  color: var(--la-text-secondary);
814
840
  }
815
841
 
@@ -848,7 +874,7 @@ var CSS_CONTENT = `
848
874
  .la-btn-outline {
849
875
  background: transparent;
850
876
  border: 1px solid var(--la-border);
851
- color: var(--la-text-primary);
877
+ color: var(--la-text-primary, var(--la-text));
852
878
  padding: 0.625rem 1rem;
853
879
  border-radius: var(--la-radius-md);
854
880
  font-size: var(--la-font-size-base);
@@ -951,6 +977,7 @@ function LumoAuthProvider({
951
977
  const [user, setUser] = (0, import_react.useState)(null);
952
978
  const tokensRef = (0, import_react.useRef)({ accessToken: null, refreshToken: null, expiresAt: null, idToken: null });
953
979
  const callbackHandledRef = (0, import_react.useRef)(false);
980
+ const magicLinkContinueRef = (0, import_react.useRef)(false);
954
981
  const callbackInflightRef = (0, import_react.useRef)(null);
955
982
  (0, import_react.useEffect)(() => {
956
983
  injectStyles();
@@ -1150,8 +1177,12 @@ function LumoAuthProvider({
1150
1177
  `Inline registration is not supported by this LumoAuth server: there is no JSON registration endpoint. Use redirectToSignUp() to send the user to the hosted registration page (${domain.replace(/\/+$/, "")}/orgs/${encodeURIComponent(orgId)}/register), or set authStrategy: "pkce".`
1151
1178
  );
1152
1179
  }, [authStrategy, domain, orgId, clientId, resolvedRedirectUri, scope, signIn]);
1153
- const sendMagicLink = (0, import_react.useCallback)(async (email, redirectUri2) => {
1154
- await authModule.requestMagicLink({ email, redirectUri: redirectUri2 });
1180
+ const sendMagicLink = (0, import_react.useCallback)(async (email, returnTo, options) => {
1181
+ const target = returnTo ?? (typeof window !== "undefined" ? defaultMagicLinkReturnTo(window.location.href) : void 0);
1182
+ const result = await authModule.requestMagicLink({ email, returnTo: target, captchaToken: options?.captchaToken });
1183
+ if (!result.sent) {
1184
+ throw new Error("The sign-in link request was not accepted.");
1185
+ }
1155
1186
  }, [authModule]);
1156
1187
  const checkEmail = (0, import_react.useCallback)(
1157
1188
  (email) => authModule.checkEmailExists(email),
@@ -1179,7 +1210,7 @@ function LumoAuthProvider({
1179
1210
  params.set("id_token_hint", idToken);
1180
1211
  }
1181
1212
  const logoutUrl = `${domain.replace(/\/+$/, "")}/orgs/${safeOrgId}/api/v1/oauth/logout?${params.toString()}`;
1182
- if (accessToken) {
1213
+ if (accessToken && !storage?.serverManaged) {
1183
1214
  authModule.revokeToken(accessToken, accessToken).catch(() => {
1184
1215
  });
1185
1216
  }
@@ -1188,11 +1219,16 @@ function LumoAuthProvider({
1188
1219
  window.location.replace(logoutUrl);
1189
1220
  await new Promise(() => {
1190
1221
  });
1191
- }, [authModule, domain, orgId, afterSignOutUrl, session, dispatch]);
1222
+ }, [authModule, domain, orgId, afterSignOutUrl, session, storage, dispatch]);
1192
1223
  (0, import_react.useEffect)(() => {
1193
1224
  let cancelled = false;
1194
1225
  async function init() {
1195
1226
  if (typeof window === "undefined") return;
1227
+ const back = takeMagicLinkContinue(window.location.href);
1228
+ if (back.found) {
1229
+ magicLinkContinueRef.current = true;
1230
+ window.history.replaceState(window.history.state, "", back.cleanUrl);
1231
+ }
1196
1232
  const params = new URLSearchParams(window.location.search);
1197
1233
  const code = params.get("code");
1198
1234
  const returnedState = params.get("state");
@@ -1215,13 +1251,19 @@ function LumoAuthProvider({
1215
1251
  }
1216
1252
  }
1217
1253
  }
1218
- init().then(() => {
1219
- if (!cancelled) void session.hydrate();
1254
+ init().then(async () => {
1255
+ if (cancelled) return;
1256
+ await session.hydrate();
1257
+ if (cancelled || !magicLinkContinueRef.current) return;
1258
+ magicLinkContinueRef.current = false;
1259
+ if (!session.getSnapshot().isSignedIn) {
1260
+ signInWithRedirect();
1261
+ }
1220
1262
  });
1221
1263
  return () => {
1222
1264
  cancelled = true;
1223
1265
  };
1224
- }, [fetchUser, handleCallback, refreshAccessToken, session]);
1266
+ }, [fetchUser, handleCallback, refreshAccessToken, session, signInWithRedirect]);
1225
1267
  (0, import_react.useEffect)(() => {
1226
1268
  let cancelled = false;
1227
1269
  if (!sessionState.isSignedIn) {
@@ -1928,11 +1970,12 @@ function UserAvatar({
1928
1970
  appearance
1929
1971
  }) {
1930
1972
  const { user, isSignedIn } = useLumoAuthContext();
1973
+ const themeClass = appearance?.theme === "dark" ? "la-dark" : appearance?.theme === "light" ? "la-light" : "";
1931
1974
  if (!isSignedIn || !user) {
1932
1975
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1933
1976
  "span",
1934
1977
  {
1935
- className: `la-avatar la-avatar-${shape} ${appearance?.className || ""}`,
1978
+ className: `la-avatar la-avatar-${shape} ${themeClass} ${appearance?.className || ""}`,
1936
1979
  style: {
1937
1980
  width: size,
1938
1981
  height: size,
@@ -1947,7 +1990,6 @@ function UserAvatar({
1947
1990
  );
1948
1991
  }
1949
1992
  const initials = [user.firstName, user.lastName].filter(Boolean).map((n) => n.charAt(0).toUpperCase()).join("") || user.email.charAt(0).toUpperCase();
1950
- const themeClass = appearance?.theme === "dark" ? "la-dark" : appearance?.theme === "light" ? "la-light" : "";
1951
1993
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1952
1994
  "span",
1953
1995
  {
@@ -1996,6 +2038,9 @@ var ICONS = {
1996
2038
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: "21", y1: "12", x2: "9", y2: "12" })
1997
2039
  ] })
1998
2040
  };
2041
+ function hasMfaStatus(user) {
2042
+ return typeof user.claims?.mfa_enabled === "boolean";
2043
+ }
1999
2044
  function UserProfile({
2000
2045
  afterSignOutUrl,
2001
2046
  mode = "full",
@@ -2047,7 +2092,7 @@ function UserProfile({
2047
2092
  ] })
2048
2093
  ] }),
2049
2094
  mode === "full" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
2050
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "la-profile-section", children: [
2095
+ hasMfaStatus(user) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "la-profile-section", children: [
2051
2096
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "la-profile-section-title", children: "Security" }),
2052
2097
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "la-profile-row", children: [
2053
2098
  ICONS.shield,
@@ -2227,14 +2272,19 @@ function useMagicLink() {
2227
2272
  const [isLoading, setIsLoading] = (0, import_react7.useState)(false);
2228
2273
  const [isSent, setIsSent] = (0, import_react7.useState)(false);
2229
2274
  const [error, setError] = (0, import_react7.useState)(null);
2230
- const sendMagicLink = (0, import_react7.useCallback)(async (email, redirectUri) => {
2275
+ const [errorCode, setErrorCode] = (0, import_react7.useState)(null);
2276
+ const sendMagicLink = (0, import_react7.useCallback)(async (email, returnTo, options) => {
2231
2277
  setIsLoading(true);
2278
+ setIsSent(false);
2232
2279
  setError(null);
2280
+ setErrorCode(null);
2233
2281
  try {
2234
- await sendMagicLinkCtx(email, redirectUri);
2282
+ await sendMagicLinkCtx(email, returnTo, options);
2235
2283
  setIsSent(true);
2236
2284
  } catch (err) {
2237
2285
  setError(err instanceof Error ? err.message : "Failed to send magic link");
2286
+ const code = err?.code;
2287
+ setErrorCode(typeof code === "string" ? code : null);
2238
2288
  } finally {
2239
2289
  setIsLoading(false);
2240
2290
  }
@@ -2242,9 +2292,10 @@ function useMagicLink() {
2242
2292
  const reset = (0, import_react7.useCallback)(() => {
2243
2293
  setIsSent(false);
2244
2294
  setError(null);
2295
+ setErrorCode(null);
2245
2296
  setIsLoading(false);
2246
2297
  }, []);
2247
- return { sendMagicLink, isLoading, isSent, error, reset };
2298
+ return { sendMagicLink, isLoading, isSent, error, errorCode, reset };
2248
2299
  }
2249
2300
  function useEmailFirst() {
2250
2301
  const { checkEmail: checkEmailCtx } = useLumoAuthContext();