@stackframe/stack 2.8.3 → 2.8.6

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 (126) hide show
  1. package/CHANGELOG.md +28 -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/esm/lib/translations.js +0 -1
  114. package/dist/esm/lib/translations.js.map +1 -1
  115. package/dist/index.d.mts +5 -1
  116. package/dist/index.d.ts +5 -1
  117. package/dist/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -1
  118. package/dist/lib/stack-app/apps/implementations/client-app-impl.js +79 -0
  119. package/dist/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
  120. package/dist/lib/stack-app/apps/implementations/common.js +1 -1
  121. package/dist/lib/stack-app/apps/implementations/common.js.map +1 -1
  122. package/dist/lib/stack-app/apps/interfaces/client-app.js.map +1 -1
  123. package/dist/lib/stack-app/projects/index.js.map +1 -1
  124. package/dist/lib/translations.js +0 -1
  125. package/dist/lib/translations.js.map +1 -1
  126. package/package.json +4 -4
@@ -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,QA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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-display-name-section.tsx
21
+ var team_display_name_section_exports = {};
22
+ __export(team_display_name_section_exports, {
23
+ TeamDisplayNameSection: () => TeamDisplayNameSection
24
+ });
25
+ module.exports = __toCommonJS(team_display_name_section_exports);
26
+ var import_hooks = require("../../../lib/hooks");
27
+ var import_translations = require("../../../lib/translations");
28
+ var import_editable_text = require("../editable-text");
29
+ var import_section = require("../section");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ function TeamDisplayNameSection(props) {
32
+ const { t } = (0, import_translations.useTranslation)();
33
+ const user = (0, import_hooks.useUser)({ or: "redirect" });
34
+ const updateTeamPermission = user.usePermission(props.team, "$update_team");
35
+ if (!updateTeamPermission) {
36
+ return null;
37
+ }
38
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
39
+ import_section.Section,
40
+ {
41
+ title: t("Team display name"),
42
+ description: t("Change the display name of your team"),
43
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
44
+ import_editable_text.EditableText,
45
+ {
46
+ value: props.team.displayName,
47
+ onSave: async (newDisplayName) => await props.team.update({ displayName: newDisplayName })
48
+ }
49
+ )
50
+ }
51
+ );
52
+ }
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ TeamDisplayNameSection
56
+ });
57
+ //# sourceMappingURL=team-display-name-section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-display-name-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Team } from \"../../..\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { EditableText } from \"../editable-text\";\nimport { Section } from \"../section\";\n\nexport function TeamDisplayNameSection(props: { team: Team }) {\n const { t } = useTranslation();\n const user = useUser({ or: 'redirect' });\n const updateTeamPermission = user.usePermission(props.team, '$update_team');\n\n if (!updateTeamPermission) {\n return null;\n }\n\n return (\n <Section\n title={t(\"Team display name\")}\n description={t(\"Change the display name of your team\")}\n >\n <EditableText\n value={props.team.displayName}\n onSave={async (newDisplayName) => await props.team.update({ displayName: newDisplayName })}\n />\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,mBAAwB;AACxB,0BAA+B;AAC/B,2BAA6B;AAC7B,qBAAwB;AAgBlB;AAdC,SAAS,uBAAuB,OAAuB;AAC5D,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,uBAAuB,KAAK,cAAc,MAAM,MAAM,cAAc;AAE1E,MAAI,CAAC,sBAAsB;AACzB,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,mBAAmB;AAAA,MAC5B,aAAa,EAAE,sCAAsC;AAAA,MAErD;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,MAAM,KAAK;AAAA,UAClB,QAAQ,OAAO,mBAAmB,MAAM,MAAM,KAAK,OAAO,EAAE,aAAa,eAAe,CAAC;AAAA;AAAA,MAC3F;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,131 @@
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-member-invitation-section.tsx
21
+ var team_member_invitation_section_exports = {};
22
+ __export(team_member_invitation_section_exports, {
23
+ TeamMemberInvitationSection: () => TeamMemberInvitationSection
24
+ });
25
+ module.exports = __toCommonJS(team_member_invitation_section_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_lucide_react = require("lucide-react");
31
+ var import_react = require("react");
32
+ var import_react_hook_form = require("react-hook-form");
33
+ var import_form_warning = require("../../../components/elements/form-warning");
34
+ var import_hooks = require("../../../lib/hooks");
35
+ var import_translations = require("../../../lib/translations");
36
+ var import_section = require("../section");
37
+ var import_jsx_runtime = require("react/jsx-runtime");
38
+ function TeamMemberInvitationSection(props) {
39
+ const user = (0, import_hooks.useUser)({ or: "redirect" });
40
+ const inviteMemberPermission = user.usePermission(props.team, "$invite_members");
41
+ if (!inviteMemberPermission) {
42
+ return null;
43
+ }
44
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemberInvitationSectionInner, { team: props.team });
45
+ }
46
+ function MemberInvitationsSectionInvitationsList(props) {
47
+ const user = (0, import_hooks.useUser)({ or: "redirect" });
48
+ const { t } = (0, import_translations.useTranslation)();
49
+ const invitationsToShow = props.team.useInvitations();
50
+ const removeMemberPermission = user.usePermission(props.team, "$remove_members");
51
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Table, { className: "mt-6", children: [
52
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableRow, { children: [
53
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[200px]", children: t("Outstanding invitations") }),
54
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[60px]", children: t("Expires") }),
55
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[36px] max-w-[36px]" })
56
+ ] }) }),
57
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableBody, { children: [
58
+ invitationsToShow.map((invitation, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableRow, { children: [
59
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: invitation.recipientEmail }) }),
60
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", children: invitation.expiresAt.toLocaleString() }) }),
61
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { align: "right", className: "max-w-[36px]", children: removeMemberPermission && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { onClick: async () => await invitation.revoke(), size: "icon", variant: "ghost", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Trash, { className: "w-4 h-4" }) }) })
62
+ ] }, invitation.id)),
63
+ invitationsToShow.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { colSpan: 3, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { variant: "secondary", children: t("No outstanding invitations") }) }) })
64
+ ] })
65
+ ] }) });
66
+ }
67
+ function MemberInvitationSectionInner(props) {
68
+ const user = (0, import_hooks.useUser)({ or: "redirect" });
69
+ const { t } = (0, import_translations.useTranslation)();
70
+ const readMemberPermission = user.usePermission(props.team, "$read_members");
71
+ const invitationSchema = (0, import_schema_fields.yupObject)({
72
+ email: (0, import_schema_fields.strictEmailSchema)(t("Please enter a valid email address")).defined().nonEmpty(t("Please enter an email address"))
73
+ });
74
+ const { register, handleSubmit, formState: { errors }, watch } = (0, import_react_hook_form.useForm)({
75
+ resolver: (0, import_yup.yupResolver)(invitationSchema)
76
+ });
77
+ const [loading, setLoading] = (0, import_react.useState)(false);
78
+ const [invitedEmail, setInvitedEmail] = (0, import_react.useState)(null);
79
+ const onSubmit = async (data) => {
80
+ setLoading(true);
81
+ try {
82
+ await props.team.inviteUser({ email: data.email });
83
+ setInvitedEmail(data.email);
84
+ } finally {
85
+ setLoading(false);
86
+ }
87
+ };
88
+ (0, import_react.useEffect)(() => {
89
+ setInvitedEmail(null);
90
+ }, [watch("email")]);
91
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
92
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
93
+ import_section.Section,
94
+ {
95
+ title: t("Invite member"),
96
+ description: t("Invite a user to your team through email"),
97
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
98
+ "form",
99
+ {
100
+ onSubmit: (e) => (0, import_promises.runAsynchronouslyWithAlert)(handleSubmit(onSubmit)(e)),
101
+ noValidate: true,
102
+ className: "w-full",
103
+ children: [
104
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-4 sm:flex-row w-full", children: [
105
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
106
+ import_stack_ui.Input,
107
+ {
108
+ placeholder: t("Email"),
109
+ ...register("email")
110
+ }
111
+ ),
112
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Button, { type: "submit", loading, children: t("Invite User") })
113
+ ] }),
114
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form_warning.FormWarningText, { text: errors.email?.message?.toString() }),
115
+ invitedEmail && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Typography, { type: "label", variant: "secondary", children: [
116
+ "Invited ",
117
+ invitedEmail
118
+ ] })
119
+ ]
120
+ }
121
+ )
122
+ }
123
+ ),
124
+ readMemberPermission && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemberInvitationsSectionInvitationsList, { team: props.team })
125
+ ] });
126
+ }
127
+ // Annotate the CommonJS export names for ESM import in node:
128
+ 0 && (module.exports = {
129
+ TeamMemberInvitationSection
130
+ });
131
+ //# sourceMappingURL=team-member-invitation-section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-member-invitation-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { yupResolver } from \"@hookform/resolvers/yup\";\nimport { strictEmailSchema, yupObject } from \"@stackframe/stack-shared/dist/schema-fields\";\nimport { runAsynchronouslyWithAlert } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { Button, Input, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Typography } from \"@stackframe/stack-ui\";\nimport { Trash } from \"lucide-react\";\nimport { useEffect, useState } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport * as yup from \"yup\";\nimport { Team } from \"../../..\";\nimport { FormWarningText } from \"../../../components/elements/form-warning\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { Section } from \"../section\";\n\nexport function TeamMemberInvitationSection(props: { team: Team }) {\n const user = useUser({ or: 'redirect' });\n const inviteMemberPermission = user.usePermission(props.team, '$invite_members');\n\n if (!inviteMemberPermission) {\n return null;\n }\n\n return <MemberInvitationSectionInner team={props.team} />;\n}\n\nfunction MemberInvitationsSectionInvitationsList(props: { team: Team }) {\n const user = useUser({ or: 'redirect' });\n const { t } = useTranslation();\n const invitationsToShow = props.team.useInvitations();\n const removeMemberPermission = user.usePermission(props.team, '$remove_members');\n\n return <>\n <Table className='mt-6'>\n <TableHeader>\n <TableRow>\n <TableHead className=\"w-[200px]\">{t(\"Outstanding invitations\")}</TableHead>\n <TableHead className=\"w-[60px]\">{t(\"Expires\")}</TableHead>\n <TableHead className=\"w-[36px] max-w-[36px]\"></TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n {invitationsToShow.map((invitation, i) => (\n <TableRow key={invitation.id}>\n <TableCell>\n <Typography>{invitation.recipientEmail}</Typography>\n </TableCell>\n <TableCell>\n <Typography variant='secondary'>{invitation.expiresAt.toLocaleString()}</Typography>\n </TableCell>\n <TableCell align='right' className='max-w-[36px]'>\n {removeMemberPermission && (\n <Button onClick={async () => await invitation.revoke()} size='icon' variant='ghost'>\n <Trash className=\"w-4 h-4\" />\n </Button>\n )}\n </TableCell>\n </TableRow>\n ))}\n {invitationsToShow.length === 0 && <TableRow>\n <TableCell colSpan={3}>\n <Typography variant='secondary'>{t(\"No outstanding invitations\")}</Typography>\n </TableCell>\n </TableRow>}\n </TableBody>\n </Table>\n </>;\n}\n\nfunction MemberInvitationSectionInner(props: { team: Team }) {\n const user = useUser({ or: 'redirect' });\n const { t } = useTranslation();\n const readMemberPermission = user.usePermission(props.team, '$read_members');\n\n const invitationSchema = yupObject({\n email: strictEmailSchema(t('Please enter a valid email address')).defined().nonEmpty(t('Please enter an email address')),\n });\n\n const { register, handleSubmit, formState: { errors }, watch } = useForm({\n resolver: yupResolver(invitationSchema)\n });\n const [loading, setLoading] = useState(false);\n const [invitedEmail, setInvitedEmail] = useState<string | null>(null);\n\n const onSubmit = async (data: yup.InferType<typeof invitationSchema>) => {\n setLoading(true);\n\n try {\n await props.team.inviteUser({ email: data.email });\n setInvitedEmail(data.email);\n } finally {\n setLoading(false);\n }\n };\n\n useEffect(() => {\n setInvitedEmail(null);\n }, [watch('email')]);\n\n return (\n <>\n <Section\n title={t(\"Invite member\")}\n description={t(\"Invite a user to your team through email\")}\n >\n <form\n onSubmit={e => runAsynchronouslyWithAlert(handleSubmit(onSubmit)(e))}\n noValidate\n className='w-full'\n >\n <div className=\"flex flex-col gap-4 sm:flex-row w-full\">\n <Input\n placeholder={t(\"Email\")}\n {...register(\"email\")}\n />\n <Button type=\"submit\" loading={loading}>{t(\"Invite User\")}</Button>\n </div>\n <FormWarningText text={errors.email?.message?.toString()} />\n {invitedEmail && <Typography type='label' variant='secondary'>Invited {invitedEmail}</Typography>}\n </form>\n </Section>\n {readMemberPermission && <MemberInvitationsSectionInvitationsList team={props.team} />}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,iBAA4B;AAC5B,2BAA6C;AAC7C,sBAA2C;AAC3C,sBAAyG;AACzG,0BAAsB;AACtB,mBAAoC;AACpC,6BAAwB;AAGxB,0BAAgC;AAChC,mBAAwB;AACxB,0BAA+B;AAC/B,qBAAwB;AAUf;AARF,SAAS,4BAA4B,OAAuB;AACjE,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,yBAAyB,KAAK,cAAc,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,uCAAgB,MAAM,OAAO,OAAO,SAAS,SAAS,GAAG;AAAA,cACzD,gBAAgB,6CAAC,8BAAW,MAAK,SAAQ,SAAQ,aAAY;AAAA;AAAA,gBAAS;AAAA,iBAAa;AAAA;AAAA;AAAA,QACtF;AAAA;AAAA,IACF;AAAA,IACC,wBAAwB,4CAAC,2CAAwC,MAAM,MAAM,MAAM;AAAA,KACtF;AAEJ;","names":[]}
@@ -0,0 +1,61 @@
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-member-list-section.tsx
21
+ var team_member_list_section_exports = {};
22
+ __export(team_member_list_section_exports, {
23
+ TeamMemberListSection: () => TeamMemberListSection
24
+ });
25
+ module.exports = __toCommonJS(team_member_list_section_exports);
26
+ var import_stack_ui = require("@stackframe/stack-ui");
27
+ var import_user_avatar = require("../../../components/elements/user-avatar");
28
+ var import_hooks = require("../../../lib/hooks");
29
+ var import_translations = require("../../../lib/translations");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ function TeamMemberListSection(props) {
32
+ const user = (0, import_hooks.useUser)({ or: "redirect" });
33
+ const readMemberPermission = user.usePermission(props.team, "$read_members");
34
+ const inviteMemberPermission = user.usePermission(props.team, "$invite_members");
35
+ if (!readMemberPermission && !inviteMemberPermission) {
36
+ return null;
37
+ }
38
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemberListSectionInner, { team: props.team });
39
+ }
40
+ function MemberListSectionInner(props) {
41
+ const { t } = (0, import_translations.useTranslation)();
42
+ const users = props.team.useUsers();
43
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
44
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { className: "font-medium mb-2", children: t("Members") }),
45
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border rounded-md", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.Table, { children: [
46
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableRow, { children: [
47
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[100px]", children: t("User") }),
48
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableHead, { className: "w-[200px]", children: t("Name") })
49
+ ] }) }),
50
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableBody, { children: users.map(({ id, teamProfile }, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stack_ui.TableRow, { children: [
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_user_avatar.UserAvatar, { user: teamProfile }) }),
52
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stack_ui.Typography, { children: teamProfile.displayName }) })
53
+ ] }, id)) })
54
+ ] }) })
55
+ ] });
56
+ }
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ TeamMemberListSection
60
+ });
61
+ //# sourceMappingURL=team-member-list-section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-member-list-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Typography } from \"@stackframe/stack-ui\";\nimport { Team } from \"../../..\";\nimport { UserAvatar } from \"../../../components/elements/user-avatar\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\n\nexport function TeamMemberListSection(props: { team: Team }) {\n const user = useUser({ or: 'redirect' });\n const readMemberPermission = user.usePermission(props.team, '$read_members');\n const inviteMemberPermission = user.usePermission(props.team, '$invite_members');\n\n if (!readMemberPermission && !inviteMemberPermission) {\n return null;\n }\n\n return <MemberListSectionInner team={props.team} />;\n}\n\nfunction MemberListSectionInner(props: { team: Team }) {\n const { t } = useTranslation();\n const users = props.team.useUsers();\n\n return (\n <div>\n <Typography className='font-medium mb-2'>{t(\"Members\")}</Typography>\n <div className='border rounded-md'>\n <Table>\n <TableHeader>\n <TableRow>\n <TableHead className=\"w-[100px]\">{t(\"User\")}</TableHead>\n <TableHead className=\"w-[200px]\">{t(\"Name\")}</TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n {users.map(({ id, teamProfile }, i) => (\n <TableRow key={id}>\n <TableCell>\n <UserAvatar user={teamProfile} />\n </TableCell>\n <TableCell>\n <Typography>{teamProfile.displayName}</Typography>\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAA0F;AAE1F,yBAA2B;AAC3B,mBAAwB;AACxB,0BAA+B;AAWtB;AATF,SAAS,sBAAsB,OAAuB;AAC3D,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,uBAAuB,KAAK,cAAc,MAAM,MAAM,eAAe;AAC3E,QAAM,yBAAyB,KAAK,cAAc,MAAM,MAAM,iBAAiB;AAE/E,MAAI,CAAC,wBAAwB,CAAC,wBAAwB;AACpD,WAAO;AAAA,EACT;AAEA,SAAO,4CAAC,0BAAuB,MAAM,MAAM,MAAM;AACnD;AAEA,SAAS,uBAAuB,OAAuB;AACrD,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,QAAQ,MAAM,KAAK,SAAS;AAElC,SACE,6CAAC,SACC;AAAA,gDAAC,8BAAW,WAAU,oBAAoB,YAAE,SAAS,GAAE;AAAA,IACvD,4CAAC,SAAI,WAAU,qBACb,uDAAC,yBACC;AAAA,kDAAC,+BACC,uDAAC,4BACC;AAAA,oDAAC,6BAAU,WAAU,aAAa,YAAE,MAAM,GAAE;AAAA,QAC5C,4CAAC,6BAAU,WAAU,aAAa,YAAE,MAAM,GAAE;AAAA,SAC9C,GACF;AAAA,MACA,4CAAC,6BACE,gBAAM,IAAI,CAAC,EAAE,IAAI,YAAY,GAAG,MAC/B,6CAAC,4BACC;AAAA,oDAAC,6BACC,sDAAC,iCAAW,MAAM,aAAa,GACjC;AAAA,QACA,4CAAC,6BACC,sDAAC,8BAAY,sBAAY,aAAY,GACvC;AAAA,WANa,EAOf,CACD,GACH;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,50 @@
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-page.tsx
21
+ var team_page_exports = {};
22
+ __export(team_page_exports, {
23
+ TeamPage: () => TeamPage
24
+ });
25
+ module.exports = __toCommonJS(team_page_exports);
26
+ var import_page_layout = require("../page-layout");
27
+ var import_leave_team_section = require("./leave-team-section");
28
+ var import_team_api_keys_section = require("./team-api-keys-section");
29
+ var import_team_display_name_section = require("./team-display-name-section");
30
+ var import_team_member_invitation_section = require("./team-member-invitation-section");
31
+ var import_team_member_list_section = require("./team-member-list-section");
32
+ var import_team_profile_image_section = require("./team-profile-image-section");
33
+ var import_team_profile_user_section = require("./team-profile-user-section");
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ function TeamPage(props) {
36
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_page_layout.PageLayout, { children: [
37
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_profile_user_section.TeamUserProfileSection, { team: props.team }, `user-profile-${props.team.id}`),
38
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_profile_image_section.TeamProfileImageSection, { team: props.team }, `profile-image-${props.team.id}`),
39
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_display_name_section.TeamDisplayNameSection, { team: props.team }, `display-name-${props.team.id}`),
40
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_member_list_section.TeamMemberListSection, { team: props.team }, `member-list-${props.team.id}`),
41
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_member_invitation_section.TeamMemberInvitationSection, { team: props.team }, `member-invitation-${props.team.id}`),
42
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_team_api_keys_section.TeamApiKeysSection, { team: props.team }, `api-keys-${props.team.id}`),
43
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_leave_team_section.LeaveTeamSection, { team: props.team }, `leave-team-${props.team.id}`)
44
+ ] });
45
+ }
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ TeamPage
49
+ });
50
+ //# sourceMappingURL=team-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-page.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Team } from \"../../..\";\nimport { PageLayout } from \"../page-layout\";\nimport { LeaveTeamSection } from \"./leave-team-section\";\nimport { TeamApiKeysSection } from \"./team-api-keys-section\";\nimport { TeamDisplayNameSection } from \"./team-display-name-section\";\nimport { TeamMemberInvitationSection } from \"./team-member-invitation-section\";\nimport { TeamMemberListSection } from \"./team-member-list-section\";\nimport { TeamProfileImageSection } from \"./team-profile-image-section\";\nimport { TeamUserProfileSection } from \"./team-profile-user-section\";\n\n\nexport function TeamPage(props: { team: Team }) {\n return (\n <PageLayout>\n <TeamUserProfileSection key={`user-profile-${props.team.id}`} team={props.team} />\n <TeamProfileImageSection key={`profile-image-${props.team.id}`} team={props.team} />\n <TeamDisplayNameSection key={`display-name-${props.team.id}`} team={props.team} />\n <TeamMemberListSection key={`member-list-${props.team.id}`} team={props.team} />\n <TeamMemberInvitationSection key={`member-invitation-${props.team.id}`} team={props.team} />\n <TeamApiKeysSection key={`api-keys-${props.team.id}`} team={props.team} />\n <LeaveTeamSection key={`leave-team-${props.team.id}`} team={props.team} />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,yBAA2B;AAC3B,gCAAiC;AACjC,mCAAmC;AACnC,uCAAuC;AACvC,4CAA4C;AAC5C,sCAAsC;AACtC,wCAAwC;AACxC,uCAAuC;AAKnC;AAFG,SAAS,SAAS,OAAuB;AAC9C,SACE,6CAAC,iCACC;AAAA,gDAAC,2DAA6D,MAAM,MAAM,QAA7C,gBAAgB,MAAM,KAAK,EAAE,EAAsB;AAAA,IAChF,4CAAC,6DAA+D,MAAM,MAAM,QAA9C,iBAAiB,MAAM,KAAK,EAAE,EAAsB;AAAA,IAClF,4CAAC,2DAA6D,MAAM,MAAM,QAA7C,gBAAgB,MAAM,KAAK,EAAE,EAAsB;AAAA,IAChF,4CAAC,yDAA2D,MAAM,MAAM,QAA5C,eAAe,MAAM,KAAK,EAAE,EAAsB;AAAA,IAC9E,4CAAC,qEAAuE,MAAM,MAAM,QAAlD,qBAAqB,MAAM,KAAK,EAAE,EAAsB;AAAA,IAC1F,4CAAC,mDAAqD,MAAM,MAAM,QAAzC,YAAY,MAAM,KAAK,EAAE,EAAsB;AAAA,IACxE,4CAAC,8CAAqD,MAAM,MAAM,QAA3C,cAAc,MAAM,KAAK,EAAE,EAAsB;AAAA,KAC1E;AAEJ;","names":[]}
@@ -0,0 +1,59 @@
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-profile-image-section.tsx
21
+ var team_profile_image_section_exports = {};
22
+ __export(team_profile_image_section_exports, {
23
+ TeamProfileImageSection: () => TeamProfileImageSection
24
+ });
25
+ module.exports = __toCommonJS(team_profile_image_section_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_section = require("../section");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ function TeamProfileImageSection(props) {
32
+ const { t } = (0, import_translations.useTranslation)();
33
+ const user = (0, import_hooks.useUser)({ or: "redirect" });
34
+ const updateTeamPermission = user.usePermission(props.team, "$update_team");
35
+ if (!updateTeamPermission) {
36
+ return null;
37
+ }
38
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
39
+ import_section.Section,
40
+ {
41
+ title: t("Team profile image"),
42
+ description: t("Upload an image for your team"),
43
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
44
+ import_profile_image_editor.ProfileImageEditor,
45
+ {
46
+ user: props.team,
47
+ onProfileImageUrlChange: async (profileImageUrl) => {
48
+ await props.team.update({ profileImageUrl });
49
+ }
50
+ }
51
+ )
52
+ }
53
+ );
54
+ }
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ TeamProfileImageSection
58
+ });
59
+ //# sourceMappingURL=team-profile-image-section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-profile-image-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Team } from \"../../..\";\nimport { ProfileImageEditor } from \"../../../components/profile-image-editor\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { Section } from \"../section\";\n\nexport function TeamProfileImageSection(props: { team: Team }) {\n const { t } = useTranslation();\n const user = useUser({ or: 'redirect' });\n const updateTeamPermission = user.usePermission(props.team, '$update_team');\n\n if (!updateTeamPermission) {\n return null;\n }\n\n return (\n <Section\n title={t(\"Team profile image\")}\n description={t(\"Upload an image for your team\")}\n >\n <ProfileImageEditor\n user={props.team}\n onProfileImageUrlChange={async (profileImageUrl) => {\n await props.team.update({ profileImageUrl });\n }}\n />\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,kCAAmC;AACnC,mBAAwB;AACxB,0BAA+B;AAC/B,qBAAwB;AAgBlB;AAdC,SAAS,wBAAwB,OAAuB;AAC7D,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,uBAAuB,KAAK,cAAc,MAAM,MAAM,cAAc;AAE1E,MAAI,CAAC,sBAAsB;AACzB,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,oBAAoB;AAAA,MAC7B,aAAa,EAAE,+BAA+B;AAAA,MAE9C;AAAA,QAAC;AAAA;AAAA,UACC,MAAM,MAAM;AAAA,UACZ,yBAAyB,OAAO,oBAAoB;AAClD,kBAAM,MAAM,KAAK,OAAO,EAAE,gBAAgB,CAAC;AAAA,UAC7C;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,56 @@
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-profile-user-section.tsx
21
+ var team_profile_user_section_exports = {};
22
+ __export(team_profile_user_section_exports, {
23
+ TeamUserProfileSection: () => TeamUserProfileSection
24
+ });
25
+ module.exports = __toCommonJS(team_profile_user_section_exports);
26
+ var import_hooks = require("../../../lib/hooks");
27
+ var import_translations = require("../../../lib/translations");
28
+ var import_editable_text = require("../editable-text");
29
+ var import_section = require("../section");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ function TeamUserProfileSection(props) {
32
+ const { t } = (0, import_translations.useTranslation)();
33
+ const user = (0, import_hooks.useUser)({ or: "redirect" });
34
+ const profile = user.useTeamProfile(props.team);
35
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
36
+ import_section.Section,
37
+ {
38
+ title: t("Team user name"),
39
+ description: t("Overwrite your user display name in this team"),
40
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
41
+ import_editable_text.EditableText,
42
+ {
43
+ value: profile.displayName || "",
44
+ onSave: async (newDisplayName) => {
45
+ await profile.update({ displayName: newDisplayName });
46
+ }
47
+ }
48
+ )
49
+ }
50
+ );
51
+ }
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ TeamUserProfileSection
55
+ });
56
+ //# sourceMappingURL=team-profile-user-section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components-page/account-settings/teams/team-profile-user-section.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { Team } from \"../../..\";\nimport { useUser } from \"../../../lib/hooks\";\nimport { useTranslation } from \"../../../lib/translations\";\nimport { EditableText } from \"../editable-text\";\nimport { Section } from \"../section\";\n\nexport function TeamUserProfileSection(props: { team: Team }) {\n const { t } = useTranslation();\n const user = useUser({ or: 'redirect' });\n const profile = user.useTeamProfile(props.team);\n\n return (\n <Section\n title={t(\"Team user name\")}\n description={t(\"Overwrite your user display name in this team\")}\n >\n <EditableText\n value={profile.displayName || ''}\n onSave={async (newDisplayName) => {\n await profile.update({ displayName: newDisplayName });\n }}\n />\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,mBAAwB;AACxB,0BAA+B;AAC/B,2BAA6B;AAC7B,qBAAwB;AAYlB;AAVC,SAAS,uBAAuB,OAAuB;AAC5D,QAAM,EAAE,EAAE,QAAI,oCAAe;AAC7B,QAAM,WAAO,sBAAQ,EAAE,IAAI,WAAW,CAAC;AACvC,QAAM,UAAU,KAAK,eAAe,MAAM,IAAI;AAE9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,gBAAgB;AAAA,MACzB,aAAa,EAAE,+CAA+C;AAAA,MAE9D;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,QAAQ,eAAe;AAAA,UAC9B,QAAQ,OAAO,mBAAmB;AAChC,kBAAM,QAAQ,OAAO,EAAE,aAAa,eAAe,CAAC;AAAA,UACtD;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;","names":[]}