@clerk/react 6.9.0 → 6.9.1-canary.v20260610190754

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.
Files changed (75) hide show
  1. package/dist/ClerkProvider-9lxHp9j5.cjs +1623 -0
  2. package/dist/ClerkProvider-9lxHp9j5.cjs.map +1 -0
  3. package/dist/ClerkProvider-LQpPtmNL.mjs +1533 -0
  4. package/dist/ClerkProvider-LQpPtmNL.mjs.map +1 -0
  5. package/dist/errors.cjs +69 -0
  6. package/dist/errors.d.cts +2 -0
  7. package/dist/errors.d.mts +2 -1
  8. package/dist/errors.mjs +2 -29
  9. package/dist/experimental.cjs +270 -0
  10. package/dist/experimental.cjs.map +1 -0
  11. package/dist/{experimental.d.ts → experimental.d.cts} +18 -18
  12. package/dist/experimental.d.mts +18 -18
  13. package/dist/experimental.mjs +201 -165
  14. package/dist/experimental.mjs.map +1 -1
  15. package/dist/hooks-BiY5Zgpp.mjs +1369 -0
  16. package/dist/hooks-BiY5Zgpp.mjs.map +1 -0
  17. package/dist/hooks-CBghYU21.cjs +1606 -0
  18. package/dist/hooks-CBghYU21.cjs.map +1 -0
  19. package/dist/index.cjs +447 -0
  20. package/dist/index.cjs.map +1 -0
  21. package/dist/index.d.cts +345 -0
  22. package/dist/index.d.mts +183 -157
  23. package/dist/index.mjs +285 -380
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/internal.cjs +107 -0
  26. package/dist/internal.cjs.map +1 -0
  27. package/dist/internal.d.cts +51 -0
  28. package/dist/internal.d.mts +24 -26
  29. package/dist/internal.mjs +39 -73
  30. package/dist/internal.mjs.map +1 -1
  31. package/dist/legacy.cjs +134 -0
  32. package/dist/legacy.cjs.map +1 -0
  33. package/dist/{legacy.d.ts → legacy.d.cts} +6 -3
  34. package/dist/legacy.d.mts +6 -3
  35. package/dist/legacy.mjs +126 -42
  36. package/dist/legacy.mjs.map +1 -1
  37. package/dist/types-Bwenmt7y.d.cts +10951 -0
  38. package/dist/types-CiIhevkA.d.mts +10951 -0
  39. package/dist/types.cjs +0 -0
  40. package/dist/types.d.cts +3 -0
  41. package/dist/types.d.mts +3 -109
  42. package/dist/types.mjs +1 -2
  43. package/dist/useAssertWrappedByClerkProvider-Cm0djUcB.cjs +52 -0
  44. package/dist/useAssertWrappedByClerkProvider-Cm0djUcB.cjs.map +1 -0
  45. package/dist/useAssertWrappedByClerkProvider-GaNwZpWo.mjs +29 -0
  46. package/dist/useAssertWrappedByClerkProvider-GaNwZpWo.mjs.map +1 -0
  47. package/dist/{useAuth-Dlg_G1_7.d.mts → useAuth-BK5Y4htK.d.mts} +58 -39
  48. package/dist/{useAuth-Cv6iRjL9.d.ts → useAuth-BMxaWktj.d.cts} +58 -39
  49. package/package.json +18 -18
  50. package/dist/chunk-E5QRIS4Z.mjs +0 -20
  51. package/dist/chunk-E5QRIS4Z.mjs.map +0 -1
  52. package/dist/chunk-FQVXBXXF.mjs +0 -1487
  53. package/dist/chunk-FQVXBXXF.mjs.map +0 -1
  54. package/dist/chunk-GVGS7DUS.mjs +0 -2097
  55. package/dist/chunk-GVGS7DUS.mjs.map +0 -1
  56. package/dist/chunk-RQWALB2R.mjs +0 -26
  57. package/dist/chunk-RQWALB2R.mjs.map +0 -1
  58. package/dist/errors.d.ts +0 -1
  59. package/dist/errors.js +0 -51
  60. package/dist/errors.js.map +0 -1
  61. package/dist/errors.mjs.map +0 -1
  62. package/dist/experimental.js +0 -1505
  63. package/dist/experimental.js.map +0 -1
  64. package/dist/index.d.ts +0 -319
  65. package/dist/index.js +0 -3919
  66. package/dist/index.js.map +0 -1
  67. package/dist/internal.d.ts +0 -53
  68. package/dist/internal.js +0 -3339
  69. package/dist/internal.js.map +0 -1
  70. package/dist/legacy.js +0 -90
  71. package/dist/legacy.js.map +0 -1
  72. package/dist/types.d.ts +0 -109
  73. package/dist/types.js +0 -19
  74. package/dist/types.js.map +0 -1
  75. package/dist/types.mjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,396 +1,301 @@
