@stackframe/stack 2.4.13 → 2.4.15

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 (104) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/components/credential-sign-in.js +45 -65
  3. package/dist/components/credential-sign-in.js.map +1 -1
  4. package/dist/components/credential-sign-up.js +74 -98
  5. package/dist/components/credential-sign-up.js.map +1 -1
  6. package/dist/components/forgot-password.js +41 -38
  7. package/dist/components/forgot-password.js.map +1 -1
  8. package/dist/components/magic-link-sign-in.js +37 -41
  9. package/dist/components/magic-link-sign-in.js.map +1 -1
  10. package/dist/components/oauth-button.js +47 -53
  11. package/dist/components/oauth-button.js.map +1 -1
  12. package/dist/components/password-field.js +6 -8
  13. package/dist/components/password-field.js.map +1 -1
  14. package/dist/components/password-reset-inner.js +61 -56
  15. package/dist/components/password-reset-inner.js.map +1 -1
  16. package/dist/components/redirect-message-card.js +1 -2
  17. package/dist/components/redirect-message-card.js.map +1 -1
  18. package/dist/components/user-avatar.d.mts +1 -0
  19. package/dist/components/user-avatar.d.ts +1 -0
  20. package/dist/components/user-avatar.js +7 -5
  21. package/dist/components/user-avatar.js.map +1 -1
  22. package/dist/components/user-button.js +14 -18
  23. package/dist/components/user-button.js.map +1 -1
  24. package/dist/components-core/button.d.mts +1 -0
  25. package/dist/components-core/button.d.ts +1 -0
  26. package/dist/components-core/button.js +31 -14
  27. package/dist/components-core/button.js.map +1 -1
  28. package/dist/components-core/card.js +3 -3
  29. package/dist/components-core/card.js.map +1 -1
  30. package/dist/components-core/input.js +10 -6
  31. package/dist/components-core/input.js.map +1 -1
  32. package/dist/components-core/label.js +2 -3
  33. package/dist/components-core/label.js.map +1 -1
  34. package/dist/components-core/tabs.js +9 -5
  35. package/dist/components-core/tabs.js.map +1 -1
  36. package/dist/components-page/account-settings.js +8 -8
  37. package/dist/components-page/account-settings.js.map +1 -1
  38. package/dist/components-page/auth-page.js +1 -1
  39. package/dist/components-page/auth-page.js.map +1 -1
  40. package/dist/components-page/password-reset.js.map +1 -1
  41. package/dist/components-page/stack-handler.d.mts +1 -0
  42. package/dist/components-page/stack-handler.d.ts +1 -0
  43. package/dist/esm/components/credential-sign-in.js +45 -65
  44. package/dist/esm/components/credential-sign-in.js.map +1 -1
  45. package/dist/esm/components/credential-sign-up.js +74 -98
  46. package/dist/esm/components/credential-sign-up.js.map +1 -1
  47. package/dist/esm/components/forgot-password.js +41 -38
  48. package/dist/esm/components/forgot-password.js.map +1 -1
  49. package/dist/esm/components/magic-link-sign-in.js +37 -41
  50. package/dist/esm/components/magic-link-sign-in.js.map +1 -1
  51. package/dist/esm/components/oauth-button.js +47 -53
  52. package/dist/esm/components/oauth-button.js.map +1 -1
  53. package/dist/esm/components/password-field.js +6 -8
  54. package/dist/esm/components/password-field.js.map +1 -1
  55. package/dist/esm/components/password-reset-inner.js +61 -56
  56. package/dist/esm/components/password-reset-inner.js.map +1 -1
  57. package/dist/esm/components/redirect-message-card.js +1 -2
  58. package/dist/esm/components/redirect-message-card.js.map +1 -1
  59. package/dist/esm/components/user-avatar.js +7 -5
  60. package/dist/esm/components/user-avatar.js.map +1 -1
  61. package/dist/esm/components/user-button.js +26 -19
  62. package/dist/esm/components/user-button.js.map +1 -1
  63. package/dist/esm/components-core/button.js +33 -16
  64. package/dist/esm/components-core/button.js.map +1 -1
  65. package/dist/esm/components-core/card.js +3 -3
  66. package/dist/esm/components-core/card.js.map +1 -1
  67. package/dist/esm/components-core/input.js +11 -7
  68. package/dist/esm/components-core/input.js.map +1 -1
  69. package/dist/esm/components-core/label.js +2 -3
  70. package/dist/esm/components-core/label.js.map +1 -1
  71. package/dist/esm/components-core/tabs.js +10 -6
  72. package/dist/esm/components-core/tabs.js.map +1 -1
  73. package/dist/esm/components-page/account-settings.js +8 -8
  74. package/dist/esm/components-page/account-settings.js.map +1 -1
  75. package/dist/esm/components-page/auth-page.js +1 -1
  76. package/dist/esm/components-page/auth-page.js.map +1 -1
  77. package/dist/esm/components-page/password-reset.js.map +1 -1
  78. package/dist/esm/lib/stack-app.js +18 -1
  79. package/dist/esm/lib/stack-app.js.map +1 -1
  80. package/dist/esm/utils/constants.js +10 -10
  81. package/dist/esm/utils/constants.js.map +1 -1
  82. package/dist/index.d.mts +1 -0
  83. package/dist/index.d.ts +1 -0
  84. package/dist/lib/hooks.d.mts +1 -0
  85. package/dist/lib/hooks.d.ts +1 -0
  86. package/dist/lib/stack-app.d.mts +6 -1
  87. package/dist/lib/stack-app.d.ts +6 -1
  88. package/dist/lib/stack-app.js +18 -1
  89. package/dist/lib/stack-app.js.map +1 -1
  90. package/dist/providers/stack-provider-client.d.mts +1 -0
  91. package/dist/providers/stack-provider-client.d.ts +1 -0
  92. package/dist/providers/stack-provider.d.mts +1 -0
  93. package/dist/providers/stack-provider.d.ts +1 -0
  94. package/dist/utils/constants.d.mts +26 -26
  95. package/dist/utils/constants.d.ts +26 -26
  96. package/dist/utils/constants.js +12 -12
  97. package/dist/utils/constants.js.map +1 -1
  98. package/package.json +9 -6
  99. package/dist/components-core/loading-indicator.d.mts +0 -11
  100. package/dist/components-core/loading-indicator.d.ts +0 -11
  101. package/dist/components-core/loading-indicator.js +0 -62
  102. package/dist/components-core/loading-indicator.js.map +0 -1
  103. package/dist/esm/components-core/loading-indicator.js +0 -31
  104. package/dist/esm/components-core/loading-indicator.js.map +0 -1
@@ -3,58 +3,54 @@
3
3
 
4
4
  // src/components/magic-link-sign-in.tsx
5
5
  import { useState } from "react";
6
+ import { useForm } from "react-hook-form";
7
+ import { yupResolver } from "@hookform/resolvers/yup";
8
+ import * as yup from "yup";
6
9
  import FormWarningText from "./form-warning";
7
- import { validateEmail } from "../utils/email";
8
10
  import { useStackApp } from "..";
9
11
  import { Button, Input, Label } from "../components-core";
12
+ import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
10
13
  import { jsx, jsxs } from "react/jsx-runtime";
14
+ var schema = yup.object().shape({
15
+ email: yup.string().email("Please enter a valid email").required("Please enter your email")
16
+ });
11
17
  function MagicLinkSignIn() {
12
- const [email, setEmail] = useState("");
18
+ const { register, handleSubmit, setError, formState: { errors }, clearErrors } = useForm({
19
+ resolver: yupResolver(schema)
20
+ });
13
21
  const [sent, setSent] = useState(false);
14
- const [error, setError] = useState("");
15
22
  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);
23
+ const onSubmit = async (data) => {
24
+ const { email } = data;
25
+ const error = await app.sendMagicLinkEmail(email);
26
+ if (error) {
27
+ setError("email", { type: "manual", message: error.message });
28
28
  return;
29
29
  }
30
30
  setSent(true);
31
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
- ] });
32
+ return /* @__PURE__ */ jsxs(
33
+ "form",
34
+ {
35
+ style: { display: "flex", flexDirection: "column", alignItems: "stretch" },
36
+ onSubmit: (e) => runAsynchronously(handleSubmit(onSubmit)(e)),
37
+ noValidate: true,
38
+ children: [
39
+ /* @__PURE__ */ jsx(Label, { htmlFor: "email", children: "Email" }),
40
+ /* @__PURE__ */ jsx(
41
+ Input,
42
+ {
43
+ id: "email",
44
+ type: "email",
45
+ ...register("email"),
46
+ disabled: sent
47
+ }
48
+ ),
49
+ /* @__PURE__ */ jsx(FormWarningText, { text: errors.email?.message?.toString() }),
50
+ /* @__PURE__ */ jsx(Button, { disabled: sent, style: { marginTop: "1.5rem" }, type: "submit", children: sent ? "Email sent" : "Send magic link" })
51
+ ]
52
+ }
53
+ );
58
54
  }
