@stackframe/stack 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/dist/components/card-frame.d.ts +7 -0
  2. package/dist/components/card-frame.d.ts.map +1 -0
  3. package/dist/components/card-frame.js +24 -0
  4. package/dist/{elements/CardHeader.d.ts → components/card-header.d.ts} +1 -0
  5. package/dist/components/card-header.d.ts.map +1 -0
  6. package/dist/components/card-header.js +5 -0
  7. package/dist/{elements/CredentialSignIn.d.ts → components/credential-sign-in.d.ts} +1 -0
  8. package/dist/components/credential-sign-in.d.ts.map +1 -0
  9. package/dist/components/credential-sign-in.js +56 -0
  10. package/dist/{elements/CredentialSignUp.d.ts → components/credential-sign-up.d.ts} +1 -0
  11. package/dist/components/credential-sign-up.d.ts.map +1 -0
  12. package/dist/{elements/CredentialSignUp.js → components/credential-sign-up.js} +15 -15
  13. package/dist/{elements/DividerWithText.d.ts → components/divider-with-text.d.ts} +1 -0
  14. package/dist/components/divider-with-text.d.ts.map +1 -0
  15. package/dist/components/divider-with-text.js +6 -0
  16. package/dist/components/email-verification.d.ts +5 -0
  17. package/dist/components/email-verification.d.ts.map +1 -0
  18. package/dist/components/{EmailVerification.js → email-verification.js} +2 -2
  19. package/dist/{elements/ForgotPassword.d.ts → components/forgot-password.d.ts} +1 -0
  20. package/dist/components/forgot-password.d.ts.map +1 -0
  21. package/dist/components/forgot-password.js +32 -0
  22. package/dist/components/form-warning.d.ts +4 -0
  23. package/dist/components/form-warning.d.ts.map +1 -0
  24. package/dist/components/form-warning.js +9 -0
  25. package/dist/{elements/MessageCard.d.ts → components/message-card.d.ts} +1 -0
  26. package/dist/components/message-card.d.ts.map +1 -0
  27. package/dist/components/message-card.js +7 -0
  28. package/dist/{elements/OAuthButton.d.ts → components/oauth-button.d.ts} +1 -0
  29. package/dist/components/oauth-button.d.ts.map +1 -0
  30. package/dist/components/oauth-button.js +66 -0
  31. package/dist/components/oauth-callback.d.ts +2 -0
  32. package/dist/components/oauth-callback.d.ts.map +1 -0
  33. package/dist/components/{OAuthCallback.js → oauth-callback.js} +1 -1
  34. package/dist/{elements/OAuthGroup.d.ts → components/oauth-group.d.ts} +1 -0
  35. package/dist/components/oauth-group.d.ts.map +1 -0
  36. package/dist/components/oauth-group.js +9 -0
  37. package/dist/components/password-field.d.ts +4 -0
  38. package/dist/components/password-field.d.ts.map +1 -0
  39. package/dist/components/password-field.js +41 -0
  40. package/dist/{elements/PasswordResetInner.d.ts → components/password-reset-inner.d.ts} +1 -0
  41. package/dist/components/password-reset-inner.d.ts.map +1 -0
  42. package/dist/{elements/PasswordResetInner.js → components/password-reset-inner.js} +18 -16
  43. package/dist/components/password-reset.d.ts +5 -0
  44. package/dist/components/password-reset.d.ts.map +1 -0
  45. package/dist/components/{PasswordReset.js → password-reset.js} +6 -5
  46. package/dist/{elements/RedirectMessageCard.d.ts → components/redirect-message-card.d.ts} +1 -0
  47. package/dist/components/redirect-message-card.d.ts.map +1 -0
  48. package/dist/{elements/RedirectMessageCard.js → components/redirect-message-card.js} +3 -4
  49. package/dist/components/sign-in.d.ts +4 -0
  50. package/dist/components/sign-in.d.ts.map +1 -0
  51. package/dist/components/sign-in.js +20 -0
  52. package/dist/components/sign-out.d.ts +2 -0
  53. package/dist/components/sign-out.d.ts.map +1 -0
  54. package/dist/components/{SignOut.js → sign-out.js} +1 -1
  55. package/dist/components/sign-up.d.ts +4 -0
  56. package/dist/components/sign-up.d.ts.map +1 -0
  57. package/dist/components/sign-up.js +20 -0
  58. package/dist/components/stack-handler.d.ts +9 -0
  59. package/dist/components/stack-handler.d.ts.map +1 -0
  60. package/dist/components/{StackHandler.js → stack-handler.js} +7 -7
  61. package/dist/components-core/button.d.ts +10 -0
  62. package/dist/components-core/button.d.ts.map +1 -0
  63. package/dist/components-core/button.js +115 -0
  64. package/dist/components-core/container.d.ts +6 -0
  65. package/dist/components-core/container.d.ts.map +1 -0
  66. package/dist/components-core/container.js +19 -0
  67. package/dist/components-core/divider.d.ts +7 -0
  68. package/dist/components-core/divider.d.ts.map +1 -0
  69. package/dist/components-core/divider.js +17 -0
  70. package/dist/components-core/index.d.ts +17 -0
  71. package/dist/components-core/index.d.ts.map +1 -0
  72. package/dist/components-core/index.js +32 -0
  73. package/dist/components-core/input.d.ts +5 -0
  74. package/dist/components-core/input.d.ts.map +1 -0
  75. package/dist/components-core/input.js +45 -0
  76. package/dist/components-core/label.d.ts +6 -0
  77. package/dist/components-core/label.d.ts.map +1 -0
  78. package/dist/components-core/label.js +22 -0
  79. package/dist/components-core/link.d.ts +9 -0
  80. package/dist/components-core/link.d.ts.map +1 -0
  81. package/dist/components-core/link.js +18 -0
  82. package/dist/components-core/text.d.ts +9 -0
  83. package/dist/components-core/text.d.ts.map +1 -0
  84. package/dist/components-core/text.js +42 -0
  85. package/dist/components-core-joy/button.d.ts +3 -0
  86. package/dist/components-core-joy/button.d.ts.map +1 -0
  87. package/dist/components-core-joy/button.js +26 -0
  88. package/dist/components-core-joy/divider.d.ts +3 -0
  89. package/dist/components-core-joy/divider.d.ts.map +1 -0
  90. package/dist/components-core-joy/divider.js +7 -0
  91. package/dist/components-core-joy/input.d.ts +3 -0
  92. package/dist/components-core-joy/input.d.ts.map +1 -0
  93. package/dist/components-core-joy/input.js +7 -0
  94. package/dist/components-core-joy/text.d.ts +3 -0
  95. package/dist/components-core-joy/text.d.ts.map +1 -0
  96. package/dist/components-core-joy/text.js +28 -0
  97. package/dist/{components/EmailVerification.d.ts → components-page/email-verification.d.ts} +1 -0
  98. package/dist/components-page/email-verification.d.ts.map +1 -0
  99. package/dist/components-page/email-verification.js +29 -0
  100. package/dist/{components/ForgotPassword.d.ts → components-page/forgot-password.d.ts} +1 -0
  101. package/dist/components-page/forgot-password.d.ts.map +1 -0
  102. package/dist/{components/ForgotPassword.js → components-page/forgot-password.js} +6 -6
  103. package/dist/{components/OAuthCallback.d.ts → components-page/oauth-callback.d.ts} +1 -0
  104. package/dist/components-page/oauth-callback.d.ts.map +1 -0
  105. package/dist/components-page/oauth-callback.js +17 -0
  106. package/dist/{components/PasswordReset.d.ts → components-page/password-reset.d.ts} +1 -0
  107. package/dist/components-page/password-reset.d.ts.map +1 -0
  108. package/dist/components-page/password-reset.js +37 -0
  109. package/dist/{components/SignIn.d.ts → components-page/sign-in.d.ts} +1 -0
  110. package/dist/components-page/sign-in.d.ts.map +1 -0
  111. package/dist/components-page/sign-in.js +20 -0
  112. package/dist/{components/SignOut.d.ts → components-page/sign-out.d.ts} +1 -0
  113. package/dist/components-page/sign-out.d.ts.map +1 -0
  114. package/dist/components-page/sign-out.js +13 -0
  115. package/dist/{components/SignUp.d.ts → components-page/sign-up.d.ts} +1 -0
  116. package/dist/components-page/sign-up.d.ts.map +1 -0
  117. package/dist/components-page/sign-up.js +20 -0
  118. package/dist/{components/StackHandler.d.ts → components-page/stack-handler.d.ts} +1 -0
  119. package/dist/components-page/stack-handler.d.ts.map +1 -0
  120. package/dist/components-page/stack-handler.js +58 -0
  121. package/dist/elements/card-frame.d.ts +7 -0
  122. package/dist/elements/card-frame.d.ts.map +1 -0
  123. package/dist/elements/card-frame.js +24 -0
  124. package/dist/elements/card-header.d.ts +6 -0
  125. package/dist/elements/card-header.d.ts.map +1 -0
  126. package/dist/elements/card-header.js +5 -0
  127. package/dist/elements/credential-sign-in.d.ts +2 -0
  128. package/dist/elements/credential-sign-in.d.ts.map +1 -0
  129. package/dist/elements/{CredentialSignIn.js → credential-sign-in.js} +10 -11
  130. package/dist/elements/credential-sign-up.d.ts +2 -0
  131. package/dist/elements/credential-sign-up.d.ts.map +1 -0
  132. package/dist/elements/credential-sign-up.js +73 -0
  133. package/dist/elements/divider-with-text.d.ts +4 -0
  134. package/dist/elements/divider-with-text.d.ts.map +1 -0
  135. package/dist/elements/divider-with-text.js +6 -0
  136. package/dist/elements/forgot-password.d.ts +4 -0
  137. package/dist/elements/forgot-password.d.ts.map +1 -0
  138. package/dist/elements/forgot-password.js +32 -0
  139. package/dist/elements/{FormWarning.d.ts → form-warning.d.ts} +1 -0
  140. package/dist/elements/form-warning.d.ts.map +1 -0
  141. package/dist/elements/{FormWarning.js → form-warning.js} +2 -1
  142. package/dist/elements/message-card.d.ts +7 -0
  143. package/dist/elements/message-card.d.ts.map +1 -0
  144. package/dist/elements/message-card.js +7 -0
  145. package/dist/elements/oauth-button.d.ts +5 -0
  146. package/dist/elements/oauth-button.d.ts.map +1 -0
  147. package/dist/elements/{OAuthButton.js → oauth-button.js} +7 -9
  148. package/dist/elements/oauth-group.d.ts +4 -0
  149. package/dist/elements/oauth-group.d.ts.map +1 -0
  150. package/dist/elements/oauth-group.js +8 -0
  151. package/dist/elements/{PasswordField.d.ts → password-field.d.ts} +1 -0
  152. package/dist/elements/password-field.d.ts.map +1 -0
  153. package/dist/elements/password-field.js +38 -0
  154. package/dist/elements/password-reset-inner.d.ts +5 -0
  155. package/dist/elements/password-reset-inner.d.ts.map +1 -0
  156. package/dist/elements/password-reset-inner.js +63 -0
  157. package/dist/elements/redirect-message-card.d.ts +5 -0
  158. package/dist/elements/redirect-message-card.d.ts.map +1 -0
  159. package/dist/elements/redirect-message-card.js +54 -0
  160. package/dist/index.d.ts +18 -8
  161. package/dist/index.d.ts.map +1 -1
  162. package/dist/index.js +17 -9
  163. package/dist/lib/auth.d.ts +1 -0
  164. package/dist/lib/cookie.d.ts +1 -0
  165. package/dist/lib/hooks.d.ts +1 -0
  166. package/dist/lib/hooks.js +1 -1
  167. package/dist/lib/stack-app.d.ts +1 -0
  168. package/dist/providers/component-provider.d.ts +25 -0
  169. package/dist/providers/component-provider.d.ts.map +1 -0
  170. package/dist/providers/component-provider.js +29 -0
  171. package/dist/providers/design-provider.d.ts +41 -0
  172. package/dist/providers/design-provider.d.ts.map +1 -0
  173. package/dist/providers/design-provider.js +68 -0
  174. package/dist/providers/joy-provider.d.ts +17 -0
  175. package/dist/providers/joy-provider.d.ts.map +1 -0
  176. package/dist/providers/joy-provider.js +27 -0
  177. package/dist/providers/{StackProviderClient.d.ts → stack-provider-client.d.ts} +1 -0
  178. package/dist/providers/stack-provider-client.d.ts.map +1 -0
  179. package/dist/providers/{StackProvider.d.ts → stack-provider.d.ts} +3 -2
  180. package/dist/providers/stack-provider.d.ts.map +1 -0
  181. package/dist/providers/{StackProvider.js → stack-provider.js} +1 -1
  182. package/dist/providers/styled-components-registry.d.ts +5 -0
  183. package/dist/providers/styled-components-registry.d.ts.map +1 -0
  184. package/dist/providers/styled-components-registry.js +18 -0
  185. package/dist/providers/theme-provider.d.ts +11 -0
  186. package/dist/providers/theme-provider.d.ts.map +1 -0
  187. package/dist/providers/theme-provider.js +20 -0
  188. package/dist/providers/ui-provider.d.ts +10 -0
  189. package/dist/providers/ui-provider.js +20 -0
  190. package/dist/utils/constants.d.ts +41 -0
  191. package/dist/utils/constants.d.ts.map +1 -0
  192. package/dist/utils/constants.js +22 -0
  193. package/dist/utils/email.d.ts +1 -0
  194. package/dist/utils/email.d.ts.map +1 -1
  195. package/dist/utils/next.d.ts +1 -0
  196. package/dist/utils/next.d.ts.map +1 -1
  197. package/dist/utils/react.d.ts +1 -0
  198. package/dist/utils/react.d.ts.map +1 -1
  199. package/dist/utils/results.d.ts +1 -0
  200. package/dist/utils/results.d.ts.map +1 -1
  201. package/dist/utils/url.d.ts +1 -0
  202. package/dist/utils/url.d.ts.map +1 -1
  203. package/package.json +19 -24
  204. package/dist/components/EmailVerification.d.ts.map +0 -1
  205. package/dist/components/ForgotPassword.d.ts.map +0 -1
  206. package/dist/components/OAuthCallback.d.ts.map +0 -1
  207. package/dist/components/PasswordReset.d.ts.map +0 -1
  208. package/dist/components/SignIn.d.ts.map +0 -1
  209. package/dist/components/SignIn.js +0 -20
  210. package/dist/components/SignOut.d.ts.map +0 -1
  211. package/dist/components/SignUp.d.ts.map +0 -1
  212. package/dist/components/SignUp.js +0 -19
  213. package/dist/components/StackHandler.d.ts.map +0 -1
  214. package/dist/elements/Button.d.ts +0 -10
  215. package/dist/elements/Button.d.ts.map +0 -1
  216. package/dist/elements/Button.js +0 -18
  217. package/dist/elements/CardFrame.d.ts +0 -5
  218. package/dist/elements/CardFrame.d.ts.map +0 -1
  219. package/dist/elements/CardFrame.js +0 -10
  220. package/dist/elements/CardHeader.d.ts.map +0 -1
  221. package/dist/elements/CardHeader.js +0 -4
  222. package/dist/elements/CredentialSignIn.d.ts.map +0 -1
  223. package/dist/elements/CredentialSignUp.d.ts.map +0 -1
  224. package/dist/elements/DividerWithText.d.ts.map +0 -1
  225. package/dist/elements/DividerWithText.js +0 -5
  226. package/dist/elements/ForgotPassword.d.ts.map +0 -1
  227. package/dist/elements/ForgotPassword.js +0 -32
  228. package/dist/elements/FormWarning.d.ts.map +0 -1
  229. package/dist/elements/MessageCard.d.ts.map +0 -1
  230. package/dist/elements/MessageCard.js +0 -5
  231. package/dist/elements/OAuthButton.d.ts.map +0 -1
  232. package/dist/elements/OAuthGroup.d.ts.map +0 -1
  233. package/dist/elements/OAuthGroup.js +0 -8
  234. package/dist/elements/PasswordField.d.ts.map +0 -1
  235. package/dist/elements/PasswordField.js +0 -27
  236. package/dist/elements/PasswordResetInner.d.ts.map +0 -1
  237. package/dist/elements/RedirectMessageCard.d.ts.map +0 -1
  238. package/dist/providers/StackProvider.d.ts.map +0 -1
  239. package/dist/providers/StackProviderClient.d.ts.map +0 -1
  240. package/dist/tailwind.css +0 -1299
  241. package/dist/utils/types.d.ts +0 -4
  242. package/dist/utils/types.d.ts.map +0 -1
  243. package/dist/utils/types.js +0 -1
  244. /package/dist/providers/{StackProviderClient.js → stack-provider-client.js} +0 -0