1
- import {
2
- AuthenticateWithRedirectCallback,
3
- ClerkDegraded,
4
- ClerkFailed,
5
- ClerkLoaded,
6
- ClerkLoading,
7
- ClerkProvider,
8
- RedirectToCreateOrganization,
9
- RedirectToOrganizationProfile,
10
- RedirectToSignIn,
11
- RedirectToSignUp,
12
- RedirectToTasks,
13
- RedirectToUserProfile,
14
- Show
15
- } from "./chunk-GVGS7DUS.mjs";
16
- import {
17
- APIKeys,
18
- CreateOrganization,
19
- GoogleOneTap,
20
- OAuthConsent,
21
- OrganizationList,
22
- OrganizationProfile,
23
- OrganizationSwitcher,
24
- PricingTable,
25
- SignIn,
26
- SignUp,
27
- TaskChooseOrganization,
28
- TaskResetPassword,
29
- TaskSetupMFA,
30
- UserAvatar,
31
- UserButton,
32
- UserProfile,
33
- Waitlist,
34
- __experimental_CheckoutProvider,
35
- __experimental_PaymentElement,
36
- __experimental_PaymentElementProvider,
37
- __experimental_useCheckout,
38
- __experimental_usePaymentElement,
39
- assertSingleChild,
40
- normalizeWithDefaultValue,
41
- safeExecute,
42
- useAPIKeys,
43
- useAuth,
44
- useClerk,
45
- useEmailLink,
46
- useOAuthConsent,
47
- useOrganization,
48
- useOrganizationCreationDefaults,
49
- useOrganizationList,
50
- useReverification,
51
- useSession,
52
- useSessionList,
53
- useSignIn,
54
- useSignUp,
55
- useUser,
56
- useWaitlist,
57
- withClerk
58
- } from "./chunk-FQVXBXXF.mjs";
59
- import {
60
- setErrorThrowerOptions
61
- } from "./chunk-RQWALB2R.mjs";
62
- import "./chunk-E5QRIS4Z.mjs";
63
-
64
- // src/polyfills.ts
65
- if (typeof window !== "undefined" && !window.global) {
66
- window.global = typeof global === "undefined" ? window : global;
67
- }
68
-
69
- // ../ui/register/index.mjs
1
+ import { i as setErrorThrowerOptions } from "./useAssertWrappedByClerkProvider-GaNwZpWo.mjs";
2
+ import { A as SignIn, C as CreateOrganization, D as OrganizationProfile, E as OrganizationList, F as UserAvatar, G as safeExecute, I as UserButton, L as UserProfile, M as TaskChooseOrganization, N as TaskResetPassword, O as OrganizationSwitcher, P as TaskSetupMFA, R as Waitlist, S as APIKeys, T as OAuthConsent, U as assertSingleChild, W as normalizeWithDefaultValue, _ as useSignUp, a as __experimental_usePaymentElement, b as useAuth, c as useOAuthConsent, d as useOrganizationList, f as useReverification, g as useSignIn, h as useUser, i as __experimental_useCheckout, j as SignUp, k as PricingTable, l as useOrganization, m as useSessionList, n as __experimental_PaymentElement, o as useAPIKeys, p as useSession, r as __experimental_PaymentElementProvider, s as useClerk, t as __experimental_CheckoutProvider, u as useOrganizationCreationDefaults, v as useWaitlist, w as GoogleOneTap, y as useEmailLink, z as withClerk } from "./hooks-BiY5Zgpp.mjs";
3
+ import { a as ClerkFailed, d as RedirectToSignIn, f as RedirectToSignUp, h as Show, i as ClerkDegraded, l as RedirectToCreateOrganization, m as RedirectToUserProfile, o as ClerkLoaded, p as RedirectToTasks, r as AuthenticateWithRedirectCallback, s as ClerkLoading, t as ClerkProvider, u as RedirectToOrganizationProfile } from "./ClerkProvider-LQpPtmNL.mjs";
70
4
  import * as react from "react";
