@stackframe/stack 2.2.5 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/card-frame.d.ts +0 -1
- package/dist/components/credential-sign-in.d.ts +0 -1
- package/dist/components/credential-sign-up.d.ts +0 -1
- package/dist/components/forgot-password.d.ts +0 -1
- package/dist/components/form-warning.d.ts +0 -1
- package/dist/components/magic-link-sign-in.d.ts +1 -0
- package/dist/components/magic-link-sign-in.d.ts.map +1 -0
- package/dist/components/magic-link-sign-in.js +33 -0
- package/dist/components/message-card.d.ts +0 -1
- package/dist/components/oauth-button.d.ts +0 -1
- package/dist/components/oauth-group.d.ts +0 -1
- package/dist/components/password-field.d.ts +0 -1
- package/dist/components/password-reset-inner.d.ts +0 -1
- package/dist/components/redirect-message-card.d.ts +0 -1
- package/dist/components/separator-with-text.d.ts +0 -1
- package/dist/components/user-avatar.d.ts +0 -1
- package/dist/components/user-button.d.ts +0 -1
- package/dist/components-core/avatar.d.ts +0 -1
- package/dist/components-core/button.d.ts +0 -1
- package/dist/components-core/card.d.ts +0 -1
- package/dist/components-core/collapsible.d.ts +0 -1
- package/dist/components-core/container.d.ts +0 -1
- package/dist/components-core/dropdown.d.ts +0 -1
- package/dist/components-core/index.d.ts +17 -14
- package/dist/components-core/index.d.ts.map +1 -1
- package/dist/components-core/index.js +35 -99
- package/dist/components-core/input.d.ts +0 -1
- package/dist/components-core/label.d.ts +0 -1
- package/dist/components-core/label.js +2 -2
- package/dist/components-core/link.d.ts +0 -1
- package/dist/components-core/loading-indicator.d.ts +0 -1
- package/dist/components-core/popover.d.ts +0 -1
- package/dist/components-core/separator.d.ts +0 -1
- package/dist/components-core/tabs.d.ts +7 -0
- package/dist/components-core/tabs.d.ts.map +1 -0
- package/dist/components-core/tabs.js +50 -0
- package/dist/components-core/text.d.ts +0 -1
- package/dist/components-core-joy/button.d.ts +0 -1
- package/dist/components-core-joy/input.d.ts +0 -1
- package/dist/components-core-joy/separator.d.ts +1 -2
- package/dist/components-core-joy/separator.d.ts.map +1 -1
- package/dist/components-core-joy/tabs.d.ts +5 -0
- package/dist/components-core-joy/tabs.d.ts.map +1 -0
- package/dist/components-core-joy/tabs.js +20 -0
- package/dist/components-core-joy/text.d.ts +0 -1
- package/dist/components-page/account-settings.d.ts +0 -1
- package/dist/components-page/account-settings.js +1 -1
- package/dist/components-page/auth-page.d.ts +4 -0
- package/dist/components-page/auth-page.d.ts.map +1 -0
- package/dist/components-page/auth-page.js +20 -0
- package/dist/components-page/email-verification.d.ts +0 -1
- package/dist/components-page/forgot-password.d.ts +0 -1
- package/dist/{components/PasswordReset.d.ts → components-page/magic-link-callback.d.ts} +1 -2
- package/dist/components-page/magic-link-callback.d.ts.map +1 -0
- package/dist/components-page/magic-link-callback.js +35 -0
- package/dist/components-page/oauth-callback.d.ts +0 -1
- package/dist/components-page/password-reset.d.ts +0 -1
- package/dist/components-page/sign-in.d.ts +0 -1
- package/dist/components-page/sign-in.d.ts.map +1 -1
- package/dist/components-page/sign-in.js +3 -16
- package/dist/components-page/sign-out.d.ts +0 -1
- package/dist/components-page/sign-out.d.ts.map +1 -1
- package/dist/components-page/sign-out.js +1 -2
- package/dist/components-page/sign-up.d.ts +0 -1
- package/dist/components-page/sign-up.d.ts.map +1 -1
- package/dist/components-page/sign-up.js +3 -16
- package/dist/components-page/stack-handler.d.ts +0 -1
- package/dist/components-page/stack-handler.d.ts.map +1 -1
- package/dist/components-page/stack-handler.js +5 -0
- package/dist/index.d.ts +0 -1
- package/dist/joy.d.ts +0 -1
- package/dist/lib/auth.d.ts +0 -1
- package/dist/lib/cookie.d.ts +0 -1
- package/dist/lib/cookie.d.ts.map +1 -1
- package/dist/lib/cookie.js +1 -1
- package/dist/lib/hooks.d.ts +0 -1
- package/dist/lib/stack-app.d.ts +6 -1
- package/dist/lib/stack-app.d.ts.map +1 -1
- package/dist/lib/stack-app.js +32 -1
- package/dist/providers/component-provider.d.ts +8 -1
- package/dist/providers/component-provider.d.ts.map +1 -1
- package/dist/providers/component-provider.js +5 -0
- package/dist/providers/design-provider.d.ts +0 -1
- package/dist/providers/joy-provider.d.ts +5 -2
- package/dist/providers/joy-provider.d.ts.map +1 -1
- package/dist/providers/joy-provider.js +5 -0
- package/dist/providers/stack-provider-client.d.ts +0 -1
- package/dist/providers/stack-provider.d.ts +0 -1
- package/dist/providers/styled-components-registry.d.ts +0 -1
- package/dist/providers/theme-provider.d.ts +0 -1
- package/dist/utils/constants.d.ts +0 -1
- package/dist/utils/email.d.ts +0 -1
- package/dist/utils/next.d.ts +0 -1
- package/dist/utils/url.d.ts +0 -1
- package/package.json +5 -4
- package/dist/components/EmailVerification.d.ts +0 -6
- package/dist/components/EmailVerification.d.ts.map +0 -1
- package/dist/components/EmailVerification.js +0 -29
- package/dist/components/ForgotPassword.d.ts +0 -4
- package/dist/components/ForgotPassword.d.ts.map +0 -1
- package/dist/components/ForgotPassword.js +0 -22
- package/dist/components/OAuthCallback.d.ts +0 -2
- package/dist/components/OAuthCallback.d.ts.map +0 -1
- package/dist/components/OAuthCallback.js +0 -20
- package/dist/components/PasswordReset.d.ts.map +0 -1
- package/dist/components/PasswordReset.js +0 -36
- package/dist/components/SignIn.d.ts +0 -5
- package/dist/components/SignIn.d.ts.map +0 -1
- package/dist/components/SignIn.js +0 -20
- package/dist/components/SignOut.d.ts +0 -4
- package/dist/components/SignOut.d.ts.map +0 -1
- package/dist/components/SignOut.js +0 -12
- package/dist/components/SignUp.d.ts +0 -5
- package/dist/components/SignUp.d.ts.map +0 -1
- package/dist/components/SignUp.js +0 -19
- package/dist/components/StackHandler.d.ts +0 -9
- package/dist/components/StackHandler.d.ts.map +0 -1
- package/dist/components/StackHandler.js +0 -58
- package/dist/elements/Button.d.ts +0 -11
- package/dist/elements/Button.d.ts.map +0 -1
- package/dist/elements/Button.js +0 -18
- package/dist/elements/CardFrame.d.ts +0 -6
- package/dist/elements/CardFrame.d.ts.map +0 -1
- package/dist/elements/CardFrame.js +0 -10
- package/dist/elements/CardHeader.d.ts +0 -6
- package/dist/elements/CardHeader.d.ts.map +0 -1
- package/dist/elements/CardHeader.js +0 -4
- package/dist/elements/CredentialSignIn.d.ts +0 -4
- package/dist/elements/CredentialSignIn.d.ts.map +0 -1
- package/dist/elements/CredentialSignIn.js +0 -57
- package/dist/elements/CredentialSignUp.d.ts +0 -4
- package/dist/elements/CredentialSignUp.d.ts.map +0 -1
- package/dist/elements/CredentialSignUp.js +0 -73
- package/dist/elements/DividerWithText.d.ts +0 -4
- package/dist/elements/DividerWithText.d.ts.map +0 -1
- package/dist/elements/DividerWithText.js +0 -5
- package/dist/elements/ForgotPassword.d.ts +0 -4
- package/dist/elements/ForgotPassword.d.ts.map +0 -1
- package/dist/elements/ForgotPassword.js +0 -32
- package/dist/elements/FormWarning.d.ts +0 -4
- package/dist/elements/FormWarning.d.ts.map +0 -1
- package/dist/elements/FormWarning.js +0 -7
- package/dist/elements/MessageCard.d.ts +0 -7
- package/dist/elements/MessageCard.d.ts.map +0 -1
- package/dist/elements/MessageCard.js +0 -5
- package/dist/elements/OAuthButton.d.ts +0 -6
- package/dist/elements/OAuthButton.d.ts.map +0 -1
- package/dist/elements/OAuthButton.js +0 -67
- package/dist/elements/OAuthGroup.d.ts +0 -5
- package/dist/elements/OAuthGroup.d.ts.map +0 -1
- package/dist/elements/OAuthGroup.js +0 -8
- package/dist/elements/PasswordField.d.ts +0 -3
- package/dist/elements/PasswordField.d.ts.map +0 -1
- package/dist/elements/PasswordField.js +0 -27
- package/dist/elements/PasswordResetInner.d.ts +0 -5
- package/dist/elements/PasswordResetInner.d.ts.map +0 -1
- package/dist/elements/PasswordResetInner.js +0 -61
- package/dist/elements/RedirectMessageCard.d.ts +0 -5
- package/dist/elements/RedirectMessageCard.d.ts.map +0 -1
- package/dist/elements/RedirectMessageCard.js +0 -55
- package/dist/providers/StackProvider.d.ts +0 -7
- package/dist/providers/StackProvider.d.ts.map +0 -1
- package/dist/providers/StackProvider.js +0 -6
- package/dist/providers/StackProviderClient.d.ts +0 -10
- package/dist/providers/StackProviderClient.d.ts.map +0 -1
- package/dist/providers/StackProviderClient.js +0 -14
- package/dist/utils/react.d.ts +0 -2
- package/dist/utils/react.d.ts.map +0 -1
- package/dist/utils/react.js +0 -6
- package/dist/utils/results.d.ts +0 -25
- package/dist/utils/results.d.ts.map +0 -1
- package/dist/utils/results.js +0 -46
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { FormWarningText } from "./FormWarning";
|
|
5
|
-
import { validateEmail } from "../utils/email";
|
|
6
|
-
import { useStackApp } from "..";
|
|
7
|
-
import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
|
|
8
|
-
import Button from "./Button";
|
|
9
|
-
export default function ForgotPassword({ onSent }) {
|
|
10
|
-
const [email, setEmail] = useState('');
|
|
11
|
-
const [emailError, setEmailError] = useState('');
|
|
12
|
-
const [sending, setSending] = useState(false);
|
|
13
|
-
const stackApp = useStackApp();
|
|
14
|
-
const onSubmit = async () => {
|
|
15
|
-
if (!email) {
|
|
16
|
-
setEmailError('Please enter your email');
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (!validateEmail(email)) {
|
|
20
|
-
setEmailError('Please enter a valid email');
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
setSending(true);
|
|
24
|
-
await stackApp.sendForgotPasswordEmail(email);
|
|
25
|
-
setSending(false);
|
|
26
|
-
onSent?.();
|
|
27
|
-
};
|
|
28
|
-
return (_jsxs("div", { className: "wl_flex wl_flex-col wl_space-y-2 wl_items-stretch", children: [_jsxs("div", { className: "wl_form-control", children: [_jsx("label", { className: "wl_label", htmlFor: "email", children: _jsx("span", { className: "wl_label-text", children: "Your Email" }) }), _jsx("input", { id: "email", type: "email", name: "email", className: "wl_input wl_input-bordered", value: email, onChange: (e) => {
|
|
29
|
-
setEmail(e.target.value);
|
|
30
|
-
setEmailError('');
|
|
31
|
-
} }), _jsx(FormWarningText, { text: emailError })] }), _jsx("div", { className: "wl_flex wl_flex-col wl_items-stretch", children: _jsx(Button, { className: "wl_btn-primary wl_mt-6", onClick: () => runAsynchronously(onSubmit()), loading: sending, children: "Send Email" }) })] }));
|
|
32
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormWarning.d.ts","sourceRoot":"","sources":["../../src/elements/FormWarning.tsx"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,kDAS1D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MessageCard.d.ts","sourceRoot":"","sources":["../../src/elements/MessageCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAc,EAAE,EACnC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAC,2CAUjE"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import CardFrame from "./CardFrame";
|
|
3
|
-
export default function MessageCard({ children, title, fullPage = false }) {
|
|
4
|
-
return (_jsx(CardFrame, { fullPage: fullPage, children: _jsxs("div", { className: 'wl_text-center', children: [_jsx("h1", { className: "wl_text-2xl wl_mb-6", children: title }), children] }) }));
|
|
5
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthButton.d.ts","sourceRoot":"","sources":["../../src/elements/OAuthButton.tsx"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,IAAI,EACJ,WAAW,EACZ,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,2CAuGA"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { FaGithub, FaFacebook, FaApple } from 'react-icons/fa';
|
|
4
|
-
import { useStackApp } from '..';
|
|
5
|
-
import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
|
|
6
|
-
import Button from './Button';
|
|
7
|
-
const iconSize = 24;
|
|
8
|
-
export default function OAuthButton({ provider, type, redirectUrl }) {
|
|
9
|
-
const stackApp = useStackApp();
|
|
10
|
-
let style;
|
|
11
|
-
switch (provider) {
|
|
12
|
-
case 'google': {
|
|
13
|
-
style = {
|
|
14
|
-
backgroundColor: '#fff',
|
|
15
|
-
textColor: '#000',
|
|
16
|
-
name: 'Google',
|
|
17
|
-
icon: (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: iconSize, height: iconSize, viewBox: "0 0 24 24", children: [_jsx("path", { fill: "#4285F4", d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" }), _jsx("path", { fill: "#34A853", d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" }), _jsx("path", { fill: "#FBBC05", d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" }), _jsx("path", { fill: "#EA4335", d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" }), _jsx("path", { fill: "none", d: "M1 1h22v22H1z" })] })),
|
|
18
|
-
};
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
case 'github': {
|
|
22
|
-
style = {
|
|
23
|
-
backgroundColor: '#111',
|
|
24
|
-
textColor: '#fff',
|
|
25
|
-
name: 'GitHub',
|
|
26
|
-
icon: (_jsx(FaGithub, { color: "#fff", size: iconSize })),
|
|
27
|
-
};
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
case 'facebook': {
|
|
31
|
-
style = {
|
|
32
|
-
backgroundColor: '#1877F2',
|
|
33
|
-
textColor: '#fff',
|
|
34
|
-
name: 'Facebook',
|
|
35
|
-
icon: (_jsx(FaFacebook, { color: "#fff", size: iconSize })),
|
|
36
|
-
};
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
case 'apple': {
|
|
40
|
-
style = {
|
|
41
|
-
backgroundColor: '#000',
|
|
42
|
-
textColor: '#fff',
|
|
43
|
-
name: 'Apple',
|
|
44
|
-
icon: (_jsx(FaApple, { color: "#fff", size: iconSize })),
|
|
45
|
-
};
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
case 'microsoft': {
|
|
49
|
-
style = {
|
|
50
|
-
backgroundColor: '#2f2f2f',
|
|
51
|
-
textColor: '#fff',
|
|
52
|
-
name: 'Microsoft',
|
|
53
|
-
icon: (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: iconSize, height: iconSize, viewBox: "0 0 21 21", children: [_jsx("title", { children: "MS-SymbolLockup" }), _jsx("path", { fill: "#f25022", d: "M1 1h9v9H1z" }), _jsx("path", { fill: "#00a4ef", d: "M1 11h9v9H1z" }), _jsx("path", { fill: "#7fba00", d: "M11 1h9v9h-9z" }), _jsx("path", { fill: "#ffb900", d: "M11 11h9v9h-9z" })] })),
|
|
54
|
-
};
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
default: {
|
|
58
|
-
style = {
|
|
59
|
-
backgroundColor: '#000',
|
|
60
|
-
textColor: '#fff',
|
|
61
|
-
name: provider,
|
|
62
|
-
icon: null
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return (_jsxs(Button, { style: { backgroundColor: style.backgroundColor, color: style.textColor }, onClick: () => runAsynchronously(stackApp.signInWithOAuth(provider)), leftIcon: style.icon, children: [type === 'signup' ? 'Sign up with ' : 'Sign in with ', style.name] }));
|
|
67
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthGroup.d.ts","sourceRoot":"","sources":["../../src/elements/OAuthGroup.tsx"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,IAAI,EACJ,WAAW,EACZ,EAAE;IACD,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,2CAWA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useStackApp } from "..";
|
|
3
|
-
import OAuthButton from "./OAuthButton";
|
|
4
|
-
export default function OAuthGroup({ type, redirectUrl }) {
|
|
5
|
-
const stackApp = useStackApp();
|
|
6
|
-
const project = stackApp.useProject();
|
|
7
|
-
return (_jsx("div", { className: "wl_space-y-4 wl_flex wl_flex-col wl_items-stretch", children: project.oauthProviders.filter(p => p.enabled).map(p => (_jsx(OAuthButton, { provider: p.id, type: type, redirectUrl: redirectUrl }, p.id))) }));
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordField.d.ts","sourceRoot":"","sources":["../../src/elements/PasswordField.tsx"],"names":[],"mappings":";AAGA,eAAO,MAAM,aAAa,oJA8CxB,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useRef, useState } from 'react';
|
|
3
|
-
import { HiEye, HiEyeOff } from 'react-icons/hi';
|
|
4
|
-
export const PasswordField = forwardRef(({ id, name, ...props }, ref) => {
|
|
5
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
6
|
-
const inputRef = useRef(null);
|
|
7
|
-
const mergeRef = (node) => {
|
|
8
|
-
if (ref) {
|
|
9
|
-
if (typeof ref === 'function') {
|
|
10
|
-
ref(node);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
ref.current = node;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
inputRef.current = node;
|
|
17
|
-
};
|
|
18
|
-
const onClickReveal = () => {
|
|
19
|
-
setIsOpen(!isOpen);
|
|
20
|
-
const currentInput = inputRef.current;
|
|
21
|
-
if (currentInput) {
|
|
22
|
-
currentInput.focus({ preventScroll: true });
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
return (_jsxs("div", { className: "wl_relative", children: [_jsx("input", { id: id, ref: mergeRef, name: name, type: isOpen ? 'text' : 'password', autoComplete: "current-password", required: true, className: "wl_input wl_input-bordered wl_w-full", ...props }), _jsx("button", { tabIndex: -1, type: "button", className: "wl_absolute wl_inset-y-0 wl_right-0 wl_flex wl_items-center wl_pr-3", onClick: onClickReveal, "aria-label": isOpen ? 'Mask password' : 'Reveal password', children: isOpen ? _jsx(HiEyeOff, {}) : _jsx(HiEye, {}) })] }));
|
|
26
|
-
});
|
|
27
|
-
PasswordField.displayName = 'PasswordField';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordResetInner.d.ts","sourceRoot":"","sources":["../../src/elements/PasswordResetInner.tsx"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,EAAE,IAAI,EAAE,QAAgB,EAAE,EAC1B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,2CAiGrC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { getPasswordError } from "@stackframe/stack-shared/dist/helpers/password";
|
|
5
|
-
import { useStackApp } from "..";
|
|
6
|
-
import { PasswordField } from "./PasswordField";
|
|
7
|
-
import { FormWarningText } from "./FormWarning";
|
|
8
|
-
import RedirectMessageCard from "./RedirectMessageCard";
|
|
9
|
-
import MessageCard from "./MessageCard";
|
|
10
|
-
import CardFrame from "./CardFrame";
|
|
11
|
-
import CardHeader from "./CardHeader";
|
|
12
|
-
export default function PasswordResetInner({ code, fullPage = false }) {
|
|
13
|
-
const [password, setPassword] = useState('');
|
|
14
|
-
const [passwordError, setPasswordError] = useState('');
|
|
15
|
-
const [passwordRepeat, setPasswordRepeat] = useState('');
|
|
16
|
-
const [passwordRepeatError, setPasswordRepeatError] = useState('');
|
|
17
|
-
const [finished, setFinished] = useState(false);
|
|
18
|
-
const [resetError, setResetError] = useState(false);
|
|
19
|
-
const stackApp = useStackApp();
|
|
20
|
-
const onSubmit = async () => {
|
|
21
|
-
if (!password) {
|
|
22
|
-
setPasswordError('Please enter your password');
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (!passwordRepeat) {
|
|
26
|
-
setPasswordRepeatError('Please repeat your password');
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (password !== passwordRepeat) {
|
|
30
|
-
setPasswordRepeatError('Passwords do not match');
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const errorMessage = getPasswordError(password);
|
|
34
|
-
if (errorMessage) {
|
|
35
|
-
setPasswordError(errorMessage);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const errorCode = await stackApp.resetPassword({ password, code });
|
|
39
|
-
// this should not happen, the outer component should verify the code before rendering this component
|
|
40
|
-
if (errorCode) {
|
|
41
|
-
setResetError(true);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
setFinished(true);
|
|
45
|
-
};
|
|
46
|
-
if (finished) {
|
|
47
|
-
return _jsx(RedirectMessageCard, { type: 'passwordReset', fullPage: fullPage });
|
|
48
|
-
}
|
|
49
|
-
if (resetError) {
|
|
50
|
-
return (_jsx(MessageCard, { title: "Failed to reset password", fullPage: fullPage, children: _jsx("p", { children: "Failed to reset password. Please request a new password reset link" }) }));
|
|
51
|
-
}
|
|
52
|
-
return (_jsxs(CardFrame, { fullPage: fullPage, children: [_jsx(CardHeader, { title: "Reset Your Password" }), _jsxs("div", { className: "wl_flex wl_flex-col wl_space-y-2 wl_items-stretch", children: [_jsxs("div", { className: "wl_form-control", children: [_jsx("label", { className: "wl_label", htmlFor: "password", children: "New Password" }), _jsx(PasswordField, { id: "password", name: "password", value: password, onChange: (e) => {
|
|
53
|
-
setPassword(e.target.value);
|
|
54
|
-
setPasswordError('');
|
|
55
|
-
setPasswordRepeatError('');
|
|
56
|
-
} }), _jsx(FormWarningText, { text: passwordError })] }), _jsxs("div", { className: "wl_form-control", children: [_jsx("label", { className: "wl_label", htmlFor: "repeat-password", children: "Repeat New Password" }), _jsx(PasswordField, { id: "repeat-password", name: "repeat-password", value: passwordRepeat, onChange: (e) => {
|
|
57
|
-
setPasswordRepeat(e.target.value);
|
|
58
|
-
setPasswordError('');
|
|
59
|
-
setPasswordRepeatError('');
|
|
60
|
-
} }), _jsx(FormWarningText, { text: passwordRepeatError })] }), _jsx("div", { className: "wl_flex wl_flex-col wl_items-stretch", children: _jsx("button", { className: "wl_btn wl_btn-primary wl_mt-6", onClick: () => void onSubmit(), children: "Reset Password" }) })] })] }));
|
|
61
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectMessageCard.d.ts","sourceRoot":"","sources":["../../src/elements/RedirectMessageCard.tsx"],"names":[],"mappings":"AAOA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,IAAI,EACJ,QAAc,GACf,EAAE;IACD,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,eAAe,GAAG,eAAe,CAAC;IACjF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,2CAwEA"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useRouter } from "next/navigation";
|
|
4
|
-
import { useStackApp } from "..";
|
|
5
|
-
import MessageCard from "./MessageCard";
|
|
6
|
-
import Button from "./Button";
|
|
7
|
-
export default function RedirectMessageCard({ type, fullPage = false, }) {
|
|
8
|
-
const stackApp = useStackApp();
|
|
9
|
-
const router = useRouter();
|
|
10
|
-
let title;
|
|
11
|
-
let primaryUrl;
|
|
12
|
-
let secondaryUrl = null;
|
|
13
|
-
let message = null;
|
|
14
|
-
let primaryButton;
|
|
15
|
-
let secondaryButton = null;
|
|
16
|
-
switch (type) {
|
|
17
|
-
case 'signedIn': {
|
|
18
|
-
title = "You are already signed in";
|
|
19
|
-
message = 'You are already signed in.';
|
|
20
|
-
primaryUrl = stackApp.urls.userHome;
|
|
21
|
-
secondaryUrl = stackApp.urls.signOut;
|
|
22
|
-
primaryButton = "Go to Home";
|
|
23
|
-
secondaryButton = "Sign Out";
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
case 'signedOut': {
|
|
27
|
-
title = "You are not currently signed in.";
|
|
28
|
-
primaryUrl = stackApp.urls.home;
|
|
29
|
-
primaryButton = "Go to Home";
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
case 'emailSent': {
|
|
33
|
-
title = "Email sent!";
|
|
34
|
-
message = 'Please check your inbox. Make sure to check your spam folder.';
|
|
35
|
-
primaryUrl = stackApp.urls.home;
|
|
36
|
-
primaryButton = "Go to Home";
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
case 'passwordReset': {
|
|
40
|
-
title = "Password reset successfully!";
|
|
41
|
-
message = 'Your password has been reset. You can now sign in with your new password.';
|
|
42
|
-
primaryUrl = stackApp.urls.signIn;
|
|
43
|
-
primaryButton = "Go to Sign In";
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
case 'emailVerified': {
|
|
47
|
-
title = "Email verified!";
|
|
48
|
-
message = 'Your have successfully verified your email.';
|
|
49
|
-
primaryUrl = stackApp.urls.home;
|
|
50
|
-
primaryButton = "Go to Home";
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return (_jsxs(MessageCard, { title: title, fullPage: fullPage, children: [message && _jsx("p", { className: 'wl_mb-8', children: message }), _jsxs("div", { className: 'wl_flex wl_flex-row wl_align-center wl_justify-center wl_gap-4', children: [secondaryButton && (_jsx(Button, { className: 'wl_btn_ghost', onClick: () => router.push(stackApp.urls.signOut.toString()), children: secondaryButton })), _jsx(Button, { className: 'wl_btn wl_btn-primary', onClick: () => router.push(primaryUrl.toString()), children: primaryButton })] })] }));
|
|
55
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { StackClientApp } from '../lib/stack-app';
|
|
3
|
-
export default function StackProvider({ children, app, }: {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
app: StackClientApp<true>;
|
|
6
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
//# sourceMappingURL=StackProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StackProvider.d.ts","sourceRoot":"","sources":["../../src/providers/StackProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,cAAc,EAA2B,MAAM,kBAAkB,CAAC;AAI3E,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,QAAQ,EACR,GAAG,GACJ,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;CAC3B,2CAMA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { stackAppInternalsSymbol } from '../lib/stack-app';
|
|
3
|
-
import { StackProviderClient } from './StackProviderClient';
|
|
4
|
-
export default function StackProvider({ children, app, }) {
|
|
5
|
-
return (_jsx(StackProviderClient, { appJsonPromise: app[stackAppInternalsSymbol].toClientJson(), children: children }));
|
|
6
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { StackClientApp, StackClientAppJson } from "../lib/stack-app";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export declare const StackContext: React.Context<{
|
|
4
|
-
app: StackClientApp<true>;
|
|
5
|
-
} | null>;
|
|
6
|
-
export declare function StackProviderClient(props: {
|
|
7
|
-
appJsonPromise: Promise<StackClientAppJson<true, string>>;
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
//# sourceMappingURL=StackProviderClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StackProviderClient.d.ts","sourceRoot":"","sources":["../../src/providers/StackProviderClient.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAA2B,MAAM,kBAAkB,CAAC;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,YAAY;SAClB,eAAe,IAAI,CAAC;SACnB,CAAC;AAET,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,cAAc,EAAE,OAAO,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,2CAaA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { use } from "react";
|
|
4
|
-
import { StackClientApp, stackAppInternalsSymbol } from "../lib/stack-app";
|
|
5
|
-
import React from "react";
|
|
6
|
-
export const StackContext = React.createContext(null);
|
|
7
|
-
export function StackProviderClient(props) {
|
|
8
|
-
const appJson = use(props.appJsonPromise);
|
|
9
|
-
const app = StackClientApp[stackAppInternalsSymbol].fromClientJson(appJson);
|
|
10
|
-
if (process.env.NODE_ENV === "development") {
|
|
11
|
-
globalThis.stackApp = app;
|
|
12
|
-
}
|
|
13
|
-
return (_jsx(StackContext.Provider, { value: { app }, children: props.children }));
|
|
14
|
-
}
|
package/dist/utils/react.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/utils/react.ts"],"names":[],"mappings":"AAGA,wBAAgB,OAAO,IAAI,KAAK,CAG/B"}
|
package/dist/utils/react.js
DELETED
package/dist/utils/results.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export type Result<T, E = unknown> = {
|
|
2
|
-
status: "ok";
|
|
3
|
-
data: T;
|
|
4
|
-
} | {
|
|
5
|
-
status: "error";
|
|
6
|
-
error: E;
|
|
7
|
-
};
|
|
8
|
-
export type AsyncResult<T, E = unknown, P = void> = Result<T, E> | {
|
|
9
|
-
status: "loading";
|
|
10
|
-
} & (P extends void ? {} : {
|
|
11
|
-
progress: P;
|
|
12
|
-
});
|
|
13
|
-
export declare const Result: {
|
|
14
|
-
fromPromise: typeof promiseToResult;
|
|
15
|
-
ok<T>(data: T): Result<T, never>;
|
|
16
|
-
error<E>(error: E): Result<never, E>;
|
|
17
|
-
map: typeof mapResult;
|
|
18
|
-
orThrow: <T_1, E_1>(result: Result<T_1, E_1>) => T_1;
|
|
19
|
-
orThrowAsync: <T_2, E_2>(result: Promise<Result<T_2, E_2>>) => Promise<T_2>;
|
|
20
|
-
};
|
|
21
|
-
declare function promiseToResult<T, E = unknown>(promise: Promise<T>): Promise<Result<T, E>>;
|
|
22
|
-
declare function mapResult<T, U, E = unknown, P = unknown>(result: Result<T, E>, fn: (data: T) => U): Result<U, E>;
|
|
23
|
-
declare function mapResult<T, U, E = unknown, P = unknown>(result: AsyncResult<T, E, P>, fn: (data: T) => U): AsyncResult<U, E, P>;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=results.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../src/utils/results.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,IAC7B;IACA,MAAM,EAAE,IAAI,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;CACT,GACC;IACA,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEJ,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,IAAI,IAC5C,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACV;IACF,MAAM,EAAE,SAAS,CAAC;CACnB,GACC,CAAC,CAAC,SAAS,IAAI,GAAG,EAAE,GAAG;IAAE,QAAQ,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAE5C,eAAO,MAAM,MAAM;;;;;;;CAsBlB,CAAC;AAEF,iBAAS,eAAe,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAQnF;AAED,iBAAS,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3G,iBAAS,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
package/dist/utils/results.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export const Result = {
|
|
2
|
-
fromPromise: promiseToResult,
|
|
3
|
-
ok(data) {
|
|
4
|
-
return {
|
|
5
|
-
status: "ok",
|
|
6
|
-
data,
|
|
7
|
-
};
|
|
8
|
-
},
|
|
9
|
-
error(error) {
|
|
10
|
-
return {
|
|
11
|
-
status: "error",
|
|
12
|
-
error,
|
|
13
|
-
};
|
|
14
|
-
},
|
|
15
|
-
map: mapResult,
|
|
16
|
-
orThrow: (result) => {
|
|
17
|
-
if (result.status === "error")
|
|
18
|
-
throw result.error;
|
|
19
|
-
return result.data;
|
|
20
|
-
},
|
|
21
|
-
orThrowAsync: async (result) => {
|
|
22
|
-
return Result.orThrow(await result);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
function promiseToResult(promise) {
|
|
26
|
-
return promise.then(data => ({
|
|
27
|
-
status: "ok",
|
|
28
|
-
data,
|
|
29
|
-
}), error => ({
|
|
30
|
-
status: "error",
|
|
31
|
-
error,
|
|
32
|
-
}));
|
|
33
|
-
}
|
|
34
|
-
function mapResult(result, fn) {
|
|
35
|
-
if (result.status === "error")
|
|
36
|
-
return {
|
|
37
|
-
status: "error",
|
|
38
|
-
error: result.error,
|
|
39
|
-
};
|
|
40
|
-
if (result.status === "loading")
|
|
41
|
-
return {
|
|
42
|
-
status: "loading",
|
|
43
|
-
..."progress" in result ? { progress: result.progress } : {},
|
|
44
|
-
};
|
|
45
|
-
return Result.ok(fn(result.data));
|
|
46
|
-
}
|