@@ -0,0 +1,7 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-frame.d.ts","sourceRoot":"","sources":["../../src/components/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"}
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Container } from "../components-core";
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
+ }
@@ -3,3 +3,4 @@ export default function CardHeader({ children, title }: {
3
3
  children?: React.ReactNode;
4
4
  title: string;
5
5
  }): import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=card-header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-header.d.ts","sourceRoot":"","sources":["../../src/components/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"}
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Text } from "../components-core";
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 +1,2 @@
1
1
  export default function CredentialSignIn(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=credential-sign-in.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-sign-in.d.ts","sourceRoot":"","sources":["../../src/components/credential-sign-in.tsx"],"names":[],"mappings":"AAWA,MAAM,CAAC,OAAO,UAAU,gBAAgB,4CAkFvC"}
@@ -0,0 +1,56 @@
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 PasswordField from "./password-field";
6
+ import { validateEmail } from "../utils/email";
7
+ import { useStackApp } from "..";
8
+ import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
9
+ import { EmailPasswordMissMatchErrorCode, UserNotExistErrorCode } from "@stackframe/stack-shared/dist/utils/types";
10
+ import { Button, Input, Label, Link } from "../components-core";
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 +1,2 @@
1
1
  export default function CredentialSignUp(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=credential-sign-up.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-sign-up.d.ts","sourceRoot":"","sources":["../../src/components/credential-sign-up.tsx"],"names":[],"mappings":"AAYA,MAAM,CAAC,OAAO,UAAU,gBAAgB,4CAwGvC"}
@@ -1,14 +1,14 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
- import { PasswordField } from "./PasswordField";
5
- import { FormWarningText } from "./FormWarning";
4
+ import PasswordField from "./password-field";
5
+ import FormWarningText from "./form-warning";
6
6
  import { validateEmail } from "../utils/email";
7
7
  import { getPasswordError } from "@stackframe/stack-shared/dist/helpers/password";
8
8
  import { useStackApp } from "..";
9
9
  import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
10
- import Button from "./Button";
11
10
  import { UserAlreadyExistErrorCode } from "@stackframe/stack-shared/dist/utils/types";
11
+ import { Button, Label, Input } from "../components-core";
12
12
  export default function CredentialSignUp() {
13
13
  const [email, setEmail] = useState('');
14
14
  const [emailError, setEmailError] = useState('');
@@ -58,16 +58,16 @@ export default function CredentialSignUp() {
58
58
  }
59
59
  }
60
60
  };
61
- 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: "Email" }), _jsx("input", { className: "wl_input wl_input-bordered", id: "email", type: "email", name: "email", value: email, onChange: (e) => {
62
- setEmail(e.target.value);
63
- setEmailError('');
64
- } }), _jsx(FormWarningText, { text: emailError })] }), _jsxs("div", { className: "wl_form-control", children: [_jsx("label", { className: "wl_label", htmlFor: "password", 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 })] }), _jsxs("div", { className: "wl_form-control", children: [_jsx("label", { className: "wl_label", htmlFor: "repeat-password", 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("div", { className: "wl_flex wl_flex-col wl_items-stretch", children: _jsx(Button, { className: "wl_btn-primary wl_mt-6", onClick: () => runAsynchronously(onSubmit), loading: loading, children: "Sign Up" }) })] }));
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
73
  }
