@stackframe/stack 2.2.2 → 2.2.4

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.
Files changed (108) hide show
  1. package/dist/components/card-frame.js +2 -2
  2. package/dist/components/user-button.d.ts.map +1 -1
  3. package/dist/components/user-button.js +3 -1
  4. package/dist/components-page/account-settings.js +3 -3
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/package.json +3 -3
  8. package/dist/components/avatar.d.ts +0 -1
  9. package/dist/components/avatar.d.ts.map +0 -1
  10. package/dist/components/avatar.js +0 -1
  11. package/dist/components/card-header.d.ts +0 -6
  12. package/dist/components/card-header.d.ts.map +0 -1
  13. package/dist/components/card-header.js +0 -5
  14. package/dist/components/centered-card-header.d.ts +0 -6
  15. package/dist/components/centered-card-header.d.ts.map +0 -1
  16. package/dist/components/centered-card-header.js +0 -5
  17. package/dist/components/dashboard-frame.d.ts +0 -23
  18. package/dist/components/dashboard-frame.d.ts.map +0 -1
  19. package/dist/components/dashboard-frame.js +0 -20
  20. package/dist/components/divider-with-text.d.ts +0 -4
  21. package/dist/components/divider-with-text.d.ts.map +0 -1
  22. package/dist/components/divider-with-text.js +0 -6
  23. package/dist/components/email-verification.d.ts +0 -5
  24. package/dist/components/email-verification.d.ts.map +0 -1
  25. package/dist/components/email-verification.js +0 -29
  26. package/dist/components/logo.d.ts +0 -7
  27. package/dist/components/logo.d.ts.map +0 -1
  28. package/dist/components/logo.js +0 -7
  29. package/dist/components/oauth-callback.d.ts +0 -2
  30. package/dist/components/oauth-callback.d.ts.map +0 -1
  31. package/dist/components/oauth-callback.js +0 -17
  32. package/dist/components/password-reset.d.ts +0 -5
  33. package/dist/components/password-reset.d.ts.map +0 -1
  34. package/dist/components/password-reset.js +0 -37
  35. package/dist/components/sign-in.d.ts +0 -4
  36. package/dist/components/sign-in.d.ts.map +0 -1
  37. package/dist/components/sign-in.js +0 -20
  38. package/dist/components/sign-out.d.ts +0 -2
  39. package/dist/components/sign-out.d.ts.map +0 -1
  40. package/dist/components/sign-out.js +0 -13
  41. package/dist/components/sign-up.d.ts +0 -4
  42. package/dist/components/sign-up.d.ts.map +0 -1
  43. package/dist/components/sign-up.js +0 -20
  44. package/dist/components/stack-handler.d.ts +0 -9
  45. package/dist/components/stack-handler.d.ts.map +0 -1
  46. package/dist/components/stack-handler.js +0 -58
  47. package/dist/components-core/collapsble.d.ts +0 -5
  48. package/dist/components-core/collapsble.d.ts.map +0 -1
  49. package/dist/components-core/collapsble.js +0 -6
  50. package/dist/components-core/divider.d.ts +0 -5
  51. package/dist/components-core/divider.d.ts.map +0 -1
  52. package/dist/components-core/divider.js +0 -20
  53. package/dist/components-core-joy/card.d.ts +0 -3
  54. package/dist/components-core-joy/card.d.ts.map +0 -1
  55. package/dist/components-core-joy/card.js +0 -7
  56. package/dist/components-core-joy/divider.d.ts +0 -3
  57. package/dist/components-core-joy/divider.d.ts.map +0 -1
  58. package/dist/components-core-joy/divider.js +0 -7
  59. package/dist/elements/card-frame.d.ts +0 -7
  60. package/dist/elements/card-frame.d.ts.map +0 -1
  61. package/dist/elements/card-frame.js +0 -24
  62. package/dist/elements/card-header.d.ts +0 -6
  63. package/dist/elements/card-header.d.ts.map +0 -1
  64. package/dist/elements/card-header.js +0 -5
  65. package/dist/elements/credential-sign-in.d.ts +0 -2
  66. package/dist/elements/credential-sign-in.d.ts.map +0 -1
  67. package/dist/elements/credential-sign-in.js +0 -56
  68. package/dist/elements/credential-sign-up.d.ts +0 -2
  69. package/dist/elements/credential-sign-up.d.ts.map +0 -1
  70. package/dist/elements/credential-sign-up.js +0 -73
  71. package/dist/elements/divider-with-text.d.ts +0 -4
  72. package/dist/elements/divider-with-text.d.ts.map +0 -1
  73. package/dist/elements/divider-with-text.js +0 -6
  74. package/dist/elements/forgot-password.d.ts +0 -4
  75. package/dist/elements/forgot-password.d.ts.map +0 -1
  76. package/dist/elements/forgot-password.js +0 -32
  77. package/dist/elements/form-warning.d.ts +0 -4
  78. package/dist/elements/form-warning.d.ts.map +0 -1
  79. package/dist/elements/form-warning.js +0 -8
  80. package/dist/elements/message-card.d.ts +0 -7
  81. package/dist/elements/message-card.d.ts.map +0 -1
  82. package/dist/elements/message-card.js +0 -7
  83. package/dist/elements/oauth-button.d.ts +0 -5
  84. package/dist/elements/oauth-button.d.ts.map +0 -1
  85. package/dist/elements/oauth-button.js +0 -65
  86. package/dist/elements/oauth-group.d.ts +0 -4
  87. package/dist/elements/oauth-group.d.ts.map +0 -1
  88. package/dist/elements/oauth-group.js +0 -8
  89. package/dist/elements/password-field.d.ts +0 -3
  90. package/dist/elements/password-field.d.ts.map +0 -1
  91. package/dist/elements/password-field.js +0 -38
  92. package/dist/elements/password-reset-inner.d.ts +0 -5
  93. package/dist/elements/password-reset-inner.d.ts.map +0 -1
  94. package/dist/elements/password-reset-inner.js +0 -63
  95. package/dist/elements/redirect-message-card.d.ts +0 -5
  96. package/dist/elements/redirect-message-card.d.ts.map +0 -1
  97. package/dist/elements/redirect-message-card.js +0 -54
  98. package/dist/icons/logo.d.ts +0 -3
  99. package/dist/icons/logo.d.ts.map +0 -1
  100. package/dist/icons/logo.js +0 -7
  101. package/dist/providers/ui-provider.d.ts +0 -10
  102. package/dist/providers/ui-provider.js +0 -20
  103. package/dist/utils/react.d.ts +0 -2
  104. package/dist/utils/react.d.ts.map +0 -1
  105. package/dist/utils/react.js +0 -6
  106. package/dist/utils/results.d.ts +0 -25
  107. package/dist/utils/results.d.ts.map +0 -1
  108. package/dist/utils/results.js +0 -46