5
+ import React, { useEffect, useRef } from "react";
71
6
  import * as reactDom from "react-dom";
72
7
  import * as reactDomClient from "react-dom/client";
73
8
  import * as jsxRuntime from "react/jsx-runtime";
74
- var _a;
75
- if (globalThis.__clerkSharedModules) {
76
- const existingVersion = (_a = globalThis.__clerkSharedModules.react) == null ? void 0 : _a.version;
77
- if (existingVersion && existingVersion !== react.version) {
78
- console.warn(
79
- `[@clerk/ui/register] React version mismatch detected. Already registered: ${existingVersion}, current import: ${react.version}. This may cause issues with the shared @clerk/ui variant.`
80
- );
81
- }
82
- } else {
83
- globalThis.__clerkSharedModules = {
84
- react,
85
- "react-dom": reactDom,
86
- "react-dom/client": reactDomClient,
87
- "react/jsx-runtime": jsxRuntime
88
- };
89
- }
90
-
91
- // src/index.ts
92
9
  import { setClerkJSLoadingErrorPackageName } from "@clerk/shared/loadClerkJsScript";
10
+ import { UNSAFE_PortalProvider } from "@clerk/shared/react";
11
+ import { deprecated } from "@clerk/shared/deprecated";
12
+ import { getToken } from "@clerk/shared/getToken";
93
13
 
94
- // src/components/SignInButton.tsx
95
- import React from "react";
96
- var SignInButton = withClerk(
97
- ({ clerk, children, ...props }) => {
98
- const {
99
- // @ts-expect-error - appearance is a valid prop for SignInProps & SignInButtonPropsModal
100
- appearance,
101
- getContainer,
102
- component,
103
- signUpFallbackRedirectUrl,
104
- forceRedirectUrl,
105
- fallbackRedirectUrl,
106
- signUpForceRedirectUrl,
107
- mode,
108
- initialValues,
109
- withSignUp,
110
- oauthFlow,
111
- ...rest
112
- } = props;
113
- children = normalizeWithDefaultValue(children, "Sign in");
114
- const child = assertSingleChild(children)("SignInButton");
115
- const clickHandler = () => {
116
- const opts = {
117
- forceRedirectUrl,
118
- fallbackRedirectUrl,
119
- signUpFallbackRedirectUrl,
120
- signUpForceRedirectUrl,
121
- initialValues,
122
- withSignUp,
123
- oauthFlow
124
- };
125
- if (mode === "modal") {
126
- return clerk.openSignIn({ ...opts, appearance, getContainer });
127
- }
128
- return clerk.redirectToSignIn({
129
- ...opts,
130
- signInFallbackRedirectUrl: fallbackRedirectUrl,
131
- signInForceRedirectUrl: forceRedirectUrl
132
- });
133
- };
134
- const wrappedChildClickHandler = async (e) => {
135
- if (child && typeof child === "object" && "props" in child) {
136
- await safeExecute(child.props.onClick)(e);
137
- }
138
- return clickHandler();
139
- };
140
- const childProps = { ...rest, onClick: wrappedChildClickHandler };
141
- return React.cloneElement(child, childProps);
142
- },
143
- { component: "SignInButton", renderWhileLoading: true }
144
- );
14
+ //#region src/polyfills.ts
15
+ /**
16
+ * Vite does not define `global` by default
17
+ * One workaround is to use the `define` config prop
18
+ * https://vitejs.dev/config/#define
19
+ * We are solving this in the SDK level to reduce setup steps.
20
+ */
21
+ if (typeof window !== "undefined" && !window.global) window.global = typeof global === "undefined" ? window : global;
145
22
 