@@ -1,3 +1,4 @@
1
1
  export default function DividerWithText({ text }: {
2
2
  text: string;
3
3
  }): import("react/jsx-runtime").JSX.Element;
4
+ //# sourceMappingURL=divider-with-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"divider-with-text.d.ts","sourceRoot":"","sources":["../../src/components/divider-with-text.tsx"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,2CAYjE"}
@@ -0,0 +1,6 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Divider, Text } from "../components-core";
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
+ }
@@ -0,0 +1,5 @@
1
+ export default function EmailVerification({ searchParams: { code, }, fullPage, }: {
2
+ searchParams?: Record<string, string>;
3
+ fullPage?: boolean;
4
+ }): import("react/jsx-runtime").JSX.Element | null;
5
+ //# sourceMappingURL=email-verification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-verification.d.ts","sourceRoot":"","sources":["../../src/components/email-verification.tsx"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,YAAY,EAAE,EACZ,IAAS,GACL,EACN,QAAgB,GACjB,EAAE;IACD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,kDAkCA"}
@@ -2,8 +2,8 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { use } from "react";
4
4
  import { useStackApp } from "..";
5
- import MessageCard from "../elements/MessageCard";
6
- import RedirectMessageCard from "../elements/RedirectMessageCard";
5
+ import MessageCard from "../elements/message-card";
6
+ import RedirectMessageCard from "../elements/redirect-message-card";
7
7
  import { EmailVerificationLinkExpiredErrorCode, EmailVerificationLinkInvalidErrorCode, EmailVerificationLinkUsedErrorCode } from "@stackframe/stack-shared/dist/utils/types";
