@clerk/chrome-extension 2.8.2-snapshot.v20251117224912 → 2.8.2
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/cjs/background/index.js +1 -1
- package/dist/cjs/index.js +160 -170
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/react/index.js +119 -129
- package/dist/cjs/react/index.js.map +1 -1
- package/dist/esm/background/index.js +1 -1
- package/dist/esm/{chunk-4CWNHWNO.js → chunk-4ONZMBYH.js} +102 -112
- package/dist/esm/chunk-4ONZMBYH.js.map +1 -0
- package/dist/esm/{chunk-ZM32VYQ5.js → chunk-BK2LWOX7.js} +3 -3
- package/dist/esm/{chunk-ZM32VYQ5.js.map → chunk-BK2LWOX7.js.map} +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/react/index.js +2 -2
- package/dist/types/internal/utils/errors.d.ts +1 -1
- package/package.json +4 -4
- package/dist/esm/chunk-4CWNHWNO.js.map +0 -1
package/dist/cjs/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React7 = require('react');
|
|
4
4
|
require('use-sync-external-store/shim/index.js');
|
|
5
5
|
var reactDom = require('react-dom');
|
|
6
6
|
var noRhc = require('@clerk/clerk-js/no-rhc');
|
|
@@ -9,7 +9,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
9
9
|
|
|
10
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var React7__default = /*#__PURE__*/_interopDefault(React7);
|
|
13
13
|
var browser__default = /*#__PURE__*/_interopDefault(browser);
|
|
14
14
|
|
|
15
15
|
var __defProp = Object.defineProperty;
|
|
@@ -374,9 +374,9 @@ var defaultConfigOptions = {
|
|
|
374
374
|
initFocus,
|
|
375
375
|
initReconnect
|
|
376
376
|
};
|
|
377
|
-
!
|
|
377
|
+
!React7__default.default.useId;
|
|
378
378
|
var IS_SERVER = !isWindowDefined || isLegacyDeno;
|
|
379
|
-
var useIsomorphicLayoutEffect = IS_SERVER ?
|
|
379
|
+
var useIsomorphicLayoutEffect = IS_SERVER ? React7.useEffect : React7.useLayoutEffect;
|
|
380
380
|
var navigatorConnection = typeof navigator !== "undefined" && navigator.connection;
|
|
381
381
|
var slowConnection = !IS_SERVER && navigatorConnection && ([
|
|
382
382
|
"slow-2g",
|
|
@@ -678,23 +678,23 @@ var mergeConfigs = (a, b) => {
|
|
|
678
678
|
}
|
|
679
679
|
return v;
|
|
680
680
|
};
|
|
681
|
-
var SWRConfigContext =
|
|
681
|
+
var SWRConfigContext = React7.createContext({});
|
|
682
682
|
var SWRConfig = (props) => {
|
|
683
683
|
const { value } = props;
|
|
684
|
-
const parentConfig =
|
|
684
|
+
const parentConfig = React7.useContext(SWRConfigContext);
|
|
685
685
|
const isFunctionalConfig = isFunction(value);
|
|
686
|
-
const config =
|
|
686
|
+
const config = React7.useMemo(() => isFunctionalConfig ? value(parentConfig) : value, [
|
|
687
687
|
isFunctionalConfig,
|
|
688
688
|
parentConfig,
|
|
689
689
|
value
|
|
690
690
|
]);
|
|
691
|
-
const extendedConfig =
|
|
691
|
+
const extendedConfig = React7.useMemo(() => isFunctionalConfig ? config : mergeConfigs(parentConfig, config), [
|
|
692
692
|
isFunctionalConfig,
|
|
693
693
|
parentConfig,
|
|
694
694
|
config
|
|
695
695
|
]);
|
|
696
696
|
const provider = config && config.provider;
|
|
697
|
-
const cacheContextRef =
|
|
697
|
+
const cacheContextRef = React7.useRef(UNDEFINED);
|
|
698
698
|
if (provider && !cacheContextRef.current) {
|
|
699
699
|
cacheContextRef.current = initCache(provider(extendedConfig.cache || cache), config);
|
|
700
700
|
}
|
|
@@ -709,7 +709,7 @@ var SWRConfig = (props) => {
|
|
|
709
709
|
return cacheContext[3];
|
|
710
710
|
}
|
|
711
711
|
}, []);
|
|
712
|
-
return
|
|
712
|
+
return React7.createElement(SWRConfigContext.Provider, mergeObjects(props, {
|
|
713
713
|
value: extendedConfig
|
|
714
714
|
}));
|
|
715
715
|
};
|
|
@@ -720,7 +720,7 @@ var enableDevtools = isWindowDefined && window.__SWR_DEVTOOLS_USE__;
|
|
|
720
720
|
var use = enableDevtools ? window.__SWR_DEVTOOLS_USE__ : [];
|
|
721
721
|
var setupDevTools = () => {
|
|
722
722
|
if (enableDevtools) {
|
|
723
|
-
window.__SWR_DEVTOOLS_REACT__ =
|
|
723
|
+
window.__SWR_DEVTOOLS_REACT__ = React7__default.default;
|
|
724
724
|
}
|
|
725
725
|
};
|
|
726
726
|
var middleware = (useSWRNext) => (key_, fetcher_, config) => {
|
|
@@ -739,7 +739,7 @@ var middleware = (useSWRNext) => (key_, fetcher_, config) => {
|
|
|
739
739
|
};
|
|
740
740
|
use.concat(middleware);
|
|
741
741
|
setupDevTools();
|
|
742
|
-
|
|
742
|
+
React7__default.default.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
|
|
743
743
|
// and emitting an error.
|
|
744
744
|
// We assume that this is only for the `use(thenable)` case, not `use(context)`.
|
|
745
745
|
// https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45
|
|
@@ -850,15 +850,15 @@ function assertContextExists(contextVal, msgOrCtx) {
|
|
|
850
850
|
}
|
|
851
851
|
var createContextAndHook = (displayName, options) => {
|
|
852
852
|
const { assertCtxFn = assertContextExists } = {};
|
|
853
|
-
const Ctx =
|
|
853
|
+
const Ctx = React7__default.default.createContext(void 0);
|
|
854
854
|
Ctx.displayName = displayName;
|
|
855
855
|
const useCtx = () => {
|
|
856
|
-
const ctx =
|
|
856
|
+
const ctx = React7__default.default.useContext(Ctx);
|
|
857
857
|
assertCtxFn(ctx, `${displayName} not found`);
|
|
858
858
|
return ctx.value;
|
|
859
859
|
};
|
|
860
860
|
const useCtxWithoutGuarantee = () => {
|
|
861
|
-
const ctx =
|
|
861
|
+
const ctx = React7__default.default.useContext(Ctx);
|
|
862
862
|
return ctx ? ctx.value : {};
|
|
863
863
|
};
|
|
864
864
|
return [
|
|
@@ -868,23 +868,23 @@ var createContextAndHook = (displayName, options) => {
|
|
|
868
868
|
];
|
|
869
869
|
};
|
|
870
870
|
function SWRConfigCompat({ swrConfig, children }) {
|
|
871
|
-
return /* @__PURE__ */
|
|
871
|
+
return /* @__PURE__ */ React7__default.default.createElement(SWRConfig2, { value: swrConfig }, children);
|
|
872
872
|
}
|
|
873
873
|
var [ClerkInstanceContext, useClerkInstanceContext] = createContextAndHook("ClerkInstanceContext");
|
|
874
874
|
var [UserContext] = createContextAndHook("UserContext");
|
|
875
875
|
var [ClientContext] = createContextAndHook("ClientContext");
|
|
876
876
|
var [SessionContext] = createContextAndHook("SessionContext");
|
|
877
|
-
|
|
877
|
+
React7__default.default.createContext({});
|
|
878
878
|
var [CheckoutContext] = createContextAndHook("CheckoutContext");
|
|
879
879
|
var __experimental_CheckoutProvider = ({ children, ...rest }) => {
|
|
880
|
-
return /* @__PURE__ */
|
|
880
|
+
return /* @__PURE__ */ React7__default.default.createElement(CheckoutContext.Provider, { value: { value: rest } }, children);
|
|
881
881
|
};
|
|
882
882
|
var [OrganizationContextInternal] = createContextAndHook("OrganizationContext");
|
|
883
883
|
var OrganizationProvider = ({ children, organization, swrConfig }) => {
|
|
884
|
-
return /* @__PURE__ */
|
|
884
|
+
return /* @__PURE__ */ React7__default.default.createElement(SWRConfigCompat, { swrConfig }, /* @__PURE__ */ React7__default.default.createElement(OrganizationContextInternal.Provider, { value: { value: { organization } } }, children));
|
|
885
885
|
};
|
|
886
886
|
function useAssertWrappedByClerkProvider(displayNameOrFn) {
|
|
887
|
-
if (!
|
|
887
|
+
if (!React7__default.default.useContext(ClerkInstanceContext)) {
|
|
888
888
|
if (typeof displayNameOrFn === "function") {
|
|
889
889
|
displayNameOrFn();
|
|
890
890
|
return;
|
|
@@ -898,22 +898,22 @@ Possible fixes:
|
|
|
898
898
|
Learn more: https://clerk.com/docs/components/clerk-provider`.trim());
|
|
899
899
|
}
|
|
900
900
|
}
|
|
901
|
-
typeof window !== "undefined" ?
|
|
901
|
+
typeof window !== "undefined" ? React7__default.default.useLayoutEffect : React7__default.default.useEffect;
|
|
902
902
|
var isDeeplyEqual = dequal2;
|
|
903
903
|
var usePrevious = (value) => {
|
|
904
|
-
const ref =
|
|
905
|
-
|
|
904
|
+
const ref = React7.useRef(value);
|
|
905
|
+
React7.useEffect(() => {
|
|
906
906
|
ref.current = value;
|
|
907
907
|
}, [value]);
|
|
908
908
|
return ref.current;
|
|
909
909
|
};
|
|
910
910
|
var useAttachEvent = (element, event, cb) => {
|
|
911
911
|
const cbDefined = !!cb;
|
|
912
|
-
const cbRef =
|
|
913
|
-
|
|
912
|
+
const cbRef = React7.useRef(cb);
|
|
913
|
+
React7.useEffect(() => {
|
|
914
914
|
cbRef.current = cb;
|
|
915
915
|
}, [cb]);
|
|
916
|
-
|
|
916
|
+
React7.useEffect(() => {
|
|
917
917
|
if (!cbDefined || !element) return () => {
|
|
918
918
|
};
|
|
919
919
|
const decoratedCb = (...args) => {
|
|
@@ -930,7 +930,7 @@ var useAttachEvent = (element, event, cb) => {
|
|
|
930
930
|
cbRef
|
|
931
931
|
]);
|
|
932
932
|
};
|
|
933
|
-
var ElementsContext =
|
|
933
|
+
var ElementsContext = React7__default.default.createContext(null);
|
|
934
934
|
ElementsContext.displayName = "ElementsContext";
|
|
935
935
|
var parseElementsContext = (ctx, useCase) => {
|
|
936
936
|
if (!ctx) throw new Error(`Could not find Elements context; You need to wrap the part of your app that ${useCase} in an <Elements> provider.`);
|
|
@@ -978,7 +978,7 @@ var isEqual = (left, right) => {
|
|
|
978
978
|
return allKeys.every(pred);
|
|
979
979
|
};
|
|
980
980
|
var useElementsOrCheckoutSdkContextWithUseCase = (useCaseString) => {
|
|
981
|
-
return parseElementsContext(
|
|
981
|
+
return parseElementsContext(React7__default.default.useContext(ElementsContext), useCaseString);
|
|
982
982
|
};
|
|
983
983
|
var capitalized = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
984
984
|
var createElementComponent = (type, isServer) => {
|
|
@@ -986,10 +986,10 @@ var createElementComponent = (type, isServer) => {
|
|
|
986
986
|
const ClientElement = ({ id, className, fallback, options = {}, onBlur, onFocus, onReady, onChange, onEscape, onClick, onLoadError, onLoaderStart, onNetworksChange, onConfirm, onCancel, onShippingAddressChange, onShippingRateChange }) => {
|
|
987
987
|
const ctx = useElementsOrCheckoutSdkContextWithUseCase(`mounts <${displayName}>`);
|
|
988
988
|
const elements = "elements" in ctx ? ctx.elements : null;
|
|
989
|
-
const [element, setElement] =
|
|
990
|
-
const elementRef =
|
|
991
|
-
const domNode =
|
|
992
|
-
const [isReady, setReady] =
|
|
989
|
+
const [element, setElement] = React7__default.default.useState(null);
|
|
990
|
+
const elementRef = React7__default.default.useRef(null);
|
|
991
|
+
const domNode = React7__default.default.useRef(null);
|
|
992
|
+
const [isReady, setReady] = React7.useState(false);
|
|
993
993
|
useAttachEvent(element, "blur", onBlur);
|
|
994
994
|
useAttachEvent(element, "focus", onFocus);
|
|
995
995
|
useAttachEvent(element, "escape", onEscape);
|
|
@@ -1008,7 +1008,7 @@ var createElementComponent = (type, isServer) => {
|
|
|
1008
1008
|
onReady(element);
|
|
1009
1009
|
};
|
|
1010
1010
|
useAttachEvent(element, "ready", readyCallback);
|
|
1011
|
-
|
|
1011
|
+
React7__default.default.useLayoutEffect(() => {
|
|
1012
1012
|
if (elementRef.current === null && domNode.current !== null && elements) {
|
|
1013
1013
|
let newElement = null;
|
|
1014
1014
|
if (elements) newElement = elements.create(type, options);
|
|
@@ -1018,12 +1018,12 @@ var createElementComponent = (type, isServer) => {
|
|
|
1018
1018
|
}
|
|
1019
1019
|
}, [elements, options]);
|
|
1020
1020
|
const prevOptions = usePrevious(options);
|
|
1021
|
-
|
|
1021
|
+
React7__default.default.useEffect(() => {
|
|
1022
1022
|
if (!elementRef.current) return;
|
|
1023
1023
|
const updates = extractAllowedOptionsUpdates(options, prevOptions, ["paymentRequest"]);
|
|
1024
1024
|
if (updates && "update" in elementRef.current) elementRef.current.update(updates);
|
|
1025
1025
|
}, [options, prevOptions]);
|
|
1026
|
-
|
|
1026
|
+
React7__default.default.useLayoutEffect(() => {
|
|
1027
1027
|
return () => {
|
|
1028
1028
|
if (elementRef.current && typeof elementRef.current.destroy === "function") try {
|
|
1029
1029
|
elementRef.current.destroy();
|
|
@@ -1032,7 +1032,7 @@ var createElementComponent = (type, isServer) => {
|
|
|
1032
1032
|
}
|
|
1033
1033
|
};
|
|
1034
1034
|
}, []);
|
|
1035
|
-
return /* @__PURE__ */
|
|
1035
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, !isReady && fallback, /* @__PURE__ */ React7__default.default.createElement("div", {
|
|
1036
1036
|
id,
|
|
1037
1037
|
style: {
|
|
1038
1038
|
height: isReady ? "unset" : "0px",
|
|
@@ -1045,7 +1045,7 @@ var createElementComponent = (type, isServer) => {
|
|
|
1045
1045
|
const ServerElement = (props) => {
|
|
1046
1046
|
useElementsOrCheckoutSdkContextWithUseCase(`mounts <${displayName}>`);
|
|
1047
1047
|
const { id, className } = props;
|
|
1048
|
-
return /* @__PURE__ */
|
|
1048
|
+
return /* @__PURE__ */ React7__default.default.createElement("div", {
|
|
1049
1049
|
id,
|
|
1050
1050
|
className
|
|
1051
1051
|
});
|
|
@@ -1099,7 +1099,7 @@ var withClerk = (Component, displayNameOrOptions) => {
|
|
|
1099
1099
|
if (!clerk2.loaded && !(options == null ? void 0 : options.renderWhileLoading)) {
|
|
1100
1100
|
return null;
|
|
1101
1101
|
}
|
|
1102
|
-
return /* @__PURE__ */
|
|
1102
|
+
return /* @__PURE__ */ React7__default.default.createElement(
|
|
1103
1103
|
Component,
|
|
1104
1104
|
{
|
|
1105
1105
|
...props,
|
|
@@ -1151,7 +1151,7 @@ withClerk(({ clerk: clerk2, ...props }) => {
|
|
|
1151
1151
|
// Compat for clerk-js<5.54.0 (which was released with the `signedInSessions` property)
|
|
1152
1152
|
client.activeSessions && client.activeSessions.length > 0
|
|
1153
1153
|
);
|
|
1154
|
-
|
|
1154
|
+
React7__default.default.useEffect(() => {
|
|
1155
1155
|
if (session === null && hasSignedInSessions) {
|
|
1156
1156
|
void clerk2.redirectToAfterSignOut();
|
|
1157
1157
|
} else {
|
|
@@ -1161,33 +1161,33 @@ withClerk(({ clerk: clerk2, ...props }) => {
|
|
|
1161
1161
|
return null;
|
|
1162
1162
|
}, "RedirectToSignIn");
|
|
1163
1163
|
withClerk(({ clerk: clerk2, ...props }) => {
|
|
1164
|
-
|
|
1164
|
+
React7__default.default.useEffect(() => {
|
|
1165
1165
|
void clerk2.redirectToSignUp(props);
|
|
1166
1166
|
}, []);
|
|
1167
1167
|
return null;
|
|
1168
1168
|
}, "RedirectToSignUp");
|
|
1169
1169
|
withClerk(({ clerk: clerk2, ...props }) => {
|
|
1170
|
-
|
|
1170
|
+
React7__default.default.useEffect(() => {
|
|
1171
1171
|
void clerk2.redirectToTasks(props);
|
|
1172
1172
|
}, []);
|
|
1173
1173
|
return null;
|
|
1174
1174
|
}, "RedirectToTasks");
|
|
1175
1175
|
withClerk(({ clerk: clerk2 }) => {
|
|
1176
|
-
|
|
1176
|
+
React7__default.default.useEffect(() => {
|
|
1177
1177
|
deprecated("RedirectToUserProfile", "Use the `redirectToUserProfile()` method instead.");
|
|
1178
1178
|
void clerk2.redirectToUserProfile();
|
|
1179
1179
|
}, []);
|
|
1180
1180
|
return null;
|
|
1181
1181
|
}, "RedirectToUserProfile");
|
|
1182
1182
|
withClerk(({ clerk: clerk2 }) => {
|
|
1183
|
-
|
|
1183
|
+
React7__default.default.useEffect(() => {
|
|
1184
1184
|
deprecated("RedirectToOrganizationProfile", "Use the `redirectToOrganizationProfile()` method instead.");
|
|
1185
1185
|
void clerk2.redirectToOrganizationProfile();
|
|
1186
1186
|
}, []);
|
|
1187
1187
|
return null;
|
|
1188
1188
|
}, "RedirectToOrganizationProfile");
|
|
1189
1189
|
withClerk(({ clerk: clerk2 }) => {
|
|
1190
|
-
|
|
1190
|
+
React7__default.default.useEffect(() => {
|
|
1191
1191
|
deprecated("RedirectToCreateOrganization", "Use the `redirectToCreateOrganization()` method instead.");
|
|
1192
1192
|
void clerk2.redirectToCreateOrganization();
|
|
1193
1193
|
}, []);
|
|
@@ -1195,7 +1195,7 @@ withClerk(({ clerk: clerk2 }) => {
|
|
|
1195
1195
|
}, "RedirectToCreateOrganization");
|
|
1196
1196
|
withClerk(
|
|
1197
1197
|
({ clerk: clerk2, ...handleRedirectCallbackParams }) => {
|
|
1198
|
-
|
|
1198
|
+
React7__default.default.useEffect(() => {
|
|
1199
1199
|
void clerk2.handleRedirectCallback(handleRedirectCallbackParams);
|
|
1200
1200
|
}, []);
|
|
1201
1201
|
return null;
|
|
@@ -1221,13 +1221,9 @@ var without = (obj, ...props) => {
|
|
|
1221
1221
|
for (const prop of props) delete copy[prop];
|
|
1222
1222
|
return copy;
|
|
1223
1223
|
};
|
|
1224
|
-
var PortalContext = React8.createContext(void 0);
|
|
1225
|
-
function usePortalConfig() {
|
|
1226
|
-
return React8.useContext(PortalContext);
|
|
1227
|
-
}
|
|
1228
1224
|
var assertSingleChild = (children) => (name) => {
|
|
1229
1225
|
try {
|
|
1230
|
-
return
|
|
1226
|
+
return React7__default.default.Children.only(children);
|
|
1231
1227
|
} catch {
|
|
1232
1228
|
return errorThrower.throw(multipleChildrenInButtonComponent(name));
|
|
1233
1229
|
}
|
|
@@ -1237,7 +1233,7 @@ var normalizeWithDefaultValue = (children, defaultText) => {
|
|
|
1237
1233
|
children = defaultText;
|
|
1238
1234
|
}
|
|
1239
1235
|
if (typeof children === "string") {
|
|
1240
|
-
children = /* @__PURE__ */
|
|
1236
|
+
children = /* @__PURE__ */ React7__default.default.createElement("button", null, children);
|
|
1241
1237
|
}
|
|
1242
1238
|
return children;
|
|
1243
1239
|
};
|
|
@@ -1251,7 +1247,7 @@ function isConstructor(f) {
|
|
|
1251
1247
|
}
|
|
1252
1248
|
var counts = /* @__PURE__ */ new Map();
|
|
1253
1249
|
function useMaxAllowedInstancesGuard(name, error, maxCount = 1) {
|
|
1254
|
-
|
|
1250
|
+
React7__default.default.useEffect(() => {
|
|
1255
1251
|
const count = counts.get(name) || 0;
|
|
1256
1252
|
if (count == maxCount) {
|
|
1257
1253
|
return errorThrower.throw(error);
|
|
@@ -1266,13 +1262,13 @@ function withMaxAllowedInstancesGuard(WrappedComponent, name, error) {
|
|
|
1266
1262
|
const displayName = WrappedComponent.displayName || WrappedComponent.name || name || "Component";
|
|
1267
1263
|
const Hoc = (props) => {
|
|
1268
1264
|
useMaxAllowedInstancesGuard(name, error);
|
|
1269
|
-
return /* @__PURE__ */
|
|
1265
|
+
return /* @__PURE__ */ React7__default.default.createElement(WrappedComponent, { ...props });
|
|
1270
1266
|
};
|
|
1271
1267
|
Hoc.displayName = `withMaxAllowedInstancesGuard(${displayName})`;
|
|
1272
1268
|
return Hoc;
|
|
1273
1269
|
}
|
|
1274
1270
|
var useCustomElementPortal = (elements) => {
|
|
1275
|
-
const [nodeMap, setNodeMap] =
|
|
1271
|
+
const [nodeMap, setNodeMap] = React7.useState(/* @__PURE__ */ new Map());
|
|
1276
1272
|
return elements.map((el) => ({
|
|
1277
1273
|
id: el.id,
|
|
1278
1274
|
mount: (node) => setNodeMap((prev) => new Map(prev).set(String(el.id), node)),
|
|
@@ -1288,7 +1284,7 @@ var useCustomElementPortal = (elements) => {
|
|
|
1288
1284
|
}));
|
|
1289
1285
|
};
|
|
1290
1286
|
var isThatComponent = (v, component) => {
|
|
1291
|
-
return !!v &&
|
|
1287
|
+
return !!v && React7__default.default.isValidElement(v) && (v == null ? void 0 : v.type) === component;
|
|
1292
1288
|
};
|
|
1293
1289
|
var useUserProfileCustomPages = (children, options) => {
|
|
1294
1290
|
const reorderItemsLabels = ["account", "security"];
|
|
@@ -1326,7 +1322,7 @@ var useSanitizedChildren = (children) => {
|
|
|
1326
1322
|
UserProfilePage,
|
|
1327
1323
|
UserProfileLink
|
|
1328
1324
|
];
|
|
1329
|
-
|
|
1325
|
+
React7__default.default.Children.forEach(children, (child) => {
|
|
1330
1326
|
if (!excludedComponents.some((component) => isThatComponent(child, component))) {
|
|
1331
1327
|
sanitizedChildren.push(child);
|
|
1332
1328
|
}
|
|
@@ -1337,7 +1333,7 @@ var useCustomPages = (params, options) => {
|
|
|
1337
1333
|
const { children, LinkComponent, PageComponent, MenuItemsComponent, reorderItemsLabels, componentName } = params;
|
|
1338
1334
|
const { allowForAnyChildren = false } = options || {};
|
|
1339
1335
|
const validChildren = [];
|
|
1340
|
-
|
|
1336
|
+
React7__default.default.Children.forEach(children, (child) => {
|
|
1341
1337
|
if (!isThatComponent(child, PageComponent) && !isThatComponent(child, LinkComponent) && !isThatComponent(child, MenuItemsComponent)) {
|
|
1342
1338
|
if (child && !allowForAnyChildren) {
|
|
1343
1339
|
logErrorInDevMode(customPagesIgnoredComponent(componentName));
|
|
@@ -1456,7 +1452,7 @@ var useCustomMenuItems = ({
|
|
|
1456
1452
|
const validChildren = [];
|
|
1457
1453
|
const customMenuItems = [];
|
|
1458
1454
|
const customMenuItemsPortals = [];
|
|
1459
|
-
|
|
1455
|
+
React7__default.default.Children.forEach(children, (child) => {
|
|
1460
1456
|
if (!isThatComponent(child, MenuItemsComponent) && !isThatComponent(child, UserProfileLinkComponent) && !isThatComponent(child, UserProfilePageComponent)) {
|
|
1461
1457
|
if (child && !allowForAnyChildren) {
|
|
1462
1458
|
logErrorInDevMode(userButtonIgnoredComponent);
|
|
@@ -1467,7 +1463,7 @@ var useCustomMenuItems = ({
|
|
|
1467
1463
|
return;
|
|
1468
1464
|
}
|
|
1469
1465
|
const { props } = child;
|
|
1470
|
-
|
|
1466
|
+
React7__default.default.Children.forEach(props.children, (child2) => {
|
|
1471
1467
|
if (!isThatComponent(child2, MenuActionComponent) && !isThatComponent(child2, MenuLinkComponent)) {
|
|
1472
1468
|
if (child2) {
|
|
1473
1469
|
logErrorInDevMode(customMenuItemsIgnoredComponent);
|
|
@@ -1627,9 +1623,9 @@ var waitForElementChildren = createAwaitableMutationObserver({
|
|
|
1627
1623
|
}
|
|
1628
1624
|
});
|
|
1629
1625
|
function useWaitForComponentMount(component, options) {
|
|
1630
|
-
const watcherRef =
|
|
1631
|
-
const [status, setStatus] =
|
|
1632
|
-
|
|
1626
|
+
const watcherRef = React7.useRef();
|
|
1627
|
+
const [status, setStatus] = React7.useState("rendering");
|
|
1628
|
+
React7.useEffect(() => {
|
|
1633
1629
|
if (!component) {
|
|
1634
1630
|
throw new Error("Clerk: no component name provided, unable to detect mount.");
|
|
1635
1631
|
}
|
|
@@ -1659,10 +1655,10 @@ var isOpenProps = (props) => {
|
|
|
1659
1655
|
var stripMenuItemIconHandlers = (menuItems) => {
|
|
1660
1656
|
return menuItems == null ? void 0 : menuItems.map(({ mountIcon, unmountIcon, ...rest }) => rest);
|
|
1661
1657
|
};
|
|
1662
|
-
var ClerkHostRenderer = class extends
|
|
1658
|
+
var ClerkHostRenderer = class extends React7__default.default.PureComponent {
|
|
1663
1659
|
constructor() {
|
|
1664
1660
|
super(...arguments);
|
|
1665
|
-
this.rootRef =
|
|
1661
|
+
this.rootRef = React7__default.default.createRef();
|
|
1666
1662
|
}
|
|
1667
1663
|
componentDidUpdate(_prevProps) {
|
|
1668
1664
|
var _a5, _b, _c, _d;
|
|
@@ -1708,12 +1704,12 @@ var ClerkHostRenderer = class extends React8__default.default.PureComponent {
|
|
|
1708
1704
|
...this.props.rootProps,
|
|
1709
1705
|
...this.props.component && { "data-clerk-component": this.props.component }
|
|
1710
1706
|
};
|
|
1711
|
-
return /* @__PURE__ */
|
|
1707
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, !hideRootHtmlElement && /* @__PURE__ */ React7__default.default.createElement("div", { ...rootAttributes }), this.props.children);
|
|
1712
1708
|
}
|
|
1713
1709
|
};
|
|
1714
1710
|
var CustomPortalsRenderer = (props) => {
|
|
1715
1711
|
var _a5, _b;
|
|
1716
|
-
return /* @__PURE__ */
|
|
1712
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, (_a5 = props == null ? void 0 : props.customPagesPortals) == null ? void 0 : _a5.map((portal, index) => React7.createElement(portal, { key: index })), (_b = props == null ? void 0 : props.customMenuItemsPortals) == null ? void 0 : _b.map((portal, index) => React7.createElement(portal, { key: index })));
|
|
1717
1713
|
};
|
|
1718
1714
|
withClerk(
|
|
1719
1715
|
({ clerk: clerk2, component, fallback, ...props }) => {
|
|
@@ -1722,7 +1718,7 @@ withClerk(
|
|
|
1722
1718
|
const rendererRootProps = {
|
|
1723
1719
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
1724
1720
|
};
|
|
1725
|
-
return /* @__PURE__ */
|
|
1721
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, shouldShowFallback && fallback, clerk2.loaded && /* @__PURE__ */ React7__default.default.createElement(
|
|
1726
1722
|
ClerkHostRenderer,
|
|
1727
1723
|
{
|
|
1728
1724
|
component,
|
|
@@ -1743,7 +1739,7 @@ withClerk(
|
|
|
1743
1739
|
const rendererRootProps = {
|
|
1744
1740
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
1745
1741
|
};
|
|
1746
|
-
return /* @__PURE__ */
|
|
1742
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, shouldShowFallback && fallback, clerk2.loaded && /* @__PURE__ */ React7__default.default.createElement(
|
|
1747
1743
|
ClerkHostRenderer,
|
|
1748
1744
|
{
|
|
1749
1745
|
component,
|
|
@@ -1759,11 +1755,11 @@ withClerk(
|
|
|
1759
1755
|
);
|
|
1760
1756
|
function UserProfilePage({ children }) {
|
|
1761
1757
|
logErrorInDevMode(userProfilePageRenderedError);
|
|
1762
|
-
return /* @__PURE__ */
|
|
1758
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, children);
|
|
1763
1759
|
}
|
|
1764
1760
|
function UserProfileLink({ children }) {
|
|
1765
1761
|
logErrorInDevMode(userProfileLinkRenderedError);
|
|
1766
|
-
return /* @__PURE__ */
|
|
1762
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, children);
|
|
1767
1763
|
}
|
|
1768
1764
|
var _UserProfile = withClerk(
|
|
1769
1765
|
({
|
|
@@ -1774,23 +1770,21 @@ var _UserProfile = withClerk(
|
|
|
1774
1770
|
}) => {
|
|
1775
1771
|
const mountingStatus = useWaitForComponentMount(component);
|
|
1776
1772
|
const shouldShowFallback = mountingStatus === "rendering" || !clerk2.loaded;
|
|
1777
|
-
const portalFromContext = usePortalConfig();
|
|
1778
|
-
const portal = props.portal !== void 0 ? props.portal : portalFromContext;
|
|
1779
1773
|
const rendererRootProps = {
|
|
1780
1774
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
1781
1775
|
};
|
|
1782
1776
|
const { customPages, customPagesPortals } = useUserProfileCustomPages(props.children);
|
|
1783
|
-
return /* @__PURE__ */
|
|
1777
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, shouldShowFallback && fallback, /* @__PURE__ */ React7__default.default.createElement(
|
|
1784
1778
|
ClerkHostRenderer,
|
|
1785
1779
|
{
|
|
1786
1780
|
component,
|
|
1787
1781
|
mount: clerk2.mountUserProfile,
|
|
1788
1782
|
unmount: clerk2.unmountUserProfile,
|
|
1789
1783
|
updateProps: clerk2.__unstable__updateProps,
|
|
1790
|
-
props: { ...props,
|
|
1784
|
+
props: { ...props, customPages },
|
|
1791
1785
|
rootProps: rendererRootProps
|
|
1792
1786
|
},
|
|
1793
|
-
/* @__PURE__ */
|
|
1787
|
+
/* @__PURE__ */ React7__default.default.createElement(CustomPortalsRenderer, { customPagesPortals })
|
|
1794
1788
|
));
|
|
1795
1789
|
},
|
|
1796
1790
|
{ component: "UserProfile", renderWhileLoading: true }
|
|
@@ -1799,7 +1793,7 @@ Object.assign(_UserProfile, {
|
|
|
1799
1793
|
Page: UserProfilePage,
|
|
1800
1794
|
Link: UserProfileLink
|
|
1801
1795
|
});
|
|
1802
|
-
var UserButtonContext =
|
|
1796
|
+
var UserButtonContext = React7.createContext({
|
|
1803
1797
|
mount: () => {
|
|
1804
1798
|
},
|
|
1805
1799
|
unmount: () => {
|
|
@@ -1816,8 +1810,6 @@ var _UserButton = withClerk(
|
|
|
1816
1810
|
}) => {
|
|
1817
1811
|
const mountingStatus = useWaitForComponentMount(component);
|
|
1818
1812
|
const shouldShowFallback = mountingStatus === "rendering" || !clerk2.loaded;
|
|
1819
|
-
const portalFromContext = usePortalConfig();
|
|
1820
|
-
const portal = props.portal !== void 0 ? props.portal : portalFromContext;
|
|
1821
1813
|
const rendererRootProps = {
|
|
1822
1814
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
1823
1815
|
};
|
|
@@ -1833,13 +1825,13 @@ var _UserButton = withClerk(
|
|
|
1833
1825
|
mount: clerk2.mountUserButton,
|
|
1834
1826
|
unmount: clerk2.unmountUserButton,
|
|
1835
1827
|
updateProps: clerk2.__unstable__updateProps,
|
|
1836
|
-
props: { ...props,
|
|
1828
|
+
props: { ...props, userProfileProps, customMenuItems }
|
|
1837
1829
|
};
|
|
1838
1830
|
const portalProps = {
|
|
1839
1831
|
customPagesPortals,
|
|
1840
1832
|
customMenuItemsPortals
|
|
1841
1833
|
};
|
|
1842
|
-
return /* @__PURE__ */
|
|
1834
|
+
return /* @__PURE__ */ React7__default.default.createElement(UserButtonContext.Provider, { value: passableProps }, shouldShowFallback && fallback, clerk2.loaded && /* @__PURE__ */ React7__default.default.createElement(
|
|
1843
1835
|
ClerkHostRenderer,
|
|
1844
1836
|
{
|
|
1845
1837
|
component,
|
|
@@ -1848,25 +1840,25 @@ var _UserButton = withClerk(
|
|
|
1848
1840
|
rootProps: rendererRootProps
|
|
1849
1841
|
},
|
|
1850
1842
|
props.__experimental_asProvider ? sanitizedChildren : null,
|
|
1851
|
-
/* @__PURE__ */
|
|
1843
|
+
/* @__PURE__ */ React7__default.default.createElement(CustomPortalsRenderer, { ...portalProps })
|
|
1852
1844
|
));
|
|
1853
1845
|
},
|
|
1854
1846
|
{ component: "UserButton", renderWhileLoading: true }
|
|
1855
1847
|
);
|
|
1856
1848
|
function MenuItems({ children }) {
|
|
1857
1849
|
logErrorInDevMode(userButtonMenuItemsRenderedError);
|
|
1858
|
-
return /* @__PURE__ */
|
|
1850
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, children);
|
|
1859
1851
|
}
|
|
1860
1852
|
function MenuAction({ children }) {
|
|
1861
1853
|
logErrorInDevMode(userButtonMenuActionRenderedError);
|
|
1862
|
-
return /* @__PURE__ */
|
|
1854
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, children);
|
|
1863
1855
|
}
|
|
1864
1856
|
function MenuLink({ children }) {
|
|
1865
1857
|
logErrorInDevMode(userButtonMenuLinkRenderedError);
|
|
1866
|
-
return /* @__PURE__ */
|
|
1858
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, children);
|
|
1867
1859
|
}
|
|
1868
1860
|
function UserButtonOutlet(outletProps) {
|
|
1869
|
-
const providerProps =
|
|
1861
|
+
const providerProps = React7.useContext(UserButtonContext);
|
|
1870
1862
|
const portalProps = {
|
|
1871
1863
|
...providerProps,
|
|
1872
1864
|
props: {
|
|
@@ -1874,7 +1866,7 @@ function UserButtonOutlet(outletProps) {
|
|
|
1874
1866
|
...outletProps
|
|
1875
1867
|
}
|
|
1876
1868
|
};
|
|
1877
|
-
return /* @__PURE__ */
|
|
1869
|
+
return /* @__PURE__ */ React7__default.default.createElement(ClerkHostRenderer, { ...portalProps });
|
|
1878
1870
|
}
|
|
1879
1871
|
Object.assign(_UserButton, {
|
|
1880
1872
|
UserProfilePage,
|
|
@@ -1886,11 +1878,11 @@ Object.assign(_UserButton, {
|
|
|
1886
1878
|
});
|
|
1887
1879
|
function OrganizationProfilePage({ children }) {
|
|
1888
1880
|
logErrorInDevMode(organizationProfilePageRenderedError);
|
|
1889
|
-
return /* @__PURE__ */
|
|
1881
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, children);
|
|
1890
1882
|
}
|
|
1891
1883
|
function OrganizationProfileLink({ children }) {
|
|
1892
1884
|
logErrorInDevMode(organizationProfileLinkRenderedError);
|
|
1893
|
-
return /* @__PURE__ */
|
|
1885
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, children);
|
|
1894
1886
|
}
|
|
1895
1887
|
var _OrganizationProfile = withClerk(
|
|
1896
1888
|
({
|
|
@@ -1905,7 +1897,7 @@ var _OrganizationProfile = withClerk(
|
|
|
1905
1897
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
1906
1898
|
};
|
|
1907
1899
|
const { customPages, customPagesPortals } = useOrganizationProfileCustomPages(props.children);
|
|
1908
|
-
return /* @__PURE__ */
|
|
1900
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, shouldShowFallback && fallback, clerk2.loaded && /* @__PURE__ */ React7__default.default.createElement(
|
|
1909
1901
|
ClerkHostRenderer,
|
|
1910
1902
|
{
|
|
1911
1903
|
component,
|
|
@@ -1915,7 +1907,7 @@ var _OrganizationProfile = withClerk(
|
|
|
1915
1907
|
props: { ...props, customPages },
|
|
1916
1908
|
rootProps: rendererRootProps
|
|
1917
1909
|
},
|
|
1918
|
-
/* @__PURE__ */
|
|
1910
|
+
/* @__PURE__ */ React7__default.default.createElement(CustomPortalsRenderer, { customPagesPortals })
|
|
1919
1911
|
));
|
|
1920
1912
|
},
|
|
1921
1913
|
{ component: "OrganizationProfile", renderWhileLoading: true }
|
|
@@ -1931,7 +1923,7 @@ withClerk(
|
|
|
1931
1923
|
const rendererRootProps = {
|
|
1932
1924
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
1933
1925
|
};
|
|
1934
|
-
return /* @__PURE__ */
|
|
1926
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, shouldShowFallback && fallback, clerk2.loaded && /* @__PURE__ */ React7__default.default.createElement(
|
|
1935
1927
|
ClerkHostRenderer,
|
|
1936
1928
|
{
|
|
1937
1929
|
component,
|
|
@@ -1945,7 +1937,7 @@ withClerk(
|
|
|
1945
1937
|
},
|
|
1946
1938
|
{ component: "CreateOrganization", renderWhileLoading: true }
|
|
1947
1939
|
);
|
|
1948
|
-
var OrganizationSwitcherContext =
|
|
1940
|
+
var OrganizationSwitcherContext = React7.createContext({
|
|
1949
1941
|
mount: () => {
|
|
1950
1942
|
},
|
|
1951
1943
|
unmount: () => {
|
|
@@ -1962,8 +1954,6 @@ var _OrganizationSwitcher = withClerk(
|
|
|
1962
1954
|
}) => {
|
|
1963
1955
|
const mountingStatus = useWaitForComponentMount(component);
|
|
1964
1956
|
const shouldShowFallback = mountingStatus === "rendering" || !clerk2.loaded;
|
|
1965
|
-
const portalFromContext = usePortalConfig();
|
|
1966
|
-
const portal = props.portal !== void 0 ? props.portal : portalFromContext;
|
|
1967
1957
|
const rendererRootProps = {
|
|
1968
1958
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
1969
1959
|
};
|
|
@@ -1976,25 +1966,25 @@ var _OrganizationSwitcher = withClerk(
|
|
|
1976
1966
|
mount: clerk2.mountOrganizationSwitcher,
|
|
1977
1967
|
unmount: clerk2.unmountOrganizationSwitcher,
|
|
1978
1968
|
updateProps: clerk2.__unstable__updateProps,
|
|
1979
|
-
props: { ...props,
|
|
1969
|
+
props: { ...props, organizationProfileProps },
|
|
1980
1970
|
rootProps: rendererRootProps,
|
|
1981
1971
|
component
|
|
1982
1972
|
};
|
|
1983
1973
|
clerk2.__experimental_prefetchOrganizationSwitcher();
|
|
1984
|
-
return /* @__PURE__ */
|
|
1974
|
+
return /* @__PURE__ */ React7__default.default.createElement(OrganizationSwitcherContext.Provider, { value: passableProps }, /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, shouldShowFallback && fallback, clerk2.loaded && /* @__PURE__ */ React7__default.default.createElement(
|
|
1985
1975
|
ClerkHostRenderer,
|
|
1986
1976
|
{
|
|
1987
1977
|
...passableProps,
|
|
1988
1978
|
hideRootHtmlElement: !!props.__experimental_asProvider
|
|
1989
1979
|
},
|
|
1990
1980
|
props.__experimental_asProvider ? sanitizedChildren : null,
|
|
1991
|
-
/* @__PURE__ */
|
|
1981
|
+
/* @__PURE__ */ React7__default.default.createElement(CustomPortalsRenderer, { customPagesPortals })
|
|
1992
1982
|
)));
|
|
1993
1983
|
},
|
|
1994
1984
|
{ component: "OrganizationSwitcher", renderWhileLoading: true }
|
|
1995
1985
|
);
|
|
1996
1986
|
function OrganizationSwitcherOutlet(outletProps) {
|
|
1997
|
-
const providerProps =
|
|
1987
|
+
const providerProps = React7.useContext(OrganizationSwitcherContext);
|
|
1998
1988
|
const portalProps = {
|
|
1999
1989
|
...providerProps,
|
|
2000
1990
|
props: {
|
|
@@ -2002,7 +1992,7 @@ function OrganizationSwitcherOutlet(outletProps) {
|
|
|
2002
1992
|
...outletProps
|
|
2003
1993
|
}
|
|
2004
1994
|
};
|
|
2005
|
-
return /* @__PURE__ */
|
|
1995
|
+
return /* @__PURE__ */ React7__default.default.createElement(ClerkHostRenderer, { ...portalProps });
|
|
2006
1996
|
}
|
|
2007
1997
|
Object.assign(_OrganizationSwitcher, {
|
|
2008
1998
|
OrganizationProfilePage,
|
|
@@ -2016,7 +2006,7 @@ withClerk(
|
|
|
2016
2006
|
const rendererRootProps = {
|
|
2017
2007
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
2018
2008
|
};
|
|
2019
|
-
return /* @__PURE__ */
|
|
2009
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, shouldShowFallback && fallback, clerk2.loaded && /* @__PURE__ */ React7__default.default.createElement(
|
|
2020
2010
|
ClerkHostRenderer,
|
|
2021
2011
|
{
|
|
2022
2012
|
component,
|
|
@@ -2037,7 +2027,7 @@ withClerk(
|
|
|
2037
2027
|
const rendererRootProps = {
|
|
2038
2028
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
2039
2029
|
};
|
|
2040
|
-
return /* @__PURE__ */
|
|
2030
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, shouldShowFallback && fallback, clerk2.loaded && /* @__PURE__ */ React7__default.default.createElement(
|
|
2041
2031
|
ClerkHostRenderer,
|
|
2042
2032
|
{
|
|
2043
2033
|
component,
|
|
@@ -2058,7 +2048,7 @@ withClerk(
|
|
|
2058
2048
|
const rendererRootProps = {
|
|
2059
2049
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
2060
2050
|
};
|
|
2061
|
-
return /* @__PURE__ */
|
|
2051
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, shouldShowFallback && fallback, clerk2.loaded && /* @__PURE__ */ React7__default.default.createElement(
|
|
2062
2052
|
ClerkHostRenderer,
|
|
2063
2053
|
{
|
|
2064
2054
|
component,
|
|
@@ -2082,7 +2072,7 @@ withClerk(
|
|
|
2082
2072
|
const rendererRootProps = {
|
|
2083
2073
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
2084
2074
|
};
|
|
2085
|
-
return /* @__PURE__ */
|
|
2075
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, shouldShowFallback && fallback, clerk2.loaded && /* @__PURE__ */ React7__default.default.createElement(
|
|
2086
2076
|
ClerkHostRenderer,
|
|
2087
2077
|
{
|
|
2088
2078
|
component,
|
|
@@ -2103,7 +2093,7 @@ withClerk(
|
|
|
2103
2093
|
const rendererRootProps = {
|
|
2104
2094
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
2105
2095
|
};
|
|
2106
|
-
return /* @__PURE__ */
|
|
2096
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, shouldShowFallback && fallback, clerk2.loaded && /* @__PURE__ */ React7__default.default.createElement(
|
|
2107
2097
|
ClerkHostRenderer,
|
|
2108
2098
|
{
|
|
2109
2099
|
component,
|
|
@@ -2124,7 +2114,7 @@ withClerk(
|
|
|
2124
2114
|
const rendererRootProps = {
|
|
2125
2115
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
2126
2116
|
};
|
|
2127
|
-
return /* @__PURE__ */
|
|
2117
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, shouldShowFallback && fallback, clerk2.loaded && /* @__PURE__ */ React7__default.default.createElement(
|
|
2128
2118
|
ClerkHostRenderer,
|
|
2129
2119
|
{
|
|
2130
2120
|
component,
|
|
@@ -2145,7 +2135,7 @@ withClerk(
|
|
|
2145
2135
|
const rendererRootProps = {
|
|
2146
2136
|
...shouldShowFallback && fallback && { style: { display: "none" } }
|
|
2147
2137
|
};
|
|
2148
|
-
return /* @__PURE__ */
|
|
2138
|
+
return /* @__PURE__ */ React7__default.default.createElement(React7__default.default.Fragment, null, shouldShowFallback && fallback, clerk2.loaded && /* @__PURE__ */ React7__default.default.createElement(
|
|
2149
2139
|
ClerkHostRenderer,
|
|
2150
2140
|
{
|
|
2151
2141
|
component,
|
|
@@ -2325,7 +2315,7 @@ withClerk(
|
|
|
2325
2315
|
return clickHandler();
|
|
2326
2316
|
};
|
|
2327
2317
|
const childProps = { ...rest, onClick: wrappedChildClickHandler };
|
|
2328
|
-
return
|
|
2318
|
+
return React7__default.default.cloneElement(child, childProps);
|
|
2329
2319
|
},
|
|
2330
2320
|
{ component: "SignInButton", renderWhileLoading: true }
|
|
2331
2321
|
);
|
|
@@ -2345,7 +2335,7 @@ withClerk(
|
|
|
2345
2335
|
return clickHandler();
|
|
2346
2336
|
};
|
|
2347
2337
|
const childProps = { ...rest, onClick: wrappedChildClickHandler };
|
|
2348
|
-
return
|
|
2338
|
+
return React7__default.default.cloneElement(child, childProps);
|
|
2349
2339
|
},
|
|
2350
2340
|
{ component: "SignInWithMetamask", renderWhileLoading: true }
|
|
2351
2341
|
);
|
|
@@ -2360,7 +2350,7 @@ withClerk(
|
|
|
2360
2350
|
return clickHandler();
|
|
2361
2351
|
};
|
|
2362
2352
|
const childProps = { ...rest, onClick: wrappedChildClickHandler };
|
|
2363
|
-
return
|
|
2353
|
+
return React7__default.default.cloneElement(child, childProps);
|
|
2364
2354
|
},
|
|
2365
2355
|
{ component: "SignOutButton", renderWhileLoading: true }
|
|
2366
2356
|
);
|
|
@@ -2407,7 +2397,7 @@ withClerk(
|
|
|
2407
2397
|
return clickHandler();
|
|
2408
2398
|
};
|
|
2409
2399
|
const childProps = { ...rest, onClick: wrappedChildClickHandler };
|
|
2410
|
-
return
|
|
2400
|
+
return React7__default.default.cloneElement(child, childProps);
|
|
2411
2401
|
},
|
|
2412
2402
|
{ component: "SignUpButton", renderWhileLoading: true }
|
|
2413
2403
|
);
|
|
@@ -2687,7 +2677,7 @@ if (typeof globalThis.__BUILD_DISABLE_RHC__ === "undefined") {
|
|
|
2687
2677
|
}
|
|
2688
2678
|
var SDK_METADATA = {
|
|
2689
2679
|
name: "@clerk/clerk-react",
|
|
2690
|
-
version: "5.56.0
|
|
2680
|
+
version: "5.56.0",
|
|
2691
2681
|
environment: process.env.NODE_ENV
|
|
2692
2682
|
};
|
|
2693
2683
|
var _status;
|
|
@@ -3921,24 +3911,24 @@ var IsomorphicClerk = _IsomorphicClerk;
|
|
|
3921
3911
|
function ClerkContextProvider(props) {
|
|
3922
3912
|
const { isomorphicClerkOptions, initialState, children } = props;
|
|
3923
3913
|
const { isomorphicClerk: clerk2, clerkStatus } = useLoadedIsomorphicClerk(isomorphicClerkOptions);
|
|
3924
|
-
const [state, setState] =
|
|
3914
|
+
const [state, setState] = React7__default.default.useState({
|
|
3925
3915
|
client: clerk2.client,
|
|
3926
3916
|
session: clerk2.session,
|
|
3927
3917
|
user: clerk2.user,
|
|
3928
3918
|
organization: clerk2.organization
|
|
3929
3919
|
});
|
|
3930
|
-
|
|
3920
|
+
React7__default.default.useEffect(() => {
|
|
3931
3921
|
return clerk2.addListener((e) => setState({ ...e }));
|
|
3932
3922
|
}, []);
|
|
3933
3923
|
const derivedState = deriveState(clerk2.loaded, state, initialState);
|
|
3934
|
-
const clerkCtx =
|
|
3924
|
+
const clerkCtx = React7__default.default.useMemo(
|
|
3935
3925
|
() => ({ value: clerk2 }),
|
|
3936
3926
|
[
|
|
3937
3927
|
// Only update the clerk reference on status change
|
|
3938
3928
|
clerkStatus
|
|
3939
3929
|
]
|
|
3940
3930
|
);
|
|
3941
|
-
const clientCtx =
|
|
3931
|
+
const clientCtx = React7__default.default.useMemo(() => ({ value: state.client }), [state.client]);
|
|
3942
3932
|
const {
|
|
3943
3933
|
sessionId,
|
|
3944
3934
|
sessionStatus,
|
|
@@ -3954,7 +3944,7 @@ function ClerkContextProvider(props) {
|
|
|
3954
3944
|
orgPermissions,
|
|
3955
3945
|
factorVerificationAge
|
|
3956
3946
|
} = derivedState;
|
|
3957
|
-
const authCtx =
|
|
3947
|
+
const authCtx = React7__default.default.useMemo(() => {
|
|
3958
3948
|
const value = {
|
|
3959
3949
|
sessionId,
|
|
3960
3950
|
sessionStatus,
|
|
@@ -3969,9 +3959,9 @@ function ClerkContextProvider(props) {
|
|
|
3969
3959
|
};
|
|
3970
3960
|
return { value };
|
|
3971
3961
|
}, [sessionId, sessionStatus, userId, actor, orgId, orgRole, orgSlug, factorVerificationAge, sessionClaims == null ? void 0 : sessionClaims.__raw]);
|
|
3972
|
-
const sessionCtx =
|
|
3973
|
-
const userCtx =
|
|
3974
|
-
const organizationCtx =
|
|
3962
|
+
const sessionCtx = React7__default.default.useMemo(() => ({ value: session }), [sessionId, session]);
|
|
3963
|
+
const userCtx = React7__default.default.useMemo(() => ({ value: user }), [userId, user]);
|
|
3964
|
+
const organizationCtx = React7__default.default.useMemo(() => {
|
|
3975
3965
|
const value = {
|
|
3976
3966
|
organization
|
|
3977
3967
|
};
|
|
@@ -3979,7 +3969,7 @@ function ClerkContextProvider(props) {
|
|
|
3979
3969
|
}, [orgId, organization]);
|
|
3980
3970
|
return (
|
|
3981
3971
|
// @ts-expect-error value passed is of type IsomorphicClerk where the context expects LoadedClerk
|
|
3982
|
-
/* @__PURE__ */
|
|
3972
|
+
/* @__PURE__ */ React7__default.default.createElement(IsomorphicClerkContext.Provider, { value: clerkCtx }, /* @__PURE__ */ React7__default.default.createElement(ClientContext.Provider, { value: clientCtx }, /* @__PURE__ */ React7__default.default.createElement(SessionContext.Provider, { value: sessionCtx }, /* @__PURE__ */ React7__default.default.createElement(OrganizationProvider, { ...organizationCtx.value }, /* @__PURE__ */ React7__default.default.createElement(AuthContext.Provider, { value: authCtx }, /* @__PURE__ */ React7__default.default.createElement(UserContext.Provider, { value: userCtx }, /* @__PURE__ */ React7__default.default.createElement(
|
|
3983
3973
|
__experimental_CheckoutProvider,
|
|
3984
3974
|
{
|
|
3985
3975
|
value: void 0
|
|
@@ -3989,15 +3979,15 @@ function ClerkContextProvider(props) {
|
|
|
3989
3979
|
);
|
|
3990
3980
|
}
|
|
3991
3981
|
var useLoadedIsomorphicClerk = (options) => {
|
|
3992
|
-
const isomorphicClerkRef =
|
|
3993
|
-
const [clerkStatus, setClerkStatus] =
|
|
3994
|
-
|
|
3982
|
+
const isomorphicClerkRef = React7__default.default.useRef(IsomorphicClerk.getOrCreateInstance(options));
|
|
3983
|
+
const [clerkStatus, setClerkStatus] = React7__default.default.useState(isomorphicClerkRef.current.status);
|
|
3984
|
+
React7__default.default.useEffect(() => {
|
|
3995
3985
|
void isomorphicClerkRef.current.__unstable__updateProps({ appearance: options.appearance });
|
|
3996
3986
|
}, [options.appearance]);
|
|
3997
|
-
|
|
3987
|
+
React7__default.default.useEffect(() => {
|
|
3998
3988
|
void isomorphicClerkRef.current.__unstable__updateProps({ options });
|
|
3999
3989
|
}, [options.localization]);
|
|
4000
|
-
|
|
3990
|
+
React7__default.default.useEffect(() => {
|
|
4001
3991
|
isomorphicClerkRef.current.on("status", setClerkStatus);
|
|
4002
3992
|
return () => {
|
|
4003
3993
|
if (isomorphicClerkRef.current) {
|
|
@@ -4018,7 +4008,7 @@ function ClerkProviderBase(props) {
|
|
|
4018
4008
|
errorThrower.throwInvalidPublishableKeyError({ key: publishableKey });
|
|
4019
4009
|
}
|
|
4020
4010
|
}
|
|
4021
|
-
return /* @__PURE__ */
|
|
4011
|
+
return /* @__PURE__ */ React7__default.default.createElement(
|
|
4022
4012
|
ClerkContextProvider,
|
|
4023
4013
|
{
|
|
4024
4014
|
initialState,
|
|
@@ -4231,7 +4221,7 @@ var BrowserStorageCache = createBrowserStorageCache();
|
|
|
4231
4221
|
var clerk;
|
|
4232
4222
|
noRhc.Clerk.sdkMetadata = {
|
|
4233
4223
|
name: "@clerk/chrome-extension",
|
|
4234
|
-
version: "2.8.2
|
|
4224
|
+
version: "2.8.2"
|
|
4235
4225
|
};
|
|
4236
4226
|
async function createClerkClient({
|
|
4237
4227
|
__experimental_syncHostListener = false,
|
|
@@ -4284,8 +4274,8 @@ async function createClerkClient({
|
|
|
4284
4274
|
function ClerkProvider2(props) {
|
|
4285
4275
|
const { children, storageCache, syncHost, __experimental_syncHostListener, ...rest } = props;
|
|
4286
4276
|
const { publishableKey = "" } = props;
|
|
4287
|
-
const [clerkInstance, setClerkInstance] =
|
|
4288
|
-
|
|
4277
|
+
const [clerkInstance, setClerkInstance] = React7__default.default.useState(null);
|
|
4278
|
+
React7__default.default.useEffect(() => {
|
|
4289
4279
|
void (async () => {
|
|
4290
4280
|
setClerkInstance(
|
|
4291
4281
|
await createClerkClient({ publishableKey, storageCache, syncHost, __experimental_syncHostListener })
|