146
- // src/components/SignInWithMetamaskButton.tsx
147
- import React2 from "react";
148
- var SignInWithMetamaskButton = withClerk(
149
- ({ clerk, children, ...props }) => {
150
- const { redirectUrl, getContainer, component, ...rest } = props;
151
- children = normalizeWithDefaultValue(children, "Sign in with Metamask");
152
- const child = assertSingleChild(children)("SignInWithMetamaskButton");
153
- const clickHandler = async () => {
154
- async function authenticate() {
155
- await clerk.authenticateWithMetamask({ redirectUrl: redirectUrl || void 0 });
156
- }
157
- void authenticate();
158
- };
159
- const wrappedChildClickHandler = async (e) => {
160
- await safeExecute(child.props.onClick)(e);
161
- return clickHandler();
162
- };
163
- const childProps = { ...rest, onClick: wrappedChildClickHandler };
164
- return React2.cloneElement(child, childProps);
165
- },
166
- { component: "SignInWithMetamask", renderWhileLoading: true }
167
- );
23
+ //#endregion
24
+ //#region ../ui/register/index.mjs
25
+ /**
26
+ * Register React dependencies for sharing with @clerk/ui's shared variant.
27
+ *
28
+ * Import this module BEFORE loading the ui.shared.browser.js bundle:
29
+ *
30
+ * ```js
31
+ * import '@clerk/ui/register';
32
+ * // Now load clerk-js which will load ui.shared.browser.js
33
+ * ```
34
+ *
35
+ * This enables @clerk/ui to use the host app's React instead of bundling its own,
36
+ * reducing the overall bundle size.
37
+ */
38
+ if (globalThis.__clerkSharedModules) {
39
+ const existingVersion = globalThis.__clerkSharedModules.react?.version;
40
+ if (existingVersion && existingVersion !== react.version) console.warn(`[@clerk/ui/register] React version mismatch detected. Already registered: ${existingVersion}, current import: ${react.version}. This may cause issues with the shared @clerk/ui variant.`);
41
+ } else globalThis.__clerkSharedModules = {
42
+ react,
43
+ "react-dom": reactDom,
44
+ "react-dom/client": reactDomClient,
45
+ "react/jsx-runtime": jsxRuntime
46
+ };
168
47
 
169
- // src/components/SignOutButton.tsx
170
- import { deprecated } from "@clerk/shared/deprecated";
171
- import React3 from "react";
172
- var SignOutButton = withClerk(
173
- ({ clerk, children, ...props }) => {
174
- const { redirectUrl = "/", sessionId, signOutOptions, getContainer, component, ...rest } = props;
175
- if (signOutOptions) {
176
- deprecated("SignOutButton `signOutOptions`", "Use the `redirectUrl` and `sessionId` props directly instead.");
177
- }
178
- children = normalizeWithDefaultValue(children, "Sign out");
179
- const child = assertSingleChild(children)("SignOutButton");
180
- const clickHandler = () => clerk.signOut({
181
- redirectUrl,
182
- ...sessionId !== void 0 && { sessionId },
183
- ...signOutOptions
184
- });
185
- const wrappedChildClickHandler = async (e) => {
186
- await safeExecute(child.props.onClick)(e);
187
- return clickHandler();
188
- };
189
- const childProps = { ...rest, onClick: wrappedChildClickHandler };
190
- return React3.cloneElement(child, childProps);
191
- },
192
- { component: "SignOutButton", renderWhileLoading: true }
193
- );
48
+ //#endregion
49
+ //#region src/components/SignInButton.tsx
50
+ const SignInButton = withClerk(({ clerk, children, ...props }) => {
51
+ const { appearance, getContainer, component, signUpFallbackRedirectUrl, forceRedirectUrl, fallbackRedirectUrl, signUpForceRedirectUrl, mode, initialValues, withSignUp, oauthFlow, ...rest } = props;
52
+ children = normalizeWithDefaultValue(children, "Sign in");
53
+ const child = assertSingleChild(children)("SignInButton");
54
+ const clickHandler = () => {
55
+ const opts = {
56
+ forceRedirectUrl,
57
+ fallbackRedirectUrl,
58
+ signUpFallbackRedirectUrl,
59
+ signUpForceRedirectUrl,
60
+ initialValues,
61
+ withSignUp,
62
+ oauthFlow
63
+ };
64
+ if (mode === "modal") return clerk.openSignIn({
65
+ ...opts,
66
+ appearance,
67
+ getContainer
68
+ });
69
+ return clerk.redirectToSignIn({
70
+ ...opts,
71
+ signInFallbackRedirectUrl: fallbackRedirectUrl,
72
+ signInForceRedirectUrl: forceRedirectUrl
73
+ });
74
+ };
75
+ const wrappedChildClickHandler = async (e) => {
76
+ if (child && typeof child === "object" && "props" in child) await safeExecute(child.props.onClick)(e);
77
+ return clickHandler();
78
+ };
79
+ const childProps = {
80
+ ...rest,
81
+ onClick: wrappedChildClickHandler
82
+ };
83
+ return React.cloneElement(child, childProps);
84
+ }, {
85
+ component: "SignInButton",
86
+ renderWhileLoading: true
87
+ });
88
+
89
+ //#endregion
90
+ //#region src/components/SignInWithMetamaskButton.tsx
91
+ const SignInWithMetamaskButton = withClerk(({ clerk, children, ...props }) => {
92
+ const { redirectUrl, getContainer, component, ...rest } = props;
93
+ children = normalizeWithDefaultValue(children, "Sign in with Metamask");
94
+ const child = assertSingleChild(children)("SignInWithMetamaskButton");
95
+ const clickHandler = async () => {
96
+ async function authenticate() {
97
+ await clerk.authenticateWithMetamask({ redirectUrl: redirectUrl || void 0 });
98
+ }
99
+ authenticate();
100
+ };
101
+ const wrappedChildClickHandler = async (e) => {
102
+ await safeExecute(child.props.onClick)(e);
103
+ return clickHandler();
104
+ };
105
+ const childProps = {
106
+ ...rest,
107
+ onClick: wrappedChildClickHandler
108
+ };
109
+ return React.cloneElement(child, childProps);
110
+ }, {
111
+ component: "SignInWithMetamask",
112
+ renderWhileLoading: true
113
+ });
194
114
 
