@stackframe/stack 2.1.3 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/dist/components/avatar.d.ts +1 -0
  2. package/dist/components/avatar.d.ts.map +1 -0
  3. package/dist/components/avatar.js +1 -0
  4. package/dist/components/card-frame.d.ts +0 -1
  5. package/dist/components/card-frame.d.ts.map +1 -1
  6. package/dist/components/credential-sign-in.d.ts +0 -1
  7. package/dist/components/credential-sign-in.d.ts.map +1 -1
  8. package/dist/components/credential-sign-in.js +8 -20
  9. package/dist/components/credential-sign-up.d.ts +0 -1
  10. package/dist/components/credential-sign-up.d.ts.map +1 -1
  11. package/dist/components/credential-sign-up.js +13 -20
  12. package/dist/components/dashboard-frame.d.ts +23 -0
  13. package/dist/components/dashboard-frame.d.ts.map +1 -0
  14. package/dist/components/dashboard-frame.js +20 -0
  15. package/dist/components/divider-with-text.d.ts +1 -1
  16. package/dist/components/divider-with-text.d.ts.map +1 -1
  17. package/dist/components/divider-with-text.js +3 -3
  18. package/dist/components/forgot-password.d.ts +0 -1
  19. package/dist/components/forgot-password.d.ts.map +1 -1
  20. package/dist/components/forgot-password.js +1 -5
  21. package/dist/components/form-warning.d.ts +0 -1
  22. package/dist/components/logo.d.ts +7 -0
  23. package/dist/components/logo.d.ts.map +1 -0
  24. package/dist/components/logo.js +7 -0
  25. package/dist/components/message-card.d.ts +0 -1
  26. package/dist/components/oauth-button.d.ts +0 -1
  27. package/dist/components/oauth-button.d.ts.map +1 -1
  28. package/dist/components/oauth-button.js +1 -2
  29. package/dist/components/oauth-group.d.ts +0 -1
  30. package/dist/components/password-field.d.ts +0 -1
  31. package/dist/components/password-field.d.ts.map +1 -1
  32. package/dist/components/password-field.js +3 -2
  33. package/dist/components/password-reset-inner.d.ts +0 -1
  34. package/dist/components/password-reset-inner.d.ts.map +1 -1
  35. package/dist/components/password-reset-inner.js +4 -5
  36. package/dist/components/redirect-message-card.d.ts +0 -1
  37. package/dist/components/redirect-message-card.d.ts.map +1 -1
  38. package/dist/components/redirect-message-card.js +8 -1
  39. package/dist/components/separator-with-text.d.ts +3 -0
  40. package/dist/components/separator-with-text.d.ts.map +1 -0
  41. package/dist/components/separator-with-text.js +6 -0
  42. package/dist/components/user-avatar.d.ts +3 -0
  43. package/dist/components/user-avatar.d.ts.map +1 -0
  44. package/dist/components/user-avatar.js +9 -0
  45. package/dist/components/user-button.d.ts +4 -0
  46. package/dist/components/user-button.d.ts.map +1 -0
  47. package/dist/components/user-button.js +25 -0
  48. package/dist/components-core/avatar.d.ts +6 -0
  49. package/dist/components-core/avatar.d.ts.map +1 -0
  50. package/dist/components-core/avatar.js +38 -0
  51. package/dist/components-core/button.d.ts +4 -4
  52. package/dist/components-core/button.d.ts.map +1 -1
  53. package/dist/components-core/button.js +51 -31
  54. package/dist/components-core/card.d.ts +5 -4
  55. package/dist/components-core/card.d.ts.map +1 -1
  56. package/dist/components-core/card.js +28 -9
  57. package/dist/components-core/collapsble.d.ts +5 -0
  58. package/dist/components-core/collapsble.d.ts.map +1 -0
  59. package/dist/components-core/collapsble.js +6 -0
  60. package/dist/components-core/collapsible.d.ts +6 -0
  61. package/dist/components-core/collapsible.d.ts.map +1 -0
  62. package/dist/components-core/collapsible.js +6 -0
  63. package/dist/components-core/container.d.ts +3 -3
  64. package/dist/components-core/container.d.ts.map +1 -1
  65. package/dist/components-core/container.js +1 -1
  66. package/dist/components-core/divider.d.ts +2 -3
  67. package/dist/components-core/divider.d.ts.map +1 -1
  68. package/dist/components-core/divider.js +5 -5
  69. package/dist/components-core/dropdown.d.ts +13 -0
  70. package/dist/components-core/dropdown.d.ts.map +1 -0
  71. package/dist/components-core/dropdown.js +73 -0
  72. package/dist/components-core/index.d.ts +41 -19
  73. package/dist/components-core/index.d.ts.map +1 -1
  74. package/dist/components-core/index.js +80 -4
  75. package/dist/components-core/input.d.ts +2 -3
  76. package/dist/components-core/input.d.ts.map +1 -1
  77. package/dist/components-core/input.js +1 -1
  78. package/dist/components-core/label.d.ts +1 -3
  79. package/dist/components-core/label.d.ts.map +1 -1
  80. package/dist/components-core/label.js +1 -1
  81. package/dist/components-core/link.d.ts +3 -3
  82. package/dist/components-core/link.d.ts.map +1 -1
  83. package/dist/components-core/link.js +3 -3
  84. package/dist/components-core/loading-indicator.d.ts +6 -0
  85. package/dist/components-core/loading-indicator.d.ts.map +1 -0
  86. package/dist/components-core/loading-indicator.js +18 -0
  87. package/dist/components-core/popover.d.ts +6 -0
  88. package/dist/components-core/popover.d.ts.map +1 -0
  89. package/dist/components-core/popover.js +24 -0
  90. package/dist/components-core/separator.d.ts +4 -0
  91. package/dist/components-core/separator.d.ts.map +1 -0
  92. package/dist/components-core/separator.js +20 -0
  93. package/dist/components-core/text.d.ts +2 -3
  94. package/dist/components-core/text.d.ts.map +1 -1
  95. package/dist/components-core/text.js +3 -3
  96. package/dist/components-core-joy/button.d.ts +2 -3
  97. package/dist/components-core-joy/button.d.ts.map +1 -1
  98. package/dist/components-core-joy/button.js +7 -4
  99. package/dist/components-core-joy/divider.d.ts +2 -2
  100. package/dist/components-core-joy/divider.d.ts.map +1 -1
  101. package/dist/components-core-joy/divider.js +5 -5
  102. package/dist/components-core-joy/input.d.ts +2 -3
  103. package/dist/components-core-joy/input.d.ts.map +1 -1
  104. package/dist/components-core-joy/input.js +3 -3
  105. package/dist/components-core-joy/separator.d.ts +2 -0
  106. package/dist/components-core-joy/separator.d.ts.map +1 -0
  107. package/dist/components-core-joy/separator.js +7 -0
  108. package/dist/components-core-joy/text.d.ts +6 -3
  109. package/dist/components-core-joy/text.d.ts.map +1 -1
  110. package/dist/components-core-joy/text.js +4 -3
  111. package/dist/components-page/account-settings.d.ts +3 -0
  112. package/dist/components-page/account-settings.d.ts.map +1 -0
  113. package/dist/components-page/account-settings.js +95 -0
  114. package/dist/components-page/email-verification.d.ts +1 -2
  115. package/dist/components-page/email-verification.d.ts.map +1 -1
  116. package/dist/components-page/email-verification.js +14 -14
  117. package/dist/components-page/forgot-password.d.ts +0 -1
  118. package/dist/components-page/oauth-callback.d.ts +0 -1
  119. package/dist/components-page/password-reset.d.ts +0 -1
  120. package/dist/components-page/password-reset.d.ts.map +1 -1
  121. package/dist/components-page/password-reset.js +14 -15
  122. package/dist/components-page/sign-in.d.ts +0 -1
  123. package/dist/components-page/sign-in.js +3 -3
  124. package/dist/components-page/sign-out.d.ts +0 -1
  125. package/dist/components-page/sign-up.d.ts +0 -1
  126. package/dist/components-page/sign-up.js +3 -3
  127. package/dist/components-page/stack-handler.d.ts +0 -1
  128. package/dist/components-page/stack-handler.d.ts.map +1 -1
  129. package/dist/components-page/stack-handler.js +5 -0
  130. package/dist/icons/logo.d.ts +3 -0
  131. package/dist/icons/logo.d.ts.map +1 -0
  132. package/dist/icons/logo.js +7 -0
  133. package/dist/index.d.ts +3 -1
  134. package/dist/index.d.ts.map +1 -1
  135. package/dist/index.js +3 -0
  136. package/dist/lib/auth.d.ts +1 -2
  137. package/dist/lib/auth.d.ts.map +1 -1
  138. package/dist/lib/auth.js +8 -7
  139. package/dist/lib/cookie.d.ts +0 -1
  140. package/dist/lib/hooks.d.ts +0 -1
  141. package/dist/lib/stack-app.d.ts +17 -10
  142. package/dist/lib/stack-app.d.ts.map +1 -1
  143. package/dist/lib/stack-app.js +97 -35
  144. package/dist/providers/component-provider.d.ts +74 -20
  145. package/dist/providers/component-provider.d.ts.map +1 -1
  146. package/dist/providers/component-provider.js +41 -18
  147. package/dist/providers/design-provider.d.ts +0 -1
  148. package/dist/providers/joy-provider.d.ts +8 -11
  149. package/dist/providers/joy-provider.d.ts.map +1 -1
  150. package/dist/providers/joy-provider.js +6 -8
  151. package/dist/providers/stack-provider-client.d.ts +0 -1
  152. package/dist/providers/stack-provider.d.ts +0 -1
  153. package/dist/providers/styled-components-registry.d.ts +0 -1
  154. package/dist/providers/theme-provider.d.ts +0 -1
  155. package/dist/utils/constants.d.ts +8 -1
  156. package/dist/utils/constants.d.ts.map +1 -1
  157. package/dist/utils/constants.js +2 -0
  158. package/dist/utils/email.d.ts +0 -1
  159. package/dist/utils/next.d.ts +0 -1
  160. package/dist/utils/url.d.ts +0 -1
  161. package/package.json +11 -7
