@stackframe/stack 2.8.3 → 2.8.5

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 (122) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/components-page/account-settings/active-sessions/active-sessions-page.js +151 -0
  3. package/dist/components-page/account-settings/active-sessions/active-sessions-page.js.map +1 -0
  4. package/dist/components-page/account-settings/api-keys/api-keys-page.js +70 -0
  5. package/dist/components-page/account-settings/api-keys/api-keys-page.js.map +1 -0
  6. package/dist/components-page/account-settings/editable-text.js +75 -0
  7. package/dist/components-page/account-settings/editable-text.js.map +1 -0
  8. package/dist/components-page/account-settings/email-and-auth/email-and-auth-page.js +46 -0
  9. package/dist/components-page/account-settings/email-and-auth/email-and-auth-page.js.map +1 -0
  10. package/dist/components-page/account-settings/email-and-auth/emails-section.js +188 -0
  11. package/dist/components-page/account-settings/email-and-auth/emails-section.js.map +1 -0
  12. package/dist/components-page/account-settings/email-and-auth/mfa-section.js +146 -0
  13. package/dist/components-page/account-settings/email-and-auth/mfa-section.js.map +1 -0
  14. package/dist/components-page/account-settings/email-and-auth/otp-section.js +89 -0
  15. package/dist/components-page/account-settings/email-and-auth/otp-section.js.map +1 -0
  16. package/dist/components-page/account-settings/email-and-auth/passkey-section.js +92 -0
  17. package/dist/components-page/account-settings/email-and-auth/passkey-section.js.map +1 -0
  18. package/dist/components-page/account-settings/email-and-auth/password-section.js +181 -0
  19. package/dist/components-page/account-settings/email-and-auth/password-section.js.map +1 -0
  20. package/dist/components-page/account-settings/page-layout.js +34 -0
  21. package/dist/components-page/account-settings/page-layout.js.map +1 -0
  22. package/dist/components-page/account-settings/profile-page/profile-page.js +75 -0
  23. package/dist/components-page/account-settings/profile-page/profile-page.js.map +1 -0
  24. package/dist/components-page/account-settings/section.js +44 -0
  25. package/dist/components-page/account-settings/section.js.map +1 -0
  26. package/dist/components-page/account-settings/settings/delete-account-section.js +87 -0
  27. package/dist/components-page/account-settings/settings/delete-account-section.js.map +1 -0
  28. package/dist/components-page/account-settings/settings/settings-page.js +40 -0
  29. package/dist/components-page/account-settings/settings/settings-page.js.map +1 -0
  30. package/dist/components-page/account-settings/settings/sign-out-section.js +54 -0
  31. package/dist/components-page/account-settings/settings/sign-out-section.js.map +1 -0
  32. package/dist/components-page/account-settings/teams/leave-team-section.js +79 -0
  33. package/dist/components-page/account-settings/teams/leave-team-section.js.map +1 -0
  34. package/dist/components-page/account-settings/teams/team-api-keys-section.js +89 -0
  35. package/dist/components-page/account-settings/teams/team-api-keys-section.js.map +1 -0
  36. package/dist/components-page/account-settings/teams/team-creation-page.js +92 -0
  37. package/dist/components-page/account-settings/teams/team-creation-page.js.map +1 -0
  38. package/dist/components-page/account-settings/teams/team-display-name-section.js +57 -0
  39. package/dist/components-page/account-settings/teams/team-display-name-section.js.map +1 -0
  40. package/dist/components-page/account-settings/teams/team-member-invitation-section.js +131 -0
  41. package/dist/components-page/account-settings/teams/team-member-invitation-section.js.map +1 -0
  42. package/dist/components-page/account-settings/teams/team-member-list-section.js +61 -0
  43. package/dist/components-page/account-settings/teams/team-member-list-section.js.map +1 -0
  44. package/dist/components-page/account-settings/teams/team-page.js +50 -0
  45. package/dist/components-page/account-settings/teams/team-page.js.map +1 -0
  46. package/dist/components-page/account-settings/teams/team-profile-image-section.js +59 -0
  47. package/dist/components-page/account-settings/teams/team-profile-image-section.js.map +1 -0
  48. package/dist/components-page/account-settings/teams/team-profile-user-section.js +56 -0
  49. package/dist/components-page/account-settings/teams/team-profile-user-section.js.map +1 -0
  50. package/dist/components-page/account-settings.js +16 -1173
  51. package/dist/components-page/account-settings.js.map +1 -1
  52. package/dist/components-page/section.js +6 -0
  53. package/dist/components-page/section.js.map +1 -0
  54. package/dist/esm/components-page/account-settings/active-sessions/active-sessions-page.js +126 -0
  55. package/dist/esm/components-page/account-settings/active-sessions/active-sessions-page.js.map +1 -0
  56. package/dist/esm/components-page/account-settings/api-keys/api-keys-page.js +45 -0
  57. package/dist/esm/components-page/account-settings/api-keys/api-keys-page.js.map +1 -0
  58. package/dist/esm/components-page/account-settings/editable-text.js +50 -0
  59. package/dist/esm/components-page/account-settings/editable-text.js.map +1 -0
  60. package/dist/esm/components-page/account-settings/email-and-auth/email-and-auth-page.js +21 -0
  61. package/dist/esm/components-page/account-settings/email-and-auth/email-and-auth-page.js.map +1 -0
  62. package/dist/esm/components-page/account-settings/email-and-auth/emails-section.js +163 -0
  63. package/dist/esm/components-page/account-settings/email-and-auth/emails-section.js.map +1 -0
  64. package/dist/esm/components-page/account-settings/email-and-auth/mfa-section.js +111 -0
  65. package/dist/esm/components-page/account-settings/email-and-auth/mfa-section.js.map +1 -0
  66. package/dist/esm/components-page/account-settings/email-and-auth/otp-section.js +64 -0
  67. package/dist/esm/components-page/account-settings/email-and-auth/otp-section.js.map +1 -0
  68. package/dist/esm/components-page/account-settings/email-and-auth/passkey-section.js +67 -0
  69. package/dist/esm/components-page/account-settings/email-and-auth/passkey-section.js.map +1 -0
  70. package/dist/esm/components-page/account-settings/email-and-auth/password-section.js +146 -0
  71. package/dist/esm/components-page/account-settings/email-and-auth/password-section.js.map +1 -0
  72. package/dist/esm/components-page/account-settings/page-layout.js +9 -0
  73. package/dist/esm/components-page/account-settings/page-layout.js.map +1 -0
  74. package/dist/esm/components-page/account-settings/profile-page/profile-page.js +50 -0
  75. package/dist/esm/components-page/account-settings/profile-page/profile-page.js.map +1 -0
  76. package/dist/esm/components-page/account-settings/section.js +19 -0
  77. package/dist/esm/components-page/account-settings/section.js.map +1 -0
  78. package/dist/esm/components-page/account-settings/settings/delete-account-section.js +62 -0
  79. package/dist/esm/components-page/account-settings/settings/delete-account-section.js.map +1 -0
  80. package/dist/esm/components-page/account-settings/settings/settings-page.js +15 -0
  81. package/dist/esm/components-page/account-settings/settings/settings-page.js.map +1 -0
  82. package/dist/esm/components-page/account-settings/settings/sign-out-section.js +29 -0
  83. package/dist/esm/components-page/account-settings/settings/sign-out-section.js.map +1 -0
  84. package/dist/esm/components-page/account-settings/teams/leave-team-section.js +54 -0
  85. package/dist/esm/components-page/account-settings/teams/leave-team-section.js.map +1 -0
  86. package/dist/esm/components-page/account-settings/teams/team-api-keys-section.js +64 -0
  87. package/dist/esm/components-page/account-settings/teams/team-api-keys-section.js.map +1 -0
  88. package/dist/esm/components-page/account-settings/teams/team-creation-page.js +67 -0
  89. package/dist/esm/components-page/account-settings/teams/team-creation-page.js.map +1 -0
  90. package/dist/esm/components-page/account-settings/teams/team-display-name-section.js +32 -0
  91. package/dist/esm/components-page/account-settings/teams/team-display-name-section.js.map +1 -0
  92. package/dist/esm/components-page/account-settings/teams/team-member-invitation-section.js +106 -0
  93. package/dist/esm/components-page/account-settings/teams/team-member-invitation-section.js.map +1 -0
  94. package/dist/esm/components-page/account-settings/teams/team-member-list-section.js +36 -0
  95. package/dist/esm/components-page/account-settings/teams/team-member-list-section.js.map +1 -0
  96. package/dist/esm/components-page/account-settings/teams/team-page.js +25 -0
  97. package/dist/esm/components-page/account-settings/teams/team-page.js.map +1 -0
  98. package/dist/esm/components-page/account-settings/teams/team-profile-image-section.js +34 -0
  99. package/dist/esm/components-page/account-settings/teams/team-profile-image-section.js.map +1 -0
  100. package/dist/esm/components-page/account-settings/teams/team-profile-user-section.js +31 -0
  101. package/dist/esm/components-page/account-settings/teams/team-profile-user-section.js.map +1 -0
  102. package/dist/esm/components-page/account-settings.js +14 -1158
  103. package/dist/esm/components-page/account-settings.js.map +1 -1
  104. package/dist/esm/components-page/section.js +4 -0
  105. package/dist/esm/components-page/section.js.map +1 -0
  106. package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -1
  107. package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.js +79 -0
  108. package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
  109. package/dist/esm/lib/stack-app/apps/implementations/common.js +1 -1
  110. package/dist/esm/lib/stack-app/apps/implementations/common.js.map +1 -1
  111. package/dist/esm/lib/stack-app/apps/interfaces/client-app.js.map +1 -1
  112. package/dist/esm/lib/stack-app/projects/index.js.map +1 -1
  113. package/dist/index.d.mts +5 -1
  114. package/dist/index.d.ts +5 -1
  115. package/dist/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -1
  116. package/dist/lib/stack-app/apps/implementations/client-app-impl.js +79 -0
  117. package/dist/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
  118. package/dist/lib/stack-app/apps/implementations/common.js +1 -1
  119. package/dist/lib/stack-app/apps/implementations/common.js.map +1 -1
  120. package/dist/lib/stack-app/apps/interfaces/client-app.js.map +1 -1
  121. package/dist/lib/stack-app/projects/index.js.map +1 -1
  122. package/package.json +4 -4
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components-page/account-settings/profile-page/profile-page.tsx
21
+ var profile_page_exports = {};
22
+ __export(profile_page_exports, {
23
+ ProfilePage: () => ProfilePage
24
+ });
25
+ module.exports = __toCommonJS(profile_page_exports);
26
+ var import_profile_image_editor = require("../../../components/profile-image-editor");
27
+ var import_hooks = require("../../../lib/hooks");
28
+ var import_translations = require("../../../lib/translations");
29
+ var import_editable_text = require("../editable-text");
30
+ var import_page_layout = require("../page-layout");
31
+ var import_section = require("../section");
32
+ var import_jsx_runtime = require("react/jsx-runtime");
33
+ function ProfilePage() {
34
+ const { t } = (0, import_translations.useTranslation)();
35
+ const user = (0, import_hooks.useUser)({ or: "redirect" });
36
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_page_layout.PageLayout, { children: [
37
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
38
+ import_section.Section,
39
+ {
40
+ title: t("User name"),
41
+ description: t("This is a display name and is not used for authentication"),
42
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
43
+ import_editable_text.EditableText,
44
+ {
45
+ value: user.displayName || "",
46
+ onSave: async (newDisplayName) => {
47
+ await user.update({ displayName: newDisplayName });
48
+ }
49
+ }
50
+ )
51
+ }
52
+ ),
53
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
54
+ import_section.Section,
55
+ {
56
+ title: t("Profile image"),
57
+ description: t("Upload your own image as your avatar"),
58
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
59
+ import_profile_image_editor.ProfileImageEditor,
60
+ {
61
+ user,
62
+ onProfileImageUrlChange: async (profileImageUrl) => {
63
+ await user.update({ profileImageUrl });
64
+ }
65
+ }
66
+ )
67
+ }
68
+ )
69
+ ] });
70
+ }
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ ProfilePage
74
+ });
75
+ //# sourceMappingURL=profile-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components-page/account-settings/profile-page/profile-page.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { ProfileImageEditor } from \"../../../components/profile-image-editor\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { EditableText } from \"../editable-text\";\nimport { PageLayout } from \"../page-layout\";\nimport { Section } from \"../section\";\n\nexport function ProfilePage() {\n const { t } = useTranslation();\n const user = useUser({ or: 'redirect' });\n\n return (\n <PageLayout>\n <Section\n title={t(\"User name\")}\n description={t(\"This is a display name and is not used for authentication\")}\n >\n <EditableText\n value={user.displayName || ''}\n onSave={async (newDisplayName) => {\n await user.update({ displayName: newDisplayName });\n }}/>\n </Section>\n\n <Section\n title={t(\"Profile image\")}\n description={t(\"Upload your own image as your avatar\")}\n >\n <ProfileImageEditor\n user={user}\n onProfileImageUrlChange={async (profileImageUrl) => {\n await user.update({ profileImageUrl });\n }}\n />\n </Section>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kCAAmC;AACnC,mBAAwB;AACxB,0BAA+B;AAC/B,2BAA6B;AAC7B,yBAA2B;AAC3B,qBAAwB;AAOpB;AALG,SAAS,cAAc;AAC5B,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AAEvC,SACE,6CAAC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,WAAW;AAAA,QACpB,aAAa,EAAE,2DAA2D;AAAA,QAE1E;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,KAAK,eAAe;AAAA,YAC3B,QAAQ,OAAO,mBAAmB;AAChC,oBAAM,KAAK,OAAO,EAAE,aAAa,eAAe,CAAC;AAAA,YACnD;AAAA;AAAA,QAAE;AAAA;AAAA,IACN;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,eAAe;AAAA,QACxB,aAAa,EAAE,sCAAsC;AAAA,QAErD;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,yBAAyB,OAAO,oBAAoB;AAClD,oBAAM,KAAK,OAAO,EAAE,gBAAgB,CAAC;AAAA,YACvC;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components-page/account-settings/section.tsx
21
+ var section_exports = {};
22
+ __export(section_exports, {
23
+ Section: () => Section
24
+ });
25
+ module.exports = __toCommonJS(section_exports);
26
+ var import_stack_ui = require("@stackframe/stack-ui");
27
+ var import_jsx_runtime = require("react/jsx-runtime");
28
+ function Section(props) {
29
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
30
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Separator, {}),
31
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col sm:flex-row gap-2", children: [
32
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sm:flex-1 flex flex-col justify-center", children: [
33
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { className: "font-medium", children: props.title }),
34
+ props.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", type: "footnote", children: props.description })
35
+ ] }),
36
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sm:flex-1 sm:items-end flex flex-col gap-2 ", children: props.children })
37
+ ] })
38
+ ] });
39
+ }
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ Section
43
+ });
44
+ //# sourceMappingURL=section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components-page/account-settings/section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Separator, Typography } from \"@stackframe/stack-ui\";\n\nexport function Section(props: { title: string, description?: string, children: React.ReactNode }) {\n return (\n <>\n <Separator />\n <div className='flex flex-col sm:flex-row gap-2'>\n <div className='sm:flex-1 flex flex-col justify-center'>\n <Typography className='font-medium'>\n {props.title}\n </Typography>\n {props.description && <Typography variant='secondary' type='footnote'>\n {props.description}\n </Typography>}\n </div>\n <div className='sm:flex-1 sm:items-end flex flex-col gap-2 '>\n {props.children}\n </div>\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAAsC;AAIlC;AAFG,SAAS,QAAQ,OAA2E;AACjG,SACE,4EACE;AAAA,gDAAC,6BAAU;AAAA,IACX,6CAAC,SAAI,WAAU,mCACb;AAAA,mDAAC,SAAI,WAAU,0CACb;AAAA,oDAAC,8BAAW,WAAU,eACnB,gBAAM,OACT;AAAA,QACC,MAAM,eAAe,4CAAC,8BAAW,SAAQ,aAAY,MAAK,YACxD,gBAAM,aACT;AAAA,SACF;AAAA,MACA,4CAAC,SAAI,WAAU,+CACZ,gBAAM,UACT;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components-page/account-settings/settings/delete-account-section.tsx
21
+ var delete_account_section_exports = {};
22
+ __export(delete_account_section_exports, {
23
+ DeleteAccountSection: () => DeleteAccountSection
24
+ });
25
+ module.exports = __toCommonJS(delete_account_section_exports);
26
+ var import_stack_ui = require("@stackframe/stack-ui");
27
+ var import_react = require("react");
28
+ var import_hooks = require("../../../lib/hooks");
29
+ var import_translations = require("../../../lib/translations");
30
+ var import_section = require("../section");
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ function DeleteAccountSection() {
33
+ const { t } = (0, import_translations.useTranslation)();
34
+ const user = (0, import_hooks.useUser)({ or: "redirect" });
35
+ const app = (0, import_hooks.useStackApp)();
36
+ const project = app.useProject();
37
+ const [deleting, setDeleting] = (0, import_react.useState)(false);
38
+ if (!project.config.clientUserDeletionEnabled) {
39
+ return null;
40
+ }
41
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
42
+ import_section.Section,
43
+ {
44
+ title: t("Delete Account"),
45
+ description: t("Permanently remove your account and all associated data"),
46
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "stack-scope flex flex-col items-stretch", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Accordion, { type: "single", collapsible: true, className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.AccordionItem, { value: "item-1", children: [
47
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.AccordionTrigger, { children: t("Danger zone") }),
48
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.AccordionContent, { children: !deleting ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
49
+ import_stack_ui.Button,
50
+ {
51
+ variant: "destructive",
52
+ onClick: () => setDeleting(true),
53
+ children: t("Delete account")
54
+ }
55
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-2", children: [
56
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "destructive", children: t("Are you sure you want to delete your account? This action is IRREVERSIBLE and will delete ALL associated data.") }),
57
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2", children: [
58
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
59
+ import_stack_ui.Button,
60
+ {
61
+ variant: "destructive",
62
+ onClick: async () => {
63
+ await user.delete();
64
+ await app.redirectToHome();
65
+ },
66
+ children: t("Delete Account")
67
+ }
68
+ ),
69
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
70
+ import_stack_ui.Button,
71
+ {
72
+ variant: "secondary",
73
+ onClick: () => setDeleting(false),
74
+ children: t("Cancel")
75
+ }
76
+ )
77
+ ] })
78
+ ] }) })
79
+ ] }) }) })
80
+ }
81
+ );
82
+ }
83
+ // Annotate the CommonJS export names for ESM import in node:
84
+ 0 && (module.exports = {
85
+ DeleteAccountSection
86
+ });
87
+ //# sourceMappingURL=delete-account-section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components-page/account-settings/settings/delete-account-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Button, Typography } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { useStackApp, useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { Section } from \"../section\";\n\nexport function DeleteAccountSection() {\n const { t } = useTranslation();\n const user = useUser({ or: 'redirect' });\n const app = useStackApp();\n const project = app.useProject();\n const [deleting, setDeleting] = useState(false);\n if (!project.config.clientUserDeletionEnabled) {\n return null;\n }\n\n return (\n <Section\n title={t(\"Delete Account\")}\n description={t(\"Permanently remove your account and all associated data\")}\n >\n <div className='stack-scope flex flex-col items-stretch'>\n <Accordion type=\"single\" collapsible className=\"w-full\">\n <AccordionItem value=\"item-1\">\n <AccordionTrigger>{t(\"Danger zone\")}</AccordionTrigger>\n <AccordionContent>\n {!deleting ? (\n <div>\n <Button\n variant='destructive'\n onClick={() => setDeleting(true)}\n >\n {t(\"Delete account\")}\n </Button>\n </div>\n ) : (\n <div className='flex flex-col gap-2'>\n <Typography variant='destructive'>\n {t(\"Are you sure you want to delete your account? This action is IRREVERSIBLE and will delete ALL associated data.\")}\n </Typography>\n <div className='flex gap-2'>\n <Button\n variant='destructive'\n onClick={async () => {\n await user.delete();\n await app.redirectToHome();\n }}\n >\n {t(\"Delete Account\")}\n </Button>\n <Button\n variant='secondary'\n onClick={() => setDeleting(false)}\n >\n {t(\"Cancel\")}\n </Button>\n </div>\n </div>\n )}\n </AccordionContent>\n </AccordionItem>\n </Accordion>\n </div>\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAAiG;AACjG,mBAAyB;AACzB,mBAAqC;AACrC,0BAA+B;AAC/B,qBAAwB;AAoBZ;AAlBL,SAAS,uBAAuB;AACrC,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,UAAM,0BAAY;AACxB,QAAM,UAAU,IAAI,WAAW;AAC/B,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAS,KAAK;AAC9C,MAAI,CAAC,QAAQ,OAAO,2BAA2B;AAC7C,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,gBAAgB;AAAA,MACzB,aAAa,EAAE,yDAAyD;AAAA,MAExE,sDAAC,SAAI,WAAU,2CACb,sDAAC,6BAAU,MAAK,UAAS,aAAW,MAAC,WAAU,UAC7C,uDAAC,iCAAc,OAAM,UACnB;AAAA,oDAAC,oCAAkB,YAAE,aAAa,GAAE;AAAA,QACpC,4CAAC,oCACE,WAAC,WACA,4CAAC,SACC;AAAA,UAAC;AAAA;AAAA,YACC,SAAQ;AAAA,YACR,SAAS,MAAM,YAAY,IAAI;AAAA,YAE9B,YAAE,gBAAgB;AAAA;AAAA,QACrB,GACF,IAEA,6CAAC,SAAI,WAAU,uBACb;AAAA,sDAAC,8BAAW,SAAQ,eACjB,YAAE,gHAAgH,GACrH;AAAA,UACA,6CAAC,SAAI,WAAU,cACb;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,SAAS,YAAY;AACnB,wBAAM,KAAK,OAAO;AAClB,wBAAM,IAAI,eAAe;AAAA,gBAC3B;AAAA,gBAEC,YAAE,gBAAgB;AAAA;AAAA,YACrB;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,SAAS,MAAM,YAAY,KAAK;AAAA,gBAE/B,YAAE,QAAQ;AAAA;AAAA,YACb;AAAA,aACF;AAAA,WACF,GAEJ;AAAA,SACF,GACF,GACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components-page/account-settings/settings/settings-page.tsx
21
+ var settings_page_exports = {};
22
+ __export(settings_page_exports, {
23
+ SettingsPage: () => SettingsPage
24
+ });
25
+ module.exports = __toCommonJS(settings_page_exports);
26
+ var import_page_layout = require("../page-layout");
27
+ var import_delete_account_section = require("./delete-account-section");
28
+ var import_sign_out_section = require("./sign-out-section");
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ function SettingsPage() {
31
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_page_layout.PageLayout, { children: [
32
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_delete_account_section.DeleteAccountSection, {}),
33
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sign_out_section.SignOutSection, {})
34
+ ] });
35
+ }
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ SettingsPage
39
+ });
40
+ //# sourceMappingURL=settings-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components-page/account-settings/settings/settings-page.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { PageLayout } from \"../page-layout\";\nimport { DeleteAccountSection } from \"./delete-account-section\";\nimport { SignOutSection } from \"./sign-out-section\";\n\n\nexport function SettingsPage() {\n return (\n <PageLayout>\n <DeleteAccountSection />\n <SignOutSection />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,yBAA2B;AAC3B,oCAAqC;AACrC,8BAA+B;AAK3B;AAFG,SAAS,eAAe;AAC7B,SACE,6CAAC,iCACC;AAAA,gDAAC,sDAAqB;AAAA,IACtB,4CAAC,0CAAe;AAAA,KAClB;AAEJ;","names":[]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components-page/account-settings/settings/sign-out-section.tsx
21
+ var sign_out_section_exports = {};
22
+ __export(sign_out_section_exports, {
23
+ SignOutSection: () => SignOutSection
24
+ });
25
+ module.exports = __toCommonJS(sign_out_section_exports);
26
+ var import_stack_ui = require("@stackframe/stack-ui");
27
+ var import_hooks = require("../../../lib/hooks");
28
+ var import_translations = require("../../../lib/translations");
29
+ var import_section = require("../section");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ function SignOutSection() {
32
+ const { t } = (0, import_translations.useTranslation)();
33
+ const user = (0, import_hooks.useUser)({ or: "throw" });
34
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
35
+ import_section.Section,
36
+ {
37
+ title: t("Sign out"),
38
+ description: t("End your current session"),
39
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
40
+ import_stack_ui.Button,
41
+ {
42
+ variant: "secondary",
43
+ onClick: () => user.signOut(),
44
+ children: t("Sign out")
45
+ }
46
+ ) })
47
+ }
48
+ );
49
+ }
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ SignOutSection
53
+ });
54
+ //# sourceMappingURL=sign-out-section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components-page/account-settings/settings/sign-out-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Button } from \"@stackframe/stack-ui\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { Section } from \"../section\";\n\nexport function SignOutSection() {\n const { t } = useTranslation();\n const user = useUser({ or: \"throw\" });\n\n return (\n <Section\n title={t(\"Sign out\")}\n description={t(\"End your current session\")}\n >\n <div>\n <Button\n variant='secondary'\n onClick={() => user.signOut()}\n >\n {t(\"Sign out\")}\n </Button>\n </div>\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAAuB;AACvB,mBAAwB;AACxB,0BAA+B;AAC/B,qBAAwB;AAYhB;AAVD,SAAS,iBAAiB;AAC/B,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,QAAQ,CAAC;AAEpC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,UAAU;AAAA,MACnB,aAAa,EAAE,0BAA0B;AAAA,MAEzC,sDAAC,SACC;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,MAAM,KAAK,QAAQ;AAAA,UAE3B,YAAE,UAAU;AAAA;AAAA,MACf,GACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components-page/account-settings/teams/leave-team-section.tsx
21
+ var leave_team_section_exports = {};
22
+ __export(leave_team_section_exports, {
23
+ LeaveTeamSection: () => LeaveTeamSection
24
+ });
25
+ module.exports = __toCommonJS(leave_team_section_exports);
26
+ var import_stack_ui = require("@stackframe/stack-ui");
27
+ var import_react = require("react");
28
+ var import_hooks = require("../../../lib/hooks");
29
+ var import_translations = require("../../../lib/translations");
30
+ var import_section = require("../section");
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ function LeaveTeamSection(props) {
33
+ const { t } = (0, import_translations.useTranslation)();
34
+ const user = (0, import_hooks.useUser)({ or: "redirect" });
35
+ const [leaving, setLeaving] = (0, import_react.useState)(false);
36
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
37
+ import_section.Section,
38
+ {
39
+ title: t("Leave Team"),
40
+ description: t("leave this team and remove your team profile"),
41
+ children: !leaving ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
42
+ import_stack_ui.Button,
43
+ {
44
+ variant: "secondary",
45
+ onClick: () => setLeaving(true),
46
+ children: t("Leave team")
47
+ }
48
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-2", children: [
49
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "destructive", children: t("Are you sure you want to leave the team?") }),
50
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2", children: [
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
52
+ import_stack_ui.Button,
53
+ {
54
+ variant: "destructive",
55
+ onClick: async () => {
56
+ await user.leaveTeam(props.team);
57
+ window.location.reload();
58
+ },
59
+ children: t("Leave")
60
+ }
61
+ ),
62
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
63
+ import_stack_ui.Button,
64
+ {
65
+ variant: "secondary",
66
+ onClick: () => setLeaving(false),
67
+ children: t("Cancel")
68
+ }
69
+ )
70
+ ] })
71
+ ] })
72
+ }
73
+ );
74
+ }
75
+ // Annotate the CommonJS export names for ESM import in node:
76
+ 0 && (module.exports = {
77
+ LeaveTeamSection
78
+ });
79
+ //# sourceMappingURL=leave-team-section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components-page/account-settings/teams/leave-team-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Button, Typography } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { Team } from \"../../..\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { Section } from \"../section\";\n\nexport function LeaveTeamSection(props: { team: Team }) {\n const { t } = useTranslation();\n const user = useUser({ or: 'redirect' });\n const [leaving, setLeaving] = useState(false);\n\n return (\n <Section\n title={t(\"Leave Team\")}\n description={t(\"leave this team and remove your team profile\")}\n >\n {!leaving ? (\n <div>\n <Button\n variant='secondary'\n onClick={() => setLeaving(true)}\n >\n {t(\"Leave team\")}\n </Button>\n </div>\n ) : (\n <div className='flex flex-col gap-2'>\n <Typography variant='destructive'>\n {t(\"Are you sure you want to leave the team?\")}\n </Typography>\n <div className='flex gap-2'>\n <Button\n variant='destructive'\n onClick={async () => {\n await user.leaveTeam(props.team);\n window.location.reload();\n }}\n >\n {t(\"Leave\")}\n </Button>\n <Button\n variant='secondary'\n onClick={() => setLeaving(false)}\n >\n {t(\"Cancel\")}\n </Button>\n </div>\n </div>\n )}\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAAmC;AACnC,mBAAyB;AAEzB,mBAAwB;AACxB,0BAA+B;AAC/B,qBAAwB;AAcd;AAZH,SAAS,iBAAiB,OAAuB;AACtD,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAE5C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,YAAY;AAAA,MACrB,aAAa,EAAE,8CAA8C;AAAA,MAE5D,WAAC,UACA,4CAAC,SACC;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,MAAM,WAAW,IAAI;AAAA,UAE7B,YAAE,YAAY;AAAA;AAAA,MACjB,GACF,IAEA,6CAAC,SAAI,WAAU,uBACb;AAAA,oDAAC,8BAAW,SAAQ,eACjB,YAAE,0CAA0C,GAC/C;AAAA,QACA,6CAAC,SAAI,WAAU,cACb;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAAS,YAAY;AACnB,sBAAM,KAAK,UAAU,MAAM,IAAI;AAC/B,uBAAO,SAAS,OAAO;AAAA,cACzB;AAAA,cAEC,YAAE,OAAO;AAAA;AAAA,UACZ;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAAS,MAAM,WAAW,KAAK;AAAA,cAE9B,YAAE,QAAQ;AAAA;AAAA,UACb;AAAA,WACF;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components-page/account-settings/teams/team-api-keys-section.tsx
21
+ var team_api_keys_section_exports = {};
22
+ __export(team_api_keys_section_exports, {
23
+ TeamApiKeysSection: () => TeamApiKeysSection
24
+ });
25
+ module.exports = __toCommonJS(team_api_keys_section_exports);
26
+ var import_errors = require("@stackframe/stack-shared/dist/utils/errors");
27
+ var import_stack_ui = require("@stackframe/stack-ui");
28
+ var import_react = require("react");
29
+ var import_api_key_dialogs = require("../../../components/api-key-dialogs");
30
+ var import_api_key_table = require("../../../components/api-key-table");
31
+ var import_hooks = require("../../../lib/hooks");
32
+ var import_translations = require("../../../lib/translations");
33
+ var import_section = require("../section");
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ function TeamApiKeysSection(props) {
36
+ const user = (0, import_hooks.useUser)({ or: "redirect" });
37
+ const team = user.useTeam(props.team.id);
38
+ if (!team) {
39
+ throw new import_errors.StackAssertionError("Team not found");
40
+ }
41
+ const manageApiKeysPermission = user.usePermission(props.team, "$manage_api_keys");
42
+ if (!manageApiKeysPermission) {
43
+ return null;
44
+ }
45
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TeamApiKeysSectionInner, { team: props.team });
46
+ }
47
+ function TeamApiKeysSectionInner(props) {
48
+ const { t } = (0, import_translations.useTranslation)();
49
+ const [isNewApiKeyDialogOpen, setIsNewApiKeyDialogOpen] = (0, import_react.useState)(false);
50
+ const [returnedApiKey, setReturnedApiKey] = (0, import_react.useState)(null);
51
+ const apiKeys = props.team.useApiKeys();
52
+ const CreateDialog = import_api_key_dialogs.CreateApiKeyDialog;
53
+ const ShowDialog = import_api_key_dialogs.ShowApiKeyDialog;
54
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
55
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
56
+ import_section.Section,
57
+ {
58
+ title: t("API Keys"),
59
+ description: t("API keys grant programmatic access to your team."),
60
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { onClick: () => setIsNewApiKeyDialogOpen(true), children: t("Create API Key") })
61
+ }
62
+ ),
63
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_api_key_table.ApiKeyTable, { apiKeys }),
64
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
+ CreateDialog,
66
+ {
67
+ open: isNewApiKeyDialogOpen,
68
+ onOpenChange: setIsNewApiKeyDialogOpen,
69
+ onKeyCreated: setReturnedApiKey,
70
+ createApiKey: async (data) => {
71
+ const apiKey = await props.team.createApiKey(data);
72
+ return apiKey;
73
+ }
74
+ }
75
+ ),
76
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
77
+ ShowDialog,
78
+ {
79
+ apiKey: returnedApiKey,
80
+ onClose: () => setReturnedApiKey(null)
81
+ }
82
+ )
83
+ ] });
84
+ }
85
+ // Annotate the CommonJS export names for ESM import in node:
86
+ 0 && (module.exports = {
87
+ TeamApiKeysSection
88
+ });
89
+ //# sourceMappingURL=team-api-keys-section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-api-keys-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { StackAssertionError } from \"@stackframe/stack-shared/dist/utils/errors\";\nimport { Button } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { CreateApiKeyDialog, ShowApiKeyDialog } from \"../../../components/api-key-dialogs\";\nimport { ApiKeyTable } from \"../../../components/api-key-table\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { TeamApiKeyFirstView } from \"../../../lib/stack-app/api-keys\";\nimport { Team } from \"../../../lib/stack-app/teams\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { Section } from \"../section\";\n\n\nexport function TeamApiKeysSection(props: { team: Team }) {\n const user = useUser({ or: 'redirect' });\n const team = user.useTeam(props.team.id);\n\n if (!team) {\n throw new StackAssertionError(\"Team not found\");\n }\n\n const manageApiKeysPermission = user.usePermission(props.team, '$manage_api_keys');\n if (!manageApiKeysPermission) {\n return null;\n }\n\n return <TeamApiKeysSectionInner team={props.team} />;\n}\n\nfunction TeamApiKeysSectionInner(props: { team: Team }) {\n const { t } = useTranslation();\n\n const [isNewApiKeyDialogOpen, setIsNewApiKeyDialogOpen] = useState(false);\n const [returnedApiKey, setReturnedApiKey] = useState<TeamApiKeyFirstView | null>(null);\n\n const apiKeys = props.team.useApiKeys();\n\n const CreateDialog = CreateApiKeyDialog<\"team\">;\n const ShowDialog = ShowApiKeyDialog<\"team\">;\n\n return (\n <>\n <Section\n title={t(\"API Keys\")}\n description={t(\"API keys grant programmatic access to your team.\")}\n >\n <Button onClick={() => setIsNewApiKeyDialogOpen(true)}>\n {t(\"Create API Key\")}\n </Button>\n </Section>\n <ApiKeyTable apiKeys={apiKeys} />\n\n <CreateDialog\n open={isNewApiKeyDialogOpen}\n onOpenChange={setIsNewApiKeyDialogOpen}\n onKeyCreated={setReturnedApiKey}\n createApiKey={async (data) => {\n const apiKey = await props.team.createApiKey(data);\n return apiKey;\n }}\n />\n <ShowDialog\n apiKey={returnedApiKey}\n onClose={() => setReturnedApiKey(null)}\n />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAAoC;AACpC,sBAAuB;AACvB,mBAAyB;AACzB,6BAAqD;AACrD,2BAA4B;AAC5B,mBAAwB;AAGxB,0BAA+B;AAC/B,qBAAwB;AAgBf;AAbF,SAAS,mBAAmB,OAAuB;AACxD,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,OAAO,KAAK,QAAQ,MAAM,KAAK,EAAE;AAEvC,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,kCAAoB,gBAAgB;AAAA,EAChD;AAEA,QAAM,0BAA0B,KAAK,cAAc,MAAM,MAAM,kBAAkB;AACjF,MAAI,CAAC,yBAAyB;AAC5B,WAAO;AAAA,EACT;AAEA,SAAO,4CAAC,2BAAwB,MAAM,MAAM,MAAM;AACpD;AAEA,SAAS,wBAAwB,OAAuB;AACtD,QAAM,EAAE,EAAE,QAAI,oCAAe;AAE7B,QAAM,CAAC,uBAAuB,wBAAwB,QAAI,uBAAS,KAAK;AACxE,QAAM,CAAC,gBAAgB,iBAAiB,QAAI,uBAAqC,IAAI;AAErF,QAAM,UAAU,MAAM,KAAK,WAAW;AAEtC,QAAM,eAAe;AACrB,QAAM,aAAa;AAEnB,SACE,4EACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,UAAU;AAAA,QACnB,aAAa,EAAE,kDAAkD;AAAA,QAEjE,sDAAC,0BAAO,SAAS,MAAM,yBAAyB,IAAI,GACjD,YAAE,gBAAgB,GACrB;AAAA;AAAA,IACF;AAAA,IACA,4CAAC,oCAAY,SAAkB;AAAA,IAE/B;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,cAAc;AAAA,QACd,cAAc;AAAA,QACd,cAAc,OAAO,SAAS;AAC5B,gBAAM,SAAS,MAAM,MAAM,KAAK,aAAa,IAAI;AACjD,iBAAO;AAAA,QACT;AAAA;AAAA,IACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,SAAS,MAAM,kBAAkB,IAAI;AAAA;AAAA,IACvC;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components-page/account-settings/teams/team-creation-page.tsx
21
+ var team_creation_page_exports = {};
22
+ __export(team_creation_page_exports, {
23
+ TeamCreationPage: () => TeamCreationPage
24
+ });
25
+ module.exports = __toCommonJS(team_creation_page_exports);
26
+ var import_yup = require("@hookform/resolvers/yup");
27
+ var import_schema_fields = require("@stackframe/stack-shared/dist/schema-fields");
28
+ var import_promises = require("@stackframe/stack-shared/dist/utils/promises");
29
+ var import_stack_ui = require("@stackframe/stack-ui");
30
+ var import_react = require("react");
31
+ var import_react_hook_form = require("react-hook-form");
32
+ var import_form_warning = require("../../../components/elements/form-warning");
33
+ var import_message_card = require("../../../components/message-cards/message-card");
34
+ var import_hooks = require("../../../lib/hooks");
35
+ var import_translations = require("../../../lib/translations");
36
+ var import_page_layout = require("../page-layout");
37
+ var import_section = require("../section");
38
+ var import_jsx_runtime = require("react/jsx-runtime");
39
+ function TeamCreationPage() {
40
+ const { t } = (0, import_translations.useTranslation)();
41
+ const teamCreationSchema = (0, import_schema_fields.yupObject)({
42
+ displayName: (0, import_schema_fields.yupString)().defined().nonEmpty(t("Please enter a team name"))
43
+ });
44
+ const { register, handleSubmit, formState: { errors } } = (0, import_react_hook_form.useForm)({
45
+ resolver: (0, import_yup.yupResolver)(teamCreationSchema)
46
+ });
47
+ const app = (0, import_hooks.useStackApp)();
48
+ const project = app.useProject();
49
+ const user = (0, import_hooks.useUser)({ or: "redirect" });
50
+ const navigate = app.useNavigate();
51
+ const [loading, setLoading] = (0, import_react.useState)(false);
52
+ if (!project.config.clientTeamCreationEnabled) {
53
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_message_card.MessageCard, { title: t("Team creation is not enabled") });
54
+ }
55
+ const onSubmit = async (data) => {
56
+ setLoading(true);
57
+ let team;
58
+ try {
59
+ team = await user.createTeam({ displayName: data.displayName });
60
+ } finally {
61
+ setLoading(false);
62
+ }
63
+ navigate(`#team-${team.id}`);
64
+ };
65
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_page_layout.PageLayout, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_section.Section, { title: t("Create a Team"), description: t("Enter a display name for your new team"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
66
+ "form",
67
+ {
68
+ onSubmit: (e) => (0, import_promises.runAsynchronouslyWithAlert)(handleSubmit(onSubmit)(e)),
69
+ noValidate: true,
70
+ className: "flex gap-2 flex-col sm:flex-row",
71
+ children: [
72
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col flex-1", children: [
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ import_stack_ui.Input,
75
+ {
76
+ id: "displayName",
77
+ type: "text",
78
+ ...register("displayName")
79
+ }
80
+ ),
81
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.displayName?.message?.toString() })
82
+ ] }),
83
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { type: "submit", loading, children: t("Create") })
84
+ ]
85
+ }
86
+ ) }) });
87
+ }
88
+ // Annotate the CommonJS export names for ESM import in node:
89
+ 0 && (module.exports = {
90
+ TeamCreationPage
91
+ });
92
+ //# sourceMappingURL=team-creation-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-creation-page.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { yupResolver } from \"@hookform/resolvers/yup\";\nimport { yupObject, yupString } from \"@stackframe/stack-shared/dist/schema-fields\";\nimport { runAsynchronouslyWithAlert } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { Button, Input } from \"@stackframe/stack-ui\";\nimport { useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport * as yup from \"yup\";\nimport { FormWarningText } from \"../../../components/elements/form-warning\";\nimport { MessageCard } from \"../../../components/message-cards/message-card\";\nimport { useStackApp, useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { PageLayout } from \"../page-layout\";\nimport { Section } from \"../section\";\n\nexport function TeamCreationPage() {\n const { t } = useTranslation();\n\n const teamCreationSchema = yupObject({\n displayName: yupString().defined().nonEmpty(t(\"Please enter a team name\")),\n });\n\n const { register, handleSubmit, formState: { errors } } = useForm({\n resolver: yupResolver(teamCreationSchema)\n });\n const app = useStackApp();\n const project = app.useProject();\n const user = useUser({ or: 'redirect' });\n const navigate = app.useNavigate();\n const [loading, setLoading] = useState(false);\n\n if (!project.config.clientTeamCreationEnabled) {\n return <MessageCard title={t(\"Team creation is not enabled\")} />;\n }\n\n const onSubmit = async (data: yup.InferType<typeof teamCreationSchema>) => {\n setLoading(true);\n\n let team;\n try {\n team = await user.createTeam({ displayName: data.displayName });\n } finally {\n setLoading(false);\n }\n\n navigate(`#team-${team.id}`);\n };\n\n return (\n <PageLayout>\n <Section title={t(\"Create a Team\")} description={t(\"Enter a display name for your new team\")}>\n <form\n onSubmit={e => runAsynchronouslyWithAlert(handleSubmit(onSubmit)(e))}\n noValidate\n className='flex gap-2 flex-col sm:flex-row'\n >\n <div className='flex flex-col flex-1'>\n <Input\n id=\"displayName\"\n type=\"text\"\n {...register(\"displayName\")}\n />\n <FormWarningText text={errors.displayName?.message?.toString()} />\n </div>\n <Button type=\"submit\" loading={loading}>{t(\"Create\")}</Button>\n </form>\n </Section>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,iBAA4B;AAC5B,2BAAqC;AACrC,sBAA2C;AAC3C,sBAA8B;AAC9B,mBAAyB;AACzB,6BAAwB;AAExB,0BAAgC;AAChC,0BAA4B;AAC5B,mBAAqC;AACrC,0BAA+B;AAC/B,yBAA2B;AAC3B,qBAAwB;AAmBb;AAjBJ,SAAS,mBAAmB;AACjC,QAAM,EAAE,EAAE,QAAI,oCAAe;AAE7B,QAAM,yBAAqB,gCAAU;AAAA,IACnC,iBAAa,gCAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,0BAA0B,CAAC;AAAA,EAC3E,CAAC;AAED,QAAM,EAAE,UAAU,cAAc,WAAW,EAAE,OAAO,EAAE,QAAI,gCAAQ;AAAA,IAChE,cAAU,wBAAY,kBAAkB;AAAA,EAC1C,CAAC;AACD,QAAM,UAAM,0BAAY;AACxB,QAAM,UAAU,IAAI,WAAW;AAC/B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,WAAW,IAAI,YAAY;AACjC,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAE5C,MAAI,CAAC,QAAQ,OAAO,2BAA2B;AAC7C,WAAO,4CAAC,mCAAY,OAAO,EAAE,8BAA8B,GAAG;AAAA,EAChE;AAEA,QAAM,WAAW,OAAO,SAAmD;AACzE,eAAW,IAAI;AAEf,QAAI;AACJ,QAAI;AACF,aAAO,MAAM,KAAK,WAAW,EAAE,aAAa,KAAK,YAAY,CAAC;AAAA,IAChE,UAAE;AACA,iBAAW,KAAK;AAAA,IAClB;AAEA,aAAS,SAAS,KAAK,EAAE,EAAE;AAAA,EAC7B;AAEA,SACE,4CAAC,iCACC,sDAAC,0BAAQ,OAAO,EAAE,eAAe,GAAG,aAAa,EAAE,wCAAwC,GACzF;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,WAAK,4CAA2B,aAAa,QAAQ,EAAE,CAAC,CAAC;AAAA,MACnE,YAAU;AAAA,MACV,WAAU;AAAA,MAEV;AAAA,qDAAC,SAAI,WAAU,wBACb;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,IAAG;AAAA,cACH,MAAK;AAAA,cACJ,GAAG,SAAS,aAAa;AAAA;AAAA,UAC5B;AAAA,UACA,4CAAC,uCAAgB,MAAM,OAAO,aAAa,SAAS,SAAS,GAAG;AAAA,WAClE;AAAA,QACA,4CAAC,0BAAO,MAAK,UAAS,SAAmB,YAAE,QAAQ,GAAE;AAAA;AAAA;AAAA,EACvD,GACF,GACF;AAEJ;","names":[]}