195
- // src/components/SignUpButton.tsx
196
- import React4 from "react";
197
- var SignUpButton = withClerk(
198
- ({ clerk, children, ...props }) => {
199
- const {
200
- // @ts-expect-error - appearance is a valid prop for SignUpProps & SignUpButtonPropsModal
201
- appearance,
202
- // @ts-expect-error - unsafeMetadata is a valid prop for SignUpProps & SignUpButtonPropsModal
203
- unsafeMetadata,
204
- getContainer,
205
- component,
206
- fallbackRedirectUrl,
207
- forceRedirectUrl,
208
- signInFallbackRedirectUrl,
209
- signInForceRedirectUrl,
210
- mode,
211
- initialValues,
212
- oauthFlow,
213
- ...rest
214
- } = props;
215
- children = normalizeWithDefaultValue(children, "Sign up");
216
- const child = assertSingleChild(children)("SignUpButton");
217
- const clickHandler = () => {
218
- const opts = {
219
- fallbackRedirectUrl,
220
- forceRedirectUrl,
221
- signInFallbackRedirectUrl,
222
- signInForceRedirectUrl,
223
- initialValues,
224
- oauthFlow
225
- };
226
- if (mode === "modal") {
227
- return clerk.openSignUp({
228
- ...opts,
229
- appearance,
230
- unsafeMetadata,
231
- getContainer
232
- });
233
- }
234
- return clerk.redirectToSignUp({
235
- ...opts,
236
- signUpFallbackRedirectUrl: fallbackRedirectUrl,
237
- signUpForceRedirectUrl: forceRedirectUrl
238
- });
239
- };
240
- const wrappedChildClickHandler = async (e) => {
241
- if (child && typeof child === "object" && "props" in child) {
242
- await safeExecute(child.props.onClick)(e);
243
- }
244
- return clickHandler();
245
- };
246
- const childProps = { ...rest, onClick: wrappedChildClickHandler };
247
- return React4.cloneElement(child, childProps);
248
- },
249
- { component: "SignUpButton", renderWhileLoading: true }
250
- );
115
+ //#endregion
116
+ //#region src/components/SignOutButton.tsx
117
+ const SignOutButton = withClerk(({ clerk, children, ...props }) => {
118
+ const { redirectUrl = "/", sessionId, signOutOptions, getContainer, component, ...rest } = props;
119
+ if (signOutOptions) deprecated("SignOutButton `signOutOptions`", "Use the `redirectUrl` and `sessionId` props directly instead.");
120
+ children = normalizeWithDefaultValue(children, "Sign out");
121
+ const child = assertSingleChild(children)("SignOutButton");
122
+ const clickHandler = () => clerk.signOut({
123
+ redirectUrl,
124
+ ...sessionId !== void 0 && { sessionId },
125
+ ...signOutOptions
126
+ });
127
+ const wrappedChildClickHandler = async (e) => {
128
+ await safeExecute(child.props.onClick)(e);
129
+ return clickHandler();
130
+ };
131
+ const childProps = {
132
+ ...rest,
133
+ onClick: wrappedChildClickHandler
134
+ };
135
+ return React.cloneElement(child, childProps);
136
+ }, {
137
+ component: "SignOutButton",
138
+ renderWhileLoading: true
139
+ });
251
140
 