8
8
  export default function EmailVerification({ searchParams: { code = "", } = {}, fullPage = false, }) {
9
9
  const stackApp = useStackApp();
@@ -1,3 +1,4 @@
1
1
  export default function ForgotPassword({ onSent }: {
2
2
  onSent?: () => void;
3
3
  }): import("react/jsx-runtime").JSX.Element;
4
+ //# sourceMappingURL=forgot-password.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forgot-password.d.ts","sourceRoot":"","sources":["../../src/components/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"}
@@ -0,0 +1,32 @@
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 "../components-core";
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
+ }
@@ -0,0 +1,4 @@
1
+ export default function FormWarningText({ text }: {
2
+ text?: string;
3
+ }): import("react/jsx-runtime").JSX.Element | null;
4
+ //# sourceMappingURL=form-warning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-warning.d.ts","sourceRoot":"","sources":["../../src/components/form-warning.tsx"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,kDASlE"}
@@ -0,0 +1,9 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Text } from "../components-core";
4
+ export default function FormWarningText({ text }) {
5
+ if (!text) {
6
+ return null;
7
+ }
8
+ return (_jsx(Text, { size: "sm", variant: "warning", children: text }));
9
+ }
@@ -4,3 +4,4 @@ export default function MessageCard({ children, title, fullPage }: {
4
4
  title: string;
5
5
  fullPage?: boolean;
6
6
  }): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=message-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-card.d.ts","sourceRoot":"","sources":["../../src/components/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"}
