@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.js DELETED
@@ -1,3919 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __typeError = (msg) => {
9
- throw TypeError(msg);
10
- };
11
- var __export = (target, all) => {
12
- for (var name in all)
13
- __defProp(target, name, { get: all[name], enumerable: true });
14
- };
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
31
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
33
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
34
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
35
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
36
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
37
-
38
- // src/index.ts
39
- var src_exports = {};
40
- __export(src_exports, {
41
- APIKeys: () => APIKeys,
42
- AuthenticateWithRedirectCallback: () => AuthenticateWithRedirectCallback,
43
- ClerkDegraded: () => ClerkDegraded,
44
- ClerkFailed: () => ClerkFailed,
45
- ClerkLoaded: () => ClerkLoaded,
46
- ClerkLoading: () => ClerkLoading,
47
- ClerkProvider: () => ClerkProvider,
48
- CreateOrganization: () => CreateOrganization,
49
- GoogleOneTap: () => GoogleOneTap,
50
- HandleSSOCallback: () => HandleSSOCallback,
51
- OAuthConsent: () => OAuthConsent,
52
- OrganizationList: () => OrganizationList,
53
- OrganizationProfile: () => OrganizationProfile,
54
- OrganizationSwitcher: () => OrganizationSwitcher,
55
- PricingTable: () => PricingTable,
56
- RedirectToCreateOrganization: () => RedirectToCreateOrganization,
57
- RedirectToOrganizationProfile: () => RedirectToOrganizationProfile,
58
- RedirectToSignIn: () => RedirectToSignIn,
59
- RedirectToSignUp: () => RedirectToSignUp,
60
- RedirectToTasks: () => RedirectToTasks,
61
- RedirectToUserProfile: () => RedirectToUserProfile,
62
- Show: () => Show,
63
- SignIn: () => SignIn,
64
- SignInButton: () => SignInButton,
65
- SignInWithMetamaskButton: () => SignInWithMetamaskButton,
66
- SignOutButton: () => SignOutButton,
67
- SignUp: () => SignUp,
68
- SignUpButton: () => SignUpButton,
69
- TaskChooseOrganization: () => TaskChooseOrganization,
70
- TaskResetPassword: () => TaskResetPassword,
71
- TaskSetupMFA: () => TaskSetupMFA,
72
- UNSAFE_PortalProvider: () => import_react31.UNSAFE_PortalProvider,
73
- UserAvatar: () => UserAvatar,
74
- UserButton: () => UserButton,
75
- UserProfile: () => UserProfile,
76
- Waitlist: () => Waitlist,
77
- __experimental_CheckoutProvider: () => import_react20.__experimental_CheckoutProvider,
78
- __experimental_PaymentElement: () => import_react20.__experimental_PaymentElement,
79
- __experimental_PaymentElementProvider: () => import_react20.__experimental_PaymentElementProvider,
80
- __experimental_useCheckout: () => import_react20.__experimental_useCheckout,
81
- __experimental_usePaymentElement: () => import_react20.__experimental_usePaymentElement,
82
- getToken: () => import_getToken.getToken,
83
- useAPIKeys: () => import_react20.useAPIKeys,
84
- useAuth: () => useAuth,
85
- useClerk: () => import_react20.useClerk,
86
- useEmailLink: () => useEmailLink,
87
- useOAuthConsent: () => import_react20.useOAuthConsent,
88
- useOrganization: () => import_react20.useOrganization,
89
- useOrganizationCreationDefaults: () => import_react20.useOrganizationCreationDefaults,
90
- useOrganizationList: () => import_react20.useOrganizationList,
91
- useReverification: () => import_react20.useReverification,
92
- useSession: () => import_react20.useSession,
93
- useSessionList: () => import_react20.useSessionList,
94
- useSignIn: () => useSignIn,
95
- useSignUp: () => useSignUp,
96
- useUser: () => import_react20.useUser,
97
- useWaitlist: () => useWaitlist
98
- });
99
- module.exports = __toCommonJS(src_exports);
100
-
101
- // <define:__CLERK_UI_SUPPORTED_REACT_BOUNDS__>
102
- var define_CLERK_UI_SUPPORTED_REACT_BOUNDS_default = [[18, 0, -1, 0], [19, 0, 0, 3], [19, 1, 1, 4], [19, 2, 2, 3], [19, 3, 3, 0]];
103
-
104
- // src/polyfills.ts
105
- if (typeof window !== "undefined" && !window.global) {
106
- window.global = typeof global === "undefined" ? window : global;
107
- }
108
-
109
- // ../ui/register/index.mjs
110
- var react = __toESM(require("react"), 1);
111
- var reactDom = __toESM(require("react-dom"), 1);
112
- var reactDomClient = __toESM(require("react-dom/client"), 1);
113
- var jsxRuntime = __toESM(require("react/jsx-runtime"), 1);
114
- var _a;
115
- if (globalThis.__clerkSharedModules) {
116
- const existingVersion = (_a = globalThis.__clerkSharedModules.react) == null ? void 0 : _a.version;
117
- if (existingVersion && existingVersion !== react.version) {
118
- console.warn(
119
- `[@clerk/ui/register] React version mismatch detected. Already registered: ${existingVersion}, current import: ${react.version}. This may cause issues with the shared @clerk/ui variant.`
120
- );
121
- }
122
- } else {
123
- globalThis.__clerkSharedModules = {
124
- react,
125
- "react-dom": reactDom,
126
- "react-dom/client": reactDomClient,
127
- "react/jsx-runtime": jsxRuntime
128
- };
129
- }
130
-
131
- // src/index.ts
132
- var import_loadClerkJsScript2 = require("@clerk/shared/loadClerkJsScript");
133
-
134
- // src/errors/errorThrower.ts
135
- var import_error = require("@clerk/shared/error");
136
- var errorThrower = (0, import_error.buildErrorThrower)({ packageName: "@clerk/react" });
137
- function setErrorThrowerOptions(options) {
138
- errorThrower.setMessages(options).setPackageName(options);
139
- }
140
-
141
- // src/components/uiComponents.tsx
142
- var import_utils3 = require("@clerk/shared/utils");
143
- var import_react14 = __toESM(require("react"));
144
-
145
- // src/errors/messages.ts
146
- var multipleClerkProvidersError = "You've added multiple <ClerkProvider> components in your React component tree. Wrap your components in a single <ClerkProvider>.";
147
- var multipleChildrenInButtonComponent = (name) => `You've passed multiple children components to <${name}/>. You can only pass a single child component or text.`;
148
- var invalidStateError = "Invalid state. Feel free to submit a bug or reach out to support here: https://clerk.com/contact/support";
149
- var unsupportedNonBrowserDomainOrProxyUrlFunction = "Unsupported usage of isSatellite, domain or proxyUrl. The usage of isSatellite, domain or proxyUrl as function is not supported in non-browser environments.";
150
- var userProfilePageRenderedError = "<UserProfile.Page /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.";
151
- var userProfileLinkRenderedError = "<UserProfile.Link /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.";
152
- var organizationProfilePageRenderedError = "<OrganizationProfile.Page /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.";
153
- var organizationProfileLinkRenderedError = "<OrganizationProfile.Link /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.";
154
- var customPagesIgnoredComponent = (componentName) => `<${componentName} /> can only accept <${componentName}.Page /> and <${componentName}.Link /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.`;
155
- var customPageWrongProps = (componentName) => `Missing props. <${componentName}.Page /> component requires the following props: url, label, labelIcon, alongside with children to be rendered inside the page.`;
156
- var customLinkWrongProps = (componentName) => `Missing props. <${componentName}.Link /> component requires the following props: url, label and labelIcon.`;
157
- var userButtonIgnoredComponent = `<UserButton /> can only accept <UserButton.UserProfilePage />, <UserButton.UserProfileLink /> and <UserButton.MenuItems /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.`;
158
- var customMenuItemsIgnoredComponent = "<UserButton.MenuItems /> component can only accept <UserButton.Action /> and <UserButton.Link /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.";
159
- var userButtonMenuItemsRenderedError = "<UserButton.MenuItems /> component needs to be a direct child of `<UserButton />`.";
160
- var userButtonMenuActionRenderedError = "<UserButton.Action /> component needs to be a direct child of `<UserButton.MenuItems />`.";
161
- var userButtonMenuLinkRenderedError = "<UserButton.Link /> component needs to be a direct child of `<UserButton.MenuItems />`.";
162
- var userButtonMenuItemLinkWrongProps = "Missing props. <UserButton.Link /> component requires the following props: href, label and labelIcon.";
163
- var userButtonMenuItemsActionWrongsProps = "Missing props. <UserButton.Action /> component requires the following props: label.";
164
-
165
- // src/utils/childrenUtils.tsx
166
- var import_react = __toESM(require("react"));
167
- var assertSingleChild = (children) => (name) => {
168
- try {
169
- return import_react.default.Children.only(children);
170
- } catch {
171
- const childArray = import_react.default.Children.toArray(children);
172
- if (childArray.length === 1 && import_react.default.isValidElement(childArray[0])) {
173
- return childArray[0];
174
- }
175
- return errorThrower.throw(multipleChildrenInButtonComponent(name));
176
- }
177
- };
178
- var normalizeWithDefaultValue = (children, defaultText) => {
179
- if (!children) {
180
- children = defaultText;
181
- }
182
- if (typeof children === "string") {
183
- children = /* @__PURE__ */ import_react.default.createElement("button", null, children);
184
- }
185
- return children;
186
- };
187
- var safeExecute = (cb) => (...args) => {
188
- if (cb && typeof cb === "function") {
189
- return cb(...args);
190
- }
191
- };
192
-
193
- // src/utils/envVariables.ts
194
- var import_getEnvVariable = require("@clerk/shared/getEnvVariable");
195
- var getEnvVar = (name) => {
196
- return (0, import_getEnvVariable.getEnvVariable)(`VITE_${name}`) || (0, import_getEnvVariable.getEnvVariable)(name);
197
- };
198
- var withEnvFallback = (value, envVarName) => {
199
- if (value !== void 0) {
200
- return value;
201
- }
202
- const envValue = getEnvVar(envVarName);
203
- return envValue || void 0;
204
- };
205
- var mergeWithEnv = (options) => {
206
- const publishableKey = withEnvFallback(options.publishableKey, "CLERK_PUBLISHABLE_KEY");
207
- return {
208
- ...options,
209
- ...publishableKey !== void 0 && { publishableKey }
210
- };
211
- };
212
-
213
- // src/utils/isConstructor.ts
214
- function isConstructor(f) {
215
- return typeof f === "function";
216
- }
217
-
218
- // src/utils/useMaxAllowedInstancesGuard.tsx
219
- var import_react2 = __toESM(require("react"));
220
- var counts = /* @__PURE__ */ new Map();
221
- function useMaxAllowedInstancesGuard(name, error, maxCount = 1) {
222
- import_react2.default.useEffect(() => {
223
- const count = counts.get(name) || 0;
224
- if (count == maxCount) {
225
- return errorThrower.throw(error);
226
- }
227
- counts.set(name, count + 1);
228
- return () => {
229
- counts.set(name, (counts.get(name) || 1) - 1);
230
- };
231
- }, []);
232
- }
233
- function withMaxAllowedInstancesGuard(WrappedComponent, name, error) {
234
- const displayName = WrappedComponent.displayName || WrappedComponent.name || name || "Component";
235
- const Hoc = (props) => {
236
- useMaxAllowedInstancesGuard(name, error);
237
- return /* @__PURE__ */ import_react2.default.createElement(WrappedComponent, { ...props });
238
- };
239
- Hoc.displayName = `withMaxAllowedInstancesGuard(${displayName})`;
240
- return Hoc;
241
- }
242
-
243
- // src/utils/useCustomElementPortal.tsx
244
- var import_react3 = require("react");
245
- var import_react_dom = require("react-dom");
246
- var useCustomElementPortal = (elements) => {
247
- const [nodeMap, setNodeMap] = (0, import_react3.useState)(/* @__PURE__ */ new Map());
248
- const nodeMapRef = (0, import_react3.useRef)(nodeMap);
249
- const elementsRef = (0, import_react3.useRef)(/* @__PURE__ */ new Map());
250
- const portalsRef = (0, import_react3.useRef)(/* @__PURE__ */ new Map());
251
- nodeMapRef.current = nodeMap;
252
- elementsRef.current = new Map(elements.map((el) => [el.id, el.component]));
253
- const elementIds = new Set(elements.map((el) => el.id));
254
- portalsRef.current.forEach((_, id) => {
255
- if (!elementIds.has(id)) {
256
- portalsRef.current.delete(id);
257
- }
258
- });
259
- return elements.map((el) => {
260
- const id = el.id;
261
- const existingPortal = portalsRef.current.get(id);
262
- if (existingPortal) {
263
- return existingPortal;
264
- }
265
- const portal = () => {
266
- const node = nodeMapRef.current.get(id);
267
- const component = elementsRef.current.get(id);
268
- return node ? (0, import_react_dom.createPortal)(component, node) : null;
269
- };
270
- const customElementPortal = {
271
- id: el.id,
272
- mount: (node) => setNodeMap((prev) => new Map(prev).set(id, node)),
273
- unmount: () => setNodeMap((prev) => {
274
- const newMap = new Map(prev);
275
- newMap.set(id, null);
276
- return newMap;
277
- }),
278
- portal
279
- };
280
- portalsRef.current.set(id, customElementPortal);
281
- return customElementPortal;
282
- });
283
- };
284
-
285
- // src/utils/useCustomPages.tsx
286
- var import_utils = require("@clerk/shared/utils");
287
- var import_react5 = __toESM(require("react"));
288
-
289
- // src/utils/componentValidation.ts
290
- var import_react4 = __toESM(require("react"));
291
- var isThatComponent = (v, component) => {
292
- return !!v && import_react4.default.isValidElement(v) && (v == null ? void 0 : v.type) === component;
293
- };
294
-
295
- // src/utils/useCustomPages.tsx
296
- var useUserProfileCustomPages = (children, options) => {
297
- const reorderItemsLabels = ["account", "security", "billing", "apiKeys"];
298
- return useCustomPages(
299
- {
300
- children,
301
- reorderItemsLabels,
302
- LinkComponent: UserProfileLink,
303
- PageComponent: UserProfilePage,
304
- MenuItemsComponent: MenuItems,
305
- componentName: "UserProfile"
306
- },
307
- options
308
- );
309
- };
310
- var useOrganizationProfileCustomPages = (children, options) => {
311
- const reorderItemsLabels = ["general", "members", "billing", "apiKeys"];
312
- return useCustomPages(
313
- {
314
- children,
315
- reorderItemsLabels,
316
- LinkComponent: OrganizationProfileLink,
317
- PageComponent: OrganizationProfilePage,
318
- componentName: "OrganizationProfile"
319
- },
320
- options
321
- );
322
- };
323
- var useSanitizedChildren = (children) => {
324
- const sanitizedChildren = [];
325
- const excludedComponents = [
326
- OrganizationProfileLink,
327
- OrganizationProfilePage,
328
- MenuItems,
329
- UserProfilePage,
330
- UserProfileLink
331
- ];
332
- import_react5.default.Children.forEach(children, (child) => {
333
- if (!excludedComponents.some((component) => isThatComponent(child, component))) {
334
- sanitizedChildren.push(child);
335
- }
336
- });
337
- return sanitizedChildren;
338
- };
339
- var useCustomPages = (params, options) => {
340
- const { children, LinkComponent, PageComponent, MenuItemsComponent, reorderItemsLabels, componentName } = params;
341
- const { allowForAnyChildren = false } = options || {};
342
- const validChildren = [];
343
- const portalIdCounts = /* @__PURE__ */ new Map();
344
- import_react5.default.Children.forEach(children, (child) => {
345
- if (!isThatComponent(child, PageComponent) && !isThatComponent(child, LinkComponent) && !isThatComponent(child, MenuItemsComponent)) {
346
- if (child && !allowForAnyChildren) {
347
- (0, import_utils.logErrorInDevMode)(customPagesIgnoredComponent(componentName));
348
- }
349
- return;
350
- }
351
- const { props } = child;
352
- const { children: children2, label, url, labelIcon } = props;
353
- const childKey = child.key;
354
- if (isThatComponent(child, PageComponent)) {
355
- if (isReorderItem(props, reorderItemsLabels)) {
356
- validChildren.push({ label });
357
- } else if (isCustomPage(props)) {
358
- validChildren.push({
359
- label,
360
- labelIcon,
361
- children: children2,
362
- url,
363
- portalId: getCustomPagePortalId("page", props, childKey, portalIdCounts)
364
- });
365
- } else {
366
- (0, import_utils.logErrorInDevMode)(customPageWrongProps(componentName));
367
- return;
368
- }
369
- }
370
- if (isThatComponent(child, LinkComponent)) {
371
- if (isExternalLink(props)) {
372
- validChildren.push({
373
- label,
374
- labelIcon,
375
- url,
376
- portalId: getCustomPagePortalId("link", props, childKey, portalIdCounts)
377
- });
378
- } else {
379
- (0, import_utils.logErrorInDevMode)(customLinkWrongProps(componentName));
380
- return;
381
- }
382
- }
383
- });
384
- const customPageContents = [];
385
- const customPageLabelIcons = [];
386
- const customLinkLabelIcons = [];
387
- validChildren.forEach((cp, index) => {
388
- if (isCustomPage(cp)) {
389
- customPageContents.push({ component: cp.children, id: cp.portalId || index });
390
- customPageLabelIcons.push({ component: cp.labelIcon, id: cp.portalId || index });
391
- return;
392
- }
393
- if (isExternalLink(cp)) {
394
- customLinkLabelIcons.push({ component: cp.labelIcon, id: cp.portalId || index });
395
- }
396
- });
397
- const customPageContentsPortals = useCustomElementPortal(customPageContents);
398
- const customPageLabelIconsPortals = useCustomElementPortal(customPageLabelIcons);
399
- const customLinkLabelIconsPortals = useCustomElementPortal(customLinkLabelIcons);
400
- const customPages = [];
401
- const customPagesPortals = [];
402
- validChildren.forEach((cp, index) => {
403
- if (isReorderItem(cp, reorderItemsLabels)) {
404
- customPages.push({ label: cp.label });
405
- return;
406
- }
407
- if (isCustomPage(cp)) {
408
- const {
409
- portal: contentPortal,
410
- mount,
411
- unmount
412
- } = customPageContentsPortals.find((p) => p.id === (cp.portalId || index));
413
- const {
414
- portal: labelPortal,
415
- mount: mountIcon,
416
- unmount: unmountIcon
417
- } = customPageLabelIconsPortals.find((p) => p.id === (cp.portalId || index));
418
- customPages.push({ label: cp.label, url: cp.url, mount, unmount, mountIcon, unmountIcon });
419
- customPagesPortals.push({ key: `content:${cp.portalId || index}`, portal: contentPortal });
420
- customPagesPortals.push({ key: `label:${cp.portalId || index}`, portal: labelPortal });
421
- return;
422
- }
423
- if (isExternalLink(cp)) {
424
- const {
425
- portal: labelPortal,
426
- mount: mountIcon,
427
- unmount: unmountIcon
428
- } = customLinkLabelIconsPortals.find((p) => p.id === (cp.portalId || index));
429
- customPages.push({ label: cp.label, url: cp.url, mountIcon, unmountIcon });
430
- customPagesPortals.push({ key: `label:${cp.portalId || index}`, portal: labelPortal });
431
- return;
432
- }
433
- });
434
- return { customPages, customPagesPortals };
435
- };
436
- var getCustomPagePortalId = (type, props, key, portalIdCounts) => {
437
- var _a2;
438
- if (key != null) {
439
- return `${type}:key:${key}`;
440
- }
441
- const baseId = `${type}:${props.label}:${props.url}`;
442
- const occurrence = (_a2 = portalIdCounts.get(baseId)) != null ? _a2 : 0;
443
- portalIdCounts.set(baseId, occurrence + 1);
444
- return `${baseId}:${occurrence}`;
445
- };
446
- var isReorderItem = (childProps, validItems) => {
447
- const { children, label, url, labelIcon } = childProps;
448
- return !children && !url && !labelIcon && validItems.some((v) => v === label);
449
- };
450
- var isCustomPage = (childProps) => {
451
- const { children, label, url, labelIcon } = childProps;
452
- return !!children && !!url && !!labelIcon && !!label;
453
- };
454
- var isExternalLink = (childProps) => {
455
- const { children, label, url, labelIcon } = childProps;
456
- return !children && !!url && !!labelIcon && !!label;
457
- };
458
-
459
- // src/utils/useCustomMenuItems.tsx
460
- var import_utils2 = require("@clerk/shared/utils");
461
- var import_react6 = __toESM(require("react"));
462
- var useUserButtonCustomMenuItems = (children, options) => {
463
- var _a2;
464
- const reorderItemsLabels = ["manageAccount", "signOut"];
465
- return useCustomMenuItems({
466
- children,
467
- reorderItemsLabels,
468
- MenuItemsComponent: MenuItems,
469
- MenuActionComponent: MenuAction,
470
- MenuLinkComponent: MenuLink,
471
- UserProfileLinkComponent: UserProfileLink,
472
- UserProfilePageComponent: UserProfilePage,
473
- allowForAnyChildren: (_a2 = options == null ? void 0 : options.allowForAnyChildren) != null ? _a2 : false
474
- });
475
- };
476
- var useCustomMenuItems = ({
477
- children,
478
- MenuItemsComponent,
479
- MenuActionComponent,
480
- MenuLinkComponent,
481
- UserProfileLinkComponent,
482
- UserProfilePageComponent,
483
- reorderItemsLabels,
484
- allowForAnyChildren = false
485
- }) => {
486
- const validChildren = [];
487
- const customMenuItems = [];
488
- const customMenuItemsPortals = [];
489
- const portalIdCounts = /* @__PURE__ */ new Map();
490
- import_react6.default.Children.forEach(children, (child) => {
491
- if (!isThatComponent(child, MenuItemsComponent) && !isThatComponent(child, UserProfileLinkComponent) && !isThatComponent(child, UserProfilePageComponent)) {
492
- if (child && !allowForAnyChildren) {
493
- (0, import_utils2.logErrorInDevMode)(userButtonIgnoredComponent);
494
- }
495
- return;
496
- }
497
- if (isThatComponent(child, UserProfileLinkComponent) || isThatComponent(child, UserProfilePageComponent)) {
498
- return;
499
- }
500
- const { props } = child;
501
- import_react6.default.Children.forEach(props.children, (child2) => {
502
- if (!isThatComponent(child2, MenuActionComponent) && !isThatComponent(child2, MenuLinkComponent)) {
503
- if (child2) {
504
- (0, import_utils2.logErrorInDevMode)(customMenuItemsIgnoredComponent);
505
- }
506
- return;
507
- }
508
- const { props: props2 } = child2;
509
- const childKey = child2.key;
510
- const { label, labelIcon, href, onClick, open } = props2;
511
- if (isThatComponent(child2, MenuActionComponent)) {
512
- if (isReorderItem2(props2, reorderItemsLabels)) {
513
- validChildren.push({ label });
514
- } else if (isCustomMenuItem(props2)) {
515
- const baseItem = {
516
- label,
517
- labelIcon
518
- };
519
- if (onClick !== void 0) {
520
- validChildren.push({
521
- ...baseItem,
522
- onClick,
523
- portalId: getCustomMenuItemPortalId("action", props2, childKey, portalIdCounts)
524
- });
525
- } else if (open !== void 0) {
526
- validChildren.push({
527
- ...baseItem,
528
- open: open.startsWith("/") ? open : `/${open}`,
529
- portalId: getCustomMenuItemPortalId("action", props2, childKey, portalIdCounts)
530
- });
531
- } else {
532
- (0, import_utils2.logErrorInDevMode)("Custom menu item must have either onClick or open property");
533
- return;
534
- }
535
- } else {
536
- (0, import_utils2.logErrorInDevMode)(userButtonMenuItemsActionWrongsProps);
537
- return;
538
- }
539
- }
540
- if (isThatComponent(child2, MenuLinkComponent)) {
541
- if (isExternalLink2(props2)) {
542
- validChildren.push({
543
- label,
544
- labelIcon,
545
- href,
546
- portalId: getCustomMenuItemPortalId("link", props2, childKey, portalIdCounts)
547
- });
548
- } else {
549
- (0, import_utils2.logErrorInDevMode)(userButtonMenuItemLinkWrongProps);
550
- return;
551
- }
552
- }
553
- });
554
- });
555
- const customMenuItemLabelIcons = [];
556
- const customLinkLabelIcons = [];
557
- validChildren.forEach((mi, index) => {
558
- if (isCustomMenuItem(mi)) {
559
- customMenuItemLabelIcons.push({ component: mi.labelIcon, id: mi.portalId || index });
560
- }
561
- if (isExternalLink2(mi)) {
562
- customLinkLabelIcons.push({ component: mi.labelIcon, id: mi.portalId || index });
563
- }
564
- });
565
- const customMenuItemLabelIconsPortals = useCustomElementPortal(customMenuItemLabelIcons);
566
- const customLinkLabelIconsPortals = useCustomElementPortal(customLinkLabelIcons);
567
- validChildren.forEach((mi, index) => {
568
- if (isReorderItem2(mi, reorderItemsLabels)) {
569
- customMenuItems.push({
570
- label: mi.label
571
- });
572
- }
573
- if (isCustomMenuItem(mi)) {
574
- const {
575
- portal: iconPortal,
576
- mount: mountIcon,
577
- unmount: unmountIcon
578
- } = customMenuItemLabelIconsPortals.find((p) => p.id === (mi.portalId || index));
579
- const menuItem = {
580
- label: mi.label,
581
- mountIcon,
582
- unmountIcon
583
- };
584
- if ("onClick" in mi) {
585
- menuItem.onClick = mi.onClick;
586
- } else if ("open" in mi) {
587
- menuItem.open = mi.open;
588
- }
589
- customMenuItems.push(menuItem);
590
- customMenuItemsPortals.push({ key: `icon:${mi.portalId || index}`, portal: iconPortal });
591
- }
592
- if (isExternalLink2(mi)) {
593
- const {
594
- portal: iconPortal,
595
- mount: mountIcon,
596
- unmount: unmountIcon
597
- } = customLinkLabelIconsPortals.find((p) => p.id === (mi.portalId || index));
598
- customMenuItems.push({
599
- label: mi.label,
600
- href: mi.href,
601
- mountIcon,
602
- unmountIcon
603
- });
604
- customMenuItemsPortals.push({ key: `icon:${mi.portalId || index}`, portal: iconPortal });
605
- }
606
- });
607
- return { customMenuItems, customMenuItemsPortals };
608
- };
609
- var getCustomMenuItemPortalId = (type, props, key, portalIdCounts) => {
610
- var _a2;
611
- if (key != null) {
612
- return `${type}:key:${key}`;
613
- }
614
- const target = props.href || props.open || "";
615
- const baseId = `${type}:${props.label}:${target}`;
616
- const occurrence = (_a2 = portalIdCounts.get(baseId)) != null ? _a2 : 0;
617
- portalIdCounts.set(baseId, occurrence + 1);
618
- return `${baseId}:${occurrence}`;
619
- };
620
- var isReorderItem2 = (childProps, validItems) => {
621
- const { children, label, onClick, labelIcon } = childProps;
622
- return !children && !onClick && !labelIcon && validItems.some((v) => v === label);
623
- };
624
- var isCustomMenuItem = (childProps) => {
625
- const { label, labelIcon, onClick, open } = childProps;
626
- return !!labelIcon && !!label && (typeof onClick === "function" || typeof open === "string");
627
- };
628
- var isExternalLink2 = (childProps) => {
629
- const { label, href, labelIcon } = childProps;
630
- return !!href && !!labelIcon && !!label;
631
- };
632
-
633
- // src/utils/useWaitForComponentMount.ts
634
- var import_react7 = require("react");
635
- var createAwaitableMutationObserver = (globalOptions) => {
636
- const isReady = globalOptions == null ? void 0 : globalOptions.isReady;
637
- return (options) => new Promise((resolve, reject) => {
638
- const { root = document == null ? void 0 : document.body, selector, timeout = 0 } = options;
639
- if (!root) {
640
- reject(new Error("No root element provided"));
641
- return;
642
- }
643
- let elementToWatch = root;
644
- if (selector) {
645
- elementToWatch = root == null ? void 0 : root.querySelector(selector);
646
- }
647
- if (isReady(elementToWatch, selector)) {
648
- resolve();
649
- return;
650
- }
651
- const observer = new MutationObserver((mutationsList) => {
652
- for (const mutation of mutationsList) {
653
- if (!elementToWatch && selector) {
654
- elementToWatch = root == null ? void 0 : root.querySelector(selector);
655
- }
656
- if (globalOptions.childList && mutation.type === "childList" || globalOptions.attributes && mutation.type === "attributes") {
657
- if (isReady(elementToWatch, selector)) {
658
- observer.disconnect();
659
- resolve();
660
- return;
661
- }
662
- }
663
- }
664
- });
665
- observer.observe(root, globalOptions);
666
- if (timeout > 0) {
667
- setTimeout(() => {
668
- observer.disconnect();
669
- reject(new Error(`Timeout waiting for ${selector}`));
670
- }, timeout);
671
- }
672
- });
673
- };
674
- var waitForElementChildren = createAwaitableMutationObserver({
675
- childList: true,
676
- subtree: true,
677
- isReady: (el, selector) => {
678
- var _a2;
679
- return !!(el == null ? void 0 : el.childElementCount) && ((_a2 = el == null ? void 0 : el.matches) == null ? void 0 : _a2.call(el, selector)) && el.childElementCount > 0;
680
- }
681
- });
682
- function useWaitForComponentMount(component, options) {
683
- const watcherRef = (0, import_react7.useRef)();
684
- const [status, setStatus] = (0, import_react7.useState)("rendering");
685
- (0, import_react7.useEffect)(() => {
686
- if (!component) {
687
- throw new Error("Clerk: no component name provided, unable to detect mount.");
688
- }
689
- if (typeof window !== "undefined" && !watcherRef.current) {
690
- const defaultSelector = `[data-clerk-component="${component}"]`;
691
- const selector = options == null ? void 0 : options.selector;
692
- watcherRef.current = waitForElementChildren({
693
- selector: selector ? (
694
- // Allows for `[data-clerk-component="xxxx"][data-some-attribute="123"] .my-class`
695
- defaultSelector + selector
696
- ) : defaultSelector
697
- }).then(() => {
698
- setStatus("rendered");
699
- }).catch(() => {
700
- setStatus("error");
701
- });
702
- }
703
- }, [component, options == null ? void 0 : options.selector]);
704
- return status;
705
- }
706
-
707
- // src/components/ClerkHostRenderer.tsx
708
- var import_object = require("@clerk/shared/object");
709
- var import_react8 = require("@clerk/shared/react");
710
- var import_react9 = __toESM(require("react"));
711
- var isMountProps = (props) => {
712
- return "mount" in props;
713
- };
714
- var isOpenProps = (props) => {
715
- return "open" in props;
716
- };
717
- var stripMenuItemIconHandlers = (menuItems) => {
718
- return menuItems == null ? void 0 : menuItems.map(({ mountIcon, unmountIcon, ...rest }) => rest);
719
- };
720
- var ClerkHostRenderer = class extends import_react9.default.PureComponent {
721
- constructor() {
722
- super(...arguments);
723
- this.rootRef = import_react9.default.createRef();
724
- }
725
- componentDidUpdate(_prevProps) {
726
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
727
- if (!isMountProps(_prevProps) || !isMountProps(this.props)) {
728
- return;
729
- }
730
- const prevProps = (0, import_object.without)(_prevProps.props || {}, "customPages", "customMenuItems", "children");
731
- const newProps = (0, import_object.without)(this.props.props || {}, "customPages", "customMenuItems", "children");
732
- const customPagesChanged = ((_b = (_a2 = _prevProps.props) == null ? void 0 : _a2.customPages) == null ? void 0 : _b.length) !== ((_d = (_c = this.props.props) == null ? void 0 : _c.customPages) == null ? void 0 : _d.length);
733
- const customMenuItemsChanged = ((_f = (_e = _prevProps.props) == null ? void 0 : _e.customMenuItems) == null ? void 0 : _f.length) !== ((_h = (_g = this.props.props) == null ? void 0 : _g.customMenuItems) == null ? void 0 : _h.length);
734
- const prevMenuItemsWithoutHandlers = stripMenuItemIconHandlers((_i = _prevProps.props) == null ? void 0 : _i.customMenuItems);
735
- const newMenuItemsWithoutHandlers = stripMenuItemIconHandlers((_j = this.props.props) == null ? void 0 : _j.customMenuItems);
736
- if (!(0, import_react8.isDeeplyEqual)(prevProps, newProps) || !(0, import_react8.isDeeplyEqual)(prevMenuItemsWithoutHandlers, newMenuItemsWithoutHandlers) || customPagesChanged || customMenuItemsChanged) {
737
- if (this.rootRef.current) {
738
- this.props.updateProps({ node: this.rootRef.current, props: this.props.props });
739
- }
740
- }
741
- }
742
- componentDidMount() {
743
- if (this.rootRef.current) {
744
- if (isMountProps(this.props)) {
745
- this.props.mount(this.rootRef.current, this.props.props);
746
- }
747
- if (isOpenProps(this.props)) {
748
- this.props.open(this.props.props);
749
- }
750
- }
751
- }
752
- componentWillUnmount() {
753
- if (this.rootRef.current) {
754
- if (isMountProps(this.props)) {
755
- this.props.unmount(this.rootRef.current);
756
- }
757
- if (isOpenProps(this.props)) {
758
- this.props.close();
759
- }
760
- }
761
- }
762
- render() {
763
- const { hideRootHtmlElement = false } = this.props;
764
- const rootAttributes = {
765
- ref: this.rootRef,
766
- ...this.props.rootProps,
767
- ...this.props.component && { "data-clerk-component": this.props.component }
768
- };
769
- return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, !hideRootHtmlElement && /* @__PURE__ */ import_react9.default.createElement("div", { ...rootAttributes }), this.props.children);
770
- }
771
- };
772
-
773
- // src/components/withClerk.tsx
774
- var import_react12 = require("@clerk/shared/react");
775
- var import_react13 = __toESM(require("react"));
776
-
777
- // src/contexts/IsomorphicClerkContext.tsx
778
- var import_react10 = require("@clerk/shared/react");
779
- var useIsomorphicClerkContext = import_react10.useClerkInstanceContext;
780
-
781
- // src/hooks/useAssertWrappedByClerkProvider.ts
782
- var import_react11 = require("@clerk/shared/react");
783
- var useAssertWrappedByClerkProvider = (source) => {
784
- (0, import_react11.useAssertWrappedByClerkProvider)(() => {
785
- errorThrower.throwMissingClerkProviderError({ source });
786
- });
787
- };
788
-
789
- // src/components/withClerk.tsx
790
- var withClerk = (Component, displayNameOrOptions) => {
791
- const passedDisplayedName = typeof displayNameOrOptions === "string" ? displayNameOrOptions : displayNameOrOptions == null ? void 0 : displayNameOrOptions.component;
792
- const displayName = passedDisplayedName || Component.displayName || Component.name || "Component";
793
- Component.displayName = displayName;
794
- const options = typeof displayNameOrOptions === "string" ? void 0 : displayNameOrOptions;
795
- const HOC = (props) => {
796
- useAssertWrappedByClerkProvider(displayName || "withClerk");
797
- const clerk = useIsomorphicClerkContext();
798
- const getContainer = (0, import_react12.usePortalRoot)();
799
- if (!clerk.loaded && !(options == null ? void 0 : options.renderWhileLoading)) {
800
- return null;
801
- }
802
- return /* @__PURE__ */ import_react13.default.createElement(
803
- Component,
804
- {
805
- getContainer,
806
- ...props,
807
- component: displayName,
808
- clerk
809
- }
810
- );
811
- };
812
- HOC.displayName = `withClerk(${displayName})`;
813
- return HOC;
814
- };
815
-
816
- // src/components/uiComponents.tsx
817
- var CustomPortalsRenderer = (props) => {
818
- var _a2, _b;
819
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, (_a2 = props == null ? void 0 : props.customPagesPortals) == null ? void 0 : _a2.map(({ key, portal }) => (0, import_react14.createElement)(portal, { key })), (_b = props == null ? void 0 : props.customMenuItemsPortals) == null ? void 0 : _b.map(({ key, portal }) => (0, import_react14.createElement)(portal, { key })));
820
- };
821
- var SignIn = withClerk(
822
- ({ clerk, component, fallback, ...props }) => {
823
- const mountingStatus = useWaitForComponentMount(component);
824
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
825
- const rendererRootProps = {
826
- ...shouldShowFallback && fallback && { style: { display: "none" } }
827
- };
828
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
829
- ClerkHostRenderer,
830
- {
831
- component,
832
- mount: clerk.mountSignIn,
833
- unmount: clerk.unmountSignIn,
834
- updateProps: clerk.__internal_updateProps,
835
- props,
836
- rootProps: rendererRootProps
837
- }
838
- ));
839
- },
840
- { component: "SignIn", renderWhileLoading: true }
841
- );
842
- var SignUp = withClerk(
843
- ({ clerk, component, fallback, ...props }) => {
844
- const mountingStatus = useWaitForComponentMount(component);
845
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
846
- const rendererRootProps = {
847
- ...shouldShowFallback && fallback && { style: { display: "none" } }
848
- };
849
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
850
- ClerkHostRenderer,
851
- {
852
- component,
853
- mount: clerk.mountSignUp,
854
- unmount: clerk.unmountSignUp,
855
- updateProps: clerk.__internal_updateProps,
856
- props,
857
- rootProps: rendererRootProps
858
- }
859
- ));
860
- },
861
- { component: "SignUp", renderWhileLoading: true }
862
- );
863
- function UserProfilePage({ children }) {
864
- (0, import_utils3.logErrorInDevMode)(userProfilePageRenderedError);
865
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, children);
866
- }
867
- function UserProfileLink({ children }) {
868
- (0, import_utils3.logErrorInDevMode)(userProfileLinkRenderedError);
869
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, children);
870
- }
871
- var _UserProfile = withClerk(
872
- ({
873
- clerk,
874
- component,
875
- fallback,
876
- ...props
877
- }) => {
878
- const mountingStatus = useWaitForComponentMount(component);
879
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
880
- const rendererRootProps = {
881
- ...shouldShowFallback && fallback && { style: { display: "none" } }
882
- };
883
- const { customPages, customPagesPortals } = useUserProfileCustomPages(props.children);
884
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, /* @__PURE__ */ import_react14.default.createElement(
885
- ClerkHostRenderer,
886
- {
887
- component,
888
- mount: clerk.mountUserProfile,
889
- unmount: clerk.unmountUserProfile,
890
- updateProps: clerk.__internal_updateProps,
891
- props: { ...props, customPages },
892
- rootProps: rendererRootProps
893
- },
894
- /* @__PURE__ */ import_react14.default.createElement(CustomPortalsRenderer, { customPagesPortals })
895
- ));
896
- },
897
- { component: "UserProfile", renderWhileLoading: true }
898
- );
899
- var UserProfile = Object.assign(_UserProfile, {
900
- Page: UserProfilePage,
901
- Link: UserProfileLink
902
- });
903
- var UserButtonContext = (0, import_react14.createContext)({
904
- mount: () => {
905
- },
906
- unmount: () => {
907
- },
908
- updateProps: () => {
909
- }
910
- });
911
- var _UserButton = withClerk(
912
- ({
913
- clerk,
914
- component,
915
- fallback,
916
- ...props
917
- }) => {
918
- const mountingStatus = useWaitForComponentMount(component);
919
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
920
- const rendererRootProps = {
921
- ...shouldShowFallback && fallback && { style: { display: "none" } }
922
- };
923
- const { customPages, customPagesPortals } = useUserProfileCustomPages(props.children, {
924
- allowForAnyChildren: !!props.__experimental_asProvider
925
- });
926
- const userProfileProps = { ...props.userProfileProps, customPages };
927
- const { customMenuItems, customMenuItemsPortals } = useUserButtonCustomMenuItems(props.children, {
928
- allowForAnyChildren: !!props.__experimental_asProvider
929
- });
930
- const sanitizedChildren = useSanitizedChildren(props.children);
931
- const passableProps = {
932
- mount: clerk.mountUserButton,
933
- unmount: clerk.unmountUserButton,
934
- updateProps: clerk.__internal_updateProps,
935
- props: { ...props, userProfileProps, customMenuItems }
936
- };
937
- const portalProps = {
938
- customPagesPortals,
939
- customMenuItemsPortals
940
- };
941
- return /* @__PURE__ */ import_react14.default.createElement(UserButtonContext.Provider, { value: passableProps }, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
942
- ClerkHostRenderer,
943
- {
944
- component,
945
- ...passableProps,
946
- hideRootHtmlElement: !!props.__experimental_asProvider,
947
- rootProps: rendererRootProps
948
- },
949
- props.__experimental_asProvider ? sanitizedChildren : null,
950
- /* @__PURE__ */ import_react14.default.createElement(CustomPortalsRenderer, { ...portalProps })
951
- ));
952
- },
953
- { component: "UserButton", renderWhileLoading: true }
954
- );
955
- function MenuItems({ children }) {
956
- (0, import_utils3.logErrorInDevMode)(userButtonMenuItemsRenderedError);
957
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, children);
958
- }
959
- function MenuAction({ children }) {
960
- (0, import_utils3.logErrorInDevMode)(userButtonMenuActionRenderedError);
961
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, children);
962
- }
963
- function MenuLink({ children }) {
964
- (0, import_utils3.logErrorInDevMode)(userButtonMenuLinkRenderedError);
965
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, children);
966
- }
967
- function UserButtonOutlet(outletProps) {
968
- const providerProps = (0, import_react14.useContext)(UserButtonContext);
969
- const portalProps = {
970
- ...providerProps,
971
- props: {
972
- ...providerProps.props,
973
- ...outletProps
974
- }
975
- };
976
- return /* @__PURE__ */ import_react14.default.createElement(ClerkHostRenderer, { ...portalProps });
977
- }
978
- var UserButton = Object.assign(_UserButton, {
979
- UserProfilePage,
980
- UserProfileLink,
981
- MenuItems,
982
- Action: MenuAction,
983
- Link: MenuLink,
984
- __experimental_Outlet: UserButtonOutlet
985
- });
986
- function OrganizationProfilePage({ children }) {
987
- (0, import_utils3.logErrorInDevMode)(organizationProfilePageRenderedError);
988
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, children);
989
- }
990
- function OrganizationProfileLink({ children }) {
991
- (0, import_utils3.logErrorInDevMode)(organizationProfileLinkRenderedError);
992
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, children);
993
- }
994
- var _OrganizationProfile = withClerk(
995
- ({
996
- clerk,
997
- component,
998
- fallback,
999
- ...props
1000
- }) => {
1001
- const mountingStatus = useWaitForComponentMount(component);
1002
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
1003
- const rendererRootProps = {
1004
- ...shouldShowFallback && fallback && { style: { display: "none" } }
1005
- };
1006
- const { customPages, customPagesPortals } = useOrganizationProfileCustomPages(props.children);
1007
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
1008
- ClerkHostRenderer,
1009
- {
1010
- component,
1011
- mount: clerk.mountOrganizationProfile,
1012
- unmount: clerk.unmountOrganizationProfile,
1013
- updateProps: clerk.__internal_updateProps,
1014
- props: { ...props, customPages },
1015
- rootProps: rendererRootProps
1016
- },
1017
- /* @__PURE__ */ import_react14.default.createElement(CustomPortalsRenderer, { customPagesPortals })
1018
- ));
1019
- },
1020
- { component: "OrganizationProfile", renderWhileLoading: true }
1021
- );
1022
- var OrganizationProfile = Object.assign(_OrganizationProfile, {
1023
- Page: OrganizationProfilePage,
1024
- Link: OrganizationProfileLink
1025
- });
1026
- var CreateOrganization = withClerk(
1027
- ({ clerk, component, fallback, ...props }) => {
1028
- const mountingStatus = useWaitForComponentMount(component);
1029
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
1030
- const rendererRootProps = {
1031
- ...shouldShowFallback && fallback && { style: { display: "none" } }
1032
- };
1033
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
1034
- ClerkHostRenderer,
1035
- {
1036
- component,
1037
- mount: clerk.mountCreateOrganization,
1038
- unmount: clerk.unmountCreateOrganization,
1039
- updateProps: clerk.__internal_updateProps,
1040
- props,
1041
- rootProps: rendererRootProps
1042
- }
1043
- ));
1044
- },
1045
- { component: "CreateOrganization", renderWhileLoading: true }
1046
- );
1047
- var OrganizationSwitcherContext = (0, import_react14.createContext)({
1048
- mount: () => {
1049
- },
1050
- unmount: () => {
1051
- },
1052
- updateProps: () => {
1053
- }
1054
- });
1055
- var _OrganizationSwitcher = withClerk(
1056
- ({
1057
- clerk,
1058
- component,
1059
- fallback,
1060
- ...props
1061
- }) => {
1062
- const mountingStatus = useWaitForComponentMount(component);
1063
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
1064
- const rendererRootProps = {
1065
- ...shouldShowFallback && fallback && { style: { display: "none" } }
1066
- };
1067
- const { customPages, customPagesPortals } = useOrganizationProfileCustomPages(props.children, {
1068
- allowForAnyChildren: !!props.__experimental_asProvider
1069
- });
1070
- const organizationProfileProps = { ...props.organizationProfileProps, customPages };
1071
- const sanitizedChildren = useSanitizedChildren(props.children);
1072
- const passableProps = {
1073
- mount: clerk.mountOrganizationSwitcher,
1074
- unmount: clerk.unmountOrganizationSwitcher,
1075
- updateProps: clerk.__internal_updateProps,
1076
- props: { ...props, organizationProfileProps },
1077
- rootProps: rendererRootProps,
1078
- component
1079
- };
1080
- clerk.__experimental_prefetchOrganizationSwitcher();
1081
- return /* @__PURE__ */ import_react14.default.createElement(OrganizationSwitcherContext.Provider, { value: passableProps }, /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
1082
- ClerkHostRenderer,
1083
- {
1084
- ...passableProps,
1085
- hideRootHtmlElement: !!props.__experimental_asProvider
1086
- },
1087
- props.__experimental_asProvider ? sanitizedChildren : null,
1088
- /* @__PURE__ */ import_react14.default.createElement(CustomPortalsRenderer, { customPagesPortals })
1089
- )));
1090
- },
1091
- { component: "OrganizationSwitcher", renderWhileLoading: true }
1092
- );
1093
- function OrganizationSwitcherOutlet(outletProps) {
1094
- const providerProps = (0, import_react14.useContext)(OrganizationSwitcherContext);
1095
- const portalProps = {
1096
- ...providerProps,
1097
- props: {
1098
- ...providerProps.props,
1099
- ...outletProps
1100
- }
1101
- };
1102
- return /* @__PURE__ */ import_react14.default.createElement(ClerkHostRenderer, { ...portalProps });
1103
- }
1104
- var OrganizationSwitcher = Object.assign(_OrganizationSwitcher, {
1105
- OrganizationProfilePage,
1106
- OrganizationProfileLink,
1107
- __experimental_Outlet: OrganizationSwitcherOutlet
1108
- });
1109
- var OrganizationList = withClerk(
1110
- ({ clerk, component, fallback, ...props }) => {
1111
- const mountingStatus = useWaitForComponentMount(component);
1112
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
1113
- const rendererRootProps = {
1114
- ...shouldShowFallback && fallback && { style: { display: "none" } }
1115
- };
1116
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
1117
- ClerkHostRenderer,
1118
- {
1119
- component,
1120
- mount: clerk.mountOrganizationList,
1121
- unmount: clerk.unmountOrganizationList,
1122
- updateProps: clerk.__internal_updateProps,
1123
- props,
1124
- rootProps: rendererRootProps
1125
- }
1126
- ));
1127
- },
1128
- { component: "OrganizationList", renderWhileLoading: true }
1129
- );
1130
- var GoogleOneTap = withClerk(
1131
- ({ clerk, component, fallback, ...props }) => {
1132
- const mountingStatus = useWaitForComponentMount(component);
1133
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
1134
- const rendererRootProps = {
1135
- ...shouldShowFallback && fallback && { style: { display: "none" } }
1136
- };
1137
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
1138
- ClerkHostRenderer,
1139
- {
1140
- component,
1141
- open: clerk.openGoogleOneTap,
1142
- close: clerk.closeGoogleOneTap,
1143
- updateProps: clerk.__internal_updateProps,
1144
- props,
1145
- rootProps: rendererRootProps
1146
- }
1147
- ));
1148
- },
1149
- { component: "GoogleOneTap", renderWhileLoading: true }
1150
- );
1151
- var Waitlist = withClerk(
1152
- ({ clerk, component, fallback, ...props }) => {
1153
- const mountingStatus = useWaitForComponentMount(component);
1154
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
1155
- const rendererRootProps = {
1156
- ...shouldShowFallback && fallback && { style: { display: "none" } }
1157
- };
1158
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
1159
- ClerkHostRenderer,
1160
- {
1161
- component,
1162
- mount: clerk.mountWaitlist,
1163
- unmount: clerk.unmountWaitlist,
1164
- updateProps: clerk.__internal_updateProps,
1165
- props,
1166
- rootProps: rendererRootProps
1167
- }
1168
- ));
1169
- },
1170
- { component: "Waitlist", renderWhileLoading: true }
1171
- );
1172
- var PricingTable = withClerk(
1173
- ({ clerk, component, fallback, ...props }) => {
1174
- const mountingStatus = useWaitForComponentMount(component, {
1175
- // This attribute is added to the PricingTable root element after we've successfully fetched the plans asynchronously.
1176
- selector: '[data-component-status="ready"]'
1177
- });
1178
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
1179
- const rendererRootProps = {
1180
- ...shouldShowFallback && fallback && { style: { display: "none" } }
1181
- };
1182
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
1183
- ClerkHostRenderer,
1184
- {
1185
- component,
1186
- mount: clerk.mountPricingTable,
1187
- unmount: clerk.unmountPricingTable,
1188
- updateProps: clerk.__internal_updateProps,
1189
- props,
1190
- rootProps: rendererRootProps
1191
- }
1192
- ));
1193
- },
1194
- { component: "PricingTable", renderWhileLoading: true }
1195
- );
1196
- var APIKeys = withClerk(
1197
- ({ clerk, component, fallback, ...props }) => {
1198
- const mountingStatus = useWaitForComponentMount(component);
1199
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
1200
- const rendererRootProps = {
1201
- ...shouldShowFallback && fallback && { style: { display: "none" } }
1202
- };
1203
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
1204
- ClerkHostRenderer,
1205
- {
1206
- component,
1207
- mount: clerk.mountAPIKeys,
1208
- unmount: clerk.unmountAPIKeys,
1209
- updateProps: clerk.__internal_updateProps,
1210
- props,
1211
- rootProps: rendererRootProps
1212
- }
1213
- ));
1214
- },
1215
- { component: "ApiKeys", renderWhileLoading: true }
1216
- );
1217
- var OAuthConsent = withClerk(
1218
- ({ clerk, component, fallback, ...props }) => {
1219
- const mountingStatus = useWaitForComponentMount(component);
1220
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
1221
- const rendererRootProps = {
1222
- ...shouldShowFallback && fallback && { style: { display: "none" } }
1223
- };
1224
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
1225
- ClerkHostRenderer,
1226
- {
1227
- component,
1228
- mount: clerk.__internal_mountOAuthConsent,
1229
- unmount: clerk.__internal_unmountOAuthConsent,
1230
- updateProps: clerk.__internal_updateProps,
1231
- props,
1232
- rootProps: rendererRootProps
1233
- }
1234
- ));
1235
- },
1236
- { component: "OAuthConsent", renderWhileLoading: true }
1237
- );
1238
- var UserAvatar = withClerk(
1239
- ({ clerk, component, fallback, ...props }) => {
1240
- const mountingStatus = useWaitForComponentMount(component);
1241
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
1242
- const rendererRootProps = {
1243
- ...shouldShowFallback && fallback && { style: { display: "none" } }
1244
- };
1245
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
1246
- ClerkHostRenderer,
1247
- {
1248
- component,
1249
- mount: clerk.mountUserAvatar,
1250
- unmount: clerk.unmountUserAvatar,
1251
- updateProps: clerk.__internal_updateProps,
1252
- props,
1253
- rootProps: rendererRootProps
1254
- }
1255
- ));
1256
- },
1257
- { component: "UserAvatar", renderWhileLoading: true }
1258
- );
1259
- var TaskChooseOrganization = withClerk(
1260
- ({ clerk, component, fallback, ...props }) => {
1261
- const mountingStatus = useWaitForComponentMount(component);
1262
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
1263
- const rendererRootProps = {
1264
- ...shouldShowFallback && fallback && { style: { display: "none" } }
1265
- };
1266
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
1267
- ClerkHostRenderer,
1268
- {
1269
- component,
1270
- mount: clerk.mountTaskChooseOrganization,
1271
- unmount: clerk.unmountTaskChooseOrganization,
1272
- updateProps: clerk.__internal_updateProps,
1273
- props,
1274
- rootProps: rendererRootProps
1275
- }
1276
- ));
1277
- },
1278
- { component: "TaskChooseOrganization", renderWhileLoading: true }
1279
- );
1280
- var TaskResetPassword = withClerk(
1281
- ({ clerk, component, fallback, ...props }) => {
1282
- const mountingStatus = useWaitForComponentMount(component);
1283
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
1284
- const rendererRootProps = {
1285
- ...shouldShowFallback && fallback && { style: { display: "none" } }
1286
- };
1287
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
1288
- ClerkHostRenderer,
1289
- {
1290
- component,
1291
- mount: clerk.mountTaskResetPassword,
1292
- unmount: clerk.unmountTaskResetPassword,
1293
- updateProps: clerk.__internal_updateProps,
1294
- props,
1295
- rootProps: rendererRootProps
1296
- }
1297
- ));
1298
- },
1299
- { component: "TaskResetPassword", renderWhileLoading: true }
1300
- );
1301
- var TaskSetupMFA = withClerk(
1302
- ({ clerk, component, fallback, ...props }) => {
1303
- const mountingStatus = useWaitForComponentMount(component);
1304
- const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
1305
- const rendererRootProps = {
1306
- ...shouldShowFallback && fallback && { style: { display: "none" } }
1307
- };
1308
- return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
1309
- ClerkHostRenderer,
1310
- {
1311
- component,
1312
- mount: clerk.mountTaskSetupMFA,
1313
- unmount: clerk.unmountTaskSetupMFA,
1314
- updateProps: clerk.__internal_updateProps,
1315
- props,
1316
- rootProps: rendererRootProps
1317
- }
1318
- ));
1319
- },
1320
- { component: "TaskSetupMFA", renderWhileLoading: true }
1321
- );
1322
-
1323
- // src/components/controlComponents.tsx
1324
- var import_deprecated = require("@clerk/shared/deprecated");
1325
- var import_react21 = require("@clerk/shared/react");
1326
- var import_react22 = __toESM(require("react"));
1327
-
1328
- // src/hooks/useAuth.ts
1329
- var import_authorization = require("@clerk/shared/authorization");
1330
- var import_telemetry = require("@clerk/shared/telemetry");
1331
- var import_react17 = require("react");
1332
-
1333
- // src/hooks/useAuthBase.tsx
1334
- var import_deriveState = require("@clerk/shared/deriveState");
1335
- var import_react15 = require("@clerk/shared/react");
1336
- var import_react16 = require("react");
1337
- var defaultDerivedInitialState = {
1338
- actor: void 0,
1339
- factorVerificationAge: null,
1340
- orgId: void 0,
1341
- orgPermissions: void 0,
1342
- orgRole: void 0,
1343
- orgSlug: void 0,
1344
- sessionClaims: void 0,
1345
- sessionId: void 0,
1346
- sessionStatus: void 0,
1347
- userId: void 0
1348
- };
1349
- function useAuthBase() {
1350
- const clerk = (0, import_react15.useClerkInstanceContext)();
1351
- const initialState = (0, import_react15.useInitialStateContext)();
1352
- const getInitialState = (0, import_react16.useCallback)(() => initialState, [initialState]);
1353
- const state = (0, import_react16.useSyncExternalStore)(
1354
- (0, import_react16.useCallback)((callback) => clerk.addListener(callback, { skipInitialEmit: true }), [clerk]),
1355
- (0, import_react16.useCallback)(() => {
1356
- if (!clerk.loaded || !clerk.__internal_lastEmittedResources) {
1357
- return getInitialState();
1358
- }
1359
- return clerk.__internal_lastEmittedResources;
1360
- }, [clerk, getInitialState]),
1361
- getInitialState
1362
- );
1363
- const authState = (0, import_react16.useMemo)(() => {
1364
- if (!state) {
1365
- return defaultDerivedInitialState;
1366
- }
1367
- const fullState = isInitialState(state) ? (0, import_deriveState.deriveState)(false, {}, state) : (0, import_deriveState.deriveState)(true, state, void 0);
1368
- return authStateFromFull(fullState);
1369
- }, [state]);
1370
- return authState;
1371
- }
1372
- function authStateFromFull(derivedState) {
1373
- return {
1374
- sessionId: derivedState.sessionId,
1375
- sessionStatus: derivedState.sessionStatus,
1376
- sessionClaims: derivedState.sessionClaims,
1377
- userId: derivedState.userId,
1378
- actor: derivedState.actor,
1379
- orgId: derivedState.orgId,
1380
- orgRole: derivedState.orgRole,
1381
- orgSlug: derivedState.orgSlug,
1382
- orgPermissions: derivedState.orgPermissions,
1383
- factorVerificationAge: derivedState.factorVerificationAge
1384
- };
1385
- }
1386
- function isInitialState(state) {
1387
- return !("client" in state);
1388
- }
1389
-
1390
- // src/hooks/utils.ts
1391
- var import_browser = require("@clerk/shared/browser");
1392
- var import_error2 = require("@clerk/shared/error");
1393
- var clerkLoaded = (isomorphicClerk) => {
1394
- return new Promise((resolve) => {
1395
- const handler = (status) => {
1396
- if (["ready", "degraded"].includes(status)) {
1397
- resolve();
1398
- isomorphicClerk.off("status", handler);
1399
- }
1400
- };
1401
- isomorphicClerk.on("status", handler, { notify: true });
1402
- });
1403
- };
1404
- var createGetToken = (isomorphicClerk) => {
1405
- return async (options) => {
1406
- if (!(0, import_browser.inBrowser)()) {
1407
- throw new import_error2.ClerkRuntimeError(
1408
- "useAuth().getToken() can only be used in browser environments. To access auth data server-side, see the Auth object reference doc: https://clerk.com/docs/reference/backend/types/auth-object",
1409
- {
1410
- code: "clerk_runtime_not_browser"
1411
- }
1412
- );
1413
- }
1414
- await clerkLoaded(isomorphicClerk);
1415
- if (!isomorphicClerk.session) {
1416
- return null;
1417
- }
1418
- return isomorphicClerk.session.getToken(options);
1419
- };
1420
- };
1421
- var createSignOut = (isomorphicClerk) => {
1422
- return async (...args) => {
1423
- await clerkLoaded(isomorphicClerk);
1424
- return isomorphicClerk.signOut(...args);
1425
- };
1426
- };
1427
-
1428
- // src/hooks/useAuth.ts
1429
- var useAuth = (options = {}) => {
1430
- var _a2;
1431
- useAssertWrappedByClerkProvider("useAuth");
1432
- const { treatPendingAsSignedOut } = options != null ? options : {};
1433
- const authState = useAuthBase();
1434
- const isomorphicClerk = useIsomorphicClerkContext();
1435
- const getToken2 = (0, import_react17.useCallback)(createGetToken(isomorphicClerk), [isomorphicClerk]);
1436
- const signOut = (0, import_react17.useCallback)(createSignOut(isomorphicClerk), [isomorphicClerk]);
1437
- (_a2 = isomorphicClerk.telemetry) == null ? void 0 : _a2.record((0, import_telemetry.eventMethodCalled)("useAuth", { treatPendingAsSignedOut }));
1438
- return useDerivedAuth(
1439
- {
1440
- ...authState,
1441
- getToken: getToken2,
1442
- signOut
1443
- },
1444
- {
1445
- treatPendingAsSignedOut
1446
- }
1447
- );
1448
- };
1449
- function useDerivedAuth(authObject, { treatPendingAsSignedOut = true } = {}) {
1450
- const { userId, orgId, orgRole, has, signOut, getToken: getToken2, orgPermissions, factorVerificationAge, sessionClaims } = authObject != null ? authObject : {};
1451
- const derivedHas = (0, import_react17.useCallback)(
1452
- (params) => {
1453
- if (has) {
1454
- return has(params);
1455
- }
1456
- return (0, import_authorization.createCheckAuthorization)({
1457
- userId,
1458
- orgId,
1459
- orgRole,
1460
- orgPermissions,
1461
- factorVerificationAge,
1462
- features: (sessionClaims == null ? void 0 : sessionClaims.fea) || "",
1463
- plans: (sessionClaims == null ? void 0 : sessionClaims.pla) || ""
1464
- })(params);
1465
- },
1466
- [has, userId, orgId, orgRole, orgPermissions, factorVerificationAge, sessionClaims]
1467
- );
1468
- const payload = (0, import_authorization.resolveAuthState)({
1469
- authObject: {
1470
- ...authObject,
1471
- getToken: getToken2,
1472
- signOut,
1473
- has: derivedHas
1474
- },
1475
- options: {
1476
- treatPendingAsSignedOut
1477
- }
1478
- });
1479
- if (!payload) {
1480
- return errorThrower.throw(invalidStateError);
1481
- }
1482
- return payload;
1483
- }
1484
-
1485
- // src/hooks/useEmailLink.ts
1486
- var import_react18 = __toESM(require("react"));
1487
- function useEmailLink(resource) {
1488
- const { startEmailLinkFlow, cancelEmailLinkFlow } = import_react18.default.useMemo(() => resource.createEmailLinkFlow(), [resource]);
1489
- import_react18.default.useEffect(() => {
1490
- return cancelEmailLinkFlow;
1491
- }, []);
1492
- return {
1493
- startEmailLinkFlow,
1494
- cancelEmailLinkFlow
1495
- };
1496
- }
1497
-
1498
- // src/hooks/useClerkSignal.ts
1499
- var import_telemetry2 = require("@clerk/shared/telemetry");
1500
- var import_react19 = require("react");
1501
- function useClerkSignal(signal) {
1502
- var _a2, _b, _c;
1503
- useAssertWrappedByClerkProvider("useClerkSignal");
1504
- const clerk = useIsomorphicClerkContext();
1505
- switch (signal) {
1506
- case "signIn":
1507
- (_a2 = clerk.telemetry) == null ? void 0 : _a2.record((0, import_telemetry2.eventMethodCalled)("useSignIn", { apiVersion: "2025-11" }));
1508
- break;
1509
- case "signUp":
1510
- (_b = clerk.telemetry) == null ? void 0 : _b.record((0, import_telemetry2.eventMethodCalled)("useSignUp", { apiVersion: "2025-11" }));
1511
- break;
1512
- case "waitlist":
1513
- (_c = clerk.telemetry) == null ? void 0 : _c.record((0, import_telemetry2.eventMethodCalled)("useWaitlist", { apiVersion: "2025-11" }));
1514
- break;
1515
- default:
1516
- break;
1517
- }
1518
- const subscribe = (0, import_react19.useCallback)(
1519
- (callback) => {
1520
- if (!clerk.loaded) {
1521
- return () => {
1522
- };
1523
- }
1524
- return clerk.__internal_state.__internal_effect(() => {
1525
- switch (signal) {
1526
- case "signIn":
1527
- clerk.__internal_state.signInSignal();
1528
- break;
1529
- case "signUp":
1530
- clerk.__internal_state.signUpSignal();
1531
- break;
1532
- case "waitlist":
1533
- clerk.__internal_state.waitlistSignal();
1534
- break;
1535
- default:
1536
- throw new Error(`Unknown signal: ${signal}`);
1537
- }
1538
- callback();
1539
- });
1540
- },
1541
- [clerk, clerk.loaded, clerk.__internal_state]
1542
- );
1543
- const getSnapshot = (0, import_react19.useCallback)(() => {
1544
- switch (signal) {
1545
- case "signIn":
1546
- return clerk.__internal_state.signInSignal();
1547
- case "signUp":
1548
- return clerk.__internal_state.signUpSignal();
1549
- case "waitlist":
1550
- return clerk.__internal_state.waitlistSignal();
1551
- default:
1552
- throw new Error(`Unknown signal: ${signal}`);
1553
- }
1554
- }, [clerk.__internal_state]);
1555
- const value = (0, import_react19.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
1556
- return value;
1557
- }
1558
- var useSignIn = () => {
1559
- return useClerkSignal("signIn");
1560
- };
1561
- var useSignUp = () => {
1562
- return useClerkSignal("signUp");
1563
- };
1564
- function useWaitlist() {
1565
- return useClerkSignal("waitlist");
1566
- }
1567
-
1568
- // src/hooks/index.ts
1569
- var import_react20 = require("@clerk/shared/react");
1570
-
1571
- // src/components/controlComponents.tsx
1572
- var ClerkLoaded = ({ children }) => {
1573
- useAssertWrappedByClerkProvider("ClerkLoaded");
1574
- const isomorphicClerk = useIsomorphicClerkContext();
1575
- if (!isomorphicClerk.loaded) {
1576
- return null;
1577
- }
1578
- return children;
1579
- };
1580
- var ClerkLoading = ({ children }) => {
1581
- useAssertWrappedByClerkProvider("ClerkLoading");
1582
- const isomorphicClerk = useIsomorphicClerkContext();
1583
- if (isomorphicClerk.status !== "loading") {
1584
- return null;
1585
- }
1586
- return children;
1587
- };
1588
- var ClerkFailed = ({ children }) => {
1589
- useAssertWrappedByClerkProvider("ClerkFailed");
1590
- const isomorphicClerk = useIsomorphicClerkContext();
1591
- if (isomorphicClerk.status !== "error") {
1592
- return null;
1593
- }
1594
- return children;
1595
- };
1596
- var ClerkDegraded = ({ children }) => {
1597
- useAssertWrappedByClerkProvider("ClerkDegraded");
1598
- const isomorphicClerk = useIsomorphicClerkContext();
1599
- if (isomorphicClerk.status !== "degraded") {
1600
- return null;
1601
- }
1602
- return children;
1603
- };
1604
- var Show = ({ children, fallback, treatPendingAsSignedOut, when }) => {
1605
- useAssertWrappedByClerkProvider("Show");
1606
- const { has, isLoaded, userId } = useAuth({ treatPendingAsSignedOut });
1607
- if (!isLoaded) {
1608
- return null;
1609
- }
1610
- const resolvedWhen = when;
1611
- const authorized = children;
1612
- const unauthorized = fallback != null ? fallback : null;
1613
- if (resolvedWhen === "signed-out") {
1614
- return userId ? unauthorized : authorized;
1615
- }
1616
- if (!userId) {
1617
- return unauthorized;
1618
- }
1619
- if (resolvedWhen === "signed-in") {
1620
- return authorized;
1621
- }
1622
- if (checkAuthorization(resolvedWhen, has)) {
1623
- return authorized;
1624
- }
1625
- return unauthorized;
1626
- };
1627
- function checkAuthorization(when, has) {
1628
- if (typeof when === "function") {
1629
- return when(has);
1630
- }
1631
- return has(when);
1632
- }
1633
- var RedirectToSignIn = withClerk(({ clerk, ...props }) => {
1634
- var _a2, _b;
1635
- const { client, session } = clerk;
1636
- const hasSignedInSessions = ((_b = (_a2 = client.signedInSessions) == null ? void 0 : _a2.length) != null ? _b : 0) > 0;
1637
- import_react22.default.useEffect(() => {
1638
- if (session === null && hasSignedInSessions) {
1639
- void clerk.redirectToAfterSignOut();
1640
- } else {
1641
- void clerk.redirectToSignIn(props);
1642
- }
1643
- }, []);
1644
- return null;
1645
- }, "RedirectToSignIn");
1646
- var RedirectToSignUp = withClerk(({ clerk, ...props }) => {
1647
- import_react22.default.useEffect(() => {
1648
- void clerk.redirectToSignUp(props);
1649
- }, []);
1650
- return null;
1651
- }, "RedirectToSignUp");
1652
- var RedirectToTasks = withClerk(({ clerk, ...props }) => {
1653
- import_react22.default.useEffect(() => {
1654
- void clerk.redirectToTasks(props);
1655
- }, []);
1656
- return null;
1657
- }, "RedirectToTasks");
1658
- var RedirectToUserProfile = withClerk(({ clerk }) => {
1659
- import_react22.default.useEffect(() => {
1660
- (0, import_deprecated.deprecated)("RedirectToUserProfile", "Use the `redirectToUserProfile()` method instead.");
1661
- void clerk.redirectToUserProfile();
1662
- }, []);
1663
- return null;
1664
- }, "RedirectToUserProfile");
1665
- var RedirectToOrganizationProfile = withClerk(({ clerk }) => {
1666
- import_react22.default.useEffect(() => {
1667
- (0, import_deprecated.deprecated)("RedirectToOrganizationProfile", "Use the `redirectToOrganizationProfile()` method instead.");
1668
- void clerk.redirectToOrganizationProfile();
1669
- }, []);
1670
- return null;
1671
- }, "RedirectToOrganizationProfile");
1672
- var RedirectToCreateOrganization = withClerk(({ clerk }) => {
1673
- import_react22.default.useEffect(() => {
1674
- (0, import_deprecated.deprecated)("RedirectToCreateOrganization", "Use the `redirectToCreateOrganization()` method instead.");
1675
- void clerk.redirectToCreateOrganization();
1676
- }, []);
1677
- return null;
1678
- }, "RedirectToCreateOrganization");
1679
- var AuthenticateWithRedirectCallback = withClerk(
1680
- ({ clerk, ...handleRedirectCallbackParams }) => {
1681
- import_react22.default.useEffect(() => {
1682
- void clerk.handleRedirectCallback(handleRedirectCallbackParams);
1683
- }, []);
1684
- return null;
1685
- },
1686
- "AuthenticateWithRedirectCallback"
1687
- );
1688
-
1689
- // src/components/SignInButton.tsx
1690
- var import_react23 = __toESM(require("react"));
1691
- var SignInButton = withClerk(
1692
- ({ clerk, children, ...props }) => {
1693
- const {
1694
- // @ts-expect-error - appearance is a valid prop for SignInProps & SignInButtonPropsModal
1695
- appearance,
1696
- getContainer,
1697
- component,
1698
- signUpFallbackRedirectUrl,
1699
- forceRedirectUrl,
1700
- fallbackRedirectUrl,
1701
- signUpForceRedirectUrl,
1702
- mode,
1703
- initialValues,
1704
- withSignUp,
1705
- oauthFlow,
1706
- ...rest
1707
- } = props;
1708
- children = normalizeWithDefaultValue(children, "Sign in");
1709
- const child = assertSingleChild(children)("SignInButton");
1710
- const clickHandler = () => {
1711
- const opts = {
1712
- forceRedirectUrl,
1713
- fallbackRedirectUrl,
1714
- signUpFallbackRedirectUrl,
1715
- signUpForceRedirectUrl,
1716
- initialValues,
1717
- withSignUp,
1718
- oauthFlow
1719
- };
1720
- if (mode === "modal") {
1721
- return clerk.openSignIn({ ...opts, appearance, getContainer });
1722
- }
1723
- return clerk.redirectToSignIn({
1724
- ...opts,
1725
- signInFallbackRedirectUrl: fallbackRedirectUrl,
1726
- signInForceRedirectUrl: forceRedirectUrl
1727
- });
1728
- };
1729
- const wrappedChildClickHandler = async (e) => {
1730
- if (child && typeof child === "object" && "props" in child) {
1731
- await safeExecute(child.props.onClick)(e);
1732
- }
1733
- return clickHandler();
1734
- };
1735
- const childProps = { ...rest, onClick: wrappedChildClickHandler };
1736
- return import_react23.default.cloneElement(child, childProps);
1737
- },
1738
- { component: "SignInButton", renderWhileLoading: true }
1739
- );
1740
-
1741
- // src/components/SignInWithMetamaskButton.tsx
1742
- var import_react24 = __toESM(require("react"));
1743
- var SignInWithMetamaskButton = withClerk(
1744
- ({ clerk, children, ...props }) => {
1745
- const { redirectUrl, getContainer, component, ...rest } = props;
1746
- children = normalizeWithDefaultValue(children, "Sign in with Metamask");
1747
- const child = assertSingleChild(children)("SignInWithMetamaskButton");
1748
- const clickHandler = async () => {
1749
- async function authenticate() {
1750
- await clerk.authenticateWithMetamask({ redirectUrl: redirectUrl || void 0 });
1751
- }
1752
- void authenticate();
1753
- };
1754
- const wrappedChildClickHandler = async (e) => {
1755
- await safeExecute(child.props.onClick)(e);
1756
- return clickHandler();
1757
- };
1758
- const childProps = { ...rest, onClick: wrappedChildClickHandler };
1759
- return import_react24.default.cloneElement(child, childProps);
1760
- },
1761
- { component: "SignInWithMetamask", renderWhileLoading: true }
1762
- );
1763
-
1764
- // src/components/SignOutButton.tsx
1765
- var import_deprecated2 = require("@clerk/shared/deprecated");
1766
- var import_react25 = __toESM(require("react"));
1767
- var SignOutButton = withClerk(
1768
- ({ clerk, children, ...props }) => {
1769
- const { redirectUrl = "/", sessionId, signOutOptions, getContainer, component, ...rest } = props;
1770
- if (signOutOptions) {
1771
- (0, import_deprecated2.deprecated)("SignOutButton `signOutOptions`", "Use the `redirectUrl` and `sessionId` props directly instead.");
1772
- }
1773
- children = normalizeWithDefaultValue(children, "Sign out");
1774
- const child = assertSingleChild(children)("SignOutButton");
1775
- const clickHandler = () => clerk.signOut({
1776
- redirectUrl,
1777
- ...sessionId !== void 0 && { sessionId },
1778
- ...signOutOptions
1779
- });
1780
- const wrappedChildClickHandler = async (e) => {
1781
- await safeExecute(child.props.onClick)(e);
1782
- return clickHandler();
1783
- };
1784
- const childProps = { ...rest, onClick: wrappedChildClickHandler };
1785
- return import_react25.default.cloneElement(child, childProps);
1786
- },
1787
- { component: "SignOutButton", renderWhileLoading: true }
1788
- );
1789
-
1790
- // src/components/SignUpButton.tsx
1791
- var import_react26 = __toESM(require("react"));
1792
- var SignUpButton = withClerk(
1793
- ({ clerk, children, ...props }) => {
1794
- const {
1795
- // @ts-expect-error - appearance is a valid prop for SignUpProps & SignUpButtonPropsModal
1796
- appearance,
1797
- // @ts-expect-error - unsafeMetadata is a valid prop for SignUpProps & SignUpButtonPropsModal
1798
- unsafeMetadata,
1799
- getContainer,
1800
- component,
1801
- fallbackRedirectUrl,
1802
- forceRedirectUrl,
1803
- signInFallbackRedirectUrl,
1804
- signInForceRedirectUrl,
1805
- mode,
1806
- initialValues,
1807
- oauthFlow,
1808
- ...rest
1809
- } = props;
1810
- children = normalizeWithDefaultValue(children, "Sign up");
1811
- const child = assertSingleChild(children)("SignUpButton");
1812
- const clickHandler = () => {
1813
- const opts = {
1814
- fallbackRedirectUrl,
1815
- forceRedirectUrl,
1816
- signInFallbackRedirectUrl,
1817
- signInForceRedirectUrl,
1818
- initialValues,
1819
- oauthFlow
1820
- };
1821
- if (mode === "modal") {
1822
- return clerk.openSignUp({
1823
- ...opts,
1824
- appearance,
1825
- unsafeMetadata,
1826
- getContainer
1827
- });
1828
- }
1829
- return clerk.redirectToSignUp({
1830
- ...opts,
1831
- signUpFallbackRedirectUrl: fallbackRedirectUrl,
1832
- signUpForceRedirectUrl: forceRedirectUrl
1833
- });
1834
- };
1835
- const wrappedChildClickHandler = async (e) => {
1836
- if (child && typeof child === "object" && "props" in child) {
1837
- await safeExecute(child.props.onClick)(e);
1838
- }
1839
- return clickHandler();
1840
- };
1841
- const childProps = { ...rest, onClick: wrappedChildClickHandler };
1842
- return import_react26.default.cloneElement(child, childProps);
1843
- },
1844
- { component: "SignUpButton", renderWhileLoading: true }
1845
- );
1846
-
1847
- // src/components/HandleSSOCallback.tsx
1848
- var import_react27 = __toESM(require("react"));
1849
- function HandleSSOCallback(props) {
1850
- const { navigateToApp, navigateToSignIn, navigateToSignUp } = props;
1851
- const clerk = (0, import_react20.useClerk)();
1852
- const { signIn } = useSignIn();
1853
- const { signUp } = useSignUp();
1854
- const hasRun = (0, import_react27.useRef)(false);
1855
- (0, import_react27.useEffect)(() => {
1856
- (async () => {
1857
- var _a2, _b, _c;
1858
- if (!clerk.loaded || hasRun.current) {
1859
- return;
1860
- }
1861
- hasRun.current = true;
1862
- if (signIn.status === "complete") {
1863
- await signIn.finalize({
1864
- navigate: async (...params) => {
1865
- navigateToApp(...params);
1866
- }
1867
- });
1868
- return;
1869
- }
1870
- if (signUp.isTransferable) {
1871
- await signIn.create({ transfer: true });
1872
- if (signIn.status === "complete") {
1873
- await signIn.finalize({
1874
- navigate: async (...params) => {
1875
- navigateToApp(...params);
1876
- }
1877
- });
1878
- return;
1879
- }
1880
- return navigateToSignIn();
1881
- }
1882
- if (signIn.status === "needs_first_factor" && !((_a2 = signIn.supportedFirstFactors) == null ? void 0 : _a2.every((f) => f.strategy === "enterprise_sso"))) {
1883
- return navigateToSignIn();
1884
- }
1885
- if (signIn.isTransferable) {
1886
- await signUp.create({ transfer: true });
1887
- if (signUp.status === "complete") {
1888
- await signUp.finalize({
1889
- navigate: async (...params) => {
1890
- navigateToApp(...params);
1891
- }
1892
- });
1893
- return;
1894
- }
1895
- return navigateToSignUp();
1896
- }
1897
- if (signUp.status === "complete") {
1898
- await signUp.finalize({
1899
- navigate: async (...params) => {
1900
- navigateToApp(...params);
1901
- }
1902
- });
1903
- return;
1904
- }
1905
- if (signIn.status === "needs_second_factor" || signIn.status === "needs_new_password") {
1906
- return navigateToSignIn();
1907
- }
1908
- if (signIn.existingSession || signUp.existingSession) {
1909
- const sessionId = ((_b = signIn.existingSession) == null ? void 0 : _b.sessionId) || ((_c = signUp.existingSession) == null ? void 0 : _c.sessionId);
1910
- if (sessionId) {
1911
- await clerk.setActive({
1912
- session: sessionId,
1913
- navigate: async (...params) => {
1914
- return navigateToApp(...params);
1915
- }
1916
- });
1917
- return;
1918
- }
1919
- }
1920
- })();
1921
- }, [clerk, clerk.loaded, signIn, signUp]);
1922
- return /* @__PURE__ */ import_react27.default.createElement("div", null, /* @__PURE__ */ import_react27.default.createElement("div", { id: "clerk-captcha" }));
1923
- }
1924
-
1925
- // src/contexts/ClerkProvider.tsx
1926
- var import_react29 = require("@clerk/shared/react");
1927
- var import_react30 = __toESM(require("react"));
1928
-
1929
- // src/isomorphicClerk.ts
1930
- var import_browser3 = require("@clerk/shared/browser");
1931
- var import_clerkEventBus = require("@clerk/shared/clerkEventBus");
1932
- var import_loadClerkJsScript = require("@clerk/shared/loadClerkJsScript");
1933
- var import_utils10 = require("@clerk/shared/utils");
1934
-
1935
- // src/stateProxy.ts
1936
- var import_browser2 = require("@clerk/shared/browser");
1937
- var defaultSignInErrors = () => ({
1938
- fields: {
1939
- identifier: null,
1940
- password: null,
1941
- code: null
1942
- },
1943
- raw: null,
1944
- global: null
1945
- });
1946
- var defaultSignUpErrors = () => ({
1947
- fields: {
1948
- firstName: null,
1949
- lastName: null,
1950
- emailAddress: null,
1951
- phoneNumber: null,
1952
- password: null,
1953
- username: null,
1954
- code: null,
1955
- captcha: null,
1956
- legalAccepted: null
1957
- },
1958
- raw: null,
1959
- global: null
1960
- });
1961
- var defaultWaitlistErrors = () => ({
1962
- fields: {
1963
- emailAddress: null
1964
- },
1965
- raw: null,
1966
- global: null
1967
- });
1968
- var defaultVerificationResource = () => ({
1969
- pathRoot: "",
1970
- attempts: null,
1971
- error: null,
1972
- expireAt: null,
1973
- externalVerificationRedirectURL: null,
1974
- nonce: null,
1975
- message: null,
1976
- status: null,
1977
- strategy: null,
1978
- verifiedAtClient: null,
1979
- verifiedFromTheSameClient() {
1980
- return false;
1981
- },
1982
- reload() {
1983
- throw new Error("reload() called before Clerk is loaded");
1984
- },
1985
- __internal_toSnapshot() {
1986
- return {
1987
- object: "verification",
1988
- id: "",
1989
- attempts: null,
1990
- error: { code: "", message: "" },
1991
- expire_at: null,
1992
- externalVerificationRedirectURL: null,
1993
- nonce: null,
1994
- message: null,
1995
- status: null,
1996
- strategy: null,
1997
- verified_at_client: null
1998
- };
1999
- }
2000
- });
2001
- var defaultSignUpVerificationResource = () => ({
2002
- ...defaultVerificationResource(),
2003
- supportedStrategies: [],
2004
- nextAction: "",
2005
- reload() {
2006
- throw new Error("reload() called before Clerk is loaded");
2007
- },
2008
- __internal_toSnapshot() {
2009
- return {
2010
- ...defaultVerificationResource().__internal_toSnapshot(),
2011
- next_action: this.nextAction,
2012
- supported_strategies: this.supportedStrategies
2013
- };
2014
- }
2015
- });
2016
- var StateProxy = class {
2017
- constructor(isomorphicClerk) {
2018
- this.isomorphicClerk = isomorphicClerk;
2019
- this.signInSignalProxy = this.buildSignInProxy();
2020
- this.signUpSignalProxy = this.buildSignUpProxy();
2021
- this.waitlistSignalProxy = this.buildWaitlistProxy();
2022
- }
2023
- signInSignal() {
2024
- return this.signInSignalProxy;
2025
- }
2026
- signUpSignal() {
2027
- return this.signUpSignalProxy;
2028
- }
2029
- waitlistSignal() {
2030
- return this.waitlistSignalProxy;
2031
- }
2032
- get __internal_waitlist() {
2033
- return this.state.__internal_waitlist;
2034
- }
2035
- checkoutSignal(params) {
2036
- return this.buildCheckoutProxy(params);
2037
- }
2038
- buildSignInProxy() {
2039
- const gateProperty = this.gateProperty.bind(this);
2040
- const target = () => this.client.signIn.__internal_future;
2041
- return {
2042
- errors: defaultSignInErrors(),
2043
- fetchStatus: "idle",
2044
- signIn: {
2045
- status: "needs_identifier",
2046
- availableStrategies: [],
2047
- get isTransferable() {
2048
- return gateProperty(target, "isTransferable", false);
2049
- },
2050
- get id() {
2051
- return gateProperty(target, "id", void 0);
2052
- },
2053
- get supportedFirstFactors() {
2054
- return gateProperty(target, "supportedFirstFactors", []);
2055
- },
2056
- get supportedSecondFactors() {
2057
- return gateProperty(target, "supportedSecondFactors", []);
2058
- },
2059
- get secondFactorVerification() {
2060
- return gateProperty(target, "secondFactorVerification", {
2061
- status: null,
2062
- error: null,
2063
- expireAt: null,
2064
- externalVerificationRedirectURL: null,
2065
- nonce: null,
2066
- attempts: null,
2067
- message: null,
2068
- strategy: null,
2069
- verifiedAtClient: null,
2070
- verifiedFromTheSameClient: () => false,
2071
- __internal_toSnapshot: () => {
2072
- throw new Error("__internal_toSnapshot called before Clerk is loaded");
2073
- },
2074
- pathRoot: "",
2075
- reload: () => {
2076
- throw new Error("__internal_toSnapshot called before Clerk is loaded");
2077
- }
2078
- });
2079
- },
2080
- get identifier() {
2081
- return gateProperty(target, "identifier", null);
2082
- },
2083
- get createdSessionId() {
2084
- return gateProperty(target, "createdSessionId", null);
2085
- },
2086
- get userData() {
2087
- return gateProperty(target, "userData", {});
2088
- },
2089
- get firstFactorVerification() {
2090
- return gateProperty(target, "firstFactorVerification", {
2091
- status: null,
2092
- error: null,
2093
- expireAt: null,
2094
- externalVerificationRedirectURL: null,
2095
- nonce: null,
2096
- attempts: null,
2097
- message: null,
2098
- strategy: null,
2099
- verifiedAtClient: null,
2100
- verifiedFromTheSameClient: () => false,
2101
- __internal_toSnapshot: () => {
2102
- throw new Error("__internal_toSnapshot called before Clerk is loaded");
2103
- },
2104
- pathRoot: "",
2105
- reload: () => {
2106
- throw new Error("__internal_toSnapshot called before Clerk is loaded");
2107
- }
2108
- });
2109
- },
2110
- get canBeDiscarded() {
2111
- return gateProperty(target, "canBeDiscarded", false);
2112
- },
2113
- create: this.gateMethod(target, "create"),
2114
- password: this.gateMethod(target, "password"),
2115
- sso: this.gateMethod(target, "sso"),
2116
- finalize: this.gateMethod(target, "finalize"),
2117
- reset: this.gateMethod(target, "reset"),
2118
- emailCode: this.wrapMethods(() => target().emailCode, ["sendCode", "verifyCode"]),
2119
- emailLink: this.wrapStruct(
2120
- () => target().emailLink,
2121
- ["sendLink", "waitForVerification"],
2122
- ["verification"],
2123
- { verification: null }
2124
- ),
2125
- resetPasswordEmailCode: this.wrapMethods(() => target().resetPasswordEmailCode, [
2126
- "sendCode",
2127
- "verifyCode",
2128
- "submitPassword"
2129
- ]),
2130
- resetPasswordPhoneCode: this.wrapMethods(() => target().resetPasswordPhoneCode, [
2131
- "sendCode",
2132
- "verifyCode",
2133
- "submitPassword"
2134
- ]),
2135
- phoneCode: this.wrapMethods(() => target().phoneCode, ["sendCode", "verifyCode"]),
2136
- mfa: this.wrapMethods(() => target().mfa, [
2137
- "sendPhoneCode",
2138
- "verifyPhoneCode",
2139
- "sendEmailCode",
2140
- "verifyEmailCode",
2141
- "verifyTOTP",
2142
- "verifyBackupCode"
2143
- ]),
2144
- ticket: this.gateMethod(target, "ticket"),
2145
- passkey: this.gateMethod(target, "passkey"),
2146
- web3: this.gateMethod(target, "web3")
2147
- }
2148
- };
2149
- }
2150
- buildSignUpProxy() {
2151
- const gateProperty = this.gateProperty.bind(this);
2152
- const gateMethod = this.gateMethod.bind(this);
2153
- const target = () => this.client.signUp.__internal_future;
2154
- return {
2155
- errors: defaultSignUpErrors(),
2156
- fetchStatus: "idle",
2157
- signUp: {
2158
- get id() {
2159
- return gateProperty(target, "id", void 0);
2160
- },
2161
- get requiredFields() {
2162
- return gateProperty(target, "requiredFields", []);
2163
- },
2164
- get optionalFields() {
2165
- return gateProperty(target, "optionalFields", []);
2166
- },
2167
- get missingFields() {
2168
- return gateProperty(target, "missingFields", []);
2169
- },
2170
- get username() {
2171
- return gateProperty(target, "username", null);
2172
- },
2173
- get firstName() {
2174
- return gateProperty(target, "firstName", null);
2175
- },
2176
- get lastName() {
2177
- return gateProperty(target, "lastName", null);
2178
- },
2179
- get emailAddress() {
2180
- return gateProperty(target, "emailAddress", null);
2181
- },
2182
- get phoneNumber() {
2183
- return gateProperty(target, "phoneNumber", null);
2184
- },
2185
- get web3Wallet() {
2186
- return gateProperty(target, "web3Wallet", null);
2187
- },
2188
- get hasPassword() {
2189
- return gateProperty(target, "hasPassword", false);
2190
- },
2191
- get unsafeMetadata() {
2192
- return gateProperty(target, "unsafeMetadata", {});
2193
- },
2194
- get createdSessionId() {
2195
- return gateProperty(target, "createdSessionId", null);
2196
- },
2197
- get createdUserId() {
2198
- return gateProperty(target, "createdUserId", null);
2199
- },
2200
- get abandonAt() {
2201
- return gateProperty(target, "abandonAt", null);
2202
- },
2203
- get legalAcceptedAt() {
2204
- return gateProperty(target, "legalAcceptedAt", null);
2205
- },
2206
- get locale() {
2207
- return gateProperty(target, "locale", null);
2208
- },
2209
- get status() {
2210
- return gateProperty(target, "status", "missing_requirements");
2211
- },
2212
- get unverifiedFields() {
2213
- return gateProperty(target, "unverifiedFields", []);
2214
- },
2215
- get isTransferable() {
2216
- return gateProperty(target, "isTransferable", false);
2217
- },
2218
- get canBeDiscarded() {
2219
- return gateProperty(target, "canBeDiscarded", false);
2220
- },
2221
- create: gateMethod(target, "create"),
2222
- update: gateMethod(target, "update"),
2223
- sso: gateMethod(target, "sso"),
2224
- password: gateMethod(target, "password"),
2225
- ticket: gateMethod(target, "ticket"),
2226
- web3: gateMethod(target, "web3"),
2227
- finalize: gateMethod(target, "finalize"),
2228
- reset: gateMethod(target, "reset"),
2229
- verifications: this.wrapStruct(
2230
- () => target().verifications,
2231
- [
2232
- "sendEmailCode",
2233
- "verifyEmailCode",
2234
- "sendEmailLink",
2235
- "waitForEmailLinkVerification",
2236
- "sendPhoneCode",
2237
- "verifyPhoneCode"
2238
- ],
2239
- ["emailAddress", "phoneNumber", "web3Wallet", "externalAccount", "emailLinkVerification"],
2240
- {
2241
- emailAddress: defaultSignUpVerificationResource(),
2242
- phoneNumber: defaultSignUpVerificationResource(),
2243
- web3Wallet: defaultSignUpVerificationResource(),
2244
- externalAccount: defaultSignUpVerificationResource(),
2245
- emailLinkVerification: null
2246
- }
2247
- )
2248
- }
2249
- };
2250
- }
2251
- buildWaitlistProxy() {
2252
- const gateProperty = this.gateProperty.bind(this);
2253
- const gateMethod = this.gateMethod.bind(this);
2254
- const target = () => {
2255
- return this.state.__internal_waitlist;
2256
- };
2257
- return {
2258
- errors: defaultWaitlistErrors(),
2259
- fetchStatus: "idle",
2260
- waitlist: {
2261
- pathRoot: "/waitlist",
2262
- get id() {
2263
- return gateProperty(target, "id", "");
2264
- },
2265
- get createdAt() {
2266
- return gateProperty(target, "createdAt", null);
2267
- },
2268
- get updatedAt() {
2269
- return gateProperty(target, "updatedAt", null);
2270
- },
2271
- join: gateMethod(target, "join"),
2272
- reload: gateMethod(target, "reload")
2273
- }
2274
- };
2275
- }
2276
- buildCheckoutProxy(params) {
2277
- const gateProperty = this.gateProperty.bind(this);
2278
- const targetCheckout = () => this.checkout(params);
2279
- const target = () => targetCheckout().checkout;
2280
- return {
2281
- errors: {
2282
- raw: null,
2283
- global: null
2284
- },
2285
- fetchStatus: "idle",
2286
- checkout: {
2287
- get status() {
2288
- return gateProperty(target, "status", "needs_initialization");
2289
- },
2290
- get externalClientSecret() {
2291
- return gateProperty(target, "externalClientSecret", null);
2292
- },
2293
- get externalGatewayId() {
2294
- return gateProperty(target, "externalGatewayId", null);
2295
- },
2296
- get paymentMethod() {
2297
- return gateProperty(target, "paymentMethod", null);
2298
- },
2299
- get plan() {
2300
- return gateProperty(target, "plan", null);
2301
- },
2302
- get planPeriod() {
2303
- return gateProperty(target, "planPeriod", null);
2304
- },
2305
- get totals() {
2306
- return gateProperty(target, "totals", null);
2307
- },
2308
- get isImmediatePlanChange() {
2309
- return gateProperty(target, "isImmediatePlanChange", false);
2310
- },
2311
- get freeTrialEndsAt() {
2312
- return gateProperty(target, "freeTrialEndsAt", null);
2313
- },
2314
- get payer() {
2315
- return gateProperty(target, "payer", null);
2316
- },
2317
- get planPeriodStart() {
2318
- return gateProperty(target, "planPeriodStart", null);
2319
- },
2320
- get needsPaymentMethod() {
2321
- return gateProperty(target, "needsPaymentMethod", null);
2322
- },
2323
- start: this.gateMethod(target, "start"),
2324
- confirm: this.gateMethod(target, "confirm"),
2325
- finalize: this.gateMethod(target, "finalize")
2326
- }
2327
- };
2328
- }
2329
- __internal_effect(_) {
2330
- throw new Error("__internal_effect called before Clerk is loaded");
2331
- }
2332
- __internal_computed(_) {
2333
- throw new Error("__internal_computed called before Clerk is loaded");
2334
- }
2335
- get state() {
2336
- const s = this.isomorphicClerk.__internal_state;
2337
- if (!s) {
2338
- throw new Error("Clerk state not ready");
2339
- }
2340
- return s;
2341
- }
2342
- get client() {
2343
- const c = this.isomorphicClerk.client;
2344
- if (!c) {
2345
- throw new Error("Clerk client not ready");
2346
- }
2347
- return c;
2348
- }
2349
- get checkout() {
2350
- const c = this.isomorphicClerk.__experimental_checkout;
2351
- if (!c) {
2352
- throw new Error("Clerk checkout not ready");
2353
- }
2354
- return c;
2355
- }
2356
- gateProperty(getTarget, key, defaultValue) {
2357
- return (() => {
2358
- if (!(0, import_browser2.inBrowser)() || !this.isomorphicClerk.loaded) {
2359
- return defaultValue;
2360
- }
2361
- const t = getTarget();
2362
- return t[key];
2363
- })();
2364
- }
2365
- gateMethod(getTarget, key) {
2366
- return (async (...args) => {
2367
- if (!(0, import_browser2.inBrowser)()) {
2368
- return errorThrower.throw(`Attempted to call a method (${key}) that is not supported on the server.`);
2369
- }
2370
- if (!this.isomorphicClerk.loaded) {
2371
- await new Promise((resolve) => this.isomorphicClerk.addOnLoaded(resolve));
2372
- }
2373
- const t = getTarget();
2374
- return t[key].apply(t, args);
2375
- });
2376
- }
2377
- wrapMethods(getTarget, keys) {
2378
- return Object.fromEntries(keys.map((k) => [k, this.gateMethod(getTarget, k)]));
2379
- }
2380
- wrapStruct(getTarget, methods, getters, fallbacks) {
2381
- const out = {};
2382
- for (const m of methods) {
2383
- out[m] = this.gateMethod(getTarget, m);
2384
- }
2385
- for (const g of getters) {
2386
- Object.defineProperty(out, g, {
2387
- get: () => this.gateProperty(getTarget, g, fallbacks[g]),
2388
- enumerable: true
2389
- });
2390
- }
2391
- return out;
2392
- }
2393
- };
2394
-
2395
- // src/isomorphicClerk.ts
2396
- if (typeof globalThis.__BUILD_DISABLE_RHC__ === "undefined") {
2397
- globalThis.__BUILD_DISABLE_RHC__ = false;
2398
- }
2399
- var SDK_METADATA = {
2400
- name: "@clerk/react",
2401
- version: "6.9.0",
2402
- environment: process.env.NODE_ENV
2403
- };
2404
- var _status, _domain, _proxyUrl, _publishableKey, _eventBus, _stateProxy, _instance, _IsomorphicClerk_instances, waitForClerkJS_fn;
2405
- var _IsomorphicClerk = class _IsomorphicClerk {
2406
- constructor(options) {
2407
- __privateAdd(this, _IsomorphicClerk_instances);
2408
- this.clerkjs = null;
2409
- this.preopenOneTap = null;
2410
- this.preopenUserVerification = null;
2411
- this.preopenEnableOrganizationsPrompt = null;
2412
- this.preopenSignIn = null;
2413
- this.preopenCheckout = null;
2414
- this.preopenPlanDetails = null;
2415
- this.preopenSubscriptionDetails = null;
2416
- this.preopenSignUp = null;
2417
- this.preopenUserProfile = null;
2418
- this.preopenOrganizationProfile = null;
2419
- this.preopenCreateOrganization = null;
2420
- this.preOpenWaitlist = null;
2421
- this.premountSignInNodes = /* @__PURE__ */ new Map();
2422
- this.premountSignUpNodes = /* @__PURE__ */ new Map();
2423
- this.premountUserAvatarNodes = /* @__PURE__ */ new Map();
2424
- this.premountUserProfileNodes = /* @__PURE__ */ new Map();
2425
- this.premountUserButtonNodes = /* @__PURE__ */ new Map();
2426
- this.premountOrganizationProfileNodes = /* @__PURE__ */ new Map();
2427
- this.premountCreateOrganizationNodes = /* @__PURE__ */ new Map();
2428
- this.premountOrganizationSwitcherNodes = /* @__PURE__ */ new Map();
2429
- this.premountOrganizationListNodes = /* @__PURE__ */ new Map();
2430
- this.premountMethodCalls = /* @__PURE__ */ new Map();
2431
- this.premountWaitlistNodes = /* @__PURE__ */ new Map();
2432
- this.premountPricingTableNodes = /* @__PURE__ */ new Map();
2433
- this.premountAPIKeysNodes = /* @__PURE__ */ new Map();
2434
- this.premountConfigureSSONodes = /* @__PURE__ */ new Map();
2435
- this.premountOAuthConsentNodes = /* @__PURE__ */ new Map();
2436
- this.premountTaskChooseOrganizationNodes = /* @__PURE__ */ new Map();
2437
- this.premountTaskResetPasswordNodes = /* @__PURE__ */ new Map();
2438
- this.premountTaskSetupMFANodes = /* @__PURE__ */ new Map();
2439
- // A separate Map of `addListener` method calls to handle multiple listeners.
2440
- this.premountAddListenerCalls = /* @__PURE__ */ new Map();
2441
- this.loadedListeners = [];
2442
- __privateAdd(this, _status, "loading");
2443
- __privateAdd(this, _domain);
2444
- __privateAdd(this, _proxyUrl);
2445
- __privateAdd(this, _publishableKey);
2446
- __privateAdd(this, _eventBus, (0, import_clerkEventBus.createClerkEventBus)());
2447
- __privateAdd(this, _stateProxy);
2448
- this.buildSignInUrl = (opts) => {
2449
- const callback = () => {
2450
- var _a2;
2451
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.buildSignInUrl(opts)) || "";
2452
- };
2453
- if (this.clerkjs && this.loaded) {
2454
- return callback();
2455
- } else {
2456
- this.premountMethodCalls.set("buildSignInUrl", callback);
2457
- }
2458
- };
2459
- this.buildSignUpUrl = (opts) => {
2460
- const callback = () => {
2461
- var _a2;
2462
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.buildSignUpUrl(opts)) || "";
2463
- };
2464
- if (this.clerkjs && this.loaded) {
2465
- return callback();
2466
- } else {
2467
- this.premountMethodCalls.set("buildSignUpUrl", callback);
2468
- }
2469
- };
2470
- this.buildAfterSignInUrl = (...args) => {
2471
- const callback = () => {
2472
- var _a2;
2473
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.buildAfterSignInUrl(...args)) || "";
2474
- };
2475
- if (this.clerkjs && this.loaded) {
2476
- return callback();
2477
- } else {
2478
- this.premountMethodCalls.set("buildAfterSignInUrl", callback);
2479
- }
2480
- };
2481
- this.buildAfterSignUpUrl = (...args) => {
2482
- const callback = () => {
2483
- var _a2;
2484
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.buildAfterSignUpUrl(...args)) || "";
2485
- };
2486
- if (this.clerkjs && this.loaded) {
2487
- return callback();
2488
- } else {
2489
- this.premountMethodCalls.set("buildAfterSignUpUrl", callback);
2490
- }
2491
- };
2492
- this.buildAfterSignOutUrl = () => {
2493
- const callback = () => {
2494
- var _a2;
2495
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.buildAfterSignOutUrl()) || "";
2496
- };
2497
- if (this.clerkjs && this.loaded) {
2498
- return callback();
2499
- } else {
2500
- this.premountMethodCalls.set("buildAfterSignOutUrl", callback);
2501
- }
2502
- };
2503
- this.buildNewSubscriptionRedirectUrl = () => {
2504
- const callback = () => {
2505
- var _a2;
2506
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.buildNewSubscriptionRedirectUrl()) || "";
2507
- };
2508
- if (this.clerkjs && this.loaded) {
2509
- return callback();
2510
- } else {
2511
- this.premountMethodCalls.set("buildNewSubscriptionRedirectUrl", callback);
2512
- }
2513
- };
2514
- this.buildAfterMultiSessionSingleSignOutUrl = () => {
2515
- const callback = () => {
2516
- var _a2;
2517
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.buildAfterMultiSessionSingleSignOutUrl()) || "";
2518
- };
2519
- if (this.clerkjs && this.loaded) {
2520
- return callback();
2521
- } else {
2522
- this.premountMethodCalls.set("buildAfterMultiSessionSingleSignOutUrl", callback);
2523
- }
2524
- };
2525
- this.buildUserProfileUrl = () => {
2526
- const callback = () => {
2527
- var _a2;
2528
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.buildUserProfileUrl()) || "";
2529
- };
2530
- if (this.clerkjs && this.loaded) {
2531
- return callback();
2532
- } else {
2533
- this.premountMethodCalls.set("buildUserProfileUrl", callback);
2534
- }
2535
- };
2536
- this.buildCreateOrganizationUrl = () => {
2537
- const callback = () => {
2538
- var _a2;
2539
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.buildCreateOrganizationUrl()) || "";
2540
- };
2541
- if (this.clerkjs && this.loaded) {
2542
- return callback();
2543
- } else {
2544
- this.premountMethodCalls.set("buildCreateOrganizationUrl", callback);
2545
- }
2546
- };
2547
- this.buildOrganizationProfileUrl = () => {
2548
- const callback = () => {
2549
- var _a2;
2550
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.buildOrganizationProfileUrl()) || "";
2551
- };
2552
- if (this.clerkjs && this.loaded) {
2553
- return callback();
2554
- } else {
2555
- this.premountMethodCalls.set("buildOrganizationProfileUrl", callback);
2556
- }
2557
- };
2558
- this.buildWaitlistUrl = () => {
2559
- const callback = () => {
2560
- var _a2;
2561
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.buildWaitlistUrl()) || "";
2562
- };
2563
- if (this.clerkjs && this.loaded) {
2564
- return callback();
2565
- } else {
2566
- this.premountMethodCalls.set("buildWaitlistUrl", callback);
2567
- }
2568
- };
2569
- this.buildTasksUrl = () => {
2570
- const callback = () => {
2571
- var _a2;
2572
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.buildTasksUrl()) || "";
2573
- };
2574
- if (this.clerkjs && this.loaded) {
2575
- return callback();
2576
- } else {
2577
- this.premountMethodCalls.set("buildTasksUrl", callback);
2578
- }
2579
- };
2580
- this.buildUrlWithAuth = (to) => {
2581
- const callback = () => {
2582
- var _a2;
2583
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.buildUrlWithAuth(to)) || "";
2584
- };
2585
- if (this.clerkjs && this.loaded) {
2586
- return callback();
2587
- } else {
2588
- this.premountMethodCalls.set("buildUrlWithAuth", callback);
2589
- }
2590
- };
2591
- this.handleUnauthenticated = async () => {
2592
- const callback = () => {
2593
- var _a2;
2594
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.handleUnauthenticated();
2595
- };
2596
- if (this.clerkjs && this.loaded) {
2597
- void callback();
2598
- } else {
2599
- this.premountMethodCalls.set("handleUnauthenticated", callback);
2600
- }
2601
- };
2602
- this.on = (...args) => {
2603
- var _a2;
2604
- if ((_a2 = this.clerkjs) == null ? void 0 : _a2.on) {
2605
- return this.clerkjs.on(...args);
2606
- } else {
2607
- __privateGet(this, _eventBus).on(...args);
2608
- }
2609
- };
2610
- this.off = (...args) => {
2611
- var _a2;
2612
- if ((_a2 = this.clerkjs) == null ? void 0 : _a2.off) {
2613
- return this.clerkjs.off(...args);
2614
- } else {
2615
- __privateGet(this, _eventBus).off(...args);
2616
- }
2617
- };
2618
- /**
2619
- * @deprecated Please use `addStatusListener`. This api will be removed in the next major.
2620
- */
2621
- this.addOnLoaded = (cb) => {
2622
- this.loadedListeners.push(cb);
2623
- if (this.loaded) {
2624
- this.emitLoaded();
2625
- }
2626
- };
2627
- /**
2628
- * @deprecated Please use `__internal_setStatus`. This api will be removed in the next major.
2629
- */
2630
- this.emitLoaded = () => {
2631
- this.loadedListeners.forEach((cb) => cb());
2632
- this.loadedListeners = [];
2633
- };
2634
- this.beforeLoad = (clerkjs) => {
2635
- if (!clerkjs) {
2636
- throw new Error("Failed to hydrate latest Clerk JS");
2637
- }
2638
- };
2639
- this.replayInterceptedInvocations = (clerkjs) => {
2640
- var _a2;
2641
- if (!clerkjs) {
2642
- throw new Error("Failed to hydrate latest Clerk JS");
2643
- }
2644
- this.clerkjs = clerkjs;
2645
- this.premountMethodCalls.forEach((cb) => cb());
2646
- this.premountAddListenerCalls.forEach((listenerExtras, listener) => {
2647
- listenerExtras.handlers.nativeUnsubscribe = clerkjs.addListener(listener, listenerExtras.options);
2648
- });
2649
- (_a2 = __privateGet(this, _eventBus).internal.retrieveListeners("status")) == null ? void 0 : _a2.forEach((listener) => {
2650
- this.on("status", listener, { notify: true });
2651
- });
2652
- if (this.preopenSignIn !== null) {
2653
- clerkjs.openSignIn(this.preopenSignIn);
2654
- }
2655
- if (this.preopenCheckout !== null) {
2656
- clerkjs.__internal_openCheckout(this.preopenCheckout);
2657
- }
2658
- if (this.preopenPlanDetails !== null) {
2659
- clerkjs.__internal_openPlanDetails(this.preopenPlanDetails);
2660
- }
2661
- if (this.preopenSubscriptionDetails !== null) {
2662
- clerkjs.__internal_openSubscriptionDetails(this.preopenSubscriptionDetails);
2663
- }
2664
- if (this.preopenSignUp !== null) {
2665
- clerkjs.openSignUp(this.preopenSignUp);
2666
- }
2667
- if (this.preopenUserProfile !== null) {
2668
- clerkjs.openUserProfile(this.preopenUserProfile);
2669
- }
2670
- if (this.preopenUserVerification !== null) {
2671
- clerkjs.__internal_openReverification(this.preopenUserVerification);
2672
- }
2673
- if (this.preopenOneTap !== null) {
2674
- clerkjs.openGoogleOneTap(this.preopenOneTap);
2675
- }
2676
- if (this.preopenOrganizationProfile !== null) {
2677
- clerkjs.openOrganizationProfile(this.preopenOrganizationProfile);
2678
- }
2679
- if (this.preopenCreateOrganization !== null) {
2680
- clerkjs.openCreateOrganization(this.preopenCreateOrganization);
2681
- }
2682
- if (this.preOpenWaitlist !== null) {
2683
- clerkjs.openWaitlist(this.preOpenWaitlist);
2684
- }
2685
- if (this.preopenEnableOrganizationsPrompt) {
2686
- clerkjs.__internal_openEnableOrganizationsPrompt(this.preopenEnableOrganizationsPrompt);
2687
- }
2688
- this.premountSignInNodes.forEach((props, node) => {
2689
- clerkjs.mountSignIn(node, props);
2690
- });
2691
- this.premountSignUpNodes.forEach((props, node) => {
2692
- clerkjs.mountSignUp(node, props);
2693
- });
2694
- this.premountUserProfileNodes.forEach((props, node) => {
2695
- clerkjs.mountUserProfile(node, props);
2696
- });
2697
- this.premountUserAvatarNodes.forEach((props, node) => {
2698
- clerkjs.mountUserAvatar(node, props);
2699
- });
2700
- this.premountUserButtonNodes.forEach((props, node) => {
2701
- clerkjs.mountUserButton(node, props);
2702
- });
2703
- this.premountOrganizationListNodes.forEach((props, node) => {
2704
- clerkjs.mountOrganizationList(node, props);
2705
- });
2706
- this.premountWaitlistNodes.forEach((props, node) => {
2707
- clerkjs.mountWaitlist(node, props);
2708
- });
2709
- this.premountPricingTableNodes.forEach((props, node) => {
2710
- clerkjs.mountPricingTable(node, props);
2711
- });
2712
- this.premountAPIKeysNodes.forEach((props, node) => {
2713
- clerkjs.mountAPIKeys(node, props);
2714
- });
2715
- this.premountConfigureSSONodes.forEach((props, node) => {
2716
- clerkjs.__internal_mountConfigureSSO(node, props);
2717
- });
2718
- this.premountOAuthConsentNodes.forEach((props, node) => {
2719
- clerkjs.__internal_mountOAuthConsent(node, props);
2720
- });
2721
- this.premountTaskChooseOrganizationNodes.forEach((props, node) => {
2722
- clerkjs.mountTaskChooseOrganization(node, props);
2723
- });
2724
- this.premountTaskResetPasswordNodes.forEach((props, node) => {
2725
- clerkjs.mountTaskResetPassword(node, props);
2726
- });
2727
- this.premountTaskSetupMFANodes.forEach((props, node) => {
2728
- clerkjs.mountTaskSetupMFA(node, props);
2729
- });
2730
- if (typeof this.clerkjs.status === "undefined") {
2731
- __privateGet(this, _eventBus).emit(import_clerkEventBus.clerkEvents.Status, "ready");
2732
- }
2733
- this.emitLoaded();
2734
- return this.clerkjs;
2735
- };
2736
- this.__experimental_checkout = (...args) => {
2737
- return this.loaded && this.clerkjs ? this.clerkjs.__experimental_checkout(...args) : __privateGet(this, _stateProxy).checkoutSignal(...args);
2738
- };
2739
- // TODO @userland-errors:
2740
- this.__internal_updateProps = async (props) => {
2741
- const clerkjs = await __privateMethod(this, _IsomorphicClerk_instances, waitForClerkJS_fn).call(this);
2742
- if (clerkjs && "__internal_updateProps" in clerkjs) {
2743
- return clerkjs.__internal_updateProps(props);
2744
- }
2745
- };
2746
- /**
2747
- * `setActive` can be used to set the active session and/or organization.
2748
- */
2749
- this.setActive = (params) => {
2750
- if (this.clerkjs) {
2751
- return this.clerkjs.setActive(params);
2752
- } else {
2753
- return Promise.reject();
2754
- }
2755
- };
2756
- this.openSignIn = (props) => {
2757
- if (this.clerkjs && this.loaded) {
2758
- this.clerkjs.openSignIn(props);
2759
- } else {
2760
- this.preopenSignIn = props;
2761
- }
2762
- };
2763
- this.closeSignIn = () => {
2764
- if (this.clerkjs && this.loaded) {
2765
- this.clerkjs.closeSignIn();
2766
- } else {
2767
- this.preopenSignIn = null;
2768
- }
2769
- };
2770
- this.__internal_openCheckout = (props) => {
2771
- if (this.clerkjs && this.loaded) {
2772
- this.clerkjs.__internal_openCheckout(props);
2773
- } else {
2774
- this.preopenCheckout = props;
2775
- }
2776
- };
2777
- this.__internal_closeCheckout = () => {
2778
- if (this.clerkjs && this.loaded) {
2779
- this.clerkjs.__internal_closeCheckout();
2780
- } else {
2781
- this.preopenCheckout = null;
2782
- }
2783
- };
2784
- this.__internal_openPlanDetails = (props) => {
2785
- if (this.clerkjs && this.loaded) {
2786
- this.clerkjs.__internal_openPlanDetails(props);
2787
- } else {
2788
- this.preopenPlanDetails = props;
2789
- }
2790
- };
2791
- this.__internal_closePlanDetails = () => {
2792
- if (this.clerkjs && this.loaded) {
2793
- this.clerkjs.__internal_closePlanDetails();
2794
- } else {
2795
- this.preopenPlanDetails = null;
2796
- }
2797
- };
2798
- this.__internal_openSubscriptionDetails = (props) => {
2799
- if (this.clerkjs && this.loaded) {
2800
- this.clerkjs.__internal_openSubscriptionDetails(props);
2801
- } else {
2802
- this.preopenSubscriptionDetails = props != null ? props : null;
2803
- }
2804
- };
2805
- this.__internal_closeSubscriptionDetails = () => {
2806
- if (this.clerkjs && this.loaded) {
2807
- this.clerkjs.__internal_closeSubscriptionDetails();
2808
- } else {
2809
- this.preopenSubscriptionDetails = null;
2810
- }
2811
- };
2812
- this.__internal_openReverification = (props) => {
2813
- if (this.clerkjs && this.loaded) {
2814
- this.clerkjs.__internal_openReverification(props);
2815
- } else {
2816
- this.preopenUserVerification = props;
2817
- }
2818
- };
2819
- this.__internal_closeReverification = () => {
2820
- if (this.clerkjs && this.loaded) {
2821
- this.clerkjs.__internal_closeReverification();
2822
- } else {
2823
- this.preopenUserVerification = null;
2824
- }
2825
- };
2826
- this.__internal_openEnableOrganizationsPrompt = (props) => {
2827
- if (this.clerkjs && this.loaded) {
2828
- this.clerkjs.__internal_openEnableOrganizationsPrompt(props);
2829
- } else {
2830
- this.preopenEnableOrganizationsPrompt = props;
2831
- }
2832
- };
2833
- this.__internal_closeEnableOrganizationsPrompt = () => {
2834
- if (this.clerkjs && this.loaded) {
2835
- this.clerkjs.__internal_closeEnableOrganizationsPrompt();
2836
- } else {
2837
- this.preopenEnableOrganizationsPrompt = null;
2838
- }
2839
- };
2840
- this.openGoogleOneTap = (props) => {
2841
- if (this.clerkjs && this.loaded) {
2842
- this.clerkjs.openGoogleOneTap(props);
2843
- } else {
2844
- this.preopenOneTap = props;
2845
- }
2846
- };
2847
- this.closeGoogleOneTap = () => {
2848
- if (this.clerkjs && this.loaded) {
2849
- this.clerkjs.closeGoogleOneTap();
2850
- } else {
2851
- this.preopenOneTap = null;
2852
- }
2853
- };
2854
- this.openUserProfile = (props) => {
2855
- if (this.clerkjs && this.loaded) {
2856
- this.clerkjs.openUserProfile(props);
2857
- } else {
2858
- this.preopenUserProfile = props;
2859
- }
2860
- };
2861
- this.closeUserProfile = () => {
2862
- if (this.clerkjs && this.loaded) {
2863
- this.clerkjs.closeUserProfile();
2864
- } else {
2865
- this.preopenUserProfile = null;
2866
- }
2867
- };
2868
- this.openOrganizationProfile = (props) => {
2869
- if (this.clerkjs && this.loaded) {
2870
- this.clerkjs.openOrganizationProfile(props);
2871
- } else {
2872
- this.preopenOrganizationProfile = props;
2873
- }
2874
- };
2875
- this.closeOrganizationProfile = () => {
2876
- if (this.clerkjs && this.loaded) {
2877
- this.clerkjs.closeOrganizationProfile();
2878
- } else {
2879
- this.preopenOrganizationProfile = null;
2880
- }
2881
- };
2882
- this.openCreateOrganization = (props) => {
2883
- if (this.clerkjs && this.loaded) {
2884
- this.clerkjs.openCreateOrganization(props);
2885
- } else {
2886
- this.preopenCreateOrganization = props;
2887
- }
2888
- };
2889
- this.closeCreateOrganization = () => {
2890
- if (this.clerkjs && this.loaded) {
2891
- this.clerkjs.closeCreateOrganization();
2892
- } else {
2893
- this.preopenCreateOrganization = null;
2894
- }
2895
- };
2896
- this.openWaitlist = (props) => {
2897
- if (this.clerkjs && this.loaded) {
2898
- this.clerkjs.openWaitlist(props);
2899
- } else {
2900
- this.preOpenWaitlist = props;
2901
- }
2902
- };
2903
- this.closeWaitlist = () => {
2904
- if (this.clerkjs && this.loaded) {
2905
- this.clerkjs.closeWaitlist();
2906
- } else {
2907
- this.preOpenWaitlist = null;
2908
- }
2909
- };
2910
- this.openSignUp = (props) => {
2911
- if (this.clerkjs && this.loaded) {
2912
- this.clerkjs.openSignUp(props);
2913
- } else {
2914
- this.preopenSignUp = props;
2915
- }
2916
- };
2917
- this.closeSignUp = () => {
2918
- if (this.clerkjs && this.loaded) {
2919
- this.clerkjs.closeSignUp();
2920
- } else {
2921
- this.preopenSignUp = null;
2922
- }
2923
- };
2924
- this.mountSignIn = (node, props) => {
2925
- if (this.clerkjs && this.loaded) {
2926
- this.clerkjs.mountSignIn(node, props);
2927
- } else {
2928
- this.premountSignInNodes.set(node, props);
2929
- }
2930
- };
2931
- this.unmountSignIn = (node) => {
2932
- if (this.clerkjs && this.loaded) {
2933
- this.clerkjs.unmountSignIn(node);
2934
- } else {
2935
- this.premountSignInNodes.delete(node);
2936
- }
2937
- };
2938
- this.mountSignUp = (node, props) => {
2939
- if (this.clerkjs && this.loaded) {
2940
- this.clerkjs.mountSignUp(node, props);
2941
- } else {
2942
- this.premountSignUpNodes.set(node, props);
2943
- }
2944
- };
2945
- this.unmountSignUp = (node) => {
2946
- if (this.clerkjs && this.loaded) {
2947
- this.clerkjs.unmountSignUp(node);
2948
- } else {
2949
- this.premountSignUpNodes.delete(node);
2950
- }
2951
- };
2952
- this.mountUserAvatar = (node, props) => {
2953
- if (this.clerkjs && this.loaded) {
2954
- this.clerkjs.mountUserAvatar(node, props);
2955
- } else {
2956
- this.premountUserAvatarNodes.set(node, props);
2957
- }
2958
- };
2959
- this.unmountUserAvatar = (node) => {
2960
- if (this.clerkjs && this.loaded) {
2961
- this.clerkjs.unmountUserAvatar(node);
2962
- } else {
2963
- this.premountUserAvatarNodes.delete(node);
2964
- }
2965
- };
2966
- this.mountUserProfile = (node, props) => {
2967
- if (this.clerkjs && this.loaded) {
2968
- this.clerkjs.mountUserProfile(node, props);
2969
- } else {
2970
- this.premountUserProfileNodes.set(node, props);
2971
- }
2972
- };
2973
- this.unmountUserProfile = (node) => {
2974
- if (this.clerkjs && this.loaded) {
2975
- this.clerkjs.unmountUserProfile(node);
2976
- } else {
2977
- this.premountUserProfileNodes.delete(node);
2978
- }
2979
- };
2980
- this.mountOrganizationProfile = (node, props) => {
2981
- if (this.clerkjs && this.loaded) {
2982
- this.clerkjs.mountOrganizationProfile(node, props);
2983
- } else {
2984
- this.premountOrganizationProfileNodes.set(node, props);
2985
- }
2986
- };
2987
- this.unmountOrganizationProfile = (node) => {
2988
- if (this.clerkjs && this.loaded) {
2989
- this.clerkjs.unmountOrganizationProfile(node);
2990
- } else {
2991
- this.premountOrganizationProfileNodes.delete(node);
2992
- }
2993
- };
2994
- this.mountCreateOrganization = (node, props) => {
2995
- if (this.clerkjs && this.loaded) {
2996
- this.clerkjs.mountCreateOrganization(node, props);
2997
- } else {
2998
- this.premountCreateOrganizationNodes.set(node, props);
2999
- }
3000
- };
3001
- this.unmountCreateOrganization = (node) => {
3002
- if (this.clerkjs && this.loaded) {
3003
- this.clerkjs.unmountCreateOrganization(node);
3004
- } else {
3005
- this.premountCreateOrganizationNodes.delete(node);
3006
- }
3007
- };
3008
- this.mountOrganizationSwitcher = (node, props) => {
3009
- if (this.clerkjs && this.loaded) {
3010
- this.clerkjs.mountOrganizationSwitcher(node, props);
3011
- } else {
3012
- this.premountOrganizationSwitcherNodes.set(node, props);
3013
- }
3014
- };
3015
- this.unmountOrganizationSwitcher = (node) => {
3016
- if (this.clerkjs && this.loaded) {
3017
- this.clerkjs.unmountOrganizationSwitcher(node);
3018
- } else {
3019
- this.premountOrganizationSwitcherNodes.delete(node);
3020
- }
3021
- };
3022
- this.__experimental_prefetchOrganizationSwitcher = () => {
3023
- const callback = () => {
3024
- var _a2;
3025
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.__experimental_prefetchOrganizationSwitcher();
3026
- };
3027
- if (this.clerkjs && this.loaded) {
3028
- void callback();
3029
- } else {
3030
- this.premountMethodCalls.set("__experimental_prefetchOrganizationSwitcher", callback);
3031
- }
3032
- };
3033
- this.mountOrganizationList = (node, props) => {
3034
- if (this.clerkjs && this.loaded) {
3035
- this.clerkjs.mountOrganizationList(node, props);
3036
- } else {
3037
- this.premountOrganizationListNodes.set(node, props);
3038
- }
3039
- };
3040
- this.unmountOrganizationList = (node) => {
3041
- if (this.clerkjs && this.loaded) {
3042
- this.clerkjs.unmountOrganizationList(node);
3043
- } else {
3044
- this.premountOrganizationListNodes.delete(node);
3045
- }
3046
- };
3047
- this.mountUserButton = (node, userButtonProps) => {
3048
- if (this.clerkjs && this.loaded) {
3049
- this.clerkjs.mountUserButton(node, userButtonProps);
3050
- } else {
3051
- this.premountUserButtonNodes.set(node, userButtonProps);
3052
- }
3053
- };
3054
- this.unmountUserButton = (node) => {
3055
- if (this.clerkjs && this.loaded) {
3056
- this.clerkjs.unmountUserButton(node);
3057
- } else {
3058
- this.premountUserButtonNodes.delete(node);
3059
- }
3060
- };
3061
- this.mountWaitlist = (node, props) => {
3062
- if (this.clerkjs && this.loaded) {
3063
- this.clerkjs.mountWaitlist(node, props);
3064
- } else {
3065
- this.premountWaitlistNodes.set(node, props);
3066
- }
3067
- };
3068
- this.unmountWaitlist = (node) => {
3069
- if (this.clerkjs && this.loaded) {
3070
- this.clerkjs.unmountWaitlist(node);
3071
- } else {
3072
- this.premountWaitlistNodes.delete(node);
3073
- }
3074
- };
3075
- this.mountPricingTable = (node, props) => {
3076
- if (this.clerkjs && this.loaded) {
3077
- this.clerkjs.mountPricingTable(node, props);
3078
- } else {
3079
- this.premountPricingTableNodes.set(node, props);
3080
- }
3081
- };
3082
- this.unmountPricingTable = (node) => {
3083
- if (this.clerkjs && this.loaded) {
3084
- this.clerkjs.unmountPricingTable(node);
3085
- } else {
3086
- this.premountPricingTableNodes.delete(node);
3087
- }
3088
- };
3089
- this.mountAPIKeys = (node, props) => {
3090
- if (this.clerkjs && this.loaded) {
3091
- this.clerkjs.mountAPIKeys(node, props);
3092
- } else {
3093
- this.premountAPIKeysNodes.set(node, props);
3094
- }
3095
- };
3096
- this.unmountAPIKeys = (node) => {
3097
- if (this.clerkjs && this.loaded) {
3098
- this.clerkjs.unmountAPIKeys(node);
3099
- } else {
3100
- this.premountAPIKeysNodes.delete(node);
3101
- }
3102
- };
3103
- this.__internal_mountConfigureSSO = (node, props) => {
3104
- if (this.clerkjs && this.loaded) {
3105
- this.clerkjs.__internal_mountConfigureSSO(node, props);
3106
- } else {
3107
- this.premountConfigureSSONodes.set(node, props);
3108
- }
3109
- };
3110
- this.__internal_unmountConfigureSSO = (node) => {
3111
- if (this.clerkjs && this.loaded) {
3112
- this.clerkjs.__internal_unmountConfigureSSO(node);
3113
- } else {
3114
- this.premountConfigureSSONodes.delete(node);
3115
- }
3116
- };
3117
- this.__internal_mountOAuthConsent = (node, props) => {
3118
- if (this.clerkjs && this.loaded) {
3119
- this.clerkjs.__internal_mountOAuthConsent(node, props);
3120
- } else {
3121
- this.premountOAuthConsentNodes.set(node, props);
3122
- }
3123
- };
3124
- this.__internal_unmountOAuthConsent = (node) => {
3125
- if (this.clerkjs && this.loaded) {
3126
- this.clerkjs.__internal_unmountOAuthConsent(node);
3127
- } else {
3128
- this.premountOAuthConsentNodes.delete(node);
3129
- }
3130
- };
3131
- this.mountOAuthConsent = (node, props) => {
3132
- this.__internal_mountOAuthConsent(node, props);
3133
- };
3134
- this.unmountOAuthConsent = (node) => {
3135
- this.__internal_unmountOAuthConsent(node);
3136
- };
3137
- this.mountTaskChooseOrganization = (node, props) => {
3138
- if (this.clerkjs && this.loaded) {
3139
- this.clerkjs.mountTaskChooseOrganization(node, props);
3140
- } else {
3141
- this.premountTaskChooseOrganizationNodes.set(node, props);
3142
- }
3143
- };
3144
- this.unmountTaskChooseOrganization = (node) => {
3145
- if (this.clerkjs && this.loaded) {
3146
- this.clerkjs.unmountTaskChooseOrganization(node);
3147
- } else {
3148
- this.premountTaskChooseOrganizationNodes.delete(node);
3149
- }
3150
- };
3151
- this.mountTaskResetPassword = (node, props) => {
3152
- if (this.clerkjs && this.loaded) {
3153
- this.clerkjs.mountTaskResetPassword(node, props);
3154
- } else {
3155
- this.premountTaskResetPasswordNodes.set(node, props);
3156
- }
3157
- };
3158
- this.unmountTaskResetPassword = (node) => {
3159
- if (this.clerkjs && this.loaded) {
3160
- this.clerkjs.unmountTaskResetPassword(node);
3161
- } else {
3162
- this.premountTaskResetPasswordNodes.delete(node);
3163
- }
3164
- };
3165
- this.mountTaskSetupMFA = (node, props) => {
3166
- if (this.clerkjs && this.loaded) {
3167
- this.clerkjs.mountTaskSetupMFA(node, props);
3168
- } else {
3169
- this.premountTaskSetupMFANodes.set(node, props);
3170
- }
3171
- };
3172
- this.unmountTaskSetupMFA = (node) => {
3173
- if (this.clerkjs && this.loaded) {
3174
- this.clerkjs.unmountTaskSetupMFA(node);
3175
- } else {
3176
- this.premountTaskSetupMFANodes.delete(node);
3177
- }
3178
- };
3179
- this.addListener = (listener, options) => {
3180
- if (this.clerkjs) {
3181
- return this.clerkjs.addListener(listener, options);
3182
- } else {
3183
- const unsubscribe = () => {
3184
- var _a2, _b;
3185
- const listenerExtras = this.premountAddListenerCalls.get(listener);
3186
- if (listenerExtras == null ? void 0 : listenerExtras.handlers) {
3187
- (_b = listenerExtras == null ? void 0 : (_a2 = listenerExtras.handlers).nativeUnsubscribe) == null ? void 0 : _b.call(_a2);
3188
- this.premountAddListenerCalls.delete(listener);
3189
- }
3190
- };
3191
- this.premountAddListenerCalls.set(listener, { options, handlers: { unsubscribe, nativeUnsubscribe: void 0 } });
3192
- return unsubscribe;
3193
- }
3194
- };
3195
- this.navigate = (to) => {
3196
- const callback = () => {
3197
- var _a2;
3198
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.navigate(to);
3199
- };
3200
- if (this.clerkjs && this.loaded) {
3201
- void callback();
3202
- } else {
3203
- this.premountMethodCalls.set("navigate", callback);
3204
- }
3205
- };
3206
- this.redirectWithAuth = async (...args) => {
3207
- const callback = () => {
3208
- var _a2;
3209
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.redirectWithAuth(...args);
3210
- };
3211
- if (this.clerkjs && this.loaded) {
3212
- return callback();
3213
- } else {
3214
- this.premountMethodCalls.set("redirectWithAuth", callback);
3215
- return;
3216
- }
3217
- };
3218
- this.redirectToSignIn = async (opts) => {
3219
- const callback = () => {
3220
- var _a2;
3221
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.redirectToSignIn(opts);
3222
- };
3223
- if (this.clerkjs && this.loaded) {
3224
- return callback();
3225
- } else {
3226
- this.premountMethodCalls.set("redirectToSignIn", callback);
3227
- return;
3228
- }
3229
- };
3230
- this.redirectToSignUp = async (opts) => {
3231
- const callback = () => {
3232
- var _a2;
3233
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.redirectToSignUp(opts);
3234
- };
3235
- if (this.clerkjs && this.loaded) {
3236
- return callback();
3237
- } else {
3238
- this.premountMethodCalls.set("redirectToSignUp", callback);
3239
- return;
3240
- }
3241
- };
3242
- this.redirectToUserProfile = async () => {
3243
- const callback = () => {
3244
- var _a2;
3245
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.redirectToUserProfile();
3246
- };
3247
- if (this.clerkjs && this.loaded) {
3248
- return callback();
3249
- } else {
3250
- this.premountMethodCalls.set("redirectToUserProfile", callback);
3251
- return;
3252
- }
3253
- };
3254
- this.redirectToAfterSignUp = () => {
3255
- const callback = () => {
3256
- var _a2;
3257
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.redirectToAfterSignUp();
3258
- };
3259
- if (this.clerkjs && this.loaded) {
3260
- return callback();
3261
- } else {
3262
- this.premountMethodCalls.set("redirectToAfterSignUp", callback);
3263
- }
3264
- };
3265
- this.redirectToAfterSignIn = () => {
3266
- const callback = () => {
3267
- var _a2;
3268
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.redirectToAfterSignIn();
3269
- };
3270
- if (this.clerkjs && this.loaded) {
3271
- callback();
3272
- } else {
3273
- this.premountMethodCalls.set("redirectToAfterSignIn", callback);
3274
- }
3275
- };
3276
- this.redirectToAfterSignOut = () => {
3277
- const callback = () => {
3278
- var _a2;
3279
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.redirectToAfterSignOut();
3280
- };
3281
- if (this.clerkjs && this.loaded) {
3282
- callback();
3283
- } else {
3284
- this.premountMethodCalls.set("redirectToAfterSignOut", callback);
3285
- }
3286
- };
3287
- this.redirectToOrganizationProfile = async () => {
3288
- const callback = () => {
3289
- var _a2;
3290
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.redirectToOrganizationProfile();
3291
- };
3292
- if (this.clerkjs && this.loaded) {
3293
- return callback();
3294
- } else {
3295
- this.premountMethodCalls.set("redirectToOrganizationProfile", callback);
3296
- return;
3297
- }
3298
- };
3299
- this.redirectToCreateOrganization = async () => {
3300
- const callback = () => {
3301
- var _a2;
3302
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.redirectToCreateOrganization();
3303
- };
3304
- if (this.clerkjs && this.loaded) {
3305
- return callback();
3306
- } else {
3307
- this.premountMethodCalls.set("redirectToCreateOrganization", callback);
3308
- return;
3309
- }
3310
- };
3311
- this.redirectToWaitlist = async () => {
3312
- const callback = () => {
3313
- var _a2;
3314
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.redirectToWaitlist();
3315
- };
3316
- if (this.clerkjs && this.loaded) {
3317
- return callback();
3318
- } else {
3319
- this.premountMethodCalls.set("redirectToWaitlist", callback);
3320
- return;
3321
- }
3322
- };
3323
- this.redirectToTasks = async (opts) => {
3324
- const callback = () => {
3325
- var _a2;
3326
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.redirectToTasks(opts);
3327
- };
3328
- if (this.clerkjs && this.loaded) {
3329
- return callback();
3330
- } else {
3331
- this.premountMethodCalls.set("redirectToTasks", callback);
3332
- return;
3333
- }
3334
- };
3335
- this.handleRedirectCallback = async (params) => {
3336
- var _a2;
3337
- const callback = () => {
3338
- var _a3;
3339
- return (_a3 = this.clerkjs) == null ? void 0 : _a3.handleRedirectCallback(params);
3340
- };
3341
- if (this.clerkjs && this.loaded) {
3342
- void ((_a2 = callback()) == null ? void 0 : _a2.catch(() => {
3343
- }));
3344
- } else {
3345
- this.premountMethodCalls.set("handleRedirectCallback", callback);
3346
- }
3347
- };
3348
- this.handleGoogleOneTapCallback = async (signInOrUp, params) => {
3349
- var _a2;
3350
- const callback = () => {
3351
- var _a3;
3352
- return (_a3 = this.clerkjs) == null ? void 0 : _a3.handleGoogleOneTapCallback(signInOrUp, params);
3353
- };
3354
- if (this.clerkjs && this.loaded) {
3355
- void ((_a2 = callback()) == null ? void 0 : _a2.catch(() => {
3356
- }));
3357
- } else {
3358
- this.premountMethodCalls.set("handleGoogleOneTapCallback", callback);
3359
- }
3360
- };
3361
- this.handleEmailLinkVerification = async (params) => {
3362
- const callback = () => {
3363
- var _a2;
3364
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.handleEmailLinkVerification(params);
3365
- };
3366
- if (this.clerkjs && this.loaded) {
3367
- return callback();
3368
- } else {
3369
- this.premountMethodCalls.set("handleEmailLinkVerification", callback);
3370
- }
3371
- };
3372
- this.authenticateWithMetamask = async (params) => {
3373
- const callback = () => {
3374
- var _a2;
3375
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.authenticateWithMetamask(params);
3376
- };
3377
- if (this.clerkjs && this.loaded) {
3378
- return callback();
3379
- } else {
3380
- this.premountMethodCalls.set("authenticateWithMetamask", callback);
3381
- }
3382
- };
3383
- this.authenticateWithCoinbaseWallet = async (params) => {
3384
- const callback = () => {
3385
- var _a2;
3386
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.authenticateWithCoinbaseWallet(params);
3387
- };
3388
- if (this.clerkjs && this.loaded) {
3389
- return callback();
3390
- } else {
3391
- this.premountMethodCalls.set("authenticateWithCoinbaseWallet", callback);
3392
- }
3393
- };
3394
- this.authenticateWithBase = async (params) => {
3395
- const callback = () => {
3396
- var _a2;
3397
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.authenticateWithBase(params);
3398
- };
3399
- if (this.clerkjs && this.loaded) {
3400
- return callback();
3401
- } else {
3402
- this.premountMethodCalls.set("authenticateWithBase", callback);
3403
- }
3404
- };
3405
- this.authenticateWithOKXWallet = async (params) => {
3406
- const callback = () => {
3407
- var _a2;
3408
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.authenticateWithOKXWallet(params);
3409
- };
3410
- if (this.clerkjs && this.loaded) {
3411
- return callback();
3412
- } else {
3413
- this.premountMethodCalls.set("authenticateWithOKXWallet", callback);
3414
- }
3415
- };
3416
- this.authenticateWithSolana = async (params) => {
3417
- const callback = () => {
3418
- var _a2;
3419
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.authenticateWithSolana(params);
3420
- };
3421
- if (this.clerkjs && this.loaded) {
3422
- return callback();
3423
- } else {
3424
- this.premountMethodCalls.set("authenticateWithSolana", callback);
3425
- }
3426
- };
3427
- this.authenticateWithWeb3 = async (params) => {
3428
- const callback = () => {
3429
- var _a2;
3430
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.authenticateWithWeb3(params);
3431
- };
3432
- if (this.clerkjs && this.loaded) {
3433
- return callback();
3434
- } else {
3435
- this.premountMethodCalls.set("authenticateWithWeb3", callback);
3436
- }
3437
- };
3438
- this.authenticateWithGoogleOneTap = async (params) => {
3439
- const clerkjs = await __privateMethod(this, _IsomorphicClerk_instances, waitForClerkJS_fn).call(this);
3440
- return clerkjs.authenticateWithGoogleOneTap(params);
3441
- };
3442
- this.__internal_loadStripeJs = async () => {
3443
- const clerkjs = await __privateMethod(this, _IsomorphicClerk_instances, waitForClerkJS_fn).call(this);
3444
- return clerkjs.__internal_loadStripeJs();
3445
- };
3446
- this.createOrganization = async (params) => {
3447
- const callback = () => {
3448
- var _a2;
3449
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.createOrganization(params);
3450
- };
3451
- if (this.clerkjs && this.loaded) {
3452
- return callback();
3453
- } else {
3454
- this.premountMethodCalls.set("createOrganization", callback);
3455
- }
3456
- };
3457
- this.getOrganization = async (organizationId) => {
3458
- const callback = () => {
3459
- var _a2;
3460
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.getOrganization(organizationId);
3461
- };
3462
- if (this.clerkjs && this.loaded) {
3463
- return callback();
3464
- } else {
3465
- this.premountMethodCalls.set("getOrganization", callback);
3466
- }
3467
- };
3468
- this.joinWaitlist = async (params) => {
3469
- const callback = () => {
3470
- var _a2;
3471
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.joinWaitlist(params);
3472
- };
3473
- if (this.clerkjs && this.loaded) {
3474
- return callback();
3475
- } else {
3476
- this.premountMethodCalls.set("joinWaitlist", callback);
3477
- }
3478
- };
3479
- this.signOut = async (...args) => {
3480
- const callback = () => {
3481
- var _a2;
3482
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.signOut(...args);
3483
- };
3484
- if (this.clerkjs && this.loaded) {
3485
- return callback();
3486
- } else {
3487
- this.premountMethodCalls.set("signOut", callback);
3488
- }
3489
- };
3490
- this.__internal_attemptToEnableEnvironmentSetting = (options) => {
3491
- const callback = () => {
3492
- var _a2;
3493
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.__internal_attemptToEnableEnvironmentSetting(options);
3494
- };
3495
- if (this.clerkjs && this.loaded) {
3496
- return callback();
3497
- } else {
3498
- this.premountMethodCalls.set("__internal_attemptToEnableEnvironmentSetting", callback);
3499
- }
3500
- };
3501
- var _a2;
3502
- __privateSet(this, _publishableKey, options == null ? void 0 : options.publishableKey);
3503
- __privateSet(this, _proxyUrl, options == null ? void 0 : options.proxyUrl);
3504
- __privateSet(this, _domain, options == null ? void 0 : options.domain);
3505
- this.options = options;
3506
- this.Clerk = (options == null ? void 0 : options.Clerk) || null;
3507
- this.mode = (0, import_browser3.inBrowser)() ? "browser" : "server";
3508
- __privateSet(this, _stateProxy, new StateProxy(this));
3509
- if (!this.options.sdkMetadata) {
3510
- this.options.sdkMetadata = SDK_METADATA;
3511
- }
3512
- __privateGet(this, _eventBus).emit(import_clerkEventBus.clerkEvents.Status, "loading");
3513
- __privateGet(this, _eventBus).prioritizedOn(import_clerkEventBus.clerkEvents.Status, (status) => __privateSet(this, _status, status));
3514
- if (__privateGet(this, _publishableKey) && ((_a2 = this.options.experimental) == null ? void 0 : _a2.runtimeEnvironment) === "headless" && this.options.Clerk) {
3515
- void this.loadHeadlessClerk();
3516
- } else if (__privateGet(this, _publishableKey)) {
3517
- void this.getEntryChunks();
3518
- }
3519
- }
3520
- get publishableKey() {
3521
- return __privateGet(this, _publishableKey);
3522
- }
3523
- get loaded() {
3524
- var _a2;
3525
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.loaded) || false;
3526
- }
3527
- get status() {
3528
- var _a2;
3529
- if (!this.clerkjs) {
3530
- return __privateGet(this, _status);
3531
- }
3532
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.status) || /**
3533
- * Support older clerk-js versions.
3534
- * If clerk-js is available but `.status` is missing it we need to fallback to `.loaded`.
3535
- * Since "degraded" an "error" did not exist before,
3536
- * map "loaded" to "ready" and "not loaded" to "loading".
3537
- */
3538
- (this.clerkjs.loaded ? "ready" : "loading");
3539
- }
3540
- static getOrCreateInstance(options) {
3541
- if (!(0, import_browser3.inBrowser)() || !__privateGet(this, _instance) || options.Clerk && __privateGet(this, _instance).Clerk !== options.Clerk || // Allow hot swapping PKs on the client
3542
- __privateGet(this, _instance).publishableKey !== options.publishableKey) {
3543
- __privateSet(this, _instance, new _IsomorphicClerk(options));
3544
- }
3545
- return __privateGet(this, _instance);
3546
- }
3547
- static clearInstance() {
3548
- __privateSet(this, _instance, null);
3549
- }
3550
- get domain() {
3551
- if (typeof window !== "undefined" && window.location) {
3552
- return (0, import_utils10.handleValueOrFn)(__privateGet(this, _domain), new URL(window.location.href), "");
3553
- }
3554
- if (typeof __privateGet(this, _domain) === "function") {
3555
- return errorThrower.throw(unsupportedNonBrowserDomainOrProxyUrlFunction);
3556
- }
3557
- return __privateGet(this, _domain) || "";
3558
- }
3559
- get proxyUrl() {
3560
- if (typeof window !== "undefined" && window.location) {
3561
- return (0, import_utils10.handleValueOrFn)(__privateGet(this, _proxyUrl), new URL(window.location.href), "");
3562
- }
3563
- if (typeof __privateGet(this, _proxyUrl) === "function") {
3564
- return errorThrower.throw(unsupportedNonBrowserDomainOrProxyUrlFunction);
3565
- }
3566
- return __privateGet(this, _proxyUrl) || "";
3567
- }
3568
- /**
3569
- * Accesses private options from the `Clerk` instance and defaults to
3570
- * `IsomorphicClerk` options when in SSR context.
3571
- * @internal
3572
- */
3573
- __internal_getOption(key) {
3574
- var _a2, _b;
3575
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.__internal_getOption) ? (_b = this.clerkjs) == null ? void 0 : _b.__internal_getOption(key) : this.options[key];
3576
- }
3577
- /**
3578
- * Initialize Clerk for headless/React Native environments where a Clerk instance is provided directly.
3579
- * Only handles Clerk construction and loading — post-load wiring is shared via replayInterceptedInvocations.
3580
- */
3581
- loadHeadlessClerk() {
3582
- const clerk = isConstructor(this.options.Clerk) ? new this.options.Clerk(__privateGet(this, _publishableKey), { proxyUrl: this.proxyUrl, domain: this.domain }) : this.options.Clerk;
3583
- if (!clerk) {
3584
- __privateGet(this, _eventBus).emit(import_clerkEventBus.clerkEvents.Status, "error");
3585
- return;
3586
- }
3587
- const onLoaded = () => {
3588
- this.replayInterceptedInvocations(clerk);
3589
- };
3590
- if (!clerk.loaded) {
3591
- clerk.load(this.options).then(() => onLoaded()).catch((err) => {
3592
- if (false) {
3593
- console.error("Clerk: Failed to load:", err);
3594
- }
3595
- __privateGet(this, _eventBus).emit(import_clerkEventBus.clerkEvents.Status, "error");
3596
- this.emitLoaded();
3597
- });
3598
- } else {
3599
- onLoaded();
3600
- }
3601
- }
3602
- get sdkMetadata() {
3603
- var _a2;
3604
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.sdkMetadata) || this.options.sdkMetadata || void 0;
3605
- }
3606
- get instanceType() {
3607
- var _a2;
3608
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.instanceType;
3609
- }
3610
- get frontendApi() {
3611
- var _a2;
3612
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.frontendApi) || "";
3613
- }
3614
- get isStandardBrowser() {
3615
- var _a2;
3616
- return ((_a2 = this.clerkjs) == null ? void 0 : _a2.isStandardBrowser) || this.options.standardBrowser || false;
3617
- }
3618
- get isSatellite() {
3619
- if (typeof window !== "undefined" && window.location) {
3620
- return (0, import_utils10.handleValueOrFn)(this.options.isSatellite, new URL(window.location.href), false);
3621
- }
3622
- if (typeof this.options.isSatellite === "function") {
3623
- return errorThrower.throw(unsupportedNonBrowserDomainOrProxyUrlFunction);
3624
- }
3625
- return false;
3626
- }
3627
- async getEntryChunks() {
3628
- var _a2;
3629
- if (this.mode !== "browser" || this.loaded) {
3630
- return;
3631
- }
3632
- if (typeof window !== "undefined") {
3633
- window.__clerk_publishable_key = __privateGet(this, _publishableKey);
3634
- window.__clerk_proxy_url = this.proxyUrl;
3635
- window.__clerk_domain = this.domain;
3636
- }
3637
- try {
3638
- const clerk = await this.getClerkJsEntryChunk();
3639
- if (!clerk.loaded) {
3640
- this.beforeLoad(clerk);
3641
- const shouldLoadUi = this.options.standardBrowser !== false && !this.options.Clerk || !!((_a2 = this.options.ui) == null ? void 0 : _a2.ClerkUI);
3642
- const ClerkUI = shouldLoadUi ? await this.getClerkUIEntryChunk() : void 0;
3643
- await clerk.load({ ...this.options, ui: { ...this.options.ui, ClerkUI } });
3644
- }
3645
- if (clerk.loaded) {
3646
- this.replayInterceptedInvocations(clerk);
3647
- }
3648
- } catch (err) {
3649
- const error = err;
3650
- __privateGet(this, _eventBus).emit(import_clerkEventBus.clerkEvents.Status, "error");
3651
- console.error(error.stack || error.message || error);
3652
- return;
3653
- }
3654
- }
3655
- async getClerkJsEntryChunk() {
3656
- if ((!this.options.Clerk || this.options.__internal_clerkJSUrl) && !__BUILD_DISABLE_RHC__) {
3657
- await (0, import_loadClerkJsScript.loadClerkJSScript)({
3658
- ...this.options,
3659
- publishableKey: __privateGet(this, _publishableKey),
3660
- proxyUrl: this.proxyUrl,
3661
- domain: this.domain,
3662
- nonce: this.options.nonce
3663
- });
3664
- }
3665
- if (this.options.Clerk && !this.options.__internal_clerkJSUrl) {
3666
- global.Clerk = isConstructor(this.options.Clerk) ? new this.options.Clerk(__privateGet(this, _publishableKey), { proxyUrl: this.proxyUrl, domain: this.domain }) : this.options.Clerk;
3667
- }
3668
- if (!global.Clerk) {
3669
- throw new Error("Failed to download latest ClerkJS. Contact support@clerk.com.");
3670
- }
3671
- return global.Clerk;
3672
- }
3673
- async getClerkUIEntryChunk() {
3674
- const uiProp = this.options.ui;
3675
- const hasInternalUrl = !!this.options.__internal_clerkUIUrl;
3676
- if ((uiProp == null ? void 0 : uiProp.ClerkUI) && !hasInternalUrl) {
3677
- return uiProp.ClerkUI;
3678
- }
3679
- if ((uiProp || this.options.prefetchUI === false) && !hasInternalUrl) {
3680
- return void 0;
3681
- }
3682
- if (!__BUILD_DISABLE_RHC__) {
3683
- await (0, import_loadClerkJsScript.loadClerkUIScript)({
3684
- ...this.options,
3685
- publishableKey: __privateGet(this, _publishableKey),
3686
- proxyUrl: this.proxyUrl,
3687
- domain: this.domain,
3688
- nonce: this.options.nonce
3689
- });
3690
- if (!global.__internal_ClerkUICtor) {
3691
- throw new Error("Failed to download latest Clerk UI. Contact support@clerk.com.");
3692
- }
3693
- return global.__internal_ClerkUICtor;
3694
- }
3695
- return void 0;
3696
- }
3697
- get version() {
3698
- var _a2;
3699
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.version;
3700
- }
3701
- get client() {
3702
- if (this.clerkjs) {
3703
- return this.clerkjs.client;
3704
- } else {
3705
- return void 0;
3706
- }
3707
- }
3708
- get session() {
3709
- if (this.clerkjs) {
3710
- return this.clerkjs.session;
3711
- } else {
3712
- return void 0;
3713
- }
3714
- }
3715
- get user() {
3716
- if (this.clerkjs) {
3717
- return this.clerkjs.user;
3718
- } else {
3719
- return void 0;
3720
- }
3721
- }
3722
- get organization() {
3723
- if (this.clerkjs) {
3724
- return this.clerkjs.organization;
3725
- } else {
3726
- return void 0;
3727
- }
3728
- }
3729
- get telemetry() {
3730
- if (this.clerkjs) {
3731
- return this.clerkjs.telemetry;
3732
- } else {
3733
- return void 0;
3734
- }
3735
- }
3736
- get __internal_environment() {
3737
- if (this.clerkjs) {
3738
- return this.clerkjs.__internal_environment;
3739
- } else {
3740
- return void 0;
3741
- }
3742
- }
3743
- get isSignedIn() {
3744
- if (this.clerkjs) {
3745
- return this.clerkjs.isSignedIn;
3746
- } else {
3747
- return false;
3748
- }
3749
- }
3750
- get billing() {
3751
- var _a2;
3752
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.billing;
3753
- }
3754
- get __internal_state() {
3755
- return this.loaded && this.clerkjs ? this.clerkjs.__internal_state : __privateGet(this, _stateProxy);
3756
- }
3757
- get apiKeys() {
3758
- var _a2;
3759
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.apiKeys;
3760
- }
3761
- get oauthApplication() {
3762
- var _a2;
3763
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.oauthApplication;
3764
- }
3765
- __internal_setEnvironment(...args) {
3766
- if (this.clerkjs && "__internal_setEnvironment" in this.clerkjs) {
3767
- this.clerkjs.__internal_setEnvironment(args);
3768
- } else {
3769
- return void 0;
3770
- }
3771
- }
3772
- get __internal_lastEmittedResources() {
3773
- var _a2;
3774
- return (_a2 = this.clerkjs) == null ? void 0 : _a2.__internal_lastEmittedResources;
3775
- }
3776
- };
3777
- _status = new WeakMap();
3778
- _domain = new WeakMap();
3779
- _proxyUrl = new WeakMap();
3780
- _publishableKey = new WeakMap();
3781
- _eventBus = new WeakMap();
3782
- _stateProxy = new WeakMap();
3783
- _instance = new WeakMap();
3784
- _IsomorphicClerk_instances = new WeakSet();
3785
- waitForClerkJS_fn = function() {
3786
- return new Promise((resolve) => {
3787
- this.addOnLoaded(() => resolve(this.clerkjs));
3788
- });
3789
- };
3790
- __privateAdd(_IsomorphicClerk, _instance);
3791
- var IsomorphicClerk = _IsomorphicClerk;
3792
-
3793
- // src/utils/versionCheck.ts
3794
- var import_versionCheck = require("@clerk/shared/versionCheck");
3795
- var import_react28 = __toESM(require("react"));
3796
- var import_versionCheck2 = require("@clerk/shared/versionCheck");
3797
- function computeReactVersionCompatibility() {
3798
- try {
3799
- return (0, import_versionCheck.isVersionCompatible)(import_react28.default.version, define_CLERK_UI_SUPPORTED_REACT_BOUNDS_default);
3800
- } catch {
3801
- return false;
3802
- }
3803
- }
3804
- var IS_REACT_SHARED_VARIANT_COMPATIBLE = computeReactVersionCompatibility();
3805
-
3806
- // src/contexts/ClerkProvider.tsx
3807
- function ClerkProviderBase(props) {
3808
- const { initialState, children, ...restIsomorphicClerkOptions } = props;
3809
- const mergedOptions = mergeWithEnv(restIsomorphicClerkOptions);
3810
- const { isomorphicClerk, clerkStatus } = useLoadedIsomorphicClerk(mergedOptions);
3811
- return /* @__PURE__ */ import_react30.default.createElement(
3812
- import_react29.ClerkContextProvider,
3813
- {
3814
- initialState,
3815
- clerk: isomorphicClerk,
3816
- clerkStatus
3817
- },
3818
- children
3819
- );
3820
- }
3821
- var ClerkProvider = withMaxAllowedInstancesGuard(ClerkProviderBase, "ClerkProvider", multipleClerkProvidersError);
3822
- ClerkProvider.displayName = "ClerkProvider";
3823
- var DEFAULT_CLERK_UI_VARIANT = IS_REACT_SHARED_VARIANT_COMPATIBLE ? "shared" : "";
3824
- var useLoadedIsomorphicClerk = (mergedOptions) => {
3825
- const optionsWithDefaults = import_react30.default.useMemo(
3826
- () => ({
3827
- clerkUIVariant: DEFAULT_CLERK_UI_VARIANT,
3828
- ...mergedOptions
3829
- }),
3830
- [mergedOptions]
3831
- );
3832
- const isomorphicClerkRef = import_react30.default.useRef(IsomorphicClerk.getOrCreateInstance(optionsWithDefaults));
3833
- const [clerkStatus, setClerkStatus] = import_react30.default.useState(isomorphicClerkRef.current.status);
3834
- import_react30.default.useEffect(() => {
3835
- void isomorphicClerkRef.current.__internal_updateProps({ appearance: mergedOptions.appearance });
3836
- }, [mergedOptions.appearance]);
3837
- import_react30.default.useEffect(() => {
3838
- void isomorphicClerkRef.current.__internal_updateProps({ options: mergedOptions });
3839
- }, [mergedOptions.localization]);
3840
- import_react30.default.useEffect(() => {
3841
- isomorphicClerkRef.current.on("status", setClerkStatus);
3842
- return () => {
3843
- if (isomorphicClerkRef.current) {
3844
- isomorphicClerkRef.current.off("status", setClerkStatus);
3845
- }
3846
- IsomorphicClerk.clearInstance();
3847
- };
3848
- }, []);
3849
- return { isomorphicClerk: isomorphicClerkRef.current, clerkStatus };
3850
- };
3851
-
3852
- // src/contexts/index.ts
3853
- var import_react31 = require("@clerk/shared/react");
3854
-
3855
- // src/index.ts
3856
- var import_getToken = require("@clerk/shared/getToken");
3857
- setErrorThrowerOptions({ packageName: "@clerk/react" });
3858
- (0, import_loadClerkJsScript2.setClerkJSLoadingErrorPackageName)("@clerk/react");
3859
- // Annotate the CommonJS export names for ESM import in node:
3860
- 0 && (module.exports = {
3861
- APIKeys,
3862
- AuthenticateWithRedirectCallback,
3863
- ClerkDegraded,
3864
- ClerkFailed,
3865
- ClerkLoaded,
3866
- ClerkLoading,
3867
- ClerkProvider,
3868
- CreateOrganization,
3869
- GoogleOneTap,
3870
- HandleSSOCallback,
3871
- OAuthConsent,
3872
- OrganizationList,
3873
- OrganizationProfile,
3874
- OrganizationSwitcher,
3875
- PricingTable,
3876
- RedirectToCreateOrganization,
3877
- RedirectToOrganizationProfile,
3878
- RedirectToSignIn,
3879
- RedirectToSignUp,
3880
- RedirectToTasks,
3881
- RedirectToUserProfile,
3882
- Show,
3883
- SignIn,
3884
- SignInButton,
3885
- SignInWithMetamaskButton,
3886
- SignOutButton,
3887
- SignUp,
3888
- SignUpButton,
3889
- TaskChooseOrganization,
3890
- TaskResetPassword,
3891
- TaskSetupMFA,
3892
- UNSAFE_PortalProvider,
3893
- UserAvatar,
3894
- UserButton,
3895
- UserProfile,
3896
- Waitlist,
3897
- __experimental_CheckoutProvider,
3898
- __experimental_PaymentElement,
3899
- __experimental_PaymentElementProvider,
3900
- __experimental_useCheckout,
3901
- __experimental_usePaymentElement,
3902
- getToken,
3903
- useAPIKeys,
3904
- useAuth,
3905
- useClerk,
3906
- useEmailLink,
3907
- useOAuthConsent,
3908
- useOrganization,
3909
- useOrganizationCreationDefaults,
3910
- useOrganizationList,
3911
- useReverification,
3912
- useSession,
3913
- useSessionList,
3914
- useSignIn,
3915
- useSignUp,
3916
- useUser,
3917
- useWaitlist
3918
- });
3919
- //# sourceMappingURL=index.js.map