252
- // src/components/HandleSSOCallback.tsx
253
- import React5, { useEffect, useRef } from "react";
141
+ //#endregion
142
+ //#region src/components/SignUpButton.tsx
143
+ const SignUpButton = withClerk(({ clerk, children, ...props }) => {
144
+ const { appearance, unsafeMetadata, getContainer, component, fallbackRedirectUrl, forceRedirectUrl, signInFallbackRedirectUrl, signInForceRedirectUrl, mode, initialValues, oauthFlow, ...rest } = props;
145
+ children = normalizeWithDefaultValue(children, "Sign up");
146
+ const child = assertSingleChild(children)("SignUpButton");
147
+ const clickHandler = () => {
148
+ const opts = {
149
+ fallbackRedirectUrl,
150
+ forceRedirectUrl,
151
+ signInFallbackRedirectUrl,
152
+ signInForceRedirectUrl,
153
+ initialValues,
154
+ oauthFlow
155
+ };
156
+ if (mode === "modal") return clerk.openSignUp({
157
+ ...opts,
158
+ appearance,
159
+ unsafeMetadata,
160
+ getContainer
161
+ });
162
+ return clerk.redirectToSignUp({
163
+ ...opts,
164
+ signUpFallbackRedirectUrl: fallbackRedirectUrl,
165
+ signUpForceRedirectUrl: forceRedirectUrl
166
+ });
167
+ };
168
+ const wrappedChildClickHandler = async (e) => {
169
+ if (child && typeof child === "object" && "props" in child) await safeExecute(child.props.onClick)(e);
170
+ return clickHandler();
171
+ };
172
+ const childProps = {
173
+ ...rest,
174
+ onClick: wrappedChildClickHandler
175
+ };
176
+ return React.cloneElement(child, childProps);
177
+ }, {
178
+ component: "SignUpButton",
179
+ renderWhileLoading: true
180
+ });
181
+
182
+ //#endregion
183
+ //#region src/components/HandleSSOCallback.tsx
184
+ /**
185
+ * Use this component when building custom UI to handle the SSO callback and navigate to the appropriate page based on
186
+ * the status of the sign-in or sign-up. By default, this component might render a captcha element to handle captchas
187
+ * when required by the Clerk API.
188
+ *
189
+ * @example
190
+ * ```tsx
191
+ * import { HandleSSOCallback } from '@clerk/react';
192
+ * import { useNavigate } from 'react-router';
193
+ *
194
+ * export default function Page() {
195
+ * const navigate = useNavigate();
196
+ *
197
+ * return (
198
+ * <HandleSSOCallback
199
+ * navigateToApp={({ session, decorateUrl }) => {
200
+ * if (session?.currentTask) {
201
+ * const destination = decorateUrl(`/onboarding/${session?.currentTask.key}`);
202
+ * if (destination.startsWith('http')) {
203
+ * window.location.href = destination;
204
+ * return;
205
+ * }
206
+ * navigate(destination);
207
+ * return;
208
+ * }
209
+ *
210
+ * const destination = decorateUrl('/dashboard');
211
+ * if (destination.startsWith('http')) {
212
+ * window.location.href = destination;
213
+ * return;
214
+ * }
215
+ * navigate(destination);
216
+ * }}
217
+ * navigateToSignIn={() => {
218
+ * navigate('/sign-in');
219
+ * }}
220
+ * navigateToSignUp={() => {
221
+ * navigate('/sign-up');
222
+ * }}
223
+ * />
224
+ * );
225
+ * }
226
+ * ```
227
+ */
254
228
  function HandleSSOCallback(props) {
255
- const { navigateToApp, navigateToSignIn, navigateToSignUp } = props;
256
- const clerk = useClerk();
257
- const { signIn } = useSignIn();
258
- const { signUp } = useSignUp();
259
- const hasRun = useRef(false);
260
- useEffect(() => {
261
- (async () => {
262
- var _a2, _b, _c;
263
- if (!clerk.loaded || hasRun.current) {
264
- return;
265
- }
266
- hasRun.current = true;
267
- if (signIn.status === "complete") {
268
- await signIn.finalize({
269
- navigate: async (...params) => {
270
- navigateToApp(...params);
271
- }
272
- });
273
- return;
274
- }
275
- if (signUp.isTransferable) {
276
- await signIn.create({ transfer: true });
277
- if (signIn.status === "complete") {
278
- await signIn.finalize({
279
- navigate: async (...params) => {
280
- navigateToApp(...params);
281
- }
282
- });
283
- return;
284
- }
285
- return navigateToSignIn();
286
- }
287
- if (signIn.status === "needs_first_factor" && !((_a2 = signIn.supportedFirstFactors) == null ? void 0 : _a2.every((f) => f.strategy === "enterprise_sso"))) {
288
- return navigateToSignIn();
289
- }
290
- if (signIn.isTransferable) {
291
- await signUp.create({ transfer: true });
292
- if (signUp.status === "complete") {
293
- await signUp.finalize({
294
- navigate: async (...params) => {
295
- navigateToApp(...params);
296
- }
297
- });
298
- return;
299
- }
300
- return navigateToSignUp();
301
- }
302
- if (signUp.status === "complete") {
303
- await signUp.finalize({
304
- navigate: async (...params) => {
305
- navigateToApp(...params);
306
- }
307
- });
308
- return;
309
- }
310
- if (signIn.status === "needs_second_factor" || signIn.status === "needs_new_password") {
311
- return navigateToSignIn();
312
- }
313
- if (signIn.existingSession || signUp.existingSession) {
314
- const sessionId = ((_b = signIn.existingSession) == null ? void 0 : _b.sessionId) || ((_c = signUp.existingSession) == null ? void 0 : _c.sessionId);
315
- if (sessionId) {
316
- await clerk.setActive({
317
- session: sessionId,
318
- navigate: async (...params) => {
319
- return navigateToApp(...params);
320
- }
321
- });
322
- return;
323
- }
324
- }
325
- })();
326
- }, [clerk, clerk.loaded, signIn, signUp]);
327
- return /* @__PURE__ */ React5.createElement("div", null, /* @__PURE__ */ React5.createElement("div", { id: "clerk-captcha" }));
229
+ const { navigateToApp, navigateToSignIn, navigateToSignUp } = props;
230
+ const clerk = useClerk();
231
+ const { signIn } = useSignIn();
232
+ const { signUp } = useSignUp();
233
+ const hasRun = useRef(false);
234
+ useEffect(() => {
235
+ (async () => {
236
+ if (!clerk.loaded || hasRun.current) return;
237
+ hasRun.current = true;
238
+ if (signIn.status === "complete") {
239
+ await signIn.finalize({ navigate: async (...params) => {
240
+ navigateToApp(...params);
241
+ } });
242
+ return;
243
+ }
244
+ if (signUp.isTransferable) {
245
+ await signIn.create({ transfer: true });
246
+ if (signIn.status === "complete") {
247
+ await signIn.finalize({ navigate: async (...params) => {
248
+ navigateToApp(...params);
249
+ } });
250
+ return;
251
+ }
252
+ return navigateToSignIn();
253
+ }
254
+ if (signIn.status === "needs_first_factor" && !signIn.supportedFirstFactors?.every((f) => f.strategy === "enterprise_sso")) return navigateToSignIn();
255
+ if (signIn.isTransferable) {
256
+ await signUp.create({ transfer: true });
257
+ if (signUp.status === "complete") {
258
+ await signUp.finalize({ navigate: async (...params) => {
259
+ navigateToApp(...params);
260
+ } });
261
+ return;
262
+ }
263
+ return navigateToSignUp();
264
+ }
265
+ if (signUp.status === "complete") {
266
+ await signUp.finalize({ navigate: async (...params) => {
267
+ navigateToApp(...params);
268
+ } });
269
+ return;
270
+ }
271
+ if (signIn.status === "needs_second_factor" || signIn.status === "needs_new_password") return navigateToSignIn();
272
+ if (signIn.existingSession || signUp.existingSession) {
273
+ const sessionId = signIn.existingSession?.sessionId || signUp.existingSession?.sessionId;
274
+ if (sessionId) {
275
+ await clerk.setActive({
276
+ session: sessionId,
277
+ navigate: async (...params) => {
278
+ return navigateToApp(...params);
279
+ }
280
+ });
281
+ return;
282
+ }
283
+ }
284
+ })();
285
+ }, [
286
+ clerk,
287
+ clerk.loaded,
288
+ signIn,
289
+ signUp
290
+ ]);
291
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { id: "clerk-captcha" }));
328
292
  }