@@ -1 +0,0 @@
1
- {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/components-core-joy/card.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,wBAAgB,IAAI,CAAC,KAAK,EAAG,SAAS,2CAOrC"}
@@ -1,7 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Card as JoyCard, CardContent as JoyCardContent } from '@mui/joy';
4
- export function Card(props) {
5
- const { color, size, ref, ...validProps } = props;
6
- return _jsx(JoyCard, { ...validProps, children: _jsx(JoyCardContent, { children: props.children }) });
7
- }
@@ -1,3 +0,0 @@
1
- import React from "react";
2
- export declare const Separator: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@radix-ui/react-separator").SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLHRElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
3
- //# sourceMappingURL=divider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"divider.d.ts","sourceRoot":"","sources":["../../src/components-core-joy/divider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,SAAS,mRASpB,CAAC"}
@@ -1,7 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import React from "react";
4
- import { Separator as JoySeparator } from '@mui/joy';
5
- export const Separator = React.forwardRef(({ orientation, ref: _, ...validProps }, ref) => {
6
- return _jsx(JoySeparator, { ...validProps, orientation: orientation });
7
- });
@@ -1,7 +0,0 @@
1
- /// <reference types="react/experimental" />
2
- import React from "react";
3
- export default function CardFrame({ children, fullPage }: {
4
- children: React.ReactNode;
5
- fullPage?: boolean;
6
- }): string | number | boolean | Iterable<React.ReactNode> | Promise<React.AwaitedReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
7
- //# sourceMappingURL=card-frame.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"card-frame.d.ts","sourceRoot":"","sources":["../../src/elements/card-frame.tsx"],"names":[],"mappings":";AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,QAAQ,EACR,QAAa,EACd,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,wJA4BA"}
@@ -1,24 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Container } from "@stackframe/stack-ui";
4
- import { useEffect, useState } from "react";
5
- export default function CardFrame({ children, fullPage = true }) {
6
- const [hasNoParent, setHasNoParent] = useState(false);
7
- useEffect(() => {
8
- const component = document.getElementById('stack-card-frame');
9
- setHasNoParent(!component?.parentElement ||
10
- component?.parentElement === document.body ||
11
- component?.parentElement === document.documentElement);
12
- }, []);
13
- if (fullPage) {
14
- return (_jsx("div", { id: 'stack-card-frame', style: {
15
- height: hasNoParent ? '100vh' : '100%',
16
- display: 'flex',
17
- alignItems: 'center',
18
- justifyContent: 'center'
19
- }, children: _jsx(Container, { size: 360, children: children }) }));
20
- }
21
- else {
22
- return children;
23
- }
24
- }
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- export default function CardHeader({ children, title }: {
3
- children?: React.ReactNode;
4
- title: string;
5
- }): import("react/jsx-runtime").JSX.Element;
6
- //# sourceMappingURL=card-header.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"card-header.d.ts","sourceRoot":"","sources":["../../src/elements/card-header.tsx"],"names":[],"mappings":";AAEA,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,EAAE,QAAQ,EAAE,KAAK,EAAE,EACnB;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,2CAQ9C"}
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Text } from "@stackframe/stack-ui";
3
- export default function CardHeader({ children, title }) {
4
- return (_jsxs("div", { style: { textAlign: 'center', marginBottom: '24px' }, children: [_jsx(Text, { size: "xl", as: 'h2', style: { marginBottom: '5px' }, children: title }), children] }));
5
- }
@@ -1,2 +0,0 @@
1
- export default function CredentialSignIn(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=credential-sign-in.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"credential-sign-in.d.ts","sourceRoot":"","sources":["../../src/elements/credential-sign-in.tsx"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,gBAAgB,4CAkFvC"}
@@ -1,56 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { FormWarningText } from "./form-warning";
4
- import { PasswordField } from "./password-field";
5
- import { validateEmail } from "../utils/email";
6
- import { useStackApp } from "..";
7
- import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
8
- import { EmailPasswordMissMatchErrorCode, UserNotExistErrorCode } from "@stackframe/stack-shared/dist/utils/types";
9
- import { Button, Input, Label, Link } from "@stackframe/stack-ui";
10
- // Import or define the PasswordField, FormWarningText, and validateEmail utilities if they're custom components or functions.
11
- export default function CredentialSignIn() {
12
- const [email, setEmail] = useState('');
13
- const [emailError, setEmailError] = useState('');
14
- const [password, setPassword] = useState('');
15
- const [passwordError, setPasswordError] = useState('');
16
- const [loading, setLoading] = useState(false);
17
- const app = useStackApp();
18
- const onSubmit = async () => {
19
- if (!email) {
20
- setEmailError('Please enter your email');
21
- return;
22
- }
23
- if (!validateEmail(email)) {
24
- setEmailError('Please enter a valid email');
25
- return;
26
- }
27
- if (!password) {
28
- setPasswordError('Please enter your password');
29
- return;
30
- }
31
- setLoading(true);
32
- const errorCode = await app.signInWithCredential({ email, password });
33
- setLoading(false);
34
- switch (errorCode) {
35
- case UserNotExistErrorCode: {
36
- setEmailError('User does not exist');
37
- break;
38
- }
39
- case EmailPasswordMissMatchErrorCode: {
40
- setPasswordError('Wrong email or password');
41
- break;
42
- }
43
- case undefined: {
44
- // success
45
- break;
46
- }
47
- }
48
- };
49
- return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'stretch' }, children: [_jsx(Label, { htmlFor: "email", children: "Email" }), _jsx(Input, { id: "email", type: "email", name: "email", value: email, onChange: (e) => {
50
- setEmail(e.target.value);
51
- setEmailError('');
52
- } }), _jsx(FormWarningText, { text: emailError }), _jsx(Label, { htmlFor: "password", style: { marginTop: '1rem' }, children: "Password" }), _jsx(PasswordField, { id: "password", name: "password", value: password, onChange: (e) => {
53
- setPassword(e.target.value);
54
- setPasswordError('');
55
- } }), _jsx(FormWarningText, { text: passwordError }), _jsx(Link, { href: app.urls.forgotPassword, size: 'sm', style: { marginTop: '0.5rem' }, children: "Forgot password?" }), _jsx(Button, { style: { marginTop: '1.5rem' }, onClick: () => runAsynchronously(onSubmit), loading: loading, children: "Sign In" })] }));
56
- }
@@ -1,2 +0,0 @@
1
- export default function CredentialSignUp(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=credential-sign-up.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"credential-sign-up.d.ts","sourceRoot":"","sources":["../../src/elements/credential-sign-up.tsx"],"names":[],"mappings":"AAYA,MAAM,CAAC,OAAO,UAAU,gBAAgB,4CAwGvC"}
@@ -1,73 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { PasswordField } from "./password-field";
5
- import { FormWarningText } from "./form-warning";
6
- import { validateEmail } from "../utils/email";
7
- import { getPasswordError } from "@stackframe/stack-shared/dist/helpers/password";
8
- import { useStackApp } from "..";
9
- import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
10
- import { UserAlreadyExistErrorCode } from "@stackframe/stack-shared/dist/utils/types";
11
- import { Button, Label, Input } from "@stackframe/stack-ui";
12
- export default function CredentialSignUp() {
13
- const [email, setEmail] = useState('');
14
- const [emailError, setEmailError] = useState('');
15
- const [password, setPassword] = useState('');
16
- const [passwordError, setPasswordError] = useState('');
17
- const [passwordRepeat, setPasswordRepeat] = useState('');
18
- const [passwordRepeatError, setPasswordRepeatError] = useState('');
19
- const [loading, setLoading] = useState(false);
20
- const app = useStackApp();
21
- const onSubmit = async () => {
22
- if (!email) {
23
- setEmailError('Please enter your email');
24
- return;
25
- }
26
- if (!validateEmail(email)) {
27
- setEmailError('Please enter a valid email');
28
- return;
29
- }
30
- if (!password) {
31
- setPasswordError('Please enter your password');
32
- return;
33
- }
34
- if (!passwordRepeat) {
35
- setPasswordRepeatError('Please repeat your password');
36
- return;
37
- }
38
- if (password !== passwordRepeat) {
39
- setPasswordRepeatError('Passwords do not match');
40
- return;
41
- }
42
- const errorMessage = getPasswordError(password);
43
- if (errorMessage) {
44
- setPasswordError(errorMessage);
45
- return;
46
- }
47
- setLoading(true);
48
- const errorCode = await app.signUpWithCredential({ email, password });
49
- setLoading(false);
50
- switch (errorCode) {
51
- case UserAlreadyExistErrorCode: {
52
- setEmailError('User already exists');
53
- break;
54
- }
55
- case undefined: {
56
- // success
57
- break;
58
- }
59
- }
60
- };
61
- return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'stretch' }, children: [_jsx(Label, { htmlFor: "email", children: "Email" }), _jsx(Input, { id: "email", type: "email", name: "email", value: email, onChange: (e) => {
62
- setEmail(e.target.value);
63
- setEmailError('');
64
- } }), _jsx(FormWarningText, { text: emailError }), _jsx(Label, { htmlFor: "password", style: { marginTop: '1rem' }, children: "Password" }), _jsx(PasswordField, { id: "password", name: "password", value: password, onChange: (e) => {
65
- setPassword(e.target.value);
66
- setPasswordError('');
67
- setPasswordRepeatError('');
68
- } }), _jsx(FormWarningText, { text: passwordError }), _jsx(Label, { htmlFor: "repeat-password", style: { marginTop: '1rem' }, children: "Repeat Password" }), _jsx(PasswordField, { id: "repeat-password", name: "repeat-password", value: passwordRepeat, onChange: (e) => {
69
- setPasswordRepeat(e.target.value);
70
- setPasswordError('');
71
- setPasswordRepeatError('');
72
- } }), _jsx(FormWarningText, { text: passwordRepeatError }), _jsx(Button, { style: { marginTop: '1.5rem' }, onClick: () => runAsynchronously(onSubmit), loading: loading, children: "Sign Up" })] }));
73
- }
@@ -1,4 +0,0 @@
1
- export default function DividerWithText({ text }: {
2
- text: string;
3
- }): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=divider-with-text.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"divider-with-text.d.ts","sourceRoot":"","sources":["../../src/elements/divider-with-text.tsx"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,2CAYjE"}
@@ -1,6 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Divider, Text } from "@stackframe/stack-ui";
4
- export default function DividerWithText({ text }) {
5
- return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', marginTop: '16px', marginBottom: '16px' }, children: [_jsx("div", { style: { flex: 1 }, children: _jsx(Divider, {}) }), _jsx(Text, { style: { padding: '0 16px' }, variant: "secondary", children: text }), _jsx("div", { style: { flex: 1 }, children: _jsx(Divider, {}) })] }));
6
- }
@@ -1,4 +0,0 @@
1
- export default function ForgotPassword({ onSent }: {
2
- onSent?: () => void;
3
- }): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=forgot-password.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"forgot-password.d.ts","sourceRoot":"","sources":["../../src/elements/forgot-password.tsx"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,2CA8CzE"}
@@ -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 "./form-warning";
5
- import { validateEmail } from "../utils/email";
6
- import { useStackApp } from "..";
7
- import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
8
- import { Button, Input, Label } from "@stackframe/stack-ui";
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", { style: { display: 'flex', flexDirection: 'column', alignItems: 'stretch' }, children: [_jsx(Label, { htmlFor: "email", children: "Your Email" }), _jsx(Input, { id: "email", type: "email", name: "email", value: email, onChange: (e) => {
29
- setEmail(e.target.value);
30
- setEmailError('');
31
- } }), _jsx(FormWarningText, { text: emailError }), _jsx(Button, { style: { marginTop: '1.5rem' }, onClick: () => runAsynchronously(onSubmit()), loading: sending, children: "Send Email" })] }));
32
- }
@@ -1,4 +0,0 @@
1
- export declare function FormWarningText({ text }: {
2
- text?: string;
3
- }): import("react/jsx-runtime").JSX.Element | null;
4
- //# sourceMappingURL=form-warning.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"form-warning.d.ts","sourceRoot":"","sources":["../../src/elements/form-warning.tsx"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,kDAS1D"}
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Text } from "@stackframe/stack-ui";
3
- export function FormWarningText({ text }) {
4
- if (!text) {
5
- return null;
6
- }
7
- return (_jsx(Text, { size: "sm", variant: "warning", children: text }));
8
- }
@@ -1,7 +0,0 @@
1
- import React from "react";
2
- export default function MessageCard({ children, title, fullPage }: {
3
- children?: React.ReactNode;
4
- title: string;
5
- fullPage?: boolean;
6
- }): import("react/jsx-runtime").JSX.Element;
7
- //# sourceMappingURL=message-card.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"message-card.d.ts","sourceRoot":"","sources":["../../src/elements/message-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,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,7 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import CardFrame from "./card-frame";
4
- import { Text } from "@stackframe/stack-ui";
5
- export default function MessageCard({ children, title, fullPage = false }) {
6
- return (_jsx(CardFrame, { fullPage: fullPage, children: _jsxs("div", { style: { textAlign: 'center' }, children: [_jsx(Text, { size: "xl", as: 'h2', style: { marginBottom: '24px' }, children: title }), children] }) }));
7
- }
@@ -1,5 +0,0 @@
1
- export default function OAuthButton({ provider, type, }: {
2
- provider: string;
3
- type: 'signin' | 'signup';
4
- }): import("react/jsx-runtime").JSX.Element;
5
- //# sourceMappingURL=oauth-button.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oauth-button.d.ts","sourceRoot":"","sources":["../../src/elements/oauth-button.tsx"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,IAAI,GACL,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC3B,2CA6GA"}
@@ -1,65 +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, useDesign } from '@stackframe/stack-ui';
7
- import Color from 'color';
8
- const iconSize = 22;
9
- export default function OAuthButton({ provider, type, }) {
10
- const { colors } = useDesign();
11
- const stackApp = useStackApp();
12
- let style;
13
- switch (provider) {
14
- case 'google': {
15
- style = {
16
- backgroundColor: '#fff',
17
- name: 'Google',
18
- border: Color(colors.primaryBgColor).isDark() ? undefined : '1px solid #ccc',
19
- 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" })] })),
20
- };
21
- break;
22
- }
23
- case 'github': {
24
- style = {
25
- backgroundColor: '#111',
26
- border: Color(colors.primaryBgColor).isDark() ? '1px solid #666' : undefined,
27
- name: 'GitHub',
28
- icon: (_jsx(FaGithub, { color: "#fff", size: iconSize })),
29
- };
30
- break;
31
- }
32
- case 'facebook': {
33
- style = {
34
- backgroundColor: '#1877F2',
35
- name: 'Facebook',
36
- icon: (_jsx(FaFacebook, { color: "#fff", size: iconSize })),
37
- };
38
- break;
39
- }
40
- case 'apple': {
41
- style = {
42
- backgroundColor: '#000',
43
- name: 'Apple',
44
- icon: (_jsx(FaApple, { color: "#fff", size: iconSize })),
45
- };
46
- break;
47
- }
48
- case 'microsoft': {
49
- style = {
50
- backgroundColor: '#2f2f2f',
51
- name: 'Microsoft',
52
- 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" })] })),
53
- };
54
- break;
55
- }
56
- default: {
57
- style = {
58
- backgroundColor: '#000',
59
- name: provider,
60
- icon: null
61
- };
62
- }
63
- }
64
- return (_jsx(Button, { color: style.backgroundColor, style: { border: style.border }, onClick: () => runAsynchronously(stackApp.signInWithOAuth(provider)), children: _jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%' }, children: [style.icon, _jsxs("span", { style: { flexGrow: 1 }, children: [type === 'signup' ? 'Sign up with ' : 'Sign in with ', style.name] }), _jsx("div", { style: { visibility: 'hidden' }, children: style.icon })] }) }));
65
- }
@@ -1,4 +0,0 @@
1
- export default function OAuthGroup({ type, }: {
2
- type: 'signin' | 'signup';
3
- }): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=oauth-group.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oauth-group.d.ts","sourceRoot":"","sources":["../../src/elements/oauth-group.tsx"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,IAAI,GACL,EAAE;IACD,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC3B,2CAWA"}
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useStackApp } from "..";
3
- import OAuthButton from "./oauth-button";
4
- export default function OAuthGroup({ type, }) {
5
- const stackApp = useStackApp();
6
- const project = stackApp.useProject();
7
- return (_jsx("div", { style: { gap: '16px', display: 'flex', flexDirection: 'column', alignItems: 'stretch' }, children: project.oauthProviders.filter(p => p.enabled).map(p => (_jsx(OAuthButton, { provider: p.id, type: type }, p.id))) }));
8
- }
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const PasswordField: import("react").ForwardRefExoticComponent<import("react").InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
3
- //# sourceMappingURL=password-field.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"password-field.d.ts","sourceRoot":"","sources":["../../src/elements/password-field.tsx"],"names":[],"mappings":";AAIA,eAAO,MAAM,aAAa,oJAwDxB,CAAC"}
@@ -1,38 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Input } from '@stackframe/stack-ui';
3
- import { forwardRef, useRef, useState } from 'react';
4
- import { HiEye, HiEyeOff } from 'react-icons/hi';
5
- export const PasswordField = forwardRef(({ id, name, ...props }, ref) => {
6
- const [isOpen, setIsOpen] = useState(false);
7
- const inputRef = useRef(null);
8
- const mergeRef = (node) => {
9
- if (ref) {
10
- if (typeof ref === 'function') {
11
- ref(node);
12
- }
13
- else {
14
- ref.current = node;
15
- }
16
- }
17
- inputRef.current = node;
18
- };
19
- const onClickReveal = () => {
20
- setIsOpen(!isOpen);
21
- const currentInput = inputRef.current;
22
- if (currentInput) {
23
- currentInput.focus({ preventScroll: true });
24
- }
25
- };
26
- return (_jsxs("div", { style: { position: 'relative', display: 'flex' }, children: [_jsx(Input, { id: id, ref: mergeRef, name: name, type: isOpen ? 'text' : 'password', autoComplete: "current-password", required: true, style: { flex: 1 }, ...props }), _jsx("button", { tabIndex: -1, type: "button", style: {
27
- position: 'absolute',
28
- backgroundColor: 'transparent',
29
- border: 'none',
30
- top: 0,
31
- right: 0,
32
- bottom: 0,
33
- display: 'flex',
34
- alignItems: 'center',
35
- paddingRight: '12px'
36
- }, onClick: onClickReveal, "aria-label": isOpen ? 'Mask password' : 'Reveal password', children: isOpen ? _jsx(HiEyeOff, {}) : _jsx(HiEye, {}) })] }));
37
- });
38
- PasswordField.displayName = 'PasswordField';
@@ -1,5 +0,0 @@
1
- export default function PasswordResetInner({ code, fullPage }: {
2
- code: string;
3
- fullPage?: boolean;
4
- }): import("react/jsx-runtime").JSX.Element;
5
- //# sourceMappingURL=password-reset-inner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"password-reset-inner.d.ts","sourceRoot":"","sources":["../../src/elements/password-reset-inner.tsx"],"names":[],"mappings":"AAeA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,EAAE,IAAI,EAAE,QAAgB,EAAE,EAC1B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,2CAyFrC"}
@@ -1,63 +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 "./password-field";
7
- import { FormWarningText } from "./form-warning";
8
- import RedirectMessageCard from "./redirect-message-card";
9
- import MessageCard from "./message-card";
10
- import CardFrame from "./card-frame";
11
- import CardHeader from "./card-header";
12
- import { Button, Label, Text } from "@stackframe/stack-ui";
13
- import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
14
- export default function PasswordResetInner({ code, fullPage = false }) {
15
- const [password, setPassword] = useState('');
16
- const [passwordError, setPasswordError] = useState('');
17
- const [passwordRepeat, setPasswordRepeat] = useState('');
18
- const [passwordRepeatError, setPasswordRepeatError] = useState('');
19
- const [finished, setFinished] = useState(false);
20
- const [resetError, setResetError] = useState(false);
21
- const stackApp = useStackApp();
22
- const onSubmit = async () => {
23
- if (!password) {
24
- setPasswordError('Please enter your password');
25
- return;
26
- }
27
- if (!passwordRepeat) {
28
- setPasswordRepeatError('Please repeat your password');
29
- return;
30
- }
31
- if (password !== passwordRepeat) {
32
- setPasswordRepeatError('Passwords do not match');
33
- return;
34
- }
35
- const errorMessage = getPasswordError(password);
36
- if (errorMessage) {
37
- setPasswordError(errorMessage);
38
- return;
39
- }
40
- const errorCode = await stackApp.resetPassword({ password, code });
41
- // this should not happen, the outer component should verify the code before rendering this component
42
- if (errorCode) {
43
- setResetError(true);
44
- return;
45
- }
46
- setFinished(true);
47
- };
48
- if (finished) {
49
- return _jsx(RedirectMessageCard, { type: 'passwordReset', fullPage: fullPage });
50
- }
51
- if (resetError) {
52
- return (_jsx(MessageCard, { title: "Failed to reset password", fullPage: fullPage, children: _jsx(Text, { children: "Failed to reset password. Please request a new password reset link" }) }));
53
- }
54
- return (_jsxs(CardFrame, { fullPage: fullPage, children: [_jsx(CardHeader, { title: "Reset Your Password" }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'stretch' }, children: [_jsx(Label, { htmlFor: "password", children: "New Password" }), _jsx(PasswordField, { id: "password", name: "password", value: password, onChange: (e) => {
55
- setPassword(e.target.value);
56
- setPasswordError('');
57
- setPasswordRepeatError('');
58
- } }), _jsx(FormWarningText, { text: passwordError }), _jsx(Label, { htmlFor: "repeat-password", style: { marginTop: "1rem" }, children: "Repeat New Password" }), _jsx(PasswordField, { id: "repeat-password", name: "repeat-password", value: passwordRepeat, onChange: (e) => {
59
- setPasswordRepeat(e.target.value);
60
- setPasswordError('');
61
- setPasswordRepeatError('');
62
- } }), _jsx(FormWarningText, { text: passwordRepeatError }), _jsx(Button, { style: { marginTop: '1.5rem' }, onClick: () => runAsynchronously(onSubmit()), children: "Reset Password" })] })] }));
63
- }
@@ -1,5 +0,0 @@
1
- export default function RedirectMessageCard({ type, fullPage, }: {
2
- type: 'signedIn' | 'signedOut' | 'emailSent' | 'passwordReset' | 'emailVerified';
3
- fullPage?: boolean;
4
- }): import("react/jsx-runtime").JSX.Element;
5
- //# sourceMappingURL=redirect-message-card.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redirect-message-card.d.ts","sourceRoot":"","sources":["../../src/elements/redirect-message-card.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,2CAoEA"}
@@ -1,54 +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 "./message-card";
6
- import { Text, Button } from "@stackframe/stack-ui";
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
- primaryUrl = stackApp.urls.home;
20
- secondaryUrl = stackApp.urls.signOut;
21
- primaryButton = "Go to Home";
22
- secondaryButton = "Sign Out";
23
- break;
24
- }
25
- case 'signedOut': {
26
- title = "You are not currently signed in.";
27
- primaryUrl = stackApp.urls.home;
28
- primaryButton = "Go to Home";
29
- break;
30
- }
31
- case 'emailSent': {
32
- title = "Email sent!";
33
- message = 'Please check your inbox. Make sure to check your spam folder.';
34
- primaryUrl = stackApp.urls.home;
35
- primaryButton = "Go to Home";
36
- break;
37
- }
38
- case 'passwordReset': {
39
- title = "Password reset successfully!";
40
- message = 'Your password has been reset. You can now sign in with your new password.';
41
- primaryUrl = stackApp.urls.signIn;
42
- primaryButton = "Go to Sign In";
43
- break;
44
- }
45
- case 'emailVerified': {
46
- title = "Email verified!";
47
- message = 'Your have successfully verified your email.';
48
- primaryUrl = stackApp.urls.home;
49
- primaryButton = "Go to Home";
50
- break;
51
- }
52
- }
53
- return (_jsxs(MessageCard, { title: title, fullPage: fullPage, children: [message && _jsx(Text, { children: message }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: '16px', marginTop: 20 }, children: [secondaryButton && (_jsx(Button, { variant: "secondary", onClick: () => router.push(stackApp.urls.signOut.toString()), children: secondaryButton })), _jsx(Button, { onClick: () => router.push(primaryUrl.toString()), children: primaryButton })] })] }));
54
- }