@@ -0,0 +1,7 @@
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 "../components-core";
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
+ }
@@ -2,3 +2,4 @@ export default function OAuthButton({ provider, type, }: {
2
2
  provider: string;
3
3
  type: 'signin' | 'signup';
4
4
  }): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=oauth-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-button.d.ts","sourceRoot":"","sources":["../../src/components/oauth-button.tsx"],"names":[],"mappings":"AAWA,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"}
@@ -0,0 +1,66 @@
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 "../components-core";
7
+ import { useDesign } from "../providers/design-provider";
8
+ import Color from 'color';
9
+ const iconSize = 22;
10
+ export default function OAuthButton({ provider, type, }) {
11
+ const { colors } = useDesign();
12
+ const stackApp = useStackApp();
13
+ let style;
14
+ switch (provider) {
15
+ case 'google': {
16
+ style = {
17
+ backgroundColor: '#fff',
18
+ name: 'Google',
19
+ border: Color(colors.primaryBgColor).isDark() ? undefined : '1px solid #ccc',
20
+ 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" })] })),
21
+ };
22
+ break;
23
+ }
24
+ case 'github': {
25
+ style = {
26
+ backgroundColor: '#111',
27
+ border: Color(colors.primaryBgColor).isDark() ? '1px solid #666' : undefined,
28
+ name: 'GitHub',
29
+ icon: (_jsx(FaGithub, { color: "#fff", size: iconSize })),
30
+ };
31
+ break;
32
+ }
33
+ case 'facebook': {
34
+ style = {
35
+ backgroundColor: '#1877F2',
36
+ name: 'Facebook',
37
+ icon: (_jsx(FaFacebook, { color: "#fff", size: iconSize })),
38
+ };
39
+ break;
40
+ }
41
+ case 'apple': {
42
+ style = {
43
+ backgroundColor: '#000',
44
+ name: 'Apple',
45
+ icon: (_jsx(FaApple, { color: "#fff", size: iconSize })),
46
+ };
47
+ break;
48
+ }
49
+ case 'microsoft': {
50
+ style = {
51
+ backgroundColor: '#2f2f2f',
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
+ name: provider,
61
+ icon: null
62
+ };
63
+ }
64
+ }
65
+ 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 })] }) }));
66
+ }
@@ -0,0 +1,2 @@
1
+ export default function OAuthCallback(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=oauth-callback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-callback.d.ts","sourceRoot":"","sources":["../../src/components/oauth-callback.tsx"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,aAAa,4CAWpC"}
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useRef, useEffect } from "react";
4
4
  import { useStackApp } from "..";