329
293
 
330
- // src/contexts/index.ts
331
- import { UNSAFE_PortalProvider } from "@clerk/shared/react";
332
-
333
- // src/index.ts
334
- import { getToken } from "@clerk/shared/getToken";
294
+ //#endregion
295
+ //#region src/index.ts
335
296
  setErrorThrowerOptions({ packageName: "@clerk/react" });
336
297
  setClerkJSLoadingErrorPackageName("@clerk/react");
337
- export {
338
- APIKeys,
339
- AuthenticateWithRedirectCallback,
340
- ClerkDegraded,
341
- ClerkFailed,
342
- ClerkLoaded,
343
- ClerkLoading,
344
- ClerkProvider,
345
- CreateOrganization,
346
- GoogleOneTap,
347
- HandleSSOCallback,
348
- OAuthConsent,
349
- OrganizationList,
350
- OrganizationProfile,
351
- OrganizationSwitcher,
352
- PricingTable,
353
- RedirectToCreateOrganization,
354
- RedirectToOrganizationProfile,
355
- RedirectToSignIn,
356
- RedirectToSignUp,
357
- RedirectToTasks,
358
- RedirectToUserProfile,
359
- Show,
360
- SignIn,
361
- SignInButton,
362
- SignInWithMetamaskButton,
363
- SignOutButton,
364
- SignUp,
365
- SignUpButton,
366
- TaskChooseOrganization,
367
- TaskResetPassword,
368
- TaskSetupMFA,
369
- UNSAFE_PortalProvider,
370
- UserAvatar,
371
- UserButton,
372
- UserProfile,
373
- Waitlist,
374
- __experimental_CheckoutProvider,
375
- __experimental_PaymentElement,
376
- __experimental_PaymentElementProvider,
377
- __experimental_useCheckout,
378
- __experimental_usePaymentElement,
379
- getToken,
380
- useAPIKeys,
381
- useAuth,
382
- useClerk,
383
- useEmailLink,
384
- useOAuthConsent,
385
- useOrganization,
386
- useOrganizationCreationDefaults,
387
- useOrganizationList,
388
- useReverification,
389
- useSession,
390
- useSessionList,
391
- useSignIn,
392
- useSignUp,
393
- useUser,
394
- useWaitlist
395
- };
298
+
299
+ //#endregion
300
+ export { APIKeys, AuthenticateWithRedirectCallback, ClerkDegraded, ClerkFailed, ClerkLoaded, ClerkLoading, ClerkProvider, CreateOrganization, GoogleOneTap, HandleSSOCallback, OAuthConsent, OrganizationList, OrganizationProfile, OrganizationSwitcher, PricingTable, RedirectToCreateOrganization, RedirectToOrganizationProfile, RedirectToSignIn, RedirectToSignUp, RedirectToTasks, RedirectToUserProfile, Show, SignIn, SignInButton, SignInWithMetamaskButton, SignOutButton, SignUp, SignUpButton, TaskChooseOrganization, TaskResetPassword, TaskSetupMFA, UNSAFE_PortalProvider, UserAvatar, UserButton, UserProfile, Waitlist, __experimental_CheckoutProvider, __experimental_PaymentElement, __experimental_PaymentElementProvider, __experimental_useCheckout, __experimental_usePaymentElement, getToken, useAPIKeys, useAuth, useClerk, useEmailLink, useOAuthConsent, useOrganization, useOrganizationCreationDefaults, useOrganizationList, useReverification, useSession, useSessionList, useSignIn, useSignUp, useUser, useWaitlist };
396
301
  //# sourceMappingURL=index.mjs.map