@clerk/react 6.8.0-snapshot.v20260604052353 → 6.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3ME65G46.mjs → chunk-FQVXBXXF.mjs} +109 -66
- package/dist/chunk-FQVXBXXF.mjs.map +1 -0
- package/dist/{chunk-DAD5TWXQ.mjs → chunk-RRVXNJ3Z.mjs} +21 -30
- package/dist/chunk-RRVXNJ3Z.mjs.map +1 -0
- package/dist/experimental.js +105 -61
- package/dist/experimental.js.map +1 -1
- package/dist/experimental.mjs +1 -1
- package/dist/index.d.mts +2 -6
- package/dist/index.d.ts +2 -6
- package/dist/index.js +124 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal.js +124 -89
- package/dist/internal.js.map +1 -1
- package/dist/internal.mjs +2 -2
- package/package.json +4 -4
- package/dist/chunk-3ME65G46.mjs.map +0 -1
- package/dist/chunk-DAD5TWXQ.mjs.map +0 -1
package/dist/experimental.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Theme, Ui } from '@clerk/ui/internal';
|
|
2
2
|
import * as _clerk_shared_types from '@clerk/shared/types';
|
|
3
|
-
import { Without, APIKeysProps,
|
|
3
|
+
import { Without, APIKeysProps, CreateOrganizationProps, OrganizationListProps, OrganizationProfileProps, OrganizationSwitcherProps, SignInProps, SignUpProps, TaskChooseOrganizationProps, TaskResetPasswordProps, TaskSetupMFAProps, UserAvatarProps, UserButtonProps, UserProfileProps, WaitlistProps, SignInButtonProps, SignOutOptions, SignUpButtonProps, SetActiveNavigate, SignInResource, CreateEmailLinkFlowReturn, SignInStartEmailLinkFlowParams, SignUpResource, StartEmailLinkFlowParams, EmailAddressResource, SignInSignalValue, SignUpSignalValue, WaitlistSignalValue } from '@clerk/shared/types';
|
|
4
4
|
export { BrowserClerk, BrowserClerkConstructor, ClerkProp, HeadlessBrowserClerk, HeadlessBrowserClerkConstructor, IsomorphicClerkOptions } from '@clerk/shared/types';
|
|
5
5
|
import React, { ReactNode, PropsWithChildren } from 'react';
|
|
6
6
|
import { WithClerkProp, OrganizationProfilePageProps, OrganizationProfileLinkProps, UserProfilePageProps, UserProfileLinkProps, UserButtonActionProps, UserButtonLinkProps, SignInWithMetamaskButtonProps, ClerkProviderProps } from './types.mjs';
|
|
@@ -156,10 +156,6 @@ declare const APIKeys: {
|
|
|
156
156
|
(props: Without<WithClerkProp<APIKeysProps & FallbackProp>, "clerk">): React.JSX.Element | null;
|
|
157
157
|
displayName: string;
|
|
158
158
|
};
|
|
159
|
-
declare const ConfigureSSO: {
|
|
160
|
-
(props: Without<WithClerkProp<ConfigureSSOProps & FallbackProp>, "clerk">): React.JSX.Element | null;
|
|
161
|
-
displayName: string;
|
|
162
|
-
};
|
|
163
159
|
declare const OAuthConsent: {
|
|
164
160
|
(props: Without<WithClerkProp<_clerk_shared_types.OAuthConsentProps & FallbackProp>, "clerk">): React.JSX.Element | null;
|
|
165
161
|
displayName: string;
|
|
@@ -320,4 +316,4 @@ declare const useSignUp: () => SignUpSignalValue;
|
|
|
320
316
|
*/
|
|
321
317
|
declare function useWaitlist(): WaitlistSignalValue;
|
|
322
318
|
|
|
323
|
-
export { APIKeys, ClerkProvider, ClerkProviderProps,
|
|
319
|
+
export { APIKeys, ClerkProvider, ClerkProviderProps, CreateOrganization, GoogleOneTap, HandleSSOCallback, OAuthConsent, OrganizationList, OrganizationProfile, OrganizationSwitcher, PricingTable, SignIn, SignInButton, SignInWithMetamaskButton, SignOutButton, SignUp, SignUpButton, TaskChooseOrganization, TaskResetPassword, TaskSetupMFA, UserAvatar, UserButton, UserProfile, Waitlist, useEmailLink, useSignIn, useSignUp, useWaitlist };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Theme, Ui } from '@clerk/ui/internal';
|
|
2
2
|
import * as _clerk_shared_types from '@clerk/shared/types';
|
|
3
|
-
import { Without, APIKeysProps,
|
|
3
|
+
import { Without, APIKeysProps, CreateOrganizationProps, OrganizationListProps, OrganizationProfileProps, OrganizationSwitcherProps, SignInProps, SignUpProps, TaskChooseOrganizationProps, TaskResetPasswordProps, TaskSetupMFAProps, UserAvatarProps, UserButtonProps, UserProfileProps, WaitlistProps, SignInButtonProps, SignOutOptions, SignUpButtonProps, SetActiveNavigate, SignInResource, CreateEmailLinkFlowReturn, SignInStartEmailLinkFlowParams, SignUpResource, StartEmailLinkFlowParams, EmailAddressResource, SignInSignalValue, SignUpSignalValue, WaitlistSignalValue } from '@clerk/shared/types';
|
|
4
4
|
export { BrowserClerk, BrowserClerkConstructor, ClerkProp, HeadlessBrowserClerk, HeadlessBrowserClerkConstructor, IsomorphicClerkOptions } from '@clerk/shared/types';
|
|
5
5
|
import React, { ReactNode, PropsWithChildren } from 'react';
|
|
6
6
|
import { WithClerkProp, OrganizationProfilePageProps, OrganizationProfileLinkProps, UserProfilePageProps, UserProfileLinkProps, UserButtonActionProps, UserButtonLinkProps, SignInWithMetamaskButtonProps, ClerkProviderProps } from './types.js';
|
|
@@ -156,10 +156,6 @@ declare const APIKeys: {
|
|
|
156
156
|
(props: Without<WithClerkProp<APIKeysProps & FallbackProp>, "clerk">): React.JSX.Element | null;
|
|
157
157
|
displayName: string;
|
|
158
158
|
};
|
|
159
|
-
declare const ConfigureSSO: {
|
|
160
|
-
(props: Without<WithClerkProp<ConfigureSSOProps & FallbackProp>, "clerk">): React.JSX.Element | null;
|
|
161
|
-
displayName: string;
|
|
162
|
-
};
|
|
163
159
|
declare const OAuthConsent: {
|
|
164
160
|
(props: Without<WithClerkProp<_clerk_shared_types.OAuthConsentProps & FallbackProp>, "clerk">): React.JSX.Element | null;
|
|
165
161
|
displayName: string;
|
|
@@ -320,4 +316,4 @@ declare const useSignUp: () => SignUpSignalValue;
|
|
|
320
316
|
*/
|
|
321
317
|
declare function useWaitlist(): WaitlistSignalValue;
|
|
322
318
|
|
|
323
|
-
export { APIKeys, ClerkProvider, ClerkProviderProps,
|
|
319
|
+
export { APIKeys, ClerkProvider, ClerkProviderProps, CreateOrganization, GoogleOneTap, HandleSSOCallback, OAuthConsent, OrganizationList, OrganizationProfile, OrganizationSwitcher, PricingTable, SignIn, SignInButton, SignInWithMetamaskButton, SignOutButton, SignUp, SignUpButton, TaskChooseOrganization, TaskResetPassword, TaskSetupMFA, UserAvatar, UserButton, UserProfile, Waitlist, useEmailLink, useSignIn, useSignUp, useWaitlist };
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,6 @@ __export(src_exports, {
|
|
|
45
45
|
ClerkLoaded: () => ClerkLoaded,
|
|
46
46
|
ClerkLoading: () => ClerkLoading,
|
|
47
47
|
ClerkProvider: () => ClerkProvider,
|
|
48
|
-
ConfigureSSO: () => ConfigureSSO,
|
|
49
48
|
CreateOrganization: () => CreateOrganization,
|
|
50
49
|
GoogleOneTap: () => GoogleOneTap,
|
|
51
50
|
HandleSSOCallback: () => HandleSSOCallback,
|
|
@@ -246,19 +245,41 @@ var import_react3 = require("react");
|
|
|
246
245
|
var import_react_dom = require("react-dom");
|
|
247
246
|
var useCustomElementPortal = (elements) => {
|
|
248
247
|
const [nodeMap, setNodeMap] = (0, import_react3.useState)(/* @__PURE__ */ new Map());
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
const node = nodeMap.get(String(el.id));
|
|
259
|
-
return node ? (0, import_react_dom.createPortal)(el.component, node) : null;
|
|
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);
|
|
260
257
|
}
|
|
261
|
-
})
|
|
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
|
+
});
|
|
262
283
|
};
|
|
263
284
|
|
|
264
285
|
// src/utils/useCustomPages.tsx
|
|
@@ -319,6 +340,7 @@ var useCustomPages = (params, options) => {
|
|
|
319
340
|
const { children, LinkComponent, PageComponent, MenuItemsComponent, reorderItemsLabels, componentName } = params;
|
|
320
341
|
const { allowForAnyChildren = false } = options || {};
|
|
321
342
|
const validChildren = [];
|
|
343
|
+
const portalIdCounts = /* @__PURE__ */ new Map();
|
|
322
344
|
import_react5.default.Children.forEach(children, (child) => {
|
|
323
345
|
if (!isThatComponent(child, PageComponent) && !isThatComponent(child, LinkComponent) && !isThatComponent(child, MenuItemsComponent)) {
|
|
324
346
|
if (child && !allowForAnyChildren) {
|
|
@@ -328,11 +350,18 @@ var useCustomPages = (params, options) => {
|
|
|
328
350
|
}
|
|
329
351
|
const { props } = child;
|
|
330
352
|
const { children: children2, label, url, labelIcon } = props;
|
|
353
|
+
const childKey = child.key;
|
|
331
354
|
if (isThatComponent(child, PageComponent)) {
|
|
332
355
|
if (isReorderItem(props, reorderItemsLabels)) {
|
|
333
356
|
validChildren.push({ label });
|
|
334
357
|
} else if (isCustomPage(props)) {
|
|
335
|
-
validChildren.push({
|
|
358
|
+
validChildren.push({
|
|
359
|
+
label,
|
|
360
|
+
labelIcon,
|
|
361
|
+
children: children2,
|
|
362
|
+
url,
|
|
363
|
+
portalId: getCustomPagePortalId("page", props, childKey, portalIdCounts)
|
|
364
|
+
});
|
|
336
365
|
} else {
|
|
337
366
|
(0, import_utils.logErrorInDevMode)(customPageWrongProps(componentName));
|
|
338
367
|
return;
|
|
@@ -340,7 +369,12 @@ var useCustomPages = (params, options) => {
|
|
|
340
369
|
}
|
|
341
370
|
if (isThatComponent(child, LinkComponent)) {
|
|
342
371
|
if (isExternalLink(props)) {
|
|
343
|
-
validChildren.push({
|
|
372
|
+
validChildren.push({
|
|
373
|
+
label,
|
|
374
|
+
labelIcon,
|
|
375
|
+
url,
|
|
376
|
+
portalId: getCustomPagePortalId("link", props, childKey, portalIdCounts)
|
|
377
|
+
});
|
|
344
378
|
} else {
|
|
345
379
|
(0, import_utils.logErrorInDevMode)(customLinkWrongProps(componentName));
|
|
346
380
|
return;
|
|
@@ -352,12 +386,12 @@ var useCustomPages = (params, options) => {
|
|
|
352
386
|
const customLinkLabelIcons = [];
|
|
353
387
|
validChildren.forEach((cp, index) => {
|
|
354
388
|
if (isCustomPage(cp)) {
|
|
355
|
-
customPageContents.push({ component: cp.children, id: index });
|
|
356
|
-
customPageLabelIcons.push({ component: cp.labelIcon, id: index });
|
|
389
|
+
customPageContents.push({ component: cp.children, id: cp.portalId || index });
|
|
390
|
+
customPageLabelIcons.push({ component: cp.labelIcon, id: cp.portalId || index });
|
|
357
391
|
return;
|
|
358
392
|
}
|
|
359
393
|
if (isExternalLink(cp)) {
|
|
360
|
-
customLinkLabelIcons.push({ component: cp.labelIcon, id: index });
|
|
394
|
+
customLinkLabelIcons.push({ component: cp.labelIcon, id: cp.portalId || index });
|
|
361
395
|
}
|
|
362
396
|
});
|
|
363
397
|
const customPageContentsPortals = useCustomElementPortal(customPageContents);
|
|
@@ -375,15 +409,15 @@ var useCustomPages = (params, options) => {
|
|
|
375
409
|
portal: contentPortal,
|
|
376
410
|
mount,
|
|
377
411
|
unmount
|
|
378
|
-
} = customPageContentsPortals.find((p) => p.id === index);
|
|
412
|
+
} = customPageContentsPortals.find((p) => p.id === (cp.portalId || index));
|
|
379
413
|
const {
|
|
380
414
|
portal: labelPortal,
|
|
381
415
|
mount: mountIcon,
|
|
382
416
|
unmount: unmountIcon
|
|
383
|
-
} = customPageLabelIconsPortals.find((p) => p.id === index);
|
|
417
|
+
} = customPageLabelIconsPortals.find((p) => p.id === (cp.portalId || index));
|
|
384
418
|
customPages.push({ label: cp.label, url: cp.url, mount, unmount, mountIcon, unmountIcon });
|
|
385
|
-
customPagesPortals.push(contentPortal);
|
|
386
|
-
customPagesPortals.push(labelPortal);
|
|
419
|
+
customPagesPortals.push({ key: `content:${cp.portalId || index}`, portal: contentPortal });
|
|
420
|
+
customPagesPortals.push({ key: `label:${cp.portalId || index}`, portal: labelPortal });
|
|
387
421
|
return;
|
|
388
422
|
}
|
|
389
423
|
if (isExternalLink(cp)) {
|
|
@@ -391,14 +425,24 @@ var useCustomPages = (params, options) => {
|
|
|
391
425
|
portal: labelPortal,
|
|
392
426
|
mount: mountIcon,
|
|
393
427
|
unmount: unmountIcon
|
|
394
|
-
} = customLinkLabelIconsPortals.find((p) => p.id === index);
|
|
428
|
+
} = customLinkLabelIconsPortals.find((p) => p.id === (cp.portalId || index));
|
|
395
429
|
customPages.push({ label: cp.label, url: cp.url, mountIcon, unmountIcon });
|
|
396
|
-
customPagesPortals.push(labelPortal);
|
|
430
|
+
customPagesPortals.push({ key: `label:${cp.portalId || index}`, portal: labelPortal });
|
|
397
431
|
return;
|
|
398
432
|
}
|
|
399
433
|
});
|
|
400
434
|
return { customPages, customPagesPortals };
|
|
401
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
|
+
};
|
|
402
446
|
var isReorderItem = (childProps, validItems) => {
|
|
403
447
|
const { children, label, url, labelIcon } = childProps;
|
|
404
448
|
return !children && !url && !labelIcon && validItems.some((v) => v === label);
|
|
@@ -442,6 +486,7 @@ var useCustomMenuItems = ({
|
|
|
442
486
|
const validChildren = [];
|
|
443
487
|
const customMenuItems = [];
|
|
444
488
|
const customMenuItemsPortals = [];
|
|
489
|
+
const portalIdCounts = /* @__PURE__ */ new Map();
|
|
445
490
|
import_react6.default.Children.forEach(children, (child) => {
|
|
446
491
|
if (!isThatComponent(child, MenuItemsComponent) && !isThatComponent(child, UserProfileLinkComponent) && !isThatComponent(child, UserProfilePageComponent)) {
|
|
447
492
|
if (child && !allowForAnyChildren) {
|
|
@@ -461,6 +506,7 @@ var useCustomMenuItems = ({
|
|
|
461
506
|
return;
|
|
462
507
|
}
|
|
463
508
|
const { props: props2 } = child2;
|
|
509
|
+
const childKey = child2.key;
|
|
464
510
|
const { label, labelIcon, href, onClick, open } = props2;
|
|
465
511
|
if (isThatComponent(child2, MenuActionComponent)) {
|
|
466
512
|
if (isReorderItem2(props2, reorderItemsLabels)) {
|
|
@@ -473,12 +519,14 @@ var useCustomMenuItems = ({
|
|
|
473
519
|
if (onClick !== void 0) {
|
|
474
520
|
validChildren.push({
|
|
475
521
|
...baseItem,
|
|
476
|
-
onClick
|
|
522
|
+
onClick,
|
|
523
|
+
portalId: getCustomMenuItemPortalId("action", props2, childKey, portalIdCounts)
|
|
477
524
|
});
|
|
478
525
|
} else if (open !== void 0) {
|
|
479
526
|
validChildren.push({
|
|
480
527
|
...baseItem,
|
|
481
|
-
open: open.startsWith("/") ? open : `/${open}
|
|
528
|
+
open: open.startsWith("/") ? open : `/${open}`,
|
|
529
|
+
portalId: getCustomMenuItemPortalId("action", props2, childKey, portalIdCounts)
|
|
482
530
|
});
|
|
483
531
|
} else {
|
|
484
532
|
(0, import_utils2.logErrorInDevMode)("Custom menu item must have either onClick or open property");
|
|
@@ -491,7 +539,12 @@ var useCustomMenuItems = ({
|
|
|
491
539
|
}
|
|
492
540
|
if (isThatComponent(child2, MenuLinkComponent)) {
|
|
493
541
|
if (isExternalLink2(props2)) {
|
|
494
|
-
validChildren.push({
|
|
542
|
+
validChildren.push({
|
|
543
|
+
label,
|
|
544
|
+
labelIcon,
|
|
545
|
+
href,
|
|
546
|
+
portalId: getCustomMenuItemPortalId("link", props2, childKey, portalIdCounts)
|
|
547
|
+
});
|
|
495
548
|
} else {
|
|
496
549
|
(0, import_utils2.logErrorInDevMode)(userButtonMenuItemLinkWrongProps);
|
|
497
550
|
return;
|
|
@@ -503,10 +556,10 @@ var useCustomMenuItems = ({
|
|
|
503
556
|
const customLinkLabelIcons = [];
|
|
504
557
|
validChildren.forEach((mi, index) => {
|
|
505
558
|
if (isCustomMenuItem(mi)) {
|
|
506
|
-
customMenuItemLabelIcons.push({ component: mi.labelIcon, id: index });
|
|
559
|
+
customMenuItemLabelIcons.push({ component: mi.labelIcon, id: mi.portalId || index });
|
|
507
560
|
}
|
|
508
561
|
if (isExternalLink2(mi)) {
|
|
509
|
-
customLinkLabelIcons.push({ component: mi.labelIcon, id: index });
|
|
562
|
+
customLinkLabelIcons.push({ component: mi.labelIcon, id: mi.portalId || index });
|
|
510
563
|
}
|
|
511
564
|
});
|
|
512
565
|
const customMenuItemLabelIconsPortals = useCustomElementPortal(customMenuItemLabelIcons);
|
|
@@ -522,7 +575,7 @@ var useCustomMenuItems = ({
|
|
|
522
575
|
portal: iconPortal,
|
|
523
576
|
mount: mountIcon,
|
|
524
577
|
unmount: unmountIcon
|
|
525
|
-
} = customMenuItemLabelIconsPortals.find((p) => p.id === index);
|
|
578
|
+
} = customMenuItemLabelIconsPortals.find((p) => p.id === (mi.portalId || index));
|
|
526
579
|
const menuItem = {
|
|
527
580
|
label: mi.label,
|
|
528
581
|
mountIcon,
|
|
@@ -534,25 +587,36 @@ var useCustomMenuItems = ({
|
|
|
534
587
|
menuItem.open = mi.open;
|
|
535
588
|
}
|
|
536
589
|
customMenuItems.push(menuItem);
|
|
537
|
-
customMenuItemsPortals.push(iconPortal);
|
|
590
|
+
customMenuItemsPortals.push({ key: `icon:${mi.portalId || index}`, portal: iconPortal });
|
|
538
591
|
}
|
|
539
592
|
if (isExternalLink2(mi)) {
|
|
540
593
|
const {
|
|
541
594
|
portal: iconPortal,
|
|
542
595
|
mount: mountIcon,
|
|
543
596
|
unmount: unmountIcon
|
|
544
|
-
} = customLinkLabelIconsPortals.find((p) => p.id === index);
|
|
597
|
+
} = customLinkLabelIconsPortals.find((p) => p.id === (mi.portalId || index));
|
|
545
598
|
customMenuItems.push({
|
|
546
599
|
label: mi.label,
|
|
547
600
|
href: mi.href,
|
|
548
601
|
mountIcon,
|
|
549
602
|
unmountIcon
|
|
550
603
|
});
|
|
551
|
-
customMenuItemsPortals.push(iconPortal);
|
|
604
|
+
customMenuItemsPortals.push({ key: `icon:${mi.portalId || index}`, portal: iconPortal });
|
|
552
605
|
}
|
|
553
606
|
});
|
|
554
607
|
return { customMenuItems, customMenuItemsPortals };
|
|
555
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
|
+
};
|
|
556
620
|
var isReorderItem2 = (childProps, validItems) => {
|
|
557
621
|
const { children, label, onClick, labelIcon } = childProps;
|
|
558
622
|
return !children && !onClick && !labelIcon && validItems.some((v) => v === label);
|
|
@@ -659,16 +723,16 @@ var ClerkHostRenderer = class extends import_react9.default.PureComponent {
|
|
|
659
723
|
this.rootRef = import_react9.default.createRef();
|
|
660
724
|
}
|
|
661
725
|
componentDidUpdate(_prevProps) {
|
|
662
|
-
var _a2, _b, _c, _d;
|
|
726
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
663
727
|
if (!isMountProps(_prevProps) || !isMountProps(this.props)) {
|
|
664
728
|
return;
|
|
665
729
|
}
|
|
666
|
-
const prevProps = (0, import_object.without)(_prevProps.props, "customPages", "customMenuItems", "children");
|
|
667
|
-
const newProps = (0, import_object.without)(this.props.props, "customPages", "customMenuItems", "children");
|
|
668
|
-
const customPagesChanged = ((_a2 =
|
|
669
|
-
const customMenuItemsChanged = ((
|
|
670
|
-
const prevMenuItemsWithoutHandlers = stripMenuItemIconHandlers(_prevProps.props.customMenuItems);
|
|
671
|
-
const newMenuItemsWithoutHandlers = stripMenuItemIconHandlers(this.props.props.customMenuItems);
|
|
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);
|
|
672
736
|
if (!(0, import_react8.isDeeplyEqual)(prevProps, newProps) || !(0, import_react8.isDeeplyEqual)(prevMenuItemsWithoutHandlers, newMenuItemsWithoutHandlers) || customPagesChanged || customMenuItemsChanged) {
|
|
673
737
|
if (this.rootRef.current) {
|
|
674
738
|
this.props.updateProps({ node: this.rootRef.current, props: this.props.props });
|
|
@@ -752,7 +816,7 @@ var withClerk = (Component, displayNameOrOptions) => {
|
|
|
752
816
|
// src/components/uiComponents.tsx
|
|
753
817
|
var CustomPortalsRenderer = (props) => {
|
|
754
818
|
var _a2, _b;
|
|
755
|
-
return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, (_a2 = props == null ? void 0 : props.customPagesPortals) == null ? void 0 : _a2.map((
|
|
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 })));
|
|
756
820
|
};
|
|
757
821
|
var SignIn = withClerk(
|
|
758
822
|
({ clerk, component, fallback, ...props }) => {
|
|
@@ -1150,27 +1214,6 @@ var APIKeys = withClerk(
|
|
|
1150
1214
|
},
|
|
1151
1215
|
{ component: "ApiKeys", renderWhileLoading: true }
|
|
1152
1216
|
);
|
|
1153
|
-
var ConfigureSSO = withClerk(
|
|
1154
|
-
({ clerk, component, fallback, ...props }) => {
|
|
1155
|
-
const mountingStatus = useWaitForComponentMount(component);
|
|
1156
|
-
const shouldShowFallback = mountingStatus === "rendering" || !clerk.loaded;
|
|
1157
|
-
const rendererRootProps = {
|
|
1158
|
-
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
1159
|
-
};
|
|
1160
|
-
return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, shouldShowFallback && fallback, clerk.loaded && /* @__PURE__ */ import_react14.default.createElement(
|
|
1161
|
-
ClerkHostRenderer,
|
|
1162
|
-
{
|
|
1163
|
-
component,
|
|
1164
|
-
mount: clerk.mountConfigureSSO,
|
|
1165
|
-
unmount: clerk.unmountConfigureSSO,
|
|
1166
|
-
updateProps: clerk.__internal_updateProps,
|
|
1167
|
-
props,
|
|
1168
|
-
rootProps: rendererRootProps
|
|
1169
|
-
}
|
|
1170
|
-
));
|
|
1171
|
-
},
|
|
1172
|
-
{ component: "ConfigureSSO", renderWhileLoading: true }
|
|
1173
|
-
);
|
|
1174
1217
|
var OAuthConsent = withClerk(
|
|
1175
1218
|
({ clerk, component, fallback, ...props }) => {
|
|
1176
1219
|
const mountingStatus = useWaitForComponentMount(component);
|
|
@@ -2355,7 +2398,7 @@ if (typeof globalThis.__BUILD_DISABLE_RHC__ === "undefined") {
|
|
|
2355
2398
|
}
|
|
2356
2399
|
var SDK_METADATA = {
|
|
2357
2400
|
name: "@clerk/react",
|
|
2358
|
-
version: "6.8.0
|
|
2401
|
+
version: "6.8.0",
|
|
2359
2402
|
environment: process.env.NODE_ENV
|
|
2360
2403
|
};
|
|
2361
2404
|
var _status, _domain, _proxyUrl, _publishableKey, _eventBus, _stateProxy, _instance, _IsomorphicClerk_instances, waitForClerkJS_fn;
|
|
@@ -2670,7 +2713,7 @@ var _IsomorphicClerk = class _IsomorphicClerk {
|
|
|
2670
2713
|
clerkjs.mountAPIKeys(node, props);
|
|
2671
2714
|
});
|
|
2672
2715
|
this.premountConfigureSSONodes.forEach((props, node) => {
|
|
2673
|
-
clerkjs.
|
|
2716
|
+
clerkjs.__internal_mountConfigureSSO(node, props);
|
|
2674
2717
|
});
|
|
2675
2718
|
this.premountOAuthConsentNodes.forEach((props, node) => {
|
|
2676
2719
|
clerkjs.__internal_mountOAuthConsent(node, props);
|
|
@@ -3057,32 +3100,20 @@ var _IsomorphicClerk = class _IsomorphicClerk {
|
|
|
3057
3100
|
this.premountAPIKeysNodes.delete(node);
|
|
3058
3101
|
}
|
|
3059
3102
|
};
|
|
3060
|
-
this.
|
|
3103
|
+
this.__internal_mountConfigureSSO = (node, props) => {
|
|
3061
3104
|
if (this.clerkjs && this.loaded) {
|
|
3062
|
-
this.clerkjs.
|
|
3105
|
+
this.clerkjs.__internal_mountConfigureSSO(node, props);
|
|
3063
3106
|
} else {
|
|
3064
3107
|
this.premountConfigureSSONodes.set(node, props);
|
|
3065
3108
|
}
|
|
3066
3109
|
};
|
|
3067
|
-
this.
|
|
3110
|
+
this.__internal_unmountConfigureSSO = (node) => {
|
|
3068
3111
|
if (this.clerkjs && this.loaded) {
|
|
3069
|
-
this.clerkjs.
|
|
3112
|
+
this.clerkjs.__internal_unmountConfigureSSO(node);
|
|
3070
3113
|
} else {
|
|
3071
3114
|
this.premountConfigureSSONodes.delete(node);
|
|
3072
3115
|
}
|
|
3073
3116
|
};
|
|
3074
|
-
/**
|
|
3075
|
-
* @deprecated Use `mountConfigureSSO` instead.
|
|
3076
|
-
*/
|
|
3077
|
-
this.__experimental_mountConfigureSSO = (node, props) => {
|
|
3078
|
-
this.mountConfigureSSO(node, props);
|
|
3079
|
-
};
|
|
3080
|
-
/**
|
|
3081
|
-
* @deprecated Use `unmountConfigureSSO` instead.
|
|
3082
|
-
*/
|
|
3083
|
-
this.__experimental_unmountConfigureSSO = (node) => {
|
|
3084
|
-
this.unmountConfigureSSO(node);
|
|
3085
|
-
};
|
|
3086
3117
|
this.__internal_mountOAuthConsent = (node, props) => {
|
|
3087
3118
|
if (this.clerkjs && this.loaded) {
|
|
3088
3119
|
this.clerkjs.__internal_mountOAuthConsent(node, props);
|
|
@@ -3648,17 +3679,20 @@ var _IsomorphicClerk = class _IsomorphicClerk {
|
|
|
3648
3679
|
if ((uiProp || this.options.prefetchUI === false) && !hasInternalUrl) {
|
|
3649
3680
|
return void 0;
|
|
3650
3681
|
}
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
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;
|
|
3660
3694
|
}
|
|
3661
|
-
return
|
|
3695
|
+
return void 0;
|
|
3662
3696
|
}
|
|
3663
3697
|
get version() {
|
|
3664
3698
|
var _a2;
|
|
@@ -3831,7 +3865,6 @@ setErrorThrowerOptions({ packageName: "@clerk/react" });
|
|
|
3831
3865
|
ClerkLoaded,
|
|
3832
3866
|
ClerkLoading,
|
|
3833
3867
|
ClerkProvider,
|
|
3834
|
-
ConfigureSSO,
|
|
3835
3868
|
CreateOrganization,
|
|
3836
3869
|
GoogleOneTap,
|
|
3837
3870
|
HandleSSOCallback,
|