@@ -1,6 +1,4 @@
1
1
  import React from "react";
2
2
  import * as LabelPrimitive from "@radix-ui/react-label";
3
- export type LabelProps = React.ComponentProps<typeof LabelPrimitive.Root>;
4
3
  declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
5
- export default Label;
6
- //# sourceMappingURL=label.d.ts.map
4
+ export { Label };
@@ -1 +1 @@
1
- {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/components-core/label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AAexD,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAE1E,QAAA,MAAM,KAAK,yJAYV,CAAC;AAGF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/components-core/label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AAexD,QAAA,MAAM,KAAK,yJAYV,CAAC;AAGF,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -19,4 +19,4 @@ const Label = React.forwardRef((props, ref) => {
19
19
  return _jsx(Primitive, { color: colorMode === 'dark' ? SECONDARY_FONT_COLORS.dark : SECONDARY_FONT_COLORS.light, ref: ref, ...props });
20
20
  });
21
21
  Label.displayName = LabelPrimitive.Root.displayName;
22
- export default Label;
22
+ export { Label };
@@ -1,9 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import { Url } from "url";
3
3
  import React from "react";
4
- export type LinkProps = {
4
+ type LinkProps = {
5
5
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
6
6
  href: Url | string;
7
7
  } & Omit<React.HTMLProps<HTMLLinkElement>, 'size' | 'href'>;
8
- export default function Link({ size, href, style, ...props }: LinkProps): import("react/jsx-runtime").JSX.Element;
9
- //# sourceMappingURL=link.d.ts.map
8
+ export declare function Link({ size, href, style, ...props }: LinkProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/components-core/link.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACxC,IAAI,EAAE,GAAG,GAAG,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;AAE3D,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAC3B,IAAS,EACT,IAAI,EACJ,KAAK,EACL,GAAG,KAAK,EACT,EAAG,SAAS,2CAmBZ"}
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/components-core/link.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,KAAK,SAAS,GAAG;IACf,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACxC,IAAI,EAAE,GAAG,GAAG,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;AAE3D,wBAAgB,IAAI,CAAC,EACnB,IAAS,EACT,IAAI,EACJ,KAAK,EACL,GAAG,KAAK,EACT,EAAG,SAAS,2CAmBZ"}
@@ -1,15 +1,15 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import NextLink from "next/link";
4
- import { FONT_FAMILY, FONT_SIZES, LINE_HEIGHTS } from "../utils/constants";
4
+ import { FONT_FAMILY, FONT_SIZES, LINE_HEIGHTS, LINK_COLORS } from "../utils/constants";
5
5
  import { useDesign } from "..";
6
- export default function Link({ size = 'md', href, style, ...props }) {
6
+ export function Link({ size = 'md', href, style, ...props }) {
7
7
  const { colorMode } = useDesign();
8
8
  return (_jsx(NextLink, { href: href, style: {
9
9
  fontSize: FONT_SIZES[size],
10
10
  lineHeight: LINE_HEIGHTS[size],
11
11
  fontFamily: FONT_FAMILY,
12
- color: colorMode === 'dark' ? '#3B82F6' : '#2563EB',
12
+ color: LINK_COLORS[colorMode],
13
13
  textDecoration: 'underline',
14
14
  margin: 0,
15
15
  padding: 0,
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const LoadingIndicator: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
3
+ color: string;
4
+ size?: number | undefined;
5
+ }>>;
6
+ export default LoadingIndicator;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading-indicator.d.ts","sourceRoot":"","sources":["../../src/components-core/loading-indicator.tsx"],"names":[],"mappings":";AAQA,QAAA,MAAM,gBAAgB;WAAuB,MAAM;;GAUlD,CAAC;AACF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import styled, { keyframes } from 'styled-components';
2
+ const l7 = keyframes `
3
+ 33% { background-size: calc(100%/3) 0%, calc(100%/3) 100%, calc(100%/3) 100%; }
4
+ 50% { background-size: calc(100%/3) 100%, calc(100%/3) 0%, calc(100%/3) 100%; }
5
+ 66% { background-size: calc(100%/3) 100%, calc(100%/3) 100%, calc(100%/3) 0%; }
6
+ `;
7
+ const LoadingIndicator = styled.div `
8
+ width: ${props => props.size || 36}px;
9
+ aspect-ratio: 4;
10
+ --_g: no-repeat radial-gradient(circle closest-side, ${props => props.color} 90%, #0000);
11
+ background:
12
+ var(--_g) 0% 50%,
13
+ var(--_g) 50% 50%,
14
+ var(--_g) 100% 50%;
15
+ background-size: calc(100%/3) 100%;
16
+ animation: ${l7} 1s infinite linear;
17
+ `;
18
+ export default LoadingIndicator;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
3
+ declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
4
+ declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
+ declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
6
+ export { Popover, PopoverTrigger, PopoverContent };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/components-core/popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAI5D,QAAA,MAAM,OAAO,yCAAwB,CAAC;AAEtC,QAAA,MAAM,cAAc,gHAA2B,CAAC;AAiBhD,QAAA,MAAM,cAAc,gKAkBlB,CAAC;AAGH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
4
+ import styled, { css } from 'styled-components';
5
+ import { useDesign } from '..';
6
+ const Popover = PopoverPrimitive.Root;
7
+ const PopoverTrigger = PopoverPrimitive.Trigger;
8
+ const StyledContent = styled(PopoverPrimitive.Content) `
9
+ z-index: 50;
10
+ width: 18rem;
11
+ border-radius: 0.375rem;
12
+ border: 1px solid ${({ $borderColor }) => $borderColor};
13
+ background-color: ${({ $bgColor }) => $bgColor};
14
+ padding: 1rem;
15
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
16
+ outline: none;
17
+ ${({ className }) => className && css `${className}`};
18
+ `;
19
+ const PopoverContent = React.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref) => {
20
+ const { colors } = useDesign();
21
+ return (_jsx(PopoverPrimitive.Portal, { children: _jsx(StyledContent, { "$borderColor": colors.neutralColor, "$bgColor": colors.backgroundColor, ref: ref, align: align, sideOffset: sideOffset, className: className, ...props }) }));
22
+ });
23
+ PopoverContent.displayName = 'PopoverContent';
24
+ export { Popover, PopoverTrigger, PopoverContent };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
3
+ declare const Separator: React.ForwardRefExoticComponent<Omit<SeparatorPrimitive.SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
+ export { Separator };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../../src/components-core/separator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAiBhE,QAAA,MAAM,SAAS,6JAab,CAAC;AAIH,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React from 'react';
4
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
5
+ import styled from 'styled-components';
6
+ import { useDesign } from '..';
7
+ const StyledSeparator = styled(SeparatorPrimitive.Root) `
8
+ flex-shrink: 0;
9
+ background-color: ${props => props.$color};
10
+
11
+ ${(props) => props.$orientation === 'horizontal'
12
+ ? 'height: 1px; width: 100%;'
13
+ : 'height: 100%; width: 1px;'}
14
+ `;
15
+ const Separator = React.forwardRef(({ orientation = 'horizontal', decorative = true, ...props }, ref) => {
16
+ const { colors } = useDesign();
17
+ return _jsx(StyledSeparator, { ref: ref, decorative: decorative, "$orientation": orientation, "$color": colors.neutralColor, ...props });
18
+ });
19
+ Separator.displayName = 'Separator';
20
+ export { Separator };
@@ -1,9 +1,8 @@
1
1
  import React from "react";
2
- export type TextProps = {
2
+ type TextProps = {
3
3
  variant?: 'primary' | 'secondary' | 'warning' | 'success';
4
4
  as?: 'p' | 'h6' | 'h5' | 'h4' | 'h3' | 'h2' | 'h1';
5
5
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
6
6
  } & Omit<React.HTMLProps<HTMLParagraphElement>, 'size'>;
7
7
  declare const Text: React.ForwardRefExoticComponent<Omit<TextProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
8
- export default Text;
9
- //# sourceMappingURL=text.d.ts.map
8
+ export { Text };
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/components-core/text.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;IAC1D,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,GAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAClD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CACzC,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC,CAAA;AAEvD,QAAA,MAAM,IAAI,qGA8CR,CAAC;AAGH,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/components-core/text.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,KAAK,SAAS,GAAG;IACf,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;IAC1D,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,GAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAClD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CACzC,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC,CAAA;AAEvD,QAAA,MAAM,IAAI,qGA8CR,CAAC;AAGH,OAAO,EAAE,IAAI,EAAE,CAAC"}
@@ -16,11 +16,11 @@ const Text = React.forwardRef(({ variant = 'primary', size = 'md', as = 'p', sty
16
16
  break;
17
17
  }
18
18
  case 'warning': {
19
- textColor = '#ff4500';
19
+ textColor = '#b33b1d';
20
20
  break;
21
21
  }
22
22
  case 'success': {
23
- textColor = '#32cd32';
23
+ textColor = '#3da63d';
24
24
  break;
25
25
  }
26
26
  }
@@ -39,4 +39,4 @@ const Text = React.forwardRef(({ variant = 'primary', size = 'md', as = 'p', sty
39
39
  }, props.children);
40
40
  });
41
41
  Text.displayName = 'Typography';
42
- export default Text;
42
+ export { Text };
@@ -1,3 +1,2 @@
1
- import { ButtonProps } from "../components-core";
2
- export default function Button({ variant, color, size, loading, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=button.d.ts.map
1
+ import React from "react";
2
+ export declare const Button: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("../components-core/button").ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/components-core-joy/button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAIjD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,OAAmB,EACnB,KAAK,EACL,IAAW,EACX,OAAe,EACf,GAAG,KAAK,EACT,EAAG,WAAW,2CAmCd"}
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/components-core-joy/button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,eAAO,MAAM,MAAM,oPA+CjB,CAAC"}
@@ -1,19 +1,21 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React from "react";
3
4
  import { Button as JoyButton } from '@mui/joy';
4
5
  import Color from "color";
5
- export default function Button({ variant = "primary", color, size = "md", loading = false, ...props }) {
6
+ export const Button = React.forwardRef(({ variant = "primary", color, size = "md", loading = false, ...props }, ref) => {
6
7
  const muiVariant = {
7
8
  primary: "primary",
8
9
  secondary: "neutral",
9
10
  warning: "danger",
11
+ link: "primary",
10
12
  }[variant] || "primary";
11
- const { children, action, ref, ...validProps } = props;
13
+ const { children, action, ref: _, ...validProps } = props;
12
14
  const c = Color(color);
13
15
  const changeColor = (value) => {
14
16
  return c.hsl(c.hue(), c.saturationl(), c.lightness() + (c.isDark() ? value : -value)).toString();
15
17
  };
16
- return _jsx(JoyButton, { color: muiVariant, sx: color ? {
18
+ return _jsx(JoyButton, { color: muiVariant, variant: variant === 'link' ? 'plain' : 'solid', sx: color ? {
17
19
  backgroundColor: color,
18
20
  color: c.isDark() ? 'white' : 'black',
19
21
  '&:hover': {
@@ -22,5 +24,6 @@ export default function Button({ variant = "primary", color, size = "md", loadin
22
24
  '&:active': {
23
25
  backgroundColor: changeColor(20)
24
26
  },
27
+ 'textDecoration': variant === 'link' ? 'underline' : 'none',
25
28
  } : {}, size: size, loading: loading, ...validProps, children: children });
26
- }
29
+ });
@@ -1,3 +1,3 @@
1
- import { DividerProps } from "../components-core";
2
- export default function Divider(props: DividerProps): import("react/jsx-runtime").JSX.Element;
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
3
  //# sourceMappingURL=divider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"divider.d.ts","sourceRoot":"","sources":["../../src/components-core-joy/divider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAG,YAAY,2CAGnD"}
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 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Divider as JoyDivider } from '@mui/joy';
4
- export default function Divider(props) {
5
- const { orientation, ref, ...validProps } = props;
6
- return _jsx(JoyDivider, { ...validProps, orientation: orientation });
7
- }
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,3 +1,2 @@
1
- import { InputProps } from "../components-core";
2
- export default function Input(props: InputProps): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=input.d.ts.map
1
+ import React from 'react';
2
+ export declare const Input: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.InputHTMLAttributes<HTMLInputElement> & Pick<React.HTMLProps<HTMLInputElement>, "ref">, "ref"> & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/components-core-joy/input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,KAAK,EAAG,UAAU,2CAG/C"}
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/components-core-joy/input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,KAAK,8RAUhB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React from 'react';
3
4
  import { Input as JoyInput } from '@mui/joy';
4
- export default function Input(props) {
5
- const { color, size, ref, ...validProps } = props;
5
+ export const Input = React.forwardRef(({ color, size, ref: _, ...validProps }, ref) => {
6
6
  return _jsx(JoyInput, { ...validProps });
7
- }
7
+ });
@@ -0,0 +1,2 @@
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>>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../../src/components-core-joy/separator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,SAAS,mRASpB,CAAC"}
@@ -0,0 +1,7 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React from "react";
4
+ import { Divider as JoySeparator } from '@mui/joy';
5
+ export const Separator = React.forwardRef(({ orientation, ref: _, ...validProps }, ref) => {
6
+ return _jsx(JoySeparator, { ...validProps, orientation: orientation });
7
+ });
@@ -1,3 +1,6 @@
1
- import { TextProps } from "../components-core";
2
- export default function Text(props: TextProps): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=text.d.ts.map
1
+ import React from 'react';
2
+ export declare const Text: React.ForwardRefExoticComponent<Omit<Omit<Omit<{
3
+ variant?: "primary" | "secondary" | "warning" | "success" | undefined;
4
+ as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | undefined;
5
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
6
+ } & Omit<React.HTMLProps<HTMLParagraphElement>, "size">, "ref"> & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/components-core-joy/text.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAG,SAAS,2CAyB7C"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/components-core-joy/text.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,IAAI;;;;oNA4Bf,CAAC"}
@@ -1,8 +1,9 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React from 'react';
3
4
  import { Typography as JoyText } from '@mui/joy';
4
- export default function Text(props) {
5
- const { color, size, as, variant, ref, ...validProps } = props;
5
+ export const Text = React.forwardRef((props, ref) => {
6
+ const { color, size, as, variant, ref: _, ...validProps } = props;
6
7
  const muiLevel = {
7
8
  h1: 'h1',
8
9
  h2: 'h2',
@@ -25,4 +26,4 @@ export default function Text(props) {
25
26
  warning: 'danger',
26
27
  }[variant || 'primary'];
27
28
  return _jsx(JoyText, { level: muiLevel, color: muiColor, ...validProps });
28
- }
29
+ });
@@ -0,0 +1,3 @@
1
+ export default function AccountSettings({ fullPage }: {
2
+ fullPage?: boolean;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-settings.d.ts","sourceRoot":"","sources":["../../src/components-page/account-settings.tsx"],"names":[],"mappings":"AAiMA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,QAAc,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,2CA6BjF"}
@@ -0,0 +1,95 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { PasswordField, useUser } from '..';
4
+ import RedirectMessageCard from '../components/redirect-message-card';
5
+ import { Text, Label, Input, Button, Card, CardHeader, CardContent, CardFooter, Container } from "../components-core";
6
+ import UserAvatar from '../components/user-avatar';
7
+ import { useState } from 'react';
8
+ import FormWarningText from '../components/form-warning';
9
+ import { getPasswordError } from '@stackframe/stack-shared/dist/helpers/password';
10
+ function SettingSection(props) {
11
+ return (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(Text, { size: 'xl', as: 'h2', children: props.title }), _jsx(Text, { variant: 'secondary', children: props.desc })] }), props.children && _jsx(CardContent, { children: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '1.5rem' }, children: props.children }) }), props.buttonText && _jsx(CardFooter, { children: _jsx("div", { style: { display: 'flex', justifyContent: 'flex-end', width: '100%' }, children: _jsx(Button, { disabled: props.buttonDisabled, onClick: props.onButtonClick, variant: props.buttonVariant, children: props.buttonText }) }) })] }));
12
+ }
13
+ function ProfileSection() {
14
+ const user = useUser();
15
+ const [userInfo, setUserInfo] = useState({ displayName: user?.displayName || '' });
16
+ const [changed, setChanged] = useState(false);
17
+ return (_jsxs(SettingSection, { title: 'Profile', desc: 'Your profile information', buttonDisabled: !changed, buttonText: 'Save', onButtonClick: async () => {
18
+ await user?.update(userInfo);
19
+ setChanged(false);
20
+ }, children: [_jsxs("div", { style: { display: 'flex', gap: '1rem', alignItems: 'center' }, children: [_jsx(UserAvatar, { size: 60 }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx(Text, { size: 'lg', children: user?.displayName }), _jsx(Text, { variant: 'secondary', size: 'sm', children: user?.primaryEmail })] })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx(Label, { htmlFor: 'display-name', children: "Display Name" }), _jsx(Input, { id: 'display-name', value: userInfo.displayName, onChange: (e) => {
21
+ setUserInfo((i) => ({ ...i, displayName: e.target.value }));
22
+ setChanged(true);
23
+ } })] })] }));
24
+ }
25
+ function EmailVerificationSection() {
26
+ const user = useUser();
27
+ const [emailSent, setEmailSent] = useState(false);
28
+ return (_jsx(SettingSection, { title: 'Email Verification', desc: 'We want to make sure that you own the email address', buttonDisabled: emailSent, buttonText: !user?.primaryEmailVerified ?
29
+ emailSent ?
30
+ 'Email sent!' :
31
+ 'Send Email'
32
+ : undefined, onButtonClick: async () => {
33
+ await user?.sendVerificationEmail();
34
+ setEmailSent(true);
35
+ }, children: user?.primaryEmailVerified ?
36
+ _jsx(Text, { variant: 'success', children: "Your email has been verified" }) :
37
+ _jsx(Text, { variant: 'warning', children: "Your email has not been verified" }) }));
38
+ }
39
+ function PasswordSection() {
40
+ const user = useUser();
41
+ const [oldPassword, setOldPassword] = useState('');
42
+ const [oldPasswordError, setOldPasswordError] = useState('');
43
+ const [newPassword, setNewPassword] = useState('');
44
+ const [newPasswordError, setNewPasswordError] = useState('');
45
+ if (user?.authMethod !== 'credential') {
46
+ return null;
47
+ }
48
+ return (_jsxs(SettingSection, { title: 'Password', desc: 'Change your password', buttonDisabled: !oldPassword || !newPassword, buttonText: 'Save', onButtonClick: async () => {
49
+ if (oldPassword && newPassword) {
50
+ const errorMessage = getPasswordError(newPassword);
51
+ if (errorMessage) {
52
+ setNewPasswordError(errorMessage.message);
53
+ }
54
+ else {
55
+ const errorCode = await user?.updatePassword({ oldPassword, newPassword });
56
+ if (errorCode) {
57
+ setOldPasswordError('Incorrect password');
58
+ }
59
+ else {
60
+ setOldPassword('');
61
+ setNewPassword('');
62
+ }
63
+ }
64
+ }
65
+ else if (oldPassword && !newPassword) {
66
+ setNewPasswordError('Please enter a new password');
67
+ }
68
+ else if (newPassword && !oldPassword) {
69
+ setOldPasswordError('Please enter your old password');
70
+ }
71
+ }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx(Label, { htmlFor: 'old-password', children: "Old Password" }), _jsx(PasswordField, { id: 'old-password', value: oldPassword, onChange: (e) => {
72
+ setOldPassword(e.target.value);
73
+ setOldPasswordError('');
74
+ } }), _jsx(FormWarningText, { text: oldPasswordError })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx(Label, { htmlFor: 'new-password', children: "New Password" }), _jsx(PasswordField, { id: 'new-password', value: newPassword, onChange: (e) => {
75
+ setNewPassword(e.target.value);
76
+ setNewPasswordError('');
77
+ } }), _jsx(FormWarningText, { text: newPasswordError })] })] }));
78
+ }
79
+ function SignOutSection() {
80
+ const user = useUser();
81
+ return (_jsx(SettingSection, { title: 'Sign out', desc: 'Sign out of your account on this device', buttonVariant: 'secondary', buttonText: 'Sign Out', onButtonClick: () => user?.signOut() }));
82
+ }
83
+ export default function AccountSettings({ fullPage = false }) {
84
+ const user = useUser();
85
+ if (!user) {
86
+ return _jsx(RedirectMessageCard, { type: 'signedOut', fullPage: fullPage });
87
+ }
88
+ const inner = (_jsxs("div", { style: { padding: fullPage ? '1rem' : 0, display: 'flex', flexDirection: 'column', gap: '1.5rem' }, children: [_jsxs("div", { children: [_jsx(Text, { size: "xl", as: 'h2', style: { marginBottom: '0.5rem', fontWeight: '700' }, children: "Account Settings" }), _jsx(Text, { variant: 'secondary', children: "Manage your account" })] }), _jsx(ProfileSection, {}), _jsx(EmailVerificationSection, {}), _jsx(PasswordSection, {}), _jsx(SignOutSection, {})] }));
89
+ if (fullPage) {
90
+ return (_jsx(Container, { size: 'sm', children: inner }));
91
+ }
92
+ else {
93
+ return inner;
94
+ }
95
+ }
@@ -1,5 +1,4 @@
1
1
  export default function EmailVerification({ searchParams: { code, }, fullPage, }: {
2
2
  searchParams?: Record<string, string>;
3
3
  fullPage?: boolean;
4
- }): import("react/jsx-runtime").JSX.Element | null;
5
- //# sourceMappingURL=email-verification.d.ts.map
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"email-verification.d.ts","sourceRoot":"","sources":["../../src/components-page/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"}
1
+ {"version":3,"file":"email-verification.d.ts","sourceRoot":"","sources":["../../src/components-page/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,2CAgCA"}
@@ -4,7 +4,7 @@ import { use } from "react";
4
4
  import { useStackApp } from "..";
5
5
  import MessageCard from "../components/message-card";
6
6
  import RedirectMessageCard from "../components/redirect-message-card";
7
- import { EmailVerificationLinkExpiredErrorCode, EmailVerificationLinkInvalidErrorCode, EmailVerificationLinkUsedErrorCode } from "@stackframe/stack-shared/dist/utils/types";
7
+ import { KnownErrors } from "@stackframe/stack-shared";
8
8
  export default function EmailVerification({ searchParams: { code = "", } = {}, fullPage = false, }) {
9
9
  const stackApp = useStackApp();
10
10
  const invalidJsx = (_jsx(MessageCard, { title: "Invalid Verification Link", fullPage: fullPage, children: _jsx("p", { children: "Please check if you have the correct link. If you continue to have issues, please contact support." }) }));
@@ -12,18 +12,18 @@ export default function EmailVerification({ searchParams: { code = "", } = {}, f
12
12
  if (!code) {
13
13
  return invalidJsx;
14
14
  }
15
- const errorCode = use(stackApp.verifyEmail(code));
16
- switch (errorCode) {
17
- case EmailVerificationLinkInvalidErrorCode: {
18
- return invalidJsx;
19
- }
20
- case EmailVerificationLinkExpiredErrorCode: {
21
- return expiredJsx;
22
- }
23
- case EmailVerificationLinkUsedErrorCode:
24
- case undefined: {
25
- return _jsx(RedirectMessageCard, { type: 'emailVerified', fullPage: fullPage });
26
- }
15
+ const error = use(stackApp.verifyEmail(code));
16
+ if (error instanceof KnownErrors.EmailVerificationCodeNotFound) {
17
+ return invalidJsx;
18
+ }
19
+ else if (error instanceof KnownErrors.EmailVerificationCodeExpired) {
20
+ return expiredJsx;
21
+ }
22
+ else if (error instanceof KnownErrors.EmailVerificationCodeAlreadyUsed) {
23
+ // everything fine, continue
24
+ }
25
+ else if (error) {
26
+ throw error;
27
27
  }
28
- return null;
28
+ return _jsx(RedirectMessageCard, { type: 'emailVerified', fullPage: fullPage });
29
29
  }
@@ -1,4 +1,3 @@
1
1
  export default function ForgotPassword({ fullPage }: {
2
2
  fullPage?: boolean;
3
3
  }): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=forgot-password.d.ts.map
@@ -1,2 +1 @@
1
1
  export default function OAuthCallback(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=oauth-callback.d.ts.map
@@ -2,4 +2,3 @@ export default function PasswordReset({ searchParams, fullPage, }: {
2
2
  searchParams?: Record<string, string>;
3
3
  fullPage?: boolean;
4
4
  }): import("react/jsx-runtime").JSX.Element;
5
- //# sourceMappingURL=password-reset.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"password-reset.d.ts","sourceRoot":"","sources":["../../src/components-page/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
+ {"version":3,"file":"password-reset.d.ts","sourceRoot":"","sources":["../../src/components-page/password-reset.tsx"],"names":[],"mappings":"AAeA,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,2CAuCA"}
@@ -4,9 +4,9 @@ import MessageCard from "../components/message-card";
4
4
  import { useStackApp } from "..";
5
5
  import { use } from "react";
6
6
  import PasswordResetInner from "../components/password-reset-inner";
7
- import { PasswordResetLinkExpiredErrorCode, PasswordResetLinkInvalidErrorCode, PasswordResetLinkUsedErrorCode } from "@stackframe/stack-shared/dist/utils/types";
8
7
  import { cacheFunction } from "@stackframe/stack-shared/dist/utils/caches";
9
8
  import { Text } from "../components-core";
9
+ import { KnownErrors } from "@stackframe/stack-shared";
10
10
  const cachedVerifyPasswordResetCode = cacheFunction(async (stackApp, code) => {
11
11
  return await stackApp.verifyPasswordResetCode(code);
12
12
  });
@@ -19,19 +19,18 @@ export default function PasswordReset({ searchParams, fullPage = false, }) {
19
19
  if (!code) {
20
20
  return invalidJsx;
21
21
  }
22
- const errorCode = use(cachedVerifyPasswordResetCode(stackApp, code));
23
- switch (errorCode) {
24
- case PasswordResetLinkInvalidErrorCode: {
25
- return invalidJsx;
26
- }
27
- case PasswordResetLinkExpiredErrorCode: {
28
- return expiredJsx;
29
- }
30
- case PasswordResetLinkUsedErrorCode: {
31
- return usedJsx;
32
- }
33
- case undefined: {
34
- return _jsx(PasswordResetInner, { code: code, fullPage: fullPage });
35
- }
22
+ const error = use(cachedVerifyPasswordResetCode(stackApp, code));
23
+ if (error instanceof KnownErrors.PasswordResetCodeNotFound) {
24
+ return invalidJsx;
25
+ }
26
+ else if (error instanceof KnownErrors.PasswordResetCodeExpired) {
27
+ return expiredJsx;
28
+ }
29
+ else if (error instanceof KnownErrors.PasswordResetCodeAlreadyUsed) {
30
+ return usedJsx;
31
+ }
32
+ else if (error) {
33
+ throw error;
36
34
  }
35
+ return _jsx(PasswordResetInner, { code: code, fullPage: fullPage });
37
36
  }
@@ -1,4 +1,3 @@
1
1
  export default function SignIn({ fullPage }: {
2
2
  fullPage?: boolean;
3
3
  }): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=sign-in.d.ts.map