@stackframe/stack 2.3.5 → 2.3.7

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 (261) hide show
  1. package/dist/components/card-frame.d.mts +9 -0
  2. package/dist/components/card-frame.d.ts +8 -5
  3. package/dist/components/card-frame.js +58 -23
  4. package/dist/components/credential-sign-in.d.mts +5 -0
  5. package/dist/components/credential-sign-in.d.ts +5 -1
  6. package/dist/components/credential-sign-in.js +109 -41
  7. package/dist/components/credential-sign-up.d.mts +5 -0
  8. package/dist/components/credential-sign-up.d.ts +5 -1
  9. package/dist/components/credential-sign-up.js +140 -62
  10. package/dist/components/forgot-password.d.mts +7 -0
  11. package/dist/components/forgot-password.d.ts +6 -2
  12. package/dist/components/forgot-password.js +83 -26
  13. package/dist/components/form-warning.d.mts +7 -0
  14. package/dist/components/form-warning.d.ts +6 -2
  15. package/dist/components/form-warning.js +34 -8
  16. package/dist/components/magic-link-sign-in.d.mts +5 -0
  17. package/dist/components/magic-link-sign-in.d.ts +5 -1
  18. package/dist/components/magic-link-sign-in.js +89 -31
  19. package/dist/components/message-card.d.mts +10 -0
  20. package/dist/components/message-card.d.ts +8 -4
  21. package/dist/components/message-card.js +45 -6
  22. package/dist/components/oauth-button.d.mts +8 -0
  23. package/dist/components/oauth-button.d.ts +6 -2
  24. package/dist/components/oauth-button.js +142 -63
  25. package/dist/components/oauth-group.d.mts +7 -0
  26. package/dist/components/oauth-group.d.ts +6 -2
  27. package/dist/components/oauth-group.js +46 -8
  28. package/dist/components/password-field.d.mts +5 -0
  29. package/dist/components/password-field.d.ts +5 -3
  30. package/dist/components/password-field.js +111 -41
  31. package/dist/components/password-reset-inner.d.mts +8 -0
  32. package/dist/components/password-reset-inner.d.ts +6 -2
  33. package/dist/components/password-reset-inner.js +120 -58
  34. package/dist/components/redirect-message-card.d.mts +8 -0
  35. package/dist/components/redirect-message-card.d.ts +6 -2
  36. package/dist/components/redirect-message-card.js +110 -58
  37. package/dist/components/separator-with-text.d.mts +7 -0
  38. package/dist/components/separator-with-text.d.ts +6 -2
  39. package/dist/components/separator-with-text.js +35 -5
  40. package/dist/components/user-avatar.d.mts +13 -0
  41. package/dist/components/user-avatar.d.ts +11 -3
  42. package/dist/components/user-avatar.js +34 -6
  43. package/dist/components/user-button.d.mts +15 -0
  44. package/dist/components/user-button.d.ts +12 -3
  45. package/dist/components/user-button.js +156 -26
  46. package/dist/components-core/avatar.d.mts +8 -0
  47. package/dist/components-core/avatar.d.ts +7 -5
  48. package/dist/components-core/avatar.js +73 -18
  49. package/dist/components-core/button.d.mts +12 -0
  50. package/dist/components-core/button.d.ts +8 -6
  51. package/dist/components-core/button.js +177 -113
  52. package/dist/components-core/card.d.mts +8 -0
  53. package/dist/components-core/card.d.ts +4 -2
  54. package/dist/components-core/card.js +73 -22
  55. package/dist/components-core/collapsible.d.mts +8 -0
  56. package/dist/components-core/collapsible.d.ts +8 -6
  57. package/dist/components-core/collapsible.js +48 -5
  58. package/dist/components-core/container.d.mts +8 -0
  59. package/dist/components-core/container.d.ts +5 -3
  60. package/dist/components-core/container.js +61 -11
  61. package/dist/components-core/dropdown.d.mts +15 -0
  62. package/dist/components-core/dropdown.d.ts +10 -8
  63. package/dist/components-core/dropdown.js +108 -36
  64. package/dist/components-core/index.d.mts +59 -0
  65. package/dist/components-core/index.d.ts +51 -40
  66. package/dist/components-core/index.js +144 -46
  67. package/dist/components-core/input.d.mts +6 -0
  68. package/dist/components-core/input.d.ts +5 -3
  69. package/dist/components-core/input.js +97 -28
  70. package/dist/components-core/label.d.mts +6 -0
  71. package/dist/components-core/label.d.ts +5 -3
  72. package/dist/components-core/label.js +65 -15
  73. package/dist/components-core/link.d.mts +10 -0
  74. package/dist/components-core/link.d.ts +7 -6
  75. package/dist/components-core/link.js +72 -18
  76. package/dist/components-core/loading-indicator.d.mts +13 -0
  77. package/dist/components-core/loading-indicator.d.ts +11 -4
  78. package/dist/components-core/loading-indicator.js +46 -6
  79. package/dist/components-core/popover.d.mts +8 -0
  80. package/dist/components-core/popover.d.ts +8 -6
  81. package/dist/components-core/popover.js +72 -16
  82. package/dist/components-core/separator.d.mts +6 -0
  83. package/dist/components-core/separator.d.ts +5 -3
  84. package/dist/components-core/separator.js +66 -16
  85. package/dist/components-core/skeleton.d.mts +7 -0
  86. package/dist/components-core/skeleton.d.ts +5 -3
  87. package/dist/components-core/skeleton.js +75 -21
  88. package/dist/components-core/tabs.d.mts +9 -0
  89. package/dist/components-core/tabs.d.ts +8 -6
  90. package/dist/components-core/tabs.js +87 -20
  91. package/dist/components-core/text.d.mts +10 -0
  92. package/dist/components-core/text.d.ts +5 -3
  93. package/dist/components-core/text.js +95 -40
  94. package/dist/components-core-joy/button.d.mts +6 -0
  95. package/dist/components-core-joy/button.d.ts +6 -2
  96. package/dist/components-core-joy/button.js +86 -28
  97. package/dist/components-core-joy/input.d.mts +5 -0
  98. package/dist/components-core-joy/input.d.ts +5 -2
  99. package/dist/components-core-joy/input.js +51 -6
  100. package/dist/components-core-joy/separator.d.mts +6 -0
  101. package/dist/components-core-joy/separator.d.ts +6 -2
  102. package/dist/components-core-joy/separator.js +50 -6
  103. package/dist/components-core-joy/tabs.d.mts +9 -0
  104. package/dist/components-core-joy/tabs.d.ts +9 -5
  105. package/dist/components-core-joy/tabs.js +62 -16
  106. package/dist/components-core-joy/text.d.mts +9 -0
  107. package/dist/components-core-joy/text.d.ts +6 -3
  108. package/dist/components-core-joy/text.js +68 -28
  109. package/dist/components-page/account-settings.d.mts +7 -0
  110. package/dist/components-page/account-settings.d.ts +6 -2
  111. package/dist/components-page/account-settings.js +213 -81
  112. package/dist/components-page/auth-page.d.mts +8 -0
  113. package/dist/components-page/auth-page.d.ts +6 -2
  114. package/dist/components-page/auth-page.js +79 -19
  115. package/dist/components-page/email-verification.d.mts +8 -0
  116. package/dist/components-page/email-verification.d.ts +6 -2
  117. package/dist/components-page/email-verification.js +65 -28
  118. package/dist/components-page/forgot-password.d.mts +7 -0
  119. package/dist/components-page/forgot-password.d.ts +6 -2
  120. package/dist/components-page/forgot-password.js +64 -20
  121. package/dist/components-page/magic-link-callback.d.mts +8 -0
  122. package/dist/components-page/magic-link-callback.d.ts +6 -2
  123. package/dist/components-page/magic-link-callback.js +72 -34
  124. package/dist/components-page/oauth-callback.d.mts +5 -0
  125. package/dist/components-page/oauth-callback.d.ts +5 -1
  126. package/dist/components-page/oauth-callback.js +52 -16
  127. package/dist/components-page/password-reset.d.mts +8 -0
  128. package/dist/components-page/password-reset.d.ts +6 -2
  129. package/dist/components-page/password-reset.js +70 -34
  130. package/dist/components-page/sign-in.d.mts +7 -0
  131. package/dist/components-page/sign-in.d.ts +6 -2
  132. package/dist/components-page/sign-in.js +41 -5
  133. package/dist/components-page/sign-out.d.mts +5 -0
  134. package/dist/components-page/sign-out.d.ts +5 -1
  135. package/dist/components-page/sign-out.js +47 -11
  136. package/dist/components-page/sign-up.d.mts +7 -0
  137. package/dist/components-page/sign-up.d.ts +6 -2
  138. package/dist/components-page/sign-up.js +41 -5
  139. package/dist/components-page/stack-handler.d.mts +16 -0
  140. package/dist/components-page/stack-handler.d.ts +11 -3
  141. package/dist/components-page/stack-handler.js +102 -64
  142. package/dist/esm/components/card-frame.js +39 -0
  143. package/dist/esm/components/credential-sign-in.js +82 -0
  144. package/dist/esm/components/credential-sign-up.js +114 -0
  145. package/dist/esm/components/forgot-password.js +55 -0
  146. package/dist/esm/components/form-warning.js +15 -0
  147. package/dist/esm/components/magic-link-sign-in.js +61 -0
  148. package/dist/esm/components/message-card.js +16 -0
  149. package/dist/esm/components/oauth-button.js +124 -0
  150. package/dist/esm/components/oauth-group.js +17 -0
  151. package/dist/esm/components/password-field.js +82 -0
  152. package/dist/esm/components/password-reset-inner.js +93 -0
  153. package/dist/esm/components/redirect-message-card.js +83 -0
  154. package/dist/esm/components/separator-with-text.js +16 -0
  155. package/dist/esm/components/user-avatar.js +14 -0
  156. package/dist/esm/components/user-button.js +133 -0
  157. package/dist/esm/components-core/avatar.js +56 -0
  158. package/dist/esm/components-core/button.js +165 -0
  159. package/dist/esm/components-core/card.js +51 -0
  160. package/dist/esm/components-core/collapsible.js +13 -0
  161. package/dist/esm/components-core/container.js +35 -0
  162. package/dist/esm/components-core/dropdown.js +106 -0
  163. package/dist/esm/components-core/index.js +93 -0
  164. package/dist/esm/components-core/input.js +80 -0
  165. package/dist/esm/components-core/label.js +38 -0
  166. package/dist/esm/components-core/link.js +38 -0
  167. package/dist/esm/components-core/loading-indicator.js +27 -0
  168. package/dist/esm/components-core/popover.js +43 -0
  169. package/dist/esm/components-core/separator.js +36 -0
  170. package/dist/esm/components-core/skeleton.js +52 -0
  171. package/dist/esm/components-core/tabs.js +79 -0
  172. package/dist/esm/components-core/text.js +63 -0
  173. package/dist/esm/components-core-joy/button.js +53 -0
  174. package/dist/esm/components-core-joy/input.js +18 -0
  175. package/dist/esm/components-core-joy/separator.js +17 -0
  176. package/dist/esm/components-core-joy/tabs.js +29 -0
  177. package/dist/esm/components-core-joy/text.js +35 -0
  178. package/dist/esm/components-page/account-settings.js +197 -0
  179. package/dist/esm/components-page/auth-page.js +50 -0
  180. package/dist/esm/components-page/email-verification.js +36 -0
  181. package/dist/esm/components-page/forgot-password.js +35 -0
  182. package/dist/esm/components-page/magic-link-callback.js +43 -0
  183. package/dist/esm/components-page/oauth-callback.js +23 -0
  184. package/dist/esm/components-page/password-reset.js +42 -0
  185. package/dist/esm/components-page/sign-in.js +12 -0
  186. package/dist/esm/components-page/sign-out.js +18 -0
  187. package/dist/esm/components-page/sign-up.js +12 -0
  188. package/dist/esm/components-page/stack-handler.js +75 -0
  189. package/dist/esm/index.js +47 -0
  190. package/dist/esm/joy.js +5 -0
  191. package/dist/esm/lib/auth.js +62 -0
  192. package/dist/esm/lib/cookie.js +185 -0
  193. package/dist/esm/lib/hooks.js +29 -0
  194. package/dist/esm/lib/stack-app.js +940 -0
  195. package/dist/esm/providers/component-provider.js +76 -0
  196. package/dist/esm/providers/design-provider.js +36 -0
  197. package/dist/esm/providers/joy-provider.js +35 -0
  198. package/dist/esm/providers/stack-provider-client.js +31 -0
  199. package/dist/esm/providers/stack-provider.js +21 -0
  200. package/dist/esm/providers/styled-components-registry.js +24 -0
  201. package/dist/esm/providers/theme-provider.js +22 -0
  202. package/dist/esm/utils/browser-script.js +25 -0
  203. package/dist/esm/utils/constants.js +34 -0
  204. package/dist/esm/utils/email.js +10 -0
  205. package/dist/esm/utils/next.js +7 -0
  206. package/dist/esm/utils/url.js +21 -0
  207. package/dist/index.d.mts +37 -0
  208. package/dist/index.d.ts +37 -22
  209. package/dist/index.js +106 -21
  210. package/dist/joy.d.mts +16 -0
  211. package/dist/joy.d.ts +16 -1
  212. package/dist/joy.js +30 -1
  213. package/dist/lib/auth.d.mts +11 -0
  214. package/dist/lib/auth.d.ts +8 -4
  215. package/dist/lib/auth.js +83 -57
  216. package/dist/lib/cookie.d.mts +14 -0
  217. package/dist/lib/cookie.d.ts +8 -6
  218. package/dist/lib/cookie.js +217 -45
  219. package/dist/lib/hooks.d.mts +35 -0
  220. package/dist/lib/hooks.d.ts +14 -8
  221. package/dist/lib/hooks.js +53 -28
  222. package/dist/lib/stack-app.d.mts +227 -0
  223. package/dist/lib/stack-app.d.ts +43 -41
  224. package/dist/lib/stack-app.js +937 -849
  225. package/dist/providers/component-provider.d.mts +113 -0
  226. package/dist/providers/component-provider.d.ts +95 -77
  227. package/dist/providers/component-provider.js +92 -58
  228. package/dist/providers/design-provider.d.mts +34 -0
  229. package/dist/providers/design-provider.d.ts +16 -21
  230. package/dist/providers/design-provider.js +57 -58
  231. package/dist/providers/joy-provider.d.mts +36 -0
  232. package/dist/providers/joy-provider.d.ts +30 -14
  233. package/dist/providers/joy-provider.js +58 -30
  234. package/dist/providers/stack-provider-client.d.mts +20 -0
  235. package/dist/providers/stack-provider-client.d.ts +15 -8
  236. package/dist/providers/stack-provider-client.js +64 -20
  237. package/dist/providers/stack-provider.d.mts +14 -0
  238. package/dist/providers/stack-provider.d.ts +13 -5
  239. package/dist/providers/stack-provider.js +39 -8
  240. package/dist/providers/styled-components-registry.d.mts +8 -0
  241. package/dist/providers/styled-components-registry.d.ts +8 -4
  242. package/dist/providers/styled-components-registry.js +43 -17
  243. package/dist/providers/theme-provider.d.mts +22 -0
  244. package/dist/providers/theme-provider.d.ts +21 -9
  245. package/dist/providers/theme-provider.js +55 -19
  246. package/dist/utils/browser-script.d.mts +5 -0
  247. package/dist/utils/browser-script.d.ts +5 -0
  248. package/dist/utils/browser-script.js +50 -0
  249. package/dist/utils/constants.d.mts +48 -0
  250. package/dist/utils/constants.d.ts +11 -9
  251. package/dist/utils/constants.js +66 -21
  252. package/dist/utils/email.d.mts +3 -0
  253. package/dist/utils/email.d.ts +3 -1
  254. package/dist/utils/email.js +44 -6
  255. package/dist/utils/next.d.mts +3 -0
  256. package/dist/utils/next.d.ts +3 -1
  257. package/dist/utils/next.js +31 -3
  258. package/dist/utils/url.d.mts +4 -0
  259. package/dist/utils/url.d.ts +4 -2
  260. package/dist/utils/url.js +44 -13
  261. package/package.json +19 -10