59
55
  export {
60
56
  MagicLinkSignIn as default
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/magic-link-sign-in.tsx"],"sourcesContent":["'use client';;\nimport { useState } from \"react\";\nimport FormWarningText from \"./form-warning\";\nimport { validateEmail } from \"../utils/email\";\nimport { useStackApp } from \"..\";\nimport { Button, Input, Label } from \"../components-core\";\n\nexport default function MagicLinkSignIn() {\n const [email, setEmail] = useState('');\n const [sent, setSent] = useState(false);\n const [error, setError] = useState('');\n const app = useStackApp();\n \n const onSubmit = async () => {\n if (!email) {\n setError('Please enter your email');\n return;\n }\n if (!validateEmail(email)) {\n setError('Please enter a valid email');\n return;\n }\n\n const error = await app.sendMagicLinkEmail(email);\n if (error) {\n setError(error.message);\n return;\n }\n setSent(true);\n };\n\n return (\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'stretch' }}>\n <Label htmlFor=\"email\">Email</Label>\n <Input\n id=\"email\"\n type=\"email\"\n name=\"email\"\n value={email}\n onChange={(e) => {\n setEmail(e.target.value);\n setError('');\n }}\n />\n <FormWarningText text={error} />\n\n <Button\n disabled={sent}\n style={{ marginTop: '1.5rem' }}\n onClick={onSubmit}\n >\n {sent ? 'Email sent' : 'Send magic link'}\n </Button>\n </div>\n );\n}\n"],"mappings":";;;AACA,SAAS,gBAAgB;AACzB,OAAO,qBAAqB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,QAAQ,OAAO,aAAa;AA2BjC,SACE,KADF;AAzBW,SAAR,kBAAmC;AACxC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AACrC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AACrC,QAAM,MAAM,YAAY;AAExB,QAAM,WAAW,YAAY;AAC3B,QAAI,CAAC,OAAO;AACV,eAAS,yBAAyB;AAClC;AAAA,IACF;AACA,QAAI,CAAC,cAAc,KAAK,GAAG;AACzB,eAAS,4BAA4B;AACrC;AAAA,IACF;AAEA,UAAMA,SAAQ,MAAM,IAAI,mBAAmB,KAAK;AAChD,QAAIA,QAAO;AACT,eAASA,OAAM,OAAO;AACtB;AAAA,IACF;AACA,YAAQ,IAAI;AAAA,EACd;AAEA,SACE,qBAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,YAAY,UAAU,GAC5E;AAAA,wBAAC,SAAM,SAAQ,SAAQ,mBAAK;AAAA,IAC5B;AAAA,MAAC;AAAA;AAAA,QACC,IAAG;AAAA,QACH,MAAK;AAAA,QACL,MAAK;AAAA,QACL,OAAO;AAAA,QACP,UAAU,CAAC,MAAM;AACf,mBAAS,EAAE,OAAO,KAAK;AACvB,mBAAS,EAAE;AAAA,QACb;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,mBAAgB,MAAM,OAAO;AAAA,IAE9B;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV,OAAO,EAAE,WAAW,SAAS;AAAA,QAC7B,SAAS;AAAA,QAER,iBAAO,eAAe;AAAA;AAAA,IACzB;AAAA,KACF;AAEJ;","names":["error"]}
1
+ {"version":3,"sources":["../../../src/components/magic-link-sign-in.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { yupResolver } from \"@hookform/resolvers/yup\";\nimport * as yup from \"yup\";\nimport FormWarningText from \"./form-warning\";\nimport { useStackApp } from \"..\";\nimport { Button, Input, Label } from \"../components-core\";\nimport { runAsynchronously } from \"@stackframe/stack-shared/dist/utils/promises\";\n\nconst schema = yup.object().shape({\n email: yup.string().email('Please enter a valid email').required('Please enter your email')\n});\n\nexport default function MagicLinkSignIn() {\n const { register, handleSubmit, setError, formState: { errors }, clearErrors } = useForm({\n resolver: yupResolver(schema)\n });\n const [sent, setSent] = useState(false);\n const app = useStackApp();\n\n const onSubmit = async (data: yup.InferType<typeof schema>) => {\n const { email } = data;\n\n const error = await app.sendMagicLinkEmail(email);\n if (error) {\n setError('email', { type: 'manual', message: error.message });\n return;\n }\n setSent(true);\n };\n\n return (\n <form \n style={{ display: 'flex', flexDirection: 'column', alignItems: 'stretch' }} \n onSubmit={e => runAsynchronously(handleSubmit(onSubmit)(e))}\n noValidate\n >\n <Label htmlFor=\"email\">Email</Label>\n <Input\n id=\"email\"\n type=\"email\"\n {...register('email')}\n disabled={sent}\n />\n <FormWarningText text={errors.email?.message?.toString()} />\n\n <Button disabled={sent} style={{ marginTop: '1.5rem' }} type=\"submit\">\n {sent ? 'Email sent' : 'Send magic link'}\n </Button>\n </form>\n );\n}\n"],"mappings":";;;AAEA,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,YAAY,SAAS;AACrB,OAAO,qBAAqB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,QAAQ,OAAO,aAAa;AACrC,SAAS,yBAAyB;AAyB9B,SAKE,KALF;AAvBJ,IAAM,SAAa,WAAO,EAAE,MAAM;AAAA,EAChC,OAAW,WAAO,EAAE,MAAM,4BAA4B,EAAE,SAAS,yBAAyB;AAC5F,CAAC;AAEc,SAAR,kBAAmC;AACxC,QAAM,EAAE,UAAU,cAAc,UAAU,WAAW,EAAE,OAAO,GAAG,YAAY,IAAI,QAAQ;AAAA,IACvF,UAAU,YAAY,MAAM;AAAA,EAC9B,CAAC;AACD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,QAAM,MAAM,YAAY;AAExB,QAAM,WAAW,OAAO,SAAuC;AAC7D,UAAM,EAAE,MAAM,IAAI;AAElB,UAAM,QAAQ,MAAM,IAAI,mBAAmB,KAAK;AAChD,QAAI,OAAO;AACT,eAAS,SAAS,EAAE,MAAM,UAAU,SAAS,MAAM,QAAQ,CAAC;AAC5D;AAAA,IACF;AACA,YAAQ,IAAI;AAAA,EACd;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,YAAY,UAAU;AAAA,MACzE,UAAU,OAAK,kBAAkB,aAAa,QAAQ,EAAE,CAAC,CAAC;AAAA,MAC1D,YAAU;AAAA,MAEV;AAAA,4BAAC,SAAM,SAAQ,SAAQ,mBAAK;AAAA,QAC5B;AAAA,UAAC;AAAA;AAAA,YACC,IAAG;AAAA,YACH,MAAK;AAAA,YACJ,GAAG,SAAS,OAAO;AAAA,YACpB,UAAU;AAAA;AAAA,QACZ;AAAA,QACA,oBAAC,mBAAgB,MAAM,OAAO,OAAO,SAAS,SAAS,GAAG;AAAA,QAE1D,oBAAC,UAAO,UAAU,MAAM,OAAO,EAAE,WAAW,SAAS,GAAG,MAAK,UAC1D,iBAAO,eAAe,mBACzB;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -2,11 +2,37 @@
2
2
  "use client";
3
3
 
4
4
  // src/components/oauth-button.tsx
5
- import { FaGithub, FaFacebook, FaApple } from "react-icons/fa";
6
5
  import { useStackApp } from "..";
7
6
  import { Button } from "../components-core";
8
7
  import { jsx, jsxs } from "react/jsx-runtime";
9
8
  var iconSize = 22;
9
+ function GoogleIcon({ iconSize: iconSize2 }) {
10
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: iconSize2, height: iconSize2, viewBox: "0 0 24 24", children: [
11
+ /* @__PURE__ */ 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" }),
12
+ /* @__PURE__ */ 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" }),
13
+ /* @__PURE__ */ 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" }),
14
+ /* @__PURE__ */ 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" }),
15
+ /* @__PURE__ */ jsx("path", { fill: "none", d: "M1 1h22v22H1z" })
16
+ ] });
17
+ }
18
+ function FacebookIcon({ iconSize: iconSize2 }) {
19
+ return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: iconSize2, height: iconSize2, viewBox: "0 0 512 512", children: /* @__PURE__ */ jsx("path", { fill: "#FFFFFF", d: "M512 256C512 114.6 397.4 0 256 0S0 114.6 0 256C0 376 82.7 476.8 194.2 504.5V334.2H141.4V256h52.8V222.3c0-87.1 39.4-127.5 125-127.5c16.2 0 44.2 3.2 55.7 6.4V172c-6-.6-16.5-1-29.6-1c-42 0-58.2 15.9-58.2 57.2V256h83.6l-14.4 78.2H287V510.1C413.8 494.8 512 386.9 512 256h0z" }) });
20
+ }
21
+ function GitHubIcon({ iconSize: iconSize2 }) {
22
+ return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: iconSize2, height: iconSize2, viewBox: "0 0 496 512", children: /* @__PURE__ */ jsx("path", { fill: "#FFFFFF", d: "M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3 .3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5 .3-6.2 2.3zm44.2-1.7c-2.9 .7-4.9 2.6-4.6 4.9 .3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3 .7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3 .3 2.9 2.3 3.9 1.6 1 3.6 .7 4.3-.7 .7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3 .7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3 .7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z" }) });
23
+ }
24
+ function MicrosoftIcon({ iconSize: iconSize2 }) {
25
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: iconSize2, height: iconSize2, viewBox: "0 0 21 21", children: [
26
+ /* @__PURE__ */ jsx("title", { children: "MS-SymbolLockup" }),
27
+ /* @__PURE__ */ jsx("path", { fill: "#f25022", d: "M1 1h9v9H1z" }),
28
+ /* @__PURE__ */ jsx("path", { fill: "#00a4ef", d: "M1 11h9v9H1z" }),
29
+ /* @__PURE__ */ jsx("path", { fill: "#7fba00", d: "M11 1h9v9h-9z" }),
30
+ /* @__PURE__ */ jsx("path", { fill: "#ffb900", d: "M11 11h9v9h-9z" })
31
+ ] });
32
+ }
33
+ function SpotifyIcon({ iconSize: iconSize2 }) {
34
+ return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: iconSize2, height: iconSize2, viewBox: "0 0 496 512", children: /* @__PURE__ */ jsx("path", { fill: "#ffffff", d: "M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8zm100.7 364.9c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4zm26.9-65.6c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm31-76.2c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3z" }) });
35
+ }
10
36
  function OAuthButton({
11
37
  provider,
12
38
  type
@@ -17,84 +43,52 @@ function OAuthButton({
17
43
  case "google": {
18
44
  style = {
19
45
  backgroundColor: "#fff",
46
+ textColor: "#000",
20
47
  name: "Google",
21
- border: "1px solid #ccc",
22
- icon: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: iconSize, height: iconSize, viewBox: "0 0 24 24", children: [
23
- /* @__PURE__ */ jsx(
24
- "path",
25
- {
26
- fill: "#4285F4",
27
- 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"
28
- }
29
- ),
30
- /* @__PURE__ */ jsx(
31
- "path",
32
- {
33
- fill: "#34A853",
34
- 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"
35
- }
36
- ),
37
- /* @__PURE__ */ jsx(
38
- "path",
39
- {
40
- fill: "#FBBC05",
41
- 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"
42
- }
43
- ),
44
- /* @__PURE__ */ jsx(
45
- "path",
46
- {
47
- fill: "#EA4335",
48
- 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"
49
- }
50
- ),
51
- /* @__PURE__ */ jsx("path", { fill: "none", d: "M1 1h22v22H1z" })
52
- ] })
48
+ border: "1px solid #ddd",
49
+ icon: /* @__PURE__ */ jsx(GoogleIcon, { iconSize })
53
50
  };
54
51
  break;
55
52
  }
56
53
  case "github": {
57
54
  style = {
58
55
  backgroundColor: "#111",
59
- border: "1px solid #444",
56
+ textColor: "#fff",
57
+ border: "1px solid #333",
60
58
  name: "GitHub",
61
- icon: /* @__PURE__ */ jsx(FaGithub, { color: "#fff", size: iconSize })
59
+ icon: /* @__PURE__ */ jsx(GitHubIcon, { iconSize })
62
60
  };
63
61
  break;
64
62
  }
65
63
  case "facebook": {
66
64
  style = {
67
65
  backgroundColor: "#1877F2",
66
+ textColor: "#fff",
68
67
  name: "Facebook",
69
- icon: /* @__PURE__ */ jsx(FaFacebook, { color: "#fff", size: iconSize })
68
+ icon: /* @__PURE__ */ jsx(FacebookIcon, { iconSize })
70
69
  };
71
70
  break;
72
71
  }
73
- case "apple": {
72
+ case "microsoft": {
74
73
  style = {
75
- backgroundColor: "#000",
76
- name: "Apple",
77
- icon: /* @__PURE__ */ jsx(FaApple, { color: "#fff", size: iconSize })
74
+ backgroundColor: "#2f2f2f",
75
+ textColor: "#fff",
76
+ name: "Microsoft",
77
+ icon: /* @__PURE__ */ jsx(MicrosoftIcon, { iconSize })
78
78
  };
79
79
  break;
80
80
  }
81
- case "microsoft": {
81
+ case "spotify": {
82
82
  style = {
83
- backgroundColor: "#2f2f2f",
84
- name: "Microsoft",
85
- icon: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: iconSize, height: iconSize, viewBox: "0 0 21 21", children: [
86
- /* @__PURE__ */ jsx("title", { children: "MS-SymbolLockup" }),
87
- /* @__PURE__ */ jsx("path", { fill: "#f25022", d: "M1 1h9v9H1z" }),
88
- /* @__PURE__ */ jsx("path", { fill: "#00a4ef", d: "M1 11h9v9H1z" }),
89
- /* @__PURE__ */ jsx("path", { fill: "#7fba00", d: "M11 1h9v9h-9z" }),
90
- /* @__PURE__ */ jsx("path", { fill: "#ffb900", d: "M11 11h9v9h-9z" })
91
- ] })
83
+ backgroundColor: "#1DB954",
84
+ textColor: "#fff",
85
+ name: "Spotify",
86
+ icon: /* @__PURE__ */ jsx(SpotifyIcon, { iconSize })
92
87
  };
93
88
  break;
94
89
  }
95
90
  default: {
96
91
  style = {
97
- backgroundColor: "#000",
98
92
  name: provider,
99
93
  icon: null
100
94
  };
@@ -104,9 +98,9 @@ function OAuthButton({
104
98
  Button,
105
99
  {
106
100
  color: style.backgroundColor,
107
- style: { border: style.border },
101
+ style: { border: style.border, height: "2.5rem", color: style.textColor },
108
102
  onClick: () => stackApp.signInWithOAuth(provider),
109
- children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", width: "100%", gap: "8px" }, children: [
103
+ children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", width: "100%", gap: "1rem" }, children: [
110
104
  style.icon,
111
105
  /* @__PURE__ */ jsxs("span", { style: { flexGrow: 1 }, children: [
112
106
  type === "sign-up" ? "Sign up with " : "Sign in with ",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/oauth-button.tsx"],"sourcesContent":["'use client';\n\nimport { FaGithub, FaFacebook, FaApple } from 'react-icons/fa';\nimport { useStackApp } from '..';\nimport { Button } from \"../components-core\";\n\nconst iconSize = 22;\n\nexport default function OAuthButton({\n provider,\n type,\n}: {\n provider: string,\n type: 'sign-in' | 'sign-up',\n}) {\n const stackApp = useStackApp();\n\n let style : {\n backgroundColor: string,\n name: string,\n icon: JSX.Element | null,\n border?: string,\n };\n switch (provider) {\n case 'google': {\n style = {\n backgroundColor: '#fff',\n name: 'Google',\n border: '1px solid #ccc',\n icon: (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={iconSize} height={iconSize} viewBox=\"0 0 24 24\">\n <path\n fill=\"#4285F4\"\n 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\"\n />\n <path\n fill=\"#34A853\"\n 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\"\n />\n <path\n fill=\"#FBBC05\"\n 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\"\n />\n <path\n fill=\"#EA4335\"\n 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\"\n />\n <path fill=\"none\" d=\"M1 1h22v22H1z\" />\n </svg>\n ),\n };\n break;\n }\n case 'github': {\n style = {\n backgroundColor: '#111',\n border: '1px solid #444',\n name: 'GitHub',\n icon: (\n <FaGithub color=\"#fff\" size={iconSize} />\n ),\n };\n break;\n }\n case 'facebook': {\n style = {\n backgroundColor: '#1877F2',\n name: 'Facebook',\n icon: (\n <FaFacebook color=\"#fff\" size={iconSize} />\n ),\n };\n break;\n }\n case 'apple': {\n style = {\n backgroundColor: '#000',\n name: 'Apple',\n icon: (\n <FaApple color=\"#fff\" size={iconSize} />\n ),\n };\n break;\n }\n case 'microsoft': {\n style = {\n backgroundColor: '#2f2f2f',\n name: 'Microsoft',\n icon: (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={iconSize} height={iconSize} viewBox=\"0 0 21 21\">\n <title>{\"MS-SymbolLockup\"}</title>\n <path fill=\"#f25022\" d=\"M1 1h9v9H1z\" />\n <path fill=\"#00a4ef\" d=\"M1 11h9v9H1z\" />\n <path fill=\"#7fba00\" d=\"M11 1h9v9h-9z\" />\n <path fill=\"#ffb900\" d=\"M11 11h9v9h-9z\" />\n </svg>\n ),\n };\n break;\n }\n default: {\n style = {\n backgroundColor: '#000',\n name: provider,\n icon: null\n };\n }\n }\n\n return (\n <Button\n color={style.backgroundColor}\n style={{ border: style.border }}\n onClick={() => stackApp.signInWithOAuth(provider)}\n >\n <div style={{ display: 'flex', alignItems: 'center', width: '100%', gap: '8px' }}>\n {style.icon}\n <span style={{ flexGrow: 1 }}>{type === 'sign-up' ? 'Sign up with ' : 'Sign in with '}{style.name}</span>\n </div>\n </Button>\n );\n}\n"],"mappings":";;;AAEA,SAAS,UAAU,YAAY,eAAe;AAC9C,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AA0Bb,SACE,KADF;AAxBV,IAAM,WAAW;AAEF,SAAR,YAA6B;AAAA,EAClC;AAAA,EACA;AACF,GAGG;AACD,QAAM,WAAW,YAAY;AAE7B,MAAI;AAMJ,UAAQ,UAAU;AAAA,IAChB,KAAK,UAAU;AACb,cAAQ;AAAA,QACN,iBAAiB;AAAA,QACjB,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,MACE,qBAAC,SAAI,OAAM,8BAA6B,OAAO,UAAU,QAAQ,UAAU,SAAQ,aACjF;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,GAAE;AAAA;AAAA,UACJ;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,GAAE;AAAA;AAAA,UACJ;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,GAAE;AAAA;AAAA,UACJ;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,GAAE;AAAA;AAAA,UACJ;AAAA,UACA,oBAAC,UAAK,MAAK,QAAO,GAAE,iBAAgB;AAAA,WACtC;AAAA,MAEJ;AACA;AAAA,IACF;AAAA,IACA,KAAK,UAAU;AACb,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C5E;AAAA,cAAM;AAAA,QACP,qBAAC,UAAK,OAAO,EAAE,UAAU,EAAE,GAAI;AAAA,mBAAS,YAAY,kBAAkB;AAAA,UAAiB,MAAM;AAAA,WAAK;AAAA,SACpG;AAAA;AAAA,EACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/oauth-button.tsx"],"sourcesContent":["'use client';\n\nimport { useStackApp } from '..';\nimport { Button } from \"../components-core\";\n\nconst iconSize = 22;\n\nfunction GoogleIcon({ iconSize } : { iconSize: number} ) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={iconSize} height={iconSize} viewBox=\"0 0 24 24\">\n <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\"/>\n <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\"/>\n <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\"/>\n <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\"/>\n <path fill=\"none\" d=\"M1 1h22v22H1z\" />\n </svg>\n );\n}\n\nfunction FacebookIcon({ iconSize } : { iconSize: number} ) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={iconSize} height={iconSize} viewBox=\"0 0 512 512\">\n <path fill='#FFFFFF' d=\"M512 256C512 114.6 397.4 0 256 0S0 114.6 0 256C0 376 82.7 476.8 194.2 504.5V334.2H141.4V256h52.8V222.3c0-87.1 39.4-127.5 125-127.5c16.2 0 44.2 3.2 55.7 6.4V172c-6-.6-16.5-1-29.6-1c-42 0-58.2 15.9-58.2 57.2V256h83.6l-14.4 78.2H287V510.1C413.8 494.8 512 386.9 512 256h0z\"/>\n </svg>\n );\n}\n\nfunction GitHubIcon({ iconSize } : { iconSize: number} ) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={iconSize} height={iconSize} viewBox=\"0 0 496 512\">\n <path fill='#FFFFFF' d=\"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3 .3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5 .3-6.2 2.3zm44.2-1.7c-2.9 .7-4.9 2.6-4.6 4.9 .3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3 .7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3 .3 2.9 2.3 3.9 1.6 1 3.6 .7 4.3-.7 .7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3 .7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3 .7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z\"/>\n </svg>\n );\n}\n\nfunction MicrosoftIcon({ iconSize } : { iconSize: number} ) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={iconSize} height={iconSize} viewBox=\"0 0 21 21\">\n <title>{\"MS-SymbolLockup\"}</title>\n <path fill=\"#f25022\" d=\"M1 1h9v9H1z\" />\n <path fill=\"#00a4ef\" d=\"M1 11h9v9H1z\" />\n <path fill=\"#7fba00\" d=\"M11 1h9v9h-9z\" />\n <path fill=\"#ffb900\" d=\"M11 11h9v9h-9z\" />\n </svg>\n );\n}\n\nfunction SpotifyIcon({ iconSize } : { iconSize: number} ) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={iconSize} height={iconSize} viewBox=\"0 0 496 512\">\n <path fill='#ffffff' d=\"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8zm100.7 364.9c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4zm26.9-65.6c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm31-76.2c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3z\"/>\n </svg>\n );\n}\nexport default function OAuthButton({\n provider,\n type,\n}: {\n provider: string,\n type: 'sign-in' | 'sign-up',\n}) {\n const stackApp = useStackApp();\n\n let style : {\n backgroundColor?: string,\n textColor?: string,\n name: string,\n icon: JSX.Element | null,\n border?: string,\n };\n switch (provider) {\n case 'google': {\n style = {\n backgroundColor: '#fff',\n textColor: '#000',\n name: 'Google',\n border: '1px solid #ddd',\n icon: <GoogleIcon iconSize={iconSize} />,\n };\n break;\n }\n case 'github': {\n style = {\n backgroundColor: '#111',\n textColor: '#fff',\n border: '1px solid #333',\n name: 'GitHub',\n icon: <GitHubIcon iconSize={iconSize} />,\n };\n break;\n }\n case 'facebook': {\n style = {\n backgroundColor: '#1877F2',\n textColor: '#fff',\n name: 'Facebook',\n icon: <FacebookIcon iconSize={iconSize} />,\n };\n break;\n }\n case 'microsoft': {\n style = {\n backgroundColor: '#2f2f2f',\n textColor: '#fff',\n name: 'Microsoft',\n icon: <MicrosoftIcon iconSize={iconSize} />,\n };\n break;\n }\n case 'spotify': {\n style = {\n backgroundColor: '#1DB954',\n textColor: '#fff',\n name: 'Spotify',\n icon: <SpotifyIcon iconSize={iconSize} />,\n };\n break;\n }\n default: {\n style = {\n name: provider,\n icon: null\n };\n }\n }\n\n return (\n <Button\n color={style.backgroundColor}\n style={{ border: style.border, height: '2.5rem', color: style.textColor }}\n onClick={() => stackApp.signInWithOAuth(provider)}\n >\n <div style={{ display: 'flex', alignItems: 'center', width: '100%', gap: '1rem' }}>\n {style.icon}\n <span style={{ flexGrow: 1 }}>{type === 'sign-up' ? 'Sign up with ' : 'Sign in with '}{style.name}</span>\n </div>\n </Button>\n );\n}\n"],"mappings":";;;AAEA,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AAMnB,SACE,KADF;AAJJ,IAAM,WAAW;AAEjB,SAAS,WAAW,EAAE,UAAAA,UAAS,GAA0B;AACvD,SACE,qBAAC,SAAI,OAAM,8BAA6B,OAAOA,WAAU,QAAQA,WAAU,SAAQ,aACjF;AAAA,wBAAC,UAAK,MAAK,WAAU,GAAE,2HAAyH;AAAA,IAChJ,oBAAC,UAAK,MAAK,WAAU,GAAE,yIAAuI;AAAA,IAC9J,oBAAC,UAAK,MAAK,WAAU,GAAE,iIAA+H;AAAA,IACtJ,oBAAC,UAAK,MAAK,WAAU,GAAE,uIAAqI;AAAA,IAC5J,oBAAC,UAAK,MAAK,QAAO,GAAE,iBAAgB;AAAA,KACtC;AAEJ;AAEA,SAAS,aAAa,EAAE,UAAAA,UAAS,GAA0B;AACzD,SACE,oBAAC,SAAI,OAAM,8BAA6B,OAAOA,WAAU,QAAQA,WAAU,SAAQ,eACjF,8BAAC,UAAK,MAAK,WAAU,GAAE,gRAA8Q,GACvS;AAEJ;AAEA,SAAS,WAAW,EAAE,UAAAA,UAAS,GAA0B;AACvD,SACE,oBAAC,SAAI,OAAM,8BAA6B,OAAOA,WAAU,QAAQA,WAAU,SAAQ,eACjF,8BAAC,UAAK,MAAK,WAAU,GAAE,syCAAoyC,GAC7zC;AAEJ;AAEA,SAAS,cAAc,EAAE,UAAAA,U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N,MAAM,oBAAC,iBAAc,UAAoB;AAAA,MAC3C;AACA;AAAA,IACF;AAAA,IACA,KAAK,WAAW;AACd,cAAQ;AAAA,QACN,iBAAiB;AAAA,QACjB,WAAW;AAAA,QACX,MAAM;AAAA,QACN,MAAM,oBAAC,eAAY,UAAoB;AAAA,MACzC;AACA;AAAA,IACF;AAAA,IACA,SAAS;AACP,cAAQ;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,MAAM;AAAA,MACb,OAAO,EAAE,QAAQ,MAAM,QAAQ,QAAQ,UAAU,OAAO,MAAM,UAAU;AAAA,MACxE,SAAS,MAAM,SAAS,gBAAgB,QAAQ;AAAA,MAEhD,+BAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,YAAY,UAAU,OAAO,QAAQ,KAAK,OAAO,GAC7E;AAAA,cAAM;AAAA,QACP,qBAAC,UAAK,OAAO,EAAE,UAAU,EAAE,GAAI;AAAA,mBAAS,YAAY,kBAAkB;AAAA,UAAiB,MAAM;AAAA,WAAK;AAAA,SACpG;AAAA;AAAA,EACF;AAEJ;","names":["iconSize"]}
@@ -4,19 +4,17 @@
4
4
  // src/components/password-field.tsx
5
5
  import { Input } from "../components-core";
6
6
  import { forwardRef, useRef, useState } from "react";
7
- import { HiEye, HiEyeOff } from "react-icons/hi";
8
7
  import { useDesign } from "..";
9
8
  import styled from "styled-components";
9
+ import { Eye, EyeOff } from "lucide-react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  var getIconStyle = (colors) => `
12
- color: ${colors.light.secondaryColor};
13
-
14
- html[data-stack-theme='dark'] & {
15
- color: ${colors.dark.secondaryColor};
16
- }
12
+ height: 1rem;
13
+ width: 1rem;
14
+ color: #808080
17
15
  `;
18
- var StyledEyeOff = styled(HiEyeOff)`${(props) => getIconStyle(props.colors)}`;
19
- var StyledEye = styled(HiEye)`${(props) => getIconStyle(props.colors)}`;
16
+ var StyledEyeOff = styled(EyeOff)`${(props) => getIconStyle(props.colors)}`;
17
+ var StyledEye = styled(Eye)`${(props) => getIconStyle(props.colors)}`;
20
18
  var PasswordField = forwardRef(({ id, name, ...props }, ref) => {
21
19
  const [isOpen, setIsOpen] = useState(false);
22
20
  const { colors } = useDesign();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/password-field.tsx"],"sourcesContent":["'use client';\n\nimport { Input } from \"../components-core\";\nimport { forwardRef, useRef, useState } from 'react';\nimport { HiEye, HiEyeOff } from 'react-icons/hi';\nimport { useDesign } from \"..\";\nimport styled from \"styled-components\";\nimport { ColorPalette } from \"../providers/design-provider\";\n\nconst getIconStyle = (colors: ColorPalette) => `\n color: ${colors.light.secondaryColor};\n\n html[data-stack-theme='dark'] & {\n color: ${colors.dark.secondaryColor};\n }\n`;\nconst StyledEyeOff = styled(HiEyeOff)<{ colors: ColorPalette }>`${props => getIconStyle(props.colors)}`;\nconst StyledEye = styled(HiEye)<{ colors: ColorPalette }>`${props => getIconStyle(props.colors)}`;\n\nconst PasswordField = forwardRef<\n HTMLInputElement, \n React.InputHTMLAttributes<HTMLInputElement>\n>(({ id, name, ...props }, ref) => {\n const [isOpen, setIsOpen] = useState(false);\n const { colors } = useDesign();\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const mergeRef = (node: HTMLInputElement) => {\n if (ref) {\n if (typeof ref === 'function') {\n ref(node);\n } else {\n ref.current = node;\n }\n }\n inputRef.current = node;\n };\n\n const onClickReveal = () => {\n setIsOpen(!isOpen);\n const currentInput = inputRef.current;\n if (currentInput) {\n currentInput.focus({ preventScroll: true });\n }\n };\n\n return (\n <div style={{ position: 'relative', display: 'flex' }}>\n <Input\n id={id}\n ref={mergeRef}\n name={name}\n type={isOpen ? 'text' : 'password'}\n autoComplete=\"current-password\"\n required\n style={{ flex: 1 }}\n {...props}\n />\n <button\n tabIndex={-1}\n type=\"button\"\n style={{ \n position: 'absolute', \n backgroundColor: 'transparent',\n border: 'none',\n top: 0, \n right: 0, \n bottom: 0, \n display: 'flex', \n alignItems: 'center', \n paddingRight: '12px' \n }}\n onClick={onClickReveal}\n aria-label={isOpen ? 'Mask password' : 'Reveal password'}\n >\n {isOpen ? <StyledEyeOff colors={colors} /> : <StyledEye colors={colors} />}\n </button>\n </div>\n );\n});\n\nPasswordField.displayName = 'PasswordField';\n\nexport default PasswordField;\n"],"mappings":";;;AAEA,SAAS,aAAa;AACtB,SAAS,YAAY,QAAQ,gBAAgB;AAC7C,SAAS,OAAO,gBAAgB;AAChC,SAAS,iBAAiB;AAC1B,OAAO,YAAY;AAyCf,SACE,KADF;AAtCJ,IAAM,eAAe,CAAC,WAAyB;AAAA,WACpC,OAAO,MAAM,cAAc;AAAA;AAAA;AAAA,aAGzB,OAAO,KAAK,cAAc;AAAA;AAAA;AAGvC,IAAM,eAAe,OAAO,QAAQ,IAA8B,WAAS,aAAa,MAAM,MAAM,CAAC;AACrG,IAAM,YAAY,OAAO,KAAK,IAA8B,WAAS,aAAa,MAAM,MAAM,CAAC;AAE/F,IAAM,gBAAgB,WAGpB,CAAC,EAAE,IAAI,MAAM,GAAG,MAAM,GAAG,QAAQ;AACjC,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAC1C,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,WAAW,OAAgC,IAAI;AAErD,QAAM,WAAW,CAAC,SAA2B;AAC3C,QAAI,KAAK;AACP,UAAI,OAAO,QAAQ,YAAY;AAC7B,YAAI,IAAI;AAAA,MACV,OAAO;AACL,YAAI,UAAU;AAAA,MAChB;AAAA,IACF;AACA,aAAS,UAAU;AAAA,EACrB;AAEA,QAAM,gBAAgB,MAAM;AAC1B,cAAU,CAAC,MAAM;AACjB,UAAM,eAAe,SAAS;AAC9B,QAAI,cAAc;AAChB,mBAAa,MAAM,EAAE,eAAe,KAAK,CAAC;AAAA,IAC5C;AAAA,EACF;AAEA,SACE,qBAAC,SAAI,OAAO,EAAE,UAAU,YAAY,SAAS,OAAO,GAClD;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,KAAK;AAAA,QACL;AAAA,QACA,MAAM,SAAS,SAAS;AAAA,QACxB,cAAa;AAAA,QACb,UAAQ;AAAA,QACR,OAAO,EAAE,MAAM,EAAE;AAAA,QAChB,GAAG;AAAA;AAAA,IACN;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV,MAAK;AAAA,QACL,OAAO;AAAA,UACL,UAAU;AAAA,UACV,iBAAiB;AAAA,UACjB,QAAQ;AAAA,UACR,KAAK;AAAA,UACL,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,YAAY;AAAA,UACZ,cAAc;AAAA,QAChB;AAAA,QACA,SAAS;AAAA,QACT,cAAY,SAAS,kBAAkB;AAAA,QAEtC,mBAAS,oBAAC,gBAAa,QAAgB,IAAK,oBAAC,aAAU,QAAgB;AAAA;AAAA,IAC1E;AAAA,KACF;AAEJ,CAAC;AAED,cAAc,cAAc;AAE5B,IAAO,yBAAQ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/password-field.tsx"],"sourcesContent":["'use client';\n\nimport { Input } from \"../components-core\";\nimport { forwardRef, useRef, useState } from 'react';\nimport { useDesign } from \"..\";\nimport styled from \"styled-components\";\nimport { ColorPalette } from \"../providers/design-provider\";\nimport { Eye, EyeOff } from 'lucide-react';\n\nconst getIconStyle = (colors: ColorPalette) => `\n height: 1rem;\n width: 1rem;\n color: #808080\n`;\nconst StyledEyeOff = styled(EyeOff)<{ colors: ColorPalette }>`${props => getIconStyle(props.colors)}`;\nconst StyledEye = styled(Eye)<{ colors: ColorPalette }>`${props => getIconStyle(props.colors)}`;\n\nconst PasswordField = forwardRef<\n HTMLInputElement, \n React.InputHTMLAttributes<HTMLInputElement>\n>(({ id, name, ...props }, ref) => {\n const [isOpen, setIsOpen] = useState(false);\n const { colors } = useDesign();\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const mergeRef = (node: HTMLInputElement) => {\n if (ref) {\n if (typeof ref === 'function') {\n ref(node);\n } else {\n ref.current = node;\n }\n }\n inputRef.current = node;\n };\n\n const onClickReveal = () => {\n setIsOpen(!isOpen);\n const currentInput = inputRef.current;\n if (currentInput) {\n currentInput.focus({ preventScroll: true });\n }\n };\n\n return (\n <div style={{ position: 'relative', display: 'flex' }}>\n <Input\n id={id}\n ref={mergeRef}\n name={name}\n type={isOpen ? 'text' : 'password'}\n autoComplete=\"current-password\"\n required\n style={{ flex: 1 }}\n {...props}\n />\n <button\n tabIndex={-1}\n type=\"button\"\n style={{ \n position: 'absolute', \n backgroundColor: 'transparent',\n border: 'none',\n top: 0, \n right: 0, \n bottom: 0, \n display: 'flex', \n alignItems: 'center', \n paddingRight: '12px' \n }}\n onClick={onClickReveal}\n aria-label={isOpen ? 'Mask password' : 'Reveal password'}\n >\n {isOpen ? <StyledEyeOff colors={colors} /> : <StyledEye colors={colors} />}\n </button>\n </div>\n );\n});\n\nPasswordField.displayName = 'PasswordField';\n\nexport default PasswordField;\n"],"mappings":";;;AAEA,SAAS,aAAa;AACtB,SAAS,YAAY,QAAQ,gBAAgB;AAC7C,SAAS,iBAAiB;AAC1B,OAAO,YAAY;AAEnB,SAAS,KAAK,cAAc;AAsCxB,SACE,KADF;AApCJ,IAAM,eAAe,CAAC,WAAyB;AAAA;AAAA;AAAA;AAAA;AAK/C,IAAM,eAAe,OAAO,MAAM,IAA8B,WAAS,aAAa,MAAM,MAAM,CAAC;AACnG,IAAM,YAAY,OAAO,GAAG,IAA8B,WAAS,aAAa,MAAM,MAAM,CAAC;AAE7F,IAAM,gBAAgB,WAGpB,CAAC,EAAE,IAAI,MAAM,GAAG,MAAM,GAAG,QAAQ;AACjC,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAC1C,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,WAAW,OAAgC,IAAI;AAErD,QAAM,WAAW,CAAC,SAA2B;AAC3C,QAAI,KAAK;AACP,UAAI,OAAO,QAAQ,YAAY;AAC7B,YAAI,IAAI;AAAA,MACV,OAAO;AACL,YAAI,UAAU;AAAA,MAChB;AAAA,IACF;AACA,aAAS,UAAU;AAAA,EACrB;AAEA,QAAM,gBAAgB,MAAM;AAC1B,cAAU,CAAC,MAAM;AACjB,UAAM,eAAe,SAAS;AAC9B,QAAI,cAAc;AAChB,mBAAa,MAAM,EAAE,eAAe,KAAK,CAAC;AAAA,IAC5C;AAAA,EACF;AAEA,SACE,qBAAC,SAAI,OAAO,EAAE,UAAU,YAAY,SAAS,OAAO,GAClD;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,KAAK;AAAA,QACL;AAAA,QACA,MAAM,SAAS,SAAS;AAAA,QACxB,cAAa;AAAA,QACb,UAAQ;AAAA,QACR,OAAO,EAAE,MAAM,EAAE;AAAA,QAChB,GAAG;AAAA;AAAA,IACN;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV,MAAK;AAAA,QACL,OAAO;AAAA,UACL,UAAU;AAAA,UACV,iBAAiB;AAAA,UACjB,QAAQ;AAAA,UACR,KAAK;AAAA,UACL,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,YAAY;AAAA,UACZ,cAAc;AAAA,QAChB;AAAA,QACA,SAAS;AAAA,QACT,cAAY,SAAS,kBAAkB;AAAA,QAEtC,mBAAS,oBAAC,gBAAa,QAAgB,IAAK,oBAAC,aAAU,QAAgB;AAAA;AAAA,IAC1E;AAAA,KACF;AAEJ,CAAC;AAED,cAAc,cAAc;AAE5B,IAAO,yBAAQ;","names":[]}
@@ -3,6 +3,9 @@
3
3
 
4
4
  // src/components/password-reset-inner.tsx
5
5
  import { useState } from "react";
6
+ import { useForm } from "react-hook-form";
7
+ import { yupResolver } from "@hookform/resolvers/yup";
8
+ import * as yup from "yup";
6
9
  import { getPasswordError } from "@stackframe/stack-shared/dist/helpers/password";
7
10
  import { useStackApp } from "..";
8
11
  import PasswordField from "./password-field";
@@ -11,33 +14,31 @@ import RedirectMessageCard from "./redirect-message-card";
11
14
  import MessageCard from "./message-card";
12
15
  import CardFrame from "./card-frame";
13
16
  import { Button, Label, Text } from "../components-core";
17
+ import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
14
18
  import { jsx, jsxs } from "react/jsx-runtime";
19
+ var schema = yup.object().shape({
20
+ password: yup.string().required("Please enter your password").test({
21
+ name: "is-valid-password",
22
+ test: (value, ctx) => {
23
+ const error = getPasswordError(value);
24
+ if (error) {
25
+ return ctx.createError({ message: error.message });
26
+ } else {
27
+ return true;
28
+ }
29
+ }
30
+ }),
31
+ passwordRepeat: yup.string().nullable().oneOf([yup.ref("password"), null], "Passwords do not match").required("Please repeat your password")
32
+ });
15
33
  function PasswordResetInner({ code, fullPage = false }) {
16
- const [password, setPassword] = useState("");
17
- const [passwordError, setPasswordError] = useState("");
18
- const [passwordRepeat, setPasswordRepeat] = useState("");
19
- const [passwordRepeatError, setPasswordRepeatError] = useState("");
34
+ const { register, handleSubmit, formState: { errors }, clearErrors } = useForm({
35
+ resolver: yupResolver(schema)
36
+ });
37
+ const stackApp = useStackApp();
20
38
  const [finished, setFinished] = useState(false);
21
39
  const [resetError, setResetError] = useState(false);
22
- const stackApp = useStackApp();
23
- const onSubmit = async () => {
24
- if (!password) {
25
- setPasswordError("Please enter your password");
26
- return;
27
- }
28
- if (!passwordRepeat) {
29
- setPasswordRepeatError("Please repeat your password");
30
- return;
31
- }
32
- if (password !== passwordRepeat) {
33
- setPasswordRepeatError("Passwords do not match");
34
- return;
35
- }
36
- const passwordError2 = getPasswordError(password);
37
- if (passwordError2) {
38
- setPasswordError(passwordError2.message);
39
- return;
40
- }
40
+ const onSubmit = async (data) => {
41
+ const { password } = data;
41
42
  const errorCode = await stackApp.resetPassword({ password, code });
42
43
  if (errorCode) {
43
44
  setResetError(true);
@@ -53,39 +54,43 @@ function PasswordResetInner({ code, fullPage = false }) {
53
54
  }
54
55
  return /* @__PURE__ */ jsxs(CardFrame, { fullPage, children: [
55
56
  /* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: "1.5rem" }, children: /* @__PURE__ */ jsx(Text, { size: "xl", as: "h2", children: "Reset Your Password" }) }),
56
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "stretch" }, children: [
57
- /* @__PURE__ */ jsx(Label, { htmlFor: "password", children: "New Password" }),
58
- /* @__PURE__ */ jsx(
59
- PasswordField,
60
- {
61
- id: "password",
62
- name: "password",
63
- value: password,
64
- onChange: (e) => {
65
- setPassword(e.target.value);
66
- setPasswordError("");
67
- setPasswordRepeatError("");
68
- }
69
- }
70
- ),
71
- /* @__PURE__ */ jsx(FormWarningText, { text: passwordError }),
72
- /* @__PURE__ */ jsx(Label, { htmlFor: "repeat-password", style: { marginTop: "1rem" }, children: "Repeat New Password" }),
73
- /* @__PURE__ */ jsx(
74
- PasswordField,
75
- {
76
- id: "repeat-password",
77
- name: "repeat-password",
78
- value: passwordRepeat,
79
- onChange: (e) => {
80
- setPasswordRepeat(e.target.value);
81
- setPasswordError("");
82
- setPasswordRepeatError("");
83
- }
84
- }
85
- ),
86
- /* @__PURE__ */ jsx(FormWarningText, { text: passwordRepeatError }),
87
- /* @__PURE__ */ jsx(Button, { style: { marginTop: "1.5rem" }, onClick: () => onSubmit(), children: "Reset Password" })
88
- ] })
57
+ /* @__PURE__ */ jsxs(
58
+ "form",
59
+ {
60
+ style: { display: "flex", flexDirection: "column", alignItems: "stretch" },
61
+ onSubmit: (e) => runAsynchronously(handleSubmit(onSubmit)(e)),
62
+ noValidate: true,
63
+ children: [
64
+ /* @__PURE__ */ jsx(Label, { htmlFor: "password", children: "New Password" }),
65
+ /* @__PURE__ */ jsx(
66
+ PasswordField,
67
+ {
68
+ id: "password",
69
+ ...register("password"),
70
+ onChange: () => {
71
+ clearErrors("password");
72
+ clearErrors("passwordRepeat");
73
+ }
74
+ }
75
+ ),
76
+ /* @__PURE__ */ jsx(FormWarningText, { text: errors.password?.message?.toString() }),
77
+ /* @__PURE__ */ jsx(Label, { htmlFor: "repeat-password", style: { marginTop: "1rem" }, children: "Repeat New Password" }),
78
+ /* @__PURE__ */ jsx(
79
+ PasswordField,
80
+ {
81
+ id: "repeat-password",
82
+ ...register("passwordRepeat"),
83
+ onChange: () => {
84
+ clearErrors("password");
85
+ clearErrors("passwordRepeat");
86
+ }
87
+ }
88
+ ),
89
+ /* @__PURE__ */ jsx(FormWarningText, { text: errors.passwordRepeat?.message?.toString() }),
90
+ /* @__PURE__ */ jsx(Button, { style: { marginTop: "1.5rem" }, type: "submit", children: "Reset Password" })
91
+ ]
92
+ }
93
+ )
89
94
  ] });
90
95
  }
91
96
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/password-reset-inner.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from \"react\";\nimport { getPasswordError } from \"@stackframe/stack-shared/dist/helpers/password\";\nimport { useStackApp } from \"..\";\nimport PasswordField from \"./password-field\";\nimport FormWarningText from \"./form-warning\";\nimport RedirectMessageCard from \"./redirect-message-card\";\nimport MessageCard from \"./message-card\";\nimport CardFrame from \"./card-frame\";\nimport { Button, Label, Text } from \"../components-core\";\n\n\nexport default function PasswordResetInner(\n { code, fullPage = false }:\n { code: string, fullPage?: boolean }\n) {\n const [password, setPassword] = useState('');\n const [passwordError, setPasswordError] = useState('');\n const [passwordRepeat, setPasswordRepeat] = useState('');\n const [passwordRepeatError, setPasswordRepeatError] = useState('');\n const [finished, setFinished] = useState(false);\n const [resetError, setResetError] = useState(false);\n const stackApp = useStackApp();\n\n const onSubmit = async () => {\n if (!password) {\n setPasswordError('Please enter your password');\n return;\n }\n if (!passwordRepeat) {\n setPasswordRepeatError('Please repeat your password');\n return;\n }\n if (password !== passwordRepeat) {\n setPasswordRepeatError('Passwords do not match');\n return;\n }\n\n const passwordError = getPasswordError(password);\n if (passwordError) {\n setPasswordError(passwordError.message);\n return;\n }\n\n const errorCode = await stackApp.resetPassword({ password, code });\n \n // this should not happen, the outer component should verify the code before rendering this component\n if (errorCode) {\n setResetError(true);\n return;\n }\n\n setFinished(true);\n };\n\n if (finished) {\n return <RedirectMessageCard type='passwordReset' fullPage={fullPage} />;\n }\n\n if (resetError) {\n return (\n <MessageCard title=\"Failed to reset password\" fullPage={fullPage}>\n <Text>Failed to reset password. Please request a new password reset link</Text>\n </MessageCard>\n );\n }\n\n return (\n <CardFrame fullPage={fullPage}>\n <div style={{ textAlign: 'center', marginBottom: '1.5rem' }}>\n <Text size=\"xl\" as='h2'>Reset Your Password</Text>\n </div>\n\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'stretch' }}>\n <Label htmlFor=\"password\">New Password</Label>\n <PasswordField\n id=\"password\"\n name=\"password\"\n value={password}\n onChange={(e) => {\n setPassword(e.target.value);\n setPasswordError('');\n setPasswordRepeatError('');\n }}\n />\n <FormWarningText text={passwordError} />\n\n <Label htmlFor=\"repeat-password\" style={{ marginTop: \"1rem\" }}>Repeat New Password</Label>\n <PasswordField\n id=\"repeat-password\"\n name=\"repeat-password\"\n value={passwordRepeat}\n onChange={(e) => {\n setPasswordRepeat(e.target.value);\n setPasswordError('');\n setPasswordRepeatError('');\n }}\n />\n <FormWarningText text={passwordRepeatError} />\n\n <Button style={{ marginTop: '1.5rem' }} onClick={() => onSubmit()}>\n Reset Password\n </Button>\n </div>\n </CardFrame>\n ); \n}\n"],"mappings":";;;AAEA,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B,OAAO,mBAAmB;AAC1B,OAAO,qBAAqB;AAC5B,OAAO,yBAAyB;AAChC,OAAO,iBAAiB;AACxB,OAAO,eAAe;AACtB,SAAS,QAAQ,OAAO,YAAY;AA+CzB,cAiBL,YAjBK;AA5CI,SAAR,mBACL,EAAE,MAAM,WAAW,MAAM,GAEzB;AACA,QAAM,CAAC,UAAU,WAAW,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AA,QAAC;AAAA;AAAA,UACC,IAAG;AAAA,UACH,MAAK;AAAA,UACL,OAAO;AAAA,UACP,UAAU,CAAC,MAAM;AACf,wBAAY,EAAE,OAAO,KAAK;AAC1B,6BAAiB,EAAE;AACnB,mCAAuB,EAAE;AAAA,UAC3B;AAAA;AAAA,MACF;AAAA,MACA,oBAAC,mBAAgB,MAAM,eAAe;AAAA,MAEtC,oBAAC,SAAM,SAAQ,mBAAkB,OAAO,EAAE,WAAW,OAAO,GAAG,iCAAmB;AAAA,MAClF;AAAA,QAAC;AAAA;AAAA,UACC,IAAG;AAAA,UACH,MAAK;AAAA,UACL,OAAO;AAAA,UACP,UAAU,CAAC,MAAM;AACf,8BAAkB,EAAE,OAAO,KAAK;AAChC,6BAAiB,EAAE;AACnB,mCAAuB,EAAE;AAAA,UAC3B;AAAA;AAAA,MACF;AAAA,MACA,oBAAC,mBAAgB,MAAM,qBAAqB;AAAA,MAE5C,oBAAC,UAAO,OAAO,EAAE,WAAW,SAAS,GAAG,SAAS,MAAM,SAAS,GAAG,4BAEnE;AAAA,OACF;AAAA,KACF;AAEJ;","names":["passwordError"]}
1
+ {"version":3,"sources":["../../../src/components/password-reset-inner.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { yupResolver } from \"@hookform/resolvers/yup\";\nimport * as yup from \"yup\";\nimport { getPasswordError } from \"@stackframe/stack-shared/dist/helpers/password\";\nimport { useStackApp } from \"..\";\nimport PasswordField from \"./password-field\";\nimport FormWarningText from \"./form-warning\";\nimport RedirectMessageCard from \"./redirect-message-card\";\nimport MessageCard from \"./message-card\";\nimport CardFrame from \"./card-frame\";\nimport { Button, Label, Text } from \"../components-core\";\nimport { runAsynchronously } from \"@stackframe/stack-shared/dist/utils/promises\";\n\nconst schema = yup.object().shape({\n password: yup.string().required('Please enter your password').test({\n name: 'is-valid-password',\n test: (value, ctx) => {\n const error = getPasswordError(value);\n if (error) {\n return ctx.createError({ message: error.message });\n } else {\n return true;\n }\n }\n }),\n passwordRepeat: yup.string().nullable().oneOf([yup.ref('password'), null], 'Passwords do not match').required('Please repeat your password')\n});\n\nexport default function PasswordResetInner(\n { code, fullPage = false }:\n { code: string, fullPage?: boolean }\n) {\n const { register, handleSubmit, formState: { errors }, clearErrors } = useForm({\n resolver: yupResolver(schema)\n });\n const stackApp = useStackApp();\n const [finished, setFinished] = useState(false);\n const [resetError, setResetError] = useState(false);\n\n const onSubmit = async (data: yup.InferType<typeof schema>) => {\n const { password } = data;\n const errorCode = await stackApp.resetPassword({ password, code });\n if (errorCode) {\n setResetError(true);\n return;\n }\n\n setFinished(true);\n };\n\n if (finished) {\n return <RedirectMessageCard type='passwordReset' fullPage={fullPage} />;\n }\n\n if (resetError) {\n return (\n <MessageCard title=\"Failed to reset password\" fullPage={fullPage}>\n <Text>Failed to reset password. Please request a new password reset link</Text>\n </MessageCard>\n );\n }\n\n return (\n <CardFrame fullPage={fullPage}>\n <div style={{ textAlign: 'center', marginBottom: '1.5rem' }}>\n <Text size=\"xl\" as='h2'>Reset Your Password</Text>\n </div>\n\n <form \n style={{ display: 'flex', flexDirection: 'column', alignItems: 'stretch' }} \n onSubmit={e => runAsynchronously(handleSubmit(onSubmit)(e))}\n noValidate\n >\n <Label htmlFor=\"password\">New Password</Label>\n <PasswordField\n id=\"password\"\n {...register('password')}\n onChange={() => {\n clearErrors('password');\n clearErrors('passwordRepeat');\n }}\n />\n <FormWarningText text={errors.password?.message?.toString()} />\n\n <Label htmlFor=\"repeat-password\" style={{ marginTop: \"1rem\" }}>Repeat New Password</Label>\n <PasswordField\n id=\"repeat-password\"\n {...register('passwordRepeat')}\n onChange={() => {\n clearErrors('password');\n clearErrors('passwordRepeat');\n }}\n />\n <FormWarningText text={errors.passwordRepeat?.message?.toString()} />\n\n <Button style={{ marginTop: '1.5rem' }} type=\"submit\">\n Reset Password\n </Button>\n </form>\n </CardFrame>\n ); \n}\n"],"mappings":";;;AAEA,SAAS,gBAAgB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7 +6,6 @@ import { useRouter } from "next/navigation";
6
6
  import { useStackApp } from "..";
7
7
  import MessageCard from "./message-card";
8
8
  import { Text, Button } from "../components-core";
9
- import { neverResolve } from "@stackframe/stack-shared/dist/utils/promises";
10
9
  import { jsx, jsxs } from "react/jsx-runtime";
11
10
  function RedirectMessageCard({
12
11
  type,
@@ -36,7 +35,7 @@ function RedirectMessageCard({
36
35
  case "emailSent": {
37
36
  title = "Email sent!";
38
37
  message = "Please check your inbox. Make sure to check your spam folder.";
39
- primaryAction = () => neverResolve();
38
+ primaryAction = () => stackApp.redirectToHome();
40
39
  primaryButton = "Go to Home";
41
40
  break;
42
41
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/redirect-message-card.tsx"],"sourcesContent":["\"use client\";\n\nimport { useRouter } from \"next/navigation\";\nimport { useStackApp } from \"..\";\nimport MessageCard from \"./message-card\";\nimport { Text, Button } from \"../components-core\";\nimport { neverResolve, wait } from \"@stackframe/stack-shared/dist/utils/promises\";\n\nexport default function RedirectMessageCard({ \n type,\n fullPage=false,\n}: { \n type: 'signedIn' | 'signedOut' | 'emailSent' | 'passwordReset' | 'emailVerified',\n fullPage?: boolean, \n}) {\n const stackApp = useStackApp();\n const router = useRouter();\n\n let title: string;\n let primaryAction: () => Promise<void>;\n let message: string | null = null;\n let primaryButton: string;\n let secondaryButton: string | null = null;\n switch (type) {\n case 'signedIn': {\n title = \"You are already signed in\";\n primaryAction = () => stackApp.redirectToAfterSignOut();\n primaryButton = \"Go to Home\";\n secondaryButton = \"Sign Out\";\n break;\n }\n case 'signedOut': {\n title = \"You are not currently signed in.\";\n primaryAction = () => stackApp.redirectToSignIn();\n primaryButton = \"Go to Home\";\n break;\n }\n case 'emailSent': {\n title = \"Email sent!\";\n message = 'Please check your inbox. Make sure to check your spam folder.';\n primaryAction = () => neverResolve();\n primaryButton = \"Go to Home\";\n break;\n }\n case 'passwordReset': {\n title = \"Password reset successfully!\";\n message = 'Your password has been reset. You can now sign in with your new password.';\n primaryAction = () => stackApp.redirectToSignIn();\n primaryButton = \"Go to Sign In\";\n break;\n }\n case 'emailVerified': {\n title = \"Email verified!\";\n message = 'Your have successfully verified your email.';\n primaryAction = () => stackApp.redirectToSignIn();\n primaryButton = \"Go to Home\";\n break;\n }\n }\n\n return (\n <MessageCard title={title} fullPage={fullPage}>\n {message && <Text>{message}</Text>}\n\n <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: '16px', marginTop: 20 }}>\n {secondaryButton && (\n <Button\n variant=\"secondary\"\n onClick={async () => {\n await stackApp.redirectToSignOut();\n }}\n >\n {secondaryButton}\n </Button>\n )}\n \n <Button onClick={primaryAction}>\n {primaryButton}\n </Button>\n </div>\n </MessageCard>\n );\n}\n"],"mappings":";;;AAEA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,OAAO,iBAAiB;AACxB,SAAS,MAAM,cAAc;AAC7B,SAAS,oBAA0B;AAwDjB,cAEZ,YAFY;AAtDH,SAAR,oBAAqC;AAAA,EAC1C;AAAA,EACA,WAAS;AACX,GAGG;AACD,QAAM,WAAW,YAAY;AAC7B,QAAM,SAAS,UAAU;AAEzB,MAAI;AACJ,MAAI;AACJ,MAAI,UAAyB;AAC7B,MAAI;AACJ,MAAI,kBAAiC;AACrC,UAAQ,MAAM;AAAA,IACZ,KAAK,YAAY;AACf,cAAQ;AACR,sBAAgB,MAAM,SAAS,uBAAuB;AACtD,sBAAgB;AAChB,wBAAkB;AAClB;AAAA,IACF;AAAA,IACA,KAAK,aAAa;AAChB,cAAQ;AACR,sBAAgB,MAAM,SAAS,iBAAiB;AAChD,sBAAgB;AAChB;AAAA,IACF;AAAA,IACA,KAAK,aAAa;AAChB,cAAQ;AACR,gBAAU;AACV,sBAAgB,MAAM,aAAa;AACnC,sBAAgB;AAChB;AAAA,IACF;AAAA,IACA,KAAK,iBAAiB;AACpB,cAAQ;AACR,gBAAU;AACV,sBAAgB,MAAM,SAAS,iBAAiB;AAChD,sBAAgB;AAChB;AAAA,IACF;AAAA,IACA,KAAK,iBAAiB;AACpB,cAAQ;AACR,gBAAU;AACV,sBAAgB,MAAM,SAAS,iBAAiB;AAChD,sBAAgB;AAChB;AAAA,IACF;AAAA,EACF;AAEA,SACE,qBAAC,eAAY,OAAc,UACxB;AAAA,eAAW,oBAAC,QAAM,mBAAQ;AAAA,IAE3B,qBAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,OAAO,YAAY,UAAU,gBAAgB,UAAU,KAAK,QAAQ,WAAW,GAAG,GAC7H;AAAA,yBACC;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,YAAY;AACnB,kBAAM,SAAS,kBAAkB;AAAA,UACnC;AAAA,UAEC;AAAA;AAAA,MACH;AAAA,MAGF,oBAAC,UAAO,SAAS,eACd,yBACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/redirect-message-card.tsx"],"sourcesContent":["\"use client\";\n\nimport { useRouter } from \"next/navigation\";\nimport { useStackApp } from \"..\";\nimport MessageCard from \"./message-card\";\nimport { Text, Button } from \"../components-core\";\nimport { neverResolve, wait } from \"@stackframe/stack-shared/dist/utils/promises\";\n\nexport default function RedirectMessageCard({ \n type,\n fullPage=false,\n}: { \n type: 'signedIn' | 'signedOut' | 'emailSent' | 'passwordReset' | 'emailVerified',\n fullPage?: boolean, \n}) {\n const stackApp = useStackApp();\n const router = useRouter();\n\n let title: string;\n let primaryAction: () => Promise<void>;\n let message: string | null = null;\n let primaryButton: string;\n let secondaryButton: string | null = null;\n switch (type) {\n case 'signedIn': {\n title = \"You are already signed in\";\n primaryAction = () => stackApp.redirectToAfterSignOut();\n primaryButton = \"Go to Home\";\n secondaryButton = \"Sign Out\";\n break;\n }\n case 'signedOut': {\n title = \"You are not currently signed in.\";\n primaryAction = () => stackApp.redirectToSignIn();\n primaryButton = \"Go to Home\";\n break;\n }\n case 'emailSent': {\n title = \"Email sent!\";\n message = 'Please check your inbox. Make sure to check your spam folder.';\n primaryAction = () => stackApp.redirectToHome();\n primaryButton = \"Go to Home\";\n break;\n }\n case 'passwordReset': {\n title = \"Password reset successfully!\";\n message = 'Your password has been reset. You can now sign in with your new password.';\n primaryAction = () => stackApp.redirectToSignIn();\n primaryButton = \"Go to Sign In\";\n break;\n }\n case 'emailVerified': {\n title = \"Email verified!\";\n message = 'Your have successfully verified your email.';\n primaryAction = () => stackApp.redirectToSignIn();\n primaryButton = \"Go to Home\";\n break;\n }\n }\n\n return (\n <MessageCard title={title} fullPage={fullPage}>\n {message && <Text>{message}</Text>}\n\n <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: '16px', marginTop: 20 }}>\n {secondaryButton && (\n <Button\n variant=\"secondary\"\n onClick={async () => {\n await stackApp.redirectToSignOut();\n }}\n >\n {secondaryButton}\n </Button>\n )}\n \n <Button onClick={primaryAction}>\n {primaryButton}\n </Button>\n </div>\n </MessageCard>\n );\n}\n"],"mappings":";;;AAEA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,OAAO,iBAAiB;AACxB,SAAS,MAAM,cAAc;AAyDX,cAEZ,YAFY;AAtDH,SAAR,oBAAqC;AAAA,EAC1C;AAAA,EACA,WAAS;AACX,GAGG;AACD,QAAM,WAAW,YAAY;AAC7B,QAAM,SAAS,UAAU;AAEzB,MAAI;AACJ,MAAI;AACJ,MAAI,UAAyB;AAC7B,MAAI;AACJ,MAAI,kBAAiC;AACrC,UAAQ,MAAM;AAAA,IACZ,KAAK,YAAY;AACf,cAAQ;AACR,sBAAgB,MAAM,SAAS,uBAAuB;AACtD,sBAAgB;AAChB,wBAAkB;AAClB;AAAA,IACF;AAAA,IACA,KAAK,aAAa;AAChB,cAAQ;AACR,sBAAgB,MAAM,SAAS,iBAAiB;AAChD,sBAAgB;AAChB;AAAA,IACF;AAAA,IACA,KAAK,aAAa;AAChB,cAAQ;AACR,gBAAU;AACV,sBAAgB,MAAM,SAAS,eAAe;AAC9C,sBAAgB;AAChB;AAAA,IACF;AAAA,IACA,KAAK,iBAAiB;AACpB,cAAQ;AACR,gBAAU;AACV,sBAAgB,MAAM,SAAS,iBAAiB;AAChD,sBAAgB;AAChB;AAAA,IACF;AAAA,IACA,KAAK,iBAAiB;AACpB,cAAQ;AACR,gBAAU;AACV,sBAAgB,MAAM,SAAS,iBAAiB;AAChD,sBAAgB;AAChB;AAAA,IACF;AAAA,EACF;AAEA,SACE,qBAAC,eAAY,OAAc,UACxB;AAAA,eAAW,oBAAC,QAAM,mBAAQ;AAAA,IAE3B,qBAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,OAAO,YAAY,UAAU,gBAAgB,UAAU,KAAK,QAAQ,WAAW,GAAG,GAC7H;AAAA,yBACC;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,YAAY;AACnB,kBAAM,SAAS,kBAAkB;AAAA,UACnC;AAAA,UAEC;AAAA;AAAA,MACH;AAAA,MAGF,oBAAC,UAAO,SAAS,eACd,yBACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1,13 +1,15 @@
1
1
  // src/components/user-avatar.tsx
2
- import { RxPerson } from "react-icons/rx";
2
+ import { UserRound } from "lucide-react";
3
3
  import { Avatar, AvatarFallback, AvatarImage, Text } from "..";
4
- import { SECONDARY_FONT_COLORS } from "../utils/constants";
5
4
  import styled from "styled-components";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
7
- var StyledIcon = styled(RxPerson)`
8
- color: ${SECONDARY_FONT_COLORS.light};
6
+ var StyledIcon = styled(UserRound)`
7
+ height: 1.25rem;
8
+ width: 1.25rem;
9
+ color: #666666;
10
+
9
11
  html[data-stack-theme='dark'] & {
10
- color: ${SECONDARY_FONT_COLORS.dark};
12
+ color: #999999;
11
13
  }
12
14
  `;
13
15
  function UserAvatar(props) {