mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-05 23:41:06 +00:00
initial commit
This commit is contained in:
commit
f6dd426830
1145 changed files with 102834 additions and 0 deletions
175
package/@stackframe/react/dist/components-page/account-settings.js
vendored
Normal file
175
package/@stackframe/react/dist/components-page/account-settings.js
vendored
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings.tsx
|
||||
var account_settings_exports = {};
|
||||
__export(account_settings_exports, {
|
||||
AccountSettings: () => AccountSettings
|
||||
});
|
||||
module.exports = __toCommonJS(account_settings_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_lucide_react = require("lucide-react");
|
||||
var import_react = require("react");
|
||||
var import__ = require("..");
|
||||
var import_maybe_full_page = require("../components/elements/maybe-full-page");
|
||||
var import_sidebar_layout = require("../components/elements/sidebar-layout");
|
||||
var import_team_icon = require("../components/team-icon");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_active_sessions_page = require("./account-settings/active-sessions/active-sessions-page");
|
||||
var import_api_keys_page = require("./account-settings/api-keys/api-keys-page");
|
||||
var import_email_and_auth_page = require("./account-settings/email-and-auth/email-and-auth-page");
|
||||
var import_profile_page = require("./account-settings/profile-page/profile-page");
|
||||
var import_settings_page = require("./account-settings/settings/settings-page");
|
||||
var import_team_creation_page = require("./account-settings/teams/team-creation-page");
|
||||
var import_team_page = require("./account-settings/teams/team-page");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
var Icon = ({ name }) => {
|
||||
const LucideIcon = import_lucide_react.icons[name];
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LucideIcon, { className: "mr-2 h-4 w-4" });
|
||||
};
|
||||
function AccountSettings(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import__.useUser)({ or: "redirect" });
|
||||
const teams = user.useTeams();
|
||||
const stackApp = (0, import__.useStackApp)();
|
||||
const project = stackApp.useProject();
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_maybe_full_page.MaybeFullPage, { fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "self-stretch flex-grow w-full", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_sidebar_layout.SidebarLayout,
|
||||
{
|
||||
items: [
|
||||
{
|
||||
title: t("My Profile"),
|
||||
type: "item",
|
||||
id: "profile",
|
||||
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "Contact" }),
|
||||
content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_profile_page.ProfilePage, {})
|
||||
},
|
||||
{
|
||||
title: t("Emails & Auth"),
|
||||
type: "item",
|
||||
id: "auth",
|
||||
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "ShieldCheck" }),
|
||||
content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmailsAndAuthPageSkeleton, {}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_email_and_auth_page.EmailsAndAuthPage, {}) })
|
||||
},
|
||||
{
|
||||
title: t("Active Sessions"),
|
||||
type: "item",
|
||||
id: "sessions",
|
||||
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "Monitor" }),
|
||||
content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActiveSessionsPageSkeleton, {}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_active_sessions_page.ActiveSessionsPage, {}) })
|
||||
},
|
||||
...project.config.allowUserApiKeys ? [{
|
||||
title: t("API Keys"),
|
||||
type: "item",
|
||||
id: "api-keys",
|
||||
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "Key" }),
|
||||
content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ApiKeysPageSkeleton, {}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_api_keys_page.ApiKeysPage, {}) })
|
||||
}] : [],
|
||||
{
|
||||
title: t("Settings"),
|
||||
type: "item",
|
||||
id: "settings",
|
||||
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "Settings" }),
|
||||
content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_settings_page.SettingsPage, {})
|
||||
},
|
||||
...props.extraItems?.map((item) => ({
|
||||
title: item.title,
|
||||
type: "item",
|
||||
id: item.id,
|
||||
icon: (() => {
|
||||
const iconName = item.iconName;
|
||||
if (iconName) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: iconName });
|
||||
} else if (item.icon) {
|
||||
return item.icon;
|
||||
}
|
||||
return null;
|
||||
})(),
|
||||
content: item.content
|
||||
})) || [],
|
||||
...teams.length > 0 || project.config.clientTeamCreationEnabled ? [{
|
||||
title: t("Teams"),
|
||||
type: "divider"
|
||||
}] : [],
|
||||
...teams.map((team) => ({
|
||||
title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2 items-center w-full", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_icon.TeamIcon, { team }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { className: "max-w-[320px] md:w-[90%] truncate", children: team.displayName })
|
||||
] }),
|
||||
type: "item",
|
||||
id: `team-${team.id}`,
|
||||
content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TeamPageSkeleton, {}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_page.TeamPage, { team }) })
|
||||
})),
|
||||
...project.config.clientTeamCreationEnabled ? [{
|
||||
title: t("Create a team"),
|
||||
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "CirclePlus" }),
|
||||
type: "item",
|
||||
id: "team-creation",
|
||||
content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TeamCreationSkeleton, {}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_creation_page.TeamCreationPage, {}) })
|
||||
}] : []
|
||||
].filter((p) => p.type === "divider" || p.content),
|
||||
title: t("Account Settings")
|
||||
}
|
||||
) }) });
|
||||
}
|
||||
function PageLayout(props) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-col gap-6", children: props.children });
|
||||
}
|
||||
function EmailsAndAuthPageSkeleton() {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PageLayout, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-full mt-1" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-full mt-1" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-full mt-1" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-full mt-1" })
|
||||
] });
|
||||
}
|
||||
function ActiveSessionsPageSkeleton() {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PageLayout, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-6 w-48 mb-2" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-4 w-full mb-4" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-[200px] w-full mt-1 rounded-md" })
|
||||
] });
|
||||
}
|
||||
function ApiKeysPageSkeleton() {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PageLayout, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-full mt-1" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-[200px] w-full mt-1 rounded-md" })
|
||||
] });
|
||||
}
|
||||
function TeamPageSkeleton() {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PageLayout, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-full mt-1" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-full mt-1" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-full mt-1" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-[200px] w-full mt-1 rounded-md" })
|
||||
] });
|
||||
}
|
||||
function TeamCreationSkeleton() {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PageLayout, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-full mt-1" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-full mt-1" })
|
||||
] });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
AccountSettings
|
||||
});
|
||||
//# sourceMappingURL=account-settings.js.map
|
||||
1
package/@stackframe/react/dist/components-page/account-settings.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/account-settings.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,151 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/active-sessions/active-sessions-page.tsx
|
||||
var active_sessions_page_exports = {};
|
||||
__export(active_sessions_page_exports, {
|
||||
ActiveSessionsPage: () => ActiveSessionsPage
|
||||
});
|
||||
module.exports = __toCommonJS(active_sessions_page_exports);
|
||||
var import_dates = require("@stackframe/stack-shared/dist/utils/dates");
|
||||
var import_errors = require("@stackframe/stack-shared/dist/utils/errors");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_page_layout = require("../page-layout");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function ActiveSessionsPage() {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import_hooks.useUser)({ or: "throw" });
|
||||
const [isLoading, setIsLoading] = (0, import_react.useState)(true);
|
||||
const [isRevokingAll, setIsRevokingAll] = (0, import_react.useState)(false);
|
||||
const [sessions, setSessions] = (0, import_react.useState)([]);
|
||||
const [showConfirmRevokeAll, setShowConfirmRevokeAll] = (0, import_react.useState)(false);
|
||||
(0, import_react.useEffect)(() => {
|
||||
(0, import_promises.runAsynchronously)(async () => {
|
||||
setIsLoading(true);
|
||||
const sessionsData = await user.getActiveSessions();
|
||||
const enhancedSessions = sessionsData;
|
||||
setSessions(enhancedSessions);
|
||||
setIsLoading(false);
|
||||
});
|
||||
}, [user]);
|
||||
const handleRevokeSession = async (sessionId) => {
|
||||
try {
|
||||
await user.revokeSession(sessionId);
|
||||
setSessions((prev) => prev.filter((session) => session.id !== sessionId));
|
||||
} catch (error) {
|
||||
(0, import_errors.captureError)("Failed to revoke session", { sessionId, error });
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
const handleRevokeAllSessions = async () => {
|
||||
setIsRevokingAll(true);
|
||||
try {
|
||||
const deletionPromises = sessions.filter((session) => !session.isCurrentSession).map((session) => user.revokeSession(session.id));
|
||||
await Promise.all(deletionPromises);
|
||||
setSessions((prevSessions) => prevSessions.filter((session) => session.isCurrentSession));
|
||||
} catch (error) {
|
||||
(0, import_errors.captureError)("Failed to revoke all sessions", { error, sessionIds: sessions.map((session) => session.id) });
|
||||
throw error;
|
||||
} finally {
|
||||
setIsRevokingAll(false);
|
||||
setShowConfirmRevokeAll(false);
|
||||
}
|
||||
};
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_page_layout.PageLayout, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-between items-center mb-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { className: "font-medium", children: t("Active Sessions") }),
|
||||
sessions.filter((s) => !s.isCurrentSession).length > 0 && !isLoading && (showConfirmRevokeAll ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "destructive",
|
||||
size: "sm",
|
||||
loading: isRevokingAll,
|
||||
onClick: handleRevokeAllSessions,
|
||||
children: t("Confirm")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
size: "sm",
|
||||
disabled: isRevokingAll,
|
||||
onClick: () => setShowConfirmRevokeAll(false),
|
||||
children: t("Cancel")
|
||||
}
|
||||
)
|
||||
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "outline",
|
||||
size: "sm",
|
||||
onClick: () => setShowConfirmRevokeAll(true),
|
||||
children: t("Revoke All Other Sessions")
|
||||
}
|
||||
))
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", type: "footnote", className: "mb-4", children: t("These are devices where you're currently logged in. You can revoke access to end a session.") }),
|
||||
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-[300px] w-full rounded-md" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border rounded-md", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Table, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableRow, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[200px]", children: t("Session") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[150px]", children: t("IP Address") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[150px]", children: t("Location") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[150px]", children: t("Last used") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[80px]" })
|
||||
] }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableBody, { children: sessions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { colSpan: 5, className: "text-center py-6", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", children: t("No active sessions found") }) }) }) : sessions.map((session) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableRow, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: session.isCurrentSession ? t("Current Session") : t("Other Session") }),
|
||||
session.isImpersonation && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Badge, { variant: "secondary", className: "w-fit mt-1", children: t("Impersonation") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", type: "footnote", children: t("Signed in {time}", { time: new Date(session.createdAt).toLocaleDateString() }) })
|
||||
] }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: session.geoInfo?.ip || t("-") }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: session.geoInfo?.cityName || t("Unknown") }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: session.lastUsedAt ? (0, import_dates.fromNow)(new Date(session.lastUsedAt)) : t("Never") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", type: "footnote", title: session.lastUsedAt ? new Date(session.lastUsedAt).toLocaleString() : "", children: session.lastUsedAt ? new Date(session.lastUsedAt).toLocaleDateString() : "" })
|
||||
] }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { align: "right", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.ActionCell,
|
||||
{
|
||||
items: [
|
||||
{
|
||||
item: t("Revoke"),
|
||||
onClick: () => handleRevokeSession(session.id),
|
||||
danger: true,
|
||||
disabled: session.isCurrentSession,
|
||||
disabledTooltip: session.isCurrentSession ? t("You cannot revoke your current session") : void 0
|
||||
}
|
||||
]
|
||||
}
|
||||
) })
|
||||
] }, session.id)) })
|
||||
] }) })
|
||||
] }) });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
ActiveSessionsPage
|
||||
});
|
||||
//# sourceMappingURL=active-sessions-page.js.map
|
||||
File diff suppressed because one or more lines are too long
70
package/@stackframe/react/dist/components-page/account-settings/api-keys/api-keys-page.js
vendored
Normal file
70
package/@stackframe/react/dist/components-page/account-settings/api-keys/api-keys-page.js
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/api-keys/api-keys-page.tsx
|
||||
var api_keys_page_exports = {};
|
||||
__export(api_keys_page_exports, {
|
||||
ApiKeysPage: () => ApiKeysPage
|
||||
});
|
||||
module.exports = __toCommonJS(api_keys_page_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_api_key_dialogs = require("../../../components/api-key-dialogs");
|
||||
var import_api_key_table = require("../../../components/api-key-table");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_page_layout = require("../page-layout");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function ApiKeysPage() {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
const apiKeys = user.useApiKeys();
|
||||
const [isNewApiKeyDialogOpen, setIsNewApiKeyDialogOpen] = (0, import_react.useState)(false);
|
||||
const [returnedApiKey, setReturnedApiKey] = (0, import_react.useState)(null);
|
||||
const CreateDialog = import_api_key_dialogs.CreateApiKeyDialog;
|
||||
const ShowDialog = import_api_key_dialogs.ShowApiKeyDialog;
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_page_layout.PageLayout, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { onClick: () => setIsNewApiKeyDialogOpen(true), children: t("Create API Key") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_api_key_table.ApiKeyTable, { apiKeys }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
CreateDialog,
|
||||
{
|
||||
open: isNewApiKeyDialogOpen,
|
||||
onOpenChange: setIsNewApiKeyDialogOpen,
|
||||
onKeyCreated: setReturnedApiKey,
|
||||
createApiKey: async (data) => {
|
||||
const apiKey = await user.createApiKey(data);
|
||||
return apiKey;
|
||||
}
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
ShowDialog,
|
||||
{
|
||||
apiKey: returnedApiKey,
|
||||
onClose: () => setReturnedApiKey(null)
|
||||
}
|
||||
)
|
||||
] });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
ApiKeysPage
|
||||
});
|
||||
//# sourceMappingURL=api-keys-page.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/api-keys/api-keys-page.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Button } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { CreateApiKeyDialog, ShowApiKeyDialog } from \"../../../components/api-key-dialogs\";\nimport { ApiKeyTable } from \"../../../components/api-key-table\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { ApiKey, ApiKeyCreationOptions } from \"../../../lib/stack-app/api-keys\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { PageLayout } from \"../page-layout\";\n\n\nexport function ApiKeysPage() {\n const { t } = useTranslation();\n\n const user = useUser({ or: 'redirect' });\n const apiKeys = user.useApiKeys();\n\n const [isNewApiKeyDialogOpen, setIsNewApiKeyDialogOpen] = useState(false);\n const [returnedApiKey, setReturnedApiKey] = useState<ApiKey<\"user\", true> | null>(null);\n\n const CreateDialog = CreateApiKeyDialog<\"user\">;\n const ShowDialog = ShowApiKeyDialog<\"user\">;\n\n return (\n <PageLayout>\n <Button onClick={() => setIsNewApiKeyDialogOpen(true)}>\n {t(\"Create API Key\")}\n </Button>\n <ApiKeyTable apiKeys={apiKeys} />\n <CreateDialog\n open={isNewApiKeyDialogOpen}\n onOpenChange={setIsNewApiKeyDialogOpen}\n onKeyCreated={setReturnedApiKey}\n createApiKey={async (data: ApiKeyCreationOptions<\"user\">) => {\n const apiKey = await user.createApiKey(data);\n return apiKey;\n }}\n />\n <ShowDialog\n apiKey={returnedApiKey}\n onClose={() => setReturnedApiKey(null)}\n />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAAuB;AACvB,mBAAyB;AACzB,6BAAqD;AACrD,2BAA4B;AAC5B,mBAAwB;AAExB,0BAA+B;AAC/B,yBAA2B;AAgBvB;AAbG,SAAS,cAAc;AAC5B,QAAM,EAAE,EAAE,QAAI,oCAAe;AAE7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,UAAU,KAAK,WAAW;AAEhC,QAAM,CAAC,uBAAuB,wBAAwB,QAAI,uBAAS,KAAK;AACxE,QAAM,CAAC,gBAAgB,iBAAiB,QAAI,uBAAwC,IAAI;AAExF,QAAM,eAAe;AACrB,QAAM,aAAa;AAEnB,SACE,6CAAC,iCACC;AAAA,gDAAC,0BAAO,SAAS,MAAM,yBAAyB,IAAI,GACjD,YAAE,gBAAgB,GACrB;AAAA,IACA,4CAAC,oCAAY,SAAkB;AAAA,IAC/B;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,cAAc;AAAA,QACd,cAAc;AAAA,QACd,cAAc,OAAO,SAAwC;AAC3D,gBAAM,SAAS,MAAM,KAAK,aAAa,IAAI;AAC3C,iBAAO;AAAA,QACT;AAAA;AAAA,IACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,SAAS,MAAM,kBAAkB,IAAI;AAAA;AAAA,IACvC;AAAA,KACF;AAEJ;","names":[]}
|
||||
75
package/@stackframe/react/dist/components-page/account-settings/editable-text.js
vendored
Normal file
75
package/@stackframe/react/dist/components-page/account-settings/editable-text.js
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/editable-text.tsx
|
||||
var editable_text_exports = {};
|
||||
__export(editable_text_exports, {
|
||||
EditableText: () => EditableText
|
||||
});
|
||||
module.exports = __toCommonJS(editable_text_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_lucide_react = require("lucide-react");
|
||||
var import_react = require("react");
|
||||
var import_translations = require("../../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function EditableText(props) {
|
||||
const [editing, setEditing] = (0, import_react.useState)(false);
|
||||
const [editingValue, setEditingValue] = (0, import_react.useState)(props.value);
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex items-center gap-2", children: editing ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Input,
|
||||
{
|
||||
value: editingValue,
|
||||
onChange: (e) => setEditingValue(e.target.value)
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
size: "sm",
|
||||
onClick: async () => {
|
||||
await props.onSave?.(editingValue);
|
||||
setEditing(false);
|
||||
},
|
||||
children: t("Save")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
size: "sm",
|
||||
variant: "secondary",
|
||||
onClick: () => {
|
||||
setEditingValue(props.value);
|
||||
setEditing(false);
|
||||
},
|
||||
children: t("Cancel")
|
||||
}
|
||||
)
|
||||
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: props.value }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { onClick: () => setEditing(true), size: "icon", variant: "ghost", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Edit, { className: "w-4 h-4" }) })
|
||||
] }) });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
EditableText
|
||||
});
|
||||
//# sourceMappingURL=editable-text.js.map
|
||||
1
package/@stackframe/react/dist/components-page/account-settings/editable-text.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/account-settings/editable-text.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../src/components-page/account-settings/editable-text.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Button, Input, Typography } from \"@stackframe/stack-ui\";\nimport { Edit } from \"lucide-react\";\nimport { useState } from \"react\";\nimport { useTranslation } from \"../../lib/translations\";\n\n\nexport function EditableText(props: { value: string, onSave?: (value: string) => void | Promise<void> }) {\n const [editing, setEditing] = useState(false);\n const [editingValue, setEditingValue] = useState(props.value);\n const { t } = useTranslation();\n\n return (\n <div className='flex items-center gap-2'>\n {editing ? (\n <>\n <Input\n value={editingValue}\n onChange={(e) => setEditingValue(e.target.value)}\n />\n <Button\n size='sm'\n onClick={async () => {\n await props.onSave?.(editingValue);\n setEditing(false);\n }}\n >\n {t(\"Save\")}\n </Button>\n <Button\n size='sm'\n variant='secondary'\n onClick={() => {\n setEditingValue(props.value);\n setEditing(false);\n }}>\n {t(\"Cancel\")}\n </Button>\n </>\n ) : (\n <>\n <Typography>{props.value}</Typography>\n <Button onClick={() => setEditing(true)} size='icon' variant='ghost'>\n <Edit className=\"w-4 h-4\" />\n </Button>\n </>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAA0C;AAC1C,0BAAqB;AACrB,mBAAyB;AACzB,0BAA+B;AAWvB;AARD,SAAS,aAAa,OAA4E;AACvG,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAC5C,QAAM,CAAC,cAAc,eAAe,QAAI,uBAAS,MAAM,KAAK;AAC5D,QAAM,EAAE,EAAE,QAAI,oCAAe;AAE7B,SACE,4CAAC,SAAI,WAAU,2BACZ,oBACC,4EACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP,UAAU,CAAC,MAAM,gBAAgB,EAAE,OAAO,KAAK;AAAA;AAAA,IACjD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAS,YAAY;AACnB,gBAAM,MAAM,SAAS,YAAY;AACjC,qBAAW,KAAK;AAAA,QAClB;AAAA,QAEC,YAAE,MAAM;AAAA;AAAA,IACX;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,SAAS,MAAM;AACb,0BAAgB,MAAM,KAAK;AAC3B,qBAAW,KAAK;AAAA,QAClB;AAAA,QACC,YAAE,QAAQ;AAAA;AAAA,IACb;AAAA,KACF,IAEA,4EACE;AAAA,gDAAC,8BAAY,gBAAM,OAAM;AAAA,IACzB,4CAAC,0BAAO,SAAS,MAAM,WAAW,IAAI,GAAG,MAAK,QAAO,SAAQ,SAC3D,sDAAC,4BAAK,WAAU,WAAU,GAC5B;AAAA,KACF,GAEJ;AAEJ;","names":[]}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/email-and-auth/email-and-auth-page.tsx
|
||||
var email_and_auth_page_exports = {};
|
||||
__export(email_and_auth_page_exports, {
|
||||
EmailsAndAuthPage: () => EmailsAndAuthPage
|
||||
});
|
||||
module.exports = __toCommonJS(email_and_auth_page_exports);
|
||||
var import_page_layout = require("../page-layout");
|
||||
var import_emails_section = require("./emails-section");
|
||||
var import_mfa_section = require("./mfa-section");
|
||||
var import_otp_section = require("./otp-section");
|
||||
var import_passkey_section = require("./passkey-section");
|
||||
var import_password_section = require("./password-section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function EmailsAndAuthPage() {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_page_layout.PageLayout, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_emails_section.EmailsSection, {}),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_password_section.PasswordSection, {}),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_passkey_section.PasskeySection, {}),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_otp_section.OtpSection, {}),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mfa_section.MfaSection, {})
|
||||
] });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
EmailsAndAuthPage
|
||||
});
|
||||
//# sourceMappingURL=email-and-auth-page.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/email-and-auth/email-and-auth-page.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { PageLayout } from \"../page-layout\";\nimport { EmailsSection } from \"./emails-section\";\nimport { MfaSection } from \"./mfa-section\";\nimport { OtpSection } from \"./otp-section\";\nimport { PasskeySection } from \"./passkey-section\";\nimport { PasswordSection } from \"./password-section\";\n\nexport function EmailsAndAuthPage() {\n return (\n <PageLayout>\n <EmailsSection/>\n <PasswordSection />\n <PasskeySection />\n <OtpSection />\n <MfaSection />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,yBAA2B;AAC3B,4BAA8B;AAC9B,yBAA2B;AAC3B,yBAA2B;AAC3B,6BAA+B;AAC/B,8BAAgC;AAI5B;AAFG,SAAS,oBAAoB;AAClC,SACE,6CAAC,iCACC;AAAA,gDAAC,uCAAa;AAAA,IACd,4CAAC,2CAAgB;AAAA,IACjB,4CAAC,yCAAe;AAAA,IAChB,4CAAC,iCAAW;AAAA,IACZ,4CAAC,iCAAW;AAAA,KACd;AAEJ;","names":[]}
|
||||
188
package/@stackframe/react/dist/components-page/account-settings/email-and-auth/emails-section.js
vendored
Normal file
188
package/@stackframe/react/dist/components-page/account-settings/email-and-auth/emails-section.js
vendored
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/email-and-auth/emails-section.tsx
|
||||
var emails_section_exports = {};
|
||||
__export(emails_section_exports, {
|
||||
EmailsSection: () => EmailsSection
|
||||
});
|
||||
module.exports = __toCommonJS(emails_section_exports);
|
||||
var import_yup = require("@hookform/resolvers/yup");
|
||||
var import_known_errors = require("@stackframe/stack-shared/dist/known-errors");
|
||||
var import_schema_fields = require("@stackframe/stack-shared/dist/schema-fields");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_react_hook_form = require("react-hook-form");
|
||||
var import_form_warning = require("../../../components/elements/form-warning");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function EmailsSection() {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
const contactChannels = user.useContactChannels();
|
||||
const [addingEmail, setAddingEmail] = (0, import_react.useState)(contactChannels.length === 0);
|
||||
const [addingEmailLoading, setAddingEmailLoading] = (0, import_react.useState)(false);
|
||||
const [addedEmail, setAddedEmail] = (0, import_react.useState)(null);
|
||||
const isLastEmail = contactChannels.filter((x) => x.usedForAuth && x.type === "email").length === 1;
|
||||
(0, import_react.useEffect)(() => {
|
||||
if (addedEmail) {
|
||||
(0, import_promises.runAsynchronously)(async () => {
|
||||
const cc = contactChannels.find((x) => x.value === addedEmail);
|
||||
if (cc && !cc.isVerified) {
|
||||
await cc.sendVerificationEmail();
|
||||
}
|
||||
setAddedEmail(null);
|
||||
});
|
||||
}
|
||||
}, [contactChannels, addedEmail]);
|
||||
const emailSchema = (0, import_schema_fields.yupObject)({
|
||||
email: (0, import_schema_fields.strictEmailSchema)(t("Please enter a valid email address")).notOneOf(contactChannels.map((x) => x.value), t("Email already exists")).defined().nonEmpty(t("Email is required"))
|
||||
});
|
||||
const { register, handleSubmit, formState: { errors }, reset } = (0, import_react_hook_form.useForm)({
|
||||
resolver: (0, import_yup.yupResolver)(emailSchema)
|
||||
});
|
||||
const onSubmit = async (data) => {
|
||||
setAddingEmailLoading(true);
|
||||
try {
|
||||
await user.createContactChannel({ type: "email", value: data.email, usedForAuth: false });
|
||||
setAddedEmail(data.email);
|
||||
} finally {
|
||||
setAddingEmailLoading(false);
|
||||
}
|
||||
setAddingEmail(false);
|
||||
reset();
|
||||
};
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col md:flex-row justify-between mb-4 gap-4", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { className: "font-medium", children: t("Emails") }),
|
||||
addingEmail ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
"form",
|
||||
{
|
||||
onSubmit: (e) => {
|
||||
e.preventDefault();
|
||||
(0, import_promises.runAsynchronously)(handleSubmit(onSubmit));
|
||||
},
|
||||
className: "flex flex-col",
|
||||
children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Input,
|
||||
{
|
||||
...register("email"),
|
||||
placeholder: t("Enter email")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { type: "submit", loading: addingEmailLoading, children: t("Add") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: () => {
|
||||
setAddingEmail(false);
|
||||
reset();
|
||||
},
|
||||
children: t("Cancel")
|
||||
}
|
||||
)
|
||||
] }),
|
||||
errors.email && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.email.message })
|
||||
]
|
||||
}
|
||||
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex md:justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { variant: "secondary", onClick: () => setAddingEmail(true), children: t("Add an email") }) })
|
||||
] }),
|
||||
contactChannels.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border rounded-md", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Table, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableBody, { children: contactChannels.filter((x) => x.type === "email").sort((a, b) => {
|
||||
if (a.isPrimary !== b.isPrimary) return a.isPrimary ? -1 : 1;
|
||||
if (a.isVerified !== b.isVerified) return a.isVerified ? -1 : 1;
|
||||
return 0;
|
||||
}).map((x) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableRow, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col md:flex-row gap-2 md:gap-4", children: [
|
||||
x.value,
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2", children: [
|
||||
x.isPrimary ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Badge, { children: t("Primary") }) : null,
|
||||
!x.isVerified ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Badge, { variant: "destructive", children: t("Unverified") }) : null,
|
||||
x.usedForAuth ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Badge, { variant: "outline", children: t("Used for sign-in") }) : null
|
||||
] })
|
||||
] }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.ActionCell, { items: [
|
||||
...!x.isVerified ? [{
|
||||
item: t("Send verification email"),
|
||||
onClick: async () => {
|
||||
await x.sendVerificationEmail();
|
||||
}
|
||||
}] : [],
|
||||
...!x.isPrimary && x.isVerified ? [{
|
||||
item: t("Set as primary"),
|
||||
onClick: async () => {
|
||||
await x.update({ isPrimary: true });
|
||||
}
|
||||
}] : !x.isPrimary ? [{
|
||||
item: t("Set as primary"),
|
||||
onClick: async () => {
|
||||
},
|
||||
disabled: true,
|
||||
disabledTooltip: t("Please verify your email first")
|
||||
}] : [],
|
||||
...!x.usedForAuth && x.isVerified ? [{
|
||||
item: t("Use for sign-in"),
|
||||
onClick: async () => {
|
||||
try {
|
||||
await x.update({ usedForAuth: true });
|
||||
} catch (e) {
|
||||
if (import_known_errors.KnownErrors.ContactChannelAlreadyUsedForAuthBySomeoneElse.isInstance(e)) {
|
||||
alert(t("This email is already used for sign-in by another user."));
|
||||
}
|
||||
}
|
||||
}
|
||||
}] : [],
|
||||
...x.usedForAuth && !isLastEmail ? [{
|
||||
item: t("Stop using for sign-in"),
|
||||
onClick: async () => {
|
||||
await x.update({ usedForAuth: false });
|
||||
}
|
||||
}] : x.usedForAuth ? [{
|
||||
item: t("Stop using for sign-in"),
|
||||
onClick: async () => {
|
||||
},
|
||||
disabled: true,
|
||||
disabledTooltip: t("You can not remove your last sign-in email")
|
||||
}] : [],
|
||||
...!isLastEmail || !x.usedForAuth ? [{
|
||||
item: t("Remove"),
|
||||
onClick: async () => {
|
||||
await x.delete();
|
||||
},
|
||||
danger: true
|
||||
}] : [{
|
||||
item: t("Remove"),
|
||||
onClick: async () => {
|
||||
},
|
||||
disabled: true,
|
||||
disabledTooltip: t("You can not remove your last sign-in email")
|
||||
}]
|
||||
] }) })
|
||||
] }, x.id)) }) }) }) : null
|
||||
] });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
EmailsSection
|
||||
});
|
||||
//# sourceMappingURL=emails-section.js.map
|
||||
File diff suppressed because one or more lines are too long
146
package/@stackframe/react/dist/components-page/account-settings/email-and-auth/mfa-section.js
vendored
Normal file
146
package/@stackframe/react/dist/components-page/account-settings/email-and-auth/mfa-section.js
vendored
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/email-and-auth/mfa-section.tsx
|
||||
var mfa_section_exports = {};
|
||||
__export(mfa_section_exports, {
|
||||
MfaSection: () => MfaSection
|
||||
});
|
||||
module.exports = __toCommonJS(mfa_section_exports);
|
||||
var import_otp = require("@oslojs/otp");
|
||||
var import_use_async_callback = require("@stackframe/stack-shared/dist/hooks/use-async-callback");
|
||||
var import_crypto = require("@stackframe/stack-shared/dist/utils/crypto");
|
||||
var import_errors = require("@stackframe/stack-shared/dist/utils/errors");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var QRCode = __toESM(require("qrcode"));
|
||||
var import_react = require("react");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function MfaSection() {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const project = (0, import_hooks.useStackApp)().useProject();
|
||||
const user = (0, import_hooks.useUser)({ or: "throw" });
|
||||
const [generatedSecret, setGeneratedSecret] = (0, import_react.useState)(null);
|
||||
const [qrCodeUrl, setQrCodeUrl] = (0, import_react.useState)(null);
|
||||
const [mfaCode, setMfaCode] = (0, import_react.useState)("");
|
||||
const [isMaybeWrong, setIsMaybeWrong] = (0, import_react.useState)(false);
|
||||
const isEnabled = user.isMultiFactorRequired;
|
||||
const [handleSubmit, isLoading] = (0, import_use_async_callback.useAsyncCallback)(async () => {
|
||||
await user.update({
|
||||
totpMultiFactorSecret: generatedSecret
|
||||
});
|
||||
setGeneratedSecret(null);
|
||||
setQrCodeUrl(null);
|
||||
setMfaCode("");
|
||||
}, [generatedSecret, user]);
|
||||
(0, import_react.useEffect)(() => {
|
||||
setIsMaybeWrong(false);
|
||||
(0, import_promises.runAsynchronouslyWithAlert)(async () => {
|
||||
if (generatedSecret && (0, import_otp.verifyTOTP)(generatedSecret, 30, 6, mfaCode)) {
|
||||
await handleSubmit();
|
||||
}
|
||||
setIsMaybeWrong(true);
|
||||
});
|
||||
}, [mfaCode, generatedSecret, handleSubmit]);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_section.Section,
|
||||
{
|
||||
title: t("Multi-factor authentication"),
|
||||
description: isEnabled ? t("Multi-factor authentication is currently enabled.") : t("Multi-factor authentication is currently disabled."),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
||||
!isEnabled && generatedSecret && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("Scan this QR code with your authenticator app:") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { width: 200, height: 200, src: qrCodeUrl ?? (0, import_errors.throwErr)("TOTP QR code failed to generate"), alt: t("TOTP multi-factor authentication QR code") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("Then, enter your six-digit MFA code:") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Input,
|
||||
{
|
||||
value: mfaCode,
|
||||
onChange: (e) => {
|
||||
setIsMaybeWrong(false);
|
||||
setMfaCode(e.target.value);
|
||||
},
|
||||
placeholder: "123456",
|
||||
maxLength: 6,
|
||||
disabled: isLoading
|
||||
}
|
||||
),
|
||||
isMaybeWrong && mfaCode.length === 6 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "destructive", children: t("Incorrect code. Please try again.") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: () => {
|
||||
setGeneratedSecret(null);
|
||||
setQrCodeUrl(null);
|
||||
setMfaCode("");
|
||||
},
|
||||
children: t("Cancel")
|
||||
}
|
||||
) })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex gap-2", children: isEnabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: async () => {
|
||||
await user.update({
|
||||
totpMultiFactorSecret: null
|
||||
});
|
||||
},
|
||||
children: t("Disable MFA")
|
||||
}
|
||||
) : !generatedSecret && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: async () => {
|
||||
const secret = (0, import_crypto.generateRandomValues)(new Uint8Array(20));
|
||||
setQrCodeUrl(await generateTotpQrCode(project, user, secret));
|
||||
setGeneratedSecret(secret);
|
||||
},
|
||||
children: t("Enable MFA")
|
||||
}
|
||||
) })
|
||||
] })
|
||||
}
|
||||
);
|
||||
}
|
||||
async function generateTotpQrCode(project, user, secret) {
|
||||
const uri = (0, import_otp.createTOTPKeyURI)(project.displayName, user.primaryEmail ?? user.id, secret, 30, 6);
|
||||
return await QRCode.toDataURL(uri);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
MfaSection
|
||||
});
|
||||
//# sourceMappingURL=mfa-section.js.map
|
||||
File diff suppressed because one or more lines are too long
89
package/@stackframe/react/dist/components-page/account-settings/email-and-auth/otp-section.js
vendored
Normal file
89
package/@stackframe/react/dist/components-page/account-settings/email-and-auth/otp-section.js
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/email-and-auth/otp-section.tsx
|
||||
var otp_section_exports = {};
|
||||
__export(otp_section_exports, {
|
||||
OtpSection: () => OtpSection
|
||||
});
|
||||
module.exports = __toCommonJS(otp_section_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function OtpSection() {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import_hooks.useUser)({ or: "throw" });
|
||||
const project = (0, import_hooks.useStackApp)().useProject();
|
||||
const contactChannels = user.useContactChannels();
|
||||
const isLastAuth = user.otpAuthEnabled && !user.hasPassword && user.oauthProviders.length === 0 && !user.passkeyAuthEnabled;
|
||||
const [disabling, setDisabling] = (0, import_react.useState)(false);
|
||||
const hasValidEmail = contactChannels.filter((x) => x.type === "email" && x.isVerified && x.usedForAuth).length > 0;
|
||||
if (!project.config.magicLinkEnabled) {
|
||||
return null;
|
||||
}
|
||||
const handleDisableOTP = async () => {
|
||||
await user.update({ otpAuthEnabled: false });
|
||||
setDisabling(false);
|
||||
};
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_section.Section, { title: t("OTP sign-in"), description: user.otpAuthEnabled ? t("OTP/magic link sign-in is currently enabled.") : t("Enable sign-in via magic link or OTP sent to your sign-in emails."), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex md:justify-end", children: hasValidEmail ? user.otpAuthEnabled ? !isLastAuth ? !disabling ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: () => setDisabling(true),
|
||||
children: t("Disable OTP")
|
||||
}
|
||||
) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "destructive", children: t("Are you sure you want to disable OTP sign-in? You will not be able to sign in with only emails anymore.") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "destructive",
|
||||
onClick: handleDisableOTP,
|
||||
children: t("Disable")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: () => setDisabling(false),
|
||||
children: t("Cancel")
|
||||
}
|
||||
)
|
||||
] })
|
||||
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", type: "label", children: t("OTP sign-in is enabled and cannot be disabled as it is currently the only sign-in method") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: async () => {
|
||||
await user.update({ otpAuthEnabled: true });
|
||||
},
|
||||
children: t("Enable OTP")
|
||||
}
|
||||
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", type: "label", children: t("To enable OTP sign-in, please add a verified sign-in email.") }) }) });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
OtpSection
|
||||
});
|
||||
//# sourceMappingURL=otp-section.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/email-and-auth/otp-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Button, Typography } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { useStackApp, useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { Section } from \"../section\";\n\nexport function OtpSection() {\n const { t } = useTranslation();\n const user = useUser({ or: \"throw\" });\n const project = useStackApp().useProject();\n const contactChannels = user.useContactChannels();\n const isLastAuth = user.otpAuthEnabled && !user.hasPassword && user.oauthProviders.length === 0 && !user.passkeyAuthEnabled;\n const [disabling, setDisabling] = useState(false);\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const hasValidEmail = contactChannels.filter(x => x.type === 'email' && x.isVerified && x.usedForAuth).length > 0;\n\n if (!project.config.magicLinkEnabled) {\n return null;\n }\n\n const handleDisableOTP = async () => {\n await user.update({ otpAuthEnabled: false });\n setDisabling(false);\n };\n\n return (\n <Section title={t(\"OTP sign-in\")} description={user.otpAuthEnabled ? t(\"OTP/magic link sign-in is currently enabled.\") : t(\"Enable sign-in via magic link or OTP sent to your sign-in emails.\")}>\n <div className='flex md:justify-end'>\n {hasValidEmail ? (\n user.otpAuthEnabled ? (\n !isLastAuth ? (\n !disabling ? (\n <Button\n variant='secondary'\n onClick={() => setDisabling(true)}\n >\n {t(\"Disable OTP\")}\n </Button>\n ) : (\n <div className='flex flex-col gap-2'>\n <Typography variant='destructive'>\n {t(\"Are you sure you want to disable OTP sign-in? You will not be able to sign in with only emails anymore.\")}\n </Typography>\n <div className='flex gap-2'>\n <Button\n variant='destructive'\n onClick={handleDisableOTP}\n >\n {t(\"Disable\")}\n </Button>\n <Button\n variant='secondary'\n onClick={() => setDisabling(false)}\n >\n {t(\"Cancel\")}\n </Button>\n </div>\n </div>\n )\n ) : (\n <Typography variant='secondary' type='label'>{t(\"OTP sign-in is enabled and cannot be disabled as it is currently the only sign-in method\")}</Typography>\n )\n ) : (\n <Button\n variant='secondary'\n onClick={async () => {\n await user.update({ otpAuthEnabled: true });\n }}\n >\n {t(\"Enable OTP\")}\n </Button>\n )\n ) : (\n <Typography variant='secondary' type='label'>{t(\"To enable OTP sign-in, please add a verified sign-in email.\")}</Typography>\n )}\n </div>\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAAmC;AACnC,mBAAyB;AACzB,mBAAqC;AACrC,0BAA+B;AAC/B,qBAAwB;AA6BR;AA3BT,SAAS,aAAa;AAC3B,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,QAAQ,CAAC;AACpC,QAAM,cAAU,0BAAY,EAAE,WAAW;AACzC,QAAM,kBAAkB,KAAK,mBAAmB;AAChD,QAAM,aAAa,KAAK,kBAAkB,CAAC,KAAK,eAAe,KAAK,eAAe,WAAW,KAAK,CAAC,KAAK;AACzG,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,KAAK;AAGhD,QAAM,gBAAgB,gBAAgB,OAAO,OAAK,EAAE,SAAS,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS;AAEhH,MAAI,CAAC,QAAQ,OAAO,kBAAkB;AACpC,WAAO;AAAA,EACT;AAEA,QAAM,mBAAmB,YAAY;AACnC,UAAM,KAAK,OAAO,EAAE,gBAAgB,MAAM,CAAC;AAC3C,iBAAa,KAAK;AAAA,EACpB;AAEA,SACE,4CAAC,0BAAQ,OAAO,EAAE,aAAa,GAAG,aAAa,KAAK,iBAAiB,EAAE,8CAA8C,IAAI,EAAE,mEAAmE,GAC5L,sDAAC,SAAI,WAAU,uBACZ,0BACC,KAAK,iBACH,CAAC,aACC,CAAC,YACC;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,SAAS,MAAM,aAAa,IAAI;AAAA,MAE/B,YAAE,aAAa;AAAA;AAAA,EAClB,IAEA,6CAAC,SAAI,WAAU,uBACb;AAAA,gDAAC,8BAAW,SAAQ,eACjB,YAAE,yGAAyG,GAC9G;AAAA,IACA,6CAAC,SAAI,WAAU,cACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS;AAAA,UAER,YAAE,SAAS;AAAA;AAAA,MACd;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,MAAM,aAAa,KAAK;AAAA,UAEhC,YAAE,QAAQ;AAAA;AAAA,MACb;AAAA,OACF;AAAA,KACF,IAGF,4CAAC,8BAAW,SAAQ,aAAY,MAAK,SAAS,YAAE,0FAA0F,GAAE,IAG9I;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,SAAS,YAAY;AACnB,cAAM,KAAK,OAAO,EAAE,gBAAgB,KAAK,CAAC;AAAA,MAC5C;AAAA,MAEC,YAAE,YAAY;AAAA;AAAA,EACjB,IAGF,4CAAC,8BAAW,SAAQ,aAAY,MAAK,SAAS,YAAE,6DAA6D,GAAE,GAEnH,GACF;AAEJ;","names":[]}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/email-and-auth/passkey-section.tsx
|
||||
var passkey_section_exports = {};
|
||||
__export(passkey_section_exports, {
|
||||
PasskeySection: () => PasskeySection
|
||||
});
|
||||
module.exports = __toCommonJS(passkey_section_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import__ = require("../../..");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function PasskeySection() {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import_hooks.useUser)({ or: "throw" });
|
||||
const stackApp = (0, import__.useStackApp)();
|
||||
const project = stackApp.useProject();
|
||||
const contactChannels = user.useContactChannels();
|
||||
const hasPasskey = user.passkeyAuthEnabled;
|
||||
const isLastAuth = user.passkeyAuthEnabled && !user.hasPassword && user.oauthProviders.length === 0 && !user.otpAuthEnabled;
|
||||
const [showConfirmationModal, setShowConfirmationModal] = (0, import_react.useState)(false);
|
||||
const hasValidEmail = contactChannels.filter((x) => x.type === "email" && x.isVerified && x.usedForAuth).length > 0;
|
||||
if (!project.config.passkeyEnabled) {
|
||||
return null;
|
||||
}
|
||||
const handleDeletePasskey = async () => {
|
||||
await user.update({ passkeyAuthEnabled: false });
|
||||
setShowConfirmationModal(false);
|
||||
};
|
||||
const handleAddNewPasskey = async () => {
|
||||
await user.registerPasskey();
|
||||
};
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_section.Section, { title: t("Passkey"), description: hasPasskey ? t("Passkey registered") : t("Register a passkey"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex md:justify-end gap-2", children: [
|
||||
!hasValidEmail && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", type: "label", children: t("To enable Passkey sign-in, please add a verified sign-in email.") }),
|
||||
hasValidEmail && hasPasskey && isLastAuth && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", type: "label", children: t("Passkey sign-in is enabled and cannot be disabled as it is currently the only sign-in method") }),
|
||||
!hasPasskey && hasValidEmail && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { onClick: handleAddNewPasskey, variant: "secondary", children: t("Add new passkey") }) }),
|
||||
hasValidEmail && hasPasskey && !isLastAuth && !showConfirmationModal && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: () => setShowConfirmationModal(true),
|
||||
children: t("Delete Passkey")
|
||||
}
|
||||
),
|
||||
hasValidEmail && hasPasskey && !isLastAuth && showConfirmationModal && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "destructive", children: t("Are you sure you want to disable Passkey sign-in? You will not be able to sign in with your passkey anymore.") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "destructive",
|
||||
onClick: handleDeletePasskey,
|
||||
children: t("Disable")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: () => setShowConfirmationModal(false),
|
||||
children: t("Cancel")
|
||||
}
|
||||
)
|
||||
] })
|
||||
] })
|
||||
] }) }) });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
PasskeySection
|
||||
});
|
||||
//# sourceMappingURL=passkey-section.js.map
|
||||
File diff suppressed because one or more lines are too long
181
package/@stackframe/react/dist/components-page/account-settings/email-and-auth/password-section.js
vendored
Normal file
181
package/@stackframe/react/dist/components-page/account-settings/email-and-auth/password-section.js
vendored
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/email-and-auth/password-section.tsx
|
||||
var password_section_exports = {};
|
||||
__export(password_section_exports, {
|
||||
PasswordSection: () => PasswordSection
|
||||
});
|
||||
module.exports = __toCommonJS(password_section_exports);
|
||||
var import_yup = require("@hookform/resolvers/yup");
|
||||
var import_password = require("@stackframe/stack-shared/dist/helpers/password");
|
||||
var import_schema_fields = require("@stackframe/stack-shared/dist/schema-fields");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_react_hook_form = require("react-hook-form");
|
||||
var yup = __toESM(require("yup"));
|
||||
var import__ = require("../../..");
|
||||
var import_form_warning = require("../../../components/elements/form-warning");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function PasswordSection() {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import_hooks.useUser)({ or: "throw" });
|
||||
const contactChannels = user.useContactChannels();
|
||||
const [changingPassword, setChangingPassword] = (0, import_react.useState)(false);
|
||||
const [loading, setLoading] = (0, import_react.useState)(false);
|
||||
const project = (0, import__.useStackApp)().useProject();
|
||||
const passwordSchema = (0, import_schema_fields.yupObject)({
|
||||
oldPassword: user.hasPassword ? import_schema_fields.passwordSchema.defined().nonEmpty(t("Please enter your old password")) : (0, import_schema_fields.yupString)(),
|
||||
newPassword: import_schema_fields.passwordSchema.defined().nonEmpty(t("Please enter your password")).test({
|
||||
name: "is-valid-password",
|
||||
test: (value, ctx) => {
|
||||
const error = (0, import_password.getPasswordError)(value);
|
||||
if (error) {
|
||||
return ctx.createError({ message: error.message });
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}),
|
||||
newPasswordRepeat: (0, import_schema_fields.yupString)().nullable().oneOf([yup.ref("newPassword"), "", null], t("Passwords do not match")).defined().nonEmpty(t("Please repeat your password"))
|
||||
});
|
||||
const { register, handleSubmit, setError, formState: { errors }, clearErrors, reset } = (0, import_react_hook_form.useForm)({
|
||||
resolver: (0, import_yup.yupResolver)(passwordSchema)
|
||||
});
|
||||
const hasValidEmail = contactChannels.filter((x) => x.type === "email" && x.usedForAuth).length > 0;
|
||||
const onSubmit = async (data) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { oldPassword, newPassword } = data;
|
||||
const error = user.hasPassword ? await user.updatePassword({ oldPassword, newPassword }) : await user.setPassword({ password: newPassword });
|
||||
if (error) {
|
||||
setError("oldPassword", { type: "manual", message: t("Incorrect password") });
|
||||
} else {
|
||||
reset();
|
||||
setChangingPassword(false);
|
||||
}
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
const registerPassword = register("newPassword");
|
||||
const registerPasswordRepeat = register("newPasswordRepeat");
|
||||
if (!project.config.credentialEnabled) {
|
||||
return null;
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_section.Section,
|
||||
{
|
||||
title: t("Password"),
|
||||
description: user.hasPassword ? t("Update your password") : t("Set a password for your account"),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-col gap-4", children: !changingPassword ? hasValidEmail ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: () => setChangingPassword(true),
|
||||
children: user.hasPassword ? t("Update password") : t("Set password")
|
||||
}
|
||||
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", type: "label", children: t("To set a password, please add a sign-in email.") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
"form",
|
||||
{
|
||||
onSubmit: (e) => (0, import_promises.runAsynchronouslyWithAlert)(handleSubmit(onSubmit)(e)),
|
||||
noValidate: true,
|
||||
children: [
|
||||
user.hasPassword && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "old-password", className: "mb-1", children: t("Old password") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Input,
|
||||
{
|
||||
id: "old-password",
|
||||
type: "password",
|
||||
autoComplete: "current-password",
|
||||
...register("oldPassword")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.oldPassword?.message?.toString() })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "new-password", className: "mt-4 mb-1", children: t("New password") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.PasswordInput,
|
||||
{
|
||||
id: "new-password",
|
||||
autoComplete: "new-password",
|
||||
...registerPassword,
|
||||
onChange: (e) => {
|
||||
clearErrors("newPassword");
|
||||
clearErrors("newPasswordRepeat");
|
||||
(0, import_promises.runAsynchronously)(registerPassword.onChange(e));
|
||||
}
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.newPassword?.message?.toString() }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "repeat-password", className: "mt-4 mb-1", children: t("Repeat new password") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.PasswordInput,
|
||||
{
|
||||
id: "repeat-password",
|
||||
autoComplete: "new-password",
|
||||
...registerPasswordRepeat,
|
||||
onChange: (e) => {
|
||||
clearErrors("newPassword");
|
||||
clearErrors("newPasswordRepeat");
|
||||
(0, import_promises.runAsynchronously)(registerPasswordRepeat.onChange(e));
|
||||
}
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.newPasswordRepeat?.message?.toString() }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mt-6 flex gap-4", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { type: "submit", loading, children: user.hasPassword ? t("Update Password") : t("Set Password") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: () => {
|
||||
setChangingPassword(false);
|
||||
reset();
|
||||
},
|
||||
children: t("Cancel")
|
||||
}
|
||||
)
|
||||
] })
|
||||
]
|
||||
}
|
||||
) })
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
PasswordSection
|
||||
});
|
||||
//# sourceMappingURL=password-section.js.map
|
||||
File diff suppressed because one or more lines are too long
34
package/@stackframe/react/dist/components-page/account-settings/page-layout.js
vendored
Normal file
34
package/@stackframe/react/dist/components-page/account-settings/page-layout.js
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/page-layout.tsx
|
||||
var page_layout_exports = {};
|
||||
__export(page_layout_exports, {
|
||||
PageLayout: () => PageLayout
|
||||
});
|
||||
module.exports = __toCommonJS(page_layout_exports);
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function PageLayout(props) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-col gap-6", children: props.children });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
PageLayout
|
||||
});
|
||||
//# sourceMappingURL=page-layout.js.map
|
||||
1
package/@stackframe/react/dist/components-page/account-settings/page-layout.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/account-settings/page-layout.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../src/components-page/account-settings/page-layout.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nexport function PageLayout(props: { children: React.ReactNode }) {\n return (\n <div className='flex flex-col gap-6'>\n {props.children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMI;AAFG,SAAS,WAAW,OAAsC;AAC/D,SACE,4CAAC,SAAI,WAAU,uBACZ,gBAAM,UACT;AAEJ;","names":[]}
|
||||
75
package/@stackframe/react/dist/components-page/account-settings/profile-page/profile-page.js
vendored
Normal file
75
package/@stackframe/react/dist/components-page/account-settings/profile-page/profile-page.js
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/profile-page/profile-page.tsx
|
||||
var profile_page_exports = {};
|
||||
__export(profile_page_exports, {
|
||||
ProfilePage: () => ProfilePage
|
||||
});
|
||||
module.exports = __toCommonJS(profile_page_exports);
|
||||
var import_profile_image_editor = require("../../../components/profile-image-editor");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_editable_text = require("../editable-text");
|
||||
var import_page_layout = require("../page-layout");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function ProfilePage() {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_page_layout.PageLayout, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_section.Section,
|
||||
{
|
||||
title: t("User name"),
|
||||
description: t("This is a display name and is not used for authentication"),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_editable_text.EditableText,
|
||||
{
|
||||
value: user.displayName || "",
|
||||
onSave: async (newDisplayName) => {
|
||||
await user.update({ displayName: newDisplayName });
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_section.Section,
|
||||
{
|
||||
title: t("Profile image"),
|
||||
description: t("Upload your own image as your avatar"),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_profile_image_editor.ProfileImageEditor,
|
||||
{
|
||||
user,
|
||||
onProfileImageUrlChange: async (profileImageUrl) => {
|
||||
await user.update({ profileImageUrl });
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
] });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
ProfilePage
|
||||
});
|
||||
//# sourceMappingURL=profile-page.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/profile-page/profile-page.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { ProfileImageEditor } from \"../../../components/profile-image-editor\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { EditableText } from \"../editable-text\";\nimport { PageLayout } from \"../page-layout\";\nimport { Section } from \"../section\";\n\nexport function ProfilePage() {\n const { t } = useTranslation();\n const user = useUser({ or: 'redirect' });\n\n return (\n <PageLayout>\n <Section\n title={t(\"User name\")}\n description={t(\"This is a display name and is not used for authentication\")}\n >\n <EditableText\n value={user.displayName || ''}\n onSave={async (newDisplayName) => {\n await user.update({ displayName: newDisplayName });\n }}/>\n </Section>\n\n <Section\n title={t(\"Profile image\")}\n description={t(\"Upload your own image as your avatar\")}\n >\n <ProfileImageEditor\n user={user}\n onProfileImageUrlChange={async (profileImageUrl) => {\n await user.update({ profileImageUrl });\n }}\n />\n </Section>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kCAAmC;AACnC,mBAAwB;AACxB,0BAA+B;AAC/B,2BAA6B;AAC7B,yBAA2B;AAC3B,qBAAwB;AAOpB;AALG,SAAS,cAAc;AAC5B,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AAEvC,SACE,6CAAC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,WAAW;AAAA,QACpB,aAAa,EAAE,2DAA2D;AAAA,QAE1E;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,KAAK,eAAe;AAAA,YAC3B,QAAQ,OAAO,mBAAmB;AAChC,oBAAM,KAAK,OAAO,EAAE,aAAa,eAAe,CAAC;AAAA,YACnD;AAAA;AAAA,QAAE;AAAA;AAAA,IACN;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,eAAe;AAAA,QACxB,aAAa,EAAE,sCAAsC;AAAA,QAErD;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,yBAAyB,OAAO,oBAAoB;AAClD,oBAAM,KAAK,OAAO,EAAE,gBAAgB,CAAC;AAAA,YACvC;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
|
||||
44
package/@stackframe/react/dist/components-page/account-settings/section.js
vendored
Normal file
44
package/@stackframe/react/dist/components-page/account-settings/section.js
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/section.tsx
|
||||
var section_exports = {};
|
||||
__export(section_exports, {
|
||||
Section: () => Section
|
||||
});
|
||||
module.exports = __toCommonJS(section_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function Section(props) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Separator, {}),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col sm:flex-row gap-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sm:flex-1 flex flex-col justify-center", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { className: "font-medium", children: props.title }),
|
||||
props.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", type: "footnote", children: props.description })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sm:flex-1 sm:items-end flex flex-col gap-2 ", children: props.children })
|
||||
] })
|
||||
] });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Section
|
||||
});
|
||||
//# sourceMappingURL=section.js.map
|
||||
1
package/@stackframe/react/dist/components-page/account-settings/section.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/account-settings/section.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../src/components-page/account-settings/section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Separator, Typography } from \"@stackframe/stack-ui\";\n\nexport function Section(props: { title: string, description?: string, children: React.ReactNode }) {\n return (\n <>\n <Separator />\n <div className='flex flex-col sm:flex-row gap-2'>\n <div className='sm:flex-1 flex flex-col justify-center'>\n <Typography className='font-medium'>\n {props.title}\n </Typography>\n {props.description && <Typography variant='secondary' type='footnote'>\n {props.description}\n </Typography>}\n </div>\n <div className='sm:flex-1 sm:items-end flex flex-col gap-2 '>\n {props.children}\n </div>\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAAsC;AAIlC;AAFG,SAAS,QAAQ,OAA2E;AACjG,SACE,4EACE;AAAA,gDAAC,6BAAU;AAAA,IACX,6CAAC,SAAI,WAAU,mCACb;AAAA,mDAAC,SAAI,WAAU,0CACb;AAAA,oDAAC,8BAAW,WAAU,eACnB,gBAAM,OACT;AAAA,QACC,MAAM,eAAe,4CAAC,8BAAW,SAAQ,aAAY,MAAK,YACxD,gBAAM,aACT;AAAA,SACF;AAAA,MACA,4CAAC,SAAI,WAAU,+CACZ,gBAAM,UACT;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/settings/delete-account-section.tsx
|
||||
var delete_account_section_exports = {};
|
||||
__export(delete_account_section_exports, {
|
||||
DeleteAccountSection: () => DeleteAccountSection
|
||||
});
|
||||
module.exports = __toCommonJS(delete_account_section_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function DeleteAccountSection() {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
const app = (0, import_hooks.useStackApp)();
|
||||
const project = app.useProject();
|
||||
const [deleting, setDeleting] = (0, import_react.useState)(false);
|
||||
if (!project.config.clientUserDeletionEnabled) {
|
||||
return null;
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_section.Section,
|
||||
{
|
||||
title: t("Delete Account"),
|
||||
description: t("Permanently remove your account and all associated data"),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "stack-scope flex flex-col items-stretch", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Accordion, { type: "single", collapsible: true, className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.AccordionItem, { value: "item-1", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.AccordionTrigger, { children: t("Danger zone") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.AccordionContent, { children: !deleting ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "destructive",
|
||||
onClick: () => setDeleting(true),
|
||||
children: t("Delete account")
|
||||
}
|
||||
) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "destructive", children: t("Are you sure you want to delete your account? This action is IRREVERSIBLE and will delete ALL associated data.") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "destructive",
|
||||
onClick: async () => {
|
||||
await user.delete();
|
||||
await app.redirectToHome();
|
||||
},
|
||||
children: t("Delete Account")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: () => setDeleting(false),
|
||||
children: t("Cancel")
|
||||
}
|
||||
)
|
||||
] })
|
||||
] }) })
|
||||
] }) }) })
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
DeleteAccountSection
|
||||
});
|
||||
//# sourceMappingURL=delete-account-section.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/settings/delete-account-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Button, Typography } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { useStackApp, useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { Section } from \"../section\";\n\nexport function DeleteAccountSection() {\n const { t } = useTranslation();\n const user = useUser({ or: 'redirect' });\n const app = useStackApp();\n const project = app.useProject();\n const [deleting, setDeleting] = useState(false);\n if (!project.config.clientUserDeletionEnabled) {\n return null;\n }\n\n return (\n <Section\n title={t(\"Delete Account\")}\n description={t(\"Permanently remove your account and all associated data\")}\n >\n <div className='stack-scope flex flex-col items-stretch'>\n <Accordion type=\"single\" collapsible className=\"w-full\">\n <AccordionItem value=\"item-1\">\n <AccordionTrigger>{t(\"Danger zone\")}</AccordionTrigger>\n <AccordionContent>\n {!deleting ? (\n <div>\n <Button\n variant='destructive'\n onClick={() => setDeleting(true)}\n >\n {t(\"Delete account\")}\n </Button>\n </div>\n ) : (\n <div className='flex flex-col gap-2'>\n <Typography variant='destructive'>\n {t(\"Are you sure you want to delete your account? This action is IRREVERSIBLE and will delete ALL associated data.\")}\n </Typography>\n <div className='flex gap-2'>\n <Button\n variant='destructive'\n onClick={async () => {\n await user.delete();\n await app.redirectToHome();\n }}\n >\n {t(\"Delete Account\")}\n </Button>\n <Button\n variant='secondary'\n onClick={() => setDeleting(false)}\n >\n {t(\"Cancel\")}\n </Button>\n </div>\n </div>\n )}\n </AccordionContent>\n </AccordionItem>\n </Accordion>\n </div>\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAAiG;AACjG,mBAAyB;AACzB,mBAAqC;AACrC,0BAA+B;AAC/B,qBAAwB;AAoBZ;AAlBL,SAAS,uBAAuB;AACrC,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,UAAM,0BAAY;AACxB,QAAM,UAAU,IAAI,WAAW;AAC/B,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAS,KAAK;AAC9C,MAAI,CAAC,QAAQ,OAAO,2BAA2B;AAC7C,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,gBAAgB;AAAA,MACzB,aAAa,EAAE,yDAAyD;AAAA,MAExE,sDAAC,SAAI,WAAU,2CACb,sDAAC,6BAAU,MAAK,UAAS,aAAW,MAAC,WAAU,UAC7C,uDAAC,iCAAc,OAAM,UACnB;AAAA,oDAAC,oCAAkB,YAAE,aAAa,GAAE;AAAA,QACpC,4CAAC,oCACE,WAAC,WACA,4CAAC,SACC;AAAA,UAAC;AAAA;AAAA,YACC,SAAQ;AAAA,YACR,SAAS,MAAM,YAAY,IAAI;AAAA,YAE9B,YAAE,gBAAgB;AAAA;AAAA,QACrB,GACF,IAEA,6CAAC,SAAI,WAAU,uBACb;AAAA,sDAAC,8BAAW,SAAQ,eACjB,YAAE,gHAAgH,GACrH;AAAA,UACA,6CAAC,SAAI,WAAU,cACb;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,SAAS,YAAY;AACnB,wBAAM,KAAK,OAAO;AAClB,wBAAM,IAAI,eAAe;AAAA,gBAC3B;AAAA,gBAEC,YAAE,gBAAgB;AAAA;AAAA,YACrB;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,SAAS,MAAM,YAAY,KAAK;AAAA,gBAE/B,YAAE,QAAQ;AAAA;AAAA,YACb;AAAA,aACF;AAAA,WACF,GAEJ;AAAA,SACF,GACF,GACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
||||
40
package/@stackframe/react/dist/components-page/account-settings/settings/settings-page.js
vendored
Normal file
40
package/@stackframe/react/dist/components-page/account-settings/settings/settings-page.js
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/settings/settings-page.tsx
|
||||
var settings_page_exports = {};
|
||||
__export(settings_page_exports, {
|
||||
SettingsPage: () => SettingsPage
|
||||
});
|
||||
module.exports = __toCommonJS(settings_page_exports);
|
||||
var import_page_layout = require("../page-layout");
|
||||
var import_delete_account_section = require("./delete-account-section");
|
||||
var import_sign_out_section = require("./sign-out-section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function SettingsPage() {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_page_layout.PageLayout, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_delete_account_section.DeleteAccountSection, {}),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sign_out_section.SignOutSection, {})
|
||||
] });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
SettingsPage
|
||||
});
|
||||
//# sourceMappingURL=settings-page.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/settings/settings-page.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { PageLayout } from \"../page-layout\";\nimport { DeleteAccountSection } from \"./delete-account-section\";\nimport { SignOutSection } from \"./sign-out-section\";\n\n\nexport function SettingsPage() {\n return (\n <PageLayout>\n <DeleteAccountSection />\n <SignOutSection />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,yBAA2B;AAC3B,oCAAqC;AACrC,8BAA+B;AAK3B;AAFG,SAAS,eAAe;AAC7B,SACE,6CAAC,iCACC;AAAA,gDAAC,sDAAqB;AAAA,IACtB,4CAAC,0CAAe;AAAA,KAClB;AAEJ;","names":[]}
|
||||
54
package/@stackframe/react/dist/components-page/account-settings/settings/sign-out-section.js
vendored
Normal file
54
package/@stackframe/react/dist/components-page/account-settings/settings/sign-out-section.js
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/settings/sign-out-section.tsx
|
||||
var sign_out_section_exports = {};
|
||||
__export(sign_out_section_exports, {
|
||||
SignOutSection: () => SignOutSection
|
||||
});
|
||||
module.exports = __toCommonJS(sign_out_section_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function SignOutSection() {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import_hooks.useUser)({ or: "throw" });
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_section.Section,
|
||||
{
|
||||
title: t("Sign out"),
|
||||
description: t("End your current session"),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: () => user.signOut(),
|
||||
children: t("Sign out")
|
||||
}
|
||||
) })
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
SignOutSection
|
||||
});
|
||||
//# sourceMappingURL=sign-out-section.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/settings/sign-out-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Button } from \"@stackframe/stack-ui\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { Section } from \"../section\";\n\nexport function SignOutSection() {\n const { t } = useTranslation();\n const user = useUser({ or: \"throw\" });\n\n return (\n <Section\n title={t(\"Sign out\")}\n description={t(\"End your current session\")}\n >\n <div>\n <Button\n variant='secondary'\n onClick={() => user.signOut()}\n >\n {t(\"Sign out\")}\n </Button>\n </div>\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAAuB;AACvB,mBAAwB;AACxB,0BAA+B;AAC/B,qBAAwB;AAYhB;AAVD,SAAS,iBAAiB;AAC/B,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,QAAQ,CAAC;AAEpC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,UAAU;AAAA,MACnB,aAAa,EAAE,0BAA0B;AAAA,MAEzC,sDAAC,SACC;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,MAAM,KAAK,QAAQ;AAAA,UAE3B,YAAE,UAAU;AAAA;AAAA,MACf,GACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
||||
79
package/@stackframe/react/dist/components-page/account-settings/teams/leave-team-section.js
vendored
Normal file
79
package/@stackframe/react/dist/components-page/account-settings/teams/leave-team-section.js
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/teams/leave-team-section.tsx
|
||||
var leave_team_section_exports = {};
|
||||
__export(leave_team_section_exports, {
|
||||
LeaveTeamSection: () => LeaveTeamSection
|
||||
});
|
||||
module.exports = __toCommonJS(leave_team_section_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function LeaveTeamSection(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
const [leaving, setLeaving] = (0, import_react.useState)(false);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_section.Section,
|
||||
{
|
||||
title: t("Leave Team"),
|
||||
description: t("leave this team and remove your team profile"),
|
||||
children: !leaving ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: () => setLeaving(true),
|
||||
children: t("Leave team")
|
||||
}
|
||||
) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "destructive", children: t("Are you sure you want to leave the team?") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "destructive",
|
||||
onClick: async () => {
|
||||
await user.leaveTeam(props.team);
|
||||
window.location.reload();
|
||||
},
|
||||
children: t("Leave")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "secondary",
|
||||
onClick: () => setLeaving(false),
|
||||
children: t("Cancel")
|
||||
}
|
||||
)
|
||||
] })
|
||||
] })
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
LeaveTeamSection
|
||||
});
|
||||
//# sourceMappingURL=leave-team-section.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/teams/leave-team-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Button, Typography } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { Team } from \"../../..\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { Section } from \"../section\";\n\nexport function LeaveTeamSection(props: { team: Team }) {\n const { t } = useTranslation();\n const user = useUser({ or: 'redirect' });\n const [leaving, setLeaving] = useState(false);\n\n return (\n <Section\n title={t(\"Leave Team\")}\n description={t(\"leave this team and remove your team profile\")}\n >\n {!leaving ? (\n <div>\n <Button\n variant='secondary'\n onClick={() => setLeaving(true)}\n >\n {t(\"Leave team\")}\n </Button>\n </div>\n ) : (\n <div className='flex flex-col gap-2'>\n <Typography variant='destructive'>\n {t(\"Are you sure you want to leave the team?\")}\n </Typography>\n <div className='flex gap-2'>\n <Button\n variant='destructive'\n onClick={async () => {\n await user.leaveTeam(props.team);\n window.location.reload();\n }}\n >\n {t(\"Leave\")}\n </Button>\n <Button\n variant='secondary'\n onClick={() => setLeaving(false)}\n >\n {t(\"Cancel\")}\n </Button>\n </div>\n </div>\n )}\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAAmC;AACnC,mBAAyB;AAEzB,mBAAwB;AACxB,0BAA+B;AAC/B,qBAAwB;AAcd;AAZH,SAAS,iBAAiB,OAAuB;AACtD,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAE5C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,YAAY;AAAA,MACrB,aAAa,EAAE,8CAA8C;AAAA,MAE5D,WAAC,UACA,4CAAC,SACC;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,MAAM,WAAW,IAAI;AAAA,UAE7B,YAAE,YAAY;AAAA;AAAA,MACjB,GACF,IAEA,6CAAC,SAAI,WAAU,uBACb;AAAA,oDAAC,8BAAW,SAAQ,eACjB,YAAE,0CAA0C,GAC/C;AAAA,QACA,6CAAC,SAAI,WAAU,cACb;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAAS,YAAY;AACnB,sBAAM,KAAK,UAAU,MAAM,IAAI;AAC/B,uBAAO,SAAS,OAAO;AAAA,cACzB;AAAA,cAEC,YAAE,OAAO;AAAA;AAAA,UACZ;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAAS,MAAM,WAAW,KAAK;AAAA,cAE9B,YAAE,QAAQ;AAAA;AAAA,UACb;AAAA,WACF;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
||||
92
package/@stackframe/react/dist/components-page/account-settings/teams/team-api-keys-section.js
vendored
Normal file
92
package/@stackframe/react/dist/components-page/account-settings/teams/team-api-keys-section.js
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/teams/team-api-keys-section.tsx
|
||||
var team_api_keys_section_exports = {};
|
||||
__export(team_api_keys_section_exports, {
|
||||
TeamApiKeysSection: () => TeamApiKeysSection
|
||||
});
|
||||
module.exports = __toCommonJS(team_api_keys_section_exports);
|
||||
var import_errors = require("@stackframe/stack-shared/dist/utils/errors");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_api_key_dialogs = require("../../../components/api-key-dialogs");
|
||||
var import_api_key_table = require("../../../components/api-key-table");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function TeamApiKeysSection(props) {
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
const team = user.useTeam(props.team.id);
|
||||
const stackApp = (0, import_hooks.useStackApp)();
|
||||
const project = stackApp.useProject();
|
||||
if (!team) {
|
||||
throw new import_errors.StackAssertionError("Team not found");
|
||||
}
|
||||
const teamApiKeysEnabled = project.config.allowTeamApiKeys;
|
||||
const manageApiKeysPermission = user.usePermission(props.team, "$manage_api_keys");
|
||||
if (!manageApiKeysPermission || !teamApiKeysEnabled) {
|
||||
return null;
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TeamApiKeysSectionInner, { team: props.team });
|
||||
}
|
||||
function TeamApiKeysSectionInner(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const [isNewApiKeyDialogOpen, setIsNewApiKeyDialogOpen] = (0, import_react.useState)(false);
|
||||
const [returnedApiKey, setReturnedApiKey] = (0, import_react.useState)(null);
|
||||
const apiKeys = props.team.useApiKeys();
|
||||
const CreateDialog = import_api_key_dialogs.CreateApiKeyDialog;
|
||||
const ShowDialog = import_api_key_dialogs.ShowApiKeyDialog;
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_section.Section,
|
||||
{
|
||||
title: t("API Keys"),
|
||||
description: t("API keys grant programmatic access to your team."),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { onClick: () => setIsNewApiKeyDialogOpen(true), children: t("Create API Key") })
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_api_key_table.ApiKeyTable, { apiKeys }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
CreateDialog,
|
||||
{
|
||||
open: isNewApiKeyDialogOpen,
|
||||
onOpenChange: setIsNewApiKeyDialogOpen,
|
||||
onKeyCreated: setReturnedApiKey,
|
||||
createApiKey: async (data) => {
|
||||
const apiKey = await props.team.createApiKey(data);
|
||||
return apiKey;
|
||||
}
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
ShowDialog,
|
||||
{
|
||||
apiKey: returnedApiKey,
|
||||
onClose: () => setReturnedApiKey(null)
|
||||
}
|
||||
)
|
||||
] });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TeamApiKeysSection
|
||||
});
|
||||
//# sourceMappingURL=team-api-keys-section.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-api-keys-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { StackAssertionError } from \"@stackframe/stack-shared/dist/utils/errors\";\nimport { Button } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { CreateApiKeyDialog, ShowApiKeyDialog } from \"../../../components/api-key-dialogs\";\nimport { ApiKeyTable } from \"../../../components/api-key-table\";\nimport { useStackApp, useUser } from \"../../../lib/hooks\";\nimport { TeamApiKeyFirstView } from \"../../../lib/stack-app/api-keys\";\nimport { Team } from \"../../../lib/stack-app/teams\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { Section } from \"../section\";\n\n\nexport function TeamApiKeysSection(props: { team: Team }) {\n const user = useUser({ or: 'redirect' });\n const team = user.useTeam(props.team.id);\n const stackApp = useStackApp();\n const project = stackApp.useProject();\n\n if (!team) {\n throw new StackAssertionError(\"Team not found\");\n }\n\n const teamApiKeysEnabled = project.config.allowTeamApiKeys;\n const manageApiKeysPermission = user.usePermission(props.team, '$manage_api_keys');\n if (!manageApiKeysPermission || !teamApiKeysEnabled) {\n return null;\n }\n\n return <TeamApiKeysSectionInner team={props.team} />;\n}\n\nfunction TeamApiKeysSectionInner(props: { team: Team }) {\n const { t } = useTranslation();\n\n const [isNewApiKeyDialogOpen, setIsNewApiKeyDialogOpen] = useState(false);\n const [returnedApiKey, setReturnedApiKey] = useState<TeamApiKeyFirstView | null>(null);\n\n const apiKeys = props.team.useApiKeys();\n\n const CreateDialog = CreateApiKeyDialog<\"team\">;\n const ShowDialog = ShowApiKeyDialog<\"team\">;\n\n return (\n <>\n <Section\n title={t(\"API Keys\")}\n description={t(\"API keys grant programmatic access to your team.\")}\n >\n <Button onClick={() => setIsNewApiKeyDialogOpen(true)}>\n {t(\"Create API Key\")}\n </Button>\n </Section>\n <ApiKeyTable apiKeys={apiKeys} />\n\n <CreateDialog\n open={isNewApiKeyDialogOpen}\n onOpenChange={setIsNewApiKeyDialogOpen}\n onKeyCreated={setReturnedApiKey}\n createApiKey={async (data) => {\n const apiKey = await props.team.createApiKey(data);\n return apiKey;\n }}\n />\n <ShowDialog\n apiKey={returnedApiKey}\n onClose={() => setReturnedApiKey(null)}\n />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAAoC;AACpC,sBAAuB;AACvB,mBAAyB;AACzB,6BAAqD;AACrD,2BAA4B;AAC5B,mBAAqC;AAGrC,0BAA+B;AAC/B,qBAAwB;AAmBf;AAhBF,SAAS,mBAAmB,OAAuB;AACxD,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,OAAO,KAAK,QAAQ,MAAM,KAAK,EAAE;AACvC,QAAM,eAAW,0BAAY;AAC7B,QAAM,UAAU,SAAS,WAAW;AAEpC,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,kCAAoB,gBAAgB;AAAA,EAChD;AAEA,QAAM,qBAAqB,QAAQ,OAAO;AAC1C,QAAM,0BAA0B,KAAK,cAAc,MAAM,MAAM,kBAAkB;AACjF,MAAI,CAAC,2BAA2B,CAAC,oBAAoB;AACnD,WAAO;AAAA,EACT;AAEA,SAAO,4CAAC,2BAAwB,MAAM,MAAM,MAAM;AACpD;AAEA,SAAS,wBAAwB,OAAuB;AACtD,QAAM,EAAE,EAAE,QAAI,oCAAe;AAE7B,QAAM,CAAC,uBAAuB,wBAAwB,QAAI,uBAAS,KAAK;AACxE,QAAM,CAAC,gBAAgB,iBAAiB,QAAI,uBAAqC,IAAI;AAErF,QAAM,UAAU,MAAM,KAAK,WAAW;AAEtC,QAAM,eAAe;AACrB,QAAM,aAAa;AAEnB,SACE,4EACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,UAAU;AAAA,QACnB,aAAa,EAAE,kDAAkD;AAAA,QAEjE,sDAAC,0BAAO,SAAS,MAAM,yBAAyB,IAAI,GACjD,YAAE,gBAAgB,GACrB;AAAA;AAAA,IACF;AAAA,IACA,4CAAC,oCAAY,SAAkB;AAAA,IAE/B;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,cAAc;AAAA,QACd,cAAc;AAAA,QACd,cAAc,OAAO,SAAS;AAC5B,gBAAM,SAAS,MAAM,MAAM,KAAK,aAAa,IAAI;AACjD,iBAAO;AAAA,QACT;AAAA;AAAA,IACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,SAAS,MAAM,kBAAkB,IAAI;AAAA;AAAA,IACvC;AAAA,KACF;AAEJ;","names":[]}
|
||||
92
package/@stackframe/react/dist/components-page/account-settings/teams/team-creation-page.js
vendored
Normal file
92
package/@stackframe/react/dist/components-page/account-settings/teams/team-creation-page.js
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/teams/team-creation-page.tsx
|
||||
var team_creation_page_exports = {};
|
||||
__export(team_creation_page_exports, {
|
||||
TeamCreationPage: () => TeamCreationPage
|
||||
});
|
||||
module.exports = __toCommonJS(team_creation_page_exports);
|
||||
var import_yup = require("@hookform/resolvers/yup");
|
||||
var import_schema_fields = require("@stackframe/stack-shared/dist/schema-fields");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_react_hook_form = require("react-hook-form");
|
||||
var import_form_warning = require("../../../components/elements/form-warning");
|
||||
var import_message_card = require("../../../components/message-cards/message-card");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_page_layout = require("../page-layout");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function TeamCreationPage() {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const teamCreationSchema = (0, import_schema_fields.yupObject)({
|
||||
displayName: (0, import_schema_fields.yupString)().defined().nonEmpty(t("Please enter a team name"))
|
||||
});
|
||||
const { register, handleSubmit, formState: { errors } } = (0, import_react_hook_form.useForm)({
|
||||
resolver: (0, import_yup.yupResolver)(teamCreationSchema)
|
||||
});
|
||||
const app = (0, import_hooks.useStackApp)();
|
||||
const project = app.useProject();
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
const navigate = app.useNavigate();
|
||||
const [loading, setLoading] = (0, import_react.useState)(false);
|
||||
if (!project.config.clientTeamCreationEnabled) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: t("Team creation is not enabled") });
|
||||
}
|
||||
const onSubmit = async (data) => {
|
||||
setLoading(true);
|
||||
let team;
|
||||
try {
|
||||
team = await user.createTeam({ displayName: data.displayName });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
navigate(`#team-${team.id}`);
|
||||
};
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_page_layout.PageLayout, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_section.Section, { title: t("Create a Team"), description: t("Enter a display name for your new team"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
"form",
|
||||
{
|
||||
onSubmit: (e) => (0, import_promises.runAsynchronouslyWithAlert)(handleSubmit(onSubmit)(e)),
|
||||
noValidate: true,
|
||||
className: "flex gap-2 flex-col sm:flex-row",
|
||||
children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col flex-1", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Input,
|
||||
{
|
||||
id: "displayName",
|
||||
type: "text",
|
||||
...register("displayName")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.displayName?.message?.toString() })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { type: "submit", loading, children: t("Create") })
|
||||
]
|
||||
}
|
||||
) }) });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TeamCreationPage
|
||||
});
|
||||
//# sourceMappingURL=team-creation-page.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-creation-page.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { yupResolver } from \"@hookform/resolvers/yup\";\nimport { yupObject, yupString } from \"@stackframe/stack-shared/dist/schema-fields\";\nimport { runAsynchronouslyWithAlert } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { Button, Input } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport * as yup from \"yup\";\nimport { FormWarningText } from \"../../../components/elements/form-warning\";\nimport { MessageCard } from \"../../../components/message-cards/message-card\";\nimport { useStackApp, useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { PageLayout } from \"../page-layout\";\nimport { Section } from \"../section\";\n\nexport function TeamCreationPage() {\n const { t } = useTranslation();\n\n const teamCreationSchema = yupObject({\n displayName: yupString().defined().nonEmpty(t(\"Please enter a team name\")),\n });\n\n const { register, handleSubmit, formState: { errors } } = useForm({\n resolver: yupResolver(teamCreationSchema)\n });\n const app = useStackApp();\n const project = app.useProject();\n const user = useUser({ or: 'redirect' });\n const navigate = app.useNavigate();\n const [loading, setLoading] = useState(false);\n\n if (!project.config.clientTeamCreationEnabled) {\n return <MessageCard title={t(\"Team creation is not enabled\")} />;\n }\n\n const onSubmit = async (data: yup.InferType<typeof teamCreationSchema>) => {\n setLoading(true);\n\n let team;\n try {\n team = await user.createTeam({ displayName: data.displayName });\n } finally {\n setLoading(false);\n }\n\n navigate(`#team-${team.id}`);\n };\n\n return (\n <PageLayout>\n <Section title={t(\"Create a Team\")} description={t(\"Enter a display name for your new team\")}>\n <form\n onSubmit={e => runAsynchronouslyWithAlert(handleSubmit(onSubmit)(e))}\n noValidate\n className='flex gap-2 flex-col sm:flex-row'\n >\n <div className='flex flex-col flex-1'>\n <Input\n id=\"displayName\"\n type=\"text\"\n {...register(\"displayName\")}\n />\n <FormWarningText text={errors.displayName?.message?.toString()} />\n </div>\n <Button type=\"submit\" loading={loading}>{t(\"Create\")}</Button>\n </form>\n </Section>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,iBAA4B;AAC5B,2BAAqC;AACrC,sBAA2C;AAC3C,sBAA8B;AAC9B,mBAAyB;AACzB,6BAAwB;AAExB,0BAAgC;AAChC,0BAA4B;AAC5B,mBAAqC;AACrC,0BAA+B;AAC/B,yBAA2B;AAC3B,qBAAwB;AAmBb;AAjBJ,SAAS,mBAAmB;AACjC,QAAM,EAAE,EAAE,QAAI,oCAAe;AAE7B,QAAM,yBAAqB,gCAAU;AAAA,IACnC,iBAAa,gCAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,0BAA0B,CAAC;AAAA,EAC3E,CAAC;AAED,QAAM,EAAE,UAAU,cAAc,WAAW,EAAE,OAAO,EAAE,QAAI,gCAAQ;AAAA,IAChE,cAAU,wBAAY,kBAAkB;AAAA,EAC1C,CAAC;AACD,QAAM,UAAM,0BAAY;AACxB,QAAM,UAAU,IAAI,WAAW;AAC/B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,WAAW,IAAI,YAAY;AACjC,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAE5C,MAAI,CAAC,QAAQ,OAAO,2BAA2B;AAC7C,WAAO,4CAAC,mCAAY,OAAO,EAAE,8BAA8B,GAAG;AAAA,EAChE;AAEA,QAAM,WAAW,OAAO,SAAmD;AACzE,eAAW,IAAI;AAEf,QAAI;AACJ,QAAI;AACF,aAAO,MAAM,KAAK,WAAW,EAAE,aAAa,KAAK,YAAY,CAAC;AAAA,IAChE,UAAE;AACA,iBAAW,KAAK;AAAA,IAClB;AAEA,aAAS,SAAS,KAAK,EAAE,EAAE;AAAA,EAC7B;AAEA,SACE,4CAAC,iCACC,sDAAC,0BAAQ,OAAO,EAAE,eAAe,GAAG,aAAa,EAAE,wCAAwC,GACzF;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,WAAK,4CAA2B,aAAa,QAAQ,EAAE,CAAC,CAAC;AAAA,MACnE,YAAU;AAAA,MACV,WAAU;AAAA,MAEV;AAAA,qDAAC,SAAI,WAAU,wBACb;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,IAAG;AAAA,cACH,MAAK;AAAA,cACJ,GAAG,SAAS,aAAa;AAAA;AAAA,UAC5B;AAAA,UACA,4CAAC,uCAAgB,MAAM,OAAO,aAAa,SAAS,SAAS,GAAG;AAAA,WAClE;AAAA,QACA,4CAAC,0BAAO,MAAK,UAAS,SAAmB,YAAE,QAAQ,GAAE;AAAA;AAAA;AAAA,EACvD,GACF,GACF;AAEJ;","names":[]}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/teams/team-display-name-section.tsx
|
||||
var team_display_name_section_exports = {};
|
||||
__export(team_display_name_section_exports, {
|
||||
TeamDisplayNameSection: () => TeamDisplayNameSection
|
||||
});
|
||||
module.exports = __toCommonJS(team_display_name_section_exports);
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_editable_text = require("../editable-text");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function TeamDisplayNameSection(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
const updateTeamPermission = user.usePermission(props.team, "$update_team");
|
||||
if (!updateTeamPermission) {
|
||||
return null;
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_section.Section,
|
||||
{
|
||||
title: t("Team display name"),
|
||||
description: t("Change the display name of your team"),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_editable_text.EditableText,
|
||||
{
|
||||
value: props.team.displayName,
|
||||
onSave: async (newDisplayName) => await props.team.update({ displayName: newDisplayName })
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TeamDisplayNameSection
|
||||
});
|
||||
//# sourceMappingURL=team-display-name-section.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-display-name-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Team } from \"../../..\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { EditableText } from \"../editable-text\";\nimport { Section } from \"../section\";\n\nexport function TeamDisplayNameSection(props: { team: Team }) {\n const { t } = useTranslation();\n const user = useUser({ or: 'redirect' });\n const updateTeamPermission = user.usePermission(props.team, '$update_team');\n\n if (!updateTeamPermission) {\n return null;\n }\n\n return (\n <Section\n title={t(\"Team display name\")}\n description={t(\"Change the display name of your team\")}\n >\n <EditableText\n value={props.team.displayName}\n onSave={async (newDisplayName) => await props.team.update({ displayName: newDisplayName })}\n />\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,mBAAwB;AACxB,0BAA+B;AAC/B,2BAA6B;AAC7B,qBAAwB;AAgBlB;AAdC,SAAS,uBAAuB,OAAuB;AAC5D,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,uBAAuB,KAAK,cAAc,MAAM,MAAM,cAAc;AAE1E,MAAI,CAAC,sBAAsB;AACzB,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,mBAAmB;AAAA,MAC5B,aAAa,EAAE,sCAAsC;AAAA,MAErD;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,MAAM,KAAK;AAAA,UAClB,QAAQ,OAAO,mBAAmB,MAAM,MAAM,KAAK,OAAO,EAAE,aAAa,eAAe,CAAC;AAAA;AAAA,MAC3F;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/teams/team-member-invitation-section.tsx
|
||||
var team_member_invitation_section_exports = {};
|
||||
__export(team_member_invitation_section_exports, {
|
||||
TeamMemberInvitationSection: () => TeamMemberInvitationSection
|
||||
});
|
||||
module.exports = __toCommonJS(team_member_invitation_section_exports);
|
||||
var import_yup = require("@hookform/resolvers/yup");
|
||||
var import_schema_fields = require("@stackframe/stack-shared/dist/schema-fields");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_lucide_react = require("lucide-react");
|
||||
var import_react = require("react");
|
||||
var import_react_hook_form = require("react-hook-form");
|
||||
var import_form_warning = require("../../../components/elements/form-warning");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function TeamMemberInvitationSection(props) {
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
const inviteMemberPermission = user.usePermission(props.team, "$invite_members");
|
||||
if (!inviteMemberPermission) {
|
||||
return null;
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemberInvitationSectionInner, { team: props.team });
|
||||
}
|
||||
function MemberInvitationsSectionInvitationsList(props) {
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const invitationsToShow = props.team.useInvitations();
|
||||
const removeMemberPermission = user.usePermission(props.team, "$remove_members");
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Table, { className: "mt-6", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableRow, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[200px]", children: t("Outstanding invitations") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[60px]", children: t("Expires") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[36px] max-w-[36px]" })
|
||||
] }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableBody, { children: [
|
||||
invitationsToShow.map((invitation, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableRow, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: invitation.recipientEmail }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", children: invitation.expiresAt.toLocaleString() }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { align: "right", className: "max-w-[36px]", children: removeMemberPermission && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { onClick: async () => await invitation.revoke(), size: "icon", variant: "ghost", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Trash, { className: "w-4 h-4" }) }) })
|
||||
] }, invitation.id)),
|
||||
invitationsToShow.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { colSpan: 3, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", children: t("No outstanding invitations") }) }) })
|
||||
] })
|
||||
] }) });
|
||||
}
|
||||
function MemberInvitationSectionInner(props) {
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const readMemberPermission = user.usePermission(props.team, "$read_members");
|
||||
const invitationSchema = (0, import_schema_fields.yupObject)({
|
||||
email: (0, import_schema_fields.strictEmailSchema)(t("Please enter a valid email address")).defined().nonEmpty(t("Please enter an email address"))
|
||||
});
|
||||
const { register, handleSubmit, formState: { errors }, watch } = (0, import_react_hook_form.useForm)({
|
||||
resolver: (0, import_yup.yupResolver)(invitationSchema)
|
||||
});
|
||||
const [loading, setLoading] = (0, import_react.useState)(false);
|
||||
const [invitedEmail, setInvitedEmail] = (0, import_react.useState)(null);
|
||||
const onSubmit = async (data) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
await props.team.inviteUser({ email: data.email });
|
||||
setInvitedEmail(data.email);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
(0, import_react.useEffect)(() => {
|
||||
setInvitedEmail(null);
|
||||
}, [watch("email")]);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_section.Section,
|
||||
{
|
||||
title: t("Invite member"),
|
||||
description: t("Invite a user to your team through email"),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
"form",
|
||||
{
|
||||
onSubmit: (e) => (0, import_promises.runAsynchronouslyWithAlert)(handleSubmit(onSubmit)(e)),
|
||||
noValidate: true,
|
||||
className: "w-full",
|
||||
children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-4 sm:flex-row w-full", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Input,
|
||||
{
|
||||
placeholder: t("Email"),
|
||||
...register("email")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { type: "submit", loading, children: t("Invite User") })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.email?.message?.toString() }),
|
||||
invitedEmail && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Typography, { type: "label", variant: "secondary", children: [
|
||||
"Invited ",
|
||||
invitedEmail
|
||||
] })
|
||||
]
|
||||
}
|
||||
)
|
||||
}
|
||||
),
|
||||
readMemberPermission && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemberInvitationsSectionInvitationsList, { team: props.team })
|
||||
] });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TeamMemberInvitationSection
|
||||
});
|
||||
//# sourceMappingURL=team-member-invitation-section.js.map
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,64 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/teams/team-member-list-section.tsx
|
||||
var team_member_list_section_exports = {};
|
||||
__export(team_member_list_section_exports, {
|
||||
TeamMemberListSection: () => TeamMemberListSection
|
||||
});
|
||||
module.exports = __toCommonJS(team_member_list_section_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_user_avatar = require("../../../components/elements/user-avatar");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function TeamMemberListSection(props) {
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
const readMemberPermission = user.usePermission(props.team, "$read_members");
|
||||
const inviteMemberPermission = user.usePermission(props.team, "$invite_members");
|
||||
if (!readMemberPermission && !inviteMemberPermission) {
|
||||
return null;
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemberListSectionInner, { team: props.team });
|
||||
}
|
||||
function MemberListSectionInner(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const users = props.team.useUsers();
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { className: "font-medium mb-2", children: t("Members") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border rounded-md", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Table, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableRow, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[100px]", children: t("User") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[200px]", children: t("Name") })
|
||||
] }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableBody, { children: users.map(({ id, teamProfile }, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableRow, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_user_avatar.UserAvatar, { user: teamProfile }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableCell, { children: [
|
||||
teamProfile.displayName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: teamProfile.displayName }),
|
||||
!teamProfile.displayName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { className: "text-muted-foreground italic", children: t("No display name set") })
|
||||
] })
|
||||
] }, id)) })
|
||||
] }) })
|
||||
] });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TeamMemberListSection
|
||||
});
|
||||
//# sourceMappingURL=team-member-list-section.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-member-list-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Typography } from \"@stackframe/stack-ui\";\nimport { Team } from \"../../..\";\nimport { UserAvatar } from \"../../../components/elements/user-avatar\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\n\nexport function TeamMemberListSection(props: { team: Team }) {\n const user = useUser({ or: 'redirect' });\n const readMemberPermission = user.usePermission(props.team, '$read_members');\n const inviteMemberPermission = user.usePermission(props.team, '$invite_members');\n\n if (!readMemberPermission && !inviteMemberPermission) {\n return null;\n }\n\n return <MemberListSectionInner team={props.team} />;\n}\n\nfunction MemberListSectionInner(props: { team: Team }) {\n const { t } = useTranslation();\n const users = props.team.useUsers();\n\n return (\n <div>\n <Typography className='font-medium mb-2'>{t(\"Members\")}</Typography>\n <div className='border rounded-md'>\n <Table>\n <TableHeader>\n <TableRow>\n <TableHead className=\"w-[100px]\">{t(\"User\")}</TableHead>\n <TableHead className=\"w-[200px]\">{t(\"Name\")}</TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n {users.map(({ id, teamProfile }, i) => (\n <TableRow key={id}>\n <TableCell>\n <UserAvatar user={teamProfile} />\n </TableCell>\n <TableCell>\n {teamProfile.displayName && (\n <Typography>{teamProfile.displayName}</Typography>\n )}\n {!teamProfile.displayName && (\n <Typography className=\"text-muted-foreground italic\">{t(\"No display name set\")}</Typography>\n )}\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAA0F;AAE1F,yBAA2B;AAC3B,mBAAwB;AACxB,0BAA+B;AAWtB;AATF,SAAS,sBAAsB,OAAuB;AAC3D,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,uBAAuB,KAAK,cAAc,MAAM,MAAM,eAAe;AAC3E,QAAM,yBAAyB,KAAK,cAAc,MAAM,MAAM,iBAAiB;AAE/E,MAAI,CAAC,wBAAwB,CAAC,wBAAwB;AACpD,WAAO;AAAA,EACT;AAEA,SAAO,4CAAC,0BAAuB,MAAM,MAAM,MAAM;AACnD;AAEA,SAAS,uBAAuB,OAAuB;AACrD,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,QAAQ,MAAM,KAAK,SAAS;AAElC,SACE,6CAAC,SACC;AAAA,gDAAC,8BAAW,WAAU,oBAAoB,YAAE,SAAS,GAAE;AAAA,IACvD,4CAAC,SAAI,WAAU,qBACb,uDAAC,yBACC;AAAA,kDAAC,+BACC,uDAAC,4BACC;AAAA,oDAAC,6BAAU,WAAU,aAAa,YAAE,MAAM,GAAE;AAAA,QAC5C,4CAAC,6BAAU,WAAU,aAAa,YAAE,MAAM,GAAE;AAAA,SAC9C,GACF;AAAA,MACA,4CAAC,6BACE,gBAAM,IAAI,CAAC,EAAE,IAAI,YAAY,GAAG,MAC/B,6CAAC,4BACC;AAAA,oDAAC,6BACC,sDAAC,iCAAW,MAAM,aAAa,GACjC;AAAA,QACA,6CAAC,6BACE;AAAA,sBAAY,eACX,4CAAC,8BAAY,sBAAY,aAAY;AAAA,UAEtC,CAAC,YAAY,eACZ,4CAAC,8BAAW,WAAU,gCAAgC,YAAE,qBAAqB,GAAE;AAAA,WAEnF;AAAA,WAXa,EAYf,CACD,GACH;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":[]}
|
||||
50
package/@stackframe/react/dist/components-page/account-settings/teams/team-page.js
vendored
Normal file
50
package/@stackframe/react/dist/components-page/account-settings/teams/team-page.js
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/teams/team-page.tsx
|
||||
var team_page_exports = {};
|
||||
__export(team_page_exports, {
|
||||
TeamPage: () => TeamPage
|
||||
});
|
||||
module.exports = __toCommonJS(team_page_exports);
|
||||
var import_page_layout = require("../page-layout");
|
||||
var import_leave_team_section = require("./leave-team-section");
|
||||
var import_team_api_keys_section = require("./team-api-keys-section");
|
||||
var import_team_display_name_section = require("./team-display-name-section");
|
||||
var import_team_member_invitation_section = require("./team-member-invitation-section");
|
||||
var import_team_member_list_section = require("./team-member-list-section");
|
||||
var import_team_profile_image_section = require("./team-profile-image-section");
|
||||
var import_team_profile_user_section = require("./team-profile-user-section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function TeamPage(props) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_page_layout.PageLayout, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_profile_user_section.TeamUserProfileSection, { team: props.team }, `user-profile-${props.team.id}`),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_profile_image_section.TeamProfileImageSection, { team: props.team }, `profile-image-${props.team.id}`),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_display_name_section.TeamDisplayNameSection, { team: props.team }, `display-name-${props.team.id}`),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_member_list_section.TeamMemberListSection, { team: props.team }, `member-list-${props.team.id}`),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_member_invitation_section.TeamMemberInvitationSection, { team: props.team }, `member-invitation-${props.team.id}`),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_api_keys_section.TeamApiKeysSection, { team: props.team }, `api-keys-${props.team.id}`),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_leave_team_section.LeaveTeamSection, { team: props.team }, `leave-team-${props.team.id}`)
|
||||
] });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TeamPage
|
||||
});
|
||||
//# sourceMappingURL=team-page.js.map
|
||||
1
package/@stackframe/react/dist/components-page/account-settings/teams/team-page.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/account-settings/teams/team-page.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-page.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Team } from \"../../..\";\nimport { PageLayout } from \"../page-layout\";\nimport { LeaveTeamSection } from \"./leave-team-section\";\nimport { TeamApiKeysSection } from \"./team-api-keys-section\";\nimport { TeamDisplayNameSection } from \"./team-display-name-section\";\nimport { TeamMemberInvitationSection } from \"./team-member-invitation-section\";\nimport { TeamMemberListSection } from \"./team-member-list-section\";\nimport { TeamProfileImageSection } from \"./team-profile-image-section\";\nimport { TeamUserProfileSection } from \"./team-profile-user-section\";\n\n\nexport function TeamPage(props: { team: Team }) {\n return (\n <PageLayout>\n <TeamUserProfileSection key={`user-profile-${props.team.id}`} team={props.team} />\n <TeamProfileImageSection key={`profile-image-${props.team.id}`} team={props.team} />\n <TeamDisplayNameSection key={`display-name-${props.team.id}`} team={props.team} />\n <TeamMemberListSection key={`member-list-${props.team.id}`} team={props.team} />\n <TeamMemberInvitationSection key={`member-invitation-${props.team.id}`} team={props.team} />\n <TeamApiKeysSection key={`api-keys-${props.team.id}`} team={props.team} />\n <LeaveTeamSection key={`leave-team-${props.team.id}`} team={props.team} />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,yBAA2B;AAC3B,gCAAiC;AACjC,mCAAmC;AACnC,uCAAuC;AACvC,4CAA4C;AAC5C,sCAAsC;AACtC,wCAAwC;AACxC,uCAAuC;AAKnC;AAFG,SAAS,SAAS,OAAuB;AAC9C,SACE,6CAAC,iCACC;AAAA,gDAAC,2DAA6D,MAAM,MAAM,QAA7C,gBAAgB,MAAM,KAAK,EAAE,EAAsB;AAAA,IAChF,4CAAC,6DAA+D,MAAM,MAAM,QAA9C,iBAAiB,MAAM,KAAK,EAAE,EAAsB;AAAA,IAClF,4CAAC,2DAA6D,MAAM,MAAM,QAA7C,gBAAgB,MAAM,KAAK,EAAE,EAAsB;AAAA,IAChF,4CAAC,yDAA2D,MAAM,MAAM,QAA5C,eAAe,MAAM,KAAK,EAAE,EAAsB;AAAA,IAC9E,4CAAC,qEAAuE,MAAM,MAAM,QAAlD,qBAAqB,MAAM,KAAK,EAAE,EAAsB;AAAA,IAC1F,4CAAC,mDAAqD,MAAM,MAAM,QAAzC,YAAY,MAAM,KAAK,EAAE,EAAsB;AAAA,IACxE,4CAAC,8CAAqD,MAAM,MAAM,QAA3C,cAAc,MAAM,KAAK,EAAE,EAAsB;AAAA,KAC1E;AAEJ;","names":[]}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/teams/team-profile-image-section.tsx
|
||||
var team_profile_image_section_exports = {};
|
||||
__export(team_profile_image_section_exports, {
|
||||
TeamProfileImageSection: () => TeamProfileImageSection
|
||||
});
|
||||
module.exports = __toCommonJS(team_profile_image_section_exports);
|
||||
var import_profile_image_editor = require("../../../components/profile-image-editor");
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function TeamProfileImageSection(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
const updateTeamPermission = user.usePermission(props.team, "$update_team");
|
||||
if (!updateTeamPermission) {
|
||||
return null;
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_section.Section,
|
||||
{
|
||||
title: t("Team profile image"),
|
||||
description: t("Upload an image for your team"),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_profile_image_editor.ProfileImageEditor,
|
||||
{
|
||||
user: props.team,
|
||||
onProfileImageUrlChange: async (profileImageUrl) => {
|
||||
await props.team.update({ profileImageUrl });
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TeamProfileImageSection
|
||||
});
|
||||
//# sourceMappingURL=team-profile-image-section.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-profile-image-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Team } from \"../../..\";\nimport { ProfileImageEditor } from \"../../../components/profile-image-editor\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { Section } from \"../section\";\n\nexport function TeamProfileImageSection(props: { team: Team }) {\n const { t } = useTranslation();\n const user = useUser({ or: 'redirect' });\n const updateTeamPermission = user.usePermission(props.team, '$update_team');\n\n if (!updateTeamPermission) {\n return null;\n }\n\n return (\n <Section\n title={t(\"Team profile image\")}\n description={t(\"Upload an image for your team\")}\n >\n <ProfileImageEditor\n user={props.team}\n onProfileImageUrlChange={async (profileImageUrl) => {\n await props.team.update({ profileImageUrl });\n }}\n />\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,kCAAmC;AACnC,mBAAwB;AACxB,0BAA+B;AAC/B,qBAAwB;AAgBlB;AAdC,SAAS,wBAAwB,OAAuB;AAC7D,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,uBAAuB,KAAK,cAAc,MAAM,MAAM,cAAc;AAE1E,MAAI,CAAC,sBAAsB;AACzB,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,oBAAoB;AAAA,MAC7B,aAAa,EAAE,+BAA+B;AAAA,MAE9C;AAAA,QAAC;AAAA;AAAA,UACC,MAAM,MAAM;AAAA,UACZ,yBAAyB,OAAO,oBAAoB;AAClD,kBAAM,MAAM,KAAK,OAAO,EAAE,gBAAgB,CAAC;AAAA,UAC7C;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/account-settings/teams/team-profile-user-section.tsx
|
||||
var team_profile_user_section_exports = {};
|
||||
__export(team_profile_user_section_exports, {
|
||||
TeamUserProfileSection: () => TeamUserProfileSection
|
||||
});
|
||||
module.exports = __toCommonJS(team_profile_user_section_exports);
|
||||
var import_hooks = require("../../../lib/hooks");
|
||||
var import_translations = require("../../../lib/translations");
|
||||
var import_editable_text = require("../editable-text");
|
||||
var import_section = require("../section");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function TeamUserProfileSection(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import_hooks.useUser)({ or: "redirect" });
|
||||
const profile = user.useTeamProfile(props.team);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_section.Section,
|
||||
{
|
||||
title: t("Team user name"),
|
||||
description: t("Overwrite your user display name in this team"),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_editable_text.EditableText,
|
||||
{
|
||||
value: profile.displayName || "",
|
||||
onSave: async (newDisplayName) => {
|
||||
await profile.update({ displayName: newDisplayName });
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TeamUserProfileSection
|
||||
});
|
||||
//# sourceMappingURL=team-profile-user-section.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-profile-user-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Team } from \"../../..\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { EditableText } from \"../editable-text\";\nimport { Section } from \"../section\";\n\nexport function TeamUserProfileSection(props: { team: Team }) {\n const { t } = useTranslation();\n const user = useUser({ or: 'redirect' });\n const profile = user.useTeamProfile(props.team);\n\n return (\n <Section\n title={t(\"Team user name\")}\n description={t(\"Overwrite your user display name in this team\")}\n >\n <EditableText\n value={profile.displayName || ''}\n onSave={async (newDisplayName) => {\n await profile.update({ displayName: newDisplayName });\n }}\n />\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,mBAAwB;AACxB,0BAA+B;AAC/B,2BAA6B;AAC7B,qBAAwB;AAYlB;AAVC,SAAS,uBAAuB,OAAuB;AAC5D,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,UAAU,KAAK,eAAe,MAAM,IAAI;AAE9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,gBAAgB;AAAA,MACzB,aAAa,EAAE,+CAA+C;AAAA,MAE9D;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,QAAQ,eAAe;AAAA,UAC9B,QAAQ,OAAO,mBAAmB;AAChC,kBAAM,QAAQ,OAAO,EAAE,aAAa,eAAe,CAAC;AAAA,UACtD;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
||||
123
package/@stackframe/react/dist/components-page/auth-page.js
vendored
Normal file
123
package/@stackframe/react/dist/components-page/auth-page.js
vendored
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/auth-page.tsx
|
||||
var auth_page_exports = {};
|
||||
__export(auth_page_exports, {
|
||||
AuthPage: () => AuthPage
|
||||
});
|
||||
module.exports = __toCommonJS(auth_page_exports);
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import__ = require("..");
|
||||
var import_credential_sign_in = require("../components/credential-sign-in");
|
||||
var import_credential_sign_up = require("../components/credential-sign-up");
|
||||
var import_maybe_full_page = require("../components/elements/maybe-full-page");
|
||||
var import_separator_with_text = require("../components/elements/separator-with-text");
|
||||
var import_link = require("../components/link");
|
||||
var import_magic_link_sign_in = require("../components/magic-link-sign-in");
|
||||
var import_predefined_message_card = require("../components/message-cards/predefined-message-card");
|
||||
var import_oauth_button_group = require("../components/oauth-button-group");
|
||||
var import_passkey_button = require("../components/passkey-button");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function AuthPage(props) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fallback, { ...props }), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Inner, { ...props }) });
|
||||
}
|
||||
function Fallback(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_maybe_full_page.MaybeFullPage, { fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "stack-scope flex flex-col items-stretch", style: { maxWidth: "380px", flexBasis: "380px", padding: props.fullPage ? "1rem" : 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-center mb-6 flex flex-col", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-2/3 self-center" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-3 w-16 mt-8" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-full mt-1" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-3 w-24 mt-2" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-full mt-1" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Skeleton, { className: "h-9 w-full mt-6" })
|
||||
] }) }) });
|
||||
}
|
||||
function Inner(props) {
|
||||
const stackApp = (0, import__.useStackApp)();
|
||||
const user = (0, import__.useUser)();
|
||||
const projectFromHook = stackApp.useProject();
|
||||
const project = props.mockProject || projectFromHook;
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
(0, import_react.useEffect)(() => {
|
||||
if (props.automaticRedirect && user && !props.mockProject) {
|
||||
(0, import_promises.runAsynchronously)(
|
||||
props.type === "sign-in" ? stackApp.redirectToAfterSignIn({ replace: true }) : stackApp.redirectToAfterSignUp({ replace: true })
|
||||
);
|
||||
}
|
||||
}, [user, props.mockProject, stackApp, props.automaticRedirect]);
|
||||
if (user && !props.mockProject && !props.automaticRedirect) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "signedIn", fullPage: props.fullPage });
|
||||
}
|
||||
if (props.type === "sign-up" && !project.config.signUpEnabled) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "signUpDisabled", fullPage: props.fullPage });
|
||||
}
|
||||
const hasOAuthProviders = project.config.oauthProviders.length > 0;
|
||||
const hasPasskey = project.config.passkeyEnabled === true && props.type === "sign-in";
|
||||
const enableSeparator = (project.config.credentialEnabled || project.config.magicLinkEnabled) && (hasOAuthProviders || hasPasskey);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_maybe_full_page.MaybeFullPage, { fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "stack-scope flex flex-col items-stretch", style: { maxWidth: "380px", flexBasis: "380px", padding: props.fullPage ? "1rem" : 0 }, children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-center mb-6", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { type: "h2", children: props.type === "sign-in" ? t("Sign in to your account") : t("Create a new account") }),
|
||||
props.type === "sign-in" ? project.config.signUpEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Typography, { children: [
|
||||
t("Don't have an account?"),
|
||||
" ",
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.StyledLink, { href: stackApp.urls.signUp, onClick: (e) => {
|
||||
(0, import_promises.runAsynchronously)(stackApp.redirectToSignUp());
|
||||
e.preventDefault();
|
||||
}, children: t("Sign up") })
|
||||
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Typography, { children: [
|
||||
t("Already have an account?"),
|
||||
" ",
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.StyledLink, { href: stackApp.urls.signIn, onClick: (e) => {
|
||||
(0, import_promises.runAsynchronously)(stackApp.redirectToSignIn());
|
||||
e.preventDefault();
|
||||
}, children: t("Sign in") })
|
||||
] })
|
||||
] }),
|
||||
(hasOAuthProviders || hasPasskey) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gap-4 flex flex-col items-stretch stack-scope", children: [
|
||||
hasOAuthProviders && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_oauth_button_group.OAuthButtonGroup, { type: props.type, mockProject: props.mockProject }),
|
||||
hasPasskey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_passkey_button.PasskeyButton, { type: props.type })
|
||||
] }),
|
||||
enableSeparator && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_separator_with_text.SeparatorWithText, { text: t("Or continue with") }),
|
||||
project.config.credentialEnabled && project.config.magicLinkEnabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Tabs, { defaultValue: props.firstTab || "magic-link", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TabsList, { className: (0, import_stack_ui.cn)("w-full mb-2", {
|
||||
"flex-row-reverse": props.firstTab === "password"
|
||||
}), children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TabsTrigger, { value: "magic-link", className: "flex-1", children: t("Email") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TabsTrigger, { value: "password", className: "flex-1", children: t("Email & Password") })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TabsContent, { value: "magic-link", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_magic_link_sign_in.MagicLinkSignIn, {}) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TabsContent, { value: "password", children: props.type === "sign-up" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_credential_sign_up.CredentialSignUp, { noPasswordRepeat: props.noPasswordRepeat }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_credential_sign_in.CredentialSignIn, {}) })
|
||||
] }) : project.config.credentialEnabled ? props.type === "sign-up" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_credential_sign_up.CredentialSignUp, { noPasswordRepeat: props.noPasswordRepeat }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_credential_sign_in.CredentialSignIn, {}) : project.config.magicLinkEnabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_magic_link_sign_in.MagicLinkSignIn, {}) : !(hasOAuthProviders || hasPasskey) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "destructive", className: "text-center", children: t("No authentication method enabled.") }) : null,
|
||||
props.extraInfo && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_stack_ui.cn)("flex flex-col items-center text-center text-sm text-gray-500", {
|
||||
"mt-2": project.config.credentialEnabled || project.config.magicLinkEnabled,
|
||||
"mt-6": !(project.config.credentialEnabled || project.config.magicLinkEnabled)
|
||||
}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: props.extraInfo }) })
|
||||
] }) });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
AuthPage
|
||||
});
|
||||
//# sourceMappingURL=auth-page.js.map
|
||||
1
package/@stackframe/react/dist/components-page/auth-page.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/auth-page.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
123
package/@stackframe/react/dist/components-page/cli-auth-confirm.js
vendored
Normal file
123
package/@stackframe/react/dist/components-page/cli-auth-confirm.js
vendored
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/cli-auth-confirm.tsx
|
||||
var cli_auth_confirm_exports = {};
|
||||
__export(cli_auth_confirm_exports, {
|
||||
CliAuthConfirmation: () => CliAuthConfirmation
|
||||
});
|
||||
module.exports = __toCommonJS(cli_auth_confirm_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import__ = require("..");
|
||||
var import_message_card = require("../components/message-cards/message-card");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function CliAuthConfirmation({ fullPage = true }) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const app = (0, import__.useStackApp)();
|
||||
const [authorizing, setAuthorizing] = (0, import_react.useState)(false);
|
||||
const [success, setSuccess] = (0, import_react.useState)(false);
|
||||
const [error, setError] = (0, import_react.useState)(null);
|
||||
const user = app.useUser({ or: "redirect" });
|
||||
const handleAuthorize = async () => {
|
||||
if (authorizing) return;
|
||||
setAuthorizing(true);
|
||||
try {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const loginCode = urlParams.get("login_code");
|
||||
if (!loginCode) {
|
||||
throw new Error("Missing login code in URL parameters");
|
||||
}
|
||||
const refreshToken = (await user.currentSession.getTokens()).refreshToken;
|
||||
if (!refreshToken) {
|
||||
throw new Error("You must be logged in to authorize CLI access");
|
||||
}
|
||||
const result = await app[import__.stackAppInternalsSymbol].sendRequest("/auth/cli/complete", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
login_code: loginCode,
|
||||
refresh_token: (await user.currentSession.getTokens()).refreshToken
|
||||
})
|
||||
});
|
||||
if (!result.ok) {
|
||||
throw new Error(`Authorization failed: ${result.status} ${await result.text()}`);
|
||||
}
|
||||
setSuccess(true);
|
||||
} catch (err) {
|
||||
setError(err);
|
||||
} finally {
|
||||
setAuthorizing(false);
|
||||
}
|
||||
};
|
||||
if (success) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_message_card.MessageCard,
|
||||
{
|
||||
title: t("CLI Authorization Successful"),
|
||||
fullPage,
|
||||
primaryButtonText: t("Close"),
|
||||
primaryAction: () => window.close(),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("The CLI application has been authorized successfully. You can now close this window and return to the command line.") })
|
||||
}
|
||||
);
|
||||
}
|
||||
if (error) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
import_message_card.MessageCard,
|
||||
{
|
||||
title: t("Authorization Failed"),
|
||||
fullPage,
|
||||
primaryButtonText: t("Try Again"),
|
||||
primaryAction: () => setError(null),
|
||||
secondaryButtonText: t("Cancel"),
|
||||
secondaryAction: () => window.close(),
|
||||
children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { className: "text-red-600", children: t("Failed to authorize the CLI application:") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { className: "text-red-600", children: error.message })
|
||||
]
|
||||
}
|
||||
);
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
import_message_card.MessageCard,
|
||||
{
|
||||
title: t("Authorize CLI Application"),
|
||||
fullPage,
|
||||
primaryButtonText: authorizing ? t("Authorizing...") : t("Authorize"),
|
||||
primaryAction: handleAuthorize,
|
||||
secondaryButtonText: t("Cancel"),
|
||||
secondaryAction: () => window.close(),
|
||||
children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("A command line application is requesting access to your account. Click the button below to authorize it.") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "destructive", children: t("WARNING: Make sure you trust the command line application, as it will gain access to your account. If you did not initiate this request, you can close this page and ignore it. We will never send you this link via email or any other means.") })
|
||||
]
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
CliAuthConfirmation
|
||||
});
|
||||
//# sourceMappingURL=cli-auth-confirm.js.map
|
||||
1
package/@stackframe/react/dist/components-page/cli-auth-confirm.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/cli-auth-confirm.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
100
package/@stackframe/react/dist/components-page/email-verification.js
vendored
Normal file
100
package/@stackframe/react/dist/components-page/email-verification.js
vendored
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/email-verification.tsx
|
||||
var email_verification_exports = {};
|
||||
__export(email_verification_exports, {
|
||||
EmailVerification: () => EmailVerification
|
||||
});
|
||||
module.exports = __toCommonJS(email_verification_exports);
|
||||
var import_stack_shared = require("@stackframe/stack-shared");
|
||||
var import_errors = require("@stackframe/stack-shared/dist/utils/errors");
|
||||
var import_react = __toESM(require("react"));
|
||||
var import__ = require("..");
|
||||
var import_message_card = require("../components/message-cards/message-card");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function EmailVerification(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const stackApp = (0, import__.useStackApp)();
|
||||
const user = (0, import__.useUser)();
|
||||
const [result, setResult] = import_react.default.useState(null);
|
||||
const invalidJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: t("Invalid Verification Link"), fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("Please check if you have the correct link. If you continue to have issues, please contact support.") }) });
|
||||
const expiredJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: t("Expired Verification Link"), fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("Your email verification link has expired. Please request a new verification link from your account settings.") }) });
|
||||
if (!props.searchParams?.code) {
|
||||
return invalidJsx;
|
||||
}
|
||||
if (!result) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_message_card.MessageCard,
|
||||
{
|
||||
title: t("Do you want to verify your email?"),
|
||||
fullPage: !!props.fullPage,
|
||||
primaryButtonText: t("Verify"),
|
||||
primaryAction: async () => {
|
||||
const result2 = await stackApp.verifyEmail(props.searchParams?.code || (0, import_errors.throwErr)("No verification code provided"));
|
||||
setResult(result2);
|
||||
},
|
||||
secondaryButtonText: t("Cancel"),
|
||||
secondaryAction: async () => {
|
||||
await stackApp.redirectToHome();
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
if (result.status === "error") {
|
||||
if (import_stack_shared.KnownErrors.VerificationCodeNotFound.isInstance(result.error)) {
|
||||
return invalidJsx;
|
||||
} else if (import_stack_shared.KnownErrors.VerificationCodeExpired.isInstance(result.error)) {
|
||||
return expiredJsx;
|
||||
} else if (import_stack_shared.KnownErrors.VerificationCodeAlreadyUsed.isInstance(result.error)) {
|
||||
} else {
|
||||
throw result.error;
|
||||
}
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_message_card.MessageCard,
|
||||
{
|
||||
title: t("You email has been verified!"),
|
||||
fullPage: !!props.fullPage,
|
||||
primaryButtonText: t("Go home"),
|
||||
primaryAction: async () => {
|
||||
await stackApp.redirectToHome();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
EmailVerification
|
||||
});
|
||||
//# sourceMappingURL=email-verification.js.map
|
||||
1
package/@stackframe/react/dist/components-page/email-verification.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/email-verification.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../src/components-page/email-verification.tsx"],"sourcesContent":["'use client';\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\n\nimport { KnownErrors } from \"@stackframe/stack-shared\";\nimport { throwErr } from \"@stackframe/stack-shared/dist/utils/errors\";\nimport React from \"react\";\nimport { useStackApp, useUser } from \"..\";\nimport { MessageCard } from \"../components/message-cards/message-card\";\nimport { useTranslation } from \"../lib/translations\";\n\nexport function EmailVerification(props: {\n searchParams?: Record<string, string>,\n fullPage?: boolean,\n}) {\n const { t } = useTranslation();\n const stackApp = useStackApp();\n const user = useUser();\n const [result, setResult] = React.useState<Awaited<ReturnType<typeof stackApp.verifyEmail>> | null>(null);\n\n const invalidJsx = (\n <MessageCard title={t(\"Invalid Verification Link\")} fullPage={!!props.fullPage}>\n <p>{t(\"Please check if you have the correct link. If you continue to have issues, please contact support.\")}</p>\n </MessageCard>\n );\n\n const expiredJsx = (\n <MessageCard title={t(\"Expired Verification Link\")} fullPage={!!props.fullPage}>\n <p>{t(\"Your email verification link has expired. Please request a new verification link from your account settings.\")}</p>\n </MessageCard>\n );\n\n if (!props.searchParams?.code) {\n return invalidJsx;\n }\n\n if (!result) {\n return <MessageCard\n title={t(\"Do you want to verify your email?\")}\n fullPage={!!props.fullPage}\n primaryButtonText={t(\"Verify\")}\n primaryAction={async () => {\n const result = await stackApp.verifyEmail(props.searchParams?.code || throwErr(\"No verification code provided\"));\n setResult(result);\n }}\n secondaryButtonText={t(\"Cancel\")}\n secondaryAction={async () => {\n await stackApp.redirectToHome();\n }}\n />;\n } else {\n if (result.status === 'error') {\n if (KnownErrors.VerificationCodeNotFound.isInstance(result.error)) {\n return invalidJsx;\n } else if (KnownErrors.VerificationCodeExpired.isInstance(result.error)) {\n return expiredJsx;\n } else if (KnownErrors.VerificationCodeAlreadyUsed.isInstance(result.error)) {\n // everything fine, continue\n } else {\n throw result.error;\n }\n }\n\n return <MessageCard\n title={t(\"You email has been verified!\")}\n fullPage={!!props.fullPage}\n primaryButtonText={t(\"Go home\")}\n primaryAction={async () => {\n await stackApp.redirectToHome();\n }}\n />;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,0BAA4B;AAC5B,oBAAyB;AACzB,mBAAkB;AAClB,eAAqC;AACrC,0BAA4B;AAC5B,0BAA+B;AAazB;AAXC,SAAS,kBAAkB,OAG/B;AACD,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,eAAW,sBAAY;AAC7B,QAAM,WAAO,kBAAQ;AACrB,QAAM,CAAC,QAAQ,SAAS,IAAI,aAAAA,QAAM,SAAkE,IAAI;AAExG,QAAM,aACJ,4CAAC,mCAAY,OAAO,EAAE,2BAA2B,GAAG,UAAU,CAAC,CAAC,MAAM,UACpE,sDAAC,OAAG,YAAE,oGAAoG,GAAE,GAC9G;AAGF,QAAM,aACJ,4CAAC,mCAAY,OAAO,EAAE,2BAA2B,GAAG,UAAU,CAAC,CAAC,MAAM,UACpE,sDAAC,OAAG,YAAE,8GAA8G,GAAE,GACxH;AAGF,MAAI,CAAC,MAAM,cAAc,MAAM;AAC7B,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,MAAC;AAAA;AAAA,QACN,OAAO,EAAE,mCAAmC;AAAA,QAC5C,UAAU,CAAC,CAAC,MAAM;AAAA,QAClB,mBAAmB,EAAE,QAAQ;AAAA,QAC7B,eAAe,YAAY;AACzB,gBAAMC,UAAS,MAAM,SAAS,YAAY,MAAM,cAAc,YAAQ,wBAAS,+BAA+B,CAAC;AAC/G,oBAAUA,OAAM;AAAA,QAClB;AAAA,QACA,qBAAqB,EAAE,QAAQ;AAAA,QAC/B,iBAAiB,YAAY;AAC3B,gBAAM,SAAS,eAAe;AAAA,QAChC;AAAA;AAAA,IACF;AAAA,EACF,OAAO;AACL,QAAI,OAAO,WAAW,SAAS;AAC7B,UAAI,gCAAY,yBAAyB,WAAW,OAAO,KAAK,GAAG;AACjE,eAAO;AAAA,MACT,WAAW,gCAAY,wBAAwB,WAAW,OAAO,KAAK,GAAG;AACvE,eAAO;AAAA,MACT,WAAW,gCAAY,4BAA4B,WAAW,OAAO,KAAK,GAAG;AAAA,MAE7E,OAAO;AACL,cAAM,OAAO;AAAA,MACf;AAAA,IACF;AAEA,WAAO;AAAA,MAAC;AAAA;AAAA,QACN,OAAO,EAAE,8BAA8B;AAAA,QACvC,UAAU,CAAC,CAAC,MAAM;AAAA,QAClB,mBAAmB,EAAE,SAAS;AAAA,QAC9B,eAAe,YAAY;AACzB,gBAAM,SAAS,eAAe;AAAA,QAChC;AAAA;AAAA,IACF;AAAA,EACF;AACF;","names":["React","result"]}
|
||||
97
package/@stackframe/react/dist/components-page/error-page.js
vendored
Normal file
97
package/@stackframe/react/dist/components-page/error-page.js
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/error-page.tsx
|
||||
var error_page_exports = {};
|
||||
__export(error_page_exports, {
|
||||
ErrorPage: () => ErrorPage
|
||||
});
|
||||
module.exports = __toCommonJS(error_page_exports);
|
||||
var import_stack_shared = require("@stackframe/stack-shared");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import__ = require("..");
|
||||
var import_known_error_message_card = require("../components/message-cards/known-error-message-card");
|
||||
var import_message_card = require("../components/message-cards/message-card");
|
||||
var import_predefined_message_card = require("../components/message-cards/predefined-message-card");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function ErrorPage(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const stackApp = (0, import__.useStackApp)();
|
||||
const errorCode = props.searchParams.errorCode;
|
||||
const message = props.searchParams.message;
|
||||
const details = props.searchParams.details;
|
||||
const unknownErrorCard = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "unknownError", fullPage: !!props.fullPage });
|
||||
if (!errorCode || !message) {
|
||||
return unknownErrorCard;
|
||||
}
|
||||
let error;
|
||||
try {
|
||||
const detailJson = details ? JSON.parse(details) : {};
|
||||
error = import_stack_shared.KnownError.fromJson({ code: errorCode, message, details: detailJson });
|
||||
} catch (e) {
|
||||
return unknownErrorCard;
|
||||
}
|
||||
if (import_stack_shared.KnownErrors.OAuthConnectionAlreadyConnectedToAnotherUser.isInstance(error)) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_message_card.MessageCard,
|
||||
{
|
||||
title: t("Failed to connect account"),
|
||||
fullPage: !!props.fullPage,
|
||||
primaryButtonText: t("Go Home"),
|
||||
primaryAction: () => stackApp.redirectToHome(),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("This account is already connected to another user. Please connect a different account.") })
|
||||
}
|
||||
);
|
||||
}
|
||||
if (import_stack_shared.KnownErrors.UserAlreadyConnectedToAnotherOAuthConnection.isInstance(error)) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_message_card.MessageCard,
|
||||
{
|
||||
title: t("Failed to connect account"),
|
||||
fullPage: !!props.fullPage,
|
||||
primaryButtonText: t("Go Home"),
|
||||
primaryAction: () => stackApp.redirectToHome(),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("The user is already connected to another OAuth account. Did you maybe selected the wrong account on the OAuth provider page?") })
|
||||
}
|
||||
);
|
||||
}
|
||||
if (import_stack_shared.KnownErrors.OAuthProviderAccessDenied.isInstance(error)) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_message_card.MessageCard,
|
||||
{
|
||||
title: t("OAuth provider access denied"),
|
||||
fullPage: !!props.fullPage,
|
||||
primaryButtonText: t("Sign in again"),
|
||||
primaryAction: () => stackApp.redirectToSignIn(),
|
||||
secondaryButtonText: t("Go Home"),
|
||||
secondaryAction: () => stackApp.redirectToHome(),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("The sign-in operation has been cancelled. Please try again. [access_denied]") })
|
||||
}
|
||||
);
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_known_error_message_card.KnownErrorMessageCard, { error, fullPage: !!props.fullPage });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
ErrorPage
|
||||
});
|
||||
//# sourceMappingURL=error-page.js.map
|
||||
1
package/@stackframe/react/dist/components-page/error-page.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/error-page.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../src/components-page/error-page.tsx"],"sourcesContent":["'use client';\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\n\nimport { KnownError, KnownErrors } from \"@stackframe/stack-shared\";\nimport { Typography } from \"@stackframe/stack-ui\";\nimport { useStackApp } from \"..\";\nimport { KnownErrorMessageCard } from \"../components/message-cards/known-error-message-card\";\nimport { MessageCard } from \"../components/message-cards/message-card\";\nimport { PredefinedMessageCard } from \"../components/message-cards/predefined-message-card\";\nimport { useTranslation } from \"../lib/translations\";\n\n\nexport function ErrorPage(props: { fullPage?: boolean, searchParams: Record<string, string> }) {\n const { t } = useTranslation();\n const stackApp = useStackApp();\n const errorCode = props.searchParams.errorCode;\n const message = props.searchParams.message;\n const details = props.searchParams.details;\n\n const unknownErrorCard = <PredefinedMessageCard type='unknownError' fullPage={!!props.fullPage} />;\n\n if (!errorCode || !message) {\n return unknownErrorCard;\n }\n\n let error;\n try {\n const detailJson = details ? JSON.parse(details) : {};\n error = KnownError.fromJson({ code: errorCode, message, details: detailJson });\n } catch (e) {\n return unknownErrorCard;\n }\n\n if (KnownErrors.OAuthConnectionAlreadyConnectedToAnotherUser.isInstance(error)) {\n // TODO: add \"Connect a different account\" button\n return (\n <MessageCard\n title={t(\"Failed to connect account\")}\n fullPage={!!props.fullPage}\n primaryButtonText={t(\"Go Home\")}\n primaryAction={() => stackApp.redirectToHome()}\n >\n <Typography>\n {t(\"This account is already connected to another user. Please connect a different account.\")}\n </Typography>\n </MessageCard>\n );\n }\n\n if (KnownErrors.UserAlreadyConnectedToAnotherOAuthConnection.isInstance(error)) {\n // TODO: add \"Connect again\" button\n return (\n <MessageCard\n title={t(\"Failed to connect account\")}\n fullPage={!!props.fullPage}\n primaryButtonText={t(\"Go Home\")}\n primaryAction={() => stackApp.redirectToHome()}\n >\n <Typography>\n {t(\"The user is already connected to another OAuth account. Did you maybe selected the wrong account on the OAuth provider page?\")}\n </Typography>\n </MessageCard>\n );\n }\n\n if (KnownErrors.OAuthProviderAccessDenied.isInstance(error)) {\n return (\n <MessageCard\n title={t(\"OAuth provider access denied\")}\n fullPage={!!props.fullPage}\n primaryButtonText={t(\"Sign in again\")}\n primaryAction={() => stackApp.redirectToSignIn()}\n secondaryButtonText={t(\"Go Home\")}\n secondaryAction={() => stackApp.redirectToHome()}\n >\n <Typography>\n {t(\"The sign-in operation has been cancelled. Please try again. [access_denied]\")}\n </Typography>\n </MessageCard>\n );\n }\n\n return <KnownErrorMessageCard error={error} fullPage={!!props.fullPage} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,0BAAwC;AACxC,sBAA2B;AAC3B,eAA4B;AAC5B,sCAAsC;AACtC,0BAA4B;AAC5B,qCAAsC;AACtC,0BAA+B;AAUJ;AAPpB,SAAS,UAAU,OAAqE;AAC7F,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,eAAW,sBAAY;AAC7B,QAAM,YAAY,MAAM,aAAa;AACrC,QAAM,UAAU,MAAM,aAAa;AACnC,QAAM,UAAU,MAAM,aAAa;AAEnC,QAAM,mBAAmB,4CAAC,wDAAsB,MAAK,gBAAe,UAAU,CAAC,CAAC,MAAM,UAAU;AAEhG,MAAI,CAAC,aAAa,CAAC,SAAS;AAC1B,WAAO;AAAA,EACT;AAEA,MAAI;AACJ,MAAI;AACF,UAAM,aAAa,UAAU,KAAK,MAAM,OAAO,IAAI,CAAC;AACpD,YAAQ,+BAAW,SAAS,EAAE,MAAM,WAAW,SAAS,SAAS,WAAW,CAAC;AAAA,EAC/E,SAAS,GAAG;AACV,WAAO;AAAA,EACT;AAEA,MAAI,gCAAY,6CAA6C,WAAW,KAAK,GAAG;AAE9E,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,2BAA2B;AAAA,QACpC,UAAU,CAAC,CAAC,MAAM;AAAA,QAClB,mBAAmB,EAAE,SAAS;AAAA,QAC9B,eAAe,MAAM,SAAS,eAAe;AAAA,QAE7C,sDAAC,8BACE,YAAE,wFAAwF,GAC7F;AAAA;AAAA,IACF;AAAA,EAEJ;AAEA,MAAI,gCAAY,6CAA6C,WAAW,KAAK,GAAG;AAE9E,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,2BAA2B;AAAA,QACpC,UAAU,CAAC,CAAC,MAAM;AAAA,QAClB,mBAAmB,EAAE,SAAS;AAAA,QAC9B,eAAe,MAAM,SAAS,eAAe;AAAA,QAE7C,sDAAC,8BACE,YAAE,8HAA8H,GACnI;AAAA;AAAA,IACF;AAAA,EAEJ;AAEA,MAAI,gCAAY,0BAA0B,WAAW,KAAK,GAAG;AAC3D,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,8BAA8B;AAAA,QACvC,UAAU,CAAC,CAAC,MAAM;AAAA,QAClB,mBAAmB,EAAE,eAAe;AAAA,QACpC,eAAe,MAAM,SAAS,iBAAiB;AAAA,QAC/C,qBAAqB,EAAE,SAAS;AAAA,QAChC,iBAAiB,MAAM,SAAS,eAAe;AAAA,QAE/C,sDAAC,8BACE,YAAE,6EAA6E,GAClF;AAAA;AAAA,IACF;AAAA,EAEJ;AAEA,SAAO,4CAAC,yDAAsB,OAAc,UAAU,CAAC,CAAC,MAAM,UAAU;AAC1E;","names":[]}
|
||||
117
package/@stackframe/react/dist/components-page/forgot-password.js
vendored
Normal file
117
package/@stackframe/react/dist/components-page/forgot-password.js
vendored
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/forgot-password.tsx
|
||||
var forgot_password_exports = {};
|
||||
__export(forgot_password_exports, {
|
||||
ForgotPassword: () => ForgotPassword,
|
||||
ForgotPasswordForm: () => ForgotPasswordForm
|
||||
});
|
||||
module.exports = __toCommonJS(forgot_password_exports);
|
||||
var import_yup = require("@hookform/resolvers/yup");
|
||||
var import_schema_fields = require("@stackframe/stack-shared/dist/schema-fields");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_react_hook_form = require("react-hook-form");
|
||||
var import__ = require("..");
|
||||
var import_form_warning = require("../components/elements/form-warning");
|
||||
var import_maybe_full_page = require("../components/elements/maybe-full-page");
|
||||
var import_link = require("../components/link");
|
||||
var import_predefined_message_card = require("../components/message-cards/predefined-message-card");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function ForgotPasswordForm({ onSent }) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const schema = (0, import_schema_fields.yupObject)({
|
||||
email: (0, import_schema_fields.strictEmailSchema)(t("Please enter a valid email")).defined().nonEmpty(t("Please enter your email"))
|
||||
});
|
||||
const { register, handleSubmit, formState: { errors }, clearErrors } = (0, import_react_hook_form.useForm)({
|
||||
resolver: (0, import_yup.yupResolver)(schema)
|
||||
});
|
||||
const stackApp = (0, import__.useStackApp)();
|
||||
const [loading, setLoading] = (0, import_react.useState)(false);
|
||||
const onSubmit = async (data) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { email } = data;
|
||||
await stackApp.sendForgotPasswordEmail(email);
|
||||
onSent?.();
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
"form",
|
||||
{
|
||||
className: "flex flex-col items-stretch stack-scope",
|
||||
onSubmit: (e) => (0, import_promises.runAsynchronouslyWithAlert)(handleSubmit(onSubmit)(e)),
|
||||
noValidate: true,
|
||||
children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "email", className: "mb-1", children: t("Your Email") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Input,
|
||||
{
|
||||
id: "email",
|
||||
type: "email",
|
||||
autoComplete: "email",
|
||||
...register("email"),
|
||||
onChange: () => clearErrors("email")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.email?.message?.toString() }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { type: "submit", className: "mt-6", loading, children: t("Send Email") })
|
||||
]
|
||||
}
|
||||
);
|
||||
}
|
||||
function ForgotPassword(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const stackApp = (0, import__.useStackApp)();
|
||||
const user = (0, import__.useUser)();
|
||||
const [sent, setSent] = (0, import_react.useState)(false);
|
||||
if (user) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "signedIn", fullPage: !!props.fullPage });
|
||||
}
|
||||
if (sent) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "emailSent", fullPage: !!props.fullPage });
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_maybe_full_page.MaybeFullPage, { fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_stack_ui.cn)(
|
||||
"stack-scope max-w-[380px] flex-basis-[380px]",
|
||||
props.fullPage ? "p-4" : "p-0"
|
||||
), children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-center", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { type: "h2", children: t("Reset Your Password") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Typography, { children: [
|
||||
t("Don't need to reset?"),
|
||||
" ",
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.StyledLink, { href: stackApp.urls["signIn"], children: t("Sign in") })
|
||||
] })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-6", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ForgotPasswordForm, { onSent: () => setSent(true) }) })
|
||||
] }) });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
ForgotPassword,
|
||||
ForgotPasswordForm
|
||||
});
|
||||
//# sourceMappingURL=forgot-password.js.map
|
||||
1
package/@stackframe/react/dist/components-page/forgot-password.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/forgot-password.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
110
package/@stackframe/react/dist/components-page/magic-link-callback.js
vendored
Normal file
110
package/@stackframe/react/dist/components-page/magic-link-callback.js
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/magic-link-callback.tsx
|
||||
var magic_link_callback_exports = {};
|
||||
__export(magic_link_callback_exports, {
|
||||
MagicLinkCallback: () => MagicLinkCallback
|
||||
});
|
||||
module.exports = __toCommonJS(magic_link_callback_exports);
|
||||
var import_stack_shared = require("@stackframe/stack-shared");
|
||||
var import_caches = require("@stackframe/stack-shared/dist/utils/caches");
|
||||
var import_errors = require("@stackframe/stack-shared/dist/utils/errors");
|
||||
var import_react = __toESM(require("react"));
|
||||
var import__ = require("..");
|
||||
var import_message_card = require("../components/message-cards/message-card");
|
||||
var import_predefined_message_card = require("../components/message-cards/predefined-message-card");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
var cacheSignInWithMagicLink = (0, import_caches.cacheFunction)(async (stackApp, code) => {
|
||||
return await stackApp.signInWithMagicLink(code);
|
||||
});
|
||||
function MagicLinkCallback(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const stackApp = (0, import__.useStackApp)();
|
||||
const user = (0, import__.useUser)();
|
||||
const [result, setResult] = import_react.default.useState(null);
|
||||
if (user) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "signedIn", fullPage: !!props.fullPage });
|
||||
}
|
||||
const invalidJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: t("Invalid Magic Link"), fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("Please check if you have the correct link. If you continue to have issues, please contact support.") }) });
|
||||
const expiredJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: t("Expired Magic Link"), fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("Your magic link has expired. Please request a new magic link if you need to sign-in.") }) });
|
||||
const alreadyUsedJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: t("Magic Link Already Used"), fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("The magic link has already been used. The link can only be used once. Please request a new magic link if you need to sign-in again.") }) });
|
||||
if (!props.searchParams?.code) {
|
||||
return invalidJsx;
|
||||
}
|
||||
if (!result) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_message_card.MessageCard,
|
||||
{
|
||||
title: t("Do you want to sign in?"),
|
||||
fullPage: !!props.fullPage,
|
||||
primaryButtonText: t("Sign in"),
|
||||
primaryAction: async () => {
|
||||
const result2 = await stackApp.signInWithMagicLink(props.searchParams?.code || (0, import_errors.throwErr)("No magic link provided"));
|
||||
setResult(result2);
|
||||
},
|
||||
secondaryButtonText: t("Cancel"),
|
||||
secondaryAction: async () => {
|
||||
await stackApp.redirectToHome();
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
if (result.status === "error") {
|
||||
if (import_stack_shared.KnownErrors.VerificationCodeNotFound.isInstance(result.error)) {
|
||||
return invalidJsx;
|
||||
} else if (import_stack_shared.KnownErrors.VerificationCodeExpired.isInstance(result.error)) {
|
||||
return expiredJsx;
|
||||
} else if (import_stack_shared.KnownErrors.VerificationCodeAlreadyUsed.isInstance(result.error)) {
|
||||
return alreadyUsedJsx;
|
||||
} else {
|
||||
throw result.error;
|
||||
}
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_message_card.MessageCard,
|
||||
{
|
||||
title: t("Signed in successfully!"),
|
||||
fullPage: !!props.fullPage,
|
||||
primaryButtonText: t("Go home"),
|
||||
primaryAction: async () => {
|
||||
await stackApp.redirectToHome();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
MagicLinkCallback
|
||||
});
|
||||
//# sourceMappingURL=magic-link-callback.js.map
|
||||
1
package/@stackframe/react/dist/components-page/magic-link-callback.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/magic-link-callback.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
93
package/@stackframe/react/dist/components-page/oauth-callback.js
vendored
Normal file
93
package/@stackframe/react/dist/components-page/oauth-callback.js
vendored
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/oauth-callback.tsx
|
||||
var oauth_callback_exports = {};
|
||||
__export(oauth_callback_exports, {
|
||||
OAuthCallback: () => OAuthCallback
|
||||
});
|
||||
module.exports = __toCommonJS(oauth_callback_exports);
|
||||
var import_errors = require("@stackframe/stack-shared/dist/utils/errors");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import__ = require("..");
|
||||
var import_maybe_full_page = require("../components/elements/maybe-full-page");
|
||||
var import_link = require("../components/link");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function OAuthCallback({ fullPage }) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const app = (0, import__.useStackApp)();
|
||||
const called = (0, import_react.useRef)(false);
|
||||
const [error, setError] = (0, import_react.useState)(null);
|
||||
const [showRedirectLink, setShowRedirectLink] = (0, import_react.useState)(false);
|
||||
(0, import_react.useEffect)(() => (0, import_promises.runAsynchronously)(async () => {
|
||||
if (called.current) return;
|
||||
called.current = true;
|
||||
let hasRedirected = false;
|
||||
try {
|
||||
hasRedirected = await app.callOAuthCallback();
|
||||
} catch (e) {
|
||||
(0, import_errors.captureError)("<OAuthCallback />", e);
|
||||
setError(e);
|
||||
}
|
||||
if (!hasRedirected && (!error || process.env.NODE_ENV === "production")) {
|
||||
await app.redirectToSignIn({ noRedirectBack: true });
|
||||
}
|
||||
}), []);
|
||||
(0, import_react.useEffect)(() => {
|
||||
setTimeout(() => setShowRedirectLink(true), 3e3);
|
||||
}, []);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_maybe_full_page.MaybeFullPage,
|
||||
{
|
||||
fullPage: fullPage ?? false,
|
||||
containerClassName: "flex items-center justify-center",
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
"div",
|
||||
{
|
||||
className: (0, import_stack_ui.cn)(
|
||||
"text-center justify-center items-center stack-scope flex flex-col gap-4 max-w-[380px]",
|
||||
fullPage ? "p-4" : "p-0"
|
||||
),
|
||||
children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-col justify-center items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Spinner, { size: 20 }) }),
|
||||
showRedirectLink ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
||||
t("If you are not redirected automatically, "),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.StyledLink, { className: "whitespace-nowrap", href: app.urls.home, children: t("click here") })
|
||||
] }) : null,
|
||||
error ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("Something went wrong while processing the OAuth callback:") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: JSON.stringify(error, null, 2) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("This is most likely an error in Stack. Please report it.") })
|
||||
] }) : null
|
||||
]
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
OAuthCallback
|
||||
});
|
||||
//# sourceMappingURL=oauth-callback.js.map
|
||||
1
package/@stackframe/react/dist/components-page/oauth-callback.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/oauth-callback.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../src/components-page/oauth-callback.tsx"],"sourcesContent":["'use client';\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\n\nimport { captureError } from \"@stackframe/stack-shared/dist/utils/errors\";\nimport { runAsynchronously } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { Spinner, cn } from \"@stackframe/stack-ui\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { useStackApp } from \"..\";\nimport { MaybeFullPage } from \"../components/elements/maybe-full-page\";\nimport { StyledLink } from \"../components/link\";\nimport { useTranslation } from \"../lib/translations\";\n\nexport function OAuthCallback({ fullPage }: { fullPage?: boolean }) {\n const { t } = useTranslation();\n const app = useStackApp();\n const called = useRef(false);\n const [error, setError] = useState<unknown>(null);\n const [showRedirectLink, setShowRedirectLink] = useState(false);\n\n useEffect(() => runAsynchronously(async () => {\n if (called.current) return;\n called.current = true;\n let hasRedirected = false;\n try {\n hasRedirected = await app.callOAuthCallback();\n } catch (e) {\n captureError(\"<OAuthCallback />\", e);\n setError(e);\n }\n if (!hasRedirected && (!error || process.env.NODE_ENV === 'production')) {\n await app.redirectToSignIn({ noRedirectBack: true });\n }\n }), []);\n\n useEffect(() => {\n setTimeout(() => setShowRedirectLink(true), 3000);\n }, []);\n\n return (\n <MaybeFullPage\n fullPage={fullPage ?? false}\n containerClassName=\"flex items-center justify-center\"\n >\n <div\n className={cn(\n \"text-center justify-center items-center stack-scope flex flex-col gap-4 max-w-[380px]\",\n fullPage ? \"p-4\" : \"p-0\"\n )}\n >\n <div className=\"flex flex-col justify-center items-center gap-4\">\n <Spinner size={20} />\n </div>\n {showRedirectLink ? <p>{t('If you are not redirected automatically, ')}<StyledLink className=\"whitespace-nowrap\" href={app.urls.home}>{t(\"click here\")}</StyledLink></p> : null}\n {error ? <div>\n <p>{t(\"Something went wrong while processing the OAuth callback:\")}</p>\n <pre>{JSON.stringify(error, null, 2)}</pre>\n <p>{t(\"This is most likely an error in Stack. Please report it.\")}</p>\n </div> : null}\n </div>\n </MaybeFullPage>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,oBAA6B;AAC7B,sBAAkC;AAClC,sBAA4B;AAC5B,mBAA4C;AAC5C,eAA4B;AAC5B,6BAA8B;AAC9B,kBAA2B;AAC3B,0BAA+B;AAwCrB;AAtCH,SAAS,cAAc,EAAE,SAAS,GAA2B;AAClE,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,UAAM,sBAAY;AACxB,QAAM,aAAS,qBAAO,KAAK;AAC3B,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAkB,IAAI;AAChD,QAAM,CAAC,kBAAkB,mBAAmB,QAAI,uBAAS,KAAK;AAE9D,8BAAU,UAAM,mCAAkB,YAAY;AAC5C,QAAI,OAAO,QAAS;AACpB,WAAO,UAAU;AACjB,QAAI,gBAAgB;AACpB,QAAI;AACF,sBAAgB,MAAM,IAAI,kBAAkB;AAAA,IAC9C,SAAS,GAAG;AACV,sCAAa,qBAAqB,CAAC;AACnC,eAAS,CAAC;AAAA,IACZ;AACA,QAAI,CAAC,kBAAkB,CAAC,SAAS,QAAQ,IAAI,aAAa,eAAe;AACvE,YAAM,IAAI,iBAAiB,EAAE,gBAAgB,KAAK,CAAC;AAAA,IACrD;AAAA,EACF,CAAC,GAAG,CAAC,CAAC;AAEN,8BAAU,MAAM;AACd,eAAW,MAAM,oBAAoB,IAAI,GAAG,GAAI;AAAA,EAClD,GAAG,CAAC,CAAC;AAEL,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,YAAY;AAAA,MACtB,oBAAmB;AAAA,MAEnB;AAAA,QAAC;AAAA;AAAA,UACC,eAAW;AAAA,YACT;AAAA,YACA,WAAW,QAAQ;AAAA,UACrB;AAAA,UAEA;AAAA,wDAAC,SAAI,WAAU,mDACb,sDAAC,2BAAQ,MAAM,IAAI,GACrB;AAAA,YACC,mBAAmB,6CAAC,OAAG;AAAA,gBAAE,2CAA2C;AAAA,cAAE,4CAAC,0BAAW,WAAU,qBAAoB,MAAM,IAAI,KAAK,MAAO,YAAE,YAAY,GAAE;AAAA,eAAa,IAAO;AAAA,YAC1K,QAAQ,6CAAC,SACR;AAAA,0DAAC,OAAG,YAAE,2DAA2D,GAAE;AAAA,cACnE,4CAAC,SAAK,eAAK,UAAU,OAAO,MAAM,CAAC,GAAE;AAAA,cACrC,4CAAC,OAAG,YAAE,0DAA0D,GAAE;AAAA,eACpE,IAAS;AAAA;AAAA;AAAA,MACX;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
||||
179
package/@stackframe/react/dist/components-page/password-reset.js
vendored
Normal file
179
package/@stackframe/react/dist/components-page/password-reset.js
vendored
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/password-reset.tsx
|
||||
var password_reset_exports = {};
|
||||
__export(password_reset_exports, {
|
||||
PasswordReset: () => PasswordReset,
|
||||
default: () => PasswordResetForm
|
||||
});
|
||||
module.exports = __toCommonJS(password_reset_exports);
|
||||
var import_yup = require("@hookform/resolvers/yup");
|
||||
var import_stack_shared = require("@stackframe/stack-shared");
|
||||
var import_password = require("@stackframe/stack-shared/dist/helpers/password");
|
||||
var import_schema_fields = require("@stackframe/stack-shared/dist/schema-fields");
|
||||
var import_caches = require("@stackframe/stack-shared/dist/utils/caches");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = __toESM(require("react"));
|
||||
var import_react_hook_form = require("react-hook-form");
|
||||
var yup = __toESM(require("yup"));
|
||||
var import__ = require("..");
|
||||
var import_form_warning = require("../components/elements/form-warning");
|
||||
var import_maybe_full_page = require("../components/elements/maybe-full-page");
|
||||
var import_message_card = require("../components/message-cards/message-card");
|
||||
var import_predefined_message_card = require("../components/message-cards/predefined-message-card");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function PasswordResetForm(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const schema = (0, import_schema_fields.yupObject)({
|
||||
password: import_schema_fields.passwordSchema.defined(t("Please enter your password")).nonEmpty(t("Please enter your password")).test({
|
||||
name: "is-valid-password",
|
||||
test: (value, ctx) => {
|
||||
const error = (0, import_password.getPasswordError)(value);
|
||||
if (error) {
|
||||
return ctx.createError({ message: error.message });
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}),
|
||||
passwordRepeat: (0, import_schema_fields.yupString)().nullable().oneOf([yup.ref("password"), null], t("Passwords do not match")).defined().nonEmpty(t("Please repeat your password"))
|
||||
});
|
||||
const { register, handleSubmit, formState: { errors }, clearErrors } = (0, import_react_hook_form.useForm)({
|
||||
resolver: (0, import_yup.yupResolver)(schema)
|
||||
});
|
||||
const stackApp = (0, import__.useStackApp)();
|
||||
const [finished, setFinished] = (0, import_react.useState)(false);
|
||||
const [resetError, setResetError] = (0, import_react.useState)(false);
|
||||
const [loading, setLoading] = (0, import_react.useState)(false);
|
||||
const onSubmit = async (data) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { password } = data;
|
||||
const result = await stackApp.resetPassword({ password, code: props.code });
|
||||
if (result.status === "error") {
|
||||
setResetError(true);
|
||||
return;
|
||||
}
|
||||
setFinished(true);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
if (finished) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "passwordReset", fullPage: !!props.fullPage });
|
||||
}
|
||||
if (resetError) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: t("Failed to reset password"), fullPage: !!props.fullPage, children: t("Failed to reset password. Please request a new password reset link") });
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_maybe_full_page.MaybeFullPage, { fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_stack_ui.cn)(
|
||||
"flex flex-col items-stretch max-w-[380px] flex-basis-[380px]",
|
||||
props.fullPage ? "p-4" : "p-0"
|
||||
), children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-center mb-6", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { type: "h2", children: t("Reset Your Password") }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
"form",
|
||||
{
|
||||
className: "flex flex-col items-stretch",
|
||||
onSubmit: (e) => (0, import_promises.runAsynchronouslyWithAlert)(handleSubmit(onSubmit)(e)),
|
||||
noValidate: true,
|
||||
children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "password", className: "mb-1", children: t("New Password") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.PasswordInput,
|
||||
{
|
||||
id: "password",
|
||||
autoComplete: "new-password",
|
||||
...register("password"),
|
||||
onChange: () => {
|
||||
clearErrors("password");
|
||||
clearErrors("passwordRepeat");
|
||||
}
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.password?.message?.toString() }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "repeat-password", className: "mt-4 mb-1", children: t("Repeat New Password") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.PasswordInput,
|
||||
{
|
||||
id: "repeat-password",
|
||||
autoComplete: "new-password",
|
||||
...register("passwordRepeat"),
|
||||
onChange: () => {
|
||||
clearErrors("password");
|
||||
clearErrors("passwordRepeat");
|
||||
}
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.passwordRepeat?.message?.toString() }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { type: "submit", className: "mt-6", loading, children: t("Reset Password") })
|
||||
]
|
||||
}
|
||||
)
|
||||
] }) });
|
||||
}
|
||||
var cachedVerifyPasswordResetCode = (0, import_caches.cacheFunction)(async (stackApp, code) => {
|
||||
return await stackApp.verifyPasswordResetCode(code);
|
||||
});
|
||||
function PasswordReset({
|
||||
searchParams,
|
||||
fullPage = false
|
||||
}) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const stackApp = (0, import__.useStackApp)();
|
||||
const invalidJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: t("Invalid Password Reset Link"), fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("Please double check if you have the correct password reset link.") }) });
|
||||
const expiredJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: t("Expired Password Reset Link"), fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("Your password reset link has expired. Please request a new password reset link from the login page.") }) });
|
||||
const usedJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: t("Used Password Reset Link"), fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("This password reset link has already been used. If you need to reset your password again, please request a new password reset link from the login page.") }) });
|
||||
const code = searchParams.code;
|
||||
if (!code) {
|
||||
return invalidJsx;
|
||||
}
|
||||
const result = import_react.default.use(cachedVerifyPasswordResetCode(stackApp, code));
|
||||
if (result.status === "error") {
|
||||
if (import_stack_shared.KnownErrors.VerificationCodeNotFound.isInstance(result.error)) {
|
||||
return invalidJsx;
|
||||
} else if (import_stack_shared.KnownErrors.VerificationCodeExpired.isInstance(result.error)) {
|
||||
return expiredJsx;
|
||||
} else if (import_stack_shared.KnownErrors.VerificationCodeAlreadyUsed.isInstance(result.error)) {
|
||||
return usedJsx;
|
||||
} else {
|
||||
throw result.error;
|
||||
}
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PasswordResetForm, { code, fullPage });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
PasswordReset
|
||||
});
|
||||
//# sourceMappingURL=password-reset.js.map
|
||||
1
package/@stackframe/react/dist/components-page/password-reset.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/password-reset.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
6
package/@stackframe/react/dist/components-page/section.js
vendored
Normal file
6
package/@stackframe/react/dist/components-page/section.js
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
// src/components-page/section.tsx
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
//# sourceMappingURL=section.js.map
|
||||
1
package/@stackframe/react/dist/components-page/section.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/section.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../src/components-page/section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Separator, Typography } from \"@stackframe/stack-ui\";\n\n\nfunction Section(props: { title: string, description?: string, children: React.ReactNode }) {\n return (\n <>\n <Separator />\n <div className='flex flex-col sm:flex-row gap-2'>\n <div className='sm:flex-1 flex flex-col justify-center'>\n <Typography className='font-medium'>\n {props.title}\n </Typography>\n {props.description && <Typography variant='secondary' type='footnote'>\n {props.description}\n </Typography>}\n </div>\n <div className='sm:flex-1 sm:items-end flex flex-col gap-2 '>\n {props.children}\n </div>\n </div>\n </>\n );\n}\n"],"mappings":";;;AAIA,sBAAsC;AAKlC;","names":[]}
|
||||
44
package/@stackframe/react/dist/components-page/sign-in.js
vendored
Normal file
44
package/@stackframe/react/dist/components-page/sign-in.js
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/sign-in.tsx
|
||||
var sign_in_exports = {};
|
||||
__export(sign_in_exports, {
|
||||
SignIn: () => SignIn
|
||||
});
|
||||
module.exports = __toCommonJS(sign_in_exports);
|
||||
var import_auth_page = require("./auth-page");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function SignIn(props) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_auth_page.AuthPage,
|
||||
{
|
||||
fullPage: !!props.fullPage,
|
||||
type: "sign-in",
|
||||
automaticRedirect: !!props.automaticRedirect,
|
||||
extraInfo: props.extraInfo,
|
||||
firstTab: props.firstTab
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
SignIn
|
||||
});
|
||||
//# sourceMappingURL=sign-in.js.map
|
||||
1
package/@stackframe/react/dist/components-page/sign-in.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/sign-in.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../src/components-page/sign-in.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { AuthPage } from \"./auth-page\";\n\nexport function SignIn(props: {\n fullPage?: boolean,\n automaticRedirect?: boolean,\n extraInfo?: React.ReactNode,\n firstTab?: 'magic-link' | 'password',\n}) {\n return (\n <AuthPage\n fullPage={!!props.fullPage}\n type=\"sign-in\"\n automaticRedirect={!!props.automaticRedirect}\n extraInfo={props.extraInfo}\n firstTab={props.firstTab}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,uBAAyB;AASrB;AAPG,SAAS,OAAO,OAKpB;AACD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,CAAC,CAAC,MAAM;AAAA,MAClB,MAAK;AAAA,MACL,mBAAmB,CAAC,CAAC,MAAM;AAAA,MAC3B,WAAW,MAAM;AAAA,MACjB,UAAU,MAAM;AAAA;AAAA,EAClB;AAEJ;","names":[]}
|
||||
57
package/@stackframe/react/dist/components-page/sign-out.js
vendored
Normal file
57
package/@stackframe/react/dist/components-page/sign-out.js
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/sign-out.tsx
|
||||
var sign_out_exports = {};
|
||||
__export(sign_out_exports, {
|
||||
SignOut: () => SignOut
|
||||
});
|
||||
module.exports = __toCommonJS(sign_out_exports);
|
||||
var import_caches = require("@stackframe/stack-shared/dist/utils/caches");
|
||||
var import_react = __toESM(require("react"));
|
||||
var import__ = require("..");
|
||||
var import_predefined_message_card = require("../components/message-cards/predefined-message-card");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
var cacheSignOut = (0, import_caches.cacheFunction)(async (user) => {
|
||||
return await user.signOut();
|
||||
});
|
||||
function SignOut(props) {
|
||||
const user = (0, import__.useUser)();
|
||||
if (user) {
|
||||
import_react.default.use(cacheSignOut(user));
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "signedOut", fullPage: props.fullPage });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
SignOut
|
||||
});
|
||||
//# sourceMappingURL=sign-out.js.map
|
||||
1
package/@stackframe/react/dist/components-page/sign-out.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/sign-out.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../src/components-page/sign-out.tsx"],"sourcesContent":["'use client';\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\n\nimport { cacheFunction } from \"@stackframe/stack-shared/dist/utils/caches\";\nimport React from \"react\";\nimport { CurrentUser, useUser } from \"..\";\nimport { PredefinedMessageCard } from \"../components/message-cards/predefined-message-card\";\n\nconst cacheSignOut = cacheFunction(async (user: CurrentUser) => {\n return await user.signOut();\n});\n\nexport function SignOut(props: { fullPage?: boolean }) {\n const user = useUser();\n\n if (user) {\n React.use(cacheSignOut(user));\n }\n\n return <PredefinedMessageCard type='signedOut' fullPage={props.fullPage} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,oBAA8B;AAC9B,mBAAkB;AAClB,eAAqC;AACrC,qCAAsC;AAa7B;AAXT,IAAM,mBAAe,6BAAc,OAAO,SAAsB;AAC9D,SAAO,MAAM,KAAK,QAAQ;AAC5B,CAAC;AAEM,SAAS,QAAQ,OAA+B;AACrD,QAAM,WAAO,kBAAQ;AAErB,MAAI,MAAM;AACR,iBAAAA,QAAM,IAAI,aAAa,IAAI,CAAC;AAAA,EAC9B;AAEA,SAAO,4CAAC,wDAAsB,MAAK,aAAY,UAAU,MAAM,UAAU;AAC3E;","names":["React"]}
|
||||
47
package/@stackframe/react/dist/components-page/sign-up.js
vendored
Normal file
47
package/@stackframe/react/dist/components-page/sign-up.js
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/sign-up.tsx
|
||||
var sign_up_exports = {};
|
||||
__export(sign_up_exports, {
|
||||
SignUp: () => SignUp
|
||||
});
|
||||
module.exports = __toCommonJS(sign_up_exports);
|
||||
var import_auth_page = require("./auth-page");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function SignUp(props) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_auth_page.AuthPage,
|
||||
{
|
||||
fullPage: !!props.fullPage,
|
||||
type: "sign-up",
|
||||
automaticRedirect: !!props.automaticRedirect,
|
||||
noPasswordRepeat: props.noPasswordRepeat,
|
||||
extraInfo: props.extraInfo,
|
||||
firstTab: props.firstTab
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
SignUp
|
||||
});
|
||||
//# sourceMappingURL=sign-up.js.map
|
||||
1
package/@stackframe/react/dist/components-page/sign-up.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/sign-up.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../src/components-page/sign-up.tsx"],"sourcesContent":["'use client';\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { AuthPage } from './auth-page';\n\nexport function SignUp(props: {\n fullPage?: boolean,\n automaticRedirect?: boolean,\n noPasswordRepeat?: boolean,\n extraInfo?: React.ReactNode,\n firstTab?: 'magic-link' | 'password',\n}) {\n return <AuthPage\n fullPage={!!props.fullPage}\n type='sign-up'\n automaticRedirect={!!props.automaticRedirect}\n noPasswordRepeat={props.noPasswordRepeat}\n extraInfo={props.extraInfo}\n firstTab={props.firstTab}\n />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,uBAAyB;AAShB;AAPF,SAAS,OAAO,OAMpB;AACD,SAAO;AAAA,IAAC;AAAA;AAAA,MACN,UAAU,CAAC,CAAC,MAAM;AAAA,MAClB,MAAK;AAAA,MACL,mBAAmB,CAAC,CAAC,MAAM;AAAA,MAC3B,kBAAkB,MAAM;AAAA,MACxB,WAAW,MAAM;AAAA,MACjB,UAAU,MAAM;AAAA;AAAA,EAClB;AACF;","names":[]}
|
||||
255
package/@stackframe/react/dist/components-page/stack-handler.js
vendored
Normal file
255
package/@stackframe/react/dist/components-page/stack-handler.js
vendored
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/stack-handler.tsx
|
||||
var stack_handler_exports = {};
|
||||
__export(stack_handler_exports, {
|
||||
default: () => stack_handler_default
|
||||
});
|
||||
module.exports = __toCommonJS(stack_handler_exports);
|
||||
var import_errors = require("@stackframe/stack-shared/dist/utils/errors");
|
||||
var import_objects = require("@stackframe/stack-shared/dist/utils/objects");
|
||||
var import_urls = require("@stackframe/stack-shared/dist/utils/urls");
|
||||
var import_react = require("react");
|
||||
var import__ = require("..");
|
||||
var import_iframe_preventer = require("../components/iframe-preventer");
|
||||
var import_message_card = require("../components/message-cards/message-card");
|
||||
var import_account_settings = require("./account-settings");
|
||||
var import_cli_auth_confirm = require("./cli-auth-confirm");
|
||||
var import_email_verification = require("./email-verification");
|
||||
var import_error_page = require("./error-page");
|
||||
var import_forgot_password = require("./forgot-password");
|
||||
var import_magic_link_callback = require("./magic-link-callback");
|
||||
var import_oauth_callback = require("./oauth-callback");
|
||||
var import_password_reset = require("./password-reset");
|
||||
var import_sign_out = require("./sign-out");
|
||||
var import_team_invitation = require("./team-invitation");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
var availablePaths = {
|
||||
signIn: "sign-in",
|
||||
signUp: "sign-up",
|
||||
emailVerification: "email-verification",
|
||||
passwordReset: "password-reset",
|
||||
forgotPassword: "forgot-password",
|
||||
signOut: "sign-out",
|
||||
oauthCallback: "oauth-callback",
|
||||
magicLinkCallback: "magic-link-callback",
|
||||
teamInvitation: "team-invitation",
|
||||
accountSettings: "account-settings",
|
||||
cliAuthConfirm: "cli-auth-confirm",
|
||||
error: "error"
|
||||
};
|
||||
var pathAliases = {
|
||||
// also includes the uppercase and non-dashed versions
|
||||
...Object.fromEntries(Object.entries(availablePaths).map(([key, value]) => [value, value])),
|
||||
"log-in": availablePaths.signIn,
|
||||
"register": availablePaths.signUp
|
||||
};
|
||||
function renderComponent(props) {
|
||||
const { path, searchParams, fullPage, componentProps, redirectIfNotHandler, onNotFound, app } = props;
|
||||
switch (path) {
|
||||
case availablePaths.signIn: {
|
||||
redirectIfNotHandler?.("signIn");
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import__.SignIn,
|
||||
{
|
||||
fullPage,
|
||||
automaticRedirect: true,
|
||||
...filterUndefinedINU(componentProps?.SignIn)
|
||||
}
|
||||
);
|
||||
}
|
||||
case availablePaths.signUp: {
|
||||
redirectIfNotHandler?.("signUp");
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import__.SignUp,
|
||||
{
|
||||
fullPage,
|
||||
automaticRedirect: true,
|
||||
...filterUndefinedINU(componentProps?.SignUp)
|
||||
}
|
||||
);
|
||||
}
|
||||
case availablePaths.emailVerification: {
|
||||
redirectIfNotHandler?.("emailVerification");
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_email_verification.EmailVerification,
|
||||
{
|
||||
searchParams,
|
||||
fullPage,
|
||||
...filterUndefinedINU(componentProps?.EmailVerification)
|
||||
}
|
||||
);
|
||||
}
|
||||
case availablePaths.passwordReset: {
|
||||
redirectIfNotHandler?.("passwordReset");
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_password_reset.PasswordReset,
|
||||
{
|
||||
searchParams,
|
||||
fullPage,
|
||||
...filterUndefinedINU(componentProps?.PasswordReset)
|
||||
}
|
||||
);
|
||||
}
|
||||
case availablePaths.forgotPassword: {
|
||||
redirectIfNotHandler?.("forgotPassword");
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_forgot_password.ForgotPassword,
|
||||
{
|
||||
fullPage,
|
||||
...filterUndefinedINU(componentProps?.ForgotPassword)
|
||||
}
|
||||
);
|
||||
}
|
||||
case availablePaths.signOut: {
|
||||
redirectIfNotHandler?.("signOut");
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_sign_out.SignOut,
|
||||
{
|
||||
fullPage,
|
||||
...filterUndefinedINU(componentProps?.SignOut)
|
||||
}
|
||||
);
|
||||
}
|
||||
case availablePaths.oauthCallback: {
|
||||
redirectIfNotHandler?.("oauthCallback");
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_oauth_callback.OAuthCallback,
|
||||
{
|
||||
fullPage,
|
||||
...filterUndefinedINU(componentProps?.OAuthCallback)
|
||||
}
|
||||
);
|
||||
}
|
||||
case availablePaths.magicLinkCallback: {
|
||||
redirectIfNotHandler?.("magicLinkCallback");
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_magic_link_callback.MagicLinkCallback,
|
||||
{
|
||||
searchParams,
|
||||
fullPage,
|
||||
...filterUndefinedINU(componentProps?.MagicLinkCallback)
|
||||
}
|
||||
);
|
||||
}
|
||||
case availablePaths.teamInvitation: {
|
||||
redirectIfNotHandler?.("teamInvitation");
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_team_invitation.TeamInvitation,
|
||||
{
|
||||
searchParams,
|
||||
fullPage,
|
||||
...filterUndefinedINU(componentProps?.TeamInvitation)
|
||||
}
|
||||
);
|
||||
}
|
||||
case availablePaths.accountSettings: {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_account_settings.AccountSettings,
|
||||
{
|
||||
fullPage,
|
||||
...filterUndefinedINU(componentProps?.AccountSettings)
|
||||
}
|
||||
);
|
||||
}
|
||||
case availablePaths.error: {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_error_page.ErrorPage,
|
||||
{
|
||||
searchParams,
|
||||
fullPage,
|
||||
...filterUndefinedINU(componentProps?.ErrorPage)
|
||||
}
|
||||
);
|
||||
}
|
||||
case availablePaths.cliAuthConfirm: {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_cli_auth_confirm.CliAuthConfirmation,
|
||||
{
|
||||
fullPage,
|
||||
...filterUndefinedINU(componentProps?.CliAuthConfirmation)
|
||||
}
|
||||
);
|
||||
}
|
||||
default: {
|
||||
if (Object.values(availablePaths).includes(path)) {
|
||||
throw new import_errors.StackAssertionError(`Path alias ${path} not included in switch statement, but in availablePaths?`, { availablePaths });
|
||||
}
|
||||
for (const [key, value] of Object.entries(pathAliases)) {
|
||||
if (path === key.toLowerCase().replaceAll("-", "")) {
|
||||
const redirectUrl = `${app.urls.handler}/${value}?${new URLSearchParams(searchParams).toString()}`;
|
||||
return { redirect: redirectUrl };
|
||||
}
|
||||
}
|
||||
return onNotFound();
|
||||
}
|
||||
}
|
||||
}
|
||||
function ReactStackHandler(props) {
|
||||
const { path, searchParams } = (0, import_react.useMemo)(() => {
|
||||
const search = window.location.search;
|
||||
const handlerPath = new URL(props.app.urls.handler, window.location.origin).pathname;
|
||||
const relativePath = props.location.startsWith(handlerPath) ? props.location.slice(handlerPath.length).replace(/^\/+/, "") : props.location.replace(/^\/+/, "");
|
||||
return {
|
||||
path: relativePath,
|
||||
searchParams: Object.fromEntries(new URLSearchParams(search).entries())
|
||||
};
|
||||
}, [props.location, props.app.urls.handler]);
|
||||
const redirectIfNotHandler = (name) => {
|
||||
const url = props.app.urls[name];
|
||||
const handlerUrl = props.app.urls.handler;
|
||||
if (url !== handlerUrl && url.startsWith(handlerUrl + "/")) {
|
||||
return;
|
||||
}
|
||||
const urlObj = new URL(url, window.location.origin);
|
||||
for (const [key, value] of Object.entries(searchParams)) {
|
||||
urlObj.searchParams.set(key, value);
|
||||
}
|
||||
window.location.href = (0, import_urls.getRelativePart)(urlObj);
|
||||
};
|
||||
const result = renderComponent({
|
||||
path,
|
||||
searchParams,
|
||||
fullPage: props.fullPage,
|
||||
componentProps: props.componentProps,
|
||||
redirectIfNotHandler,
|
||||
onNotFound: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_message_card.MessageCard,
|
||||
{
|
||||
title: "Page does not exist",
|
||||
fullPage: props.fullPage,
|
||||
primaryButtonText: "Go to Home",
|
||||
primaryAction: () => props.app.redirectToHome(),
|
||||
children: "The page you are looking for could not be found. Please check the URL and try again."
|
||||
}
|
||||
),
|
||||
app: props.app
|
||||
});
|
||||
if (result && "redirect" in result) {
|
||||
window.location.href = result.redirect;
|
||||
return null;
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_iframe_preventer.IframePreventer, { children: result });
|
||||
}
|
||||
var stack_handler_default = ReactStackHandler;
|
||||
function filterUndefinedINU(value) {
|
||||
return value === void 0 ? value : (0, import_objects.filterUndefined)(value);
|
||||
}
|
||||
//# sourceMappingURL=stack-handler.js.map
|
||||
1
package/@stackframe/react/dist/components-page/stack-handler.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/stack-handler.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
92
package/@stackframe/react/dist/components-page/team-creation.js
vendored
Normal file
92
package/@stackframe/react/dist/components-page/team-creation.js
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/team-creation.tsx
|
||||
var team_creation_exports = {};
|
||||
__export(team_creation_exports, {
|
||||
TeamCreation: () => TeamCreation
|
||||
});
|
||||
module.exports = __toCommonJS(team_creation_exports);
|
||||
var import_yup = require("@hookform/resolvers/yup");
|
||||
var import_schema_fields = require("@stackframe/stack-shared/dist/schema-fields");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_react_hook_form = require("react-hook-form");
|
||||
var import__ = require("..");
|
||||
var import_form_warning = require("../components/elements/form-warning");
|
||||
var import_maybe_full_page = require("../components/elements/maybe-full-page");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function TeamCreation(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const schema = (0, import_schema_fields.yupObject)({
|
||||
displayName: (0, import_schema_fields.yupString)().defined().nonEmpty(t("Please enter a team name"))
|
||||
});
|
||||
const { register, handleSubmit, formState: { errors } } = (0, import_react_hook_form.useForm)({
|
||||
resolver: (0, import_yup.yupResolver)(schema)
|
||||
});
|
||||
const app = (0, import__.useStackApp)();
|
||||
const project = app.useProject();
|
||||
const user = (0, import__.useUser)({ or: "redirect" });
|
||||
const [loading, setLoading] = (0, import_react.useState)(false);
|
||||
const navigate = app.useNavigate();
|
||||
if (!project.config.clientTeamCreationEnabled) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.MessageCard, { title: t("Team creation is not enabled") });
|
||||
}
|
||||
const onSubmit = async (data) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const team = await user.createTeam({ displayName: data.displayName });
|
||||
navigate(`${app.urls.handler}/team-settings/${team.id}`);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_maybe_full_page.MaybeFullPage, { fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "stack-scope flex flex-col items-stretch", style: { maxWidth: "380px", flexBasis: "380px", padding: props.fullPage ? "1rem" : 0 }, children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-center mb-6", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { type: "h2", children: t("Create a Team") }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
"form",
|
||||
{
|
||||
className: "flex flex-col items-stretch stack-scope",
|
||||
onSubmit: (e) => (0, import_promises.runAsynchronously)(handleSubmit(onSubmit)(e)),
|
||||
noValidate: true,
|
||||
children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "display-name", className: "mb-1", children: t("Display name") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Input,
|
||||
{
|
||||
id: "display-name",
|
||||
...register("displayName")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.displayName?.message?.toString() }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { type: "submit", className: "mt-6", loading, children: t("Create") })
|
||||
]
|
||||
}
|
||||
)
|
||||
] }) });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TeamCreation
|
||||
});
|
||||
//# sourceMappingURL=team-creation.js.map
|
||||
1
package/@stackframe/react/dist/components-page/team-creation.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/team-creation.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../src/components-page/team-creation.tsx"],"sourcesContent":["'use client';\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\n\nimport { yupResolver } from \"@hookform/resolvers/yup\";\nimport { yupObject, yupString } from \"@stackframe/stack-shared/dist/schema-fields\";\nimport { runAsynchronously } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { Button, Input, Label, Typography } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport * as yup from \"yup\";\nimport { MessageCard, useStackApp, useUser } from \"..\";\nimport { FormWarningText } from \"../components/elements/form-warning\";\nimport { MaybeFullPage } from \"../components/elements/maybe-full-page\";\nimport { useTranslation } from \"../lib/translations\";\n\nexport function TeamCreation(props: { fullPage?: boolean }) {\n const { t } = useTranslation();\n\n const schema = yupObject({\n displayName: yupString().defined().nonEmpty(t('Please enter a team name')),\n });\n\n const { register, handleSubmit, formState: { errors } } = useForm({\n resolver: yupResolver(schema)\n });\n const app = useStackApp();\n const project = app.useProject();\n const user = useUser({ or: 'redirect' });\n const [loading, setLoading] = useState(false);\n const navigate = app.useNavigate();\n\n if (!project.config.clientTeamCreationEnabled) {\n return <MessageCard title={t('Team creation is not enabled')} />;\n }\n\n const onSubmit = async (data: yup.InferType<typeof schema>) => {\n setLoading(true);\n\n try {\n const team = await user.createTeam({ displayName: data.displayName });\n navigate(`${app.urls.handler}/team-settings/${team.id}`);\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <MaybeFullPage fullPage={!!props.fullPage}>\n <div className='stack-scope flex flex-col items-stretch' style={{ maxWidth: '380px', flexBasis: '380px', padding: props.fullPage ? '1rem' : 0 }}>\n <div className=\"text-center mb-6\">\n <Typography type='h2'>\n {t('Create a Team')}\n </Typography>\n </div>\n <form\n className=\"flex flex-col items-stretch stack-scope\"\n onSubmit={e => runAsynchronously(handleSubmit(onSubmit)(e))}\n noValidate\n >\n <Label htmlFor=\"display-name\" className=\"mb-1\">{t('Display name')}</Label>\n <Input\n id=\"display-name\"\n {...register('displayName')}\n />\n <FormWarningText text={errors.displayName?.message?.toString()} />\n\n <Button type=\"submit\" className=\"mt-6\" loading={loading}>\n {t('Create')}\n </Button>\n </form>\n </div>\n </MaybeFullPage>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,iBAA4B;AAC5B,2BAAqC;AACrC,sBAAkC;AAClC,sBAAiD;AACjD,mBAAyB;AACzB,6BAAwB;AAExB,eAAkD;AAClD,0BAAgC;AAChC,6BAA8B;AAC9B,0BAA+B;AAmBpB;AAjBJ,SAAS,aAAa,OAA+B;AAC1D,QAAM,EAAE,EAAE,QAAI,oCAAe;AAE7B,QAAM,aAAS,gCAAU;AAAA,IACvB,iBAAa,gCAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,0BAA0B,CAAC;AAAA,EAC3E,CAAC;AAED,QAAM,EAAE,UAAU,cAAc,WAAW,EAAE,OAAO,EAAE,QAAI,gCAAQ;AAAA,IAChE,cAAU,wBAAY,MAAM;AAAA,EAC9B,CAAC;AACD,QAAM,UAAM,sBAAY;AACxB,QAAM,UAAU,IAAI,WAAW;AAC/B,QAAM,WAAO,kBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAC5C,QAAM,WAAW,IAAI,YAAY;AAEjC,MAAI,CAAC,QAAQ,OAAO,2BAA2B;AAC7C,WAAO,4CAAC,wBAAY,OAAO,EAAE,8BAA8B,GAAG;AAAA,EAChE;AAEA,QAAM,WAAW,OAAO,SAAuC;AAC7D,eAAW,IAAI;AAEf,QAAI;AACF,YAAM,OAAO,MAAM,KAAK,WAAW,EAAE,aAAa,KAAK,YAAY,CAAC;AACpE,eAAS,GAAG,IAAI,KAAK,OAAO,kBAAkB,KAAK,EAAE,EAAE;AAAA,IACzD,UAAE;AACA,iBAAW,KAAK;AAAA,IAClB;AAAA,EACF;AAEA,SACE,4CAAC,wCAAc,UAAU,CAAC,CAAC,MAAM,UAC/B,uDAAC,SAAI,WAAU,2CAA0C,OAAO,EAAE,UAAU,SAAS,WAAW,SAAS,SAAS,MAAM,WAAW,SAAS,EAAE,GAC5I;AAAA,gDAAC,SAAI,WAAU,oBACb,sDAAC,8BAAW,MAAK,MACd,YAAE,eAAe,GACpB,GACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,UAAU,WAAK,mCAAkB,aAAa,QAAQ,EAAE,CAAC,CAAC;AAAA,QAC1D,YAAU;AAAA,QAEV;AAAA,sDAAC,yBAAM,SAAQ,gBAAe,WAAU,QAAQ,YAAE,cAAc,GAAE;AAAA,UAClE;AAAA,YAAC;AAAA;AAAA,cACC,IAAG;AAAA,cACF,GAAG,SAAS,aAAa;AAAA;AAAA,UAC5B;AAAA,UACA,4CAAC,uCAAgB,MAAM,OAAO,aAAa,SAAS,SAAS,GAAG;AAAA,UAEhE,4CAAC,0BAAO,MAAK,UAAS,WAAU,QAAO,SACpC,YAAE,QAAQ,GACb;AAAA;AAAA;AAAA,IACF;AAAA,KACF,GACF;AAEJ;","names":[]}
|
||||
144
package/@stackframe/react/dist/components-page/team-invitation.js
vendored
Normal file
144
package/@stackframe/react/dist/components-page/team-invitation.js
vendored
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components-page/team-invitation.tsx
|
||||
var team_invitation_exports = {};
|
||||
__export(team_invitation_exports, {
|
||||
TeamInvitation: () => TeamInvitation
|
||||
});
|
||||
module.exports = __toCommonJS(team_invitation_exports);
|
||||
var import_stack_shared = require("@stackframe/stack-shared");
|
||||
var import_caches = require("@stackframe/stack-shared/dist/utils/caches");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = __toESM(require("react"));
|
||||
var import__ = require("..");
|
||||
var import_predefined_message_card = require("../components/message-cards/predefined-message-card");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
var cachedVerifyInvitation = (0, import_caches.cacheFunction)(async (stackApp, code) => {
|
||||
return await stackApp.verifyTeamInvitationCode(code);
|
||||
});
|
||||
var cachedGetInvitationDetails = (0, import_caches.cacheFunction)(async (stackApp, code) => {
|
||||
return await stackApp.getTeamInvitationDetails(code);
|
||||
});
|
||||
function TeamInvitationInner(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const stackApp = (0, import__.useStackApp)();
|
||||
const [success, setSuccess] = import_react.default.useState(false);
|
||||
const [errorMessage, setErrorMessage] = import_react.default.useState(null);
|
||||
const details = import_react.default.use(cachedGetInvitationDetails(stackApp, props.searchParams.code || ""));
|
||||
if (errorMessage || details.status === "error") {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "unknownError", fullPage: props.fullPage });
|
||||
}
|
||||
if (success) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import__.MessageCard,
|
||||
{
|
||||
title: t("Team invitation"),
|
||||
fullPage: props.fullPage,
|
||||
primaryButtonText: "Go home",
|
||||
primaryAction: () => stackApp.redirectToHome(),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Typography, { children: [
|
||||
"You have successfully joined ",
|
||||
details.data.teamDisplayName
|
||||
] })
|
||||
}
|
||||
);
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import__.MessageCard,
|
||||
{
|
||||
title: t("Team invitation"),
|
||||
fullPage: props.fullPage,
|
||||
primaryButtonText: t("Join"),
|
||||
primaryAction: () => (0, import_promises.runAsynchronouslyWithAlert)(async () => {
|
||||
const result = await stackApp.acceptTeamInvitation(props.searchParams.code || "");
|
||||
if (result.status === "error") {
|
||||
setErrorMessage(result.error.message);
|
||||
} else {
|
||||
setSuccess(true);
|
||||
}
|
||||
}),
|
||||
secondaryButtonText: t("Ignore"),
|
||||
secondaryAction: () => stackApp.redirectToHome(),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Typography, { children: [
|
||||
"You are invited to join ",
|
||||
details.data.teamDisplayName
|
||||
] })
|
||||
}
|
||||
);
|
||||
}
|
||||
function TeamInvitation({ fullPage = false, searchParams }) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import__.useUser)();
|
||||
const stackApp = (0, import__.useStackApp)();
|
||||
const invalidJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.MessageCard, { title: t("Invalid Team Invitation Link"), fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("Please double check if you have the correct team invitation link.") }) });
|
||||
const expiredJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.MessageCard, { title: t("Expired Team Invitation Link"), fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("Your team invitation link has expired. Please request a new team invitation link ") }) });
|
||||
const usedJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.MessageCard, { title: t("Used Team Invitation Link"), fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("This team invitation link has already been used.") }) });
|
||||
const code = searchParams.code;
|
||||
if (!code) {
|
||||
return invalidJsx;
|
||||
}
|
||||
if (!user) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import__.MessageCard,
|
||||
{
|
||||
title: t("Team invitation"),
|
||||
fullPage,
|
||||
primaryButtonText: t("Sign in"),
|
||||
primaryAction: () => stackApp.redirectToSignIn(),
|
||||
secondaryButtonText: t("Cancel"),
|
||||
secondaryAction: () => stackApp.redirectToHome(),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: t("Sign in or create an account to join the team.") })
|
||||
}
|
||||
);
|
||||
}
|
||||
const verificationResult = import_react.default.use(cachedVerifyInvitation(stackApp, searchParams.code || ""));
|
||||
if (verificationResult.status === "error") {
|
||||
const error = verificationResult.error;
|
||||
if (import_stack_shared.KnownErrors.VerificationCodeNotFound.isInstance(error)) {
|
||||
return invalidJsx;
|
||||
} else if (import_stack_shared.KnownErrors.VerificationCodeExpired.isInstance(error)) {
|
||||
return expiredJsx;
|
||||
} else if (import_stack_shared.KnownErrors.VerificationCodeAlreadyUsed.isInstance(error)) {
|
||||
return usedJsx;
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TeamInvitationInner, { fullPage, searchParams });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TeamInvitation
|
||||
});
|
||||
//# sourceMappingURL=team-invitation.js.map
|
||||
1
package/@stackframe/react/dist/components-page/team-invitation.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components-page/team-invitation.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
184
package/@stackframe/react/dist/components/api-key-dialogs.js
vendored
Normal file
184
package/@stackframe/react/dist/components/api-key-dialogs.js
vendored
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components/api-key-dialogs.tsx
|
||||
var api_key_dialogs_exports = {};
|
||||
__export(api_key_dialogs_exports, {
|
||||
CreateApiKeyDialog: () => CreateApiKeyDialog,
|
||||
ShowApiKeyDialog: () => ShowApiKeyDialog,
|
||||
expiresInOptions: () => expiresInOptions,
|
||||
neverInMs: () => neverInMs
|
||||
});
|
||||
module.exports = __toCommonJS(api_key_dialogs_exports);
|
||||
var import_yup = require("@hookform/resolvers/yup");
|
||||
var import_schema_fields = require("@stackframe/stack-shared/dist/schema-fields");
|
||||
var import_errors = require("@stackframe/stack-shared/dist/utils/errors");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_react_hook_form = require("react-hook-form");
|
||||
var import__ = require("..");
|
||||
var import_form_warning = require("../components/elements/form-warning");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
var neverInMs = 1e3 * 60 * 60 * 24 * 365 * 200;
|
||||
var expiresInOptions = {
|
||||
[1e3 * 60 * 60 * 24 * 1]: "1 day",
|
||||
[1e3 * 60 * 60 * 24 * 7]: "7 days",
|
||||
[1e3 * 60 * 60 * 24 * 30]: "30 days",
|
||||
[1e3 * 60 * 60 * 24 * 90]: "90 days",
|
||||
[1e3 * 60 * 60 * 24 * 365]: "1 year",
|
||||
[neverInMs]: "Never"
|
||||
};
|
||||
function CreateApiKeyDialog(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const user = (0, import__.useUser)({ or: "redirect" });
|
||||
const [loading, setLoading] = (0, import_react.useState)(false);
|
||||
const apiKeySchema = (0, import_schema_fields.yupObject)({
|
||||
description: (0, import_schema_fields.yupString)().defined().nonEmpty(t("Description is required")),
|
||||
expiresIn: (0, import_schema_fields.yupString)().defined()
|
||||
});
|
||||
const { register, handleSubmit, formState: { errors }, reset } = (0, import_react_hook_form.useForm)({
|
||||
resolver: (0, import_yup.yupResolver)(apiKeySchema),
|
||||
defaultValues: {
|
||||
description: "",
|
||||
expiresIn: Object.keys(expiresInOptions)[2]
|
||||
// Default to 30 days
|
||||
}
|
||||
});
|
||||
const onSubmit = async (data) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const expiresAt = new Date(Date.now() + parseInt(data.expiresIn));
|
||||
const apiKey = await props.createApiKey({
|
||||
description: data.description,
|
||||
expiresAt
|
||||
});
|
||||
if (props.onKeyCreated) {
|
||||
props.onKeyCreated(apiKey);
|
||||
}
|
||||
reset();
|
||||
props.onOpenChange(false);
|
||||
} catch (error) {
|
||||
(0, import_errors.captureError)("Failed to create API key", { error });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.ActionDialog,
|
||||
{
|
||||
open: props.open,
|
||||
onOpenChange: props.onOpenChange,
|
||||
title: t("Create API Key"),
|
||||
description: t("API keys grant programmatic access to your account."),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
"form",
|
||||
{
|
||||
onSubmit: (e) => {
|
||||
e.preventDefault();
|
||||
(0, import_promises.runAsynchronously)(handleSubmit(onSubmit));
|
||||
},
|
||||
className: "space-y-4",
|
||||
children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "description", children: t("Description") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Input,
|
||||
{
|
||||
id: "description",
|
||||
placeholder: t("e.g. Development, Production, CI/CD"),
|
||||
...register("description")
|
||||
}
|
||||
),
|
||||
errors.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.description.message })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "expiresIn", children: t("Expires In") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
"select",
|
||||
{
|
||||
id: "expiresIn",
|
||||
className: "w-full p-2 border border-input rounded-md bg-background",
|
||||
...register("expiresIn"),
|
||||
children: Object.entries(expiresInOptions).map(([value, label]) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value, children: t(label) }, value))
|
||||
}
|
||||
),
|
||||
errors.expiresIn && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.expiresIn.message })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-end gap-2 pt-4", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
type: "button",
|
||||
variant: "secondary",
|
||||
onClick: () => {
|
||||
reset();
|
||||
props.onOpenChange(false);
|
||||
},
|
||||
children: t("Cancel")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { type: "submit", loading, children: t("Create") })
|
||||
] })
|
||||
]
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
function ShowApiKeyDialog(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.ActionDialog,
|
||||
{
|
||||
open: !!props.apiKey,
|
||||
title: t("API Key"),
|
||||
okButton: { label: t("Close") },
|
||||
onClose: props.onClose,
|
||||
preventClose: true,
|
||||
confirmText: t("I understand that I will not be able to view this key again."),
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Typography, { children: [
|
||||
t("Here is your API key."),
|
||||
" ",
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-bold", children: t("Copy it to a safe place. You will not be able to view it again.") })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.CopyField,
|
||||
{
|
||||
monospace: true,
|
||||
value: props.apiKey?.value ?? "",
|
||||
label: t("Secret API Key")
|
||||
}
|
||||
)
|
||||
] })
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
CreateApiKeyDialog,
|
||||
ShowApiKeyDialog,
|
||||
expiresInOptions,
|
||||
neverInMs
|
||||
});
|
||||
//# sourceMappingURL=api-key-dialogs.js.map
|
||||
1
package/@stackframe/react/dist/components/api-key-dialogs.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components/api-key-dialogs.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
149
package/@stackframe/react/dist/components/api-key-table.js
vendored
Normal file
149
package/@stackframe/react/dist/components/api-key-table.js
vendored
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components/api-key-table.tsx
|
||||
var api_key_table_exports = {};
|
||||
__export(api_key_table_exports, {
|
||||
ApiKeyTable: () => ApiKeyTable
|
||||
});
|
||||
module.exports = __toCommonJS(api_key_table_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function toolbarRender(table) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.SearchToolbarItem, { table, placeholder: "Search table" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.DataTableFacetedFilter,
|
||||
{
|
||||
column: table.getColumn("status"),
|
||||
title: "Status",
|
||||
options: ["valid", "expired", "revoked"].map((provider) => ({
|
||||
value: provider,
|
||||
label: provider
|
||||
}))
|
||||
}
|
||||
)
|
||||
] });
|
||||
}
|
||||
function RevokeDialog(props) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.ActionDialog,
|
||||
{
|
||||
open: props.open,
|
||||
onOpenChange: props.onOpenChange,
|
||||
title: "Revoke API Key",
|
||||
danger: true,
|
||||
cancelButton: true,
|
||||
okButton: { label: "Revoke Key", onClick: async () => {
|
||||
await props.apiKey.revoke();
|
||||
} },
|
||||
confirmText: "I understand this will unlink all the apps using this API key",
|
||||
children: `Are you sure you want to revoke API key *****${props.apiKey.value.lastFour}?`
|
||||
}
|
||||
);
|
||||
}
|
||||
function Actions({ row }) {
|
||||
const [isRevokeModalOpen, setIsRevokeModalOpen] = (0, import_react.useState)(false);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RevokeDialog, { apiKey: row.original, open: isRevokeModalOpen, onOpenChange: setIsRevokeModalOpen }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.ActionCell,
|
||||
{
|
||||
invisible: row.original.status !== "valid",
|
||||
items: [{
|
||||
item: "Revoke",
|
||||
danger: true,
|
||||
onClick: () => setIsRevokeModalOpen(true)
|
||||
}]
|
||||
}
|
||||
)
|
||||
] });
|
||||
}
|
||||
var columns = [
|
||||
{
|
||||
accessorKey: "description",
|
||||
header: ({ column }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.DataTableColumnHeader, { column, columnTitle: "Description" }),
|
||||
cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TextCell, { size: 100, children: row.original.description })
|
||||
},
|
||||
{
|
||||
accessorKey: "status",
|
||||
header: ({ column }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.DataTableColumnHeader, { column, columnTitle: "Status" }),
|
||||
cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.BadgeCell, { badges: [row.original.status] }),
|
||||
filterFn: import_stack_ui.standardFilterFn
|
||||
},
|
||||
{
|
||||
id: "value",
|
||||
accessorFn: (row) => row.value.lastFour,
|
||||
header: ({ column }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.DataTableColumnHeader, { column, columnTitle: "Client Key" }),
|
||||
cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TextCell, { children: [
|
||||
"*******",
|
||||
row.original.value.lastFour
|
||||
] }),
|
||||
enableSorting: false
|
||||
},
|
||||
{
|
||||
accessorKey: "expiresAt",
|
||||
header: ({ column }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.DataTableColumnHeader, { column, columnTitle: "Expires At" }),
|
||||
cell: ({ row }) => {
|
||||
if (row.original.status === "revoked") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TextCell, { children: "-" });
|
||||
return row.original.expiresAt ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.DateCell, { date: row.original.expiresAt, ignoreAfterYears: 50 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TextCell, { children: "Never" });
|
||||
}
|
||||
},
|
||||
{
|
||||
accessorKey: "createdAt",
|
||||
header: ({ column }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.DataTableColumnHeader, { column, columnTitle: "Created At" }),
|
||||
cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.DateCell, { date: row.original.createdAt, ignoreAfterYears: 50 })
|
||||
},
|
||||
{
|
||||
id: "actions",
|
||||
cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Actions, { row })
|
||||
}
|
||||
];
|
||||
function ApiKeyTable(props) {
|
||||
const extendedApiKeys = (0, import_react.useMemo)(() => {
|
||||
const keys = props.apiKeys.map((apiKey) => ({
|
||||
...apiKey,
|
||||
status: { "valid": "valid", "manually-revoked": "revoked", "expired": "expired" }[apiKey.whyInvalid() || "valid"]
|
||||
}));
|
||||
return keys.sort((a, b) => {
|
||||
if (a.status === b.status) {
|
||||
return a.createdAt < b.createdAt ? 1 : -1;
|
||||
}
|
||||
return a.status === "valid" ? -1 : 1;
|
||||
});
|
||||
}, [props.apiKeys]);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.DataTable,
|
||||
{
|
||||
data: extendedApiKeys,
|
||||
columns,
|
||||
toolbarRender,
|
||||
defaultColumnFilters: [],
|
||||
defaultSorting: []
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
ApiKeyTable
|
||||
});
|
||||
//# sourceMappingURL=api-key-table.js.map
|
||||
1
package/@stackframe/react/dist/components/api-key-table.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components/api-key-table.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
103
package/@stackframe/react/dist/components/credential-sign-in.js
vendored
Normal file
103
package/@stackframe/react/dist/components/credential-sign-in.js
vendored
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components/credential-sign-in.tsx
|
||||
var credential_sign_in_exports = {};
|
||||
__export(credential_sign_in_exports, {
|
||||
CredentialSignIn: () => CredentialSignIn
|
||||
});
|
||||
module.exports = __toCommonJS(credential_sign_in_exports);
|
||||
var import_yup = require("@hookform/resolvers/yup");
|
||||
var import_schema_fields = require("@stackframe/stack-shared/dist/schema-fields");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_react_hook_form = require("react-hook-form");
|
||||
var import__ = require("..");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_form_warning = require("./elements/form-warning");
|
||||
var import_link = require("./link");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function CredentialSignIn() {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const schema = (0, import_schema_fields.yupObject)({
|
||||
email: (0, import_schema_fields.strictEmailSchema)(t("Please enter a valid email")).defined().nonEmpty(t("Please enter your email")),
|
||||
password: import_schema_fields.passwordSchema.defined().nonEmpty(t("Please enter your password"))
|
||||
});
|
||||
const { register, handleSubmit, setError, formState: { errors } } = (0, import_react_hook_form.useForm)({
|
||||
resolver: (0, import_yup.yupResolver)(schema)
|
||||
});
|
||||
const app = (0, import__.useStackApp)();
|
||||
const [loading, setLoading] = (0, import_react.useState)(false);
|
||||
const onSubmit = async (data) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { email, password } = data;
|
||||
const result = await app.signInWithCredential({
|
||||
email,
|
||||
password
|
||||
});
|
||||
if (result.status === "error") {
|
||||
setError("email", { type: "manual", message: result.error.message });
|
||||
}
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
"form",
|
||||
{
|
||||
className: "flex flex-col items-stretch stack-scope",
|
||||
onSubmit: (e) => (0, import_promises.runAsynchronouslyWithAlert)(handleSubmit(onSubmit)(e)),
|
||||
noValidate: true,
|
||||
children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "email", className: "mb-1", children: t("Email") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Input,
|
||||
{
|
||||
id: "email",
|
||||
type: "email",
|
||||
autoComplete: "email",
|
||||
...register("email")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.email?.message?.toString() }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "password", className: "mt-4 mb-1", children: t("Password") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.PasswordInput,
|
||||
{
|
||||
id: "password",
|
||||
autoComplete: "current-password",
|
||||
...register("password")
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.password?.message?.toString() }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.StyledLink, { href: app.urls.forgotPassword, className: "mt-1 text-sm", children: t("Forgot password?") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { type: "submit", className: "mt-6", loading, children: t("Sign In") })
|
||||
]
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
CredentialSignIn
|
||||
});
|
||||
//# sourceMappingURL=credential-sign-in.js.map
|
||||
1
package/@stackframe/react/dist/components/credential-sign-in.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components/credential-sign-in.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../src/components/credential-sign-in.tsx"],"sourcesContent":["'use client';\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\n\nimport { yupResolver } from \"@hookform/resolvers/yup\";\nimport { passwordSchema, strictEmailSchema, yupObject } from \"@stackframe/stack-shared/dist/schema-fields\";\nimport { runAsynchronouslyWithAlert } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { Button, Input, Label, PasswordInput } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport * as yup from \"yup\";\nimport { useStackApp } from \"..\";\nimport { useTranslation } from \"../lib/translations\";\nimport { FormWarningText } from \"./elements/form-warning\";\nimport { StyledLink } from \"./link\";\n\nexport function CredentialSignIn() {\n const { t } = useTranslation();\n\n const schema = yupObject({\n email: strictEmailSchema(t('Please enter a valid email')).defined().nonEmpty(t('Please enter your email')),\n password: passwordSchema.defined().nonEmpty(t('Please enter your password'))\n });\n\n const { register, handleSubmit, setError, formState: { errors } } = useForm({\n resolver: yupResolver(schema)\n });\n const app = useStackApp();\n const [loading, setLoading] = useState(false);\n\n const onSubmit = async (data: yup.InferType<typeof schema>) => {\n setLoading(true);\n\n try {\n const { email, password } = data;\n const result = await app.signInWithCredential({\n email,\n password,\n });\n if (result.status === 'error') {\n setError('email', { type: 'manual', message: result.error.message });\n }\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <form\n className=\"flex flex-col items-stretch stack-scope\"\n onSubmit={e => runAsynchronouslyWithAlert(handleSubmit(onSubmit)(e))}\n noValidate\n >\n <Label htmlFor=\"email\" className=\"mb-1\">{t('Email')}</Label>\n <Input\n id=\"email\"\n type=\"email\"\n autoComplete=\"email\"\n {...register('email')}\n />\n <FormWarningText text={errors.email?.message?.toString()} />\n\n <Label htmlFor=\"password\" className=\"mt-4 mb-1\">{t('Password')}</Label>\n <PasswordInput\n id=\"password\"\n autoComplete=\"current-password\"\n {...register('password')}\n />\n <FormWarningText text={errors.password?.message?.toString()} />\n\n <StyledLink href={app.urls.forgotPassword} className=\"mt-1 text-sm\">\n {t('Forgot password?')}\n </StyledLink>\n\n <Button type=\"submit\" className=\"mt-6\" loading={loading}>\n {t('Sign In')}\n </Button>\n </form>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,iBAA4B;AAC5B,2BAA6D;AAC7D,sBAA2C;AAC3C,sBAAoD;AACpD,mBAAyB;AACzB,6BAAwB;AAExB,eAA4B;AAC5B,0BAA+B;AAC/B,0BAAgC;AAChC,kBAA2B;AAkCvB;AAhCG,SAAS,mBAAmB;AACjC,QAAM,EAAE,EAAE,QAAI,oCAAe;AAE7B,QAAM,aAAS,gCAAU;AAAA,IACvB,WAAO,wCAAkB,EAAE,4BAA4B,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,yBAAyB,CAAC;AAAA,IACzG,UAAU,oCAAe,QAAQ,EAAE,SAAS,EAAE,4BAA4B,CAAC;AAAA,EAC7E,CAAC;AAED,QAAM,EAAE,UAAU,cAAc,UAAU,WAAW,EAAE,OAAO,EAAE,QAAI,gCAAQ;AAAA,IAC1E,cAAU,wBAAY,MAAM;AAAA,EAC9B,CAAC;AACD,QAAM,UAAM,sBAAY;AACxB,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAE5C,QAAM,WAAW,OAAO,SAAuC;AAC7D,eAAW,IAAI;AAEf,QAAI;AACF,YAAM,EAAE,OAAO,SAAS,IAAI;AAC5B,YAAM,SAAS,MAAM,IAAI,qBAAqB;AAAA,QAC5C;AAAA,QACA;AAAA,MACF,CAAC;AACD,UAAI,OAAO,WAAW,SAAS;AAC7B,iBAAS,SAAS,EAAE,MAAM,UAAU,SAAS,OAAO,MAAM,QAAQ,CAAC;AAAA,MACrE;AAAA,IACF,UAAE;AACA,iBAAW,KAAK;AAAA,IAClB;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,UAAU,WAAK,4CAA2B,aAAa,QAAQ,EAAE,CAAC,CAAC;AAAA,MACnE,YAAU;AAAA,MAEV;AAAA,oDAAC,yBAAM,SAAQ,SAAQ,WAAU,QAAQ,YAAE,OAAO,GAAE;AAAA,QACpD;AAAA,UAAC;AAAA;AAAA,YACC,IAAG;AAAA,YACH,MAAK;AAAA,YACL,cAAa;AAAA,YACZ,GAAG,SAAS,OAAO;AAAA;AAAA,QACtB;AAAA,QACA,4CAAC,uCAAgB,MAAM,OAAO,OAAO,SAAS,SAAS,GAAG;AAAA,QAE1D,4CAAC,yBAAM,SAAQ,YAAW,WAAU,aAAa,YAAE,UAAU,GAAE;AAAA,QAC/D;AAAA,UAAC;AAAA;AAAA,YACC,IAAG;AAAA,YACH,cAAa;AAAA,YACZ,GAAG,SAAS,UAAU;AAAA;AAAA,QACzB;AAAA,QACA,4CAAC,uCAAgB,MAAM,OAAO,UAAU,SAAS,SAAS,GAAG;AAAA,QAE7D,4CAAC,0BAAW,MAAM,IAAI,KAAK,gBAAgB,WAAU,gBAClD,YAAE,kBAAkB,GACvB;AAAA,QAEA,4CAAC,0BAAO,MAAK,UAAS,WAAU,QAAO,SACpC,YAAE,SAAS,GACd;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
||||
138
package/@stackframe/react/dist/components/credential-sign-up.js
vendored
Normal file
138
package/@stackframe/react/dist/components/credential-sign-up.js
vendored
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components/credential-sign-up.tsx
|
||||
var credential_sign_up_exports = {};
|
||||
__export(credential_sign_up_exports, {
|
||||
CredentialSignUp: () => CredentialSignUp
|
||||
});
|
||||
module.exports = __toCommonJS(credential_sign_up_exports);
|
||||
var import_yup = require("@hookform/resolvers/yup");
|
||||
var import_password = require("@stackframe/stack-shared/dist/helpers/password");
|
||||
var import_schema_fields = require("@stackframe/stack-shared/dist/schema-fields");
|
||||
var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_react = require("react");
|
||||
var import_react_hook_form = require("react-hook-form");
|
||||
var yup = __toESM(require("yup"));
|
||||
var import__ = require("..");
|
||||
var import_translations = require("../lib/translations");
|
||||
var import_form_warning = require("./elements/form-warning");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function CredentialSignUp(props) {
|
||||
const { t } = (0, import_translations.useTranslation)();
|
||||
const schema = (0, import_schema_fields.yupObject)({
|
||||
email: (0, import_schema_fields.strictEmailSchema)(t("Please enter a valid email")).defined().nonEmpty(t("Please enter your email")),
|
||||
password: import_schema_fields.passwordSchema.defined().nonEmpty(t("Please enter your password")).test({
|
||||
name: "is-valid-password",
|
||||
test: (value, ctx) => {
|
||||
const error = (0, import_password.getPasswordError)(value);
|
||||
if (error) {
|
||||
return ctx.createError({ message: error.message });
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}),
|
||||
...!props.noPasswordRepeat && {
|
||||
passwordRepeat: import_schema_fields.passwordSchema.nullable().oneOf([yup.ref("password"), "", null], t("Passwords do not match")).nonEmpty(t("Please repeat your password"))
|
||||
}
|
||||
});
|
||||
const { register, handleSubmit, setError, formState: { errors }, clearErrors } = (0, import_react_hook_form.useForm)({
|
||||
resolver: (0, import_yup.yupResolver)(schema)
|
||||
});
|
||||
const app = (0, import__.useStackApp)();
|
||||
const [loading, setLoading] = (0, import_react.useState)(false);
|
||||
const onSubmit = async (data) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { email, password } = data;
|
||||
const result = await app.signUpWithCredential({ email, password });
|
||||
if (result.status === "error") {
|
||||
setError("email", { type: "manual", message: result.error.message });
|
||||
}
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
const registerPassword = register("password");
|
||||
const registerPasswordRepeat = register("passwordRepeat");
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
"form",
|
||||
{
|
||||
className: "flex flex-col items-stretch stack-scope",
|
||||
onSubmit: (e) => (0, import_promises.runAsynchronouslyWithAlert)(handleSubmit(onSubmit)(e)),
|
||||
noValidate: true,
|
||||
children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "email", className: "mb-1", children: t("Email") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Input, { id: "email", type: "email", autoComplete: "email", ...register("email") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.email?.message?.toString() }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "password", className: "mt-4 mb-1", children: t("Password") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.PasswordInput,
|
||||
{
|
||||
id: "password",
|
||||
autoComplete: "new-password",
|
||||
...registerPassword,
|
||||
onChange: (e) => {
|
||||
clearErrors("password");
|
||||
clearErrors("passwordRepeat");
|
||||
(0, import_promises.runAsynchronously)(registerPassword.onChange(e));
|
||||
}
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.password?.message?.toString() }),
|
||||
!props.noPasswordRepeat && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Label, { htmlFor: "repeat-password", className: "mt-4 mb-1", children: t("Repeat Password") }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.PasswordInput,
|
||||
{
|
||||
id: "repeat-password",
|
||||
...registerPasswordRepeat,
|
||||
onChange: (e) => {
|
||||
clearErrors("password");
|
||||
clearErrors("passwordRepeat");
|
||||
(0, import_promises.runAsynchronously)(registerPasswordRepeat.onChange(e));
|
||||
}
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.passwordRepeat?.message?.toString() })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { type: "submit", className: "mt-6", loading, children: t("Sign Up") })
|
||||
]
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
CredentialSignUp
|
||||
});
|
||||
//# sourceMappingURL=credential-sign-up.js.map
|
||||
1
package/@stackframe/react/dist/components/credential-sign-up.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components/credential-sign-up.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
39
package/@stackframe/react/dist/components/elements/form-warning.js
vendored
Normal file
39
package/@stackframe/react/dist/components/elements/form-warning.js
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components/elements/form-warning.tsx
|
||||
var form_warning_exports = {};
|
||||
__export(form_warning_exports, {
|
||||
FormWarningText: () => FormWarningText
|
||||
});
|
||||
module.exports = __toCommonJS(form_warning_exports);
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function FormWarningText({ text }) {
|
||||
if (!text) {
|
||||
return null;
|
||||
}
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-red-500 text-sm mt-1", children: text });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
FormWarningText
|
||||
});
|
||||
//# sourceMappingURL=form-warning.js.map
|
||||
1
package/@stackframe/react/dist/components/elements/form-warning.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components/elements/form-warning.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../src/components/elements/form-warning.tsx"],"sourcesContent":["'use client';\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\n\nexport function FormWarningText({ text }: { text?: string }) {\n if (!text) {\n return null;\n }\n return (\n <div className=\"text-red-500 text-sm mt-1\">\n {text}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYI;AALG,SAAS,gBAAgB,EAAE,KAAK,GAAsB;AAC3D,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AACA,SACE,4CAAC,SAAI,WAAU,6BACZ,gBACH;AAEJ;","names":[]}
|
||||
75
package/@stackframe/react/dist/components/elements/maybe-full-page.js
vendored
Normal file
75
package/@stackframe/react/dist/components/elements/maybe-full-page.js
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components/elements/maybe-full-page.tsx
|
||||
var maybe_full_page_exports = {};
|
||||
__export(maybe_full_page_exports, {
|
||||
MaybeFullPage: () => MaybeFullPage
|
||||
});
|
||||
module.exports = __toCommonJS(maybe_full_page_exports);
|
||||
var import_react = require("react");
|
||||
var import_ssr_layout_effect = require("./ssr-layout-effect");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function MaybeFullPage({
|
||||
children,
|
||||
fullPage
|
||||
}) {
|
||||
const uniqueId = (0, import_react.useId)();
|
||||
const id = `stack-full-page-container-${uniqueId}`;
|
||||
const scriptString = `(([id]) => {
|
||||
const el = document.getElementById(id);
|
||||
if (!el) {
|
||||
// component is not full page
|
||||
return;
|
||||
}
|
||||
const offset = el.getBoundingClientRect().top + document.documentElement.scrollTop;
|
||||
el.style.minHeight = \`calc(100vh - \${offset}px)\`;
|
||||
})(${JSON.stringify([id])})`;
|
||||
if (fullPage) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
"div",
|
||||
{
|
||||
suppressHydrationWarning: true,
|
||||
id,
|
||||
style: {
|
||||
minHeight: "100vh",
|
||||
alignSelf: "stretch",
|
||||
flexGrow: 1,
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center"
|
||||
},
|
||||
className: "stack-scope",
|
||||
children
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ssr_layout_effect.SsrScript, { script: scriptString })
|
||||
] });
|
||||
} else {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
MaybeFullPage
|
||||
});
|
||||
//# sourceMappingURL=maybe-full-page.js.map
|
||||
1
package/@stackframe/react/dist/components/elements/maybe-full-page.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components/elements/maybe-full-page.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../src/components/elements/maybe-full-page.tsx"],"sourcesContent":["\"use client\";\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\n\nimport React, { useId } from \"react\";\nimport { SsrScript } from \"./ssr-layout-effect\";\n\nexport function MaybeFullPage({\n children,\n fullPage,\n}: {\n children: React.ReactNode,\n fullPage: boolean,\n size?: number,\n containerClassName?: string,\n}) {\n const uniqueId = useId();\n const id = `stack-full-page-container-${uniqueId}`;\n\n const scriptString = `(([id]) => {\n const el = document.getElementById(id);\n if (!el) {\n // component is not full page\n return;\n }\n const offset = el.getBoundingClientRect().top + document.documentElement.scrollTop;\n el.style.minHeight = \\`calc(100vh - \\${offset}px)\\`;\n })(${JSON.stringify([id])})`;\n\n if (fullPage) {\n return (\n <>\n <div\n suppressHydrationWarning\n id={id}\n style={{\n minHeight: '100vh',\n alignSelf: 'stretch',\n flexGrow: 1,\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n className=\"stack-scope\"\n >\n {children}\n </div>\n <SsrScript script={scriptString} />\n </>\n );\n } else {\n return <>\n {children}\n </>;\n }\n\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,mBAA6B;AAC7B,+BAA0B;AA0BpB;AAxBC,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AACF,GAKG;AACD,QAAM,eAAW,oBAAM;AACvB,QAAM,KAAK,6BAA6B,QAAQ;AAEhD,QAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAQhB,KAAK,UAAU,CAAC,EAAE,CAAC,CAAC;AAEzB,MAAI,UAAU;AACZ,WACE,4EACE;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,0BAAwB;AAAA,UACxB;AAAA,UACA,OAAO;AAAA,YACL,WAAW;AAAA,YACX,WAAW;AAAA,YACX,UAAU;AAAA,YACV,SAAS;AAAA,YACT,gBAAgB;AAAA,YAChB,YAAY;AAAA,UACd;AAAA,UACA,WAAU;AAAA,UAET;AAAA;AAAA,MACH;AAAA,MACA,4CAAC,sCAAU,QAAQ,cAAc;AAAA,OACnC;AAAA,EAEJ,OAAO;AACL,WAAO,2EACJ,UACH;AAAA,EACF;AAEF;","names":[]}
|
||||
41
package/@stackframe/react/dist/components/elements/separator-with-text.js
vendored
Normal file
41
package/@stackframe/react/dist/components/elements/separator-with-text.js
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components/elements/separator-with-text.tsx
|
||||
var separator_with_text_exports = {};
|
||||
__export(separator_with_text_exports, {
|
||||
SeparatorWithText: () => SeparatorWithText
|
||||
});
|
||||
module.exports = __toCommonJS(separator_with_text_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function SeparatorWithText({ text }) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-center my-6 stack-scope", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Separator, {}) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mx-2 text-sm text-zinc-500", children: text }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Separator, {}) })
|
||||
] });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
SeparatorWithText
|
||||
});
|
||||
//# sourceMappingURL=separator-with-text.js.map
|
||||
1
package/@stackframe/react/dist/components/elements/separator-with-text.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components/elements/separator-with-text.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../src/components/elements/separator-with-text.tsx"],"sourcesContent":["'use client';\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\n\nimport { Separator } from \"@stackframe/stack-ui\";\n\nexport function SeparatorWithText({ text }: { text: string }) {\n return (\n <div className=\"flex items-center justify-center my-6 stack-scope\">\n <div className=\"flex-1\">\n <Separator />\n </div>\n <div className=\"mx-2 text-sm text-zinc-500\">{text}</div>\n <div className=\"flex-1\">\n <Separator />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,sBAA0B;AAItB;AAFG,SAAS,kBAAkB,EAAE,KAAK,GAAqB;AAC5D,SACE,6CAAC,SAAI,WAAU,qDACb;AAAA,gDAAC,SAAI,WAAU,UACb,sDAAC,6BAAU,GACb;AAAA,IACA,4CAAC,SAAI,WAAU,8BAA8B,gBAAK;AAAA,IAClD,4CAAC,SAAI,WAAU,UACb,sDAAC,6BAAU,GACb;AAAA,KACF;AAEJ;","names":[]}
|
||||
119
package/@stackframe/react/dist/components/elements/sidebar-layout.js
vendored
Normal file
119
package/@stackframe/react/dist/components/elements/sidebar-layout.js
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components/elements/sidebar-layout.tsx
|
||||
var sidebar_layout_exports = {};
|
||||
__export(sidebar_layout_exports, {
|
||||
SidebarLayout: () => SidebarLayout
|
||||
});
|
||||
module.exports = __toCommonJS(sidebar_layout_exports);
|
||||
var import_use_hash = require("@stackframe/stack-shared/dist/hooks/use-hash");
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_lucide_react = require("lucide-react");
|
||||
var import__ = require("../..");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function SidebarLayout(props) {
|
||||
const hash = (0, import_use_hash.useHash)();
|
||||
const selectedIndex = props.items.findIndex((item) => item.id && item.id === hash);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_stack_ui.cn)("hidden sm:flex stack-scope h-full", props.className), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DesktopLayout, { items: props.items, title: props.title, selectedIndex }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_stack_ui.cn)("sm:hidden stack-scope h-full", props.className), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MobileLayout, { items: props.items, title: props.title, selectedIndex }) })
|
||||
] });
|
||||
}
|
||||
function Items(props) {
|
||||
const app = (0, import__.useStackApp)();
|
||||
const navigate = app.useNavigate();
|
||||
const activeItemIndex = props.selectedIndex === -1 ? 0 : props.selectedIndex;
|
||||
return props.items.map((item, index) => item.type === "item" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "ghost",
|
||||
size: "sm",
|
||||
className: (0, import_stack_ui.cn)(
|
||||
activeItemIndex === index && "sm:bg-muted",
|
||||
"justify-start text-md text-zinc-800 dark:text-zinc-300 px-2 text-left"
|
||||
),
|
||||
onClick: () => {
|
||||
if (item.id) {
|
||||
navigate("#" + item.id);
|
||||
}
|
||||
},
|
||||
children: [
|
||||
item.icon,
|
||||
item.title
|
||||
]
|
||||
},
|
||||
index
|
||||
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: item.title }, index));
|
||||
}
|
||||
function DesktopLayout(props) {
|
||||
const selectedItem = props.items[props.selectedIndex === -1 ? 0 : props.selectedIndex];
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "stack-scope flex w-full h-full max-w-full relative", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex max-w-[200px] min-w-[200px] border-r flex-col items-stretch gap-2 p-2 overflow-y-auto", children: [
|
||||
props.title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mb-2 ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { type: "h2", className: "text-lg font-semibold text-zinc-800 dark:text-zinc-300", children: props.title }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Items, { items: props.items, selectedIndex: props.selectedIndex })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex-1 w-0 flex justify-center gap-4 py-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col max-w-[800px] w-[800px]", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mt-4 mb-6", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { type: "h4", className: "font-semibold", children: selectedItem.title }),
|
||||
selectedItem.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", type: "label", children: selectedItem.description })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex-1", children: selectedItem.content })
|
||||
] }) })
|
||||
] });
|
||||
}
|
||||
function MobileLayout(props) {
|
||||
const selectedItem = props.items[props.selectedIndex];
|
||||
const app = (0, import__.useStackApp)();
|
||||
const navigate = app.useNavigate();
|
||||
if (props.selectedIndex === -1) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-2 p-2", children: [
|
||||
props.title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mb-2 ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { type: "h2", className: "text-lg font-semibold text-zinc-800 dark:text-zinc-300", children: props.title }) }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Items, { items: props.items, selectedIndex: props.selectedIndex })
|
||||
] });
|
||||
} else {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex-1 flex flex-col gap-4 py-2 px-4", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-between", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { type: "h4", className: "font-semibold", children: selectedItem.title }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
import_stack_ui.Button,
|
||||
{
|
||||
variant: "ghost",
|
||||
size: "icon",
|
||||
onClick: () => {
|
||||
navigate("#");
|
||||
},
|
||||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XIcon, { className: "h-5 w-5" })
|
||||
}
|
||||
)
|
||||
] }),
|
||||
selectedItem.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", type: "label", children: selectedItem.description })
|
||||
] }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex-1", children: selectedItem.content })
|
||||
] });
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
SidebarLayout
|
||||
});
|
||||
//# sourceMappingURL=sidebar-layout.js.map
|
||||
1
package/@stackframe/react/dist/components/elements/sidebar-layout.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components/elements/sidebar-layout.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
47
package/@stackframe/react/dist/components/elements/ssr-layout-effect.js
vendored
Normal file
47
package/@stackframe/react/dist/components/elements/ssr-layout-effect.js
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
"use client";
|
||||
"use strict";
|
||||
"use client";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components/elements/ssr-layout-effect.tsx
|
||||
var ssr_layout_effect_exports = {};
|
||||
__export(ssr_layout_effect_exports, {
|
||||
SsrScript: () => SsrScript
|
||||
});
|
||||
module.exports = __toCommonJS(ssr_layout_effect_exports);
|
||||
var import_react = require("react");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
function SsrScript(props) {
|
||||
(0, import_react.useLayoutEffect)(() => {
|
||||
(0, eval)(props.script);
|
||||
}, []);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
||||
"script",
|
||||
{
|
||||
suppressHydrationWarning: true,
|
||||
nonce: props.nonce,
|
||||
dangerouslySetInnerHTML: { __html: props.script }
|
||||
}
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
SsrScript
|
||||
});
|
||||
//# sourceMappingURL=ssr-layout-effect.js.map
|
||||
1
package/@stackframe/react/dist/components/elements/ssr-layout-effect.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components/elements/ssr-layout-effect.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../src/components/elements/ssr-layout-effect.tsx"],"sourcesContent":["\"use client\";\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { useLayoutEffect } from \"react\";\n\nexport function SsrScript(props: { script: string, nonce?: string }) {\n useLayoutEffect(() => {\n // TODO fix workaround: React has a bug where it doesn't run the script on the first CSR render if SSR has been skipped due to suspense\n // As a workaround, we run the script in the <script> tag again after the first render\n // Note that we do an indirect eval as described here: https://esbuild.github.io/content-types/#direct-eval\n (0, eval)(props.script);\n }, []);\n\n return (\n <script\n suppressHydrationWarning // the transpiler is setup differently for client/server targets, so if `script` was generated with Function.toString they will differ\n nonce={props.nonce}\n dangerouslySetInnerHTML={{ __html: props.script }}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,mBAAgC;AAW5B;AATG,SAAS,UAAU,OAA2C;AACnE,oCAAgB,MAAM;AAIpB,KAAC,GAAG,MAAM,MAAM,MAAM;AAAA,EACxB,GAAG,CAAC,CAAC;AAEL,SACE;AAAA,IAAC;AAAA;AAAA,MACC,0BAAwB;AAAA,MACxB,OAAO,MAAM;AAAA,MACb,yBAAyB,EAAE,QAAQ,MAAM,OAAO;AAAA;AAAA,EAClD;AAEJ;","names":[]}
|
||||
41
package/@stackframe/react/dist/components/elements/user-avatar.js
vendored
Normal file
41
package/@stackframe/react/dist/components/elements/user-avatar.js
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/components/elements/user-avatar.tsx
|
||||
var user_avatar_exports = {};
|
||||
__export(user_avatar_exports, {
|
||||
UserAvatar: () => UserAvatar
|
||||
});
|
||||
module.exports = __toCommonJS(user_avatar_exports);
|
||||
var import_stack_ui = require("@stackframe/stack-ui");
|
||||
var import_lucide_react = require("lucide-react");
|
||||
var import_jsx_runtime = require("react/jsx-runtime");
|
||||
var defaultSize = 34;
|
||||
function UserAvatar(props) {
|
||||
const user = props.user;
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Avatar, { style: { height: props.size || defaultSize, width: props.size || defaultSize }, className: props.border ? "border" : "", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.AvatarImage, { src: user?.profileImageUrl || "" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.AvatarFallback, { children: user ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "font-medium", style: { fontSize: (props.size || defaultSize) * 0.4 }, children: (user.displayName || user.primaryEmail)?.slice(0, 2).toUpperCase() }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.UserRound, { className: "text-zinc-500", size: (props.size || defaultSize) * 0.6 }) })
|
||||
] });
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
UserAvatar
|
||||
});
|
||||
//# sourceMappingURL=user-avatar.js.map
|
||||
1
package/@stackframe/react/dist/components/elements/user-avatar.js.map
vendored
Normal file
1
package/@stackframe/react/dist/components/elements/user-avatar.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../src/components/elements/user-avatar.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Avatar, AvatarFallback, AvatarImage } from \"@stackframe/stack-ui\";\nimport { UserRound } from \"lucide-react\";\n\nconst defaultSize = 34;\n\nexport function UserAvatar(props: {\n size?: number,\n user?: {\n profileImageUrl?: string | null,\n displayName?: string | null,\n primaryEmail?: string | null,\n } | null,\n border?: boolean,\n}) {\n const user = props.user;\n return (\n <Avatar style={{ height: props.size || defaultSize, width: props.size || defaultSize }} className={props.border ? 'border' : ''}>\n <AvatarImage src={user?.profileImageUrl || ''} />\n <AvatarFallback>\n {user ?\n <div className='font-medium' style={{ fontSize: (props.size || defaultSize) * 0.4 }}>\n {(user.displayName || user.primaryEmail)?.slice(0, 2).toUpperCase()}\n </div> :\n <UserRound className=\"text-zinc-500\" size={(props.size || defaultSize) * 0.6} />}\n </AvatarFallback>\n </Avatar>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAAoD;AACpD,0BAA0B;AAetB;AAbJ,IAAM,cAAc;AAEb,SAAS,WAAW,OAQxB;AACD,QAAM,OAAO,MAAM;AACnB,SACE,6CAAC,0BAAO,OAAO,EAAE,QAAQ,MAAM,QAAQ,aAAa,OAAO,MAAM,QAAQ,YAAY,GAAG,WAAW,MAAM,SAAS,WAAW,IAC3H;AAAA,gDAAC,+BAAY,KAAK,MAAM,mBAAmB,IAAI;AAAA,IAC/C,4CAAC,kCACE,iBACC,4CAAC,SAAI,WAAU,eAAc,OAAO,EAAE,WAAW,MAAM,QAAQ,eAAe,IAAI,GAC9E,gBAAK,eAAe,KAAK,eAAe,MAAM,GAAG,CAAC,EAAE,YAAY,GACpE,IACA,4CAAC,iCAAU,WAAU,iBAAgB,OAAO,MAAM,QAAQ,eAAe,KAAK,GAClF;AAAA,KACF;AAEJ;","names":[]}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue