@mdxui/auth 1.4.2 → 1.5.1
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/app/assets/{index-C6xHcx9J.js → index-Dfkrf_Pt.js} +62 -62
- package/app/assets/{index-C6xHcx9J.js.map → index-Dfkrf_Pt.js.map} +1 -1
- package/app/index.html +1 -1
- package/dist/index.js +120 -81
- package/dist/index.js.map +1 -1
- package/dist/providers/index.js +0 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/shell/index.d.ts +19 -14
- package/dist/shell/index.js +152 -113
- package/dist/shell/index.js.map +1 -1
- package/package.json +18 -17
package/dist/shell/index.js
CHANGED
|
@@ -4,16 +4,16 @@ import { createContext, useContext, useMemo } from "react";
|
|
|
4
4
|
// src/shell/route-presets.ts
|
|
5
5
|
import { Key, Monitor, Plug, Shield, User, Users } from "lucide-react";
|
|
6
6
|
|
|
7
|
-
// src/widgets/user-profile.tsx
|
|
8
|
-
import { UserProfile as WorkOSUserProfile } from "@workos-inc/widgets";
|
|
9
|
-
import { jsx } from "react/jsx-runtime";
|
|
10
|
-
function UserProfile({ authToken, className }) {
|
|
11
|
-
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(WorkOSUserProfile, { authToken }) });
|
|
12
|
-
}
|
|
13
|
-
|
|
14
7
|
// src/hooks/use-auth.ts
|
|
15
8
|
import { useAuth } from "@workos-inc/authkit-react";
|
|
16
9
|
|
|
10
|
+
// src/widgets/api-keys.tsx
|
|
11
|
+
import { ApiKeys as WorkOSApiKeys } from "@workos-inc/widgets";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
function ApiKeys({ authToken, className }) {
|
|
14
|
+
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(WorkOSApiKeys, { authToken }) });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
17
|
// src/shell/components/breadcrumbs.tsx
|
|
18
18
|
import { WebLink } from "@mdxui/navigation/web";
|
|
19
19
|
import {
|
|
@@ -181,9 +181,9 @@ var WidgetErrorBoundary = class extends Component {
|
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
183
|
|
|
184
|
-
// src/shell/pages/
|
|
184
|
+
// src/shell/pages/api-keys-page.tsx
|
|
185
185
|
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
186
|
-
function
|
|
186
|
+
function ApiKeysPage() {
|
|
187
187
|
const { user, getAccessToken, isLoading } = useAuth();
|
|
188
188
|
if (isLoading) {
|
|
189
189
|
return /* @__PURE__ */ jsx6("div", { className: "flex items-center justify-center py-12 text-muted-foreground", children: "Loading..." });
|
|
@@ -191,31 +191,31 @@ function ProfilePage() {
|
|
|
191
191
|
if (!user) {
|
|
192
192
|
return /* @__PURE__ */ jsxs4("div", { className: "container max-w-4xl py-8", children: [
|
|
193
193
|
/* @__PURE__ */ jsxs4("div", { className: "mb-8", children: [
|
|
194
|
-
/* @__PURE__ */ jsx6("h1", { className: "text-2xl font-semibold tracking-tight", children: "
|
|
195
|
-
/* @__PURE__ */ jsx6("p", { className: "text-muted-foreground", children: "
|
|
194
|
+
/* @__PURE__ */ jsx6("h1", { className: "text-2xl font-semibold tracking-tight", children: "API Keys" }),
|
|
195
|
+
/* @__PURE__ */ jsx6("p", { className: "text-muted-foreground", children: "Create and manage your API keys" })
|
|
196
196
|
] }),
|
|
197
|
-
/* @__PURE__ */ jsx6("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx6("p", { className: "text-muted-foreground text-sm", children: "Please sign in to
|
|
197
|
+
/* @__PURE__ */ jsx6("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx6("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your API keys." }) })
|
|
198
198
|
] });
|
|
199
199
|
}
|
|
200
200
|
return /* @__PURE__ */ jsxs4("div", { className: "container max-w-4xl py-8", children: [
|
|
201
201
|
/* @__PURE__ */ jsxs4("div", { className: "mb-8", children: [
|
|
202
|
-
/* @__PURE__ */ jsx6("h1", { className: "text-2xl font-semibold tracking-tight", children: "
|
|
203
|
-
/* @__PURE__ */ jsx6("p", { className: "text-muted-foreground", children: "
|
|
202
|
+
/* @__PURE__ */ jsx6("h1", { className: "text-2xl font-semibold tracking-tight", children: "API Keys" }),
|
|
203
|
+
/* @__PURE__ */ jsx6("p", { className: "text-muted-foreground", children: "Create and manage your API keys" })
|
|
204
204
|
] }),
|
|
205
|
-
/* @__PURE__ */ jsx6(WidgetErrorBoundary, { widgetName: "
|
|
205
|
+
/* @__PURE__ */ jsx6(WidgetErrorBoundary, { widgetName: "api-keys", children: /* @__PURE__ */ jsx6(ApiKeys, { authToken: getAccessToken }) })
|
|
206
206
|
] });
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
// src/widgets/
|
|
210
|
-
import {
|
|
209
|
+
// src/widgets/pipes.tsx
|
|
210
|
+
import { Pipes as WorkOSPipes } from "@workos-inc/widgets";
|
|
211
211
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
212
|
-
function
|
|
213
|
-
return /* @__PURE__ */ jsx7("div", { className, children: /* @__PURE__ */ jsx7(
|
|
212
|
+
function Pipes({ authToken, className }) {
|
|
213
|
+
return /* @__PURE__ */ jsx7("div", { className, children: /* @__PURE__ */ jsx7(WorkOSPipes, { authToken }) });
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
// src/shell/pages/
|
|
216
|
+
// src/shell/pages/integrations-page.tsx
|
|
217
217
|
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
218
|
-
function
|
|
218
|
+
function IntegrationsPage() {
|
|
219
219
|
const { user, getAccessToken, isLoading } = useAuth();
|
|
220
220
|
if (isLoading) {
|
|
221
221
|
return /* @__PURE__ */ jsx8("div", { className: "flex items-center justify-center py-12 text-muted-foreground", children: "Loading..." });
|
|
@@ -223,32 +223,31 @@ function SecurityPage() {
|
|
|
223
223
|
if (!user) {
|
|
224
224
|
return /* @__PURE__ */ jsxs5("div", { className: "container max-w-4xl py-8", children: [
|
|
225
225
|
/* @__PURE__ */ jsxs5("div", { className: "mb-8", children: [
|
|
226
|
-
/* @__PURE__ */ jsx8("h1", { className: "text-2xl font-semibold tracking-tight", children: "
|
|
227
|
-
/* @__PURE__ */ jsx8("p", { className: "text-muted-foreground", children: "
|
|
226
|
+
/* @__PURE__ */ jsx8("h1", { className: "text-2xl font-semibold tracking-tight", children: "Integrations" }),
|
|
227
|
+
/* @__PURE__ */ jsx8("p", { className: "text-muted-foreground", children: "Connect and manage third-party services" })
|
|
228
228
|
] }),
|
|
229
|
-
/* @__PURE__ */ jsx8("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx8("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your
|
|
229
|
+
/* @__PURE__ */ jsx8("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx8("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your integrations." }) })
|
|
230
230
|
] });
|
|
231
231
|
}
|
|
232
232
|
return /* @__PURE__ */ jsxs5("div", { className: "container max-w-4xl py-8", children: [
|
|
233
233
|
/* @__PURE__ */ jsxs5("div", { className: "mb-8", children: [
|
|
234
|
-
/* @__PURE__ */ jsx8("h1", { className: "text-2xl font-semibold tracking-tight", children: "
|
|
235
|
-
/* @__PURE__ */ jsx8("p", { className: "text-muted-foreground", children: "
|
|
234
|
+
/* @__PURE__ */ jsx8("h1", { className: "text-2xl font-semibold tracking-tight", children: "Integrations" }),
|
|
235
|
+
/* @__PURE__ */ jsx8("p", { className: "text-muted-foreground", children: "Connect and manage third-party services" })
|
|
236
236
|
] }),
|
|
237
|
-
/* @__PURE__ */ jsx8(WidgetErrorBoundary, { widgetName: "
|
|
237
|
+
/* @__PURE__ */ jsx8(WidgetErrorBoundary, { widgetName: "integrations", children: /* @__PURE__ */ jsx8(Pipes, { authToken: getAccessToken }) })
|
|
238
238
|
] });
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
// src/widgets/user-
|
|
242
|
-
import {
|
|
241
|
+
// src/widgets/user-profile.tsx
|
|
242
|
+
import { UserProfile as WorkOSUserProfile } from "@workos-inc/widgets";
|
|
243
243
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
244
|
-
function
|
|
245
|
-
|
|
246
|
-
return /* @__PURE__ */ jsx9("div", { className, children: /* @__PURE__ */ jsx9(WorkOSUserSessions, { ...rest }) });
|
|
244
|
+
function UserProfile({ authToken, className }) {
|
|
245
|
+
return /* @__PURE__ */ jsx9("div", { className, children: /* @__PURE__ */ jsx9(WorkOSUserProfile, { authToken }) });
|
|
247
246
|
}
|
|
248
247
|
|
|
249
|
-
// src/shell/pages/
|
|
248
|
+
// src/shell/pages/profile-page.tsx
|
|
250
249
|
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
251
|
-
function
|
|
250
|
+
function ProfilePage() {
|
|
252
251
|
const { user, getAccessToken, isLoading } = useAuth();
|
|
253
252
|
if (isLoading) {
|
|
254
253
|
return /* @__PURE__ */ jsx10("div", { className: "flex items-center justify-center py-12 text-muted-foreground", children: "Loading..." });
|
|
@@ -256,31 +255,31 @@ function SessionsPage() {
|
|
|
256
255
|
if (!user) {
|
|
257
256
|
return /* @__PURE__ */ jsxs6("div", { className: "container max-w-4xl py-8", children: [
|
|
258
257
|
/* @__PURE__ */ jsxs6("div", { className: "mb-8", children: [
|
|
259
|
-
/* @__PURE__ */ jsx10("h1", { className: "text-2xl font-semibold tracking-tight", children: "
|
|
260
|
-
/* @__PURE__ */ jsx10("p", { className: "text-muted-foreground", children: "
|
|
258
|
+
/* @__PURE__ */ jsx10("h1", { className: "text-2xl font-semibold tracking-tight", children: "Profile" }),
|
|
259
|
+
/* @__PURE__ */ jsx10("p", { className: "text-muted-foreground", children: "Manage your account information" })
|
|
261
260
|
] }),
|
|
262
|
-
/* @__PURE__ */ jsx10("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx10("p", { className: "text-muted-foreground text-sm", children: "Please sign in to view your
|
|
261
|
+
/* @__PURE__ */ jsx10("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx10("p", { className: "text-muted-foreground text-sm", children: "Please sign in to view your profile." }) })
|
|
263
262
|
] });
|
|
264
263
|
}
|
|
265
264
|
return /* @__PURE__ */ jsxs6("div", { className: "container max-w-4xl py-8", children: [
|
|
266
265
|
/* @__PURE__ */ jsxs6("div", { className: "mb-8", children: [
|
|
267
|
-
/* @__PURE__ */ jsx10("h1", { className: "text-2xl font-semibold tracking-tight", children: "
|
|
268
|
-
/* @__PURE__ */ jsx10("p", { className: "text-muted-foreground", children: "
|
|
266
|
+
/* @__PURE__ */ jsx10("h1", { className: "text-2xl font-semibold tracking-tight", children: "Profile" }),
|
|
267
|
+
/* @__PURE__ */ jsx10("p", { className: "text-muted-foreground", children: "Manage your account information" })
|
|
269
268
|
] }),
|
|
270
|
-
/* @__PURE__ */ jsx10(WidgetErrorBoundary, { widgetName: "
|
|
269
|
+
/* @__PURE__ */ jsx10(WidgetErrorBoundary, { widgetName: "profile", children: /* @__PURE__ */ jsx10(UserProfile, { authToken: getAccessToken }) })
|
|
271
270
|
] });
|
|
272
271
|
}
|
|
273
272
|
|
|
274
|
-
// src/widgets/
|
|
275
|
-
import {
|
|
273
|
+
// src/widgets/user-security.tsx
|
|
274
|
+
import { UserSecurity as WorkOSUserSecurity } from "@workos-inc/widgets";
|
|
276
275
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
277
|
-
function
|
|
278
|
-
return /* @__PURE__ */ jsx11("div", { className, children: /* @__PURE__ */ jsx11(
|
|
276
|
+
function UserSecurity({ authToken, className }) {
|
|
277
|
+
return /* @__PURE__ */ jsx11("div", { className, children: /* @__PURE__ */ jsx11(WorkOSUserSecurity, { authToken }) });
|
|
279
278
|
}
|
|
280
279
|
|
|
281
|
-
// src/shell/pages/
|
|
280
|
+
// src/shell/pages/security-page.tsx
|
|
282
281
|
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
283
|
-
function
|
|
282
|
+
function SecurityPage() {
|
|
284
283
|
const { user, getAccessToken, isLoading } = useAuth();
|
|
285
284
|
if (isLoading) {
|
|
286
285
|
return /* @__PURE__ */ jsx12("div", { className: "flex items-center justify-center py-12 text-muted-foreground", children: "Loading..." });
|
|
@@ -288,106 +287,107 @@ function ApiKeysPage() {
|
|
|
288
287
|
if (!user) {
|
|
289
288
|
return /* @__PURE__ */ jsxs7("div", { className: "container max-w-4xl py-8", children: [
|
|
290
289
|
/* @__PURE__ */ jsxs7("div", { className: "mb-8", children: [
|
|
291
|
-
/* @__PURE__ */ jsx12("h1", { className: "text-2xl font-semibold tracking-tight", children: "
|
|
292
|
-
/* @__PURE__ */ jsx12("p", { className: "text-muted-foreground", children: "
|
|
290
|
+
/* @__PURE__ */ jsx12("h1", { className: "text-2xl font-semibold tracking-tight", children: "Security" }),
|
|
291
|
+
/* @__PURE__ */ jsx12("p", { className: "text-muted-foreground", children: "Manage your password and authentication settings" })
|
|
293
292
|
] }),
|
|
294
|
-
/* @__PURE__ */ jsx12("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx12("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your
|
|
293
|
+
/* @__PURE__ */ jsx12("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx12("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your security settings." }) })
|
|
295
294
|
] });
|
|
296
295
|
}
|
|
297
296
|
return /* @__PURE__ */ jsxs7("div", { className: "container max-w-4xl py-8", children: [
|
|
298
297
|
/* @__PURE__ */ jsxs7("div", { className: "mb-8", children: [
|
|
299
|
-
/* @__PURE__ */ jsx12("h1", { className: "text-2xl font-semibold tracking-tight", children: "
|
|
300
|
-
/* @__PURE__ */ jsx12("p", { className: "text-muted-foreground", children: "
|
|
298
|
+
/* @__PURE__ */ jsx12("h1", { className: "text-2xl font-semibold tracking-tight", children: "Security" }),
|
|
299
|
+
/* @__PURE__ */ jsx12("p", { className: "text-muted-foreground", children: "Manage your password and authentication settings" })
|
|
301
300
|
] }),
|
|
302
|
-
/* @__PURE__ */ jsx12(WidgetErrorBoundary, { widgetName: "
|
|
301
|
+
/* @__PURE__ */ jsx12(WidgetErrorBoundary, { widgetName: "security", children: /* @__PURE__ */ jsx12(UserSecurity, { authToken: getAccessToken }) })
|
|
303
302
|
] });
|
|
304
303
|
}
|
|
305
304
|
|
|
306
|
-
// src/widgets/
|
|
307
|
-
import {
|
|
305
|
+
// src/widgets/user-sessions.tsx
|
|
306
|
+
import { UserSessions as WorkOSUserSessions } from "@workos-inc/widgets";
|
|
308
307
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
309
|
-
function
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
className
|
|
313
|
-
}) {
|
|
314
|
-
return /* @__PURE__ */ jsx13("div", { className, children: /* @__PURE__ */ jsx13(WorkOSUsersManagement, { authToken }) });
|
|
308
|
+
function UserSessions(props) {
|
|
309
|
+
const { className, ...rest } = props;
|
|
310
|
+
return /* @__PURE__ */ jsx13("div", { className, children: /* @__PURE__ */ jsx13(WorkOSUserSessions, { ...rest }) });
|
|
315
311
|
}
|
|
316
312
|
|
|
317
|
-
// src/shell/pages/
|
|
313
|
+
// src/shell/pages/sessions-page.tsx
|
|
318
314
|
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
319
|
-
function
|
|
320
|
-
const { user, getAccessToken, isLoading
|
|
321
|
-
const hasOrganization = !!organizationId;
|
|
322
|
-
const canManageTeam = hasOrganization && permissions?.includes("widgets:users-table:manage");
|
|
315
|
+
function SessionsPage() {
|
|
316
|
+
const { user, getAccessToken, isLoading } = useAuth();
|
|
323
317
|
if (isLoading) {
|
|
324
318
|
return /* @__PURE__ */ jsx14("div", { className: "flex items-center justify-center py-12 text-muted-foreground", children: "Loading..." });
|
|
325
319
|
}
|
|
326
320
|
if (!user) {
|
|
327
321
|
return /* @__PURE__ */ jsxs8("div", { className: "container max-w-4xl py-8", children: [
|
|
328
322
|
/* @__PURE__ */ jsxs8("div", { className: "mb-8", children: [
|
|
329
|
-
/* @__PURE__ */ jsx14("h1", { className: "text-2xl font-semibold tracking-tight", children: "
|
|
330
|
-
/* @__PURE__ */ jsx14("p", { className: "text-muted-foreground", children: "
|
|
331
|
-
] }),
|
|
332
|
-
/* @__PURE__ */ jsx14("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx14("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your team." }) })
|
|
333
|
-
] });
|
|
334
|
-
}
|
|
335
|
-
if (!hasOrganization) {
|
|
336
|
-
return /* @__PURE__ */ jsxs8("div", { className: "container max-w-4xl py-8", children: [
|
|
337
|
-
/* @__PURE__ */ jsxs8("div", { className: "mb-8", children: [
|
|
338
|
-
/* @__PURE__ */ jsx14("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
|
|
339
|
-
/* @__PURE__ */ jsx14("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
|
|
340
|
-
] }),
|
|
341
|
-
/* @__PURE__ */ jsx14("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx14("p", { className: "text-muted-foreground text-sm", children: "You need to be part of an organization to manage team members." }) })
|
|
342
|
-
] });
|
|
343
|
-
}
|
|
344
|
-
if (!canManageTeam) {
|
|
345
|
-
return /* @__PURE__ */ jsxs8("div", { className: "container max-w-4xl py-8", children: [
|
|
346
|
-
/* @__PURE__ */ jsxs8("div", { className: "mb-8", children: [
|
|
347
|
-
/* @__PURE__ */ jsx14("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
|
|
348
|
-
/* @__PURE__ */ jsx14("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
|
|
323
|
+
/* @__PURE__ */ jsx14("h1", { className: "text-2xl font-semibold tracking-tight", children: "Sessions" }),
|
|
324
|
+
/* @__PURE__ */ jsx14("p", { className: "text-muted-foreground", children: "View and manage your active sessions" })
|
|
349
325
|
] }),
|
|
350
|
-
/* @__PURE__ */ jsx14("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx14("p", { className: "text-muted-foreground text-sm", children: "
|
|
326
|
+
/* @__PURE__ */ jsx14("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx14("p", { className: "text-muted-foreground text-sm", children: "Please sign in to view your sessions." }) })
|
|
351
327
|
] });
|
|
352
328
|
}
|
|
353
329
|
return /* @__PURE__ */ jsxs8("div", { className: "container max-w-4xl py-8", children: [
|
|
354
330
|
/* @__PURE__ */ jsxs8("div", { className: "mb-8", children: [
|
|
355
|
-
/* @__PURE__ */ jsx14("h1", { className: "text-2xl font-semibold tracking-tight", children: "
|
|
356
|
-
/* @__PURE__ */ jsx14("p", { className: "text-muted-foreground", children: "
|
|
331
|
+
/* @__PURE__ */ jsx14("h1", { className: "text-2xl font-semibold tracking-tight", children: "Sessions" }),
|
|
332
|
+
/* @__PURE__ */ jsx14("p", { className: "text-muted-foreground", children: "View and manage your active sessions" })
|
|
357
333
|
] }),
|
|
358
|
-
/* @__PURE__ */ jsx14(WidgetErrorBoundary, { widgetName: "
|
|
334
|
+
/* @__PURE__ */ jsx14(WidgetErrorBoundary, { widgetName: "sessions", children: /* @__PURE__ */ jsx14(UserSessions, { authToken: getAccessToken }) })
|
|
359
335
|
] });
|
|
360
336
|
}
|
|
361
337
|
|
|
362
|
-
// src/widgets/
|
|
363
|
-
import {
|
|
338
|
+
// src/widgets/users-management.tsx
|
|
339
|
+
import { UsersManagement as WorkOSUsersManagement } from "@workos-inc/widgets";
|
|
364
340
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
365
|
-
function
|
|
366
|
-
|
|
341
|
+
function UsersManagement({
|
|
342
|
+
authToken,
|
|
343
|
+
organizationId: _organizationId,
|
|
344
|
+
className
|
|
345
|
+
}) {
|
|
346
|
+
return /* @__PURE__ */ jsx15("div", { className, children: /* @__PURE__ */ jsx15(WorkOSUsersManagement, { authToken }) });
|
|
367
347
|
}
|
|
368
348
|
|
|
369
|
-
// src/shell/pages/
|
|
349
|
+
// src/shell/pages/team-page.tsx
|
|
370
350
|
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
371
|
-
function
|
|
372
|
-
const { user, getAccessToken, isLoading } = useAuth();
|
|
351
|
+
function TeamPage() {
|
|
352
|
+
const { user, getAccessToken, isLoading, organizationId, permissions } = useAuth();
|
|
353
|
+
const hasOrganization = !!organizationId;
|
|
354
|
+
const canManageTeam = hasOrganization && permissions?.includes("widgets:users-table:manage");
|
|
373
355
|
if (isLoading) {
|
|
374
356
|
return /* @__PURE__ */ jsx16("div", { className: "flex items-center justify-center py-12 text-muted-foreground", children: "Loading..." });
|
|
375
357
|
}
|
|
376
358
|
if (!user) {
|
|
377
359
|
return /* @__PURE__ */ jsxs9("div", { className: "container max-w-4xl py-8", children: [
|
|
378
360
|
/* @__PURE__ */ jsxs9("div", { className: "mb-8", children: [
|
|
379
|
-
/* @__PURE__ */ jsx16("h1", { className: "text-2xl font-semibold tracking-tight", children: "
|
|
380
|
-
/* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "
|
|
361
|
+
/* @__PURE__ */ jsx16("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
|
|
362
|
+
/* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
|
|
363
|
+
] }),
|
|
364
|
+
/* @__PURE__ */ jsx16("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx16("p", { className: "text-muted-foreground text-sm", children: "Please sign in to manage your team." }) })
|
|
365
|
+
] });
|
|
366
|
+
}
|
|
367
|
+
if (!hasOrganization) {
|
|
368
|
+
return /* @__PURE__ */ jsxs9("div", { className: "container max-w-4xl py-8", children: [
|
|
369
|
+
/* @__PURE__ */ jsxs9("div", { className: "mb-8", children: [
|
|
370
|
+
/* @__PURE__ */ jsx16("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
|
|
371
|
+
/* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
|
|
372
|
+
] }),
|
|
373
|
+
/* @__PURE__ */ jsx16("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx16("p", { className: "text-muted-foreground text-sm", children: "You need to be part of an organization to manage team members." }) })
|
|
374
|
+
] });
|
|
375
|
+
}
|
|
376
|
+
if (!canManageTeam) {
|
|
377
|
+
return /* @__PURE__ */ jsxs9("div", { className: "container max-w-4xl py-8", children: [
|
|
378
|
+
/* @__PURE__ */ jsxs9("div", { className: "mb-8", children: [
|
|
379
|
+
/* @__PURE__ */ jsx16("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
|
|
380
|
+
/* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
|
|
381
381
|
] }),
|
|
382
|
-
/* @__PURE__ */ jsx16("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx16("p", { className: "text-muted-foreground text-sm", children: "
|
|
382
|
+
/* @__PURE__ */ jsx16("div", { className: "flex items-center justify-center rounded-[var(--radius-md)] border border-dashed py-24", children: /* @__PURE__ */ jsx16("p", { className: "text-muted-foreground text-sm", children: "You need admin permissions to manage team members." }) })
|
|
383
383
|
] });
|
|
384
384
|
}
|
|
385
385
|
return /* @__PURE__ */ jsxs9("div", { className: "container max-w-4xl py-8", children: [
|
|
386
386
|
/* @__PURE__ */ jsxs9("div", { className: "mb-8", children: [
|
|
387
|
-
/* @__PURE__ */ jsx16("h1", { className: "text-2xl font-semibold tracking-tight", children: "
|
|
388
|
-
/* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "
|
|
387
|
+
/* @__PURE__ */ jsx16("h1", { className: "text-2xl font-semibold tracking-tight", children: "Team" }),
|
|
388
|
+
/* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Manage your team members and invitations" })
|
|
389
389
|
] }),
|
|
390
|
-
/* @__PURE__ */ jsx16(WidgetErrorBoundary, { widgetName: "
|
|
390
|
+
/* @__PURE__ */ jsx16(WidgetErrorBoundary, { widgetName: "team", children: /* @__PURE__ */ jsx16(UsersManagement, { authToken: getAccessToken }) })
|
|
391
391
|
] });
|
|
392
392
|
}
|
|
393
393
|
|
|
@@ -451,7 +451,9 @@ var adminRoutes = [
|
|
|
451
451
|
icon: Users,
|
|
452
452
|
component: TeamPage,
|
|
453
453
|
enabled: true,
|
|
454
|
-
public: false
|
|
454
|
+
public: false,
|
|
455
|
+
requiresOrganization: true,
|
|
456
|
+
requiredPermissions: ["widgets:users-table:manage"]
|
|
455
457
|
}
|
|
456
458
|
];
|
|
457
459
|
var integrationRoutes = [
|
|
@@ -614,12 +616,12 @@ function AuthGate({
|
|
|
614
616
|
case "allow":
|
|
615
617
|
return /* @__PURE__ */ jsx18(Fragment2, { children });
|
|
616
618
|
case "landing":
|
|
617
|
-
default:
|
|
618
619
|
return /* @__PURE__ */ jsx18(Fragment2, { children: landingComponent ?? /* @__PURE__ */ jsx18(DefaultLandingPage, {}) });
|
|
619
620
|
}
|
|
620
621
|
}
|
|
621
622
|
|
|
622
623
|
// src/shell/auth-shell-nav.tsx
|
|
624
|
+
import { useMemo as useMemo2 } from "react";
|
|
623
625
|
import { useAuth as useAuth4 } from "@workos-inc/authkit-react";
|
|
624
626
|
import { useIsActive, WebLink as WebLink2 } from "@mdxui/navigation/web";
|
|
625
627
|
import {
|
|
@@ -637,6 +639,27 @@ import {
|
|
|
637
639
|
} from "@mdxui/primitives/sidebar";
|
|
638
640
|
import { SidebarUser } from "@mdxui/primitives/sidebar-user";
|
|
639
641
|
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
642
|
+
function isRouteVisible(route, context) {
|
|
643
|
+
const { organizationId, permissions = [], role } = context;
|
|
644
|
+
if (route.requiresOrganization && !organizationId) {
|
|
645
|
+
return false;
|
|
646
|
+
}
|
|
647
|
+
if (route.requiredPermissions && route.requiredPermissions.length > 0) {
|
|
648
|
+
const hasAllPermissions = route.requiredPermissions.every(
|
|
649
|
+
(p) => permissions.includes(p)
|
|
650
|
+
);
|
|
651
|
+
if (!hasAllPermissions) {
|
|
652
|
+
return false;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
if (route.requiredRoles && route.requiredRoles.length > 0) {
|
|
656
|
+
const hasRole = role && route.requiredRoles.includes(role);
|
|
657
|
+
if (!hasRole) {
|
|
658
|
+
return false;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
return true;
|
|
662
|
+
}
|
|
640
663
|
function NavItem({ route, getFullPath }) {
|
|
641
664
|
const fullPath = getFullPath(route.path);
|
|
642
665
|
const isActive = useIsActive(fullPath, { partial: fullPath !== "/" });
|
|
@@ -678,10 +701,26 @@ function DefaultUserMenu() {
|
|
|
678
701
|
function AuthShellNav({ headerContent, userMenu, className }) {
|
|
679
702
|
const { routesByGroup, groups } = useAuthShellRoutesByGroup();
|
|
680
703
|
const getFullPath = useAuthShellFullPath();
|
|
704
|
+
const { organizationId, permissions, role } = useAuth4();
|
|
705
|
+
const filteredRoutesByGroup = useMemo2(() => {
|
|
706
|
+
const context = {
|
|
707
|
+
organizationId: organizationId ?? void 0,
|
|
708
|
+
permissions: permissions ?? void 0,
|
|
709
|
+
role: role ?? void 0
|
|
710
|
+
};
|
|
711
|
+
const filtered = /* @__PURE__ */ new Map();
|
|
712
|
+
for (const [groupId, routes] of routesByGroup) {
|
|
713
|
+
const visibleRoutes = routes.filter((route) => isRouteVisible(route, context));
|
|
714
|
+
if (visibleRoutes.length > 0) {
|
|
715
|
+
filtered.set(groupId, visibleRoutes);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
return filtered;
|
|
719
|
+
}, [routesByGroup, organizationId, permissions, role]);
|
|
681
720
|
return /* @__PURE__ */ jsxs11(Sidebar, { collapsible: "icon", className, children: [
|
|
682
721
|
/* @__PURE__ */ jsx19(SidebarHeader, { children: /* @__PURE__ */ jsx19(BrandingHeader, { headerContent }) }),
|
|
683
722
|
/* @__PURE__ */ jsx19(SidebarContent, { children: groups.map((group) => {
|
|
684
|
-
const routes =
|
|
723
|
+
const routes = filteredRoutesByGroup.get(group.id);
|
|
685
724
|
if (!routes || routes.length === 0) return null;
|
|
686
725
|
return /* @__PURE__ */ jsxs11(SidebarGroup, { children: [
|
|
687
726
|
group.label && /* @__PURE__ */ jsx19(SidebarGroupLabel, { children: group.label }),
|
|
@@ -738,9 +777,9 @@ function AuthShell({
|
|
|
738
777
|
}
|
|
739
778
|
|
|
740
779
|
// src/shell/auth-app.tsx
|
|
741
|
-
import { useMemo as useMemo2 } from "react";
|
|
742
|
-
import { ThemeProvider } from "next-themes";
|
|
743
780
|
import { createWebRouter, RouterProvider, WebOutlet } from "@mdxui/navigation/web";
|
|
781
|
+
import { ThemeProvider } from "next-themes";
|
|
782
|
+
import { useMemo as useMemo3 } from "react";
|
|
744
783
|
|
|
745
784
|
// src/providers/identity-provider.tsx
|
|
746
785
|
import { AuthKitProvider } from "@workos-inc/authkit-react";
|
|
@@ -910,7 +949,7 @@ function mergeWithEnvConfig(config) {
|
|
|
910
949
|
// src/shell/auth-app.tsx
|
|
911
950
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
912
951
|
function AuthAppProvider({ config, children }) {
|
|
913
|
-
const resolvedConfig =
|
|
952
|
+
const resolvedConfig = useMemo3(() => mergeWithEnvConfig(config), [config]);
|
|
914
953
|
const { identity, theme } = resolvedConfig;
|
|
915
954
|
return /* @__PURE__ */ jsx23(
|
|
916
955
|
ThemeProvider,
|
|
@@ -959,14 +998,14 @@ function createRootLayout(headerContent, sidebarHeaderContent) {
|
|
|
959
998
|
};
|
|
960
999
|
}
|
|
961
1000
|
function AuthApp({ config, headerContent, sidebarHeaderContent }) {
|
|
962
|
-
const mergedConfig =
|
|
1001
|
+
const mergedConfig = useMemo3(() => mergeWithEnvConfig(config), [config]);
|
|
963
1002
|
const routes = mergedConfig.routes ?? defaultRoutes;
|
|
964
1003
|
const groups = mergedConfig.groups ?? defaultGroups;
|
|
965
|
-
const resolvedConfig =
|
|
1004
|
+
const resolvedConfig = useMemo3(
|
|
966
1005
|
() => ({ ...mergedConfig, routes, groups }),
|
|
967
1006
|
[mergedConfig, routes, groups]
|
|
968
1007
|
);
|
|
969
|
-
const router =
|
|
1008
|
+
const router = useMemo3(() => {
|
|
970
1009
|
const routeConfig = convertRoutesToConfig(routes, mergedConfig.basePath);
|
|
971
1010
|
const RootLayout = createRootLayout(headerContent, sidebarHeaderContent);
|
|
972
1011
|
return createWebRouter(routeConfig, {
|
|
@@ -982,10 +1021,10 @@ function AuthAppWithChildren({
|
|
|
982
1021
|
sidebarHeaderContent,
|
|
983
1022
|
children
|
|
984
1023
|
}) {
|
|
985
|
-
const mergedConfig =
|
|
1024
|
+
const mergedConfig = useMemo3(() => mergeWithEnvConfig(config), [config]);
|
|
986
1025
|
const routes = mergedConfig.routes ?? defaultRoutes;
|
|
987
1026
|
const groups = mergedConfig.groups ?? defaultGroups;
|
|
988
|
-
const resolvedConfig =
|
|
1027
|
+
const resolvedConfig = useMemo3(
|
|
989
1028
|
() => ({ ...mergedConfig, routes, groups }),
|
|
990
1029
|
[mergedConfig, routes, groups]
|
|
991
1030
|
);
|