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