5
5
  import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
6
- import MessageCard from "../elements/MessageCard";
6
+ import MessageCard from "../elements/message-card";
7
7
  export default function OAuthCallback() {
8
8
  const app = useStackApp();
9
9
  const called = useRef(false);
@@ -1,3 +1,4 @@
1
1
  export default function OAuthGroup({ type, }: {
2
2
  type: 'signin' | 'signup';
3
3
  }): import("react/jsx-runtime").JSX.Element;
4
+ //# sourceMappingURL=oauth-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-group.d.ts","sourceRoot":"","sources":["../../src/components/oauth-group.tsx"],"names":[],"mappings":"AAKA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,IAAI,GACL,EAAE;IACD,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC3B,2CAWA"}
@@ -0,0 +1,9 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useStackApp } from "../lib/hooks";
4
+ import OAuthButton from "./oauth-button";
5
+ export default function OAuthGroup({ type, }) {
6
+ const stackApp = useStackApp();
7
+ const project = stackApp.useProject();
8
+ 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))) }));
9
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ declare const PasswordField: import("react").ForwardRefExoticComponent<import("react").InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
3
+ export default PasswordField;
4
+ //# sourceMappingURL=password-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-field.d.ts","sourceRoot":"","sources":["../../src/components/password-field.tsx"],"names":[],"mappings":";AAMA,QAAA,MAAM,aAAa,oJAwDjB,CAAC;AAIH,eAAe,aAAa,CAAC"}
@@ -0,0 +1,41 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Input } from "../components-core";
4
+ ;
5
+ import { forwardRef, useRef, useState } from 'react';
6
+ import { HiEye, HiEyeOff } from 'react-icons/hi';
7
+ const PasswordField = forwardRef(({ id, name, ...props }, ref) => {
8
+ const [isOpen, setIsOpen] = useState(false);
9
+ const inputRef = useRef(null);
10
+ const mergeRef = (node) => {
11
+ if (ref) {
12
+ if (typeof ref === 'function') {
13
+ ref(node);
14
+ }
15
+ else {
16
+ ref.current = node;
17
+ }
18
+ }
19
+ inputRef.current = node;
20
+ };
21
+ const onClickReveal = () => {
22
+ setIsOpen(!isOpen);
23
+ const currentInput = inputRef.current;
24
+ if (currentInput) {
25
+ currentInput.focus({ preventScroll: true });
26
+ }
27
+ };
28
+ 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: {
29
+ position: 'absolute',
30
+ backgroundColor: 'transparent',
31
+ border: 'none',
32
+ top: 0,
33
+ right: 0,
34
+ bottom: 0,
35
+ display: 'flex',
36
+ alignItems: 'center',
37
+ paddingRight: '12px'
38
+ }, onClick: onClickReveal, "aria-label": isOpen ? 'Mask password' : 'Reveal password', children: isOpen ? _jsx(HiEyeOff, {}) : _jsx(HiEye, {}) })] }));
39
+ });
40
+ PasswordField.displayName = 'PasswordField';
41
+ export default PasswordField;
@@ -2,3 +2,4 @@ export default function PasswordResetInner({ code, fullPage }: {
2
2
  code: string;
3
3
  fullPage?: boolean;
4
4
  }): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=password-reset-inner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-reset-inner.d.ts","sourceRoot":"","sources":["../../src/components/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"}