@@ -1,6 +1,42 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import AuthPage from './auth-page';
4
- export default function SignUp({ fullPage = false }) {
5
- return _jsx(AuthPage, { fullPage: fullPage, type: 'sign-up' });
1
+ "use client";
2
+ "use strict";
3
+ "use client";
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // src/components-page/sign-up.tsx
33
+ var sign_up_exports = {};
34
+ __export(sign_up_exports, {
35
+ default: () => SignUp
36
+ });
37
+ module.exports = __toCommonJS(sign_up_exports);
38
+ var import_auth_page = __toESM(require("./auth-page"));
39
+ var import_jsx_runtime = require("react/jsx-runtime");
40
+ function SignUp({ fullPage = false }) {
41
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_auth_page.default, { fullPage, type: "sign-up" });
6
42
  }
@@ -0,0 +1,16 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { StackServerApp } from '../lib/stack-app.mjs';
3
+ import '@stackframe/stack-shared';
4
+ import '@stackframe/stack-shared/dist/interface/clientInterface';
5
+ import '@stackframe/stack-shared/dist/utils/json';
6
+ import '@stackframe/stack-shared/dist/interface/adminInterface';
7
+
8
+ declare function StackHandler<HasTokenStore extends boolean>({ app, params: { stack }, searchParams, }: {
9
+ app: StackServerApp<HasTokenStore>;
10
+ params?: {
11
+ stack?: string[];
12
+ };
13
+ searchParams?: Record<string, string>;
14
+ }): Promise<react_jsx_runtime.JSX.Element>;
15
+
16
+ export { StackHandler as default };
@@ -1,8 +1,16 @@
1
- import { StackServerApp } from "..";
2
- export default function StackHandler<HasTokenStore extends boolean>({ app, params: { stack }, searchParams, }: {
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { StackServerApp } from '../lib/stack-app.js';
3
+ import '@stackframe/stack-shared';
4
+ import '@stackframe/stack-shared/dist/interface/clientInterface';
5
+ import '@stackframe/stack-shared/dist/utils/json';
6
+ import '@stackframe/stack-shared/dist/interface/adminInterface';
7
+
8
+ declare function StackHandler<HasTokenStore extends boolean>({ app, params: { stack }, searchParams, }: {
3
9
  app: StackServerApp<HasTokenStore>;
4
10
  params?: {
5
11
  stack?: string[];
6
12
  };
7
13
  searchParams?: Record<string, string>;
8
- }): Promise<import("react/jsx-runtime").JSX.Element>;
14
+ }): Promise<react_jsx_runtime.JSX.Element>;
15
+
16
+ export { StackHandler as default };
@@ -1,68 +1,106 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import SignUp from "./sign-up";
3
- import SignIn from "./sign-in";
4
- import { RedirectType, notFound, redirect } from 'next/navigation';
5
- import EmailVerification from "./email-verification";
6
- import { PasswordReset } from "..";
7
- import MessageCard from "../components/message-card";
8
- import Signout from "./sign-out";
9
- import ForgotPassword from "./forgot-password";
10
- import OAuthCallback from "./oauth-callback";
11
- import AccountSettings from "./account-settings";
12
- import MagicLinkCallback from "./magic-link-callback";
13
- export default async function StackHandler({ app, params: { stack } = {}, searchParams = {}, }) {
14
- if (!stack) {
15
- return (_jsx(MessageCard, { title: "Invalid Stack Handler Setup", fullPage: true, children: _jsx("p", { children: "Can't use Stack handler at this location. Make sure that the file is in a folder called [...stack]." }) }));
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/components-page/stack-handler.tsx
31
+ var stack_handler_exports = {};
32
+ __export(stack_handler_exports, {
33
+ default: () => StackHandler
34
+ });
35
+ module.exports = __toCommonJS(stack_handler_exports);
36
+ var import_sign_up = __toESM(require("./sign-up"));
37
+ var import_sign_in = __toESM(require("./sign-in"));
38
+ var import_navigation = require("next/navigation");
39
+ var import_email_verification = __toESM(require("./email-verification"));
40
+ var import__ = require("..");
41
+ var import_message_card = __toESM(require("../components/message-card"));
42
+ var import_sign_out = __toESM(require("./sign-out"));
43
+ var import_forgot_password = __toESM(require("./forgot-password"));
44
+ var import_oauth_callback = __toESM(require("./oauth-callback"));
45
+ var import_account_settings = __toESM(require("./account-settings"));
46
+ var import_magic_link_callback = __toESM(require("./magic-link-callback"));
47
+ var import_jsx_runtime = require("react/jsx-runtime");
48
+ async function StackHandler({
49
+ app,
50
+ params: { stack } = {},
51
+ searchParams = {}
52
+ }) {
53
+ if (!stack) {
54
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.default, { title: "Invalid Stack Handler Setup", fullPage: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Can't use Stack handler at this location. Make sure that the file is in a folder called [...stack]." }) });
55
+ }
56
+ function redirectIfNotHandler(name) {
57
+ const url = app.urls[name];
58
+ const handlerUrl = app.urls.handler;
59
+ if (url.startsWith(handlerUrl)) {
60
+ return;
16
61
  }
17
- function redirectIfNotHandler(name) {
18
- const url = app.urls[name];
19
- const handlerUrl = app.urls.handler;
20
- if (url.startsWith(handlerUrl)) {
21
- // don't redirect if the url is a handler url
22
- return;
23
- }
24
- redirect(url, RedirectType.replace);
62
+ (0, import_navigation.redirect)(url, import_navigation.RedirectType.replace);
63
+ }
64
+ const path = stack.join("/");
65
+ switch (path) {
66
+ case "signin": {
67
+ redirectIfNotHandler("signIn");
68
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sign_in.default, { fullPage: true });
25
69
  }
26
- const path = stack.join('/');
27
- switch (path) {
28
- case 'signin': {
29
- redirectIfNotHandler('signIn');
30
- return _jsx(SignIn, { fullPage: true });
31
- }
32
- case 'signup': {
33
- redirectIfNotHandler('signUp');
34
- return _jsx(SignUp, { fullPage: true });
35
- }
36
- case 'email-verification': {
37
- redirectIfNotHandler('emailVerification');
38
- return _jsx(EmailVerification, { searchParams: searchParams, fullPage: true });
39
- }
40
- case 'password-reset': {
41
- redirectIfNotHandler('passwordReset');
42
- return _jsx(PasswordReset, { searchParams: searchParams, fullPage: true });
43
- }
44
- case 'forgot-password': {
45
- redirectIfNotHandler('forgotPassword');
46
- return _jsx(ForgotPassword, { fullPage: true });
47
- }
48
- case 'signout': {
49
- redirectIfNotHandler('signOut');
50
- return _jsx(Signout, {});
51
- }
52
- case 'oauth-callback': {
53
- redirectIfNotHandler('oauthCallback');
54
- return _jsx(OAuthCallback, {});
55
- }
56
- case 'account-settings': {
57
- redirectIfNotHandler('accountSettings');
58
- return _jsx(AccountSettings, { fullPage: true });
59
- }
60
- case 'magic-link-callback': {
61
- redirectIfNotHandler('magicLinkCallback');
62
- return _jsx(MagicLinkCallback, { searchParams: searchParams, fullPage: true });
63
- }
64
- default: {
65
- return notFound();
66
- }
70
+ case "signup": {
71
+ redirectIfNotHandler("signUp");
72
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sign_up.default, { fullPage: true });
67
73
  }
74
+ case "email-verification": {
75
+ redirectIfNotHandler("emailVerification");
76
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_email_verification.default, { searchParams, fullPage: true });
77
+ }
78
+ case "password-reset": {
79
+ redirectIfNotHandler("passwordReset");
80
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.PasswordReset, { searchParams, fullPage: true });
81
+ }
82
+ case "forgot-password": {
83
+ redirectIfNotHandler("forgotPassword");
84
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_forgot_password.default, { fullPage: true });
85
+ }
86
+ case "signout": {
87
+ redirectIfNotHandler("signOut");
88
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sign_out.default, {});
89
+ }
90
+ case "oauth-callback": {
91
+ redirectIfNotHandler("oauthCallback");
92
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_oauth_callback.default, {});
93
+ }
94
+ case "account-settings": {
95
+ redirectIfNotHandler("accountSettings");
96
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_account_settings.default, { fullPage: true });
97
+ }
98
+ case "magic-link-callback": {
99
+ redirectIfNotHandler("magicLinkCallback");
100
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_magic_link_callback.default, { searchParams, fullPage: true });
101
+ }
102
+ default: {
103
+ return (0, import_navigation.notFound)();
104
+ }
105
+ }
68
106
  }
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ "use client";
3
+
4
+ // src/components/card-frame.tsx
5
+ import { Container } from "../components-core";
6
+ import { useEffect, useState } from "react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ function CardFrame({
9
+ children,
10
+ fullPage = true
11
+ }) {
12
+ const [hasNoParent, setHasNoParent] = useState(false);
13
+ useEffect(() => {
14
+ const component = document.getElementById("stack-card-frame");
15
+ setHasNoParent(
16
+ !component?.parentElement || component?.parentElement === document.body || component?.parentElement === document.documentElement
17
+ );
18
+ }, []);
19
+ if (fullPage) {
20
+ return /* @__PURE__ */ jsx(
21
+ "div",
22
+ {
23
+ id: "stack-card-frame",
24
+ style: {
25
+ height: hasNoParent ? "100vh" : "100%",
26
+ display: "flex",
27
+ alignItems: "center",
28
+ justifyContent: "center"
29
+ },
30
+ children: /* @__PURE__ */ jsx(Container, { size: 380, style: { padding: "1rem 1rem" }, children })
31
+ }
32
+ );
33
+ } else {
34
+ return children;
35
+ }
36
+ }
37
+ export {
38
+ CardFrame as default
39
+ };
@@ -0,0 +1,82 @@
1
+ "use client";
2
+ "use client";
3
+
4
+ // src/components/credential-sign-in.tsx
5
+ import { useState } from "react";
6
+ import FormWarningText from "./form-warning";
7
+ import PasswordField from "./password-field";
8
+ import { validateEmail } from "../utils/email";
9
+ import { useStackApp } from "..";
10
+ import { Button, Input, Label, Link } from "../components-core";
11
+ import { KnownErrors } from "@stackframe/stack-shared";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ function CredentialSignIn() {
14
+ const [email, setEmail] = useState("");
15
+ const [emailError, setEmailError] = useState("");
16
+ const [password, setPassword] = useState("");
17
+ const [passwordError, setPasswordError] = useState("");
18
+ const app = useStackApp();
19
+ const onSubmit = async () => {
20
+ if (!email) {
21
+ setEmailError("Please enter your email");
22
+ return;
23
+ }
24
+ if (!validateEmail(email)) {
25
+ setEmailError("Please enter a valid email");
26
+ return;
27
+ }
28
+ if (!password) {
29
+ setPasswordError("Please enter your password");
30
+ return;
31
+ }
32
+ const error = await app.signInWithCredential({ email, password });
33
+ if (error instanceof KnownErrors.EmailPasswordMismatch) {
34
+ setPasswordError("Wrong email or password");
35
+ } else if (error) {
36
+ setEmailError(`An error occurred. ${error.message}`);
37
+ }
38
+ };
39
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "stretch" }, children: [
40
+ /* @__PURE__ */ jsx(Label, { htmlFor: "email", children: "Email" }),
41
+ /* @__PURE__ */ jsx(
42
+ Input,
43
+ {
44
+ id: "email",
45
+ type: "email",
46
+ name: "email",
47
+ value: email,
48
+ onChange: (e) => {
49
+ setEmail(e.target.value);
50
+ setEmailError("");
51
+ }
52
+ }
53
+ ),
54
+ /* @__PURE__ */ jsx(FormWarningText, { text: emailError }),
55
+ /* @__PURE__ */ jsx(Label, { htmlFor: "password", style: { marginTop: "1rem" }, children: "Password" }),
56
+ /* @__PURE__ */ jsx(
57
+ PasswordField,
58
+ {
59
+ id: "password",
60
+ name: "password",
61
+ value: password,
62
+ onChange: (e) => {
63
+ setPassword(e.target.value);
64
+ setPasswordError("");
65
+ }
66
+ }
67
+ ),
68
+ /* @__PURE__ */ jsx(FormWarningText, { text: passwordError }),
69
+ /* @__PURE__ */ jsx(Link, { href: app.urls.forgotPassword, size: "sm", style: { marginTop: "0.5rem" }, children: "Forgot password?" }),
70
+ /* @__PURE__ */ jsx(
71
+ Button,
72
+ {
73
+ style: { marginTop: "1.5rem" },
74
+ onClick: onSubmit,
75
+ children: "Sign In"
76
+ }
77
+ )
78
+ ] });
79
+ }
80
+ export {
81
+ CredentialSignIn as default
82
+ };
@@ -0,0 +1,114 @@
1
+ "use client";
2
+ "use client";
3
+
4
+ // src/components/credential-sign-up.tsx
5
+ import { useState } from "react";
6
+ import PasswordField from "./password-field";
7
+ import FormWarningText from "./form-warning";
8
+ import { validateEmail } from "../utils/email";
9
+ import { getPasswordError } from "@stackframe/stack-shared/dist/helpers/password";
10
+ import { useStackApp } from "..";
11
+ import { Label, Input, Button } from "../components-core";
12
+ import { KnownErrors } from "@stackframe/stack-shared";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ function CredentialSignUp() {
15
+ const [email, setEmail] = useState("");
16
+ const [emailError, setEmailError] = useState("");
17
+ const [password, setPassword] = useState("");
18
+ const [passwordError, setPasswordError] = useState("");
19
+ const [passwordRepeat, setPasswordRepeat] = useState("");
20
+ const [passwordRepeatError, setPasswordRepeatError] = useState("");
21
+ const app = useStackApp();
22
+ const onSubmit = async () => {
23
+ if (!email) {
24
+ setEmailError("Please enter your email");
25
+ return;
26
+ }
27
+ if (!validateEmail(email)) {
28
+ setEmailError("Please enter a valid email");
29
+ return;
30
+ }
31
+ if (!password) {
32
+ setPasswordError("Please enter your password");
33
+ return;
34
+ }
35
+ if (!passwordRepeat) {
36
+ setPasswordRepeatError("Please repeat your password");
37
+ return;
38
+ }
39
+ if (password !== passwordRepeat) {
40
+ setPasswordRepeatError("Passwords do not match");
41
+ return;
42
+ }
43
+ const passwordError2 = getPasswordError(password);
44
+ if (passwordError2) {
45
+ setPasswordError(passwordError2.message);
46
+ return;
47
+ }
48
+ let error;
49
+ error = await app.signUpWithCredential({ email, password });
50
+ if (error instanceof KnownErrors.UserEmailAlreadyExists) {
51
+ setEmailError("User already exists");
52
+ } else if (error) {
53
+ setEmailError(`An error occurred. ${error.message}`);
54
+ }
55
+ };
56
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "stretch" }, children: [
57
+ /* @__PURE__ */ jsx(Label, { htmlFor: "email", children: "Email" }),
58
+ /* @__PURE__ */ jsx(
59
+ Input,
60
+ {
61
+ id: "email",
62
+ type: "email",
63
+ name: "email",
64
+ value: email,
65
+ onChange: (e) => {
66
+ setEmail(e.target.value);
67
+ setEmailError("");
68
+ }
69
+ }
70
+ ),
71
+ /* @__PURE__ */ jsx(FormWarningText, { text: emailError }),
72
+ /* @__PURE__ */ jsx(Label, { htmlFor: "password", style: { marginTop: "1rem" }, children: "Password" }),
73
+ /* @__PURE__ */ jsx(
74
+ PasswordField,
75
+ {
76
+ id: "password",
77
+ name: "password",
78
+ value: password,
79
+ onChange: (e) => {
80
+ setPassword(e.target.value);
81
+ setPasswordError("");
82
+ setPasswordRepeatError("");
83
+ }
84
+ }
85
+ ),
86
+ /* @__PURE__ */ jsx(FormWarningText, { text: passwordError }),
87
+ /* @__PURE__ */ jsx(Label, { htmlFor: "repeat-password", style: { marginTop: "1rem" }, children: "Repeat Password" }),
88
+ /* @__PURE__ */ jsx(
89
+ PasswordField,
90
+ {
91
+ id: "repeat-password",
92
+ name: "repeat-password",
93
+ value: passwordRepeat,
94
+ onChange: (e) => {
95
+ setPasswordRepeat(e.target.value);
96
+ setPasswordError("");
97
+ setPasswordRepeatError("");
98
+ }
99
+ }
100
+ ),
101
+ /* @__PURE__ */ jsx(FormWarningText, { text: passwordRepeatError }),
102
+ /* @__PURE__ */ jsx(
103
+ Button,
104
+ {
105
+ style: { marginTop: "1.5rem" },
106
+ onClick: onSubmit,
107
+ children: "Sign Up"
108
+ }
109
+ )
110
+ ] });
111
+ }
112
+ export {
113
+ CredentialSignUp as default
114
+ };
@@ -0,0 +1,55 @@
1
+ "use client";
2
+ "use client";
3
+
4
+ // src/components/forgot-password.tsx
5
+ import { useState } from "react";
6
+ import FormWarningText from "./form-warning";
7
+ import { validateEmail } from "../utils/email";
8
+ import { useStackApp } from "..";
9
+ import { Button, Input, Label } from "../components-core";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ function ForgotPassword({ onSent }) {
12
+ const [email, setEmail] = useState("");
13
+ const [emailError, setEmailError] = useState("");
14
+ const stackApp = useStackApp();
15
+ const onSubmit = async () => {
16
+ if (!email) {
17
+ setEmailError("Please enter your email");
18
+ return;
19
+ }
20
+ if (!validateEmail(email)) {
21
+ setEmailError("Please enter a valid email");
22
+ return;
23
+ }
24
+ await stackApp.sendForgotPasswordEmail(email);
25
+ onSent?.();
26
+ };
27
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "stretch" }, children: [
28
+ /* @__PURE__ */ jsx(Label, { htmlFor: "email", children: "Your Email" }),
29
+ /* @__PURE__ */ jsx(
30
+ Input,
31
+ {
32
+ id: "email",
33
+ type: "email",
34
+ name: "email",
35
+ value: email,
36
+ onChange: (e) => {
37
+ setEmail(e.target.value);
38
+ setEmailError("");
39
+ }
40
+ }
41
+ ),
42
+ /* @__PURE__ */ jsx(FormWarningText, { text: emailError }),
43
+ /* @__PURE__ */ jsx(
44
+ Button,
45
+ {
46
+ style: { marginTop: "1.5rem" },
47
+ onClick: onSubmit,
48
+ children: "Send Email"
49
+ }
50
+ )
51
+ ] });
52
+ }
53
+ export {
54
+ ForgotPassword as default
55
+ };
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ "use client";
3
+
4
+ // src/components/form-warning.tsx
5
+ import { Text } from "../components-core";
6
+ import { jsx } from "react/jsx-runtime";
7
+ function FormWarningText({ text }) {
8
+ if (!text) {
9
+ return null;
10
+ }
11
+ return /* @__PURE__ */ jsx(Text, { size: "sm", variant: "warning", children: text });
12
+ }
13
+ export {
14
+ FormWarningText as default
15
+ };
@@ -0,0 +1,61 @@
1
+ "use client";
2
+ "use client";
3
+
4
+ // src/components/magic-link-sign-in.tsx
5
+ import { useState } from "react";
6
+ import FormWarningText from "./form-warning";
7
+ import { validateEmail } from "../utils/email";
8
+ import { useStackApp } from "..";
9
+ import { Button, Input, Label } from "../components-core";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ function MagicLinkSignIn() {
12
+ const [email, setEmail] = useState("");
13
+ const [sent, setSent] = useState(false);
14
+ const [error, setError] = useState("");
15
+ const app = useStackApp();
16
+ const onSubmit = async () => {
17
+ if (!email) {
18
+ setError("Please enter your email");
19
+ return;
20
+ }
21
+ if (!validateEmail(email)) {
22
+ setError("Please enter a valid email");
23
+ return;
24
+ }
25
+ const error2 = await app.sendMagicLinkEmail(email);
26
+ if (error2) {
27
+ setError(error2.message);
28
+ return;
29
+ }
30
+ setSent(true);
31
+ };
32
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "stretch" }, children: [
33
+ /* @__PURE__ */ jsx(Label, { htmlFor: "email", children: "Email" }),
34
+ /* @__PURE__ */ jsx(
35
+ Input,
36
+ {
37
+ id: "email",
38
+ type: "email",
39
+ name: "email",
40
+ value: email,
41
+ onChange: (e) => {
42
+ setEmail(e.target.value);
43
+ setError("");
44
+ }
45
+ }
46
+ ),
47
+ /* @__PURE__ */ jsx(FormWarningText, { text: error }),
48
+ /* @__PURE__ */ jsx(
49
+ Button,
50
+ {
51
+ disabled: sent,
52
+ style: { marginTop: "1.5rem" },
53
+ onClick: onSubmit,
54
+ children: sent ? "Email sent" : "Send magic link"
55
+ }
56
+ )
57
+ ] });
58
+ }
59
+ export {
60
+ MagicLinkSignIn as default
61
+ };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ "use client";
3
+
4
+ // src/components/message-card.tsx
5
+ import CardFrame from "./card-frame";
6
+ import { Text } from "../components-core";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ function MessageCard({ children, title, fullPage = false }) {
9
+ return /* @__PURE__ */ jsx(CardFrame, { fullPage, children: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
10
+ /* @__PURE__ */ jsx(Text, { size: "xl", as: "h2", style: { marginBottom: "24px" }, children: title }),
11
+ children
12
+ ] }) });
13
+ }
14
+ export {
15
+ MessageCard as default
16
+ };