@stackframe/stack 2.5.30 → 2.5.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/components-page/account-settings.d.mts +8 -1
- package/dist/components-page/account-settings.d.ts +8 -1
- package/dist/components-page/account-settings.js +9 -2
- package/dist/components-page/account-settings.js.map +1 -1
- package/dist/components-page/auth-page.d.mts +2 -1
- package/dist/components-page/auth-page.d.ts +2 -1
- package/dist/components-page/auth-page.js +25 -29
- package/dist/components-page/auth-page.js.map +1 -1
- package/dist/components-page/email-verification.d.mts +1 -1
- package/dist/components-page/email-verification.d.ts +1 -1
- package/dist/components-page/email-verification.js +6 -11
- package/dist/components-page/email-verification.js.map +1 -1
- package/dist/components-page/error-page.d.mts +1 -1
- package/dist/components-page/error-page.d.ts +1 -1
- package/dist/components-page/error-page.js +8 -8
- package/dist/components-page/error-page.js.map +1 -1
- package/dist/components-page/forgot-password.d.mts +1 -1
- package/dist/components-page/forgot-password.d.ts +1 -1
- package/dist/components-page/forgot-password.js +5 -5
- package/dist/components-page/forgot-password.js.map +1 -1
- package/dist/components-page/magic-link-callback.d.mts +1 -1
- package/dist/components-page/magic-link-callback.d.ts +1 -1
- package/dist/components-page/magic-link-callback.js +7 -12
- package/dist/components-page/magic-link-callback.js.map +1 -1
- package/dist/components-page/password-reset.d.mts +1 -1
- package/dist/components-page/password-reset.d.ts +1 -1
- package/dist/components-page/password-reset.js +6 -6
- package/dist/components-page/password-reset.js.map +1 -1
- package/dist/components-page/sign-in.d.mts +3 -1
- package/dist/components-page/sign-in.d.ts +3 -1
- package/dist/components-page/sign-in.js +2 -2
- package/dist/components-page/sign-in.js.map +1 -1
- package/dist/components-page/sign-out.js +1 -1
- package/dist/components-page/sign-out.js.map +1 -1
- package/dist/components-page/sign-up.d.mts +3 -1
- package/dist/components-page/sign-up.d.ts +3 -1
- package/dist/components-page/sign-up.js +2 -2
- package/dist/components-page/sign-up.js.map +1 -1
- package/dist/components-page/stack-handler.d.mts +30 -2
- package/dist/components-page/stack-handler.d.ts +30 -2
- package/dist/components-page/stack-handler.js +96 -28
- package/dist/components-page/stack-handler.js.map +1 -1
- package/dist/components-page/team-creation.js +3 -4
- package/dist/components-page/team-creation.js.map +1 -1
- package/dist/esm/components-page/account-settings.js +9 -2
- package/dist/esm/components-page/account-settings.js.map +1 -1
- package/dist/esm/components-page/auth-page.js +25 -29
- package/dist/esm/components-page/auth-page.js.map +1 -1
- package/dist/esm/components-page/email-verification.js +6 -11
- package/dist/esm/components-page/email-verification.js.map +1 -1
- package/dist/esm/components-page/error-page.js +8 -8
- package/dist/esm/components-page/error-page.js.map +1 -1
- package/dist/esm/components-page/forgot-password.js +5 -5
- package/dist/esm/components-page/forgot-password.js.map +1 -1
- package/dist/esm/components-page/magic-link-callback.js +7 -12
- package/dist/esm/components-page/magic-link-callback.js.map +1 -1
- package/dist/esm/components-page/password-reset.js +6 -6
- package/dist/esm/components-page/password-reset.js.map +1 -1
- package/dist/esm/components-page/sign-in.js +2 -2
- package/dist/esm/components-page/sign-in.js.map +1 -1
- package/dist/esm/components-page/sign-out.js +1 -1
- package/dist/esm/components-page/sign-out.js.map +1 -1
- package/dist/esm/components-page/sign-up.js +2 -2
- package/dist/esm/components-page/sign-up.js.map +1 -1
- package/dist/esm/components-page/stack-handler.js +97 -29
- package/dist/esm/components-page/stack-handler.js.map +1 -1
- package/dist/esm/components-page/team-creation.js +3 -4
- package/dist/esm/components-page/team-creation.js.map +1 -1
- package/dist/esm/lib/stack-app.js +1 -1
- package/dist/esm/utils/browser-script.js +10 -2
- package/dist/esm/utils/browser-script.js.map +1 -1
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/lib/stack-app.js +1 -1
- package/dist/utils/browser-script.js +10 -2
- package/dist/utils/browser-script.js.map +1 -1
- package/package.json +4 -4
|
@@ -79,18 +79,18 @@ function ForgotPasswordForm({ onSent }) {
|
|
|
79
79
|
}
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
|
-
function ForgotPassword(
|
|
82
|
+
function ForgotPassword(props) {
|
|
83
83
|
const stackApp = (0, import__.useStackApp)();
|
|
84
84
|
const user = (0, import__.useUser)();
|
|
85
85
|
const [sent, setSent] = (0, import_react.useState)(false);
|
|
86
86
|
if (user) {
|
|
87
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "signedIn", fullPage });
|
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "signedIn", fullPage: !!props.fullPage });
|
|
88
88
|
}
|
|
89
89
|
if (sent) {
|
|
90
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "emailSent", fullPage });
|
|
90
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "emailSent", fullPage: !!props.fullPage });
|
|
91
91
|
}
|
|
92
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_maybe_full_page.MaybeFullPage, { fullPage, children: [
|
|
93
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-center mb-6 stack-scope", style: { width: "380px", padding: fullPage ? "1rem" : 0 }, children: [
|
|
92
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_maybe_full_page.MaybeFullPage, { fullPage: !!props.fullPage, children: [
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-center mb-6 stack-scope", style: { width: "380px", padding: props.fullPage ? "1rem" : 0 }, children: [
|
|
94
94
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { type: "h2", children: "Reset Your Password" }),
|
|
95
95
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Typography, { children: [
|
|
96
96
|
"Don't need to reset? ",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components-page/forgot-password.tsx"],"sourcesContent":["'use client';\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, Label, StyledLink, Typography } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport * as yup from \"yup\";\nimport { useStackApp, useUser } from \"..\";\nimport { FormWarningText } from \"../components/elements/form-warning\";\nimport { MaybeFullPage } from \"../components/elements/maybe-full-page\";\nimport { PredefinedMessageCard } from \"../components/message-cards/predefined-message-card\";\n\nconst schema = yupObject({\n email: yupString().email('Please enter a valid email').required('Please enter your email')\n});\n\nexport function ForgotPasswordForm({ onSent }: { onSent?: () => void }) {\n const { register, handleSubmit, formState: { errors }, clearErrors } = useForm({\n resolver: yupResolver(schema)\n });\n const stackApp = useStackApp();\n const [loading, setLoading] = useState(false);\n\n const onSubmit = async (data: yup.InferType<typeof schema>) => {\n setLoading(true);\n try {\n const { email } = data;\n await stackApp.sendForgotPasswordEmail(email);\n onSent?.();\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\">Your Email</Label>\n <Input\n id=\"email\"\n type=\"email\"\n {...register('email')}\n onChange={() => clearErrors('email')}\n />\n <FormWarningText text={errors.email?.message?.toString()} />\n\n <Button type=\"submit\" className=\"mt-6\" loading={loading}>\n Send Email\n </Button>\n </form>\n );\n}\n\n\nexport function ForgotPassword(
|
|
1
|
+
{"version":3,"sources":["../../src/components-page/forgot-password.tsx"],"sourcesContent":["'use client';\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, Label, StyledLink, Typography } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport * as yup from \"yup\";\nimport { useStackApp, useUser } from \"..\";\nimport { FormWarningText } from \"../components/elements/form-warning\";\nimport { MaybeFullPage } from \"../components/elements/maybe-full-page\";\nimport { PredefinedMessageCard } from \"../components/message-cards/predefined-message-card\";\n\nconst schema = yupObject({\n email: yupString().email('Please enter a valid email').required('Please enter your email')\n});\n\nexport function ForgotPasswordForm({ onSent }: { onSent?: () => void }) {\n const { register, handleSubmit, formState: { errors }, clearErrors } = useForm({\n resolver: yupResolver(schema)\n });\n const stackApp = useStackApp();\n const [loading, setLoading] = useState(false);\n\n const onSubmit = async (data: yup.InferType<typeof schema>) => {\n setLoading(true);\n try {\n const { email } = data;\n await stackApp.sendForgotPasswordEmail(email);\n onSent?.();\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\">Your Email</Label>\n <Input\n id=\"email\"\n type=\"email\"\n {...register('email')}\n onChange={() => clearErrors('email')}\n />\n <FormWarningText text={errors.email?.message?.toString()} />\n\n <Button type=\"submit\" className=\"mt-6\" loading={loading}>\n Send Email\n </Button>\n </form>\n );\n}\n\n\nexport function ForgotPassword(props: { fullPage?: boolean }) {\n const stackApp = useStackApp();\n const user = useUser();\n const [sent, setSent] = useState(false);\n\n if (user) {\n return <PredefinedMessageCard type='signedIn' fullPage={!!props.fullPage} />;\n }\n\n if (sent) {\n return <PredefinedMessageCard type='emailSent' fullPage={!!props.fullPage} />;\n }\n\n return (\n <MaybeFullPage fullPage={!!props.fullPage}>\n <div className=\"text-center mb-6 stack-scope\" style={{ width: '380px', padding: props.fullPage ? '1rem' : 0 }}>\n <Typography type='h2'>Reset Your Password</Typography>\n <Typography>\n {\"Don't need to reset? \"}\n <StyledLink href={stackApp.urls['signUp']}>\n Sign in\n </StyledLink>\n </Typography>\n </div>\n <ForgotPasswordForm onSent={() => setSent(true)} />\n </MaybeFullPage>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAA4B;AAC5B,2BAAqC;AACrC,sBAA2C;AAC3C,sBAA6D;AAC7D,mBAAyB;AACzB,6BAAwB;AAExB,eAAqC;AACrC,0BAAgC;AAChC,6BAA8B;AAC9B,qCAAsC;AAyBlC;AAvBJ,IAAM,aAAS,gCAAU;AAAA,EACvB,WAAO,gCAAU,EAAE,MAAM,4BAA4B,EAAE,SAAS,yBAAyB;AAC3F,CAAC;AAEM,SAAS,mBAAmB,EAAE,OAAO,GAA4B;AACtE,QAAM,EAAE,UAAU,cAAc,WAAW,EAAE,OAAO,GAAG,YAAY,QAAI,gCAAQ;AAAA,IAC7E,cAAU,wBAAY,MAAM;AAAA,EAC9B,CAAC;AACD,QAAM,eAAW,sBAAY;AAC7B,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAE5C,QAAM,WAAW,OAAO,SAAuC;AAC7D,eAAW,IAAI;AACf,QAAI;AACF,YAAM,EAAE,MAAM,IAAI;AAClB,YAAM,SAAS,wBAAwB,KAAK;AAC9C,eAAS;AAAA,IACT,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,QAAO,wBAAU;AAAA,QAClD;AAAA,UAAC;AAAA;AAAA,YACC,IAAG;AAAA,YACH,MAAK;AAAA,YACJ,GAAG,SAAS,OAAO;AAAA,YACpB,UAAU,MAAM,YAAY,OAAO;AAAA;AAAA,QACrC;AAAA,QACA,4CAAC,uCAAgB,MAAM,OAAO,OAAO,SAAS,SAAS,GAAG;AAAA,QAE1D,4CAAC,0BAAO,MAAK,UAAS,WAAU,QAAO,SAAkB,wBAEzD;AAAA;AAAA;AAAA,EACF;AAEJ;AAGO,SAAS,eAAe,OAA+B;AAC5D,QAAM,eAAW,sBAAY;AAC7B,QAAM,WAAO,kBAAQ;AACrB,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAS,KAAK;AAEtC,MAAI,MAAM;AACR,WAAO,4CAAC,wDAAsB,MAAK,YAAW,UAAU,CAAC,CAAC,MAAM,UAAU;AAAA,EAC5E;AAEA,MAAI,MAAM;AACR,WAAO,4CAAC,wDAAsB,MAAK,aAAY,UAAU,CAAC,CAAC,MAAM,UAAU;AAAA,EAC7E;AAEA,SACE,6CAAC,wCAAc,UAAU,CAAC,CAAC,MAAM,UAC/B;AAAA,iDAAC,SAAI,WAAU,gCAA+B,OAAO,EAAE,OAAO,SAAS,SAAS,MAAM,WAAW,SAAS,EAAE,GAC1G;AAAA,kDAAC,8BAAW,MAAK,MAAK,iCAAmB;AAAA,MACzC,6CAAC,8BACE;AAAA;AAAA,QACD,4CAAC,8BAAW,MAAM,SAAS,KAAK,QAAQ,GAAG,qBAE3C;AAAA,SACF;AAAA,OACF;AAAA,IACA,4CAAC,sBAAmB,QAAQ,MAAM,QAAQ,IAAI,GAAG;AAAA,KACnD;AAEJ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
declare function MagicLinkCallback(
|
|
3
|
+
declare function MagicLinkCallback(props: {
|
|
4
4
|
searchParams?: Record<string, string>;
|
|
5
5
|
fullPage?: boolean;
|
|
6
6
|
}): react_jsx_runtime.JSX.Element | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
declare function MagicLinkCallback(
|
|
3
|
+
declare function MagicLinkCallback(props: {
|
|
4
4
|
searchParams?: Record<string, string>;
|
|
5
5
|
fullPage?: boolean;
|
|
6
6
|
}): react_jsx_runtime.JSX.Element | undefined;
|
|
@@ -46,24 +46,19 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
46
46
|
var cacheSignInWithMagicLink = (0, import_caches.cacheFunction)(async (stackApp, code) => {
|
|
47
47
|
return await stackApp.signInWithMagicLink(code);
|
|
48
48
|
});
|
|
49
|
-
function MagicLinkCallback({
|
|
50
|
-
searchParams: {
|
|
51
|
-
code = ""
|
|
52
|
-
} = {},
|
|
53
|
-
fullPage = false
|
|
54
|
-
}) {
|
|
49
|
+
function MagicLinkCallback(props) {
|
|
55
50
|
const stackApp = (0, import__.useStackApp)();
|
|
56
51
|
const user = (0, import__.useUser)();
|
|
57
52
|
if (user) {
|
|
58
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "signedIn", fullPage });
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "signedIn", fullPage: !!props.fullPage });
|
|
59
54
|
}
|
|
60
|
-
const invalidJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: "Invalid Magic Link", fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Please check if you have the correct link. If you continue to have issues, please contact support." }) });
|
|
61
|
-
const expiredJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: "Expired Magic Link", fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Your magic link has expired. Please request a new magic link if you need to sign-in." }) });
|
|
62
|
-
const alreadyUsedJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: "Magic Link Already Used", fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "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." }) });
|
|
63
|
-
if (!code) {
|
|
55
|
+
const invalidJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: "Invalid Magic Link", fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Please check if you have the correct link. If you continue to have issues, please contact support." }) });
|
|
56
|
+
const expiredJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: "Expired Magic Link", fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Your magic link has expired. Please request a new magic link if you need to sign-in." }) });
|
|
57
|
+
const alreadyUsedJsx = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: "Magic Link Already Used", fullPage: !!props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "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." }) });
|
|
58
|
+
if (!props.searchParams?.code) {
|
|
64
59
|
return invalidJsx;
|
|
65
60
|
}
|
|
66
|
-
const error = import_react.default.use(cacheSignInWithMagicLink(stackApp, code));
|
|
61
|
+
const error = import_react.default.use(cacheSignInWithMagicLink(stackApp, props.searchParams.code));
|
|
67
62
|
if (error instanceof import_stack_shared.KnownErrors.VerificationCodeNotFound) {
|
|
68
63
|
return invalidJsx;
|
|
69
64
|
} else if (error instanceof import_stack_shared.KnownErrors.VerificationCodeExpired) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components-page/magic-link-callback.tsx"],"sourcesContent":["'use client';\n\nimport React from \"react\";\nimport { StackClientApp, useStackApp, useUser } from \"..\";\nimport { MessageCard } from \"../components/message-cards/message-card\";\nimport { PredefinedMessageCard } from \"../components/message-cards/predefined-message-card\";\nimport { KnownErrors } from \"@stackframe/stack-shared\";\nimport { neverResolve } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { cacheFunction } from \"@stackframe/stack-shared/dist/utils/caches\";\n\nconst cacheSignInWithMagicLink = cacheFunction(async (stackApp: StackClientApp<true>, code: string) => {\n return await stackApp.signInWithMagicLink(code);\n});\n\nexport function MagicLinkCallback(
|
|
1
|
+
{"version":3,"sources":["../../src/components-page/magic-link-callback.tsx"],"sourcesContent":["'use client';\n\nimport React from \"react\";\nimport { StackClientApp, useStackApp, useUser } from \"..\";\nimport { MessageCard } from \"../components/message-cards/message-card\";\nimport { PredefinedMessageCard } from \"../components/message-cards/predefined-message-card\";\nimport { KnownErrors } from \"@stackframe/stack-shared\";\nimport { neverResolve } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { cacheFunction } from \"@stackframe/stack-shared/dist/utils/caches\";\n\nconst cacheSignInWithMagicLink = cacheFunction(async (stackApp: StackClientApp<true>, code: string) => {\n return await stackApp.signInWithMagicLink(code);\n});\n\nexport function MagicLinkCallback(props: {\n searchParams?: Record<string, string>,\n fullPage?: boolean,\n}) {\n const stackApp = useStackApp();\n const user = useUser();\n\n if (user) {\n return <PredefinedMessageCard type='signedIn' fullPage={!!props.fullPage} />;\n }\n\n const invalidJsx = (\n <MessageCard title=\"Invalid Magic Link\" fullPage={!!props.fullPage}>\n <p>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=\"Expired Magic Link\" fullPage={!!props.fullPage}>\n <p>Your magic link has expired. Please request a new magic link if you need to sign-in.</p>\n </MessageCard>\n );\n\n const alreadyUsedJsx = (\n <MessageCard title=\"Magic Link Already Used\" fullPage={!!props.fullPage}>\n <p>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.</p>\n </MessageCard>\n );\n\n if (!props.searchParams?.code) {\n return invalidJsx;\n }\n\n const error = React.use(cacheSignInWithMagicLink(stackApp, props.searchParams.code));\n\n if (error instanceof KnownErrors.VerificationCodeNotFound) {\n return invalidJsx;\n } else if (error instanceof KnownErrors.VerificationCodeExpired) {\n return expiredJsx;\n } else if (error instanceof KnownErrors.VerificationCodeAlreadyUsed) {\n return alreadyUsedJsx;\n } else if (error) {\n throw error;\n }\n\n React.use(neverResolve());\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAkB;AAClB,eAAqD;AACrD,0BAA4B;AAC5B,qCAAsC;AACtC,0BAA4B;AAC5B,sBAA6B;AAC7B,oBAA8B;AAcnB;AAZX,IAAM,+BAA2B,6BAAc,OAAO,UAAgC,SAAiB;AACrG,SAAO,MAAM,SAAS,oBAAoB,IAAI;AAChD,CAAC;AAEM,SAAS,kBAAkB,OAG/B;AACD,QAAM,eAAW,sBAAY;AAC7B,QAAM,WAAO,kBAAQ;AAErB,MAAI,MAAM;AACR,WAAO,4CAAC,wDAAsB,MAAK,YAAW,UAAU,CAAC,CAAC,MAAM,UAAU;AAAA,EAC5E;AAEA,QAAM,aACJ,4CAAC,mCAAY,OAAM,sBAAqB,UAAU,CAAC,CAAC,MAAM,UACxD,sDAAC,OAAE,gHAAkG,GACvG;AAGF,QAAM,aACJ,4CAAC,mCAAY,OAAM,sBAAqB,UAAU,CAAC,CAAC,MAAM,UACxD,sDAAC,OAAE,kGAAoF,GACzF;AAGF,QAAM,iBACJ,4CAAC,mCAAY,OAAM,2BAA0B,UAAU,CAAC,CAAC,MAAM,UAC7D,sDAAC,OAAE,iJAAmI,GACxI;AAGF,MAAI,CAAC,MAAM,cAAc,MAAM;AAC7B,WAAO;AAAA,EACT;AAEA,QAAM,QAAQ,aAAAA,QAAM,IAAI,yBAAyB,UAAU,MAAM,aAAa,IAAI,CAAC;AAEnF,MAAI,iBAAiB,gCAAY,0BAA0B;AACzD,WAAO;AAAA,EACT,WAAW,iBAAiB,gCAAY,yBAAyB;AAC/D,WAAO;AAAA,EACT,WAAW,iBAAiB,gCAAY,6BAA6B;AACnE,WAAO;AAAA,EACT,WAAW,OAAO;AAChB,UAAM;AAAA,EACR;AAEA,eAAAA,QAAM,QAAI,8BAAa,CAAC;AAC1B;","names":["React"]}
|
|
@@ -66,7 +66,7 @@ var schema = (0, import_schema_fields.yupObject)({
|
|
|
66
66
|
}),
|
|
67
67
|
passwordRepeat: (0, import_schema_fields.yupString)().nullable().oneOf([yup.ref("password"), null], "Passwords do not match").required("Please repeat your password")
|
|
68
68
|
});
|
|
69
|
-
function PasswordResetForm(
|
|
69
|
+
function PasswordResetForm(props) {
|
|
70
70
|
const { register, handleSubmit, formState: { errors }, clearErrors } = (0, import_react_hook_form.useForm)({
|
|
71
71
|
resolver: (0, import_yup.yupResolver)(schema)
|
|
72
72
|
});
|
|
@@ -78,7 +78,7 @@ function PasswordResetForm({ code, fullPage = false }) {
|
|
|
78
78
|
setLoading(true);
|
|
79
79
|
try {
|
|
80
80
|
const { password } = data;
|
|
81
|
-
const errorCode = await stackApp.resetPassword({ password, code });
|
|
81
|
+
const errorCode = await stackApp.resetPassword({ password, code: props.code });
|
|
82
82
|
if (errorCode) {
|
|
83
83
|
setResetError(true);
|
|
84
84
|
return;
|
|
@@ -89,13 +89,13 @@ function PasswordResetForm({ code, fullPage = false }) {
|
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
if (finished) {
|
|
92
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "passwordReset", fullPage });
|
|
92
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_predefined_message_card.PredefinedMessageCard, { type: "passwordReset", fullPage: !!props.fullPage });
|
|
93
93
|
}
|
|
94
94
|
if (resetError) {
|
|
95
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: "Failed to reset password", fullPage, children: "Failed to reset password. Please request a new password reset link" });
|
|
95
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: "Failed to reset password", fullPage: !!props.fullPage, children: "Failed to reset password. Please request a new password reset link" });
|
|
96
96
|
}
|
|
97
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_maybe_full_page.MaybeFullPage, { fullPage, children: [
|
|
98
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-center mb-6", style: { width: "380px", padding: fullPage ? "1rem" : 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { type: "h2", children: "Reset Your Password" }) }),
|
|
97
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_maybe_full_page.MaybeFullPage, { fullPage: !!props.fullPage, children: [
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-center mb-6", style: { width: "380px", padding: props.fullPage ? "1rem" : 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { type: "h2", children: "Reset Your Password" }) }),
|
|
99
99
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
100
100
|
"form",
|
|
101
101
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components-page/password-reset.tsx"],"sourcesContent":["'use client';\n\nimport { yupResolver } from \"@hookform/resolvers/yup\";\nimport { KnownErrors } from \"@stackframe/stack-shared\";\nimport { getPasswordError } from \"@stackframe/stack-shared/dist/helpers/password\";\nimport { yupObject, yupString } from \"@stackframe/stack-shared/dist/schema-fields\";\nimport { cacheFunction } from \"@stackframe/stack-shared/dist/utils/caches\";\nimport { runAsynchronouslyWithAlert } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { Button, Label, PasswordInput, Typography } from \"@stackframe/stack-ui\";\nimport React, { useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport * as yup from \"yup\";\nimport { StackClientApp, useStackApp } from \"..\";\nimport { FormWarningText } from \"../components/elements/form-warning\";\nimport { MaybeFullPage } from \"../components/elements/maybe-full-page\";\nimport { MessageCard } from \"../components/message-cards/message-card\";\nimport { PredefinedMessageCard } from \"../components/message-cards/predefined-message-card\";\n\nconst schema = yupObject({\n password: yupString().required('Please enter your password').test({\n name: 'is-valid-password',\n test: (value, ctx) => {\n const error = getPasswordError(value);\n if (error) {\n return ctx.createError({ message: error.message });\n } else {\n return true;\n }\n }\n }),\n passwordRepeat: yupString().nullable().oneOf([yup.ref('password'), null], 'Passwords do not match').required('Please repeat your password')\n});\n\nexport default function PasswordResetForm(\n
|
|
1
|
+
{"version":3,"sources":["../../src/components-page/password-reset.tsx"],"sourcesContent":["'use client';\n\nimport { yupResolver } from \"@hookform/resolvers/yup\";\nimport { KnownErrors } from \"@stackframe/stack-shared\";\nimport { getPasswordError } from \"@stackframe/stack-shared/dist/helpers/password\";\nimport { yupObject, yupString } from \"@stackframe/stack-shared/dist/schema-fields\";\nimport { cacheFunction } from \"@stackframe/stack-shared/dist/utils/caches\";\nimport { runAsynchronouslyWithAlert } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { Button, Label, PasswordInput, Typography } from \"@stackframe/stack-ui\";\nimport React, { useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport * as yup from \"yup\";\nimport { StackClientApp, useStackApp } from \"..\";\nimport { FormWarningText } from \"../components/elements/form-warning\";\nimport { MaybeFullPage } from \"../components/elements/maybe-full-page\";\nimport { MessageCard } from \"../components/message-cards/message-card\";\nimport { PredefinedMessageCard } from \"../components/message-cards/predefined-message-card\";\n\nconst schema = yupObject({\n password: yupString().required('Please enter your password').test({\n name: 'is-valid-password',\n test: (value, ctx) => {\n const error = getPasswordError(value);\n if (error) {\n return ctx.createError({ message: error.message });\n } else {\n return true;\n }\n }\n }),\n passwordRepeat: yupString().nullable().oneOf([yup.ref('password'), null], 'Passwords do not match').required('Please repeat your password')\n});\n\nexport default function PasswordResetForm(props: {\n code: string,\n fullPage?: boolean,\n}) {\n const { register, handleSubmit, formState: { errors }, clearErrors } = useForm({\n resolver: yupResolver(schema)\n });\n const stackApp = useStackApp();\n const [finished, setFinished] = useState(false);\n const [resetError, setResetError] = useState(false);\n const [loading, setLoading] = useState(false);\n\n const onSubmit = async (data: yup.InferType<typeof schema>) => {\n setLoading(true);\n try {\n const { password } = data;\n const errorCode = await stackApp.resetPassword({ password, code: props.code });\n if (errorCode) {\n setResetError(true);\n return;\n }\n\n setFinished(true);\n } finally {\n setLoading(false);\n }\n };\n\n if (finished) {\n return <PredefinedMessageCard type='passwordReset' fullPage={!!props.fullPage} />;\n }\n\n if (resetError) {\n return (\n <MessageCard title=\"Failed to reset password\" fullPage={!!props.fullPage}>\n Failed to reset password. Please request a new password reset link\n </MessageCard>\n );\n }\n\n return (\n <MaybeFullPage fullPage={!!props.fullPage}>\n <div className=\"text-center mb-6\" style={{ width: '380px', padding: props.fullPage ? '1rem' : 0 }}>\n <Typography type='h2'>Reset Your Password</Typography>\n </div>\n\n <form\n style={{ display: 'flex', flexDirection: 'column', alignItems: 'stretch' }}\n onSubmit={e => runAsynchronouslyWithAlert(handleSubmit(onSubmit)(e))}\n noValidate\n >\n <Label htmlFor=\"password\" className=\"mb-1\">New Password</Label>\n <PasswordInput\n id=\"password\"\n {...register('password')}\n onChange={() => {\n clearErrors('password');\n clearErrors('passwordRepeat');\n }}\n />\n <FormWarningText text={errors.password?.message?.toString()} />\n\n <Label htmlFor=\"repeat-password\" className=\"mt-4 mb-1\">Repeat New Password</Label>\n <PasswordInput\n id=\"repeat-password\"\n {...register('passwordRepeat')}\n onChange={() => {\n clearErrors('password');\n clearErrors('passwordRepeat');\n }}\n />\n <FormWarningText text={errors.passwordRepeat?.message?.toString()} />\n\n <Button type=\"submit\" className=\"mt-6\" loading={loading}>\n Reset Password\n </Button>\n </form>\n </MaybeFullPage>\n );\n}\n\n\nconst cachedVerifyPasswordResetCode = cacheFunction(async (stackApp: StackClientApp<true>, code: string) => {\n return await stackApp.verifyPasswordResetCode(code);\n});\n\nexport function PasswordReset({\n searchParams,\n fullPage = false,\n}: {\n searchParams: Record<string, string>,\n fullPage?: boolean,\n}) {\n const stackApp = useStackApp();\n\n const invalidJsx = (\n <MessageCard title=\"Invalid Password Reset Link\" fullPage={fullPage}>\n <Typography>Please double check if you have the correct password reset link.</Typography>\n </MessageCard>\n );\n\n const expiredJsx = (\n <MessageCard title=\"Expired Password Reset Link\" fullPage={fullPage}>\n <Typography>Your password reset link has expired. Please request a new password reset link from the login page.</Typography>\n </MessageCard>\n );\n\n const usedJsx = (\n <MessageCard title=\"Used Password Reset Link\" fullPage={fullPage}>\n <Typography>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.</Typography>\n </MessageCard>\n );\n\n const code = searchParams.code;\n if (!code) {\n return invalidJsx;\n }\n\n const error = React.use(cachedVerifyPasswordResetCode(stackApp, code));\n\n if (error instanceof KnownErrors.VerificationCodeNotFound) {\n return invalidJsx;\n } else if (error instanceof KnownErrors.VerificationCodeExpired) {\n return expiredJsx;\n } else if (error instanceof KnownErrors.VerificationCodeAlreadyUsed) {\n return usedJsx;\n } else if (error) {\n throw error;\n }\n\n return <PasswordResetForm code={code} fullPage={fullPage} />;\n}\n"],"mappings":"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","names":["React"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
declare function SignIn(
|
|
3
|
+
declare function SignIn(props: {
|
|
4
4
|
fullPage?: boolean;
|
|
5
|
+
automaticRedirect?: boolean;
|
|
6
|
+
extraInfo?: React.ReactNode;
|
|
5
7
|
}): react_jsx_runtime.JSX.Element;
|
|
6
8
|
|
|
7
9
|
export { SignIn };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
declare function SignIn(
|
|
3
|
+
declare function SignIn(props: {
|
|
4
4
|
fullPage?: boolean;
|
|
5
|
+
automaticRedirect?: boolean;
|
|
6
|
+
extraInfo?: React.ReactNode;
|
|
5
7
|
}): react_jsx_runtime.JSX.Element;
|
|
6
8
|
|
|
7
9
|
export { SignIn };
|
|
@@ -25,8 +25,8 @@ __export(sign_in_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(sign_in_exports);
|
|
26
26
|
var import_auth_page = require("./auth-page");
|
|
27
27
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
-
function SignIn(
|
|
29
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_auth_page.AuthPage, { fullPage, type: "sign-in" });
|
|
28
|
+
function SignIn(props) {
|
|
29
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_auth_page.AuthPage, { fullPage: !!props.fullPage, type: "sign-in", automaticRedirect: !!props.automaticRedirect, extraInfo: props.extraInfo });
|
|
30
30
|
}
|
|
31
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
32
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components-page/sign-in.tsx"],"sourcesContent":["import { AuthPage } from './auth-page';\n\nexport function SignIn(
|
|
1
|
+
{"version":3,"sources":["../../src/components-page/sign-in.tsx"],"sourcesContent":["import { AuthPage } from './auth-page';\n\nexport function SignIn(props: { fullPage?: boolean, automaticRedirect?: boolean, extraInfo?: React.ReactNode }) {\n return <AuthPage fullPage={!!props.fullPage} type='sign-in' automaticRedirect={!!props.automaticRedirect} extraInfo={props.extraInfo} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAyB;AAGhB;AADF,SAAS,OAAO,OAAyF;AAC9G,SAAO,4CAAC,6BAAS,UAAU,CAAC,CAAC,MAAM,UAAU,MAAK,WAAU,mBAAmB,CAAC,CAAC,MAAM,mBAAmB,WAAW,MAAM,WAAW;AACxI;","names":[]}
|
|
@@ -35,10 +35,10 @@ __export(sign_out_exports, {
|
|
|
35
35
|
SignOut: () => SignOut
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(sign_out_exports);
|
|
38
|
+
var import_caches = require("@stackframe/stack-shared/dist/utils/caches");
|
|
38
39
|
var import_react = __toESM(require("react"));
|
|
39
40
|
var import__ = require("..");
|
|
40
41
|
var import_predefined_message_card = require("../components/message-cards/predefined-message-card");
|
|
41
|
-
var import_caches = require("@stackframe/stack-shared/dist/utils/caches");
|
|
42
42
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
43
|
var cacheSignOut = (0, import_caches.cacheFunction)(async (user) => {
|
|
44
44
|
return await user.signOut();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components-page/sign-out.tsx"],"sourcesContent":["'use client';\n\nimport React from \"react\";\nimport { CurrentUser,
|
|
1
|
+
{"version":3,"sources":["../../src/components-page/sign-out.tsx"],"sourcesContent":["'use client';\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;AAEA,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"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
declare function SignUp(
|
|
3
|
+
declare function SignUp(props: {
|
|
4
4
|
fullPage?: boolean;
|
|
5
|
+
automaticRedirect?: boolean;
|
|
6
|
+
extraInfo?: React.ReactNode;
|
|
5
7
|
}): react_jsx_runtime.JSX.Element;
|
|
6
8
|
|
|
7
9
|
export { SignUp };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
declare function SignUp(
|
|
3
|
+
declare function SignUp(props: {
|
|
4
4
|
fullPage?: boolean;
|
|
5
|
+
automaticRedirect?: boolean;
|
|
6
|
+
extraInfo?: React.ReactNode;
|
|
5
7
|
}): react_jsx_runtime.JSX.Element;
|
|
6
8
|
|
|
7
9
|
export { SignUp };
|
|
@@ -27,8 +27,8 @@ __export(sign_up_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(sign_up_exports);
|
|
28
28
|
var import_auth_page = require("./auth-page");
|
|
29
29
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
-
function SignUp(
|
|
31
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_auth_page.AuthPage, { fullPage, type: "sign-up" });
|
|
30
|
+
function SignUp(props) {
|
|
31
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_auth_page.AuthPage, { fullPage: !!props.fullPage, type: "sign-up", automaticRedirect: !!props.automaticRedirect, extraInfo: props.extraInfo });
|
|
32
32
|
}
|
|
33
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
34
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components-page/sign-up.tsx"],"sourcesContent":["'use client';\nimport { AuthPage } from './auth-page';\n\nexport function SignUp(
|
|
1
|
+
{"version":3,"sources":["../../src/components-page/sign-up.tsx"],"sourcesContent":["'use client';\nimport { AuthPage } from './auth-page';\n\nexport function SignUp(props: { fullPage?: boolean, automaticRedirect?: boolean, extraInfo?: React.ReactNode }) {\n return <AuthPage fullPage={!!props.fullPage} type='sign-up' automaticRedirect={!!props.automaticRedirect} extraInfo={props.extraInfo} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,uBAAyB;AAGhB;AADF,SAAS,OAAO,OAAyF;AAC9G,SAAO,4CAAC,6BAAS,UAAU,CAAC,CAAC,MAAM,UAAU,MAAK,WAAU,mBAAmB,CAAC,CAAC,MAAM,mBAAmB,WAAW,MAAM,WAAW;AACxI;","names":[]}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { StackServerApp } from '../lib/stack-app.mjs';
|
|
3
|
+
import { SignIn } from './sign-in.mjs';
|
|
4
|
+
import { SignUp } from './sign-up.mjs';
|
|
5
|
+
import { EmailVerification } from './email-verification.mjs';
|
|
6
|
+
import { PasswordReset } from './password-reset.mjs';
|
|
7
|
+
import { ForgotPassword } from './forgot-password.mjs';
|
|
8
|
+
import { AccountSettings } from './account-settings.mjs';
|
|
9
|
+
import { ErrorPage } from './error-page.mjs';
|
|
10
|
+
import { MagicLinkCallback } from './magic-link-callback.mjs';
|
|
11
|
+
import { OAuthCallback } from './oauth-callback.mjs';
|
|
12
|
+
import { SignOut } from './sign-out.mjs';
|
|
13
|
+
import { TeamInvitation } from './team-invitation.mjs';
|
|
3
14
|
import '@stackframe/stack-shared';
|
|
4
15
|
import '@stackframe/stack-shared/dist/helpers/production-mode';
|
|
5
16
|
import '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
@@ -10,14 +21,31 @@ import '@stackframe/stack-shared/dist/sessions';
|
|
|
10
21
|
import '@stackframe/stack-shared/dist/utils/json';
|
|
11
22
|
import '@stackframe/stack-shared/dist/utils/oauth';
|
|
12
23
|
import '@stackframe/stack-shared/dist/utils/results';
|
|
24
|
+
import 'lucide-react';
|
|
13
25
|
|
|
14
|
-
|
|
26
|
+
type Components = {
|
|
27
|
+
SignIn: typeof SignIn;
|
|
28
|
+
SignUp: typeof SignUp;
|
|
29
|
+
EmailVerification: typeof EmailVerification;
|
|
30
|
+
PasswordReset: typeof PasswordReset;
|
|
31
|
+
ForgotPassword: typeof ForgotPassword;
|
|
32
|
+
SignOut: typeof SignOut;
|
|
33
|
+
OAuthCallback: typeof OAuthCallback;
|
|
34
|
+
MagicLinkCallback: typeof MagicLinkCallback;
|
|
35
|
+
TeamInvitation: typeof TeamInvitation;
|
|
36
|
+
ErrorPage: typeof ErrorPage;
|
|
37
|
+
AccountSettings: typeof AccountSettings;
|
|
38
|
+
};
|
|
39
|
+
declare function StackHandler<HasTokenStore extends boolean>(props: {
|
|
15
40
|
app: StackServerApp<HasTokenStore>;
|
|
16
41
|
params?: {
|
|
17
42
|
stack?: string[];
|
|
18
43
|
};
|
|
19
44
|
searchParams?: Record<string, string>;
|
|
20
|
-
fullPage
|
|
45
|
+
fullPage: boolean;
|
|
46
|
+
componentProps?: {
|
|
47
|
+
[K in keyof Components]?: Parameters<Components[K]>;
|
|
48
|
+
};
|
|
21
49
|
}): Promise<react_jsx_runtime.JSX.Element>;
|
|
22
50
|
|
|
23
51
|
export { StackHandler as default };
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { StackServerApp } from '../lib/stack-app.js';
|
|
3
|
+
import { SignIn } from './sign-in.js';
|
|
4
|
+
import { SignUp } from './sign-up.js';
|
|
5
|
+
import { EmailVerification } from './email-verification.js';
|
|
6
|
+
import { PasswordReset } from './password-reset.js';
|
|
7
|
+
import { ForgotPassword } from './forgot-password.js';
|
|
8
|
+
import { AccountSettings } from './account-settings.js';
|
|
9
|
+
import { ErrorPage } from './error-page.js';
|
|
10
|
+
import { MagicLinkCallback } from './magic-link-callback.js';
|
|
11
|
+
import { OAuthCallback } from './oauth-callback.js';
|
|
12
|
+
import { SignOut } from './sign-out.js';
|
|
13
|
+
import { TeamInvitation } from './team-invitation.js';
|
|
3
14
|
import '@stackframe/stack-shared';
|
|
4
15
|
import '@stackframe/stack-shared/dist/helpers/production-mode';
|
|
5
16
|
import '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
@@ -10,14 +21,31 @@ import '@stackframe/stack-shared/dist/sessions';
|
|
|
10
21
|
import '@stackframe/stack-shared/dist/utils/json';
|
|
11
22
|
import '@stackframe/stack-shared/dist/utils/oauth';
|
|
12
23
|
import '@stackframe/stack-shared/dist/utils/results';
|
|
24
|
+
import 'lucide-react';
|
|
13
25
|
|
|
14
|
-
|
|
26
|
+
type Components = {
|
|
27
|
+
SignIn: typeof SignIn;
|
|
28
|
+
SignUp: typeof SignUp;
|
|
29
|
+
EmailVerification: typeof EmailVerification;
|
|
30
|
+
PasswordReset: typeof PasswordReset;
|
|
31
|
+
ForgotPassword: typeof ForgotPassword;
|
|
32
|
+
SignOut: typeof SignOut;
|
|
33
|
+
OAuthCallback: typeof OAuthCallback;
|
|
34
|
+
MagicLinkCallback: typeof MagicLinkCallback;
|
|
35
|
+
TeamInvitation: typeof TeamInvitation;
|
|
36
|
+
ErrorPage: typeof ErrorPage;
|
|
37
|
+
AccountSettings: typeof AccountSettings;
|
|
38
|
+
};
|
|
39
|
+
declare function StackHandler<HasTokenStore extends boolean>(props: {
|
|
15
40
|
app: StackServerApp<HasTokenStore>;
|
|
16
41
|
params?: {
|
|
17
42
|
stack?: string[];
|
|
18
43
|
};
|
|
19
44
|
searchParams?: Record<string, string>;
|
|
20
|
-
fullPage
|
|
45
|
+
fullPage: boolean;
|
|
46
|
+
componentProps?: {
|
|
47
|
+
[K in keyof Components]?: Parameters<Components[K]>;
|
|
48
|
+
};
|
|
21
49
|
}): Promise<react_jsx_runtime.JSX.Element>;
|
|
22
50
|
|
|
23
51
|
export { StackHandler as default };
|
|
@@ -36,28 +36,20 @@ var import_oauth_callback = require("./oauth-callback");
|
|
|
36
36
|
var import_password_reset = require("./password-reset");
|
|
37
37
|
var import_sign_out = require("./sign-out");
|
|
38
38
|
var import_team_invitation = require("./team-invitation");
|
|
39
|
+
var import_objects = require("@stackframe/stack-shared/dist/utils/objects");
|
|
39
40
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
-
async function StackHandler({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
searchParams = {},
|
|
44
|
-
fullPage
|
|
45
|
-
}) {
|
|
46
|
-
if (fullPage === void 0) {
|
|
47
|
-
console.warn("Not specifying `fullPage` in the StackHandler options is deprecated; the default value will change to `false` in the next major version. Please specify `fullPage={true}` in your `app/[...stack]/handler/page.tsx` file to retain the current behavior.");
|
|
48
|
-
fullPage = true;
|
|
49
|
-
}
|
|
50
|
-
if (!stack) {
|
|
51
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: "Invalid Stack Handler Setup", fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Can't use Stack handler at this location. Make sure that the file is in a folder called [...stack]." }) });
|
|
41
|
+
async function StackHandler(props) {
|
|
42
|
+
if (!props.params?.stack) {
|
|
43
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: "Invalid Stack Handler Setup", fullPage: props.fullPage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Can't use Stack handler at this location. Make sure that the file is in a folder called [...stack]." }) });
|
|
52
44
|
}
|
|
53
45
|
function redirectIfNotHandler(name) {
|
|
54
|
-
const url = app.urls[name];
|
|
55
|
-
const handlerUrl = app.urls.handler;
|
|
46
|
+
const url = props.app.urls[name];
|
|
47
|
+
const handlerUrl = props.app.urls.handler;
|
|
56
48
|
if (url !== handlerUrl && url.startsWith(handlerUrl + "/")) {
|
|
57
49
|
return;
|
|
58
50
|
}
|
|
59
51
|
const urlObj = new URL(url, "http://example.com");
|
|
60
|
-
for (const [key, value] of Object.entries(searchParams)) {
|
|
52
|
+
for (const [key, value] of Object.entries(props.searchParams || {})) {
|
|
61
53
|
urlObj.searchParams.set(key, value);
|
|
62
54
|
}
|
|
63
55
|
(0, import_navigation.redirect)((0, import_urls.getRelativePart)(urlObj), import_navigation.RedirectType.replace);
|
|
@@ -75,58 +67,134 @@ async function StackHandler({
|
|
|
75
67
|
teamInvitation: "team-invitation",
|
|
76
68
|
error: "error"
|
|
77
69
|
};
|
|
78
|
-
const path = stack.join("/");
|
|
70
|
+
const path = props.params.stack.join("/");
|
|
79
71
|
if (path.startsWith("account-settings")) {
|
|
80
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
|
+
import_account_settings.AccountSettings,
|
|
74
|
+
{
|
|
75
|
+
fullPage: props.fullPage,
|
|
76
|
+
...filterUndefinedINU(props.componentProps?.AccountSettings)
|
|
77
|
+
}
|
|
78
|
+
);
|
|
81
79
|
}
|
|
82
80
|
switch (path) {
|
|
83
81
|
case availablePaths.signIn: {
|
|
84
82
|
redirectIfNotHandler("signIn");
|
|
85
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
83
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
+
import__.SignIn,
|
|
85
|
+
{
|
|
86
|
+
fullPage: props.fullPage,
|
|
87
|
+
automaticRedirect: true,
|
|
88
|
+
...filterUndefinedINU(props.componentProps?.SignIn)
|
|
89
|
+
}
|
|
90
|
+
);
|
|
86
91
|
}
|
|
87
92
|
case availablePaths.signUp: {
|
|
88
93
|
redirectIfNotHandler("signUp");
|
|
89
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
94
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
95
|
+
import__.SignUp,
|
|
96
|
+
{
|
|
97
|
+
fullPage: props.fullPage,
|
|
98
|
+
automaticRedirect: true,
|
|
99
|
+
...filterUndefinedINU(props.componentProps?.SignUp)
|
|
100
|
+
}
|
|
101
|
+
);
|
|
90
102
|
}
|
|
91
103
|
case availablePaths.emailVerification: {
|
|
92
104
|
redirectIfNotHandler("emailVerification");
|
|
93
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
106
|
+
import_email_verification.EmailVerification,
|
|
107
|
+
{
|
|
108
|
+
searchParams: props.searchParams,
|
|
109
|
+
fullPage: props.fullPage,
|
|
110
|
+
...filterUndefinedINU(props.componentProps?.EmailVerification)
|
|
111
|
+
}
|
|
112
|
+
);
|
|
94
113
|
}
|
|
95
114
|
case availablePaths.passwordReset: {
|
|
96
115
|
redirectIfNotHandler("passwordReset");
|
|
97
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
|
+
import_password_reset.PasswordReset,
|
|
118
|
+
{
|
|
119
|
+
searchParams: props.searchParams || {},
|
|
120
|
+
fullPage: props.fullPage,
|
|
121
|
+
...filterUndefinedINU(props.componentProps?.PasswordReset)
|
|
122
|
+
}
|
|
123
|
+
);
|
|
98
124
|
}
|
|
99
125
|
case availablePaths.forgotPassword: {
|
|
100
126
|
redirectIfNotHandler("forgotPassword");
|
|
101
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
128
|
+
import_forgot_password.ForgotPassword,
|
|
129
|
+
{
|
|
130
|
+
fullPage: props.fullPage,
|
|
131
|
+
...filterUndefinedINU(props.componentProps?.ForgotPassword)
|
|
132
|
+
}
|
|
133
|
+
);
|
|
102
134
|
}
|
|
103
135
|
case availablePaths.signOut: {
|
|
104
136
|
redirectIfNotHandler("signOut");
|
|
105
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
138
|
+
import_sign_out.SignOut,
|
|
139
|
+
{
|
|
140
|
+
fullPage: props.fullPage,
|
|
141
|
+
...filterUndefinedINU(props.componentProps?.SignOut)
|
|
142
|
+
}
|
|
143
|
+
);
|
|
106
144
|
}
|
|
107
145
|
case availablePaths.oauthCallback: {
|
|
108
146
|
redirectIfNotHandler("oauthCallback");
|
|
109
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
148
|
+
import_oauth_callback.OAuthCallback,
|
|
149
|
+
{
|
|
150
|
+
fullPage: props.fullPage,
|
|
151
|
+
...filterUndefinedINU(props.componentProps?.OAuthCallback)
|
|
152
|
+
}
|
|
153
|
+
);
|
|
110
154
|
}
|
|
111
155
|
case availablePaths.magicLinkCallback: {
|
|
112
156
|
redirectIfNotHandler("magicLinkCallback");
|
|
113
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
158
|
+
import_magic_link_callback.MagicLinkCallback,
|
|
159
|
+
{
|
|
160
|
+
searchParams: props.searchParams || {},
|
|
161
|
+
fullPage: props.fullPage,
|
|
162
|
+
...filterUndefinedINU(props.componentProps?.MagicLinkCallback)
|
|
163
|
+
}
|
|
164
|
+
);
|
|
114
165
|
}
|
|
115
166
|
case availablePaths.teamInvitation: {
|
|
116
167
|
redirectIfNotHandler("teamInvitation");
|
|
117
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
169
|
+
import_team_invitation.TeamInvitation,
|
|
170
|
+
{
|
|
171
|
+
searchParams: props.searchParams || {},
|
|
172
|
+
fullPage: props.fullPage,
|
|
173
|
+
...filterUndefinedINU(props.componentProps?.TeamInvitation)
|
|
174
|
+
}
|
|
175
|
+
);
|
|
118
176
|
}
|
|
119
177
|
case availablePaths.error: {
|
|
120
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
179
|
+
import_error_page.ErrorPage,
|
|
180
|
+
{
|
|
181
|
+
searchParams: props.searchParams || {},
|
|
182
|
+
fullPage: props.fullPage,
|
|
183
|
+
...filterUndefinedINU(props.componentProps?.ErrorPage)
|
|
184
|
+
}
|
|
185
|
+
);
|
|
121
186
|
}
|
|
122
187
|
default: {
|
|
123
188
|
for (const [key, value] of Object.entries(availablePaths)) {
|
|
124
189
|
if (path === value.replaceAll("-", "")) {
|
|
125
|
-
(0, import_navigation.redirect)(`${app.urls.handler}/${value}`, import_navigation.RedirectType.replace);
|
|
190
|
+
(0, import_navigation.redirect)(`${props.app.urls.handler}/${value}`, import_navigation.RedirectType.replace);
|
|
126
191
|
}
|
|
127
192
|
}
|
|
128
193
|
return (0, import_navigation.notFound)();
|
|
129
194
|
}
|
|
130
195
|
}
|
|
131
196
|
}
|
|
197
|
+
function filterUndefinedINU(value) {
|
|
198
|
+
return value === void 0 ? value : (0, import_objects.filterUndefined)(value);
|
|
199
|
+
}
|
|
132
200
|
//# sourceMappingURL=stack-handler.js.map
|