@@ -3,12 +3,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import { getPasswordError } from "@stackframe/stack-shared/dist/helpers/password";
5
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";
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 "../components-core";
13
+ import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
12
14
  export default function PasswordResetInner({ code, fullPage = false }) {
13
15
  const [password, setPassword] = useState('');
14
16
  const [passwordError, setPasswordError] = useState('');
@@ -47,15 +49,15 @@ export default function PasswordResetInner({ code, fullPage = false }) {
47
49
  return _jsx(RedirectMessageCard, { type: 'passwordReset', fullPage: fullPage });
48
50
  }
49
51
  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" }) }));
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" }) }));
51
53
  }
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" }) })] })] }));
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" })] })] }));
61
63
  }
@@ -0,0 +1,5 @@
1
+ export default function PasswordReset({ searchParams, fullPage, }: {
2
+ searchParams?: Record<string, string>;
3
+ fullPage?: boolean;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=password-reset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-reset.d.ts","sourceRoot":"","sources":["../../src/components/password-reset.tsx"],"names":[],"mappings":"AAcA,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,YAAY,EACZ,QAAgB,GACjB,EAAE;IACD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,2CA0CA"}
@@ -1,19 +1,20 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import MessageCard from "../elements/MessageCard";
3
+ import MessageCard from "../elements/message-card";
4
4
  import { useStackApp } from "..";
5
5
  import { use } from "react";
6
- import PasswordResetInner from "../elements/PasswordResetInner";
6
+ import PasswordResetInner from "../elements/password-reset-inner";
7
7
  import { PasswordResetLinkExpiredErrorCode, PasswordResetLinkInvalidErrorCode, PasswordResetLinkUsedErrorCode } from "@stackframe/stack-shared/dist/utils/types";
8
8
  import { cacheFunction } from "@stackframe/stack-shared/dist/utils/caches";
9
+ import { Text } from "@stackframe/stack-ui";
9
10
  const cachedVerifyPasswordResetCode = cacheFunction(async (stackApp, code) => {
10
11
  return await stackApp.verifyPasswordResetCode(code);
11
12
  });
12
13
  export default function PasswordReset({ searchParams, fullPage = false, }) {
13
14
  const stackApp = useStackApp();
14
- const invalidJsx = (_jsx(MessageCard, { title: "Invalid Password Reset Link", fullPage: fullPage, children: _jsx("p", { children: "Please check if you have the correct password reset link. If you continue to have issues, please contact support." }) }));
15
- const expiredJsx = (_jsx(MessageCard, { title: "Expired Password Reset Link", fullPage: fullPage, children: _jsx("p", { children: "Your password reset link has expired. Please request a new password reset link from the login page." }) }));
16
- const usedJsx = (_jsx(MessageCard, { title: "Used Password Reset Link", fullPage: fullPage, children: _jsx("p", { children: "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." }) }));
15
+ const invalidJsx = (_jsx(MessageCard, { title: "Invalid Password Reset Link", fullPage: fullPage, children: _jsx(Text, { children: "Please double check if you have the correct password reset link." }) }));
16
+ const expiredJsx = (_jsx(MessageCard, { title: "Expired Password Reset Link", fullPage: fullPage, children: _jsx(Text, { children: "Your password reset link has expired. Please request a new password reset link from the login page." }) }));
17
+ const usedJsx = (_jsx(MessageCard, { title: "Used Password Reset Link", fullPage: fullPage, children: _jsx(Text, { children: "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." }) }));
17
18
  const code = searchParams?.code;
18
19
  if (!code) {
19
20
  return invalidJsx;
@@ -2,3 +2,4 @@ export default function RedirectMessageCard({ type, fullPage, }: {
2
2
  type: 'signedIn' | 'signedOut' | 'emailSent' | 'passwordReset' | 'emailVerified';
3
3
  fullPage?: boolean;
4
4
  }): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=redirect-message-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redirect-message-card.d.ts","sourceRoot":"","sources":["../../src/components/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"}