@mdxui/auth 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,592 @@
1
+ // src/providers/identity-provider.tsx
2
+ import { AuthKitProvider } from "@workos-inc/authkit-react";
3
+
4
+ // src/providers/widgets-provider.tsx
5
+ import { WorkOsWidgets } from "@workos-inc/widgets";
6
+ import { useEffect, useState } from "react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ function useThemeDetection() {
9
+ const [mounted, setMounted] = useState(false);
10
+ const [isDark, setIsDark] = useState(false);
11
+ useEffect(() => {
12
+ setMounted(true);
13
+ const checkDarkMode = () => {
14
+ const isDarkClass = document.documentElement.classList.contains("dark");
15
+ const prefersDark = window.matchMedia(
16
+ "(prefers-color-scheme: dark)"
17
+ ).matches;
18
+ setIsDark(
19
+ isDarkClass || !document.documentElement.classList.contains("light") && prefersDark
20
+ );
21
+ };
22
+ checkDarkMode();
23
+ const observer = new MutationObserver(checkDarkMode);
24
+ observer.observe(document.documentElement, {
25
+ attributes: true,
26
+ attributeFilter: ["class"]
27
+ });
28
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
29
+ mediaQuery.addEventListener("change", checkDarkMode);
30
+ return () => {
31
+ observer.disconnect();
32
+ mediaQuery.removeEventListener("change", checkDarkMode);
33
+ };
34
+ }, []);
35
+ return { isDark, mounted };
36
+ }
37
+ function WidgetsProvider({
38
+ children,
39
+ appearance,
40
+ radius = "medium",
41
+ scaling = "100%"
42
+ }) {
43
+ const { isDark, mounted } = useThemeDetection();
44
+ const resolvedAppearance = appearance ?? (mounted ? isDark ? "dark" : "light" : "inherit");
45
+ return /* @__PURE__ */ jsx(
46
+ WorkOsWidgets,
47
+ {
48
+ theme: {
49
+ appearance: resolvedAppearance,
50
+ radius,
51
+ scaling
52
+ },
53
+ elements: {
54
+ primaryButton: {
55
+ variant: "solid"
56
+ },
57
+ secondaryButton: {
58
+ variant: "outline"
59
+ }
60
+ },
61
+ children
62
+ }
63
+ );
64
+ }
65
+
66
+ // src/providers/identity-provider.tsx
67
+ import { jsx as jsx2 } from "react/jsx-runtime";
68
+ function IdentityProvider({
69
+ clientId,
70
+ apiHostname,
71
+ devMode,
72
+ redirectUri,
73
+ onRedirectCallback,
74
+ children
75
+ }) {
76
+ const resolvedRedirectUri = redirectUri ?? (typeof window !== "undefined" ? window.location.origin : void 0);
77
+ const handleRedirectCallback = onRedirectCallback ?? (() => {
78
+ if (typeof window !== "undefined") {
79
+ const url = new URL(window.location.href);
80
+ url.searchParams.delete("code");
81
+ url.searchParams.delete("state");
82
+ window.history.replaceState({}, "", url.pathname);
83
+ }
84
+ });
85
+ return /* @__PURE__ */ jsx2(
86
+ AuthKitProvider,
87
+ {
88
+ clientId,
89
+ apiHostname,
90
+ devMode,
91
+ redirectUri: resolvedRedirectUri,
92
+ onRedirectCallback: handleRedirectCallback,
93
+ children: /* @__PURE__ */ jsx2(WidgetsProvider, { children })
94
+ }
95
+ );
96
+ }
97
+ function IdentityProviderMinimal({
98
+ clientId,
99
+ apiHostname,
100
+ devMode,
101
+ redirectUri,
102
+ onRedirectCallback,
103
+ children
104
+ }) {
105
+ const resolvedRedirectUri = redirectUri ?? (typeof window !== "undefined" ? window.location.origin : void 0);
106
+ const handleRedirectCallback = onRedirectCallback ?? (() => {
107
+ if (typeof window !== "undefined") {
108
+ const url = new URL(window.location.href);
109
+ url.searchParams.delete("code");
110
+ url.searchParams.delete("state");
111
+ window.history.replaceState({}, "", url.pathname);
112
+ }
113
+ });
114
+ return /* @__PURE__ */ jsx2(
115
+ AuthKitProvider,
116
+ {
117
+ clientId,
118
+ apiHostname,
119
+ devMode,
120
+ redirectUri: resolvedRedirectUri,
121
+ onRedirectCallback: handleRedirectCallback,
122
+ children
123
+ }
124
+ );
125
+ }
126
+
127
+ // src/providers/auth-gate.tsx
128
+ import { useAuth } from "@workos-inc/authkit-react";
129
+ import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
130
+ function DefaultLoadingComponent() {
131
+ return /* @__PURE__ */ jsx3("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4", children: [
132
+ /* @__PURE__ */ jsx3("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" }),
133
+ /* @__PURE__ */ jsx3("p", { className: "text-sm text-muted-foreground", children: "Loading..." })
134
+ ] }) });
135
+ }
136
+ function DefaultLandingPage() {
137
+ const { signIn } = useAuth();
138
+ return /* @__PURE__ */ jsx3("div", { className: "min-h-screen bg-background flex flex-col items-center justify-center p-4", children: /* @__PURE__ */ jsxs("div", { className: "text-center max-w-md", children: [
139
+ /* @__PURE__ */ jsx3("h1", { className: "text-3xl font-bold tracking-tight mb-4", children: "Welcome" }),
140
+ /* @__PURE__ */ jsx3("p", { className: "text-muted-foreground mb-8", children: "Sign in to access your dashboard." }),
141
+ /* @__PURE__ */ jsx3(
142
+ "button",
143
+ {
144
+ type: "button",
145
+ onClick: () => signIn(),
146
+ className: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-md)] text-sm font-medium transition-colors bg-primary text-primary-foreground hover:bg-primary/90 h-10 px-6",
147
+ children: "Sign In"
148
+ }
149
+ )
150
+ ] }) });
151
+ }
152
+ function AuthGate({
153
+ children,
154
+ required = true,
155
+ loadingComponent,
156
+ landingComponent,
157
+ onUnauthenticated = "landing",
158
+ redirectUrl
159
+ }) {
160
+ const { user, isLoading } = useAuth();
161
+ if (!required) {
162
+ return /* @__PURE__ */ jsx3(Fragment, { children });
163
+ }
164
+ if (isLoading) {
165
+ return /* @__PURE__ */ jsx3(Fragment, { children: loadingComponent ?? /* @__PURE__ */ jsx3(DefaultLoadingComponent, {}) });
166
+ }
167
+ if (user) {
168
+ return /* @__PURE__ */ jsx3(Fragment, { children });
169
+ }
170
+ switch (onUnauthenticated) {
171
+ case "redirect":
172
+ if (redirectUrl && typeof window !== "undefined") {
173
+ window.location.href = redirectUrl;
174
+ return /* @__PURE__ */ jsx3("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ jsx3("p", { className: "text-sm text-muted-foreground", children: "Redirecting..." }) });
175
+ }
176
+ return /* @__PURE__ */ jsx3(Fragment, { children: landingComponent ?? /* @__PURE__ */ jsx3(DefaultLandingPage, {}) });
177
+ case "allow":
178
+ return /* @__PURE__ */ jsx3(Fragment, { children });
179
+ case "landing":
180
+ default:
181
+ return /* @__PURE__ */ jsx3(Fragment, { children: landingComponent ?? /* @__PURE__ */ jsx3(DefaultLandingPage, {}) });
182
+ }
183
+ }
184
+
185
+ // src/widgets/user-profile.tsx
186
+ import { UserProfile as WorkOSUserProfile } from "@workos-inc/widgets";
187
+ import { jsx as jsx4 } from "react/jsx-runtime";
188
+ function UserProfile({ authToken, className }) {
189
+ return /* @__PURE__ */ jsx4("div", { className, children: /* @__PURE__ */ jsx4(WorkOSUserProfile, { authToken }) });
190
+ }
191
+
192
+ // src/widgets/user-security.tsx
193
+ import { UserSecurity as WorkOSUserSecurity } from "@workos-inc/widgets";
194
+ import { jsx as jsx5 } from "react/jsx-runtime";
195
+ function UserSecurity({ authToken, className }) {
196
+ return /* @__PURE__ */ jsx5("div", { className, children: /* @__PURE__ */ jsx5(WorkOSUserSecurity, { authToken }) });
197
+ }
198
+
199
+ // src/widgets/user-sessions.tsx
200
+ import { UserSessions as WorkOSUserSessions } from "@workos-inc/widgets";
201
+ import { jsx as jsx6 } from "react/jsx-runtime";
202
+ function UserSessions(props) {
203
+ const { className, ...rest } = props;
204
+ return /* @__PURE__ */ jsx6("div", { className, children: /* @__PURE__ */ jsx6(WorkOSUserSessions, { ...rest }) });
205
+ }
206
+
207
+ // src/widgets/api-keys.tsx
208
+ import { ApiKeys as WorkOSApiKeys } from "@workos-inc/widgets";
209
+ import { jsx as jsx7 } from "react/jsx-runtime";
210
+ function ApiKeys({ authToken, className }) {
211
+ return /* @__PURE__ */ jsx7("div", { className, children: /* @__PURE__ */ jsx7(WorkOSApiKeys, { authToken }) });
212
+ }
213
+
214
+ // src/widgets/users-management.tsx
215
+ import { UsersManagement as WorkOSUsersManagement } from "@workos-inc/widgets";
216
+ import { jsx as jsx8 } from "react/jsx-runtime";
217
+ function UsersManagement({
218
+ authToken,
219
+ organizationId: _organizationId,
220
+ className
221
+ }) {
222
+ return /* @__PURE__ */ jsx8("div", { className, children: /* @__PURE__ */ jsx8(WorkOSUsersManagement, { authToken }) });
223
+ }
224
+
225
+ // src/widgets/pipes.tsx
226
+ import { Pipes as WorkOSPipes } from "@workos-inc/widgets";
227
+ import { jsx as jsx9 } from "react/jsx-runtime";
228
+ function Pipes({ authToken, className }) {
229
+ return /* @__PURE__ */ jsx9("div", { className, children: /* @__PURE__ */ jsx9(WorkOSPipes, { authToken }) });
230
+ }
231
+
232
+ // src/widgets/organization-switcher.tsx
233
+ import { OrganizationSwitcher as WorkOSOrganizationSwitcher } from "@workos-inc/widgets";
234
+ import { jsx as jsx10 } from "react/jsx-runtime";
235
+ function OrganizationSwitcher({
236
+ authToken,
237
+ switchToOrganization,
238
+ variant,
239
+ organizationLabel,
240
+ truncateBehavior,
241
+ className
242
+ }) {
243
+ return /* @__PURE__ */ jsx10("div", { className, children: /* @__PURE__ */ jsx10(
244
+ WorkOSOrganizationSwitcher,
245
+ {
246
+ authToken,
247
+ switchToOrganization,
248
+ variant,
249
+ organizationLabel,
250
+ truncateBehavior
251
+ }
252
+ ) });
253
+ }
254
+
255
+ // src/components/sign-in-button.tsx
256
+ import { useAuth as useAuth2 } from "@workos-inc/authkit-react";
257
+ import { jsx as jsx11 } from "react/jsx-runtime";
258
+ function SignInButton({
259
+ children = "Sign In",
260
+ onSignIn,
261
+ className,
262
+ disabled,
263
+ ...props
264
+ }) {
265
+ const { signIn, isLoading } = useAuth2();
266
+ const handleClick = () => {
267
+ onSignIn?.();
268
+ signIn();
269
+ };
270
+ return /* @__PURE__ */ jsx11(
271
+ "button",
272
+ {
273
+ type: "button",
274
+ onClick: handleClick,
275
+ disabled: disabled || isLoading,
276
+ className: className ?? "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-md)] text-sm font-medium transition-colors bg-primary text-primary-foreground hover:bg-primary/90 h-10 px-4 disabled:opacity-50 disabled:pointer-events-none",
277
+ ...props,
278
+ children
279
+ }
280
+ );
281
+ }
282
+
283
+ // src/components/sign-out-button.tsx
284
+ import { useAuth as useAuth3 } from "@workos-inc/authkit-react";
285
+ import { jsx as jsx12 } from "react/jsx-runtime";
286
+ function SignOutButton({
287
+ children = "Sign Out",
288
+ onSignOut,
289
+ className,
290
+ disabled,
291
+ ...props
292
+ }) {
293
+ const { signOut, isLoading } = useAuth3();
294
+ const handleClick = () => {
295
+ onSignOut?.();
296
+ signOut();
297
+ };
298
+ return /* @__PURE__ */ jsx12(
299
+ "button",
300
+ {
301
+ type: "button",
302
+ onClick: handleClick,
303
+ disabled: disabled || isLoading,
304
+ className: className ?? "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-md)] text-sm font-medium transition-colors bg-secondary text-secondary-foreground hover:bg-secondary/80 h-10 px-4 disabled:opacity-50 disabled:pointer-events-none",
305
+ ...props,
306
+ children
307
+ }
308
+ );
309
+ }
310
+
311
+ // src/components/user-menu.tsx
312
+ import { useAuth as useAuth4 } from "@workos-inc/authkit-react";
313
+ import { jsx as jsx13, jsxs as jsxs2 } from "react/jsx-runtime";
314
+ function getInitials(name) {
315
+ if (!name) return "?";
316
+ const parts = name.trim().split(/\s+/);
317
+ if (parts.length === 1) return parts[0].charAt(0).toUpperCase();
318
+ return (parts[0].charAt(0) + parts[parts.length - 1].charAt(0)).toUpperCase();
319
+ }
320
+ function UserMenu({ renderTrigger, renderMenu, className }) {
321
+ const { user, signOut, isLoading } = useAuth4();
322
+ if (isLoading) {
323
+ return /* @__PURE__ */ jsx13("div", { className, children: /* @__PURE__ */ jsx13("div", { className: "flex items-center gap-2 p-2", children: /* @__PURE__ */ jsx13("div", { className: "h-8 w-8 animate-pulse rounded-full bg-muted" }) }) });
324
+ }
325
+ if (!user) {
326
+ return null;
327
+ }
328
+ const displayName = user.firstName ? `${user.firstName}${user.lastName ? ` ${user.lastName}` : ""}` : user.email;
329
+ const initials = getInitials(
330
+ user.firstName ? `${user.firstName} ${user.lastName ?? ""}` : user.email
331
+ );
332
+ const triggerProps = { user, displayName, initials };
333
+ const menuProps = { user, displayName, initials, signOut };
334
+ if (!renderTrigger && !renderMenu) {
335
+ return /* @__PURE__ */ jsx13("div", { className, children: /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 p-2", children: [
336
+ /* @__PURE__ */ jsx13("div", { className: "h-8 w-8 rounded-full bg-muted flex items-center justify-center text-sm font-medium", children: user.profilePictureUrl ? /* @__PURE__ */ jsx13(
337
+ "img",
338
+ {
339
+ src: user.profilePictureUrl,
340
+ alt: displayName,
341
+ className: "h-full w-full rounded-full object-cover"
342
+ }
343
+ ) : initials }),
344
+ /* @__PURE__ */ jsxs2("div", { className: "text-sm", children: [
345
+ /* @__PURE__ */ jsx13("p", { className: "font-medium", children: displayName }),
346
+ /* @__PURE__ */ jsx13("p", { className: "text-muted-foreground text-xs", children: user.email })
347
+ ] }),
348
+ /* @__PURE__ */ jsx13(
349
+ "button",
350
+ {
351
+ type: "button",
352
+ onClick: () => signOut(),
353
+ className: "ml-auto text-sm text-muted-foreground hover:text-foreground",
354
+ children: "Sign out"
355
+ }
356
+ )
357
+ ] }) });
358
+ }
359
+ return /* @__PURE__ */ jsxs2("div", { className, children: [
360
+ renderTrigger?.(triggerProps),
361
+ renderMenu?.(menuProps)
362
+ ] });
363
+ }
364
+
365
+ // src/components/team-switcher.tsx
366
+ import { useAuth as useAuth5 } from "@workos-inc/authkit-react";
367
+ import { OrganizationSwitcher as OrganizationSwitcher2 } from "@workos-inc/widgets";
368
+ import { jsx as jsx14 } from "react/jsx-runtime";
369
+ function TeamSwitcher({
370
+ renderWrapper,
371
+ renderNoOrganization,
372
+ className
373
+ }) {
374
+ const { getAccessToken, switchToOrganization, organizationId } = useAuth5();
375
+ if (!organizationId) {
376
+ return renderNoOrganization?.() ?? null;
377
+ }
378
+ const handleSwitchOrganization = ({
379
+ organizationId: organizationId2
380
+ }) => {
381
+ return switchToOrganization({ organizationId: organizationId2 });
382
+ };
383
+ const widget = /* @__PURE__ */ jsx14("div", { className: `organization-switcher-wrapper ${className ?? ""}`, children: /* @__PURE__ */ jsx14(
384
+ OrganizationSwitcher2,
385
+ {
386
+ authToken: getAccessToken,
387
+ switchToOrganization: handleSwitchOrganization
388
+ }
389
+ ) });
390
+ return renderWrapper ? renderWrapper(widget) : widget;
391
+ }
392
+
393
+ // src/hooks/use-auth.ts
394
+ import { useAuth as useAuth6 } from "@workos-inc/authkit-react";
395
+
396
+ // src/hooks/use-widget-token.ts
397
+ import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
398
+ function useWidgetToken({
399
+ widget,
400
+ organizationId,
401
+ endpoint = "/api/workos/widget-token"
402
+ }) {
403
+ const [token, setToken] = useState2(null);
404
+ const [loading, setLoading] = useState2(true);
405
+ const [error, setError] = useState2(null);
406
+ const fetchToken = useCallback(async () => {
407
+ try {
408
+ setLoading(true);
409
+ setError(null);
410
+ const params = new URLSearchParams({ widget });
411
+ if (organizationId) {
412
+ params.set("organizationId", organizationId);
413
+ }
414
+ const response = await fetch(`${endpoint}?${params}`);
415
+ const data = await response.json();
416
+ if (!response.ok) {
417
+ throw new Error(data.error || "Failed to fetch token");
418
+ }
419
+ setToken(data.token);
420
+ } catch (err) {
421
+ setError(err instanceof Error ? err.message : "Token fetch failed");
422
+ } finally {
423
+ setLoading(false);
424
+ }
425
+ }, [widget, organizationId, endpoint]);
426
+ useEffect2(() => {
427
+ fetchToken();
428
+ }, [fetchToken]);
429
+ return { token, loading, error, refetch: fetchToken };
430
+ }
431
+
432
+ // src/schemas/auth-user.ts
433
+ import { z } from "zod";
434
+ import { UserIdentitySchema } from "mdxui/zod";
435
+ var AuthUserSchema = UserIdentitySchema.extend({
436
+ // Override to be more specific (WorkOS guarantees string ID)
437
+ id: z.string().describe("User ID from WorkOS"),
438
+ // WorkOS requires email (not optional like UserIdentity)
439
+ email: z.string().email().describe("Email address"),
440
+ // WorkOS-specific fields not in UserIdentity
441
+ emailVerified: z.boolean().describe("Email verification status"),
442
+ // Timestamps
443
+ createdAt: z.string().datetime().describe("Account creation timestamp"),
444
+ updatedAt: z.string().datetime().describe("Last update timestamp"),
445
+ lastSignInAt: z.string().datetime().nullable().optional().describe("Last sign-in timestamp")
446
+ });
447
+
448
+ // src/schemas/auth-session.ts
449
+ import { z as z2 } from "zod";
450
+ import { SessionSchema } from "mdxui/zod";
451
+ var ImpersonatorSchema = z2.object({
452
+ /** Impersonator's email address */
453
+ email: z2.string().email().describe("Impersonator's email address"),
454
+ /** Reason for impersonation */
455
+ reason: z2.string().optional().describe("Reason for impersonation")
456
+ });
457
+ var AuthSessionSchema = SessionSchema.extend({
458
+ // Override userId to be string (WorkOS uses string IDs)
459
+ userId: z2.string().describe("User ID"),
460
+ // WorkOS-specific: impersonation support
461
+ impersonator: ImpersonatorSchema.optional().describe(
462
+ "Impersonator info (if being impersonated)"
463
+ )
464
+ });
465
+
466
+ // src/schemas/auth-organization.ts
467
+ import { z as z3 } from "zod";
468
+ var AuthOrganizationSchema = z3.object({
469
+ /** Organization ID */
470
+ id: z3.string().describe("Organization ID"),
471
+ /** Organization display name */
472
+ name: z3.string().describe("Organization name"),
473
+ /** Organization slug (URL-friendly identifier) */
474
+ slug: z3.string().optional().describe("Organization slug"),
475
+ /** Organization logo URL */
476
+ logoUrl: z3.string().url().optional().describe("Organization logo URL"),
477
+ /** Whether the organization is active */
478
+ active: z3.boolean().optional().describe("Whether organization is active"),
479
+ /** Custom domains for the organization */
480
+ domains: z3.array(z3.string()).optional().describe("Custom domains for the organization"),
481
+ /** Additional metadata */
482
+ metadata: z3.record(z3.string(), z3.unknown()).optional().describe("Additional metadata")
483
+ });
484
+
485
+ // src/schemas/provider-props.ts
486
+ import { z as z4 } from "zod";
487
+ var IdentityProviderPropsSchema = z4.object({
488
+ /** WorkOS client ID */
489
+ clientId: z4.string().describe("WorkOS client ID"),
490
+ /** Optional API hostname override */
491
+ apiHostname: z4.string().optional().describe("Optional API hostname override"),
492
+ /** Enable dev mode for local development */
493
+ devMode: z4.boolean().optional().describe("Enable dev mode for local development"),
494
+ /** Redirect URI after authentication */
495
+ redirectUri: z4.string().url().optional().describe("Redirect URI after authentication")
496
+ /** Note: onRedirectCallback and children are React-specific, not in schema */
497
+ });
498
+ var UnauthenticatedActionSchema = z4.enum(["landing", "redirect", "allow"]);
499
+ var AuthGatePropsSchema = z4.object({
500
+ /** Whether authentication is required (default: true) */
501
+ required: z4.boolean().optional().describe("Whether authentication is required"),
502
+ /** What to do when unauthenticated */
503
+ onUnauthenticated: UnauthenticatedActionSchema.optional().describe(
504
+ "What to do when unauthenticated"
505
+ ),
506
+ /** URL to redirect to when unauthenticated (if onUnauthenticated is "redirect") */
507
+ redirectUrl: z4.string().url().optional().describe("URL to redirect to when unauthenticated")
508
+ /** Note: children, loadingComponent, landingComponent are React-specific */
509
+ });
510
+ var AppearanceSchema = z4.enum(["light", "dark", "inherit"]);
511
+ var RadiusSchema = z4.enum(["none", "small", "medium", "large", "full"]);
512
+ var ScalingSchema = z4.enum(["90%", "95%", "100%", "105%", "110%"]);
513
+ var WidgetsProviderPropsSchema = z4.object({
514
+ /** Theme appearance mode */
515
+ appearance: AppearanceSchema.optional().describe("Theme appearance mode"),
516
+ /** Border radius style */
517
+ radius: RadiusSchema.optional().describe("Border radius style"),
518
+ /** Scaling factor */
519
+ scaling: ScalingSchema.optional().describe("Scaling factor")
520
+ /** Note: children is React-specific, not in schema */
521
+ });
522
+
523
+ // src/schemas/widget-props.ts
524
+ import { z as z5 } from "zod";
525
+ var AuthTokenSchema = z5.union([
526
+ z5.string().describe("Static auth token"),
527
+ z5.literal("function").describe("Token getter function")
528
+ ]);
529
+ var BaseWidgetPropsSchema = z5.object({
530
+ /** Auth token for the widget (string or getter function) */
531
+ authToken: z5.string().describe("Auth token for the widget"),
532
+ /** CSS class name */
533
+ className: z5.string().optional().describe("CSS class name")
534
+ });
535
+ var OrganizationWidgetPropsSchema = BaseWidgetPropsSchema.extend({
536
+ /** Organization ID for org-scoped widgets */
537
+ organizationId: z5.string().optional().describe("Organization ID for org-scoped widgets")
538
+ });
539
+ var UseWidgetTokenOptionsSchema = z5.object({
540
+ /** Widget type to fetch token for */
541
+ widget: z5.string().describe("Widget type to fetch token for"),
542
+ /** Organization ID for org-scoped widgets */
543
+ organizationId: z5.string().optional().describe("Organization ID for org-scoped widgets"),
544
+ /** Custom endpoint for fetching widget token */
545
+ endpoint: z5.string().url().optional().describe("Custom endpoint for fetching widget token")
546
+ });
547
+ var UseWidgetTokenResultSchema = z5.object({
548
+ /** The fetched token */
549
+ token: z5.string().nullable().describe("The fetched token"),
550
+ /** Whether token is being fetched */
551
+ loading: z5.boolean().describe("Whether token is being fetched"),
552
+ /** Error message if fetch failed */
553
+ error: z5.string().nullable().describe("Error message if fetch failed")
554
+ /** Note: refetch function is React-specific, not in schema */
555
+ });
556
+ export {
557
+ ApiKeys,
558
+ AppearanceSchema,
559
+ AuthGate,
560
+ AuthGatePropsSchema,
561
+ AuthOrganizationSchema,
562
+ AuthSessionSchema,
563
+ AuthTokenSchema,
564
+ AuthUserSchema,
565
+ BaseWidgetPropsSchema,
566
+ IdentityProvider,
567
+ IdentityProviderMinimal,
568
+ IdentityProviderPropsSchema,
569
+ ImpersonatorSchema,
570
+ OrganizationSwitcher,
571
+ OrganizationWidgetPropsSchema,
572
+ Pipes,
573
+ RadiusSchema,
574
+ ScalingSchema,
575
+ SignInButton,
576
+ SignOutButton,
577
+ TeamSwitcher,
578
+ UnauthenticatedActionSchema,
579
+ UseWidgetTokenOptionsSchema,
580
+ UseWidgetTokenResultSchema,
581
+ UserMenu,
582
+ UserProfile,
583
+ UserSecurity,
584
+ UserSessions,
585
+ UsersManagement,
586
+ WidgetsProvider,
587
+ WidgetsProviderPropsSchema,
588
+ useAuth6 as useAuth,
589
+ useThemeDetection,
590
+ useWidgetToken
591
+ };
592
+ //# sourceMappingURL=index.js.map