@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
@@ -0,0 +1,1606 @@
1
+ //#region \0rolldown/runtime.js
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 __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+ const require_useAssertWrappedByClerkProvider = require('./useAssertWrappedByClerkProvider-Cm0djUcB.cjs');
29
+ let react = require("react");
30
+ react = __toESM(react);
31
+ let react_dom = require("react-dom");
32
+ let _clerk_shared_error = require("@clerk/shared/error");
33
+ let _clerk_shared_utils = require("@clerk/shared/utils");
34
+ let _clerk_shared_getEnvVariable = require("@clerk/shared/getEnvVariable");
35
+ let _clerk_shared_object = require("@clerk/shared/object");
36
+ let _clerk_shared_react = require("@clerk/shared/react");
37
+ let _clerk_shared_authorization = require("@clerk/shared/authorization");
38
+ let _clerk_shared_telemetry = require("@clerk/shared/telemetry");
39
+ let _clerk_shared_deriveState = require("@clerk/shared/deriveState");
40
+ let _clerk_shared_browser = require("@clerk/shared/browser");
41
+
42
+ //#region src/errors/messages.ts
43
+ const multipleClerkProvidersError = "You've added multiple <ClerkProvider> components in your React component tree. Wrap your components in a single <ClerkProvider>.";
44
+ const multipleChildrenInButtonComponent = (name) => `You've passed multiple children components to <${name}/>. You can only pass a single child component or text.`;
45
+ const invalidStateError = "Invalid state. Feel free to submit a bug or reach out to support here: https://clerk.com/contact/support";
46
+ const unsupportedNonBrowserDomainOrProxyUrlFunction = "Unsupported usage of isSatellite, domain or proxyUrl. The usage of isSatellite, domain or proxyUrl as function is not supported in non-browser environments.";
47
+ const userProfilePageRenderedError = "<UserProfile.Page /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.";
48
+ const userProfileLinkRenderedError = "<UserProfile.Link /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.";
49
+ const organizationProfilePageRenderedError = "<OrganizationProfile.Page /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.";
50
+ const organizationProfileLinkRenderedError = "<OrganizationProfile.Link /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.";
51
+ const 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.`;
52
+ const customPageWrongProps = (componentName) => `Missing props. <${componentName}.Page /> component requires the following props: url, label, labelIcon, alongside with children to be rendered inside the page.`;
53
+ const customLinkWrongProps = (componentName) => `Missing props. <${componentName}.Link /> component requires the following props: url, label and labelIcon.`;
54
+ const noPathProvidedError = (componentName) => `The <${componentName}/> component uses path-based routing by default unless a different routing strategy is provided using the \`routing\` prop. When path-based routing is used, you need to provide the path where the component is mounted on by using the \`path\` prop. Example: <${componentName} path={'/my-path'} />`;
55
+ const incompatibleRoutingWithPathProvidedError = (componentName) => `The \`path\` prop will only be respected when the Clerk component uses path-based routing. To resolve this error, pass \`routing='path'\` to the <${componentName}/> component, or drop the \`path\` prop to switch to hash-based routing. For more details please refer to our docs: https://clerk.com/docs`;
56
+ const 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.`;
57
+ const 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.";
58
+ const userButtonMenuItemsRenderedError = "<UserButton.MenuItems /> component needs to be a direct child of `<UserButton />`.";
59
+ const userButtonMenuActionRenderedError = "<UserButton.Action /> component needs to be a direct child of `<UserButton.MenuItems />`.";
60
+ const userButtonMenuLinkRenderedError = "<UserButton.Link /> component needs to be a direct child of `<UserButton.MenuItems />`.";
61
+ const userButtonMenuItemLinkWrongProps = "Missing props. <UserButton.Link /> component requires the following props: href, label and labelIcon.";
62
+ const userButtonMenuItemsActionWrongsProps = "Missing props. <UserButton.Action /> component requires the following props: label.";
63
+
64
+ //#endregion
65
+ //#region src/utils/childrenUtils.tsx
66
+ const assertSingleChild = (children) => (name) => {
67
+ try {
68
+ return react.default.Children.only(children);
69
+ } catch {
70
+ const childArray = react.default.Children.toArray(children);
71
+ if (childArray.length === 1 && react.default.isValidElement(childArray[0])) return childArray[0];
72
+ return require_useAssertWrappedByClerkProvider.errorThrower.throw(multipleChildrenInButtonComponent(name));
73
+ }
74
+ };
75
+ const normalizeWithDefaultValue = (children, defaultText) => {
76
+ if (!children) children = defaultText;
77
+ if (typeof children === "string") children = /* @__PURE__ */ react.default.createElement("button", null, children);
78
+ return children;
79
+ };
80
+ const safeExecute = (cb) => (...args) => {
81
+ if (cb && typeof cb === "function") return cb(...args);
82
+ };
83
+
84
+ //#endregion
85
+ //#region src/utils/envVariables.ts
86
+ /**
87
+ * Gets an environment variable value, checking for Vite's VITE_ prefix first.
88
+ * This allows React SDK users with Vite to use VITE_CLERK_* env vars
89
+ * (which Vite exposes client-side) without manual configuration.
90
+ *
91
+ * Note: Empty string values are treated as "not set" and will fall through to
92
+ * the next env var in the chain. This is intentional since empty values are
93
+ * typically invalid for these options.
94
+ *
95
+ * @param name - The environment variable name without prefix (e.g., 'CLERK_PUBLISHABLE_KEY')
96
+ * @returns The value of the environment variable, or empty string if not found
97
+ */
98
+ const getEnvVar = (name) => {
99
+ return (0, _clerk_shared_getEnvVariable.getEnvVariable)(`VITE_${name}`) || (0, _clerk_shared_getEnvVariable.getEnvVariable)(name);
100
+ };
101
+ /**
102
+ * Helper to get env fallback only when the option is undefined.
103
+ * We check for undefined specifically (not falsy) to avoid conflicting with framework SDKs
104
+ * that may pass an empty string when their env var is not set.
105
+ *
106
+ * Returns the env var value only if it's non-empty, otherwise returns undefined
107
+ * to preserve the original behavior when no env var is set.
108
+ */
109
+ const withEnvFallback = (value, envVarName) => {
110
+ if (value !== void 0) return value;
111
+ return getEnvVar(envVarName) || void 0;
112
+ };
113
+ /**
114
+ * Merges ClerkProvider options with environment variable fallbacks.
115
+ * This supports Vite users who set VITE_CLERK_* or CLERK_* env vars.
116
+ * Passed-in options always take priority over environment variables.
117
+ *
118
+ * Supported environment variables:
119
+ * - VITE_CLERK_PUBLISHABLE_KEY / CLERK_PUBLISHABLE_KEY
120
+ *
121
+ * @param options - The options passed to ClerkProvider
122
+ * @returns Options with environment variable fallbacks applied
123
+ */
124
+ const mergeWithEnv = (options) => {
125
+ const publishableKey = withEnvFallback(options.publishableKey, "CLERK_PUBLISHABLE_KEY");
126
+ return {
127
+ ...options,
128
+ ...publishableKey !== void 0 && { publishableKey }
129
+ };
130
+ };
131
+
132
+ //#endregion
133
+ //#region src/utils/isConstructor.ts
134
+ function isConstructor(f) {
135
+ return typeof f === "function";
136
+ }
137
+
138
+ //#endregion
139
+ //#region src/utils/useMaxAllowedInstancesGuard.tsx
140
+ const counts = /* @__PURE__ */ new Map();
141
+ function useMaxAllowedInstancesGuard(name, error, maxCount = 1) {
142
+ react.default.useEffect(() => {
143
+ const count = counts.get(name) || 0;
144
+ if (count == maxCount) return require_useAssertWrappedByClerkProvider.errorThrower.throw(error);
145
+ counts.set(name, count + 1);
146
+ return () => {
147
+ counts.set(name, (counts.get(name) || 1) - 1);
148
+ };
149
+ }, []);
150
+ }
151
+ function withMaxAllowedInstancesGuard(WrappedComponent, name, error) {
152
+ const displayName = WrappedComponent.displayName || WrappedComponent.name || name || "Component";
153
+ const Hoc = (props) => {
154
+ useMaxAllowedInstancesGuard(name, error);
155
+ return /* @__PURE__ */ react.default.createElement(WrappedComponent, props);
156
+ };
157
+ Hoc.displayName = `withMaxAllowedInstancesGuard(${displayName})`;
158
+ return Hoc;
159
+ }
160
+
161
+ //#endregion
162
+ //#region src/utils/useCustomElementPortal.tsx
163
+ const useCustomElementPortal = (elements) => {
164
+ const [nodeMap, setNodeMap] = (0, react.useState)(/* @__PURE__ */ new Map());
165
+ const nodeMapRef = (0, react.useRef)(nodeMap);
166
+ const elementsRef = (0, react.useRef)(/* @__PURE__ */ new Map());
167
+ const portalsRef = (0, react.useRef)(/* @__PURE__ */ new Map());
168
+ nodeMapRef.current = nodeMap;
169
+ elementsRef.current = new Map(elements.map((el) => [el.id, el.component]));
170
+ const elementIds = new Set(elements.map((el) => el.id));
171
+ portalsRef.current.forEach((_, id) => {
172
+ if (!elementIds.has(id)) portalsRef.current.delete(id);
173
+ });
174
+ return elements.map((el) => {
175
+ const id = el.id;
176
+ const existingPortal = portalsRef.current.get(id);
177
+ if (existingPortal) return existingPortal;
178
+ const portal = () => {
179
+ const node = nodeMapRef.current.get(id);
180
+ const component = elementsRef.current.get(id);
181
+ return node ? (0, react_dom.createPortal)(component, node) : null;
182
+ };
183
+ const customElementPortal = {
184
+ id: el.id,
185
+ mount: (node) => setNodeMap((prev) => new Map(prev).set(id, node)),
186
+ unmount: () => setNodeMap((prev) => {
187
+ const newMap = new Map(prev);
188
+ newMap.set(id, null);
189
+ return newMap;
190
+ }),
191
+ portal
192
+ };
193
+ portalsRef.current.set(id, customElementPortal);
194
+ return customElementPortal;
195
+ });
196
+ };
197
+
198
+ //#endregion
199
+ //#region src/utils/componentValidation.ts
200
+ const isThatComponent = (v, component) => {
201
+ return !!v && react.default.isValidElement(v) && v?.type === component;
202
+ };
203
+
204
+ //#endregion
205
+ //#region src/utils/useCustomPages.tsx
206
+ const useUserProfileCustomPages = (children, options) => {
207
+ return useCustomPages({
208
+ children,
209
+ reorderItemsLabels: [
210
+ "account",
211
+ "security",
212
+ "billing",
213
+ "apiKeys"
214
+ ],
215
+ LinkComponent: UserProfileLink,
216
+ PageComponent: UserProfilePage,
217
+ MenuItemsComponent: MenuItems,
218
+ componentName: "UserProfile"
219
+ }, options);
220
+ };
221
+ const useOrganizationProfileCustomPages = (children, options) => {
222
+ return useCustomPages({
223
+ children,
224
+ reorderItemsLabels: [
225
+ "general",
226
+ "members",
227
+ "billing",
228
+ "apiKeys"
229
+ ],
230
+ LinkComponent: OrganizationProfileLink,
231
+ PageComponent: OrganizationProfilePage,
232
+ componentName: "OrganizationProfile"
233
+ }, options);
234
+ };
235
+ /**
236
+ * Exclude any children that is used for identifying Custom Pages or Custom Items.
237
+ * Passing:
238
+ * ```tsx
239
+ * <UserProfile.Page/>
240
+ * <OrganizationProfile.Link/>
241
+ * <MyComponent>
242
+ * <UserButton.MenuItems/>
243
+ * ```
244
+ * Gives back
245
+ * ```tsx
246
+ * <MyComponent>
247
+ * ````
248
+ */
249
+ const useSanitizedChildren = (children) => {
250
+ const sanitizedChildren = [];
251
+ const excludedComponents = [
252
+ OrganizationProfileLink,
253
+ OrganizationProfilePage,
254
+ MenuItems,
255
+ UserProfilePage,
256
+ UserProfileLink
257
+ ];
258
+ react.default.Children.forEach(children, (child) => {
259
+ if (!excludedComponents.some((component) => isThatComponent(child, component))) sanitizedChildren.push(child);
260
+ });
261
+ return sanitizedChildren;
262
+ };
263
+ const useCustomPages = (params, options) => {
264
+ const { children, LinkComponent, PageComponent, MenuItemsComponent, reorderItemsLabels, componentName } = params;
265
+ const { allowForAnyChildren = false } = options || {};
266
+ const validChildren = [];
267
+ const portalIdCounts = /* @__PURE__ */ new Map();
268
+ react.default.Children.forEach(children, (child) => {
269
+ if (!isThatComponent(child, PageComponent) && !isThatComponent(child, LinkComponent) && !isThatComponent(child, MenuItemsComponent)) {
270
+ if (child && !allowForAnyChildren) (0, _clerk_shared_utils.logErrorInDevMode)(customPagesIgnoredComponent(componentName));
271
+ return;
272
+ }
273
+ const { props } = child;
274
+ const { children, label, url, labelIcon } = props;
275
+ const childKey = child.key;
276
+ if (isThatComponent(child, PageComponent)) if (isReorderItem$1(props, reorderItemsLabels)) validChildren.push({ label });
277
+ else if (isCustomPage(props)) validChildren.push({
278
+ label,
279
+ labelIcon,
280
+ children,
281
+ url,
282
+ portalId: getCustomPagePortalId("page", props, childKey, portalIdCounts)
283
+ });
284
+ else {
285
+ (0, _clerk_shared_utils.logErrorInDevMode)(customPageWrongProps(componentName));
286
+ return;
287
+ }
288
+ if (isThatComponent(child, LinkComponent)) if (isExternalLink$1(props)) validChildren.push({
289
+ label,
290
+ labelIcon,
291
+ url,
292
+ portalId: getCustomPagePortalId("link", props, childKey, portalIdCounts)
293
+ });
294
+ else {
295
+ (0, _clerk_shared_utils.logErrorInDevMode)(customLinkWrongProps(componentName));
296
+ return;
297
+ }
298
+ });
299
+ const customPageContents = [];
300
+ const customPageLabelIcons = [];
301
+ const customLinkLabelIcons = [];
302
+ validChildren.forEach((cp, index) => {
303
+ if (isCustomPage(cp)) {
304
+ customPageContents.push({
305
+ component: cp.children,
306
+ id: cp.portalId || index
307
+ });
308
+ customPageLabelIcons.push({
309
+ component: cp.labelIcon,
310
+ id: cp.portalId || index
311
+ });
312
+ return;
313
+ }
314
+ if (isExternalLink$1(cp)) customLinkLabelIcons.push({
315
+ component: cp.labelIcon,
316
+ id: cp.portalId || index
317
+ });
318
+ });
319
+ const customPageContentsPortals = useCustomElementPortal(customPageContents);
320
+ const customPageLabelIconsPortals = useCustomElementPortal(customPageLabelIcons);
321
+ const customLinkLabelIconsPortals = useCustomElementPortal(customLinkLabelIcons);
322
+ const customPages = [];
323
+ const customPagesPortals = [];
324
+ validChildren.forEach((cp, index) => {
325
+ if (isReorderItem$1(cp, reorderItemsLabels)) {
326
+ customPages.push({ label: cp.label });
327
+ return;
328
+ }
329
+ if (isCustomPage(cp)) {
330
+ const { portal: contentPortal, mount, unmount } = customPageContentsPortals.find((p) => p.id === (cp.portalId || index));
331
+ const { portal: labelPortal, mount: mountIcon, unmount: unmountIcon } = customPageLabelIconsPortals.find((p) => p.id === (cp.portalId || index));
332
+ customPages.push({
333
+ label: cp.label,
334
+ url: cp.url,
335
+ mount,
336
+ unmount,
337
+ mountIcon,
338
+ unmountIcon
339
+ });
340
+ customPagesPortals.push({
341
+ key: `content:${cp.portalId || index}`,
342
+ portal: contentPortal
343
+ });
344
+ customPagesPortals.push({
345
+ key: `label:${cp.portalId || index}`,
346
+ portal: labelPortal
347
+ });
348
+ return;
349
+ }
350
+ if (isExternalLink$1(cp)) {
351
+ const { portal: labelPortal, mount: mountIcon, unmount: unmountIcon } = customLinkLabelIconsPortals.find((p) => p.id === (cp.portalId || index));
352
+ customPages.push({
353
+ label: cp.label,
354
+ url: cp.url,
355
+ mountIcon,
356
+ unmountIcon
357
+ });
358
+ customPagesPortals.push({
359
+ key: `label:${cp.portalId || index}`,
360
+ portal: labelPortal
361
+ });
362
+ return;
363
+ }
364
+ });
365
+ return {
366
+ customPages,
367
+ customPagesPortals
368
+ };
369
+ };
370
+ const getCustomPagePortalId = (type, props, key, portalIdCounts) => {
371
+ if (key != null) return `${type}:key:${key}`;
372
+ const baseId = `${type}:${props.label}:${props.url}`;
373
+ const occurrence = portalIdCounts.get(baseId) ?? 0;
374
+ portalIdCounts.set(baseId, occurrence + 1);
375
+ return `${baseId}:${occurrence}`;
376
+ };
377
+ const isReorderItem$1 = (childProps, validItems) => {
378
+ const { children, label, url, labelIcon } = childProps;
379
+ return !children && !url && !labelIcon && validItems.some((v) => v === label);
380
+ };
381
+ const isCustomPage = (childProps) => {
382
+ const { children, label, url, labelIcon } = childProps;
383
+ return !!children && !!url && !!labelIcon && !!label;
384
+ };
385
+ const isExternalLink$1 = (childProps) => {
386
+ const { children, label, url, labelIcon } = childProps;
387
+ return !children && !!url && !!labelIcon && !!label;
388
+ };
389
+
390
+ //#endregion
391
+ //#region src/utils/useCustomMenuItems.tsx
392
+ const useUserButtonCustomMenuItems = (children, options) => {
393
+ return useCustomMenuItems({
394
+ children,
395
+ reorderItemsLabels: ["manageAccount", "signOut"],
396
+ MenuItemsComponent: MenuItems,
397
+ MenuActionComponent: MenuAction,
398
+ MenuLinkComponent: MenuLink,
399
+ UserProfileLinkComponent: UserProfileLink,
400
+ UserProfilePageComponent: UserProfilePage,
401
+ allowForAnyChildren: options?.allowForAnyChildren ?? false
402
+ });
403
+ };
404
+ const useCustomMenuItems = ({ children, MenuItemsComponent, MenuActionComponent, MenuLinkComponent, UserProfileLinkComponent, UserProfilePageComponent, reorderItemsLabels, allowForAnyChildren = false }) => {
405
+ const validChildren = [];
406
+ const customMenuItems = [];
407
+ const customMenuItemsPortals = [];
408
+ const portalIdCounts = /* @__PURE__ */ new Map();
409
+ react.default.Children.forEach(children, (child) => {
410
+ if (!isThatComponent(child, MenuItemsComponent) && !isThatComponent(child, UserProfileLinkComponent) && !isThatComponent(child, UserProfilePageComponent)) {
411
+ if (child && !allowForAnyChildren) (0, _clerk_shared_utils.logErrorInDevMode)(userButtonIgnoredComponent);
412
+ return;
413
+ }
414
+ if (isThatComponent(child, UserProfileLinkComponent) || isThatComponent(child, UserProfilePageComponent)) return;
415
+ const { props } = child;
416
+ react.default.Children.forEach(props.children, (child) => {
417
+ if (!isThatComponent(child, MenuActionComponent) && !isThatComponent(child, MenuLinkComponent)) {
418
+ if (child) (0, _clerk_shared_utils.logErrorInDevMode)(customMenuItemsIgnoredComponent);
419
+ return;
420
+ }
421
+ const { props } = child;
422
+ const childKey = child.key;
423
+ const { label, labelIcon, href, onClick, open } = props;
424
+ if (isThatComponent(child, MenuActionComponent)) if (isReorderItem(props, reorderItemsLabels)) validChildren.push({ label });
425
+ else if (isCustomMenuItem(props)) {
426
+ const baseItem = {
427
+ label,
428
+ labelIcon
429
+ };
430
+ if (onClick !== void 0) validChildren.push({
431
+ ...baseItem,
432
+ onClick,
433
+ portalId: getCustomMenuItemPortalId("action", props, childKey, portalIdCounts)
434
+ });
435
+ else if (open !== void 0) validChildren.push({
436
+ ...baseItem,
437
+ open: open.startsWith("/") ? open : `/${open}`,
438
+ portalId: getCustomMenuItemPortalId("action", props, childKey, portalIdCounts)
439
+ });
440
+ else {
441
+ (0, _clerk_shared_utils.logErrorInDevMode)("Custom menu item must have either onClick or open property");
442
+ return;
443
+ }
444
+ } else {
445
+ (0, _clerk_shared_utils.logErrorInDevMode)(userButtonMenuItemsActionWrongsProps);
446
+ return;
447
+ }
448
+ if (isThatComponent(child, MenuLinkComponent)) if (isExternalLink(props)) validChildren.push({
449
+ label,
450
+ labelIcon,
451
+ href,
452
+ portalId: getCustomMenuItemPortalId("link", props, childKey, portalIdCounts)
453
+ });
454
+ else {
455
+ (0, _clerk_shared_utils.logErrorInDevMode)(userButtonMenuItemLinkWrongProps);
456
+ return;
457
+ }
458
+ });
459
+ });
460
+ const customMenuItemLabelIcons = [];
461
+ const customLinkLabelIcons = [];
462
+ validChildren.forEach((mi, index) => {
463
+ if (isCustomMenuItem(mi)) customMenuItemLabelIcons.push({
464
+ component: mi.labelIcon,
465
+ id: mi.portalId || index
466
+ });
467
+ if (isExternalLink(mi)) customLinkLabelIcons.push({
468
+ component: mi.labelIcon,
469
+ id: mi.portalId || index
470
+ });
471
+ });
472
+ const customMenuItemLabelIconsPortals = useCustomElementPortal(customMenuItemLabelIcons);
473
+ const customLinkLabelIconsPortals = useCustomElementPortal(customLinkLabelIcons);
474
+ validChildren.forEach((mi, index) => {
475
+ if (isReorderItem(mi, reorderItemsLabels)) customMenuItems.push({ label: mi.label });
476
+ if (isCustomMenuItem(mi)) {
477
+ const { portal: iconPortal, mount: mountIcon, unmount: unmountIcon } = customMenuItemLabelIconsPortals.find((p) => p.id === (mi.portalId || index));
478
+ const menuItem = {
479
+ label: mi.label,
480
+ mountIcon,
481
+ unmountIcon
482
+ };
483
+ if ("onClick" in mi) menuItem.onClick = mi.onClick;
484
+ else if ("open" in mi) menuItem.open = mi.open;
485
+ customMenuItems.push(menuItem);
486
+ customMenuItemsPortals.push({
487
+ key: `icon:${mi.portalId || index}`,
488
+ portal: iconPortal
489
+ });
490
+ }
491
+ if (isExternalLink(mi)) {
492
+ const { portal: iconPortal, mount: mountIcon, unmount: unmountIcon } = customLinkLabelIconsPortals.find((p) => p.id === (mi.portalId || index));
493
+ customMenuItems.push({
494
+ label: mi.label,
495
+ href: mi.href,
496
+ mountIcon,
497
+ unmountIcon
498
+ });
499
+ customMenuItemsPortals.push({
500
+ key: `icon:${mi.portalId || index}`,
501
+ portal: iconPortal
502
+ });
503
+ }
504
+ });
505
+ return {
506
+ customMenuItems,
507
+ customMenuItemsPortals
508
+ };
509
+ };
510
+ const getCustomMenuItemPortalId = (type, props, key, portalIdCounts) => {
511
+ if (key != null) return `${type}:key:${key}`;
512
+ const target = props.href || props.open || "";
513
+ const baseId = `${type}:${props.label}:${target}`;
514
+ const occurrence = portalIdCounts.get(baseId) ?? 0;
515
+ portalIdCounts.set(baseId, occurrence + 1);
516
+ return `${baseId}:${occurrence}`;
517
+ };
518
+ const isReorderItem = (childProps, validItems) => {
519
+ const { children, label, onClick, labelIcon } = childProps;
520
+ return !children && !onClick && !labelIcon && validItems.some((v) => v === label);
521
+ };
522
+ const isCustomMenuItem = (childProps) => {
523
+ const { label, labelIcon, onClick, open } = childProps;
524
+ return !!labelIcon && !!label && (typeof onClick === "function" || typeof open === "string");
525
+ };
526
+ const isExternalLink = (childProps) => {
527
+ const { label, href, labelIcon } = childProps;
528
+ return !!href && !!labelIcon && !!label;
529
+ };
530
+
531
+ //#endregion
532
+ //#region src/utils/useWaitForComponentMount.ts
533
+ const createAwaitableMutationObserver = (globalOptions) => {
534
+ const isReady = globalOptions?.isReady;
535
+ return (options) => new Promise((resolve, reject) => {
536
+ const { root = document?.body, selector, timeout = 0 } = options;
537
+ if (!root) {
538
+ reject(/* @__PURE__ */ new Error("No root element provided"));
539
+ return;
540
+ }
541
+ let elementToWatch = root;
542
+ if (selector) elementToWatch = root?.querySelector(selector);
543
+ if (isReady(elementToWatch, selector)) {
544
+ resolve();
545
+ return;
546
+ }
547
+ const observer = new MutationObserver((mutationsList) => {
548
+ for (const mutation of mutationsList) {
549
+ if (!elementToWatch && selector) elementToWatch = root?.querySelector(selector);
550
+ if (globalOptions.childList && mutation.type === "childList" || globalOptions.attributes && mutation.type === "attributes") {
551
+ if (isReady(elementToWatch, selector)) {
552
+ observer.disconnect();
553
+ resolve();
554
+ return;
555
+ }
556
+ }
557
+ }
558
+ });
559
+ observer.observe(root, globalOptions);
560
+ if (timeout > 0) setTimeout(() => {
561
+ observer.disconnect();
562
+ reject(/* @__PURE__ */ new Error(`Timeout waiting for ${selector}`));
563
+ }, timeout);
564
+ });
565
+ };
566
+ const waitForElementChildren = createAwaitableMutationObserver({
567
+ childList: true,
568
+ subtree: true,
569
+ isReady: (el, selector) => !!el?.childElementCount && el?.matches?.(selector) && el.childElementCount > 0
570
+ });
571
+ /**
572
+ * Detect when a Clerk component has mounted by watching DOM updates to an element with a `data-clerk-component="${component}"` property.
573
+ */
574
+ function useWaitForComponentMount(component, options) {
575
+ const watcherRef = (0, react.useRef)();
576
+ const [status, setStatus] = (0, react.useState)("rendering");
577
+ (0, react.useEffect)(() => {
578
+ if (!component) throw new Error("Clerk: no component name provided, unable to detect mount.");
579
+ if (typeof window !== "undefined" && !watcherRef.current) {
580
+ const defaultSelector = `[data-clerk-component="${component}"]`;
581
+ const selector = options?.selector;
582
+ watcherRef.current = waitForElementChildren({ selector: selector ? defaultSelector + selector : defaultSelector }).then(() => {
583
+ setStatus("rendered");
584
+ }).catch(() => {
585
+ setStatus("error");
586
+ });
587
+ }
588
+ }, [component, options?.selector]);
589
+ return status;
590
+ }
591
+
592
+ //#endregion
593
+ //#region src/components/ClerkHostRenderer.tsx
594
+ const isMountProps = (props) => {
595
+ return "mount" in props;
596
+ };
597
+ const isOpenProps = (props) => {
598
+ return "open" in props;
599
+ };
600
+ const stripMenuItemIconHandlers = (menuItems) => {
601
+ return menuItems?.map(({ mountIcon, unmountIcon, ...rest }) => rest);
602
+ };
603
+ /**
604
+ * Used to orchestrate mounting of Clerk components in a host React application.
605
+ * Components are rendered into a specific DOM node using mount/unmount methods provided by the Clerk class.
606
+ */
607
+ var ClerkHostRenderer = class extends react.default.PureComponent {
608
+ constructor(..._args) {
609
+ super(..._args);
610
+ this.rootRef = react.default.createRef();
611
+ }
612
+ componentDidUpdate(_prevProps) {
613
+ if (!isMountProps(_prevProps) || !isMountProps(this.props)) return;
614
+ const prevProps = (0, _clerk_shared_object.without)(_prevProps.props || {}, "customPages", "customMenuItems", "children");
615
+ const newProps = (0, _clerk_shared_object.without)(this.props.props || {}, "customPages", "customMenuItems", "children");
616
+ const customPagesChanged = _prevProps.props?.customPages?.length !== this.props.props?.customPages?.length;
617
+ const customMenuItemsChanged = _prevProps.props?.customMenuItems?.length !== this.props.props?.customMenuItems?.length;
618
+ const prevMenuItemsWithoutHandlers = stripMenuItemIconHandlers(_prevProps.props?.customMenuItems);
619
+ const newMenuItemsWithoutHandlers = stripMenuItemIconHandlers(this.props.props?.customMenuItems);
620
+ if (!(0, _clerk_shared_react.isDeeplyEqual)(prevProps, newProps) || !(0, _clerk_shared_react.isDeeplyEqual)(prevMenuItemsWithoutHandlers, newMenuItemsWithoutHandlers) || customPagesChanged || customMenuItemsChanged) {
621
+ if (this.rootRef.current) this.props.updateProps({
622
+ node: this.rootRef.current,
623
+ props: this.props.props
624
+ });
625
+ }
626
+ }
627
+ componentDidMount() {
628
+ if (this.rootRef.current) {
629
+ if (isMountProps(this.props)) this.props.mount(this.rootRef.current, this.props.props);
630
+ if (isOpenProps(this.props)) this.props.open(this.props.props);
631
+ }
632
+ }
633
+ componentWillUnmount() {
634
+ if (this.rootRef.current) {
635
+ if (isMountProps(this.props)) this.props.unmount(this.rootRef.current);
636
+ if (isOpenProps(this.props)) this.props.close();
637
+ }
638
+ }
639
+ render() {
640
+ const { hideRootHtmlElement = false } = this.props;
641
+ const rootAttributes = {
642
+ ref: this.rootRef,
643
+ ...this.props.rootProps,
644
+ ...this.props.component && { "data-clerk-component": this.props.component }
645
+ };
646
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, !hideRootHtmlElement && /* @__PURE__ */ react.default.createElement("div", rootAttributes), this.props.children);
647
+ }
648
+ };
649
+
650
+ //#endregion
651
+ //#region src/components/withClerk.tsx
652
+ const withClerk = (Component, displayNameOrOptions) => {
653
+ const displayName = (typeof displayNameOrOptions === "string" ? displayNameOrOptions : displayNameOrOptions?.component) || Component.displayName || Component.name || "Component";
654
+ Component.displayName = displayName;
655
+ const options = typeof displayNameOrOptions === "string" ? void 0 : displayNameOrOptions;
656
+ const HOC = (props) => {
657
+ require_useAssertWrappedByClerkProvider.useAssertWrappedByClerkProvider(displayName || "withClerk");
658
+ const clerk = require_useAssertWrappedByClerkProvider.useIsomorphicClerkContext();
659
+ const getContainer = (0, _clerk_shared_react.usePortalRoot)();
660
+ if (!clerk.loaded && !options?.renderWhileLoading) return null;
661
+ return /* @__PURE__ */ react.default.createElement(Component, {
662
+ getContainer,
663
+ ...props,
664
+ component: displayName,
665
+ clerk
666
+ });
667
+ };
668
+ HOC.displayName = `withClerk(${displayName})`;
669
+ return HOC;
670
+ };
671
+
672
+ //#endregion
673
+ //#region src/components/uiComponents.tsx
674
+ const CustomPortalsRenderer = (props) => {
675
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, props?.customPagesPortals?.map(({ key, portal }) => (0, react.createElement)(portal, { key })), props?.customMenuItemsPortals?.map(({ key, portal }) => (0, react.createElement)(portal, { key })));
676
+ };
677
+ const SignIn = withClerk(({ clerk, component, fallback, ...props }) => {
678
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
679
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
680
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
681
+ component,
682
+ mount: clerk.mountSignIn,
683
+ unmount: clerk.unmountSignIn,
684
+ updateProps: clerk.__internal_updateProps,
685
+ props,
686
+ rootProps: rendererRootProps
687
+ }));
688
+ }, {
689
+ component: "SignIn",
690
+ renderWhileLoading: true
691
+ });
692
+ const SignUp = withClerk(({ clerk, component, fallback, ...props }) => {
693
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
694
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
695
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
696
+ component,
697
+ mount: clerk.mountSignUp,
698
+ unmount: clerk.unmountSignUp,
699
+ updateProps: clerk.__internal_updateProps,
700
+ props,
701
+ rootProps: rendererRootProps
702
+ }));
703
+ }, {
704
+ component: "SignUp",
705
+ renderWhileLoading: true
706
+ });
707
+ function UserProfilePage({ children }) {
708
+ (0, _clerk_shared_utils.logErrorInDevMode)(userProfilePageRenderedError);
709
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, children);
710
+ }
711
+ function UserProfileLink({ children }) {
712
+ (0, _clerk_shared_utils.logErrorInDevMode)(userProfileLinkRenderedError);
713
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, children);
714
+ }
715
+ const _UserProfile = withClerk(({ clerk, component, fallback, ...props }) => {
716
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
717
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
718
+ const { customPages, customPagesPortals } = useUserProfileCustomPages(props.children);
719
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
720
+ component,
721
+ mount: clerk.mountUserProfile,
722
+ unmount: clerk.unmountUserProfile,
723
+ updateProps: clerk.__internal_updateProps,
724
+ props: {
725
+ ...props,
726
+ customPages
727
+ },
728
+ rootProps: rendererRootProps
729
+ }, /* @__PURE__ */ react.default.createElement(CustomPortalsRenderer, { customPagesPortals })));
730
+ }, {
731
+ component: "UserProfile",
732
+ renderWhileLoading: true
733
+ });
734
+ const UserProfile = Object.assign(_UserProfile, {
735
+ Page: UserProfilePage,
736
+ Link: UserProfileLink
737
+ });
738
+ const UserButtonContext = (0, react.createContext)({
739
+ mount: () => {},
740
+ unmount: () => {},
741
+ updateProps: () => {}
742
+ });
743
+ const _UserButton = withClerk(({ clerk, component, fallback, ...props }) => {
744
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
745
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
746
+ const { customPages, customPagesPortals } = useUserProfileCustomPages(props.children, { allowForAnyChildren: !!props.__experimental_asProvider });
747
+ const userProfileProps = {
748
+ ...props.userProfileProps,
749
+ customPages
750
+ };
751
+ const { customMenuItems, customMenuItemsPortals } = useUserButtonCustomMenuItems(props.children, { allowForAnyChildren: !!props.__experimental_asProvider });
752
+ const sanitizedChildren = useSanitizedChildren(props.children);
753
+ const passableProps = {
754
+ mount: clerk.mountUserButton,
755
+ unmount: clerk.unmountUserButton,
756
+ updateProps: clerk.__internal_updateProps,
757
+ props: {
758
+ ...props,
759
+ userProfileProps,
760
+ customMenuItems
761
+ }
762
+ };
763
+ const portalProps = {
764
+ customPagesPortals,
765
+ customMenuItemsPortals
766
+ };
767
+ return /* @__PURE__ */ react.default.createElement(UserButtonContext.Provider, { value: passableProps }, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
768
+ component,
769
+ ...passableProps,
770
+ hideRootHtmlElement: !!props.__experimental_asProvider,
771
+ rootProps: rendererRootProps
772
+ }, props.__experimental_asProvider ? sanitizedChildren : null, /* @__PURE__ */ react.default.createElement(CustomPortalsRenderer, portalProps)));
773
+ }, {
774
+ component: "UserButton",
775
+ renderWhileLoading: true
776
+ });
777
+ function MenuItems({ children }) {
778
+ (0, _clerk_shared_utils.logErrorInDevMode)(userButtonMenuItemsRenderedError);
779
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, children);
780
+ }
781
+ function MenuAction({ children }) {
782
+ (0, _clerk_shared_utils.logErrorInDevMode)(userButtonMenuActionRenderedError);
783
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, children);
784
+ }
785
+ function MenuLink({ children }) {
786
+ (0, _clerk_shared_utils.logErrorInDevMode)(userButtonMenuLinkRenderedError);
787
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, children);
788
+ }
789
+ function UserButtonOutlet(outletProps) {
790
+ const providerProps = (0, react.useContext)(UserButtonContext);
791
+ const portalProps = {
792
+ ...providerProps,
793
+ props: {
794
+ ...providerProps.props,
795
+ ...outletProps
796
+ }
797
+ };
798
+ return /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, portalProps);
799
+ }
800
+ const UserButton = Object.assign(_UserButton, {
801
+ UserProfilePage,
802
+ UserProfileLink,
803
+ MenuItems,
804
+ Action: MenuAction,
805
+ Link: MenuLink,
806
+ __experimental_Outlet: UserButtonOutlet
807
+ });
808
+ function OrganizationProfilePage({ children }) {
809
+ (0, _clerk_shared_utils.logErrorInDevMode)(organizationProfilePageRenderedError);
810
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, children);
811
+ }
812
+ function OrganizationProfileLink({ children }) {
813
+ (0, _clerk_shared_utils.logErrorInDevMode)(organizationProfileLinkRenderedError);
814
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, children);
815
+ }
816
+ const _OrganizationProfile = withClerk(({ clerk, component, fallback, ...props }) => {
817
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
818
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
819
+ const { customPages, customPagesPortals } = useOrganizationProfileCustomPages(props.children);
820
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
821
+ component,
822
+ mount: clerk.mountOrganizationProfile,
823
+ unmount: clerk.unmountOrganizationProfile,
824
+ updateProps: clerk.__internal_updateProps,
825
+ props: {
826
+ ...props,
827
+ customPages
828
+ },
829
+ rootProps: rendererRootProps
830
+ }, /* @__PURE__ */ react.default.createElement(CustomPortalsRenderer, { customPagesPortals })));
831
+ }, {
832
+ component: "OrganizationProfile",
833
+ renderWhileLoading: true
834
+ });
835
+ const OrganizationProfile = Object.assign(_OrganizationProfile, {
836
+ Page: OrganizationProfilePage,
837
+ Link: OrganizationProfileLink
838
+ });
839
+ const CreateOrganization = withClerk(({ clerk, component, fallback, ...props }) => {
840
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
841
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
842
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
843
+ component,
844
+ mount: clerk.mountCreateOrganization,
845
+ unmount: clerk.unmountCreateOrganization,
846
+ updateProps: clerk.__internal_updateProps,
847
+ props,
848
+ rootProps: rendererRootProps
849
+ }));
850
+ }, {
851
+ component: "CreateOrganization",
852
+ renderWhileLoading: true
853
+ });
854
+ const OrganizationSwitcherContext = (0, react.createContext)({
855
+ mount: () => {},
856
+ unmount: () => {},
857
+ updateProps: () => {}
858
+ });
859
+ const _OrganizationSwitcher = withClerk(({ clerk, component, fallback, ...props }) => {
860
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
861
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
862
+ const { customPages, customPagesPortals } = useOrganizationProfileCustomPages(props.children, { allowForAnyChildren: !!props.__experimental_asProvider });
863
+ const organizationProfileProps = {
864
+ ...props.organizationProfileProps,
865
+ customPages
866
+ };
867
+ const sanitizedChildren = useSanitizedChildren(props.children);
868
+ const passableProps = {
869
+ mount: clerk.mountOrganizationSwitcher,
870
+ unmount: clerk.unmountOrganizationSwitcher,
871
+ updateProps: clerk.__internal_updateProps,
872
+ props: {
873
+ ...props,
874
+ organizationProfileProps
875
+ },
876
+ rootProps: rendererRootProps,
877
+ component
878
+ };
879
+ /**
880
+ * Prefetch organization list
881
+ */
882
+ clerk.__experimental_prefetchOrganizationSwitcher();
883
+ return /* @__PURE__ */ react.default.createElement(OrganizationSwitcherContext.Provider, { value: passableProps }, /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
884
+ ...passableProps,
885
+ hideRootHtmlElement: !!props.__experimental_asProvider
886
+ }, props.__experimental_asProvider ? sanitizedChildren : null, /* @__PURE__ */ react.default.createElement(CustomPortalsRenderer, { customPagesPortals }))));
887
+ }, {
888
+ component: "OrganizationSwitcher",
889
+ renderWhileLoading: true
890
+ });
891
+ function OrganizationSwitcherOutlet(outletProps) {
892
+ const providerProps = (0, react.useContext)(OrganizationSwitcherContext);
893
+ const portalProps = {
894
+ ...providerProps,
895
+ props: {
896
+ ...providerProps.props,
897
+ ...outletProps
898
+ }
899
+ };
900
+ return /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, portalProps);
901
+ }
902
+ const OrganizationSwitcher = Object.assign(_OrganizationSwitcher, {
903
+ OrganizationProfilePage,
904
+ OrganizationProfileLink,
905
+ __experimental_Outlet: OrganizationSwitcherOutlet
906
+ });
907
+ const OrganizationList = withClerk(({ clerk, component, fallback, ...props }) => {
908
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
909
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
910
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
911
+ component,
912
+ mount: clerk.mountOrganizationList,
913
+ unmount: clerk.unmountOrganizationList,
914
+ updateProps: clerk.__internal_updateProps,
915
+ props,
916
+ rootProps: rendererRootProps
917
+ }));
918
+ }, {
919
+ component: "OrganizationList",
920
+ renderWhileLoading: true
921
+ });
922
+ const GoogleOneTap = withClerk(({ clerk, component, fallback, ...props }) => {
923
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
924
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
925
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
926
+ component,
927
+ open: clerk.openGoogleOneTap,
928
+ close: clerk.closeGoogleOneTap,
929
+ updateProps: clerk.__internal_updateProps,
930
+ props,
931
+ rootProps: rendererRootProps
932
+ }));
933
+ }, {
934
+ component: "GoogleOneTap",
935
+ renderWhileLoading: true
936
+ });
937
+ const Waitlist = withClerk(({ clerk, component, fallback, ...props }) => {
938
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
939
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
940
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
941
+ component,
942
+ mount: clerk.mountWaitlist,
943
+ unmount: clerk.unmountWaitlist,
944
+ updateProps: clerk.__internal_updateProps,
945
+ props,
946
+ rootProps: rendererRootProps
947
+ }));
948
+ }, {
949
+ component: "Waitlist",
950
+ renderWhileLoading: true
951
+ });
952
+ const PricingTable = withClerk(({ clerk, component, fallback, ...props }) => {
953
+ const shouldShowFallback = useWaitForComponentMount(component, { selector: "[data-component-status=\"ready\"]" }) === "rendering" || !clerk.loaded;
954
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
955
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
956
+ component,
957
+ mount: clerk.mountPricingTable,
958
+ unmount: clerk.unmountPricingTable,
959
+ updateProps: clerk.__internal_updateProps,
960
+ props,
961
+ rootProps: rendererRootProps
962
+ }));
963
+ }, {
964
+ component: "PricingTable",
965
+ renderWhileLoading: true
966
+ });
967
+ /**
968
+ * @experimental This component is in early access and may change in future releases.
969
+ */
970
+ const APIKeys = withClerk(({ clerk, component, fallback, ...props }) => {
971
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
972
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
973
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
974
+ component,
975
+ mount: clerk.mountAPIKeys,
976
+ unmount: clerk.unmountAPIKeys,
977
+ updateProps: clerk.__internal_updateProps,
978
+ props,
979
+ rootProps: rendererRootProps
980
+ }));
981
+ }, {
982
+ component: "ApiKeys",
983
+ renderWhileLoading: true
984
+ });
985
+ const OAuthConsent = withClerk(({ clerk, component, fallback, ...props }) => {
986
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
987
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
988
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
989
+ component,
990
+ mount: clerk.__internal_mountOAuthConsent,
991
+ unmount: clerk.__internal_unmountOAuthConsent,
992
+ updateProps: clerk.__internal_updateProps,
993
+ props,
994
+ rootProps: rendererRootProps
995
+ }));
996
+ }, {
997
+ component: "OAuthConsent",
998
+ renderWhileLoading: true
999
+ });
1000
+ const UserAvatar = withClerk(({ clerk, component, fallback, ...props }) => {
1001
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
1002
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
1003
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
1004
+ component,
1005
+ mount: clerk.mountUserAvatar,
1006
+ unmount: clerk.unmountUserAvatar,
1007
+ updateProps: clerk.__internal_updateProps,
1008
+ props,
1009
+ rootProps: rendererRootProps
1010
+ }));
1011
+ }, {
1012
+ component: "UserAvatar",
1013
+ renderWhileLoading: true
1014
+ });
1015
+ const TaskChooseOrganization = withClerk(({ clerk, component, fallback, ...props }) => {
1016
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
1017
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
1018
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
1019
+ component,
1020
+ mount: clerk.mountTaskChooseOrganization,
1021
+ unmount: clerk.unmountTaskChooseOrganization,
1022
+ updateProps: clerk.__internal_updateProps,
1023
+ props,
1024
+ rootProps: rendererRootProps
1025
+ }));
1026
+ }, {
1027
+ component: "TaskChooseOrganization",
1028
+ renderWhileLoading: true
1029
+ });
1030
+ const TaskResetPassword = withClerk(({ clerk, component, fallback, ...props }) => {
1031
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
1032
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
1033
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
1034
+ component,
1035
+ mount: clerk.mountTaskResetPassword,
1036
+ unmount: clerk.unmountTaskResetPassword,
1037
+ updateProps: clerk.__internal_updateProps,
1038
+ props,
1039
+ rootProps: rendererRootProps
1040
+ }));
1041
+ }, {
1042
+ component: "TaskResetPassword",
1043
+ renderWhileLoading: true
1044
+ });
1045
+ const TaskSetupMFA = withClerk(({ clerk, component, fallback, ...props }) => {
1046
+ const shouldShowFallback = useWaitForComponentMount(component) === "rendering" || !clerk.loaded;
1047
+ const rendererRootProps = { ...shouldShowFallback && fallback && { style: { display: "none" } } };
1048
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ react.default.createElement(ClerkHostRenderer, {
1049
+ component,
1050
+ mount: clerk.mountTaskSetupMFA,
1051
+ unmount: clerk.unmountTaskSetupMFA,
1052
+ updateProps: clerk.__internal_updateProps,
1053
+ props,
1054
+ rootProps: rendererRootProps
1055
+ }));
1056
+ }, {
1057
+ component: "TaskSetupMFA",
1058
+ renderWhileLoading: true
1059
+ });
1060
+
1061
+ //#endregion
1062
+ //#region src/hooks/useAuthBase.tsx
1063
+ const defaultDerivedInitialState = {
1064
+ actor: void 0,
1065
+ factorVerificationAge: null,
1066
+ orgId: void 0,
1067
+ orgPermissions: void 0,
1068
+ orgRole: void 0,
1069
+ orgSlug: void 0,
1070
+ sessionClaims: void 0,
1071
+ sessionId: void 0,
1072
+ sessionStatus: void 0,
1073
+ userId: void 0
1074
+ };
1075
+ function useAuthBase() {
1076
+ const clerk = (0, _clerk_shared_react.useClerkInstanceContext)();
1077
+ const initialState = (0, _clerk_shared_react.useInitialStateContext)();
1078
+ const getInitialState = (0, react.useCallback)(() => initialState, [initialState]);
1079
+ const state = (0, react.useSyncExternalStore)((0, react.useCallback)((callback) => clerk.addListener(callback, { skipInitialEmit: true }), [clerk]), (0, react.useCallback)(() => {
1080
+ if (!clerk.loaded || !clerk.__internal_lastEmittedResources) return getInitialState();
1081
+ return clerk.__internal_lastEmittedResources;
1082
+ }, [clerk, getInitialState]), getInitialState);
1083
+ return (0, react.useMemo)(() => {
1084
+ if (!state) return defaultDerivedInitialState;
1085
+ return authStateFromFull(isInitialState(state) ? (0, _clerk_shared_deriveState.deriveState)(false, {}, state) : (0, _clerk_shared_deriveState.deriveState)(true, state, void 0));
1086
+ }, [state]);
1087
+ }
1088
+ function authStateFromFull(derivedState) {
1089
+ return {
1090
+ sessionId: derivedState.sessionId,
1091
+ sessionStatus: derivedState.sessionStatus,
1092
+ sessionClaims: derivedState.sessionClaims,
1093
+ userId: derivedState.userId,
1094
+ actor: derivedState.actor,
1095
+ orgId: derivedState.orgId,
1096
+ orgRole: derivedState.orgRole,
1097
+ orgSlug: derivedState.orgSlug,
1098
+ orgPermissions: derivedState.orgPermissions,
1099
+ factorVerificationAge: derivedState.factorVerificationAge
1100
+ };
1101
+ }
1102
+ function isInitialState(state) {
1103
+ return !("client" in state);
1104
+ }
1105
+
1106
+ //#endregion
1107
+ //#region src/hooks/utils.ts
1108
+ /**
1109
+ * @internal
1110
+ */
1111
+ const clerkLoaded = (isomorphicClerk) => {
1112
+ return new Promise((resolve) => {
1113
+ const handler = (status) => {
1114
+ if (["ready", "degraded"].includes(status)) {
1115
+ resolve();
1116
+ isomorphicClerk.off("status", handler);
1117
+ }
1118
+ };
1119
+ isomorphicClerk.on("status", handler, { notify: true });
1120
+ });
1121
+ };
1122
+ /**
1123
+ * @internal
1124
+ */
1125
+ const createGetToken = (isomorphicClerk) => {
1126
+ return async (options) => {
1127
+ if (!(0, _clerk_shared_browser.inBrowser)()) throw new _clerk_shared_error.ClerkRuntimeError("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", { code: "clerk_runtime_not_browser" });
1128
+ await clerkLoaded(isomorphicClerk);
1129
+ if (!isomorphicClerk.session) return null;
1130
+ return isomorphicClerk.session.getToken(options);
1131
+ };
1132
+ };
1133
+ /**
1134
+ * @internal
1135
+ */
1136
+ const createSignOut = (isomorphicClerk) => {
1137
+ return async (...args) => {
1138
+ await clerkLoaded(isomorphicClerk);
1139
+ return isomorphicClerk.signOut(...args);
1140
+ };
1141
+ };
1142
+
1143
+ //#endregion
1144
+ //#region src/hooks/useAuth.ts
1145
+ /**
1146
+ * The `useAuth()` hook provides access to the current user's authentication state and methods to manage the active session.
1147
+ *
1148
+ * > [!NOTE]
1149
+ * > To access auth data server-side, see the [`Auth` object reference doc](https://clerk.com/docs/reference/backend/types/auth-object).
1150
+ *
1151
+ * <If sdk="nextjs">
1152
+ * By default, Next.js opts all routes into static rendering. If you need to opt a route or routes into dynamic rendering because you need to access the authentication data at request time, you can create a boundary by passing the `dynamic` prop to `<ClerkProvider>`. See the [guide on rendering modes](https://clerk.com/docs/guides/development/rendering-modes) for more information, including code examples.
1153
+ * </If>
1154
+ *
1155
+ * @unionReturnHeadings
1156
+ * ["Loading", "Signed out", "Signed in (no active organization)", "Signed in (with active organization)"]
1157
+ *
1158
+ * @param [options] - An object containing options for the `useAuth()` hook. `treatPendingAsSignedOut` indicates whether pending sessions are considered as signed out or not. Defaults to `true`.
1159
+ *
1160
+ * @function
1161
+ *
1162
+ * @example
1163
+ *
1164
+ * The following example demonstrates how to use the `useAuth()` hook to access the current auth state, like whether the user is signed in or not. It also includes a basic example for using the `getToken()` method to retrieve a session token for fetching data from an external resource.
1165
+ *
1166
+ * <Tabs items='React,Next.js'>
1167
+ * <Tab>
1168
+ *
1169
+ * ```tsx {{ filename: 'src/pages/ExternalDataPage.tsx' }}
1170
+ * import { useAuth } from '@clerk/react'
1171
+ *
1172
+ * export default function ExternalDataPage() {
1173
+ * const { userId, sessionId, getToken, isLoaded, isSignedIn } = useAuth()
1174
+ *
1175
+ * const fetchExternalData = async () => {
1176
+ * const token = await getToken()
1177
+ *
1178
+ * // Fetch data from an external API
1179
+ * const response = await fetch('https://api.example.com/data', {
1180
+ * headers: {
1181
+ * Authorization: `Bearer ${token}`,
1182
+ * },
1183
+ * })
1184
+ *
1185
+ * return response.json()
1186
+ * }
1187
+ *
1188
+ * if (!isLoaded) {
1189
+ * return <div>Loading...</div>
1190
+ * }
1191
+ *
1192
+ * if (!isSignedIn) {
1193
+ * return <div>Sign in to view this page</div>
1194
+ * }
1195
+ *
1196
+ * return (
1197
+ * <div>
1198
+ * <p>
1199
+ * Hello, {userId}! Your current active session is {sessionId}.
1200
+ * </p>
1201
+ * <button onClick={fetchExternalData}>Fetch Data</button>
1202
+ * </div>
1203
+ * )
1204
+ * }
1205
+ * ```
1206
+ *
1207
+ * </Tab>
1208
+ * <Tab>
1209
+ *
1210
+ * {@include ../../docs/use-auth.md#nextjs-01}
1211
+ *
1212
+ * </Tab>
1213
+ * </Tabs>
1214
+ */
1215
+ const useAuth = (options = {}) => {
1216
+ require_useAssertWrappedByClerkProvider.useAssertWrappedByClerkProvider("useAuth");
1217
+ const { treatPendingAsSignedOut } = options ?? {};
1218
+ const authState = useAuthBase();
1219
+ const isomorphicClerk = require_useAssertWrappedByClerkProvider.useIsomorphicClerkContext();
1220
+ const getToken = (0, react.useCallback)(createGetToken(isomorphicClerk), [isomorphicClerk]);
1221
+ const signOut = (0, react.useCallback)(createSignOut(isomorphicClerk), [isomorphicClerk]);
1222
+ isomorphicClerk.telemetry?.record((0, _clerk_shared_telemetry.eventMethodCalled)("useAuth", { treatPendingAsSignedOut }));
1223
+ return useDerivedAuth({
1224
+ ...authState,
1225
+ getToken,
1226
+ signOut
1227
+ }, { treatPendingAsSignedOut });
1228
+ };
1229
+ /**
1230
+ * A hook that derives and returns authentication state and utility functions based on the provided auth object.
1231
+ *
1232
+ * @param authObject - An object containing authentication-related properties and functions.
1233
+ *
1234
+ * @returns A derived authentication state with helper methods. If the authentication state is invalid, an error is thrown.
1235
+ *
1236
+ * @remarks
1237
+ * This hook inspects session, user, and organization information to determine the current authentication state.
1238
+ * It returns an object that includes various properties such as whether the state is loaded, if a user is signed in,
1239
+ * session and user identifiers, Organization Roles, and a `has` function for authorization checks.
1240
+ * Additionally, it provides `signOut` and `getToken` functions if applicable.
1241
+ *
1242
+ * @example
1243
+ * ```tsx
1244
+ * const {
1245
+ * isLoaded,
1246
+ * isSignedIn,
1247
+ * userId,
1248
+ * orgId,
1249
+ * has,
1250
+ * signOut,
1251
+ * getToken
1252
+ * } = useDerivedAuth(authObject);
1253
+ * ```
1254
+ */
1255
+ function useDerivedAuth(authObject, { treatPendingAsSignedOut = true } = {}) {
1256
+ const { userId, orgId, orgRole, has, signOut, getToken, orgPermissions, factorVerificationAge, sessionClaims } = authObject ?? {};
1257
+ const derivedHas = (0, react.useCallback)((params) => {
1258
+ if (has) return has(params);
1259
+ return (0, _clerk_shared_authorization.createCheckAuthorization)({
1260
+ userId,
1261
+ orgId,
1262
+ orgRole,
1263
+ orgPermissions,
1264
+ factorVerificationAge,
1265
+ features: sessionClaims?.fea || "",
1266
+ plans: sessionClaims?.pla || ""
1267
+ })(params);
1268
+ }, [
1269
+ has,
1270
+ userId,
1271
+ orgId,
1272
+ orgRole,
1273
+ orgPermissions,
1274
+ factorVerificationAge,
1275
+ sessionClaims
1276
+ ]);
1277
+ const payload = (0, _clerk_shared_authorization.resolveAuthState)({
1278
+ authObject: {
1279
+ ...authObject,
1280
+ getToken,
1281
+ signOut,
1282
+ has: derivedHas
1283
+ },
1284
+ options: { treatPendingAsSignedOut }
1285
+ });
1286
+ if (!payload) return require_useAssertWrappedByClerkProvider.errorThrower.throw(invalidStateError);
1287
+ return payload;
1288
+ }
1289
+
1290
+ //#endregion
1291
+ //#region src/hooks/useEmailLink.ts
1292
+ function useEmailLink(resource) {
1293
+ const { startEmailLinkFlow, cancelEmailLinkFlow } = react.default.useMemo(() => resource.createEmailLinkFlow(), [resource]);
1294
+ react.default.useEffect(() => {
1295
+ return cancelEmailLinkFlow;
1296
+ }, []);
1297
+ return {
1298
+ startEmailLinkFlow,
1299
+ cancelEmailLinkFlow
1300
+ };
1301
+ }
1302
+
1303
+ //#endregion
1304
+ //#region src/hooks/useClerkSignal.ts
1305
+ function useClerkSignal(signal) {
1306
+ require_useAssertWrappedByClerkProvider.useAssertWrappedByClerkProvider("useClerkSignal");
1307
+ const clerk = require_useAssertWrappedByClerkProvider.useIsomorphicClerkContext();
1308
+ switch (signal) {
1309
+ case "signIn":
1310
+ clerk.telemetry?.record((0, _clerk_shared_telemetry.eventMethodCalled)("useSignIn", { apiVersion: "2025-11" }));
1311
+ break;
1312
+ case "signUp":
1313
+ clerk.telemetry?.record((0, _clerk_shared_telemetry.eventMethodCalled)("useSignUp", { apiVersion: "2025-11" }));
1314
+ break;
1315
+ case "waitlist":
1316
+ clerk.telemetry?.record((0, _clerk_shared_telemetry.eventMethodCalled)("useWaitlist", { apiVersion: "2025-11" }));
1317
+ break;
1318
+ default: break;
1319
+ }
1320
+ const subscribe = (0, react.useCallback)((callback) => {
1321
+ if (!clerk.loaded) return () => {};
1322
+ return clerk.__internal_state.__internal_effect(() => {
1323
+ switch (signal) {
1324
+ case "signIn":
1325
+ clerk.__internal_state.signInSignal();
1326
+ break;
1327
+ case "signUp":
1328
+ clerk.__internal_state.signUpSignal();
1329
+ break;
1330
+ case "waitlist":
1331
+ clerk.__internal_state.waitlistSignal();
1332
+ break;
1333
+ default: throw new Error(`Unknown signal: ${signal}`);
1334
+ }
1335
+ callback();
1336
+ });
1337
+ }, [
1338
+ clerk,
1339
+ clerk.loaded,
1340
+ clerk.__internal_state
1341
+ ]);
1342
+ const getSnapshot = (0, react.useCallback)(() => {
1343
+ switch (signal) {
1344
+ case "signIn": return clerk.__internal_state.signInSignal();
1345
+ case "signUp": return clerk.__internal_state.signUpSignal();
1346
+ case "waitlist": return clerk.__internal_state.waitlistSignal();
1347
+ default: throw new Error(`Unknown signal: ${signal}`);
1348
+ }
1349
+ }, [clerk.__internal_state]);
1350
+ return (0, react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
1351
+ }
1352
+ /**
1353
+ * This hook allows you to access the Signal-based `SignIn` resource.
1354
+ *
1355
+ * @example
1356
+ * import { useSignIn } from "@clerk/react";
1357
+ *
1358
+ * function SignInForm() {
1359
+ * const { signIn, errors, fetchStatus } = useSignIn();
1360
+ * //
1361
+ * }
1362
+ */
1363
+ const useSignIn = () => {
1364
+ return useClerkSignal("signIn");
1365
+ };
1366
+ /**
1367
+ * This hook allows you to access the Signal-based `SignUp` resource.
1368
+ *
1369
+ * @example
1370
+ * import { useSignUp } from "@clerk/react";
1371
+ *
1372
+ * function SignUpForm() {
1373
+ * const { signUp, errors, fetchStatus } = useSignUp();
1374
+ * //
1375
+ * }
1376
+ */
1377
+ const useSignUp = () => {
1378
+ return useClerkSignal("signUp");
1379
+ };
1380
+ /**
1381
+ * This hook allows you to access the Signal-based `Waitlist` resource.
1382
+ *
1383
+ * @example
1384
+ * import { useWaitlist } from "@clerk/react";
1385
+ *
1386
+ * function WaitlistForm() {
1387
+ * const { waitlist, errors, fetchStatus } = useWaitlist();
1388
+ * //
1389
+ * }
1390
+ */
1391
+ function useWaitlist() {
1392
+ return useClerkSignal("waitlist");
1393
+ }
1394
+
1395
+ //#endregion
1396
+ Object.defineProperty(exports, 'APIKeys', {
1397
+ enumerable: true,
1398
+ get: function () {
1399
+ return APIKeys;
1400
+ }
1401
+ });
1402
+ Object.defineProperty(exports, 'CreateOrganization', {
1403
+ enumerable: true,
1404
+ get: function () {
1405
+ return CreateOrganization;
1406
+ }
1407
+ });
1408
+ Object.defineProperty(exports, 'GoogleOneTap', {
1409
+ enumerable: true,
1410
+ get: function () {
1411
+ return GoogleOneTap;
1412
+ }
1413
+ });
1414
+ Object.defineProperty(exports, 'OAuthConsent', {
1415
+ enumerable: true,
1416
+ get: function () {
1417
+ return OAuthConsent;
1418
+ }
1419
+ });
1420
+ Object.defineProperty(exports, 'OrganizationList', {
1421
+ enumerable: true,
1422
+ get: function () {
1423
+ return OrganizationList;
1424
+ }
1425
+ });
1426
+ Object.defineProperty(exports, 'OrganizationProfile', {
1427
+ enumerable: true,
1428
+ get: function () {
1429
+ return OrganizationProfile;
1430
+ }
1431
+ });
1432
+ Object.defineProperty(exports, 'OrganizationSwitcher', {
1433
+ enumerable: true,
1434
+ get: function () {
1435
+ return OrganizationSwitcher;
1436
+ }
1437
+ });
1438
+ Object.defineProperty(exports, 'PricingTable', {
1439
+ enumerable: true,
1440
+ get: function () {
1441
+ return PricingTable;
1442
+ }
1443
+ });
1444
+ Object.defineProperty(exports, 'SignIn', {
1445
+ enumerable: true,
1446
+ get: function () {
1447
+ return SignIn;
1448
+ }
1449
+ });
1450
+ Object.defineProperty(exports, 'SignUp', {
1451
+ enumerable: true,
1452
+ get: function () {
1453
+ return SignUp;
1454
+ }
1455
+ });
1456
+ Object.defineProperty(exports, 'TaskChooseOrganization', {
1457
+ enumerable: true,
1458
+ get: function () {
1459
+ return TaskChooseOrganization;
1460
+ }
1461
+ });
1462
+ Object.defineProperty(exports, 'TaskResetPassword', {
1463
+ enumerable: true,
1464
+ get: function () {
1465
+ return TaskResetPassword;
1466
+ }
1467
+ });
1468
+ Object.defineProperty(exports, 'TaskSetupMFA', {
1469
+ enumerable: true,
1470
+ get: function () {
1471
+ return TaskSetupMFA;
1472
+ }
1473
+ });
1474
+ Object.defineProperty(exports, 'UserAvatar', {
1475
+ enumerable: true,
1476
+ get: function () {
1477
+ return UserAvatar;
1478
+ }
1479
+ });
1480
+ Object.defineProperty(exports, 'UserButton', {
1481
+ enumerable: true,
1482
+ get: function () {
1483
+ return UserButton;
1484
+ }
1485
+ });
1486
+ Object.defineProperty(exports, 'UserProfile', {
1487
+ enumerable: true,
1488
+ get: function () {
1489
+ return UserProfile;
1490
+ }
1491
+ });
1492
+ Object.defineProperty(exports, 'Waitlist', {
1493
+ enumerable: true,
1494
+ get: function () {
1495
+ return Waitlist;
1496
+ }
1497
+ });
1498
+ Object.defineProperty(exports, '__toESM', {
1499
+ enumerable: true,
1500
+ get: function () {
1501
+ return __toESM;
1502
+ }
1503
+ });
1504
+ Object.defineProperty(exports, 'assertSingleChild', {
1505
+ enumerable: true,
1506
+ get: function () {
1507
+ return assertSingleChild;
1508
+ }
1509
+ });
1510
+ Object.defineProperty(exports, 'incompatibleRoutingWithPathProvidedError', {
1511
+ enumerable: true,
1512
+ get: function () {
1513
+ return incompatibleRoutingWithPathProvidedError;
1514
+ }
1515
+ });
1516
+ Object.defineProperty(exports, 'isConstructor', {
1517
+ enumerable: true,
1518
+ get: function () {
1519
+ return isConstructor;
1520
+ }
1521
+ });
1522
+ Object.defineProperty(exports, 'mergeWithEnv', {
1523
+ enumerable: true,
1524
+ get: function () {
1525
+ return mergeWithEnv;
1526
+ }
1527
+ });
1528
+ Object.defineProperty(exports, 'multipleClerkProvidersError', {
1529
+ enumerable: true,
1530
+ get: function () {
1531
+ return multipleClerkProvidersError;
1532
+ }
1533
+ });
1534
+ Object.defineProperty(exports, 'noPathProvidedError', {
1535
+ enumerable: true,
1536
+ get: function () {
1537
+ return noPathProvidedError;
1538
+ }
1539
+ });
1540
+ Object.defineProperty(exports, 'normalizeWithDefaultValue', {
1541
+ enumerable: true,
1542
+ get: function () {
1543
+ return normalizeWithDefaultValue;
1544
+ }
1545
+ });
1546
+ Object.defineProperty(exports, 'safeExecute', {
1547
+ enumerable: true,
1548
+ get: function () {
1549
+ return safeExecute;
1550
+ }
1551
+ });
1552
+ Object.defineProperty(exports, 'unsupportedNonBrowserDomainOrProxyUrlFunction', {
1553
+ enumerable: true,
1554
+ get: function () {
1555
+ return unsupportedNonBrowserDomainOrProxyUrlFunction;
1556
+ }
1557
+ });
1558
+ Object.defineProperty(exports, 'useAuth', {
1559
+ enumerable: true,
1560
+ get: function () {
1561
+ return useAuth;
1562
+ }
1563
+ });
1564
+ Object.defineProperty(exports, 'useDerivedAuth', {
1565
+ enumerable: true,
1566
+ get: function () {
1567
+ return useDerivedAuth;
1568
+ }
1569
+ });
1570
+ Object.defineProperty(exports, 'useEmailLink', {
1571
+ enumerable: true,
1572
+ get: function () {
1573
+ return useEmailLink;
1574
+ }
1575
+ });
1576
+ Object.defineProperty(exports, 'useSignIn', {
1577
+ enumerable: true,
1578
+ get: function () {
1579
+ return useSignIn;
1580
+ }
1581
+ });
1582
+ Object.defineProperty(exports, 'useSignUp', {
1583
+ enumerable: true,
1584
+ get: function () {
1585
+ return useSignUp;
1586
+ }
1587
+ });
1588
+ Object.defineProperty(exports, 'useWaitlist', {
1589
+ enumerable: true,
1590
+ get: function () {
1591
+ return useWaitlist;
1592
+ }
1593
+ });
1594
+ Object.defineProperty(exports, 'withClerk', {
1595
+ enumerable: true,
1596
+ get: function () {
1597
+ return withClerk;
1598
+ }
1599
+ });
1600
+ Object.defineProperty(exports, 'withMaxAllowedInstancesGuard', {
1601
+ enumerable: true,
1602
+ get: function () {
1603
+ return withMaxAllowedInstancesGuard;
1604
+ }
1605
+ });
1606
+ //# sourceMappingURL=hooks-CBghYU21.cjs.map