@authowl/react 0.24.4 → 0.25.1
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.
- package/README.md +10 -1
- package/dist/{OrganizationListContent-BSGDHYAC.js → OrganizationListContent-HMRK4ZSI.js} +3 -3
- package/dist/{OrganizationProfileContent-HJT33DMJ.js → OrganizationProfileContent-7RM6OMLU.js} +3 -3
- package/dist/{OrganizationSwitcherContent-2TJ76HZM.js → OrganizationSwitcherContent-6G6ASVYZ.js} +2 -2
- package/dist/{PrivacyCenterContent-EQEXXSLA.js → PrivacyCenterContent-C4ON7H74.js} +3 -1
- package/dist/{TeamsSection-VJTKS4KP.js → TeamsSection-MXSBSO44.js} +1 -1
- package/dist/{chunk-SAVEQ6RC.js → chunk-KUNSGUZP.js} +4 -2
- package/dist/{chunk-2HNQYORD.js → chunk-R6WM64IM.js} +2 -2
- package/dist/{chunk-7WIBXVGK.js → chunk-TTBODVRM.js} +1 -1
- package/dist/index.cjs +922 -752
- package/dist/index.d.cts +174 -12
- package/dist/index.d.ts +174 -12
- package/dist/index.js +516 -349
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -911,13 +911,15 @@ function useSubmitAction() {
|
|
|
911
911
|
const [error, setError] = React7.useState(null);
|
|
912
912
|
const toMessage = useServerError();
|
|
913
913
|
const run = React7.useCallback(
|
|
914
|
-
async (action, { failure, onSuccess, mapError, keepPendingOnSuccess }) => {
|
|
914
|
+
async (action, { failure, onSuccess, mapError, intercept, keepPendingOnSuccess }) => {
|
|
915
915
|
setError(null);
|
|
916
916
|
setPending(true);
|
|
917
917
|
try {
|
|
918
918
|
const res = await action();
|
|
919
919
|
if (res?.error) {
|
|
920
|
-
|
|
920
|
+
if (!intercept?.(res.error)) {
|
|
921
|
+
setError(mapError?.(res.error) ?? toMessage(res.error, failure));
|
|
922
|
+
}
|
|
921
923
|
setPending(false);
|
|
922
924
|
return;
|
|
923
925
|
}
|
|
@@ -2819,13 +2821,13 @@ function PrivacyCenterContent({ className } = {}) {
|
|
|
2819
2821
|
const client = useAuthClient();
|
|
2820
2822
|
const { config } = usePublicConfig();
|
|
2821
2823
|
const { isLoaded, isSignedIn, user } = useUser();
|
|
2822
|
-
const [preferences, setPreferences] =
|
|
2823
|
-
const [requests, setRequests] =
|
|
2824
|
-
const [loading, setLoading] =
|
|
2825
|
-
const [error, setError] =
|
|
2826
|
-
const [pendingPurpose, setPendingPurpose] =
|
|
2827
|
-
const [pendingRight, setPendingRight] =
|
|
2828
|
-
const refresh =
|
|
2824
|
+
const [preferences, setPreferences] = React46.useState([]);
|
|
2825
|
+
const [requests, setRequests] = React46.useState([]);
|
|
2826
|
+
const [loading, setLoading] = React46.useState(true);
|
|
2827
|
+
const [error, setError] = React46.useState(null);
|
|
2828
|
+
const [pendingPurpose, setPendingPurpose] = React46.useState(null);
|
|
2829
|
+
const [pendingRight, setPendingRight] = React46.useState(null);
|
|
2830
|
+
const refresh = React46.useCallback(async () => {
|
|
2829
2831
|
if (!isSignedIn) return;
|
|
2830
2832
|
setLoading(true);
|
|
2831
2833
|
setError(null);
|
|
@@ -2837,19 +2839,20 @@ function PrivacyCenterContent({ className } = {}) {
|
|
|
2837
2839
|
}
|
|
2838
2840
|
setLoading(false);
|
|
2839
2841
|
}, [client, isSignedIn, t, toServerError]);
|
|
2840
|
-
|
|
2842
|
+
React46.useEffect(() => {
|
|
2841
2843
|
if (isLoaded && isSignedIn) void refresh();
|
|
2842
2844
|
else if (isLoaded) setLoading(false);
|
|
2843
2845
|
}, [isLoaded, isSignedIn, refresh, user?.id]);
|
|
2844
2846
|
if (!isLoaded || loading) {
|
|
2845
|
-
return /* @__PURE__ */ (0,
|
|
2846
|
-
/* @__PURE__ */ (0,
|
|
2847
|
-
/* @__PURE__ */ (0,
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
2847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("section", { className: classes("ba-profile-section ba-privacy-center", className), "aria-busy": "true", children: [
|
|
2848
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "ba-skeleton" }),
|
|
2849
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "ba-skeleton" }),
|
|
2850
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "ba-skeleton" })
|
|
2849
2851
|
] });
|
|
2850
2852
|
}
|
|
2851
|
-
if (!isSignedIn) return /* @__PURE__ */ (0,
|
|
2853
|
+
if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "ba-muted", children: t("privacy.signedOut") });
|
|
2852
2854
|
const privacy = config?.privacy;
|
|
2855
|
+
const offeredRights = (0, import_core10.offeredRightTypes)(privacy?.availableRightTypes);
|
|
2853
2856
|
const preferenceByCode = new Map(preferences.map((item) => [item.code, item]));
|
|
2854
2857
|
async function updateConsent(purposeCode, granted) {
|
|
2855
2858
|
const purpose = privacy?.consentPurposes.find((item) => item.code === purposeCode);
|
|
@@ -2879,27 +2882,27 @@ function PrivacyCenterContent({ className } = {}) {
|
|
|
2879
2882
|
else await refresh();
|
|
2880
2883
|
setPendingRight(null);
|
|
2881
2884
|
}
|
|
2882
|
-
return /* @__PURE__ */ (0,
|
|
2883
|
-
/* @__PURE__ */ (0,
|
|
2884
|
-
/* @__PURE__ */ (0,
|
|
2885
|
-
/* @__PURE__ */ (0,
|
|
2886
|
-
/* @__PURE__ */ (0,
|
|
2885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("section", { className: classes("ba-profile-section ba-privacy-center", className), "aria-labelledby": "ba-privacy-title", children: [
|
|
2886
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("header", { className: "ba-profile-section-header ba-privacy-center-header", children: [
|
|
2887
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "ba-eyebrow", children: t("privacy.dataUse") }),
|
|
2888
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h2", { className: "ba-title", id: "ba-privacy-title", children: t("privacy.title") }),
|
|
2889
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "ba-muted", children: t("privacy.description") })
|
|
2887
2890
|
] }),
|
|
2888
|
-
/* @__PURE__ */ (0,
|
|
2889
|
-
/* @__PURE__ */ (0,
|
|
2890
|
-
/* @__PURE__ */ (0,
|
|
2891
|
-
/* @__PURE__ */ (0,
|
|
2892
|
-
/* @__PURE__ */ (0,
|
|
2891
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FormError, { children: error }),
|
|
2892
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "ba-privacy-center-block", children: [
|
|
2893
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "ba-privacy-center-block-heading", children: [
|
|
2894
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h3", { children: t("privacy.choices.title") }),
|
|
2895
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { children: t("privacy.choices.description") })
|
|
2893
2896
|
] }),
|
|
2894
|
-
(privacy?.consentPurposes.length ?? 0) === 0 ? /* @__PURE__ */ (0,
|
|
2897
|
+
(privacy?.consentPurposes.length ?? 0) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "ba-privacy-empty", children: t("privacy.choices.empty") }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "ba-privacy-center-choices", children: privacy.consentPurposes.map((purpose) => {
|
|
2895
2898
|
const granted = preferenceByCode.get(purpose.code)?.state === "granted";
|
|
2896
2899
|
const pending = pendingPurpose === purpose.code;
|
|
2897
|
-
return /* @__PURE__ */ (0,
|
|
2898
|
-
/* @__PURE__ */ (0,
|
|
2899
|
-
/* @__PURE__ */ (0,
|
|
2900
|
-
/* @__PURE__ */ (0,
|
|
2900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "ba-privacy-center-choice", children: [
|
|
2901
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { children: [
|
|
2902
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("strong", { children: purpose.title[locale] }),
|
|
2903
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("small", { children: purpose.description[locale] })
|
|
2901
2904
|
] }),
|
|
2902
|
-
/* @__PURE__ */ (0,
|
|
2905
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
2903
2906
|
"button",
|
|
2904
2907
|
{
|
|
2905
2908
|
type: "button",
|
|
@@ -2910,52 +2913,52 @@ function PrivacyCenterContent({ className } = {}) {
|
|
|
2910
2913
|
disabled: pending,
|
|
2911
2914
|
onClick: () => void updateConsent(purpose.code, !granted),
|
|
2912
2915
|
children: [
|
|
2913
|
-
/* @__PURE__ */ (0,
|
|
2914
|
-
/* @__PURE__ */ (0,
|
|
2916
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { "aria-hidden": "true" }),
|
|
2917
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("b", { children: pending ? t("common.working") : granted ? t("privacy.on") : t("privacy.off") })
|
|
2915
2918
|
]
|
|
2916
2919
|
}
|
|
2917
2920
|
)
|
|
2918
2921
|
] }, purpose.purposeVersionId);
|
|
2919
2922
|
}) })
|
|
2920
2923
|
] }),
|
|
2921
|
-
/* @__PURE__ */ (0,
|
|
2922
|
-
/* @__PURE__ */ (0,
|
|
2923
|
-
/* @__PURE__ */ (0,
|
|
2924
|
-
/* @__PURE__ */ (0,
|
|
2924
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "ba-privacy-center-block", children: [
|
|
2925
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "ba-privacy-center-block-heading", children: [
|
|
2926
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h3", { children: t("privacy.rights.title") }),
|
|
2927
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { children: t("privacy.rights.description") })
|
|
2925
2928
|
] }),
|
|
2926
|
-
/* @__PURE__ */ (0,
|
|
2929
|
+
offeredRights.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "ba-privacy-empty", children: t("privacy.rights.unavailable") }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "ba-privacy-right-grid", children: offeredRights.map((right) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2927
2930
|
"button",
|
|
2928
2931
|
{
|
|
2929
2932
|
type: "button",
|
|
2930
2933
|
className: right === "erasure" ? "ba-privacy-right ba-privacy-right-danger" : "ba-privacy-right",
|
|
2931
2934
|
disabled: pendingRight !== null,
|
|
2932
2935
|
onClick: () => void createRequest(right),
|
|
2933
|
-
children: /* @__PURE__ */ (0,
|
|
2936
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Busy, { busy: pendingRight === right, label: t("common.working"), children: t(RIGHT_KEYS[right]) })
|
|
2934
2937
|
},
|
|
2935
2938
|
right
|
|
2936
2939
|
)) })
|
|
2937
2940
|
] }),
|
|
2938
|
-
/* @__PURE__ */ (0,
|
|
2939
|
-
/* @__PURE__ */ (0,
|
|
2940
|
-
/* @__PURE__ */ (0,
|
|
2941
|
-
/* @__PURE__ */ (0,
|
|
2941
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "ba-privacy-center-block", children: [
|
|
2942
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "ba-privacy-center-block-heading", children: [
|
|
2943
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h3", { children: t("privacy.requests.title") }),
|
|
2944
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { children: t("privacy.requests.description") })
|
|
2942
2945
|
] }),
|
|
2943
|
-
requests.length === 0 ? /* @__PURE__ */ (0,
|
|
2944
|
-
/* @__PURE__ */ (0,
|
|
2945
|
-
/* @__PURE__ */ (0,
|
|
2946
|
-
/* @__PURE__ */ (0,
|
|
2946
|
+
requests.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "ba-privacy-empty", children: t("privacy.requests.empty") }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("ol", { className: "ba-privacy-request-list", children: requests.map((request) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("li", { children: [
|
|
2947
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { children: [
|
|
2948
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("strong", { children: t(RIGHT_KEYS[request.rightType]) }),
|
|
2949
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("small", { children: formatCairo(request.receivedAt, locale) })
|
|
2947
2950
|
] }),
|
|
2948
|
-
/* @__PURE__ */ (0,
|
|
2951
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("b", { "data-state": request.state, children: t(STATE_KEYS[request.state]) })
|
|
2949
2952
|
] }, request.id)) })
|
|
2950
2953
|
] }),
|
|
2951
|
-
(privacy?.notices.length ?? 0) > 0 && /* @__PURE__ */ (0,
|
|
2952
|
-
/* @__PURE__ */ (0,
|
|
2953
|
-
/* @__PURE__ */ (0,
|
|
2954
|
-
/* @__PURE__ */ (0,
|
|
2954
|
+
(privacy?.notices.length ?? 0) > 0 && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "ba-privacy-center-block", children: [
|
|
2955
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "ba-privacy-center-block-heading", children: [
|
|
2956
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h3", { children: t("privacy.notices.title") }),
|
|
2957
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { children: t("privacy.notices.description") })
|
|
2955
2958
|
] }),
|
|
2956
|
-
/* @__PURE__ */ (0,
|
|
2957
|
-
/* @__PURE__ */ (0,
|
|
2958
|
-
/* @__PURE__ */ (0,
|
|
2959
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "ba-privacy-notices", children: privacy.notices.map((notice) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("details", { className: "ba-privacy-notice", children: [
|
|
2960
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("summary", { children: notice.title[locale] }),
|
|
2961
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { children: notice.body[locale] })
|
|
2959
2962
|
] }, notice.noticeVersionId)) })
|
|
2960
2963
|
] })
|
|
2961
2964
|
] });
|
|
@@ -2980,17 +2983,18 @@ function formatCairo(date, locale) {
|
|
|
2980
2983
|
function classes(...values) {
|
|
2981
2984
|
return values.filter(Boolean).join(" ");
|
|
2982
2985
|
}
|
|
2983
|
-
var
|
|
2986
|
+
var React46, import_core10, import_jsx_runtime53, RIGHT_KEYS, STATE_KEYS;
|
|
2984
2987
|
var init_PrivacyCenterContent = __esm({
|
|
2985
2988
|
"src/components/PrivacyCenterContent.tsx"() {
|
|
2986
2989
|
"use strict";
|
|
2987
2990
|
"use client";
|
|
2988
|
-
|
|
2991
|
+
React46 = __toESM(require("react"), 1);
|
|
2992
|
+
import_core10 = require("@authowl/core");
|
|
2989
2993
|
init_hooks();
|
|
2990
2994
|
init_i18n();
|
|
2991
2995
|
init_Spinner();
|
|
2992
2996
|
init_FormError();
|
|
2993
|
-
|
|
2997
|
+
import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2994
2998
|
RIGHT_KEYS = {
|
|
2995
2999
|
access: "privacy.right.access",
|
|
2996
3000
|
correction: "privacy.right.correction",
|
|
@@ -3066,15 +3070,15 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
3066
3070
|
const { isLoaded, isSignedIn } = useUser();
|
|
3067
3071
|
const api = useAuthClient().organization;
|
|
3068
3072
|
const { pending, error, run } = useSubmitAction();
|
|
3069
|
-
const [name, setName] =
|
|
3070
|
-
const [slug, setSlug] =
|
|
3071
|
-
const [logo, setLogo] =
|
|
3072
|
-
const [slugTouched, setSlugTouched] =
|
|
3073
|
+
const [name, setName] = React50.useState("");
|
|
3074
|
+
const [slug, setSlug] = React50.useState("");
|
|
3075
|
+
const [logo, setLogo] = React50.useState("");
|
|
3076
|
+
const [slugTouched, setSlugTouched] = React50.useState(false);
|
|
3073
3077
|
if (configLoading || !isLoaded) {
|
|
3074
|
-
return /* @__PURE__ */ (0,
|
|
3078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
3075
3079
|
}
|
|
3076
3080
|
if (config?.organizations !== true) return null;
|
|
3077
|
-
if (!isSignedIn) return /* @__PURE__ */ (0,
|
|
3081
|
+
if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
3078
3082
|
const submit = (event) => {
|
|
3079
3083
|
event.preventDefault();
|
|
3080
3084
|
const normalizedName = name.trim();
|
|
@@ -3099,15 +3103,15 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
3099
3103
|
}
|
|
3100
3104
|
);
|
|
3101
3105
|
};
|
|
3102
|
-
return /* @__PURE__ */ (0,
|
|
3103
|
-
title !== null && /* @__PURE__ */ (0,
|
|
3104
|
-
/* @__PURE__ */ (0,
|
|
3105
|
-
/* @__PURE__ */ (0,
|
|
3106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("section", { className: "ba-organization-create", children: [
|
|
3107
|
+
title !== null && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
3108
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("h2", { className: "ba-title", children: title ?? t("organization.create.title") }),
|
|
3109
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "ba-muted", children: t("organization.create.description") })
|
|
3106
3110
|
] }),
|
|
3107
|
-
/* @__PURE__ */ (0,
|
|
3108
|
-
/* @__PURE__ */ (0,
|
|
3111
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3112
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("label", { className: "ba-label", children: [
|
|
3109
3113
|
t("organization.create.name"),
|
|
3110
|
-
/* @__PURE__ */ (0,
|
|
3114
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3111
3115
|
"input",
|
|
3112
3116
|
{
|
|
3113
3117
|
className: "ba-input",
|
|
@@ -3122,9 +3126,9 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
3122
3126
|
}
|
|
3123
3127
|
)
|
|
3124
3128
|
] }),
|
|
3125
|
-
/* @__PURE__ */ (0,
|
|
3129
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("label", { className: "ba-label", children: [
|
|
3126
3130
|
t("organization.create.slug"),
|
|
3127
|
-
/* @__PURE__ */ (0,
|
|
3131
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3128
3132
|
"input",
|
|
3129
3133
|
{
|
|
3130
3134
|
className: "ba-input",
|
|
@@ -3139,9 +3143,9 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
3139
3143
|
}
|
|
3140
3144
|
)
|
|
3141
3145
|
] }),
|
|
3142
|
-
/* @__PURE__ */ (0,
|
|
3146
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("label", { className: "ba-label", children: [
|
|
3143
3147
|
t("organization.create.logo"),
|
|
3144
|
-
/* @__PURE__ */ (0,
|
|
3148
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3145
3149
|
"input",
|
|
3146
3150
|
{
|
|
3147
3151
|
className: "ba-input",
|
|
@@ -3153,33 +3157,33 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
3153
3157
|
}
|
|
3154
3158
|
)
|
|
3155
3159
|
] }),
|
|
3156
|
-
/* @__PURE__ */ (0,
|
|
3157
|
-
/* @__PURE__ */ (0,
|
|
3160
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(FormError, { children: error }),
|
|
3161
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3158
3162
|
"button",
|
|
3159
3163
|
{
|
|
3160
3164
|
className: "ba-button ba-profile-submit",
|
|
3161
3165
|
type: "submit",
|
|
3162
3166
|
disabled: pending || !name.trim() || !slug.trim(),
|
|
3163
3167
|
"aria-busy": pending || void 0,
|
|
3164
|
-
children: /* @__PURE__ */ (0,
|
|
3168
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("organization.create.submit") })
|
|
3165
3169
|
}
|
|
3166
3170
|
)
|
|
3167
3171
|
] })
|
|
3168
3172
|
] });
|
|
3169
3173
|
}
|
|
3170
|
-
var
|
|
3174
|
+
var React50, import_jsx_runtime57;
|
|
3171
3175
|
var init_CreateOrganization = __esm({
|
|
3172
3176
|
"src/components/CreateOrganization.tsx"() {
|
|
3173
3177
|
"use strict";
|
|
3174
3178
|
"use client";
|
|
3175
|
-
|
|
3179
|
+
React50 = __toESM(require("react"), 1);
|
|
3176
3180
|
init_hooks();
|
|
3177
3181
|
init_i18n();
|
|
3178
3182
|
init_model();
|
|
3179
3183
|
init_use_submit_action();
|
|
3180
3184
|
init_Spinner();
|
|
3181
3185
|
init_FormError();
|
|
3182
|
-
|
|
3186
|
+
import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3183
3187
|
}
|
|
3184
3188
|
});
|
|
3185
3189
|
|
|
@@ -3191,8 +3195,8 @@ function OrganizationModal({
|
|
|
3191
3195
|
children
|
|
3192
3196
|
}) {
|
|
3193
3197
|
const t = useT();
|
|
3194
|
-
const titleId =
|
|
3195
|
-
return /* @__PURE__ */ (0,
|
|
3198
|
+
const titleId = React51.useId();
|
|
3199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
3196
3200
|
ModalSurface,
|
|
3197
3201
|
{
|
|
3198
3202
|
overlayClassName: "ba-organization-overlay",
|
|
@@ -3201,9 +3205,9 @@ function OrganizationModal({
|
|
|
3201
3205
|
returnFocusRef,
|
|
3202
3206
|
onClose,
|
|
3203
3207
|
children: [
|
|
3204
|
-
/* @__PURE__ */ (0,
|
|
3205
|
-
/* @__PURE__ */ (0,
|
|
3206
|
-
/* @__PURE__ */ (0,
|
|
3208
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ba-organization-modal-header", children: [
|
|
3209
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("h2", { id: titleId, className: "ba-title", children: title }),
|
|
3210
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3207
3211
|
"button",
|
|
3208
3212
|
{
|
|
3209
3213
|
className: "ba-profile-close",
|
|
@@ -3215,36 +3219,36 @@ function OrganizationModal({
|
|
|
3215
3219
|
}
|
|
3216
3220
|
)
|
|
3217
3221
|
] }),
|
|
3218
|
-
/* @__PURE__ */ (0,
|
|
3222
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "ba-organization-modal-body", children })
|
|
3219
3223
|
]
|
|
3220
3224
|
}
|
|
3221
3225
|
);
|
|
3222
3226
|
}
|
|
3223
|
-
var
|
|
3227
|
+
var React51, import_jsx_runtime58;
|
|
3224
3228
|
var init_OrganizationModal = __esm({
|
|
3225
3229
|
"src/components/organization/OrganizationModal.tsx"() {
|
|
3226
3230
|
"use strict";
|
|
3227
3231
|
"use client";
|
|
3228
|
-
|
|
3232
|
+
React51 = __toESM(require("react"), 1);
|
|
3229
3233
|
init_i18n();
|
|
3230
3234
|
init_ModalSurface();
|
|
3231
|
-
|
|
3235
|
+
import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3232
3236
|
}
|
|
3233
3237
|
});
|
|
3234
3238
|
|
|
3235
3239
|
// src/components/organization/use-organizations-resource.ts
|
|
3236
3240
|
function useOrganizationsResource(enabled = true) {
|
|
3237
3241
|
const api = useAuthClient().organization;
|
|
3238
|
-
const apiRef =
|
|
3242
|
+
const apiRef = React52.useRef(api);
|
|
3239
3243
|
apiRef.current = api;
|
|
3240
3244
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
3241
3245
|
const t = useT();
|
|
3242
3246
|
const toServerError = useServerError();
|
|
3243
|
-
const [organizations, setOrganizations] =
|
|
3244
|
-
const [error, setError] =
|
|
3245
|
-
const requestRef =
|
|
3247
|
+
const [organizations, setOrganizations] = React52.useState(null);
|
|
3248
|
+
const [error, setError] = React52.useState(null);
|
|
3249
|
+
const requestRef = React52.useRef(0);
|
|
3246
3250
|
const identity = user?.id ?? null;
|
|
3247
|
-
const refresh =
|
|
3251
|
+
const refresh = React52.useCallback(async () => {
|
|
3248
3252
|
const token = ++requestRef.current;
|
|
3249
3253
|
if (!enabled || !identity || !isSignedIn) {
|
|
3250
3254
|
setOrganizations([]);
|
|
@@ -3264,7 +3268,7 @@ function useOrganizationsResource(enabled = true) {
|
|
|
3264
3268
|
if (token === requestRef.current) setError(t("organization.error.load"));
|
|
3265
3269
|
}
|
|
3266
3270
|
}, [enabled, identity, isSignedIn, t, toServerError]);
|
|
3267
|
-
|
|
3271
|
+
React52.useEffect(() => {
|
|
3268
3272
|
setOrganizations(null);
|
|
3269
3273
|
setError(null);
|
|
3270
3274
|
if (!isLoaded) return;
|
|
@@ -3273,7 +3277,7 @@ function useOrganizationsResource(enabled = true) {
|
|
|
3273
3277
|
requestRef.current += 1;
|
|
3274
3278
|
};
|
|
3275
3279
|
}, [identity, isLoaded, refresh]);
|
|
3276
|
-
|
|
3280
|
+
React52.useEffect(
|
|
3277
3281
|
() => api.subscribe(() => void refresh()),
|
|
3278
3282
|
[api, refresh]
|
|
3279
3283
|
);
|
|
@@ -3284,12 +3288,12 @@ function useOrganizationsResource(enabled = true) {
|
|
|
3284
3288
|
refresh
|
|
3285
3289
|
};
|
|
3286
3290
|
}
|
|
3287
|
-
var
|
|
3291
|
+
var React52;
|
|
3288
3292
|
var init_use_organizations_resource = __esm({
|
|
3289
3293
|
"src/components/organization/use-organizations-resource.ts"() {
|
|
3290
3294
|
"use strict";
|
|
3291
3295
|
"use client";
|
|
3292
|
-
|
|
3296
|
+
React52 = __toESM(require("react"), 1);
|
|
3293
3297
|
init_hooks();
|
|
3294
3298
|
init_i18n();
|
|
3295
3299
|
}
|
|
@@ -3306,7 +3310,7 @@ function DangerSection({
|
|
|
3306
3310
|
const api = useAuthClient().organization;
|
|
3307
3311
|
const session = useSession();
|
|
3308
3312
|
const { pending, error, run } = useSubmitAction();
|
|
3309
|
-
const [confirmation, setConfirmation] =
|
|
3313
|
+
const [confirmation, setConfirmation] = React53.useState("");
|
|
3310
3314
|
const isOwner = hasOrganizationRole(membership, "owner");
|
|
3311
3315
|
const confirmed = confirmation.trim().toLowerCase() === organization.slug.toLowerCase();
|
|
3312
3316
|
const leave = () => {
|
|
@@ -3336,52 +3340,52 @@ function DangerSection({
|
|
|
3336
3340
|
}
|
|
3337
3341
|
);
|
|
3338
3342
|
};
|
|
3339
|
-
return /* @__PURE__ */ (0,
|
|
3340
|
-
/* @__PURE__ */ (0,
|
|
3341
|
-
/* @__PURE__ */ (0,
|
|
3342
|
-
/* @__PURE__ */ (0,
|
|
3343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("section", { className: "ba-organization-section ba-organization-danger", children: [
|
|
3344
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
3345
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h3", { className: "ba-title", children: t("organization.profile.danger.title") }),
|
|
3346
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "ba-muted", children: t("organization.profile.danger.description") })
|
|
3343
3347
|
] }),
|
|
3344
|
-
/* @__PURE__ */ (0,
|
|
3345
|
-
/* @__PURE__ */ (0,
|
|
3346
|
-
/* @__PURE__ */ (0,
|
|
3347
|
-
/* @__PURE__ */ (0,
|
|
3348
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ba-organization-danger-action", children: [
|
|
3349
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("strong", { children: t("organization.profile.danger.leaveTitle") }),
|
|
3350
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "ba-muted", children: isOwner ? t("organization.profile.danger.ownerLeaveHint") : t("organization.profile.danger.leaveHint") }),
|
|
3351
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: leave, children: t("organization.profile.danger.leave") })
|
|
3348
3352
|
] }),
|
|
3349
|
-
isOwner && /* @__PURE__ */ (0,
|
|
3350
|
-
/* @__PURE__ */ (0,
|
|
3351
|
-
/* @__PURE__ */ (0,
|
|
3352
|
-
/* @__PURE__ */ (0,
|
|
3353
|
+
isOwner && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("form", { method: "post", className: "ba-organization-danger-action ba-organization-delete", onSubmit: remove, children: [
|
|
3354
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("strong", { children: t("organization.profile.danger.deleteTitle") }),
|
|
3355
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "ba-muted", children: t("organization.profile.danger.deleteHint") }),
|
|
3356
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("label", { className: "ba-label", children: [
|
|
3353
3357
|
t("organization.profile.danger.deleteConfirm"),
|
|
3354
3358
|
" ",
|
|
3355
|
-
/* @__PURE__ */ (0,
|
|
3356
|
-
/* @__PURE__ */ (0,
|
|
3359
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Bidi, { children: organization.slug }),
|
|
3360
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("input", { className: "ba-input", dir: "ltr", value: confirmation, onChange: (event) => setConfirmation(event.target.value), autoComplete: "off", required: true })
|
|
3357
3361
|
] }),
|
|
3358
|
-
/* @__PURE__ */ (0,
|
|
3362
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
3359
3363
|
"button",
|
|
3360
3364
|
{
|
|
3361
3365
|
className: "ba-button ba-danger-button",
|
|
3362
3366
|
type: "submit",
|
|
3363
3367
|
disabled: pending || !confirmed,
|
|
3364
3368
|
"aria-busy": pending || void 0,
|
|
3365
|
-
children: /* @__PURE__ */ (0,
|
|
3369
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.danger.delete") })
|
|
3366
3370
|
}
|
|
3367
3371
|
)
|
|
3368
3372
|
] }),
|
|
3369
|
-
/* @__PURE__ */ (0,
|
|
3373
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(FormError, { children: error })
|
|
3370
3374
|
] });
|
|
3371
3375
|
}
|
|
3372
|
-
var
|
|
3376
|
+
var React53, import_jsx_runtime59;
|
|
3373
3377
|
var init_DangerSection = __esm({
|
|
3374
3378
|
"src/components/organization/DangerSection.tsx"() {
|
|
3375
3379
|
"use strict";
|
|
3376
3380
|
"use client";
|
|
3377
|
-
|
|
3381
|
+
React53 = __toESM(require("react"), 1);
|
|
3378
3382
|
init_hooks();
|
|
3379
3383
|
init_i18n();
|
|
3380
3384
|
init_use_submit_action();
|
|
3381
3385
|
init_Spinner();
|
|
3382
3386
|
init_model();
|
|
3383
3387
|
init_FormError();
|
|
3384
|
-
|
|
3388
|
+
import_jsx_runtime59 = require("react/jsx-runtime");
|
|
3385
3389
|
}
|
|
3386
3390
|
});
|
|
3387
3391
|
|
|
@@ -3394,25 +3398,25 @@ function GeneralSection({
|
|
|
3394
3398
|
const t = useT();
|
|
3395
3399
|
const api = useAuthClient().organization;
|
|
3396
3400
|
const { pending, error, run } = useSubmitAction();
|
|
3397
|
-
const [name, setName] =
|
|
3398
|
-
const [slug, setSlug] =
|
|
3399
|
-
const [logo, setLogo] =
|
|
3400
|
-
|
|
3401
|
+
const [name, setName] = React54.useState(organization.name);
|
|
3402
|
+
const [slug, setSlug] = React54.useState(organization.slug);
|
|
3403
|
+
const [logo, setLogo] = React54.useState(organization.logo ?? "");
|
|
3404
|
+
React54.useEffect(() => {
|
|
3401
3405
|
setName(organization.name);
|
|
3402
3406
|
setSlug(organization.slug);
|
|
3403
3407
|
setLogo(organization.logo ?? "");
|
|
3404
3408
|
}, [organization.id, organization.logo, organization.name, organization.slug]);
|
|
3405
3409
|
if (!canManage) {
|
|
3406
|
-
return /* @__PURE__ */ (0,
|
|
3407
|
-
/* @__PURE__ */ (0,
|
|
3408
|
-
/* @__PURE__ */ (0,
|
|
3409
|
-
/* @__PURE__ */ (0,
|
|
3410
|
-
/* @__PURE__ */ (0,
|
|
3411
|
-
/* @__PURE__ */ (0,
|
|
3410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("section", { className: "ba-organization-section", children: [
|
|
3411
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.profile.general.readOnly") }),
|
|
3412
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("dl", { className: "ba-organization-facts", children: [
|
|
3413
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { children: [
|
|
3414
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("dt", { children: t("organization.create.name") }),
|
|
3415
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("dd", { children: organization.name })
|
|
3412
3416
|
] }),
|
|
3413
|
-
/* @__PURE__ */ (0,
|
|
3414
|
-
/* @__PURE__ */ (0,
|
|
3415
|
-
/* @__PURE__ */ (0,
|
|
3417
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { children: [
|
|
3418
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("dt", { children: t("organization.create.slug") }),
|
|
3419
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Bidi, { children: organization.slug }) })
|
|
3416
3420
|
] })
|
|
3417
3421
|
] })
|
|
3418
3422
|
] });
|
|
@@ -3430,19 +3434,19 @@ function GeneralSection({
|
|
|
3430
3434
|
}
|
|
3431
3435
|
);
|
|
3432
3436
|
};
|
|
3433
|
-
return /* @__PURE__ */ (0,
|
|
3434
|
-
/* @__PURE__ */ (0,
|
|
3435
|
-
/* @__PURE__ */ (0,
|
|
3436
|
-
/* @__PURE__ */ (0,
|
|
3437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("section", { className: "ba-organization-section", children: [
|
|
3438
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
3439
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h3", { className: "ba-title", children: t("organization.profile.general.title") }),
|
|
3440
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.profile.general.description") })
|
|
3437
3441
|
] }),
|
|
3438
|
-
/* @__PURE__ */ (0,
|
|
3439
|
-
/* @__PURE__ */ (0,
|
|
3442
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3443
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("label", { className: "ba-label", children: [
|
|
3440
3444
|
t("organization.create.name"),
|
|
3441
|
-
/* @__PURE__ */ (0,
|
|
3445
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("input", { className: "ba-input", value: name, onChange: (event) => setName(event.target.value), required: true })
|
|
3442
3446
|
] }),
|
|
3443
|
-
/* @__PURE__ */ (0,
|
|
3447
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("label", { className: "ba-label", children: [
|
|
3444
3448
|
t("organization.create.slug"),
|
|
3445
|
-
/* @__PURE__ */ (0,
|
|
3449
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
3446
3450
|
"input",
|
|
3447
3451
|
{
|
|
3448
3452
|
className: "ba-input",
|
|
@@ -3454,37 +3458,37 @@ function GeneralSection({
|
|
|
3454
3458
|
}
|
|
3455
3459
|
)
|
|
3456
3460
|
] }),
|
|
3457
|
-
/* @__PURE__ */ (0,
|
|
3461
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("label", { className: "ba-label", children: [
|
|
3458
3462
|
t("organization.create.logo"),
|
|
3459
|
-
/* @__PURE__ */ (0,
|
|
3463
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("input", { className: "ba-input", type: "url", dir: "ltr", value: logo, onChange: (event) => setLogo(event.target.value), placeholder: "https://" })
|
|
3460
3464
|
] }),
|
|
3461
|
-
/* @__PURE__ */ (0,
|
|
3462
|
-
/* @__PURE__ */ (0,
|
|
3465
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(FormError, { children: error }),
|
|
3466
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
3463
3467
|
"button",
|
|
3464
3468
|
{
|
|
3465
3469
|
className: "ba-button ba-profile-submit",
|
|
3466
3470
|
type: "submit",
|
|
3467
3471
|
disabled: pending || !name.trim() || !slug.trim(),
|
|
3468
3472
|
"aria-busy": pending || void 0,
|
|
3469
|
-
children: /* @__PURE__ */ (0,
|
|
3473
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.general.save") })
|
|
3470
3474
|
}
|
|
3471
3475
|
)
|
|
3472
3476
|
] })
|
|
3473
3477
|
] });
|
|
3474
3478
|
}
|
|
3475
|
-
var
|
|
3479
|
+
var React54, import_jsx_runtime60;
|
|
3476
3480
|
var init_GeneralSection = __esm({
|
|
3477
3481
|
"src/components/organization/GeneralSection.tsx"() {
|
|
3478
3482
|
"use strict";
|
|
3479
3483
|
"use client";
|
|
3480
|
-
|
|
3484
|
+
React54 = __toESM(require("react"), 1);
|
|
3481
3485
|
init_hooks();
|
|
3482
3486
|
init_i18n();
|
|
3483
3487
|
init_use_submit_action();
|
|
3484
3488
|
init_Spinner();
|
|
3485
3489
|
init_model();
|
|
3486
3490
|
init_FormError();
|
|
3487
|
-
|
|
3491
|
+
import_jsx_runtime60 = require("react/jsx-runtime");
|
|
3488
3492
|
}
|
|
3489
3493
|
});
|
|
3490
3494
|
|
|
@@ -3509,11 +3513,11 @@ var init_role_label = __esm({
|
|
|
3509
3513
|
// src/components/organization/use-organization-roles.ts
|
|
3510
3514
|
function useOrganizationRoles(organizationId) {
|
|
3511
3515
|
const api = useAuthClient().organization;
|
|
3512
|
-
const apiRef =
|
|
3516
|
+
const apiRef = React55.useRef(api);
|
|
3513
3517
|
apiRef.current = api;
|
|
3514
|
-
const [dynamicRoles, setDynamicRoles] =
|
|
3515
|
-
const requestRef =
|
|
3516
|
-
|
|
3518
|
+
const [dynamicRoles, setDynamicRoles] = React55.useState([]);
|
|
3519
|
+
const requestRef = React55.useRef(0);
|
|
3520
|
+
React55.useEffect(() => {
|
|
3517
3521
|
const token = ++requestRef.current;
|
|
3518
3522
|
setDynamicRoles([]);
|
|
3519
3523
|
if (!organizationId) return;
|
|
@@ -3529,7 +3533,7 @@ function useOrganizationRoles(organizationId) {
|
|
|
3529
3533
|
requestRef.current += 1;
|
|
3530
3534
|
};
|
|
3531
3535
|
}, [organizationId]);
|
|
3532
|
-
const roles =
|
|
3536
|
+
const roles = React55.useMemo(() => {
|
|
3533
3537
|
const seen = /* @__PURE__ */ new Set();
|
|
3534
3538
|
const out = [];
|
|
3535
3539
|
for (const candidate of [...BUILTIN_ROLES, ...dynamicRoles.map((entry) => entry.role)]) {
|
|
@@ -3542,12 +3546,12 @@ function useOrganizationRoles(organizationId) {
|
|
|
3542
3546
|
}, [dynamicRoles]);
|
|
3543
3547
|
return { roles, dynamicRoles };
|
|
3544
3548
|
}
|
|
3545
|
-
var
|
|
3549
|
+
var React55, BUILTIN_ROLES;
|
|
3546
3550
|
var init_use_organization_roles = __esm({
|
|
3547
3551
|
"src/components/organization/use-organization-roles.ts"() {
|
|
3548
3552
|
"use strict";
|
|
3549
3553
|
"use client";
|
|
3550
|
-
|
|
3554
|
+
React55 = __toESM(require("react"), 1);
|
|
3551
3555
|
init_hooks();
|
|
3552
3556
|
BUILTIN_ROLES = ["owner", "admin", "member"];
|
|
3553
3557
|
}
|
|
@@ -3562,8 +3566,8 @@ function InvitationsSection({
|
|
|
3562
3566
|
const api = useAuthClient().organization;
|
|
3563
3567
|
const { pending, error, run } = useSubmitAction();
|
|
3564
3568
|
const { roles } = useOrganizationRoles(organization.id);
|
|
3565
|
-
const [email, setEmail] =
|
|
3566
|
-
const [role, setRole] =
|
|
3569
|
+
const [email, setEmail] = React56.useState("");
|
|
3570
|
+
const [role, setRole] = React56.useState("member");
|
|
3567
3571
|
const invitations = organization.invitations.filter((invitation) => invitation.status === "pending");
|
|
3568
3572
|
const invite = (event) => {
|
|
3569
3573
|
event.preventDefault();
|
|
@@ -3585,47 +3589,47 @@ function InvitationsSection({
|
|
|
3585
3589
|
{ failure: t("organization.profile.invitations.cancelError"), onSuccess: onChanged }
|
|
3586
3590
|
);
|
|
3587
3591
|
};
|
|
3588
|
-
return /* @__PURE__ */ (0,
|
|
3589
|
-
/* @__PURE__ */ (0,
|
|
3590
|
-
/* @__PURE__ */ (0,
|
|
3591
|
-
/* @__PURE__ */ (0,
|
|
3592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("section", { className: "ba-organization-section", children: [
|
|
3593
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
3594
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("h3", { className: "ba-title", children: t("organization.profile.invitations.title") }),
|
|
3595
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "ba-muted", children: t("organization.profile.invitations.description") })
|
|
3592
3596
|
] }),
|
|
3593
|
-
/* @__PURE__ */ (0,
|
|
3594
|
-
/* @__PURE__ */ (0,
|
|
3597
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("form", { method: "post", className: "ba-organization-invite-form", onSubmit: invite, children: [
|
|
3598
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("label", { className: "ba-label", children: [
|
|
3595
3599
|
t("organization.profile.invitations.email"),
|
|
3596
|
-
/* @__PURE__ */ (0,
|
|
3600
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("input", { className: "ba-input", type: "email", dir: "ltr", value: email, onChange: (event) => setEmail(event.target.value), required: true })
|
|
3597
3601
|
] }),
|
|
3598
|
-
/* @__PURE__ */ (0,
|
|
3602
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("label", { className: "ba-label", children: [
|
|
3599
3603
|
t("organization.profile.members.role"),
|
|
3600
|
-
/* @__PURE__ */ (0,
|
|
3604
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("select", { className: "ba-input", value: role, onChange: (event) => setRole(event.target.value), children: roles.map((option) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("option", { value: option, children: organizationRoleLabel(option, t) }, option)) })
|
|
3601
3605
|
] }),
|
|
3602
|
-
/* @__PURE__ */ (0,
|
|
3606
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3603
3607
|
"button",
|
|
3604
3608
|
{
|
|
3605
3609
|
className: "ba-button",
|
|
3606
3610
|
type: "submit",
|
|
3607
3611
|
disabled: pending || !email.trim(),
|
|
3608
3612
|
"aria-busy": pending || void 0,
|
|
3609
|
-
children: /* @__PURE__ */ (0,
|
|
3613
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.invitations.invite") })
|
|
3610
3614
|
}
|
|
3611
3615
|
)
|
|
3612
3616
|
] }),
|
|
3613
|
-
/* @__PURE__ */ (0,
|
|
3614
|
-
invitations.length === 0 ? /* @__PURE__ */ (0,
|
|
3615
|
-
/* @__PURE__ */ (0,
|
|
3616
|
-
/* @__PURE__ */ (0,
|
|
3617
|
-
/* @__PURE__ */ (0,
|
|
3617
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(FormError, { children: error }),
|
|
3618
|
+
invitations.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "ba-muted", children: t("organization.profile.invitations.empty") }) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("li", { className: "ba-organization-invitation", children: [
|
|
3619
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { children: [
|
|
3620
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("strong", { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Bidi, { children: invitation.email }) }),
|
|
3621
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("small", { children: organizationRoleLabel(invitation.role, t) })
|
|
3618
3622
|
] }),
|
|
3619
|
-
/* @__PURE__ */ (0,
|
|
3623
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => cancel(invitation), children: t("organization.profile.invitations.cancel") })
|
|
3620
3624
|
] }, invitation.id)) })
|
|
3621
3625
|
] });
|
|
3622
3626
|
}
|
|
3623
|
-
var
|
|
3627
|
+
var React56, import_jsx_runtime61;
|
|
3624
3628
|
var init_InvitationsSection = __esm({
|
|
3625
3629
|
"src/components/organization/InvitationsSection.tsx"() {
|
|
3626
3630
|
"use strict";
|
|
3627
3631
|
"use client";
|
|
3628
|
-
|
|
3632
|
+
React56 = __toESM(require("react"), 1);
|
|
3629
3633
|
init_hooks();
|
|
3630
3634
|
init_i18n();
|
|
3631
3635
|
init_use_submit_action();
|
|
@@ -3633,7 +3637,7 @@ var init_InvitationsSection = __esm({
|
|
|
3633
3637
|
init_role_label();
|
|
3634
3638
|
init_use_organization_roles();
|
|
3635
3639
|
init_FormError();
|
|
3636
|
-
|
|
3640
|
+
import_jsx_runtime61 = require("react/jsx-runtime");
|
|
3637
3641
|
}
|
|
3638
3642
|
});
|
|
3639
3643
|
|
|
@@ -3664,27 +3668,27 @@ function MembersSection({
|
|
|
3664
3668
|
{ failure: t("organization.profile.members.removeError"), onSuccess: onChanged }
|
|
3665
3669
|
);
|
|
3666
3670
|
};
|
|
3667
|
-
return /* @__PURE__ */ (0,
|
|
3668
|
-
/* @__PURE__ */ (0,
|
|
3669
|
-
/* @__PURE__ */ (0,
|
|
3670
|
-
/* @__PURE__ */ (0,
|
|
3671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", { className: "ba-organization-section", children: [
|
|
3672
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
3673
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("h3", { className: "ba-title", children: t("organization.profile.members.title") }),
|
|
3674
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "ba-muted", children: t("organization.profile.members.description") })
|
|
3671
3675
|
] }),
|
|
3672
|
-
/* @__PURE__ */ (0,
|
|
3673
|
-
/* @__PURE__ */ (0,
|
|
3676
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(FormError, { children: error }),
|
|
3677
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("ul", { className: "ba-organization-list", children: organization.members.map((member) => {
|
|
3674
3678
|
const primaryRole = organizationRoles(member.role)[0] ?? member.role;
|
|
3675
3679
|
const isCurrent = member.userId === userId;
|
|
3676
|
-
return /* @__PURE__ */ (0,
|
|
3677
|
-
/* @__PURE__ */ (0,
|
|
3678
|
-
/* @__PURE__ */ (0,
|
|
3679
|
-
/* @__PURE__ */ (0,
|
|
3680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("li", { className: "ba-organization-member", children: [
|
|
3681
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: member.user.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
3682
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ba-organization-member-copy", children: [
|
|
3683
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("strong", { children: [
|
|
3680
3684
|
member.user.name,
|
|
3681
3685
|
isCurrent ? ` ${t("organization.profile.members.you")}` : ""
|
|
3682
3686
|
] }),
|
|
3683
|
-
/* @__PURE__ */ (0,
|
|
3687
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("small", { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Bidi, { children: member.user.email }) })
|
|
3684
3688
|
] }),
|
|
3685
|
-
canManage && !isCurrent ? /* @__PURE__ */ (0,
|
|
3686
|
-
/* @__PURE__ */ (0,
|
|
3687
|
-
/* @__PURE__ */ (0,
|
|
3689
|
+
canManage && !isCurrent ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ba-organization-member-actions", children: [
|
|
3690
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("label", { className: "ba-sr-only", htmlFor: `organization-role-${member.id}`, children: t("organization.profile.members.role") }),
|
|
3691
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3688
3692
|
"select",
|
|
3689
3693
|
{
|
|
3690
3694
|
id: `organization-role-${member.id}`,
|
|
@@ -3692,16 +3696,16 @@ function MembersSection({
|
|
|
3692
3696
|
value: primaryRole,
|
|
3693
3697
|
disabled: pending,
|
|
3694
3698
|
onChange: (event) => updateRole(member, event.target.value),
|
|
3695
|
-
children: (roles.includes(primaryRole) ? roles : [primaryRole, ...roles]).map((role) => /* @__PURE__ */ (0,
|
|
3699
|
+
children: (roles.includes(primaryRole) ? roles : [primaryRole, ...roles]).map((role) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("option", { value: role, children: organizationRoleLabel(role, t) }, role))
|
|
3696
3700
|
}
|
|
3697
3701
|
),
|
|
3698
|
-
/* @__PURE__ */ (0,
|
|
3699
|
-
] }) : /* @__PURE__ */ (0,
|
|
3702
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => remove(member), children: t("organization.profile.members.remove") })
|
|
3703
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ba-organization-role-label", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Bidi, { children: organizationRoleLabel(member.role, t) }) })
|
|
3700
3704
|
] }, member.id);
|
|
3701
3705
|
}) })
|
|
3702
3706
|
] });
|
|
3703
3707
|
}
|
|
3704
|
-
var
|
|
3708
|
+
var import_jsx_runtime62;
|
|
3705
3709
|
var init_MembersSection = __esm({
|
|
3706
3710
|
"src/components/organization/MembersSection.tsx"() {
|
|
3707
3711
|
"use strict";
|
|
@@ -3713,7 +3717,7 @@ var init_MembersSection = __esm({
|
|
|
3713
3717
|
init_role_label();
|
|
3714
3718
|
init_use_organization_roles();
|
|
3715
3719
|
init_FormError();
|
|
3716
|
-
|
|
3720
|
+
import_jsx_runtime62 = require("react/jsx-runtime");
|
|
3717
3721
|
}
|
|
3718
3722
|
});
|
|
3719
3723
|
|
|
@@ -3726,12 +3730,12 @@ function useOrganizationListResource({
|
|
|
3726
3730
|
inactiveData = null
|
|
3727
3731
|
}) {
|
|
3728
3732
|
const toServerError = useServerError();
|
|
3729
|
-
const requestFn =
|
|
3733
|
+
const requestFn = React57.useRef(request);
|
|
3730
3734
|
requestFn.current = request;
|
|
3731
|
-
const [data, setData] =
|
|
3732
|
-
const [error, setError] =
|
|
3733
|
-
const requestToken =
|
|
3734
|
-
const refresh =
|
|
3735
|
+
const [data, setData] = React57.useState(null);
|
|
3736
|
+
const [error, setError] = React57.useState(null);
|
|
3737
|
+
const requestToken = React57.useRef(0);
|
|
3738
|
+
const refresh = React57.useCallback(async () => {
|
|
3735
3739
|
const token = ++requestToken.current;
|
|
3736
3740
|
if (!enabled || !resourceKey) {
|
|
3737
3741
|
setData(inactiveData);
|
|
@@ -3751,7 +3755,7 @@ function useOrganizationListResource({
|
|
|
3751
3755
|
if (token === requestToken.current) setError(fallback);
|
|
3752
3756
|
}
|
|
3753
3757
|
}, [enabled, fallback, inactiveData, resourceKey, toServerError]);
|
|
3754
|
-
|
|
3758
|
+
React57.useEffect(() => {
|
|
3755
3759
|
setData(enabled && resourceKey ? null : inactiveData);
|
|
3756
3760
|
setError(null);
|
|
3757
3761
|
void refresh();
|
|
@@ -3761,12 +3765,12 @@ function useOrganizationListResource({
|
|
|
3761
3765
|
}, [enabled, inactiveData, refresh, resourceKey]);
|
|
3762
3766
|
return { data, isLoading: data === null && error === null, error, refresh };
|
|
3763
3767
|
}
|
|
3764
|
-
var
|
|
3768
|
+
var React57;
|
|
3765
3769
|
var init_use_organization_list_resource = __esm({
|
|
3766
3770
|
"src/components/organization/use-organization-list-resource.ts"() {
|
|
3767
3771
|
"use strict";
|
|
3768
3772
|
"use client";
|
|
3769
|
-
|
|
3773
|
+
React57 = __toESM(require("react"), 1);
|
|
3770
3774
|
init_i18n();
|
|
3771
3775
|
}
|
|
3772
3776
|
});
|
|
@@ -3774,7 +3778,7 @@ var init_use_organization_list_resource = __esm({
|
|
|
3774
3778
|
// src/components/organization/use-team-resources.ts
|
|
3775
3779
|
function useTeamsResource(organizationId) {
|
|
3776
3780
|
const api = useAuthClient().organization;
|
|
3777
|
-
const apiRef =
|
|
3781
|
+
const apiRef = React58.useRef(api);
|
|
3778
3782
|
apiRef.current = api;
|
|
3779
3783
|
const t = useT();
|
|
3780
3784
|
const resource = useOrganizationListResource({
|
|
@@ -3787,7 +3791,7 @@ function useTeamsResource(organizationId) {
|
|
|
3787
3791
|
}
|
|
3788
3792
|
function useTeamMembersResource(selectedTeamId) {
|
|
3789
3793
|
const api = useAuthClient().organization;
|
|
3790
|
-
const apiRef =
|
|
3794
|
+
const apiRef = React58.useRef(api);
|
|
3791
3795
|
apiRef.current = api;
|
|
3792
3796
|
const t = useT();
|
|
3793
3797
|
const resource = useOrganizationListResource({
|
|
@@ -3798,12 +3802,12 @@ function useTeamMembersResource(selectedTeamId) {
|
|
|
3798
3802
|
});
|
|
3799
3803
|
return { members: resource.data, error: resource.error, reload: resource.refresh };
|
|
3800
3804
|
}
|
|
3801
|
-
var
|
|
3805
|
+
var React58;
|
|
3802
3806
|
var init_use_team_resources = __esm({
|
|
3803
3807
|
"src/components/organization/use-team-resources.ts"() {
|
|
3804
3808
|
"use strict";
|
|
3805
3809
|
"use client";
|
|
3806
|
-
|
|
3810
|
+
React58 = __toESM(require("react"), 1);
|
|
3807
3811
|
init_hooks();
|
|
3808
3812
|
init_i18n();
|
|
3809
3813
|
init_use_organization_list_resource();
|
|
@@ -3820,7 +3824,7 @@ function TeamMembersPanel({
|
|
|
3820
3824
|
const t = useT();
|
|
3821
3825
|
const api = useAuthClient().organization;
|
|
3822
3826
|
const { pending, error: actionError, run } = useSubmitAction();
|
|
3823
|
-
const [userId, setUserId] =
|
|
3827
|
+
const [userId, setUserId] = React59.useState("");
|
|
3824
3828
|
const { members, error, reload } = useTeamMembersResource(team.id);
|
|
3825
3829
|
const assignedUserIds = new Set(members?.map((member) => member.userId));
|
|
3826
3830
|
const availableMembers = organization.members.filter((member) => !assignedUserIds.has(member.userId));
|
|
@@ -3859,45 +3863,45 @@ function TeamMembersPanel({
|
|
|
3859
3863
|
}
|
|
3860
3864
|
);
|
|
3861
3865
|
};
|
|
3862
|
-
return /* @__PURE__ */ (0,
|
|
3863
|
-
/* @__PURE__ */ (0,
|
|
3864
|
-
canAdd && availableMembers.length > 0 && members !== null && /* @__PURE__ */ (0,
|
|
3865
|
-
/* @__PURE__ */ (0,
|
|
3866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "ba-organization-user-invitations", children: [
|
|
3867
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("h4", { children: t("organization.profile.teams.manageMembers") }),
|
|
3868
|
+
canAdd && availableMembers.length > 0 && members !== null && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("form", { method: "post", className: "ba-organization-invite-form", onSubmit: addMember, children: [
|
|
3869
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("label", { className: "ba-label", children: [
|
|
3866
3870
|
t("organization.profile.teams.addMember"),
|
|
3867
|
-
/* @__PURE__ */ (0,
|
|
3871
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("select", { className: "ba-input", value: addableUserId, onChange: (event) => setUserId(event.target.value), children: availableMembers.map((member) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("option", { value: member.userId, children: member.user.name || member.user.email || member.userId }, member.userId)) })
|
|
3868
3872
|
] }),
|
|
3869
|
-
/* @__PURE__ */ (0,
|
|
3873
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { className: "ba-button", type: "submit", disabled: pending || !addableUserId, children: t("organization.profile.teams.addMember") })
|
|
3870
3874
|
] }),
|
|
3871
|
-
/* @__PURE__ */ (0,
|
|
3872
|
-
error && /* @__PURE__ */ (0,
|
|
3873
|
-
/* @__PURE__ */ (0,
|
|
3874
|
-
/* @__PURE__ */ (0,
|
|
3875
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(FormError, { children: actionError }),
|
|
3876
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "ba-inline-error", children: [
|
|
3877
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(FormError, { children: error }),
|
|
3878
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void reload(), children: t("organization.retry") })
|
|
3875
3879
|
] }),
|
|
3876
|
-
members?.length ? /* @__PURE__ */ (0,
|
|
3880
|
+
members?.length ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("ul", { className: "ba-organization-list", children: members.map((member) => {
|
|
3877
3881
|
const organizationMember = organization.members.find((entry) => entry.userId === member.userId);
|
|
3878
3882
|
const displayName = organizationMember?.user.name || member.userId;
|
|
3879
|
-
return /* @__PURE__ */ (0,
|
|
3880
|
-
/* @__PURE__ */ (0,
|
|
3881
|
-
/* @__PURE__ */ (0,
|
|
3882
|
-
organizationMember?.user.email && /* @__PURE__ */ (0,
|
|
3883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("li", { className: "ba-organization-member", children: [
|
|
3884
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "ba-organization-member-copy", children: [
|
|
3885
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("strong", { children: displayName }),
|
|
3886
|
+
organizationMember?.user.email && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("small", { children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Bidi, { children: organizationMember.user.email }) })
|
|
3883
3887
|
] }),
|
|
3884
|
-
canRemove && /* @__PURE__ */ (0,
|
|
3888
|
+
canRemove && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => removeMember(member), children: t("organization.profile.teams.removeMember") })
|
|
3885
3889
|
] }, member.id);
|
|
3886
|
-
}) }) : error ? null : members === null ? /* @__PURE__ */ (0,
|
|
3890
|
+
}) }) : error ? null : members === null ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ba-skeleton", "aria-label": t("common.loading") }) : members.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "ba-muted", children: t("organization.profile.teams.membersEmpty") }) : null
|
|
3887
3891
|
] });
|
|
3888
3892
|
}
|
|
3889
|
-
var
|
|
3893
|
+
var React59, import_jsx_runtime63;
|
|
3890
3894
|
var init_TeamMembersPanel = __esm({
|
|
3891
3895
|
"src/components/organization/TeamMembersPanel.tsx"() {
|
|
3892
3896
|
"use strict";
|
|
3893
3897
|
"use client";
|
|
3894
|
-
|
|
3898
|
+
React59 = __toESM(require("react"), 1);
|
|
3895
3899
|
init_hooks();
|
|
3896
3900
|
init_i18n();
|
|
3897
3901
|
init_FormError();
|
|
3898
3902
|
init_use_submit_action();
|
|
3899
3903
|
init_use_team_resources();
|
|
3900
|
-
|
|
3904
|
+
import_jsx_runtime63 = require("react/jsx-runtime");
|
|
3901
3905
|
}
|
|
3902
3906
|
});
|
|
3903
3907
|
|
|
@@ -3916,11 +3920,11 @@ function TeamsSection({
|
|
|
3916
3920
|
const { teams, error: teamsError, reload } = useTeamsResource(organization.id);
|
|
3917
3921
|
const { dynamicRoles } = useOrganizationRoles(organization.id);
|
|
3918
3922
|
const capabilities = teamManagementCapabilities(membership, dynamicRoles);
|
|
3919
|
-
const [name, setName] =
|
|
3920
|
-
const [selectedTeamId, setSelectedTeamId] =
|
|
3921
|
-
const [editingTeamId, setEditingTeamId] =
|
|
3922
|
-
const [editingName, setEditingName] =
|
|
3923
|
-
|
|
3923
|
+
const [name, setName] = React60.useState("");
|
|
3924
|
+
const [selectedTeamId, setSelectedTeamId] = React60.useState(null);
|
|
3925
|
+
const [editingTeamId, setEditingTeamId] = React60.useState(null);
|
|
3926
|
+
const [editingName, setEditingName] = React60.useState("");
|
|
3927
|
+
React60.useEffect(() => {
|
|
3924
3928
|
setSelectedTeamId(null);
|
|
3925
3929
|
setEditingTeamId(null);
|
|
3926
3930
|
setEditingName("");
|
|
@@ -3976,42 +3980,42 @@ function TeamsSection({
|
|
|
3976
3980
|
);
|
|
3977
3981
|
};
|
|
3978
3982
|
const selectedTeam = teams?.find((team) => team.id === selectedTeamId);
|
|
3979
|
-
return /* @__PURE__ */ (0,
|
|
3980
|
-
/* @__PURE__ */ (0,
|
|
3981
|
-
/* @__PURE__ */ (0,
|
|
3982
|
-
/* @__PURE__ */ (0,
|
|
3983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("section", { className: "ba-organization-section", children: [
|
|
3984
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
3985
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("h3", { className: "ba-title", children: t("organization.profile.teams.title") }),
|
|
3986
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "ba-muted", children: t("organization.profile.teams.description") })
|
|
3983
3987
|
] }),
|
|
3984
|
-
capabilities.createTeam ? /* @__PURE__ */ (0,
|
|
3985
|
-
/* @__PURE__ */ (0,
|
|
3988
|
+
capabilities.createTeam ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("form", { method: "post", className: "ba-organization-invite-form", onSubmit: create, children: [
|
|
3989
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("label", { className: "ba-label", children: [
|
|
3986
3990
|
t("organization.profile.teams.create"),
|
|
3987
|
-
/* @__PURE__ */ (0,
|
|
3991
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("input", { className: "ba-input", value: name, onChange: (event) => setName(event.target.value), required: true })
|
|
3988
3992
|
] }),
|
|
3989
|
-
/* @__PURE__ */ (0,
|
|
3993
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { className: "ba-button", type: "submit", disabled: pending || !name.trim(), "aria-busy": pending || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.teams.create") }) })
|
|
3990
3994
|
] }) : null,
|
|
3991
|
-
/* @__PURE__ */ (0,
|
|
3992
|
-
teamsError && /* @__PURE__ */ (0,
|
|
3993
|
-
/* @__PURE__ */ (0,
|
|
3994
|
-
/* @__PURE__ */ (0,
|
|
3995
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(FormError, { children: actionError }),
|
|
3996
|
+
teamsError && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "ba-inline-error", children: [
|
|
3997
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(FormError, { children: teamsError }),
|
|
3998
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void reload(), children: t("organization.retry") })
|
|
3995
3999
|
] }),
|
|
3996
|
-
teams?.length ? /* @__PURE__ */ (0,
|
|
3997
|
-
/* @__PURE__ */ (0,
|
|
3998
|
-
editingTeamId === team.id ? /* @__PURE__ */ (0,
|
|
3999
|
-
/* @__PURE__ */ (0,
|
|
4000
|
+
teams?.length ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("ul", { className: "ba-organization-list", children: teams.map((team) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("li", { className: "ba-organization-member", children: [
|
|
4001
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: team.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
4002
|
+
editingTeamId === team.id ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("form", { method: "post", className: "ba-organization-invite-form", onSubmit: (event) => rename(event, team), children: [
|
|
4003
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("label", { className: "ba-label", children: [
|
|
4000
4004
|
t("organization.profile.teams.rename"),
|
|
4001
|
-
/* @__PURE__ */ (0,
|
|
4005
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("input", { className: "ba-input", value: editingName, onChange: (event) => setEditingName(event.target.value), required: true, autoFocus: true })
|
|
4002
4006
|
] }),
|
|
4003
|
-
/* @__PURE__ */ (0,
|
|
4004
|
-
/* @__PURE__ */ (0,
|
|
4005
|
-
] }) : /* @__PURE__ */ (0,
|
|
4006
|
-
/* @__PURE__ */ (0,
|
|
4007
|
-
/* @__PURE__ */ (0,
|
|
4008
|
-
/* @__PURE__ */ (0,
|
|
4009
|
-
capabilities.updateTeam && /* @__PURE__ */ (0,
|
|
4010
|
-
capabilities.deleteTeam && /* @__PURE__ */ (0,
|
|
4007
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { className: "ba-button", type: "submit", disabled: pending || !editingName.trim(), children: t("organization.profile.teams.rename") }),
|
|
4008
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => setEditingTeamId(null), children: t("organization.profile.teams.cancel") })
|
|
4009
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
4010
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "ba-organization-member-copy", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("strong", { children: team.name }) }),
|
|
4011
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { className: "ba-organization-member-actions", children: [
|
|
4012
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, "aria-expanded": selectedTeamId === team.id, onClick: () => setSelectedTeamId(selectedTeamId === team.id ? null : team.id), children: t("organization.profile.teams.manageMembers") }),
|
|
4013
|
+
capabilities.updateTeam && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => beginRename(team), children: t("organization.profile.teams.rename") }),
|
|
4014
|
+
capabilities.deleteTeam && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => remove(team), children: t("organization.profile.teams.removeTeam") })
|
|
4011
4015
|
] })
|
|
4012
4016
|
] })
|
|
4013
|
-
] }, team.id)) }) : teamsError ? null : teams === null ? /* @__PURE__ */ (0,
|
|
4014
|
-
selectedTeam && /* @__PURE__ */ (0,
|
|
4017
|
+
] }, team.id)) }) : teamsError ? null : teams === null ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ba-skeleton", "aria-label": t("common.loading") }) : teams.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "ba-muted", children: t("organization.profile.teams.empty") }) : null,
|
|
4018
|
+
selectedTeam && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
4015
4019
|
TeamMembersPanel,
|
|
4016
4020
|
{
|
|
4017
4021
|
organization,
|
|
@@ -4022,12 +4026,12 @@ function TeamsSection({
|
|
|
4022
4026
|
)
|
|
4023
4027
|
] });
|
|
4024
4028
|
}
|
|
4025
|
-
var
|
|
4029
|
+
var React60, import_jsx_runtime64;
|
|
4026
4030
|
var init_TeamsSection = __esm({
|
|
4027
4031
|
"src/components/organization/TeamsSection.tsx"() {
|
|
4028
4032
|
"use strict";
|
|
4029
4033
|
"use client";
|
|
4030
|
-
|
|
4034
|
+
React60 = __toESM(require("react"), 1);
|
|
4031
4035
|
init_hooks();
|
|
4032
4036
|
init_i18n();
|
|
4033
4037
|
init_FormError();
|
|
@@ -4037,7 +4041,7 @@ var init_TeamsSection = __esm({
|
|
|
4037
4041
|
init_model();
|
|
4038
4042
|
init_use_organization_roles();
|
|
4039
4043
|
init_use_team_resources();
|
|
4040
|
-
|
|
4044
|
+
import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4041
4045
|
}
|
|
4042
4046
|
});
|
|
4043
4047
|
|
|
@@ -4053,17 +4057,17 @@ function OrganizationProfileContent({ organizationId, defaultSection = "general"
|
|
|
4053
4057
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
4054
4058
|
const session = useSession();
|
|
4055
4059
|
const api = useAuthClient().organization;
|
|
4056
|
-
const apiRef =
|
|
4060
|
+
const apiRef = React61.useRef(api);
|
|
4057
4061
|
apiRef.current = api;
|
|
4058
4062
|
const activeOrganizationId = session.data?.session.activeOrganizationId ?? null;
|
|
4059
4063
|
const requestedId = organizationId ?? activeOrganizationId;
|
|
4060
4064
|
const enabled = config?.organizations === true && isSignedIn;
|
|
4061
|
-
const [organization, setOrganization] =
|
|
4062
|
-
const [error, setError] =
|
|
4063
|
-
const [wasRemoved, setWasRemoved] =
|
|
4064
|
-
const [section, setSection] =
|
|
4065
|
-
const requestRef =
|
|
4066
|
-
const load =
|
|
4065
|
+
const [organization, setOrganization] = React61.useState(null);
|
|
4066
|
+
const [error, setError] = React61.useState(null);
|
|
4067
|
+
const [wasRemoved, setWasRemoved] = React61.useState(false);
|
|
4068
|
+
const [section, setSection] = React61.useState(defaultSection);
|
|
4069
|
+
const requestRef = React61.useRef(0);
|
|
4070
|
+
const load = React61.useCallback(async () => {
|
|
4067
4071
|
const token = ++requestRef.current;
|
|
4068
4072
|
if (!enabled || !requestedId) {
|
|
4069
4073
|
setOrganization(null);
|
|
@@ -4083,7 +4087,7 @@ function OrganizationProfileContent({ organizationId, defaultSection = "general"
|
|
|
4083
4087
|
if (token === requestRef.current) setError(t("organization.profile.loadError"));
|
|
4084
4088
|
}
|
|
4085
4089
|
}, [enabled, requestedId, t, toServerError]);
|
|
4086
|
-
|
|
4090
|
+
React61.useEffect(() => {
|
|
4087
4091
|
setOrganization(null);
|
|
4088
4092
|
setError(null);
|
|
4089
4093
|
setWasRemoved(false);
|
|
@@ -4092,20 +4096,20 @@ function OrganizationProfileContent({ organizationId, defaultSection = "general"
|
|
|
4092
4096
|
requestRef.current += 1;
|
|
4093
4097
|
};
|
|
4094
4098
|
}, [load]);
|
|
4095
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */ (0,
|
|
4099
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
4096
4100
|
if (config?.organizations !== true) return null;
|
|
4097
|
-
if (!isSignedIn || !user) return /* @__PURE__ */ (0,
|
|
4098
|
-
if (wasRemoved) return /* @__PURE__ */ (0,
|
|
4099
|
-
if (!requestedId) return /* @__PURE__ */ (0,
|
|
4101
|
+
if (!isSignedIn || !user) return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
4102
|
+
if (wasRemoved) return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { className: "ba-muted", children: t("organization.profile.noActive") });
|
|
4103
|
+
if (!requestedId) return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { className: "ba-muted", children: t("organization.profile.noActive") });
|
|
4100
4104
|
if (error) {
|
|
4101
|
-
return /* @__PURE__ */ (0,
|
|
4102
|
-
/* @__PURE__ */ (0,
|
|
4103
|
-
/* @__PURE__ */ (0,
|
|
4105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "ba-inline-error", children: [
|
|
4106
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FormError, { children: error }),
|
|
4107
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("organization.retry") })
|
|
4104
4108
|
] });
|
|
4105
4109
|
}
|
|
4106
|
-
if (!organization) return /* @__PURE__ */ (0,
|
|
4110
|
+
if (!organization) return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
4107
4111
|
const membership = organization.members.find((member) => member.userId === user.id);
|
|
4108
|
-
if (!membership) return /* @__PURE__ */ (0,
|
|
4112
|
+
if (!membership) return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { className: "ba-muted", children: t("organization.profile.notMember") });
|
|
4109
4113
|
const canManage = canManageOrganization(membership);
|
|
4110
4114
|
const visibleSections = canManage ? ["general", "members", "teams", "invitations", "danger"] : ["general", "members", "teams", "danger"];
|
|
4111
4115
|
const activeSection = visibleSections.includes(section) ? section : "general";
|
|
@@ -4114,16 +4118,16 @@ function OrganizationProfileContent({ organizationId, defaultSection = "general"
|
|
|
4114
4118
|
setOrganization(null);
|
|
4115
4119
|
callback?.(removedOrganization);
|
|
4116
4120
|
};
|
|
4117
|
-
return /* @__PURE__ */ (0,
|
|
4118
|
-
/* @__PURE__ */ (0,
|
|
4119
|
-
/* @__PURE__ */ (0,
|
|
4120
|
-
/* @__PURE__ */ (0,
|
|
4121
|
-
/* @__PURE__ */ (0,
|
|
4122
|
-
/* @__PURE__ */ (0,
|
|
4121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("article", { className: "ba-organization-profile", children: [
|
|
4122
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("header", { className: "ba-organization-profile-heading", children: [
|
|
4123
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
4124
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { children: [
|
|
4125
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("h2", { className: "ba-title", children: organization.name }),
|
|
4126
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { className: "ba-muted", children: organization.slug })
|
|
4123
4127
|
] })
|
|
4124
4128
|
] }),
|
|
4125
|
-
/* @__PURE__ */ (0,
|
|
4126
|
-
/* @__PURE__ */ (0,
|
|
4129
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "ba-organization-profile-layout", children: [
|
|
4130
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("nav", { className: "ba-organization-profile-nav", "aria-label": t("organization.profile.nav.label"), children: visibleSections.map((item) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4127
4131
|
"button",
|
|
4128
4132
|
{
|
|
4129
4133
|
className: "ba-profile-nav-item",
|
|
@@ -4134,12 +4138,12 @@ function OrganizationProfileContent({ organizationId, defaultSection = "general"
|
|
|
4134
4138
|
},
|
|
4135
4139
|
item
|
|
4136
4140
|
)) }),
|
|
4137
|
-
/* @__PURE__ */ (0,
|
|
4138
|
-
activeSection === "general" && /* @__PURE__ */ (0,
|
|
4139
|
-
activeSection === "members" && /* @__PURE__ */ (0,
|
|
4140
|
-
activeSection === "teams" && /* @__PURE__ */ (0,
|
|
4141
|
-
activeSection === "invitations" && /* @__PURE__ */ (0,
|
|
4142
|
-
activeSection === "danger" && /* @__PURE__ */ (0,
|
|
4141
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "ba-organization-profile-content", children: [
|
|
4142
|
+
activeSection === "general" && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(GeneralSection, { organization, canManage, onChanged: load }),
|
|
4143
|
+
activeSection === "members" && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(MembersSection, { organization, userId: user.id, canManage, onChanged: load }),
|
|
4144
|
+
activeSection === "teams" && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(React61.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(TeamsSection2, { organization, membership }) }),
|
|
4145
|
+
activeSection === "invitations" && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(InvitationsSection, { organization, onChanged: load }),
|
|
4146
|
+
activeSection === "danger" && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4143
4147
|
DangerSection,
|
|
4144
4148
|
{
|
|
4145
4149
|
organization,
|
|
@@ -4152,12 +4156,12 @@ function OrganizationProfileContent({ organizationId, defaultSection = "general"
|
|
|
4152
4156
|
] })
|
|
4153
4157
|
] });
|
|
4154
4158
|
}
|
|
4155
|
-
var
|
|
4159
|
+
var React61, import_jsx_runtime65, SECTION_KEYS2, TeamsSection2;
|
|
4156
4160
|
var init_OrganizationProfileContent = __esm({
|
|
4157
4161
|
"src/components/OrganizationProfileContent.tsx"() {
|
|
4158
4162
|
"use strict";
|
|
4159
4163
|
"use client";
|
|
4160
|
-
|
|
4164
|
+
React61 = __toESM(require("react"), 1);
|
|
4161
4165
|
init_hooks();
|
|
4162
4166
|
init_i18n();
|
|
4163
4167
|
init_DangerSection();
|
|
@@ -4166,7 +4170,7 @@ var init_OrganizationProfileContent = __esm({
|
|
|
4166
4170
|
init_MembersSection();
|
|
4167
4171
|
init_model();
|
|
4168
4172
|
init_FormError();
|
|
4169
|
-
|
|
4173
|
+
import_jsx_runtime65 = require("react/jsx-runtime");
|
|
4170
4174
|
SECTION_KEYS2 = {
|
|
4171
4175
|
general: "organization.profile.nav.general",
|
|
4172
4176
|
members: "organization.profile.nav.members",
|
|
@@ -4174,22 +4178,22 @@ var init_OrganizationProfileContent = __esm({
|
|
|
4174
4178
|
invitations: "organization.profile.nav.invitations",
|
|
4175
4179
|
danger: "organization.profile.nav.danger"
|
|
4176
4180
|
};
|
|
4177
|
-
TeamsSection2 =
|
|
4181
|
+
TeamsSection2 = React61.lazy(() => Promise.resolve().then(() => (init_TeamsSection(), TeamsSection_exports)));
|
|
4178
4182
|
}
|
|
4179
4183
|
});
|
|
4180
4184
|
|
|
4181
4185
|
// src/components/OrganizationProfile.tsx
|
|
4182
4186
|
function OrganizationProfile(props = {}) {
|
|
4183
|
-
return /* @__PURE__ */ (0,
|
|
4187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(React62.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "ba-skeleton", "aria-busy": "true" }), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(OrganizationProfileContent2, { ...props }) });
|
|
4184
4188
|
}
|
|
4185
|
-
var
|
|
4189
|
+
var React62, import_jsx_runtime66, OrganizationProfileContent2;
|
|
4186
4190
|
var init_OrganizationProfile = __esm({
|
|
4187
4191
|
"src/components/OrganizationProfile.tsx"() {
|
|
4188
4192
|
"use strict";
|
|
4189
4193
|
"use client";
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
OrganizationProfileContent2 =
|
|
4194
|
+
React62 = __toESM(require("react"), 1);
|
|
4195
|
+
import_jsx_runtime66 = require("react/jsx-runtime");
|
|
4196
|
+
OrganizationProfileContent2 = React62.lazy(async () => {
|
|
4193
4197
|
const module2 = await Promise.resolve().then(() => (init_OrganizationProfileContent(), OrganizationProfileContent_exports));
|
|
4194
4198
|
return { default: module2.OrganizationProfileContent };
|
|
4195
4199
|
});
|
|
@@ -4210,15 +4214,15 @@ function OrganizationSwitcherContent({ showPersonalWorkspace = true, onOrganizat
|
|
|
4210
4214
|
const enabled = config?.organizations === true && isSignedIn;
|
|
4211
4215
|
const { organizations, isLoading, error: loadError, refresh } = useOrganizationsResource(enabled);
|
|
4212
4216
|
const { pending, error, run } = useSubmitAction();
|
|
4213
|
-
const [open, setOpen] =
|
|
4214
|
-
const [dialog, setDialog] =
|
|
4215
|
-
const rootRef =
|
|
4216
|
-
const triggerRef =
|
|
4217
|
-
const menuRef =
|
|
4218
|
-
const menuId =
|
|
4217
|
+
const [open, setOpen] = React63.useState(false);
|
|
4218
|
+
const [dialog, setDialog] = React63.useState(null);
|
|
4219
|
+
const rootRef = React63.useRef(null);
|
|
4220
|
+
const triggerRef = React63.useRef(null);
|
|
4221
|
+
const menuRef = React63.useRef(null);
|
|
4222
|
+
const menuId = React63.useId();
|
|
4219
4223
|
const activeId = session.data?.session.activeOrganizationId ?? null;
|
|
4220
4224
|
const active = organizations?.find((organization) => organization.id === activeId) ?? null;
|
|
4221
|
-
|
|
4225
|
+
React63.useEffect(() => {
|
|
4222
4226
|
if (!open) return;
|
|
4223
4227
|
const onPointerDown = (event) => {
|
|
4224
4228
|
if (!rootRef.current?.contains(event.target)) setOpen(false);
|
|
@@ -4233,9 +4237,9 @@ function OrganizationSwitcherContent({ showPersonalWorkspace = true, onOrganizat
|
|
|
4233
4237
|
document.removeEventListener("keydown", onKeyDown);
|
|
4234
4238
|
};
|
|
4235
4239
|
}, [open]);
|
|
4236
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */ (0,
|
|
4240
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-label": t("organization.loading") });
|
|
4237
4241
|
if (config?.organizations !== true) return null;
|
|
4238
|
-
if (!isSignedIn) return /* @__PURE__ */ (0,
|
|
4242
|
+
if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
4239
4243
|
const select = (organization) => {
|
|
4240
4244
|
void run(
|
|
4241
4245
|
() => api.setActive({ organizationId: organization?.id ?? null }),
|
|
@@ -4278,9 +4282,9 @@ function OrganizationSwitcherContent({ showPersonalWorkspace = true, onOrganizat
|
|
|
4278
4282
|
else if (event.key === "ArrowDown") items[(current + 1 + items.length) % items.length]?.focus();
|
|
4279
4283
|
else items[(current - 1 + items.length) % items.length]?.focus();
|
|
4280
4284
|
};
|
|
4281
|
-
return /* @__PURE__ */ (0,
|
|
4282
|
-
/* @__PURE__ */ (0,
|
|
4283
|
-
/* @__PURE__ */ (0,
|
|
4285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
|
|
4286
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { ref: rootRef, className: "ba-organization-switcher", children: [
|
|
4287
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
4284
4288
|
"button",
|
|
4285
4289
|
{
|
|
4286
4290
|
ref: triggerRef,
|
|
@@ -4297,43 +4301,43 @@ function OrganizationSwitcherContent({ showPersonalWorkspace = true, onOrganizat
|
|
|
4297
4301
|
focusMenuItem(event.key === "ArrowDown" ? "first" : "last");
|
|
4298
4302
|
},
|
|
4299
4303
|
children: [
|
|
4300
|
-
/* @__PURE__ */ (0,
|
|
4301
|
-
/* @__PURE__ */ (0,
|
|
4302
|
-
/* @__PURE__ */ (0,
|
|
4304
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: active?.name.trim().charAt(0).toUpperCase() || "P" }),
|
|
4305
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { children: active?.name ?? t("organization.personal") }),
|
|
4306
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { "aria-hidden": "true", children: "\u2304" })
|
|
4303
4307
|
]
|
|
4304
4308
|
}
|
|
4305
4309
|
),
|
|
4306
|
-
open && /* @__PURE__ */ (0,
|
|
4307
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
4308
|
-
showPersonalWorkspace && /* @__PURE__ */ (0,
|
|
4309
|
-
/* @__PURE__ */ (0,
|
|
4310
|
-
/* @__PURE__ */ (0,
|
|
4310
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { ref: menuRef, id: menuId, className: "ba-organization-menu", role: "menu", "aria-label": t("organization.switcher.label"), onKeyDown: onMenuKeyDown, children: [
|
|
4311
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "ba-skeleton" }) : /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
|
|
4312
|
+
showPersonalWorkspace && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === null ? "true" : void 0, disabled: pending, onClick: () => select(null), children: [
|
|
4313
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: "P" }),
|
|
4314
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { children: t("organization.personal") })
|
|
4311
4315
|
] }),
|
|
4312
|
-
organizations?.map((organization) => /* @__PURE__ */ (0,
|
|
4313
|
-
/* @__PURE__ */ (0,
|
|
4314
|
-
/* @__PURE__ */ (0,
|
|
4316
|
+
organizations?.map((organization) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === organization.id ? "true" : void 0, disabled: pending, onClick: () => select(organization), children: [
|
|
4317
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
4318
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("span", { children: [
|
|
4315
4319
|
organization.name,
|
|
4316
|
-
/* @__PURE__ */ (0,
|
|
4320
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("small", { children: organization.slug })
|
|
4317
4321
|
] })
|
|
4318
4322
|
] }, organization.id))
|
|
4319
4323
|
] }),
|
|
4320
|
-
(loadError || error) && /* @__PURE__ */ (0,
|
|
4321
|
-
/* @__PURE__ */ (0,
|
|
4322
|
-
loadError && /* @__PURE__ */ (0,
|
|
4324
|
+
(loadError || error) && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "ba-inline-error", children: [
|
|
4325
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(FormError, { children: loadError ?? error }),
|
|
4326
|
+
loadError && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
|
|
4323
4327
|
] }),
|
|
4324
|
-
/* @__PURE__ */ (0,
|
|
4325
|
-
active && /* @__PURE__ */ (0,
|
|
4328
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "ba-organization-menu-actions", children: [
|
|
4329
|
+
active && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
|
|
4326
4330
|
setOpen(false);
|
|
4327
4331
|
setDialog("profile");
|
|
4328
4332
|
}, children: t("organization.switcher.manage") }),
|
|
4329
|
-
/* @__PURE__ */ (0,
|
|
4333
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
|
|
4330
4334
|
setOpen(false);
|
|
4331
4335
|
setDialog("create");
|
|
4332
4336
|
}, children: t("organization.switcher.create") })
|
|
4333
4337
|
] })
|
|
4334
4338
|
] })
|
|
4335
4339
|
] }),
|
|
4336
|
-
dialog === "create" && /* @__PURE__ */ (0,
|
|
4340
|
+
dialog === "create" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
4337
4341
|
CreateOrganization,
|
|
4338
4342
|
{
|
|
4339
4343
|
title: null,
|
|
@@ -4347,15 +4351,15 @@ function OrganizationSwitcherContent({ showPersonalWorkspace = true, onOrganizat
|
|
|
4347
4351
|
}
|
|
4348
4352
|
}
|
|
4349
4353
|
) }),
|
|
4350
|
-
dialog === "profile" && active && /* @__PURE__ */ (0,
|
|
4354
|
+
dialog === "profile" && active && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(OrganizationProfile, { organizationId: active.id, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
|
|
4351
4355
|
] });
|
|
4352
4356
|
}
|
|
4353
|
-
var
|
|
4357
|
+
var React63, import_jsx_runtime67;
|
|
4354
4358
|
var init_OrganizationSwitcherContent = __esm({
|
|
4355
4359
|
"src/components/OrganizationSwitcherContent.tsx"() {
|
|
4356
4360
|
"use strict";
|
|
4357
4361
|
"use client";
|
|
4358
|
-
|
|
4362
|
+
React63 = __toESM(require("react"), 1);
|
|
4359
4363
|
init_hooks();
|
|
4360
4364
|
init_i18n();
|
|
4361
4365
|
init_CreateOrganization();
|
|
@@ -4364,7 +4368,7 @@ var init_OrganizationSwitcherContent = __esm({
|
|
|
4364
4368
|
init_OrganizationProfile();
|
|
4365
4369
|
init_use_submit_action();
|
|
4366
4370
|
init_FormError();
|
|
4367
|
-
|
|
4371
|
+
import_jsx_runtime67 = require("react/jsx-runtime");
|
|
4368
4372
|
}
|
|
4369
4373
|
});
|
|
4370
4374
|
|
|
@@ -4380,19 +4384,19 @@ function OrganizationListContent({ onOrganizationChange } = {}) {
|
|
|
4380
4384
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
4381
4385
|
const session = useSession();
|
|
4382
4386
|
const api = useAuthClient().organization;
|
|
4383
|
-
const apiRef =
|
|
4387
|
+
const apiRef = React65.useRef(api);
|
|
4384
4388
|
apiRef.current = api;
|
|
4385
4389
|
const enabled = config?.organizations === true && isSignedIn;
|
|
4386
4390
|
const { organizations, isLoading, error: organizationError, refresh } = useOrganizationsResource(enabled);
|
|
4387
4391
|
const { pending, error, run } = useSubmitAction();
|
|
4388
|
-
const [invitations, setInvitations] =
|
|
4389
|
-
const [invitationError, setInvitationError] =
|
|
4390
|
-
const [dialog, setDialog] =
|
|
4391
|
-
const [profileId, setProfileId] =
|
|
4392
|
-
const dialogReturnFocusRef =
|
|
4393
|
-
const invitationRequestRef =
|
|
4392
|
+
const [invitations, setInvitations] = React65.useState(null);
|
|
4393
|
+
const [invitationError, setInvitationError] = React65.useState(null);
|
|
4394
|
+
const [dialog, setDialog] = React65.useState(null);
|
|
4395
|
+
const [profileId, setProfileId] = React65.useState(null);
|
|
4396
|
+
const dialogReturnFocusRef = React65.useRef(null);
|
|
4397
|
+
const invitationRequestRef = React65.useRef(0);
|
|
4394
4398
|
const activeId = session.data?.session.activeOrganizationId ?? null;
|
|
4395
|
-
const loadInvitations =
|
|
4399
|
+
const loadInvitations = React65.useCallback(async () => {
|
|
4396
4400
|
const token = ++invitationRequestRef.current;
|
|
4397
4401
|
if (!enabled) {
|
|
4398
4402
|
setInvitations([]);
|
|
@@ -4412,7 +4416,7 @@ function OrganizationListContent({ onOrganizationChange } = {}) {
|
|
|
4412
4416
|
if (token === invitationRequestRef.current) setInvitationError(t("organization.list.invitationsError"));
|
|
4413
4417
|
}
|
|
4414
4418
|
}, [enabled, t, toServerError]);
|
|
4415
|
-
|
|
4419
|
+
React65.useEffect(() => {
|
|
4416
4420
|
setInvitations(null);
|
|
4417
4421
|
setInvitationError(null);
|
|
4418
4422
|
if (!isLoaded) return;
|
|
@@ -4421,9 +4425,9 @@ function OrganizationListContent({ onOrganizationChange } = {}) {
|
|
|
4421
4425
|
invitationRequestRef.current += 1;
|
|
4422
4426
|
};
|
|
4423
4427
|
}, [isLoaded, loadInvitations, user?.id]);
|
|
4424
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */ (0,
|
|
4428
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
4425
4429
|
if (config?.organizations !== true) return null;
|
|
4426
|
-
if (!isSignedIn) return /* @__PURE__ */ (0,
|
|
4430
|
+
if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
4427
4431
|
const setActive = (organization) => {
|
|
4428
4432
|
void run(
|
|
4429
4433
|
() => api.setActive({ organizationId: organization.id }),
|
|
@@ -4464,74 +4468,74 @@ function OrganizationListContent({ onOrganizationChange } = {}) {
|
|
|
4464
4468
|
setDialog(null);
|
|
4465
4469
|
setProfileId(null);
|
|
4466
4470
|
};
|
|
4467
|
-
return /* @__PURE__ */ (0,
|
|
4468
|
-
/* @__PURE__ */ (0,
|
|
4469
|
-
/* @__PURE__ */ (0,
|
|
4470
|
-
/* @__PURE__ */ (0,
|
|
4471
|
-
/* @__PURE__ */ (0,
|
|
4472
|
-
/* @__PURE__ */ (0,
|
|
4471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
4472
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("section", { className: "ba-organization-directory", children: [
|
|
4473
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("header", { className: "ba-organization-directory-header", children: [
|
|
4474
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { children: [
|
|
4475
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("h2", { className: "ba-title", children: t("organization.list.title") }),
|
|
4476
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "ba-muted", children: t("organization.list.description") })
|
|
4473
4477
|
] }),
|
|
4474
|
-
/* @__PURE__ */ (0,
|
|
4478
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { className: "ba-button", type: "button", onClick: (event) => {
|
|
4475
4479
|
dialogReturnFocusRef.current = event.currentTarget;
|
|
4476
4480
|
setDialog("create");
|
|
4477
4481
|
}, children: t("organization.switcher.create") })
|
|
4478
4482
|
] }),
|
|
4479
|
-
(organizationError || error) && /* @__PURE__ */ (0,
|
|
4480
|
-
/* @__PURE__ */ (0,
|
|
4481
|
-
organizationError && /* @__PURE__ */ (0,
|
|
4483
|
+
(organizationError || error) && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ba-inline-error", children: [
|
|
4484
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(FormError, { children: organizationError ?? error }),
|
|
4485
|
+
organizationError && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
|
|
4482
4486
|
] }),
|
|
4483
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
4484
|
-
/* @__PURE__ */ (0,
|
|
4485
|
-
/* @__PURE__ */ (0,
|
|
4486
|
-
] }) : organizations?.length ? /* @__PURE__ */ (0,
|
|
4487
|
-
/* @__PURE__ */ (0,
|
|
4488
|
-
/* @__PURE__ */ (0,
|
|
4489
|
-
/* @__PURE__ */ (0,
|
|
4490
|
-
/* @__PURE__ */ (0,
|
|
4487
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ba-organization-card-grid", children: [
|
|
4488
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ba-skeleton" }),
|
|
4489
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ba-skeleton" })
|
|
4490
|
+
] }) : organizations?.length ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("ul", { className: "ba-organization-card-grid", children: organizations.map((organization) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("li", { className: "ba-organization-card", children: [
|
|
4491
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
4492
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { className: "ba-organization-card-copy", children: [
|
|
4493
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("strong", { children: organization.name }),
|
|
4494
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("small", { children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Bidi, { children: organization.slug }) })
|
|
4491
4495
|
] }),
|
|
4492
|
-
activeId === organization.id && /* @__PURE__ */ (0,
|
|
4493
|
-
/* @__PURE__ */ (0,
|
|
4494
|
-
activeId !== organization.id && /* @__PURE__ */ (0,
|
|
4495
|
-
/* @__PURE__ */ (0,
|
|
4496
|
+
activeId === organization.id && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ba-organization-active", children: t("organization.list.active") }),
|
|
4497
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { className: "ba-organization-card-actions", children: [
|
|
4498
|
+
activeId !== organization.id && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: () => setActive(organization), children: t("organization.list.switch") }),
|
|
4499
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { className: "ba-link-button", type: "button", onClick: (event) => openProfile(organization, event.currentTarget), children: t("organization.list.manage") })
|
|
4496
4500
|
] })
|
|
4497
|
-
] }, organization.id)) }) : organizationError ? null : /* @__PURE__ */ (0,
|
|
4498
|
-
/* @__PURE__ */ (0,
|
|
4499
|
-
/* @__PURE__ */ (0,
|
|
4500
|
-
/* @__PURE__ */ (0,
|
|
4501
|
-
/* @__PURE__ */ (0,
|
|
4501
|
+
] }, organization.id)) }) : organizationError ? null : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "ba-muted", children: t("organization.list.empty") }),
|
|
4502
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("section", { className: "ba-organization-user-invitations", children: [
|
|
4503
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
4504
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("h3", { className: "ba-title", children: t("organization.list.invitationsTitle") }),
|
|
4505
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "ba-muted", children: t("organization.list.invitationsDescription") })
|
|
4502
4506
|
] }),
|
|
4503
|
-
invitationError && /* @__PURE__ */ (0,
|
|
4504
|
-
/* @__PURE__ */ (0,
|
|
4505
|
-
/* @__PURE__ */ (0,
|
|
4507
|
+
invitationError && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ba-inline-error", children: [
|
|
4508
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(FormError, { children: invitationError }),
|
|
4509
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void loadInvitations(), children: t("organization.retry") })
|
|
4506
4510
|
] }),
|
|
4507
|
-
invitations?.length ? /* @__PURE__ */ (0,
|
|
4508
|
-
/* @__PURE__ */ (0,
|
|
4509
|
-
/* @__PURE__ */ (0,
|
|
4510
|
-
/* @__PURE__ */ (0,
|
|
4511
|
+
invitations?.length ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("li", { className: "ba-organization-invitation", children: [
|
|
4512
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { children: [
|
|
4513
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("strong", { children: invitation.organizationName }),
|
|
4514
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("small", { children: organizationRoleLabel(invitation.role, t) })
|
|
4511
4515
|
] }),
|
|
4512
|
-
/* @__PURE__ */ (0,
|
|
4513
|
-
/* @__PURE__ */ (0,
|
|
4514
|
-
/* @__PURE__ */ (0,
|
|
4516
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { className: "ba-organization-card-actions", children: [
|
|
4517
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { className: "ba-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "accept"), children: t("organization.list.accept") }),
|
|
4518
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "reject"), children: t("organization.list.reject") })
|
|
4515
4519
|
] })
|
|
4516
|
-
] }, invitation.id)) }) : invitationError ? null : invitations === null ? /* @__PURE__ */ (0,
|
|
4520
|
+
] }, invitation.id)) }) : invitationError ? null : invitations === null ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ba-skeleton" }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "ba-muted", children: t("organization.list.noInvitations") })
|
|
4517
4521
|
] })
|
|
4518
4522
|
] }),
|
|
4519
|
-
dialog === "create" && /* @__PURE__ */ (0,
|
|
4523
|
+
dialog === "create" && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(CreateOrganization, { title: null, onCreated: () => {
|
|
4520
4524
|
void (async () => {
|
|
4521
4525
|
await refresh();
|
|
4522
4526
|
await session.refetch({ query: { disableCookieCache: true } });
|
|
4523
4527
|
setDialog(null);
|
|
4524
4528
|
})();
|
|
4525
4529
|
} }) }),
|
|
4526
|
-
dialog === "profile" && profileId && /* @__PURE__ */ (0,
|
|
4530
|
+
dialog === "profile" && profileId && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(OrganizationProfile, { organizationId: profileId, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
|
|
4527
4531
|
] });
|
|
4528
4532
|
}
|
|
4529
|
-
var
|
|
4533
|
+
var React65, import_jsx_runtime69;
|
|
4530
4534
|
var init_OrganizationListContent = __esm({
|
|
4531
4535
|
"src/components/OrganizationListContent.tsx"() {
|
|
4532
4536
|
"use strict";
|
|
4533
4537
|
"use client";
|
|
4534
|
-
|
|
4538
|
+
React65 = __toESM(require("react"), 1);
|
|
4535
4539
|
init_hooks();
|
|
4536
4540
|
init_i18n();
|
|
4537
4541
|
init_CreateOrganization();
|
|
@@ -4541,7 +4545,7 @@ var init_OrganizationListContent = __esm({
|
|
|
4541
4545
|
init_OrganizationProfile();
|
|
4542
4546
|
init_use_submit_action();
|
|
4543
4547
|
init_FormError();
|
|
4544
|
-
|
|
4548
|
+
import_jsx_runtime69 = require("react/jsx-runtime");
|
|
4545
4549
|
}
|
|
4546
4550
|
});
|
|
4547
4551
|
|
|
@@ -4552,7 +4556,7 @@ __export(index_exports, {
|
|
|
4552
4556
|
AuthLoading: () => AuthLoading,
|
|
4553
4557
|
AuthOwlBadge: () => AuthOwlBadge,
|
|
4554
4558
|
AuthOwlBranding: () => AuthOwlBranding,
|
|
4555
|
-
AuthOwlError: () =>
|
|
4559
|
+
AuthOwlError: () => import_core11.AuthOwlError,
|
|
4556
4560
|
AuthOwlProvider: () => AuthOwlProvider,
|
|
4557
4561
|
BackupCodesManager: () => BackupCodesManager,
|
|
4558
4562
|
Bidi: () => Bidi,
|
|
@@ -4563,7 +4567,7 @@ __export(index_exports, {
|
|
|
4563
4567
|
EmailOtpForm: () => EmailOtpForm,
|
|
4564
4568
|
ForgotPassword: () => ForgotPassword,
|
|
4565
4569
|
GoogleOneTap: () => GoogleOneTap,
|
|
4566
|
-
InvalidKeyError: () =>
|
|
4570
|
+
InvalidKeyError: () => import_core11.InvalidKeyError,
|
|
4567
4571
|
InvitationPrompt: () => InvitationPrompt,
|
|
4568
4572
|
KNOWN_METHODS: () => KNOWN_METHODS,
|
|
4569
4573
|
MFAChallenge: () => MFAChallenge,
|
|
@@ -4575,11 +4579,13 @@ __export(index_exports, {
|
|
|
4575
4579
|
OrganizationSwitcher: () => OrganizationSwitcher,
|
|
4576
4580
|
PasskeyButton: () => PasskeyButton,
|
|
4577
4581
|
PasskeyManager: () => PasskeyManager,
|
|
4582
|
+
PasskeyOfferGate: () => PasskeyOfferGate,
|
|
4578
4583
|
PhoneOTP: () => PhoneOTP,
|
|
4579
4584
|
PrivacyCenter: () => PrivacyCenter,
|
|
4580
4585
|
Protect: () => Protect,
|
|
4581
|
-
RateLimitedError: () =>
|
|
4586
|
+
RateLimitedError: () => import_core11.RateLimitedError,
|
|
4582
4587
|
ResetPassword: () => ResetPassword,
|
|
4588
|
+
SECOND_FACTOR_REQUIRED: () => SECOND_FACTOR_REQUIRED,
|
|
4583
4589
|
SignIn: () => SignIn,
|
|
4584
4590
|
SignOutButton: () => SignOutButton,
|
|
4585
4591
|
SignUp: () => SignUp,
|
|
@@ -4592,11 +4598,11 @@ __export(index_exports, {
|
|
|
4592
4598
|
VerificationPending: () => VerificationPending,
|
|
4593
4599
|
VerifyEmail: () => VerifyEmail,
|
|
4594
4600
|
Waitlist: () => Waitlist,
|
|
4595
|
-
createMembershipHas: () =>
|
|
4601
|
+
createMembershipHas: () => import_core12.createMembershipHas,
|
|
4596
4602
|
emailAutocomplete: () => emailAutocomplete,
|
|
4597
|
-
membershipHas: () =>
|
|
4598
|
-
membershipHasPermission: () =>
|
|
4599
|
-
membershipHasTeam: () =>
|
|
4603
|
+
membershipHas: () => import_core12.membershipHas,
|
|
4604
|
+
membershipHasPermission: () => import_core12.membershipHasPermission,
|
|
4605
|
+
membershipHasTeam: () => import_core12.membershipHasTeam,
|
|
4600
4606
|
resolveSignInMethods: () => resolveSignInMethods,
|
|
4601
4607
|
useAccount: () => useAccount,
|
|
4602
4608
|
useAuth: () => useAuth,
|
|
@@ -4618,6 +4624,7 @@ __export(index_exports, {
|
|
|
4618
4624
|
useSignIn: () => useSignIn,
|
|
4619
4625
|
useSignOut: () => useSignOut,
|
|
4620
4626
|
useSignUp: () => useSignUp,
|
|
4627
|
+
useStepUpAction: () => useStepUpAction,
|
|
4621
4628
|
useUser: () => useUser,
|
|
4622
4629
|
useWaitlist: () => useWaitlist
|
|
4623
4630
|
});
|
|
@@ -4656,6 +4663,13 @@ function passkeyReachableFrom(authBaseUrl, pageHost, relyingPartyId) {
|
|
|
4656
4663
|
if (rpId !== "localhost" && !rpId.includes(".")) return false;
|
|
4657
4664
|
return pageHost === rpId || pageHost.endsWith(`.${rpId}`);
|
|
4658
4665
|
}
|
|
4666
|
+
function passkeyReachableForConfig(config, pageHost) {
|
|
4667
|
+
return passkeyReachableFrom(
|
|
4668
|
+
config?.authBaseUrl,
|
|
4669
|
+
pageHost,
|
|
4670
|
+
config?.authentication?.passkey?.relyingPartyId
|
|
4671
|
+
);
|
|
4672
|
+
}
|
|
4659
4673
|
function resolveSignInMethods(config, pageHost) {
|
|
4660
4674
|
const methods = config?.enabledMethods ?? ["password"];
|
|
4661
4675
|
const social = config?.socialProviders ?? [];
|
|
@@ -4666,11 +4680,7 @@ function resolveSignInMethods(config, pageHost) {
|
|
|
4666
4680
|
const magicLink = capabilities.magicLinkSignIn;
|
|
4667
4681
|
const emailOtp = capabilities.emailOtpSignIn && !capabilities.totp && !capabilities.mfaRequired;
|
|
4668
4682
|
const phoneOtp = capabilities.phoneSignIn && !capabilities.mfaRequired;
|
|
4669
|
-
const passkey = capabilities.passkeySignIn &&
|
|
4670
|
-
config?.authBaseUrl,
|
|
4671
|
-
pageHost,
|
|
4672
|
-
config?.authentication?.passkey?.relyingPartyId
|
|
4673
|
-
);
|
|
4683
|
+
const passkey = capabilities.passkeySignIn && passkeyReachableForConfig(config, pageHost);
|
|
4674
4684
|
const sso = has("sso");
|
|
4675
4685
|
const renderable = password || username || magicLink || emailOtp || phoneOtp || passkey || sso || social.length > 0;
|
|
4676
4686
|
const emptyReason = renderable ? null : methods.length > 0 ? "unsupported" : "none";
|
|
@@ -5237,7 +5247,12 @@ init_use_submit_action();
|
|
|
5237
5247
|
init_Spinner();
|
|
5238
5248
|
init_FormError();
|
|
5239
5249
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
5240
|
-
function MFAChallenge({
|
|
5250
|
+
function MFAChallenge({
|
|
5251
|
+
onVerified,
|
|
5252
|
+
allowTrustDevice = true,
|
|
5253
|
+
variant = "sign-in",
|
|
5254
|
+
onCancel
|
|
5255
|
+
}) {
|
|
5241
5256
|
const t = useT();
|
|
5242
5257
|
const { config } = usePublicConfig();
|
|
5243
5258
|
const { verifyTotp, verifyBackupCode, sendOtp, verifyOtp } = useMFA();
|
|
@@ -5245,7 +5260,8 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
|
|
|
5245
5260
|
const [mode, setMode] = React12.useState("totp");
|
|
5246
5261
|
const [code, setCode] = React12.useState("");
|
|
5247
5262
|
const [trustDevice, setTrustDevice] = React12.useState(false);
|
|
5248
|
-
const
|
|
5263
|
+
const stepUp = variant === "step-up";
|
|
5264
|
+
const canTrustDevice = !stepUp && allowTrustDevice && (config?.mfa?.trustDevice ?? true);
|
|
5249
5265
|
const canUseEmailOtp = config?.mfa?.emailOtpFallback ?? true;
|
|
5250
5266
|
React12.useEffect(() => {
|
|
5251
5267
|
if (!canTrustDevice) setTrustDevice(false);
|
|
@@ -5278,7 +5294,7 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
|
|
|
5278
5294
|
const hint = mode === "totp" ? t("mfa.challenge.totpHint") : mode === "backup" ? t("mfa.challenge.backupHint") : t("mfa.challenge.otpHint");
|
|
5279
5295
|
const label2 = mode === "totp" ? t("mfa.challenge.totpLabel") : mode === "backup" ? t("mfa.challenge.backupLabel") : t("mfa.challenge.otpLabel");
|
|
5280
5296
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("form", { method: "post", className: "ba-fields", "data-testid": "mfa-challenge", onSubmit: submit, children: [
|
|
5281
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h2", { className: "ba-title", children: t("mfa.challenge.title") }),
|
|
5297
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h2", { className: "ba-title", children: t(stepUp ? "mfa.stepUp.title" : "mfa.challenge.title") }),
|
|
5282
5298
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "ba-muted", children: hint }),
|
|
5283
5299
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "ba-label", children: [
|
|
5284
5300
|
label2,
|
|
@@ -5309,7 +5325,8 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
|
|
|
5309
5325
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { className: "ba-button", type: "submit", disabled: pending || !code, "aria-busy": pending || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Busy, { busy: pending, label: t("common.verifying"), children: t("mfa.challenge.submit") }) }),
|
|
5310
5326
|
mode !== "totp" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "ba-link-button", onClick: () => switchMode("totp"), children: t("mfa.challenge.useTotp") }),
|
|
5311
5327
|
mode !== "backup" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "ba-link-button", onClick: () => switchMode("backup"), children: t("mfa.challenge.useBackup") }),
|
|
5312
|
-
canUseEmailOtp && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "ba-link-button", disabled: pending, onClick: requestOtp, children: t(mode === "otp" ? "mfa.challenge.resendOtp" : "mfa.challenge.useEmailOtp") })
|
|
5328
|
+
canUseEmailOtp && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "ba-link-button", disabled: pending, onClick: requestOtp, children: t(mode === "otp" ? "mfa.challenge.resendOtp" : "mfa.challenge.useEmailOtp") }),
|
|
5329
|
+
onCancel && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "ba-link-button", disabled: pending, onClick: onCancel, children: t("common.cancel") })
|
|
5313
5330
|
] });
|
|
5314
5331
|
}
|
|
5315
5332
|
|
|
@@ -6604,20 +6621,37 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
6604
6621
|
);
|
|
6605
6622
|
}
|
|
6606
6623
|
|
|
6607
|
-
// src/components/
|
|
6624
|
+
// src/components/PasskeyOffer.tsx
|
|
6608
6625
|
init_hooks();
|
|
6609
6626
|
init_i18n();
|
|
6610
6627
|
init_use_submit_action();
|
|
6611
6628
|
init_Spinner();
|
|
6612
6629
|
init_FormError();
|
|
6613
6630
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
6614
|
-
|
|
6631
|
+
var COPY = {
|
|
6632
|
+
"sign-up": {
|
|
6633
|
+
title: "signUp.passkeyTitle",
|
|
6634
|
+
body: "signUp.passkeyDescription",
|
|
6635
|
+
submit: "signUp.passkeySubmit",
|
|
6636
|
+
skip: "signUp.passkeySkip",
|
|
6637
|
+
failed: "signUp.error.passkeyFailed"
|
|
6638
|
+
},
|
|
6639
|
+
"sign-in": {
|
|
6640
|
+
title: "passkeyOffer.title",
|
|
6641
|
+
body: "passkeyOffer.description",
|
|
6642
|
+
submit: "passkeyOffer.submit",
|
|
6643
|
+
skip: "passkeyOffer.skip",
|
|
6644
|
+
failed: "passkeyOffer.error"
|
|
6645
|
+
}
|
|
6646
|
+
};
|
|
6647
|
+
function PasskeyOffer({ onComplete, variant, title }) {
|
|
6615
6648
|
const t = useT();
|
|
6616
6649
|
const { addPasskey } = usePasskeys();
|
|
6617
6650
|
const { pending, error, run } = useSubmitAction();
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("
|
|
6651
|
+
const copy = COPY[variant];
|
|
6652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "ba-fields", "data-testid": "passkey-offer", children: [
|
|
6653
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "ba-title", children: title ?? t(copy.title) }),
|
|
6654
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "ba-muted", children: t(copy.body) }),
|
|
6621
6655
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FormError, { children: error }),
|
|
6622
6656
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
6623
6657
|
"button",
|
|
@@ -6627,13 +6661,13 @@ function PasskeySignUpCompletion({ onComplete }) {
|
|
|
6627
6661
|
disabled: pending,
|
|
6628
6662
|
"aria-busy": pending || void 0,
|
|
6629
6663
|
onClick: () => void run(() => addPasskey(), {
|
|
6630
|
-
failure: t(
|
|
6631
|
-
onSuccess: onComplete
|
|
6664
|
+
failure: t(copy.failed),
|
|
6665
|
+
onSuccess: () => onComplete(true)
|
|
6632
6666
|
}),
|
|
6633
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Busy, { busy: pending, label: t("passkey.waiting"), children: t(
|
|
6667
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Busy, { busy: pending, label: t("passkey.waiting"), children: t(copy.submit) })
|
|
6634
6668
|
}
|
|
6635
6669
|
),
|
|
6636
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: onComplete, children: t(
|
|
6670
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => onComplete(false), children: t(copy.skip) })
|
|
6637
6671
|
] });
|
|
6638
6672
|
}
|
|
6639
6673
|
|
|
@@ -6902,7 +6936,7 @@ function SignUp({
|
|
|
6902
6936
|
if (completeWithPasskey) {
|
|
6903
6937
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "ba-form", "data-testid": "signup-passkey-step", children: [
|
|
6904
6938
|
showBranding ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AuthOwlBranding, {}) : null,
|
|
6905
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6939
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PasskeyOffer, { variant: "sign-up", onComplete: finishSignUp }),
|
|
6906
6940
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AuthOwlBadge, { force: showBadge })
|
|
6907
6941
|
] });
|
|
6908
6942
|
}
|
|
@@ -7118,10 +7152,56 @@ function MFARequiredGate({ children, title }) {
|
|
|
7118
7152
|
}
|
|
7119
7153
|
|
|
7120
7154
|
// src/components/BackupCodesManager.tsx
|
|
7121
|
-
var
|
|
7155
|
+
var React26 = __toESM(require("react"), 1);
|
|
7122
7156
|
init_hooks();
|
|
7123
7157
|
init_i18n();
|
|
7158
|
+
|
|
7159
|
+
// src/components/use-step-up-action.ts
|
|
7160
|
+
var React25 = __toESM(require("react"), 1);
|
|
7124
7161
|
init_use_submit_action();
|
|
7162
|
+
var SECOND_FACTOR_REQUIRED = "SECOND_FACTOR_REQUIRED";
|
|
7163
|
+
function useStepUpAction() {
|
|
7164
|
+
const { pending, error, setError, run } = useSubmitAction();
|
|
7165
|
+
const attempt = React25.useRef(null);
|
|
7166
|
+
const [stepUpRequired, setStepUpRequired] = React25.useState(false);
|
|
7167
|
+
const park = React25.useCallback((next) => {
|
|
7168
|
+
if (next !== null && attempt.current !== null) return false;
|
|
7169
|
+
attempt.current = next;
|
|
7170
|
+
setStepUpRequired(next !== null);
|
|
7171
|
+
return true;
|
|
7172
|
+
}, []);
|
|
7173
|
+
const epoch = React25.useRef(0);
|
|
7174
|
+
const guardedRun = React25.useCallback(
|
|
7175
|
+
(action, opts) => {
|
|
7176
|
+
const send = () => {
|
|
7177
|
+
const era = epoch.current;
|
|
7178
|
+
return run(action, {
|
|
7179
|
+
...opts,
|
|
7180
|
+
intercept: (failure) => {
|
|
7181
|
+
if (failure.code !== SECOND_FACTOR_REQUIRED) return opts.intercept?.(failure) ?? false;
|
|
7182
|
+
if (era !== epoch.current) return true;
|
|
7183
|
+
return park(send);
|
|
7184
|
+
}
|
|
7185
|
+
});
|
|
7186
|
+
};
|
|
7187
|
+
return send();
|
|
7188
|
+
},
|
|
7189
|
+
[run, park]
|
|
7190
|
+
);
|
|
7191
|
+
const resume = React25.useCallback(() => {
|
|
7192
|
+
const send = attempt.current;
|
|
7193
|
+
park(null);
|
|
7194
|
+
void send?.();
|
|
7195
|
+
}, [park]);
|
|
7196
|
+
const cancel = React25.useCallback(() => {
|
|
7197
|
+
epoch.current += 1;
|
|
7198
|
+
park(null);
|
|
7199
|
+
setError(null);
|
|
7200
|
+
}, [park, setError]);
|
|
7201
|
+
return { pending, error, setError, stepUpRequired, run: guardedRun, resume, cancel };
|
|
7202
|
+
}
|
|
7203
|
+
|
|
7204
|
+
// src/components/BackupCodesManager.tsx
|
|
7125
7205
|
init_Spinner();
|
|
7126
7206
|
init_FormError();
|
|
7127
7207
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
@@ -7129,10 +7209,14 @@ function BackupCodesManager({ title }) {
|
|
|
7129
7209
|
const t = useT();
|
|
7130
7210
|
const { user } = useUser();
|
|
7131
7211
|
const { regenerateBackupCodes } = useMFA();
|
|
7132
|
-
const { pending, error, run } =
|
|
7133
|
-
const [password, setPassword] =
|
|
7134
|
-
const [codes, setCodes] =
|
|
7212
|
+
const { pending, error, stepUpRequired, run, resume, cancel } = useStepUpAction();
|
|
7213
|
+
const [password, setPassword] = React26.useState("");
|
|
7214
|
+
const [codes, setCodes] = React26.useState(null);
|
|
7135
7215
|
if (!user?.twoFactorEnabled) return null;
|
|
7216
|
+
const cancelStepUp = () => {
|
|
7217
|
+
cancel();
|
|
7218
|
+
setPassword("");
|
|
7219
|
+
};
|
|
7136
7220
|
const submit = (e) => {
|
|
7137
7221
|
e.preventDefault();
|
|
7138
7222
|
void run(() => regenerateBackupCodes({ password }), {
|
|
@@ -7153,7 +7237,7 @@ function BackupCodesManager({ title }) {
|
|
|
7153
7237
|
t("mfa.enroll.backupCodesWarningRest")
|
|
7154
7238
|
] }),
|
|
7155
7239
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("ul", { className: "ba-passkey-list", "data-testid": "backup-codes-list", children: codes.map((c) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("li", { className: "ba-passkey-item", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("bdi", { children: c }) }) }, c)) })
|
|
7156
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
7240
|
+
] }) : stepUpRequired ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(MFAChallenge, { variant: "step-up", onVerified: resume, onCancel: cancelStepUp }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
7157
7241
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "ba-label", children: [
|
|
7158
7242
|
t("common.passwordLabel"),
|
|
7159
7243
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -7175,7 +7259,7 @@ function BackupCodesManager({ title }) {
|
|
|
7175
7259
|
}
|
|
7176
7260
|
|
|
7177
7261
|
// src/components/MagicLinkForm.tsx
|
|
7178
|
-
var
|
|
7262
|
+
var React27 = __toESM(require("react"), 1);
|
|
7179
7263
|
init_hooks();
|
|
7180
7264
|
init_i18n();
|
|
7181
7265
|
init_use_submit_action();
|
|
@@ -7187,8 +7271,8 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
7187
7271
|
const { signInMagicLink } = useSignIn();
|
|
7188
7272
|
const { pending, error, run } = useSubmitAction();
|
|
7189
7273
|
const authChallenge = useAuthChallenge();
|
|
7190
|
-
const [email, setEmail] =
|
|
7191
|
-
const [sent, setSent] =
|
|
7274
|
+
const [email, setEmail] = React27.useState("");
|
|
7275
|
+
const [sent, setSent] = React27.useState(false);
|
|
7192
7276
|
if (sent) {
|
|
7193
7277
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "ba-muted", "data-testid": "magiclink-sent", children: t("magicLink.sent") });
|
|
7194
7278
|
}
|
|
@@ -7238,7 +7322,7 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
7238
7322
|
}
|
|
7239
7323
|
|
|
7240
7324
|
// src/components/EmailOtpForm.tsx
|
|
7241
|
-
var
|
|
7325
|
+
var React28 = __toESM(require("react"), 1);
|
|
7242
7326
|
init_hooks();
|
|
7243
7327
|
init_i18n();
|
|
7244
7328
|
init_use_submit_action();
|
|
@@ -7251,9 +7335,9 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
7251
7335
|
const { sendEmailOtp, signInEmailOtp } = useSignIn();
|
|
7252
7336
|
const { pending, error, setError, run } = useSubmitAction();
|
|
7253
7337
|
const authChallenge = useAuthChallenge();
|
|
7254
|
-
const [email, setEmail] =
|
|
7255
|
-
const [otp, setOtp] =
|
|
7256
|
-
const [stage, setStage] =
|
|
7338
|
+
const [email, setEmail] = React28.useState("");
|
|
7339
|
+
const [otp, setOtp] = React28.useState("");
|
|
7340
|
+
const [stage, setStage] = React28.useState("email");
|
|
7257
7341
|
if (stage === "code") {
|
|
7258
7342
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7259
7343
|
OtpCodeForm,
|
|
@@ -7327,7 +7411,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
7327
7411
|
}
|
|
7328
7412
|
|
|
7329
7413
|
// src/components/ResetPassword.tsx
|
|
7330
|
-
var
|
|
7414
|
+
var React29 = __toESM(require("react"), 1);
|
|
7331
7415
|
init_hooks();
|
|
7332
7416
|
init_i18n();
|
|
7333
7417
|
init_use_submit_action();
|
|
@@ -7341,12 +7425,12 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
7341
7425
|
const capabilities = (0, import_core4.resolveProjectCapabilities)(config);
|
|
7342
7426
|
const { passwordMinLength, passwordMaxLength } = capabilities;
|
|
7343
7427
|
const { pending, error, setError, run } = useSubmitAction();
|
|
7344
|
-
const [token, setToken] =
|
|
7345
|
-
const [ready, setReady] =
|
|
7346
|
-
const [password, setPassword] =
|
|
7347
|
-
const [confirm, setConfirm] =
|
|
7348
|
-
const [done, setDone] =
|
|
7349
|
-
|
|
7428
|
+
const [token, setToken] = React29.useState(tokenProp ?? null);
|
|
7429
|
+
const [ready, setReady] = React29.useState(tokenProp != null);
|
|
7430
|
+
const [password, setPassword] = React29.useState("");
|
|
7431
|
+
const [confirm, setConfirm] = React29.useState("");
|
|
7432
|
+
const [done, setDone] = React29.useState(false);
|
|
7433
|
+
React29.useEffect(() => {
|
|
7350
7434
|
if (tokenProp != null) return;
|
|
7351
7435
|
const params = new URLSearchParams(window.location.search);
|
|
7352
7436
|
setToken(params.get("token"));
|
|
@@ -7433,7 +7517,7 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
7433
7517
|
}
|
|
7434
7518
|
|
|
7435
7519
|
// src/components/VerifyEmail.tsx
|
|
7436
|
-
var
|
|
7520
|
+
var React30 = __toESM(require("react"), 1);
|
|
7437
7521
|
init_hooks();
|
|
7438
7522
|
init_i18n();
|
|
7439
7523
|
init_use_submit_action();
|
|
@@ -7445,11 +7529,11 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
7445
7529
|
const { sendVerificationEmail } = useEmailVerification();
|
|
7446
7530
|
const { pending, error, run } = useSubmitAction();
|
|
7447
7531
|
const authChallenge = useAuthChallenge();
|
|
7448
|
-
const [ready, setReady] =
|
|
7449
|
-
const [failed, setFailed] =
|
|
7450
|
-
const [email, setEmail] =
|
|
7451
|
-
const [resent, setResent] =
|
|
7452
|
-
|
|
7532
|
+
const [ready, setReady] = React30.useState(false);
|
|
7533
|
+
const [failed, setFailed] = React30.useState(false);
|
|
7534
|
+
const [email, setEmail] = React30.useState("");
|
|
7535
|
+
const [resent, setResent] = React30.useState(false);
|
|
7536
|
+
React30.useEffect(() => {
|
|
7453
7537
|
const didFail = new URLSearchParams(window.location.search).has("error");
|
|
7454
7538
|
setFailed(didFail);
|
|
7455
7539
|
setReady(true);
|
|
@@ -7514,7 +7598,7 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
7514
7598
|
}
|
|
7515
7599
|
|
|
7516
7600
|
// src/components/PasskeyManager.tsx
|
|
7517
|
-
var
|
|
7601
|
+
var React31 = __toESM(require("react"), 1);
|
|
7518
7602
|
init_hooks();
|
|
7519
7603
|
init_i18n();
|
|
7520
7604
|
init_use_submit_action();
|
|
@@ -7539,12 +7623,12 @@ function PasskeyManagerBody({
|
|
|
7539
7623
|
const t = useT();
|
|
7540
7624
|
const toServerError = useServerError();
|
|
7541
7625
|
const api = usePasskeys();
|
|
7542
|
-
const apiRef =
|
|
7626
|
+
const apiRef = React31.useRef(api);
|
|
7543
7627
|
apiRef.current = api;
|
|
7544
7628
|
const { pending, error, setError, run } = useSubmitAction();
|
|
7545
|
-
const [passkeys, setPasskeys] =
|
|
7546
|
-
const loadTokenRef =
|
|
7547
|
-
const load =
|
|
7629
|
+
const [passkeys, setPasskeys] = React31.useState(null);
|
|
7630
|
+
const loadTokenRef = React31.useRef(0);
|
|
7631
|
+
const load = React31.useCallback(async () => {
|
|
7548
7632
|
const token = ++loadTokenRef.current;
|
|
7549
7633
|
try {
|
|
7550
7634
|
const res = await apiRef.current.listPasskeys();
|
|
@@ -7560,7 +7644,7 @@ function PasskeyManagerBody({
|
|
|
7560
7644
|
setError(t("passkeys.error.loadFailed"));
|
|
7561
7645
|
}
|
|
7562
7646
|
}, [setError, toServerError, t]);
|
|
7563
|
-
|
|
7647
|
+
React31.useEffect(() => {
|
|
7564
7648
|
void load();
|
|
7565
7649
|
}, [load]);
|
|
7566
7650
|
function onRename(id, current) {
|
|
@@ -7630,19 +7714,96 @@ function PasskeyManagerBody({
|
|
|
7630
7714
|
] });
|
|
7631
7715
|
}
|
|
7632
7716
|
|
|
7633
|
-
// src/components/
|
|
7717
|
+
// src/components/PasskeyOfferGate.tsx
|
|
7718
|
+
var React33 = __toESM(require("react"), 1);
|
|
7719
|
+
|
|
7720
|
+
// src/components/use-passkey-offer.ts
|
|
7721
|
+
var React32 = __toESM(require("react"), 1);
|
|
7634
7722
|
var import_core8 = require("@authowl/core");
|
|
7635
7723
|
init_hooks();
|
|
7724
|
+
function usePasskeyOffer() {
|
|
7725
|
+
const { config } = usePublicConfig();
|
|
7726
|
+
const { user, isSignedIn } = useUser();
|
|
7727
|
+
const { data: sessionData } = useSession();
|
|
7728
|
+
const { listPasskeys } = usePasskeys();
|
|
7729
|
+
const api = React32.useRef(listPasskeys);
|
|
7730
|
+
api.current = listPasskeys;
|
|
7731
|
+
const projectId = config?.environmentId ?? null;
|
|
7732
|
+
const eligible = projectId !== null && isSignedIn && (0, import_core4.resolveProjectCapabilities)(config).passkeyAdd && user?.twoFactorEnabled !== true && typeof window !== "undefined" && "PublicKeyCredential" in window && passkeyReachableForConfig(config, window.location.hostname);
|
|
7733
|
+
const userId = user?.id ?? null;
|
|
7734
|
+
const sessionId = sessionData?.session?.id ?? null;
|
|
7735
|
+
const subject = React32.useMemo(
|
|
7736
|
+
() => eligible && userId && sessionId ? { userId, sessionKey: `${projectId}:${sessionId}:${userId}` } : null,
|
|
7737
|
+
[eligible, projectId, sessionId, userId]
|
|
7738
|
+
);
|
|
7739
|
+
const shouldOffer = React32.useCallback(async () => {
|
|
7740
|
+
if (subject === null || projectId === null || !(0, import_core8.passkeyOfferIsDue)(projectId, subject.userId)) {
|
|
7741
|
+
return false;
|
|
7742
|
+
}
|
|
7743
|
+
try {
|
|
7744
|
+
const res = await api.current();
|
|
7745
|
+
if (res?.error || !res?.data) return false;
|
|
7746
|
+
return res.data.length === 0;
|
|
7747
|
+
} catch {
|
|
7748
|
+
return false;
|
|
7749
|
+
}
|
|
7750
|
+
}, [subject, projectId]);
|
|
7751
|
+
const remember = React32.useCallback(
|
|
7752
|
+
(added) => {
|
|
7753
|
+
if (projectId === null || subject === null) return;
|
|
7754
|
+
if (added) (0, import_core8.recordPasskeyOfferSettled)(projectId, subject.userId);
|
|
7755
|
+
else (0, import_core8.recordPasskeyOfferDismissed)(projectId, subject.userId);
|
|
7756
|
+
},
|
|
7757
|
+
[projectId, subject]
|
|
7758
|
+
);
|
|
7759
|
+
return { subject, shouldOffer, remember };
|
|
7760
|
+
}
|
|
7761
|
+
|
|
7762
|
+
// src/components/PasskeyOfferGate.tsx
|
|
7763
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
7764
|
+
function PasskeyOfferGate({ children, title }) {
|
|
7765
|
+
const { subject, shouldOffer, remember } = usePasskeyOffer();
|
|
7766
|
+
const [offerFor, setOfferFor] = React33.useState(null);
|
|
7767
|
+
React33.useEffect(() => {
|
|
7768
|
+
if (subject === null) return;
|
|
7769
|
+
let cancelled = false;
|
|
7770
|
+
void shouldOffer().then((due) => {
|
|
7771
|
+
if (!cancelled) setOfferFor(due ? subject.sessionKey : null);
|
|
7772
|
+
});
|
|
7773
|
+
return () => {
|
|
7774
|
+
cancelled = true;
|
|
7775
|
+
};
|
|
7776
|
+
}, [subject, shouldOffer]);
|
|
7777
|
+
if (subject === null || offerFor !== subject.sessionKey) return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children });
|
|
7778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "ba-form", "data-testid": "passkey-offer-gate", children: [
|
|
7779
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7780
|
+
PasskeyOffer,
|
|
7781
|
+
{
|
|
7782
|
+
variant: "sign-in",
|
|
7783
|
+
title,
|
|
7784
|
+
onComplete: (added) => {
|
|
7785
|
+
remember(added);
|
|
7786
|
+
setOfferFor(null);
|
|
7787
|
+
}
|
|
7788
|
+
}
|
|
7789
|
+
),
|
|
7790
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AuthOwlBadge, {})
|
|
7791
|
+
] });
|
|
7792
|
+
}
|
|
7793
|
+
|
|
7794
|
+
// src/components/control.tsx
|
|
7795
|
+
var import_core9 = require("@authowl/core");
|
|
7796
|
+
init_hooks();
|
|
7636
7797
|
init_i18n();
|
|
7637
7798
|
init_Spinner();
|
|
7638
|
-
var
|
|
7799
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
7639
7800
|
function SignedIn({ children }) {
|
|
7640
7801
|
const { isLoaded, isSignedIn } = useUser();
|
|
7641
|
-
return isLoaded && isSignedIn ? /* @__PURE__ */ (0,
|
|
7802
|
+
return isLoaded && isSignedIn ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children }) : null;
|
|
7642
7803
|
}
|
|
7643
7804
|
function SignedOut({ children }) {
|
|
7644
7805
|
const { isLoaded, isSignedIn } = useUser();
|
|
7645
|
-
return isLoaded && !isSignedIn ? /* @__PURE__ */ (0,
|
|
7806
|
+
return isLoaded && !isSignedIn ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children }) : null;
|
|
7646
7807
|
}
|
|
7647
7808
|
function Protect({
|
|
7648
7809
|
children,
|
|
@@ -7655,42 +7816,42 @@ function Protect({
|
|
|
7655
7816
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
7656
7817
|
const membership = useSession().data?.session?.membership ?? null;
|
|
7657
7818
|
if (!isLoaded) return null;
|
|
7658
|
-
if (!isSignedIn || !user) return /* @__PURE__ */ (0,
|
|
7659
|
-
if ((role !== void 0 || permission !== void 0 || teamId !== void 0) && !(0,
|
|
7660
|
-
return /* @__PURE__ */ (0,
|
|
7819
|
+
if (!isSignedIn || !user) return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children: fallback });
|
|
7820
|
+
if ((role !== void 0 || permission !== void 0 || teamId !== void 0) && !(0, import_core9.membershipHas)(membership, { role, permission, teamId })) {
|
|
7821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children: fallback });
|
|
7661
7822
|
}
|
|
7662
|
-
if (condition && !condition(user)) return /* @__PURE__ */ (0,
|
|
7663
|
-
return /* @__PURE__ */ (0,
|
|
7823
|
+
if (condition && !condition(user)) return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children: fallback });
|
|
7824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children });
|
|
7664
7825
|
}
|
|
7665
7826
|
function AuthLoading({ children }) {
|
|
7666
7827
|
const t = useT();
|
|
7667
7828
|
const { isLoaded } = useUser();
|
|
7668
7829
|
if (isLoaded) return null;
|
|
7669
|
-
if (children !== void 0) return /* @__PURE__ */ (0,
|
|
7670
|
-
return /* @__PURE__ */ (0,
|
|
7671
|
-
/* @__PURE__ */ (0,
|
|
7672
|
-
/* @__PURE__ */ (0,
|
|
7830
|
+
if (children !== void 0) return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children });
|
|
7831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "ba-auth-loading", role: "status", "aria-busy": "true", "data-testid": "auth-loading", children: [
|
|
7832
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Spinner, {}),
|
|
7833
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "ba-sr-only", children: t("common.loading") })
|
|
7673
7834
|
] });
|
|
7674
7835
|
}
|
|
7675
7836
|
function AuthLoaded({ children }) {
|
|
7676
|
-
return useUser().isLoaded ? /* @__PURE__ */ (0,
|
|
7837
|
+
return useUser().isLoaded ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children }) : null;
|
|
7677
7838
|
}
|
|
7678
7839
|
|
|
7679
7840
|
// src/index.ts
|
|
7680
7841
|
init_Spinner();
|
|
7681
7842
|
|
|
7682
7843
|
// src/components/SignOutButton.tsx
|
|
7683
|
-
var
|
|
7844
|
+
var React34 = __toESM(require("react"), 1);
|
|
7684
7845
|
init_hooks();
|
|
7685
7846
|
init_i18n();
|
|
7686
7847
|
init_Spinner();
|
|
7687
|
-
var
|
|
7848
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
7688
7849
|
function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
7689
7850
|
const t = useT();
|
|
7690
7851
|
const { signOut } = useSignOut();
|
|
7691
|
-
const [pending, setPending] =
|
|
7852
|
+
const [pending, setPending] = React34.useState(false);
|
|
7692
7853
|
const content = children ?? t("signOut.button");
|
|
7693
|
-
return /* @__PURE__ */ (0,
|
|
7854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7694
7855
|
"button",
|
|
7695
7856
|
{
|
|
7696
7857
|
type: "button",
|
|
@@ -7708,41 +7869,41 @@ function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
|
7708
7869
|
setPending(false);
|
|
7709
7870
|
}
|
|
7710
7871
|
},
|
|
7711
|
-
children: /* @__PURE__ */ (0,
|
|
7872
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Busy, { busy: pending, label: content, children: content })
|
|
7712
7873
|
}
|
|
7713
7874
|
);
|
|
7714
7875
|
}
|
|
7715
7876
|
|
|
7716
7877
|
// src/components/UserButton.tsx
|
|
7717
|
-
var
|
|
7878
|
+
var React49 = __toESM(require("react"), 1);
|
|
7718
7879
|
init_hooks();
|
|
7719
7880
|
init_i18n();
|
|
7720
7881
|
|
|
7721
7882
|
// src/components/UserProfile.tsx
|
|
7722
|
-
var
|
|
7883
|
+
var React48 = __toESM(require("react"), 1);
|
|
7723
7884
|
init_hooks();
|
|
7724
7885
|
init_i18n();
|
|
7725
7886
|
|
|
7726
7887
|
// src/components/user-profile/EmailSection.tsx
|
|
7727
|
-
var
|
|
7888
|
+
var React35 = __toESM(require("react"), 1);
|
|
7728
7889
|
init_hooks();
|
|
7729
7890
|
init_i18n();
|
|
7730
7891
|
init_use_submit_action();
|
|
7731
7892
|
init_Spinner();
|
|
7732
7893
|
init_FormError();
|
|
7733
|
-
var
|
|
7894
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
7734
7895
|
function EmailSection({ allowChange }) {
|
|
7735
7896
|
const t = useT();
|
|
7736
7897
|
const account = useAccount();
|
|
7737
7898
|
const { user } = useUser();
|
|
7738
7899
|
const { pending, error, run } = useSubmitAction();
|
|
7739
|
-
const [newEmail, setNewEmail] =
|
|
7740
|
-
const [sent, setSent] =
|
|
7741
|
-
const titleId =
|
|
7900
|
+
const [newEmail, setNewEmail] = React35.useState("");
|
|
7901
|
+
const [sent, setSent] = React35.useState(false);
|
|
7902
|
+
const titleId = React35.useId();
|
|
7742
7903
|
if (!user?.email) {
|
|
7743
|
-
return /* @__PURE__ */ (0,
|
|
7744
|
-
/* @__PURE__ */ (0,
|
|
7745
|
-
/* @__PURE__ */ (0,
|
|
7904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
7905
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
|
|
7906
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "ba-muted", children: t("userProfile.email.unavailable") })
|
|
7746
7907
|
] });
|
|
7747
7908
|
}
|
|
7748
7909
|
const submit = (event) => {
|
|
@@ -7762,19 +7923,19 @@ function EmailSection({ allowChange }) {
|
|
|
7762
7923
|
}
|
|
7763
7924
|
);
|
|
7764
7925
|
};
|
|
7765
|
-
return /* @__PURE__ */ (0,
|
|
7766
|
-
/* @__PURE__ */ (0,
|
|
7767
|
-
/* @__PURE__ */ (0,
|
|
7768
|
-
/* @__PURE__ */ (0,
|
|
7926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
7927
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
7928
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
|
|
7929
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "ba-muted", children: t("userProfile.email.description") })
|
|
7769
7930
|
] }),
|
|
7770
|
-
/* @__PURE__ */ (0,
|
|
7771
|
-
/* @__PURE__ */ (0,
|
|
7772
|
-
/* @__PURE__ */ (0,
|
|
7931
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("p", { className: "ba-profile-current", children: [
|
|
7932
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: t("userProfile.email.current") }),
|
|
7933
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("strong", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Bidi, { children: user.email }) })
|
|
7773
7934
|
] }),
|
|
7774
|
-
!allowChange ? /* @__PURE__ */ (0,
|
|
7775
|
-
/* @__PURE__ */ (0,
|
|
7935
|
+
!allowChange ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "ba-muted", "data-testid": "email-change-disabled", children: t("userProfile.email.changeDisabled") }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
7936
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "ba-label", children: [
|
|
7776
7937
|
t("userProfile.email.newLabel"),
|
|
7777
|
-
/* @__PURE__ */ (0,
|
|
7938
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7778
7939
|
"input",
|
|
7779
7940
|
{
|
|
7780
7941
|
className: "ba-input",
|
|
@@ -7786,16 +7947,16 @@ function EmailSection({ allowChange }) {
|
|
|
7786
7947
|
}
|
|
7787
7948
|
)
|
|
7788
7949
|
] }),
|
|
7789
|
-
/* @__PURE__ */ (0,
|
|
7790
|
-
sent && /* @__PURE__ */ (0,
|
|
7791
|
-
/* @__PURE__ */ (0,
|
|
7950
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FormError, { children: error }),
|
|
7951
|
+
sent && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "ba-success", role: "status", children: t("userProfile.email.sent") }),
|
|
7952
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7792
7953
|
"button",
|
|
7793
7954
|
{
|
|
7794
7955
|
className: "ba-button ba-profile-submit",
|
|
7795
7956
|
type: "submit",
|
|
7796
7957
|
disabled: pending || !newEmail.trim(),
|
|
7797
7958
|
"aria-busy": pending || void 0,
|
|
7798
|
-
children: /* @__PURE__ */ (0,
|
|
7959
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Busy, { busy: pending, label: t("common.sending"), children: t("userProfile.email.submit") })
|
|
7799
7960
|
}
|
|
7800
7961
|
)
|
|
7801
7962
|
] })
|
|
@@ -7803,21 +7964,21 @@ function EmailSection({ allowChange }) {
|
|
|
7803
7964
|
}
|
|
7804
7965
|
|
|
7805
7966
|
// src/components/user-profile/DeleteAccountSection.tsx
|
|
7806
|
-
var
|
|
7967
|
+
var React36 = __toESM(require("react"), 1);
|
|
7807
7968
|
init_hooks();
|
|
7808
7969
|
init_i18n();
|
|
7809
7970
|
init_use_submit_action();
|
|
7810
7971
|
init_Spinner();
|
|
7811
7972
|
init_FormError();
|
|
7812
|
-
var
|
|
7973
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
7813
7974
|
function DeleteAccountSection({ onDeleted }) {
|
|
7814
7975
|
const t = useT();
|
|
7815
7976
|
const account = useAccount();
|
|
7816
7977
|
const session = useSession();
|
|
7817
7978
|
const { user } = useUser();
|
|
7818
7979
|
const { pending, error, run } = useSubmitAction();
|
|
7819
|
-
const [confirmation, setConfirmation] =
|
|
7820
|
-
const titleId =
|
|
7980
|
+
const [confirmation, setConfirmation] = React36.useState("");
|
|
7981
|
+
const titleId = React36.useId();
|
|
7821
7982
|
const identifier = user?.email ?? user?.phoneNumber ?? user?.id ?? "";
|
|
7822
7983
|
const confirmed = identifier.length > 0 && confirmation.trim().toLowerCase() === identifier.toLowerCase();
|
|
7823
7984
|
const submit = (event) => {
|
|
@@ -7834,18 +7995,18 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
7834
7995
|
}
|
|
7835
7996
|
);
|
|
7836
7997
|
};
|
|
7837
|
-
return /* @__PURE__ */ (0,
|
|
7838
|
-
/* @__PURE__ */ (0,
|
|
7839
|
-
/* @__PURE__ */ (0,
|
|
7840
|
-
/* @__PURE__ */ (0,
|
|
7998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("section", { className: "ba-profile-section ba-profile-danger-zone", "aria-labelledby": titleId, children: [
|
|
7999
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
8000
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.delete.title") }),
|
|
8001
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "ba-muted", children: t("userProfile.delete.description") })
|
|
7841
8002
|
] }),
|
|
7842
|
-
/* @__PURE__ */ (0,
|
|
7843
|
-
/* @__PURE__ */ (0,
|
|
7844
|
-
/* @__PURE__ */ (0,
|
|
8003
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
8004
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "ba-profile-delete-warning", children: t("userProfile.delete.warning", { identifier }) }),
|
|
8005
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "ba-label", children: [
|
|
7845
8006
|
t("userProfile.delete.confirmLabel"),
|
|
7846
8007
|
" ",
|
|
7847
|
-
/* @__PURE__ */ (0,
|
|
7848
|
-
/* @__PURE__ */ (0,
|
|
8008
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Bidi, { children: identifier }),
|
|
8009
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7849
8010
|
"input",
|
|
7850
8011
|
{
|
|
7851
8012
|
className: "ba-input",
|
|
@@ -7859,15 +8020,15 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
7859
8020
|
}
|
|
7860
8021
|
)
|
|
7861
8022
|
] }),
|
|
7862
|
-
/* @__PURE__ */ (0,
|
|
7863
|
-
/* @__PURE__ */ (0,
|
|
8023
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(FormError, { children: error }),
|
|
8024
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7864
8025
|
"button",
|
|
7865
8026
|
{
|
|
7866
8027
|
className: "ba-button ba-danger-button ba-profile-submit",
|
|
7867
8028
|
type: "submit",
|
|
7868
8029
|
disabled: pending || !confirmed,
|
|
7869
8030
|
"aria-busy": pending || void 0,
|
|
7870
|
-
children: /* @__PURE__ */ (0,
|
|
8031
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.delete.submit") })
|
|
7871
8032
|
}
|
|
7872
8033
|
)
|
|
7873
8034
|
] })
|
|
@@ -7875,31 +8036,30 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
7875
8036
|
}
|
|
7876
8037
|
|
|
7877
8038
|
// src/components/user-profile/MfaSection.tsx
|
|
7878
|
-
var
|
|
8039
|
+
var React37 = __toESM(require("react"), 1);
|
|
7879
8040
|
init_hooks();
|
|
7880
8041
|
init_i18n();
|
|
7881
|
-
init_use_submit_action();
|
|
7882
8042
|
init_Spinner();
|
|
7883
8043
|
init_FormError();
|
|
7884
|
-
var
|
|
8044
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7885
8045
|
function MfaSection() {
|
|
7886
8046
|
const t = useT();
|
|
7887
8047
|
const { user } = useUser();
|
|
7888
8048
|
const session = useSession();
|
|
7889
8049
|
const { config } = usePublicConfig();
|
|
7890
8050
|
const { disable } = useMFA();
|
|
7891
|
-
const { pending, error, run } =
|
|
7892
|
-
const [password, setPassword] =
|
|
7893
|
-
const [showDisable, setShowDisable] =
|
|
7894
|
-
const titleId =
|
|
8051
|
+
const { pending, error, stepUpRequired, run, resume, cancel } = useStepUpAction();
|
|
8052
|
+
const [password, setPassword] = React37.useState("");
|
|
8053
|
+
const [showDisable, setShowDisable] = React37.useState(false);
|
|
8054
|
+
const titleId = React37.useId();
|
|
7895
8055
|
const required = (0, import_core4.resolveProjectCapabilities)(config).mfaRequired;
|
|
7896
8056
|
if (!user?.twoFactorEnabled) {
|
|
7897
|
-
return /* @__PURE__ */ (0,
|
|
7898
|
-
/* @__PURE__ */ (0,
|
|
7899
|
-
/* @__PURE__ */ (0,
|
|
7900
|
-
/* @__PURE__ */ (0,
|
|
8057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
8058
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
8059
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
|
|
8060
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredDescription") : t("userProfile.mfa.description") })
|
|
7901
8061
|
] }),
|
|
7902
|
-
/* @__PURE__ */ (0,
|
|
8062
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
7903
8063
|
MFAEnrollment,
|
|
7904
8064
|
{
|
|
7905
8065
|
title: null,
|
|
@@ -7922,16 +8082,26 @@ function MfaSection() {
|
|
|
7922
8082
|
}
|
|
7923
8083
|
);
|
|
7924
8084
|
};
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
8085
|
+
const cancelDisable = () => {
|
|
8086
|
+
cancel();
|
|
8087
|
+
setShowDisable(false);
|
|
8088
|
+
setPassword("");
|
|
8089
|
+
};
|
|
8090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
8091
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
8092
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
|
|
8093
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredActive") : t("userProfile.mfa.active") })
|
|
7929
8094
|
] }),
|
|
7930
|
-
/* @__PURE__ */ (0,
|
|
7931
|
-
/* @__PURE__ */ (0,
|
|
7932
|
-
/* @__PURE__ */ (0,
|
|
8095
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "ba-profile-status", role: "status", children: [
|
|
8096
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("strong", { children: t("userProfile.mfa.enabled") }),
|
|
8097
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: t("userProfile.mfa.authenticator") })
|
|
7933
8098
|
] }),
|
|
7934
|
-
|
|
8099
|
+
stepUpRequired ? (
|
|
8100
|
+
// Turning the factor off requires PROVING it, not just knowing the
|
|
8101
|
+
// password - see `useStepUpAction`. The parked attempt replays with the
|
|
8102
|
+
// password already entered, so accepting a code finishes the removal.
|
|
8103
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(MFAChallenge, { variant: "step-up", onVerified: resume, onCancel: cancelDisable })
|
|
8104
|
+
) : !showDisable ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
7935
8105
|
"button",
|
|
7936
8106
|
{
|
|
7937
8107
|
className: "ba-button ba-button-secondary ba-profile-submit",
|
|
@@ -7939,11 +8109,11 @@ function MfaSection() {
|
|
|
7939
8109
|
onClick: () => setShowDisable(true),
|
|
7940
8110
|
children: required ? t("userProfile.mfa.replace") : t("userProfile.mfa.disable")
|
|
7941
8111
|
}
|
|
7942
|
-
) : /* @__PURE__ */ (0,
|
|
7943
|
-
/* @__PURE__ */ (0,
|
|
7944
|
-
/* @__PURE__ */ (0,
|
|
8112
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("form", { method: "post", className: "ba-fields ba-profile-security-form", onSubmit: submitDisable, children: [
|
|
8113
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "ba-muted", children: required ? t("userProfile.mfa.replaceWarning") : t("userProfile.mfa.disableWarning") }),
|
|
8114
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "ba-label", children: [
|
|
7945
8115
|
t("common.passwordLabel"),
|
|
7946
|
-
/* @__PURE__ */ (0,
|
|
8116
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
7947
8117
|
"input",
|
|
7948
8118
|
{
|
|
7949
8119
|
className: "ba-input",
|
|
@@ -7955,29 +8125,26 @@ function MfaSection() {
|
|
|
7955
8125
|
}
|
|
7956
8126
|
)
|
|
7957
8127
|
] }),
|
|
7958
|
-
/* @__PURE__ */ (0,
|
|
7959
|
-
/* @__PURE__ */ (0,
|
|
7960
|
-
/* @__PURE__ */ (0,
|
|
8128
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(FormError, { children: error }),
|
|
8129
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "ba-profile-action-row", children: [
|
|
8130
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
7961
8131
|
"button",
|
|
7962
8132
|
{
|
|
7963
8133
|
className: "ba-button ba-danger-button",
|
|
7964
8134
|
type: "submit",
|
|
7965
8135
|
disabled: pending || !password,
|
|
7966
8136
|
"aria-busy": pending || void 0,
|
|
7967
|
-
children: /* @__PURE__ */ (0,
|
|
8137
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Busy, { busy: pending, label: t("common.working"), children: required ? t("userProfile.mfa.replaceConfirm") : t("userProfile.mfa.disableConfirm") })
|
|
7968
8138
|
}
|
|
7969
8139
|
),
|
|
7970
|
-
/* @__PURE__ */ (0,
|
|
8140
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
7971
8141
|
"button",
|
|
7972
8142
|
{
|
|
7973
8143
|
className: "ba-button ba-button-secondary",
|
|
7974
8144
|
type: "button",
|
|
7975
8145
|
disabled: pending,
|
|
7976
|
-
onClick:
|
|
7977
|
-
|
|
7978
|
-
setPassword("");
|
|
7979
|
-
},
|
|
7980
|
-
children: t("userProfile.cancel")
|
|
8146
|
+
onClick: cancelDisable,
|
|
8147
|
+
children: t("common.cancel")
|
|
7981
8148
|
}
|
|
7982
8149
|
)
|
|
7983
8150
|
] })
|
|
@@ -7986,24 +8153,24 @@ function MfaSection() {
|
|
|
7986
8153
|
}
|
|
7987
8154
|
|
|
7988
8155
|
// src/components/user-profile/PasswordSection.tsx
|
|
7989
|
-
var
|
|
8156
|
+
var React38 = __toESM(require("react"), 1);
|
|
7990
8157
|
init_hooks();
|
|
7991
8158
|
init_i18n();
|
|
7992
8159
|
init_use_submit_action();
|
|
7993
8160
|
init_Spinner();
|
|
7994
8161
|
init_FormError();
|
|
7995
|
-
var
|
|
8162
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
7996
8163
|
function PasswordSection() {
|
|
7997
8164
|
const t = useT();
|
|
7998
8165
|
const account = useAccount();
|
|
7999
8166
|
const { config } = usePublicConfig();
|
|
8000
8167
|
const { passwordMinLength, passwordMaxLength } = (0, import_core4.resolveProjectCapabilities)(config);
|
|
8001
8168
|
const { pending, error, setError, run } = useSubmitAction();
|
|
8002
|
-
const [currentPassword, setCurrentPassword] =
|
|
8003
|
-
const [newPassword, setNewPassword] =
|
|
8004
|
-
const [confirmPassword, setConfirmPassword] =
|
|
8005
|
-
const [saved, setSaved] =
|
|
8006
|
-
const titleId =
|
|
8169
|
+
const [currentPassword, setCurrentPassword] = React38.useState("");
|
|
8170
|
+
const [newPassword, setNewPassword] = React38.useState("");
|
|
8171
|
+
const [confirmPassword, setConfirmPassword] = React38.useState("");
|
|
8172
|
+
const [saved, setSaved] = React38.useState(false);
|
|
8173
|
+
const titleId = React38.useId();
|
|
8007
8174
|
const submit = (event) => {
|
|
8008
8175
|
event.preventDefault();
|
|
8009
8176
|
setSaved(false);
|
|
@@ -8028,43 +8195,43 @@ function PasswordSection() {
|
|
|
8028
8195
|
}
|
|
8029
8196
|
);
|
|
8030
8197
|
};
|
|
8031
|
-
return /* @__PURE__ */ (0,
|
|
8032
|
-
/* @__PURE__ */ (0,
|
|
8033
|
-
/* @__PURE__ */ (0,
|
|
8034
|
-
/* @__PURE__ */ (0,
|
|
8198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
8199
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
8200
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.password.title") }),
|
|
8201
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "ba-muted", children: t("userProfile.password.description") })
|
|
8035
8202
|
] }),
|
|
8036
|
-
/* @__PURE__ */ (0,
|
|
8037
|
-
/* @__PURE__ */ (0,
|
|
8203
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
8204
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "ba-label", children: [
|
|
8038
8205
|
t("userProfile.password.currentLabel"),
|
|
8039
|
-
/* @__PURE__ */ (0,
|
|
8206
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("input", { className: "ba-input", type: "password", autoComplete: "current-password", value: currentPassword, onChange: (event) => {
|
|
8040
8207
|
setCurrentPassword(event.target.value);
|
|
8041
8208
|
setError(null);
|
|
8042
8209
|
}, required: true })
|
|
8043
8210
|
] }),
|
|
8044
|
-
/* @__PURE__ */ (0,
|
|
8211
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "ba-label", children: [
|
|
8045
8212
|
t("resetPassword.newPasswordLabel"),
|
|
8046
|
-
/* @__PURE__ */ (0,
|
|
8213
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: newPassword, onChange: (event) => {
|
|
8047
8214
|
setNewPassword(event.target.value);
|
|
8048
8215
|
setError(null);
|
|
8049
8216
|
}, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
|
|
8050
8217
|
] }),
|
|
8051
|
-
/* @__PURE__ */ (0,
|
|
8218
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "ba-label", children: [
|
|
8052
8219
|
t("resetPassword.confirmPasswordLabel"),
|
|
8053
|
-
/* @__PURE__ */ (0,
|
|
8220
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: confirmPassword, onChange: (event) => {
|
|
8054
8221
|
setConfirmPassword(event.target.value);
|
|
8055
8222
|
setError(null);
|
|
8056
8223
|
}, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
|
|
8057
8224
|
] }),
|
|
8058
|
-
/* @__PURE__ */ (0,
|
|
8059
|
-
saved && /* @__PURE__ */ (0,
|
|
8060
|
-
/* @__PURE__ */ (0,
|
|
8225
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(FormError, { children: error }),
|
|
8226
|
+
saved && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "ba-success", role: "status", children: t("userProfile.password.saved") }),
|
|
8227
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
8061
8228
|
"button",
|
|
8062
8229
|
{
|
|
8063
8230
|
className: "ba-button ba-profile-submit",
|
|
8064
8231
|
type: "submit",
|
|
8065
8232
|
disabled: pending || !currentPassword || !newPassword || !confirmPassword,
|
|
8066
8233
|
"aria-busy": pending || void 0,
|
|
8067
|
-
children: /* @__PURE__ */ (0,
|
|
8234
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.password.submit") })
|
|
8068
8235
|
}
|
|
8069
8236
|
)
|
|
8070
8237
|
] })
|
|
@@ -8072,29 +8239,29 @@ function PasswordSection() {
|
|
|
8072
8239
|
}
|
|
8073
8240
|
|
|
8074
8241
|
// src/components/user-profile/PasskeysSection.tsx
|
|
8075
|
-
var
|
|
8242
|
+
var React39 = __toESM(require("react"), 1);
|
|
8076
8243
|
init_i18n();
|
|
8077
|
-
var
|
|
8244
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
8078
8245
|
function PasskeysSection({ allowAdd }) {
|
|
8079
8246
|
const t = useT();
|
|
8080
|
-
const titleId =
|
|
8081
|
-
return /* @__PURE__ */ (0,
|
|
8082
|
-
/* @__PURE__ */ (0,
|
|
8083
|
-
/* @__PURE__ */ (0,
|
|
8084
|
-
/* @__PURE__ */ (0,
|
|
8247
|
+
const titleId = React39.useId();
|
|
8248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
8249
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
8250
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.passkeys.title") }),
|
|
8251
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "ba-muted", children: t("userProfile.passkeys.description") })
|
|
8085
8252
|
] }),
|
|
8086
|
-
/* @__PURE__ */ (0,
|
|
8253
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PasskeyManager, { title: null, allowAdd })
|
|
8087
8254
|
] });
|
|
8088
8255
|
}
|
|
8089
8256
|
|
|
8090
8257
|
// src/components/user-profile/ProfileSection.tsx
|
|
8091
|
-
var
|
|
8258
|
+
var React40 = __toESM(require("react"), 1);
|
|
8092
8259
|
init_hooks();
|
|
8093
8260
|
init_i18n();
|
|
8094
8261
|
init_use_submit_action();
|
|
8095
8262
|
init_Spinner();
|
|
8096
8263
|
init_FormError();
|
|
8097
|
-
var
|
|
8264
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
8098
8265
|
function ProfileSection({
|
|
8099
8266
|
firstLastName,
|
|
8100
8267
|
usernameEnabled,
|
|
@@ -8105,15 +8272,15 @@ function ProfileSection({
|
|
|
8105
8272
|
const { user } = useUser();
|
|
8106
8273
|
const session = useSession();
|
|
8107
8274
|
const { pending, error, run } = useSubmitAction();
|
|
8108
|
-
const [name, setName] =
|
|
8109
|
-
const [firstName, setFirstName] =
|
|
8110
|
-
const [lastName, setLastName] =
|
|
8111
|
-
const [username, setUsername] =
|
|
8275
|
+
const [name, setName] = React40.useState(user?.name ?? "");
|
|
8276
|
+
const [firstName, setFirstName] = React40.useState(user?.firstName ?? "");
|
|
8277
|
+
const [lastName, setLastName] = React40.useState(user?.lastName ?? "");
|
|
8278
|
+
const [username, setUsername] = React40.useState(
|
|
8112
8279
|
user?.displayUsername ?? user?.username ?? ""
|
|
8113
8280
|
);
|
|
8114
|
-
const [image, setImage] =
|
|
8115
|
-
const [saved, setSaved] =
|
|
8116
|
-
const titleId =
|
|
8281
|
+
const [image, setImage] = React40.useState(user?.image ?? "");
|
|
8282
|
+
const [saved, setSaved] = React40.useState(false);
|
|
8283
|
+
const titleId = React40.useId();
|
|
8117
8284
|
const submit = (event) => {
|
|
8118
8285
|
event.preventDefault();
|
|
8119
8286
|
setSaved(false);
|
|
@@ -8136,15 +8303,15 @@ function ProfileSection({
|
|
|
8136
8303
|
}
|
|
8137
8304
|
);
|
|
8138
8305
|
};
|
|
8139
|
-
return /* @__PURE__ */ (0,
|
|
8140
|
-
/* @__PURE__ */ (0,
|
|
8141
|
-
/* @__PURE__ */ (0,
|
|
8142
|
-
/* @__PURE__ */ (0,
|
|
8306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
8307
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
8308
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.profile.title") }),
|
|
8309
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "ba-muted", children: t("userProfile.profile.description") })
|
|
8143
8310
|
] }),
|
|
8144
|
-
/* @__PURE__ */ (0,
|
|
8145
|
-
legacyNameField && /* @__PURE__ */ (0,
|
|
8311
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
8312
|
+
legacyNameField && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "ba-label", children: [
|
|
8146
8313
|
t("signUp.nameLabel"),
|
|
8147
|
-
/* @__PURE__ */ (0,
|
|
8314
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8148
8315
|
"input",
|
|
8149
8316
|
{
|
|
8150
8317
|
className: "ba-input",
|
|
@@ -8155,10 +8322,10 @@ function ProfileSection({
|
|
|
8155
8322
|
}
|
|
8156
8323
|
)
|
|
8157
8324
|
] }),
|
|
8158
|
-
firstLastName && /* @__PURE__ */ (0,
|
|
8159
|
-
/* @__PURE__ */ (0,
|
|
8325
|
+
firstLastName && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
8326
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "ba-label", children: [
|
|
8160
8327
|
t("signUp.firstNameLabel"),
|
|
8161
|
-
/* @__PURE__ */ (0,
|
|
8328
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8162
8329
|
"input",
|
|
8163
8330
|
{
|
|
8164
8331
|
className: "ba-input",
|
|
@@ -8168,9 +8335,9 @@ function ProfileSection({
|
|
|
8168
8335
|
}
|
|
8169
8336
|
)
|
|
8170
8337
|
] }),
|
|
8171
|
-
/* @__PURE__ */ (0,
|
|
8338
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "ba-label", children: [
|
|
8172
8339
|
t("signUp.lastNameLabel"),
|
|
8173
|
-
/* @__PURE__ */ (0,
|
|
8340
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8174
8341
|
"input",
|
|
8175
8342
|
{
|
|
8176
8343
|
className: "ba-input",
|
|
@@ -8181,9 +8348,9 @@ function ProfileSection({
|
|
|
8181
8348
|
)
|
|
8182
8349
|
] })
|
|
8183
8350
|
] }),
|
|
8184
|
-
usernameEnabled && /* @__PURE__ */ (0,
|
|
8351
|
+
usernameEnabled && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "ba-label", children: [
|
|
8185
8352
|
t("common.usernameLabel"),
|
|
8186
|
-
/* @__PURE__ */ (0,
|
|
8353
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8187
8354
|
"input",
|
|
8188
8355
|
{
|
|
8189
8356
|
className: "ba-input",
|
|
@@ -8193,9 +8360,9 @@ function ProfileSection({
|
|
|
8193
8360
|
}
|
|
8194
8361
|
)
|
|
8195
8362
|
] }),
|
|
8196
|
-
/* @__PURE__ */ (0,
|
|
8363
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "ba-label", children: [
|
|
8197
8364
|
t("userProfile.profile.imageLabel"),
|
|
8198
|
-
/* @__PURE__ */ (0,
|
|
8365
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8199
8366
|
"input",
|
|
8200
8367
|
{
|
|
8201
8368
|
className: "ba-input",
|
|
@@ -8206,16 +8373,16 @@ function ProfileSection({
|
|
|
8206
8373
|
}
|
|
8207
8374
|
)
|
|
8208
8375
|
] }),
|
|
8209
|
-
/* @__PURE__ */ (0,
|
|
8210
|
-
saved && /* @__PURE__ */ (0,
|
|
8211
|
-
/* @__PURE__ */ (0,
|
|
8376
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(FormError, { children: error }),
|
|
8377
|
+
saved && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "ba-success", role: "status", children: t("userProfile.profile.saved") }),
|
|
8378
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8212
8379
|
"button",
|
|
8213
8380
|
{
|
|
8214
8381
|
className: "ba-button ba-profile-submit",
|
|
8215
8382
|
type: "submit",
|
|
8216
8383
|
disabled: pending || legacyNameField && !name.trim(),
|
|
8217
8384
|
"aria-busy": pending || void 0,
|
|
8218
|
-
children: /* @__PURE__ */ (0,
|
|
8385
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.save") })
|
|
8219
8386
|
}
|
|
8220
8387
|
)
|
|
8221
8388
|
] })
|
|
@@ -8223,32 +8390,32 @@ function ProfileSection({
|
|
|
8223
8390
|
}
|
|
8224
8391
|
|
|
8225
8392
|
// src/components/user-profile/RecoverySection.tsx
|
|
8226
|
-
var
|
|
8393
|
+
var React41 = __toESM(require("react"), 1);
|
|
8227
8394
|
init_hooks();
|
|
8228
8395
|
init_i18n();
|
|
8229
|
-
var
|
|
8396
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
8230
8397
|
function RecoverySection() {
|
|
8231
8398
|
const t = useT();
|
|
8232
8399
|
const { user } = useUser();
|
|
8233
|
-
const titleId =
|
|
8234
|
-
return /* @__PURE__ */ (0,
|
|
8235
|
-
/* @__PURE__ */ (0,
|
|
8236
|
-
/* @__PURE__ */ (0,
|
|
8237
|
-
/* @__PURE__ */ (0,
|
|
8400
|
+
const titleId = React41.useId();
|
|
8401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
8402
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
8403
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.recovery.title") }),
|
|
8404
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "ba-muted", children: t("userProfile.recovery.description") })
|
|
8238
8405
|
] }),
|
|
8239
|
-
/* @__PURE__ */ (0,
|
|
8240
|
-
/* @__PURE__ */ (0,
|
|
8241
|
-
user?.email && user.emailVerified ? /* @__PURE__ */ (0,
|
|
8242
|
-
/* @__PURE__ */ (0,
|
|
8243
|
-
/* @__PURE__ */ (0,
|
|
8244
|
-
] }) : /* @__PURE__ */ (0,
|
|
8406
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "ba-profile-recovery-card", children: [
|
|
8407
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("strong", { children: t("userProfile.recovery.emailTitle") }),
|
|
8408
|
+
user?.email && user.emailVerified ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
8409
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { children: t("userProfile.recovery.emailDescription") }),
|
|
8410
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Bidi, { children: user.email })
|
|
8411
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { children: t("userProfile.recovery.emailUnavailable") })
|
|
8245
8412
|
] }),
|
|
8246
|
-
/* @__PURE__ */ (0,
|
|
8413
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BackupCodesManager, { title: null })
|
|
8247
8414
|
] });
|
|
8248
8415
|
}
|
|
8249
8416
|
|
|
8250
8417
|
// src/components/user-profile/SessionsSection.tsx
|
|
8251
|
-
var
|
|
8418
|
+
var React43 = __toESM(require("react"), 1);
|
|
8252
8419
|
init_hooks();
|
|
8253
8420
|
init_i18n();
|
|
8254
8421
|
init_use_submit_action();
|
|
@@ -8300,19 +8467,19 @@ function formatSessionTime(date, locale) {
|
|
|
8300
8467
|
}
|
|
8301
8468
|
|
|
8302
8469
|
// src/components/user-profile/use-account-resource.ts
|
|
8303
|
-
var
|
|
8470
|
+
var React42 = __toESM(require("react"), 1);
|
|
8304
8471
|
init_i18n();
|
|
8305
8472
|
function useAccountResource(loader, failure) {
|
|
8306
|
-
const loaderRef =
|
|
8473
|
+
const loaderRef = React42.useRef(loader);
|
|
8307
8474
|
loaderRef.current = loader;
|
|
8308
|
-
const failureRef =
|
|
8475
|
+
const failureRef = React42.useRef(failure);
|
|
8309
8476
|
failureRef.current = failure;
|
|
8310
8477
|
const toServerError = useServerError();
|
|
8311
|
-
const [data, setData] =
|
|
8312
|
-
const [error, setError] =
|
|
8313
|
-
const [loading, setLoading] =
|
|
8314
|
-
const requestRef =
|
|
8315
|
-
const load =
|
|
8478
|
+
const [data, setData] = React42.useState(null);
|
|
8479
|
+
const [error, setError] = React42.useState(null);
|
|
8480
|
+
const [loading, setLoading] = React42.useState(true);
|
|
8481
|
+
const requestRef = React42.useRef(0);
|
|
8482
|
+
const load = React42.useCallback(async () => {
|
|
8316
8483
|
const request = ++requestRef.current;
|
|
8317
8484
|
setLoading(true);
|
|
8318
8485
|
try {
|
|
@@ -8331,7 +8498,7 @@ function useAccountResource(loader, failure) {
|
|
|
8331
8498
|
if (request === requestRef.current) setLoading(false);
|
|
8332
8499
|
}
|
|
8333
8500
|
}, [toServerError]);
|
|
8334
|
-
|
|
8501
|
+
React42.useEffect(() => {
|
|
8335
8502
|
void load();
|
|
8336
8503
|
return () => {
|
|
8337
8504
|
requestRef.current += 1;
|
|
@@ -8342,14 +8509,14 @@ function useAccountResource(loader, failure) {
|
|
|
8342
8509
|
|
|
8343
8510
|
// src/components/user-profile/SessionsSection.tsx
|
|
8344
8511
|
init_FormError();
|
|
8345
|
-
var
|
|
8512
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
8346
8513
|
function SessionsSection() {
|
|
8347
8514
|
const t = useT();
|
|
8348
8515
|
const locale = useLocale();
|
|
8349
8516
|
const account = useAccount();
|
|
8350
8517
|
const sessionState = useSession();
|
|
8351
8518
|
const mutation = useSubmitAction();
|
|
8352
|
-
const titleId =
|
|
8519
|
+
const titleId = React43.useId();
|
|
8353
8520
|
const resource = useAccountResource(
|
|
8354
8521
|
() => account.listSessions(),
|
|
8355
8522
|
t("userProfile.sessions.loadError")
|
|
@@ -8371,31 +8538,31 @@ function SessionsSection() {
|
|
|
8371
8538
|
}
|
|
8372
8539
|
);
|
|
8373
8540
|
};
|
|
8374
|
-
return /* @__PURE__ */ (0,
|
|
8375
|
-
/* @__PURE__ */ (0,
|
|
8376
|
-
/* @__PURE__ */ (0,
|
|
8377
|
-
/* @__PURE__ */ (0,
|
|
8541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
8542
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
8543
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.sessions.title") }),
|
|
8544
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "ba-muted", children: t("userProfile.sessions.description") })
|
|
8378
8545
|
] }),
|
|
8379
|
-
resource.data === null ? resource.loading ? /* @__PURE__ */ (0,
|
|
8380
|
-
/* @__PURE__ */ (0,
|
|
8381
|
-
/* @__PURE__ */ (0,
|
|
8382
|
-
] }) : null : /* @__PURE__ */ (0,
|
|
8546
|
+
resource.data === null ? resource.loading ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: [
|
|
8547
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "ba-skeleton" }),
|
|
8548
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "ba-skeleton" })
|
|
8549
|
+
] }) : null : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("ul", { className: "ba-profile-list", children: [
|
|
8383
8550
|
sessions.map((session) => {
|
|
8384
8551
|
const label2 = session.userAgent?.trim() || t("userProfile.sessions.unknownDevice");
|
|
8385
|
-
return /* @__PURE__ */ (0,
|
|
8386
|
-
/* @__PURE__ */ (0,
|
|
8387
|
-
/* @__PURE__ */ (0,
|
|
8388
|
-
/* @__PURE__ */ (0,
|
|
8389
|
-
session.id === currentId && /* @__PURE__ */ (0,
|
|
8552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("li", { className: "ba-profile-list-item", children: [
|
|
8553
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { children: [
|
|
8554
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("strong", { children: label2 }),
|
|
8555
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("small", { children: [
|
|
8556
|
+
session.id === currentId && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("em", { children: t("userProfile.sessions.current") }),
|
|
8390
8557
|
formatSessionTime(session.updatedAt, locale)
|
|
8391
8558
|
] })
|
|
8392
8559
|
] }),
|
|
8393
|
-
/* @__PURE__ */ (0,
|
|
8560
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: mutation.pending, onClick: () => revoke(session.id, label2), children: t("userProfile.sessions.revoke") })
|
|
8394
8561
|
] }, session.id);
|
|
8395
8562
|
}),
|
|
8396
|
-
sessions.length === 0 && /* @__PURE__ */ (0,
|
|
8563
|
+
sessions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("li", { className: "ba-muted", children: t("userProfile.sessions.empty") })
|
|
8397
8564
|
] }),
|
|
8398
|
-
sessions.some((session) => session.id !== currentId) && /* @__PURE__ */ (0,
|
|
8565
|
+
sessions.some((session) => session.id !== currentId) && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
8399
8566
|
"button",
|
|
8400
8567
|
{
|
|
8401
8568
|
className: "ba-button ba-button-secondary ba-profile-submit",
|
|
@@ -8411,21 +8578,21 @@ function SessionsSection() {
|
|
|
8411
8578
|
children: t("userProfile.sessions.revokeOthers")
|
|
8412
8579
|
}
|
|
8413
8580
|
),
|
|
8414
|
-
resource.error && /* @__PURE__ */ (0,
|
|
8415
|
-
/* @__PURE__ */ (0,
|
|
8416
|
-
/* @__PURE__ */ (0,
|
|
8581
|
+
resource.error && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "ba-profile-inline-error", children: [
|
|
8582
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(FormError, { children: resource.error }),
|
|
8583
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
|
|
8417
8584
|
] }),
|
|
8418
|
-
/* @__PURE__ */ (0,
|
|
8585
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(FormError, { children: mutation.error })
|
|
8419
8586
|
] });
|
|
8420
8587
|
}
|
|
8421
8588
|
|
|
8422
8589
|
// src/components/user-profile/SocialSection.tsx
|
|
8423
|
-
var
|
|
8590
|
+
var React44 = __toESM(require("react"), 1);
|
|
8424
8591
|
init_hooks();
|
|
8425
8592
|
init_i18n();
|
|
8426
8593
|
init_use_submit_action();
|
|
8427
8594
|
init_FormError();
|
|
8428
|
-
var
|
|
8595
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
8429
8596
|
function providerLabel(provider) {
|
|
8430
8597
|
return provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
8431
8598
|
}
|
|
@@ -8434,7 +8601,7 @@ function SocialSection() {
|
|
|
8434
8601
|
const account = useAccount();
|
|
8435
8602
|
const { config } = usePublicConfig();
|
|
8436
8603
|
const mutation = useSubmitAction();
|
|
8437
|
-
const titleId =
|
|
8604
|
+
const titleId = React44.useId();
|
|
8438
8605
|
const resource = useAccountResource(
|
|
8439
8606
|
() => account.listSocialAccounts(),
|
|
8440
8607
|
t("userProfile.social.loadError")
|
|
@@ -8465,18 +8632,18 @@ function SocialSection() {
|
|
|
8465
8632
|
{ failure: t("userProfile.social.unlinkError"), onSuccess: resource.load }
|
|
8466
8633
|
);
|
|
8467
8634
|
};
|
|
8468
|
-
return /* @__PURE__ */ (0,
|
|
8469
|
-
/* @__PURE__ */ (0,
|
|
8470
|
-
/* @__PURE__ */ (0,
|
|
8471
|
-
/* @__PURE__ */ (0,
|
|
8635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
8636
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("header", { className: "ba-profile-section-header", children: [
|
|
8637
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h2", { id: titleId, className: "ba-title", children: t("userProfile.social.title") }),
|
|
8638
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "ba-muted", children: t("userProfile.social.description") })
|
|
8472
8639
|
] }),
|
|
8473
|
-
resource.data === null ? resource.loading ? /* @__PURE__ */ (0,
|
|
8474
|
-
linked.map((item) => /* @__PURE__ */ (0,
|
|
8475
|
-
/* @__PURE__ */ (0,
|
|
8476
|
-
/* @__PURE__ */ (0,
|
|
8477
|
-
/* @__PURE__ */ (0,
|
|
8640
|
+
resource.data === null ? resource.loading ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "ba-skeleton" }) }) : null : /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("ul", { className: "ba-profile-list", children: [
|
|
8641
|
+
linked.map((item) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("li", { className: "ba-profile-list-item", children: [
|
|
8642
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { children: [
|
|
8643
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("strong", { children: providerLabel(item.providerId) }),
|
|
8644
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("small", { children: item.canUnlink ? t("userProfile.social.connected") : t("userProfile.social.lastMethod") })
|
|
8478
8645
|
] }),
|
|
8479
|
-
/* @__PURE__ */ (0,
|
|
8646
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
8480
8647
|
"button",
|
|
8481
8648
|
{
|
|
8482
8649
|
className: "ba-link-button ba-danger",
|
|
@@ -8491,33 +8658,33 @@ function SocialSection() {
|
|
|
8491
8658
|
}
|
|
8492
8659
|
)
|
|
8493
8660
|
] }, item.id)),
|
|
8494
|
-
linked.length === 0 && /* @__PURE__ */ (0,
|
|
8661
|
+
linked.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("li", { className: "ba-muted", children: t("userProfile.social.empty") })
|
|
8495
8662
|
] }),
|
|
8496
|
-
available.length > 0 && /* @__PURE__ */ (0,
|
|
8497
|
-
/* @__PURE__ */ (0,
|
|
8498
|
-
available.map((provider) => /* @__PURE__ */ (0,
|
|
8663
|
+
available.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "ba-profile-provider-actions", children: [
|
|
8664
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "ba-profile-subtitle", children: t("userProfile.social.add") }),
|
|
8665
|
+
available.map((provider) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", className: "ba-button ba-button-secondary", disabled: mutation.pending, onClick: () => link(provider), children: t("userProfile.social.connectProvider", { provider: providerLabel(provider) }) }, provider))
|
|
8499
8666
|
] }),
|
|
8500
|
-
resource.error && /* @__PURE__ */ (0,
|
|
8501
|
-
/* @__PURE__ */ (0,
|
|
8502
|
-
/* @__PURE__ */ (0,
|
|
8667
|
+
resource.error && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "ba-profile-inline-error", children: [
|
|
8668
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FormError, { children: resource.error }),
|
|
8669
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
|
|
8503
8670
|
] }),
|
|
8504
|
-
/* @__PURE__ */ (0,
|
|
8671
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FormError, { children: mutation.error })
|
|
8505
8672
|
] });
|
|
8506
8673
|
}
|
|
8507
8674
|
|
|
8508
8675
|
// src/components/user-profile/UserProfileModal.tsx
|
|
8509
|
-
var
|
|
8676
|
+
var React45 = __toESM(require("react"), 1);
|
|
8510
8677
|
init_i18n();
|
|
8511
8678
|
init_ModalSurface();
|
|
8512
|
-
var
|
|
8679
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
8513
8680
|
function UserProfileModal({
|
|
8514
8681
|
children,
|
|
8515
8682
|
onClose,
|
|
8516
8683
|
branding
|
|
8517
8684
|
}) {
|
|
8518
8685
|
const t = useT();
|
|
8519
|
-
const titleId =
|
|
8520
|
-
return /* @__PURE__ */ (0,
|
|
8686
|
+
const titleId = React45.useId();
|
|
8687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
8521
8688
|
ModalSurface,
|
|
8522
8689
|
{
|
|
8523
8690
|
overlayClassName: "ba-profile-overlay",
|
|
@@ -8526,13 +8693,13 @@ function UserProfileModal({
|
|
|
8526
8693
|
testId: "user-profile-modal",
|
|
8527
8694
|
onClose,
|
|
8528
8695
|
children: [
|
|
8529
|
-
/* @__PURE__ */ (0,
|
|
8530
|
-
/* @__PURE__ */ (0,
|
|
8696
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "ba-profile-modal-header", children: [
|
|
8697
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { children: [
|
|
8531
8698
|
branding,
|
|
8532
|
-
/* @__PURE__ */ (0,
|
|
8533
|
-
/* @__PURE__ */ (0,
|
|
8699
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h1", { id: titleId, children: t("userProfile.title") }),
|
|
8700
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { children: t("userProfile.description") })
|
|
8534
8701
|
] }),
|
|
8535
|
-
/* @__PURE__ */ (0,
|
|
8702
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
8536
8703
|
"button",
|
|
8537
8704
|
{
|
|
8538
8705
|
type: "button",
|
|
@@ -8540,7 +8707,7 @@ function UserProfileModal({
|
|
|
8540
8707
|
"aria-label": t("userProfile.close"),
|
|
8541
8708
|
onClick: onClose,
|
|
8542
8709
|
autoFocus: true,
|
|
8543
|
-
children: /* @__PURE__ */ (0,
|
|
8710
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
8544
8711
|
"path",
|
|
8545
8712
|
{
|
|
8546
8713
|
d: "M6 6l12 12M18 6L6 18",
|
|
@@ -8553,39 +8720,39 @@ function UserProfileModal({
|
|
|
8553
8720
|
)
|
|
8554
8721
|
] }),
|
|
8555
8722
|
children,
|
|
8556
|
-
/* @__PURE__ */ (0,
|
|
8723
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AuthOwlBadge, {}) })
|
|
8557
8724
|
]
|
|
8558
8725
|
}
|
|
8559
8726
|
);
|
|
8560
8727
|
}
|
|
8561
8728
|
|
|
8562
8729
|
// src/components/PrivacyCenter.tsx
|
|
8563
|
-
var
|
|
8564
|
-
var
|
|
8565
|
-
var PrivacyCenterContent2 =
|
|
8730
|
+
var React47 = __toESM(require("react"), 1);
|
|
8731
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
8732
|
+
var PrivacyCenterContent2 = React47.lazy(async () => {
|
|
8566
8733
|
const module2 = await Promise.resolve().then(() => (init_PrivacyCenterContent(), PrivacyCenterContent_exports));
|
|
8567
8734
|
return { default: module2.PrivacyCenterContent };
|
|
8568
8735
|
});
|
|
8569
8736
|
function PrivacyCenter(props = {}) {
|
|
8570
|
-
return /* @__PURE__ */ (0,
|
|
8737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(React47.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PrivacyCenterFallback, { className: props.className }), children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PrivacyCenterContent2, { ...props }) });
|
|
8571
8738
|
}
|
|
8572
8739
|
function PrivacyCenterFallback({ className }) {
|
|
8573
|
-
return /* @__PURE__ */ (0,
|
|
8740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
8574
8741
|
"section",
|
|
8575
8742
|
{
|
|
8576
8743
|
className: ["ba-profile-section ba-privacy-center", className].filter(Boolean).join(" "),
|
|
8577
8744
|
"aria-busy": "true",
|
|
8578
8745
|
children: [
|
|
8579
|
-
/* @__PURE__ */ (0,
|
|
8580
|
-
/* @__PURE__ */ (0,
|
|
8581
|
-
/* @__PURE__ */ (0,
|
|
8746
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "ba-skeleton" }),
|
|
8747
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "ba-skeleton" }),
|
|
8748
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "ba-skeleton" })
|
|
8582
8749
|
]
|
|
8583
8750
|
}
|
|
8584
8751
|
);
|
|
8585
8752
|
}
|
|
8586
8753
|
|
|
8587
8754
|
// src/components/UserProfile.tsx
|
|
8588
|
-
var
|
|
8755
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
8589
8756
|
var SECTION_KEYS = {
|
|
8590
8757
|
profile: "userProfile.nav.profile",
|
|
8591
8758
|
email: "userProfile.nav.email",
|
|
@@ -8615,7 +8782,7 @@ function UserProfile(props = {}) {
|
|
|
8615
8782
|
const t = useT();
|
|
8616
8783
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
8617
8784
|
const { config } = usePublicConfig();
|
|
8618
|
-
const [internalSection, setInternalSection] =
|
|
8785
|
+
const [internalSection, setInternalSection] = React48.useState(() => initialSection(defaultSection));
|
|
8619
8786
|
const active = section ?? internalSection;
|
|
8620
8787
|
const capabilities = (0, import_core4.resolveProjectCapabilities)(config);
|
|
8621
8788
|
const passwordEnabled = config !== null && capabilities.passwordSignIn;
|
|
@@ -8625,7 +8792,7 @@ function UserProfile(props = {}) {
|
|
|
8625
8792
|
const deletionEnabled = capabilities.accountDeletion;
|
|
8626
8793
|
const socialEnabled = (config?.socialProviders?.length ?? 0) > 0;
|
|
8627
8794
|
const privacyEnabled = config?.privacy !== void 0;
|
|
8628
|
-
const sections =
|
|
8795
|
+
const sections = React48.useMemo(
|
|
8629
8796
|
() => userProfileSectionsFor({
|
|
8630
8797
|
password: passwordEnabled,
|
|
8631
8798
|
passkeys: passkeysEnabled,
|
|
@@ -8637,7 +8804,7 @@ function UserProfile(props = {}) {
|
|
|
8637
8804
|
}),
|
|
8638
8805
|
[deletionEnabled, mfaEnabled, passkeysEnabled, passwordEnabled, privacyEnabled, recoveryEnabled, socialEnabled]
|
|
8639
8806
|
);
|
|
8640
|
-
|
|
8807
|
+
React48.useEffect(() => {
|
|
8641
8808
|
if (section || mode !== "page") return;
|
|
8642
8809
|
const onHashChange = () => {
|
|
8643
8810
|
const next = userProfileSectionFromHash(window.location.hash);
|
|
@@ -8654,11 +8821,11 @@ function UserProfile(props = {}) {
|
|
|
8654
8821
|
window.history.replaceState(null, "", userProfileSectionHash(next));
|
|
8655
8822
|
}
|
|
8656
8823
|
};
|
|
8657
|
-
const content = !isLoaded ? /* @__PURE__ */ (0,
|
|
8658
|
-
/* @__PURE__ */ (0,
|
|
8659
|
-
/* @__PURE__ */ (0,
|
|
8660
|
-
/* @__PURE__ */ (0,
|
|
8661
|
-
] }) : !isSignedIn || !user ? /* @__PURE__ */ (0,
|
|
8824
|
+
const content = !isLoaded ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "ba-profile-loading", "aria-busy": "true", children: [
|
|
8825
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "ba-skeleton" }),
|
|
8826
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "ba-skeleton" }),
|
|
8827
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "ba-skeleton" })
|
|
8828
|
+
] }) : !isSignedIn || !user ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "ba-muted", children: t("userProfile.signedOut") }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
8662
8829
|
UserProfileBody,
|
|
8663
8830
|
{
|
|
8664
8831
|
active: visibleActive,
|
|
@@ -8670,23 +8837,23 @@ function UserProfile(props = {}) {
|
|
|
8670
8837
|
user.id
|
|
8671
8838
|
);
|
|
8672
8839
|
if (props.mode === "modal") {
|
|
8673
|
-
return /* @__PURE__ */ (0,
|
|
8840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
8674
8841
|
UserProfileModal,
|
|
8675
8842
|
{
|
|
8676
8843
|
onClose: props.onClose,
|
|
8677
|
-
branding: showBranding ? /* @__PURE__ */ (0,
|
|
8844
|
+
branding: showBranding ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(AuthOwlBranding, {}) : null,
|
|
8678
8845
|
children: content
|
|
8679
8846
|
}
|
|
8680
8847
|
);
|
|
8681
8848
|
}
|
|
8682
|
-
return /* @__PURE__ */ (0,
|
|
8683
|
-
/* @__PURE__ */ (0,
|
|
8684
|
-
showBranding ? /* @__PURE__ */ (0,
|
|
8685
|
-
/* @__PURE__ */ (0,
|
|
8686
|
-
/* @__PURE__ */ (0,
|
|
8849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("article", { className: "ba-profile ba-profile-page", "data-testid": "user-profile", children: [
|
|
8850
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("header", { className: "ba-profile-heading", children: [
|
|
8851
|
+
showBranding ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(AuthOwlBranding, {}) : null,
|
|
8852
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h1", { children: t("userProfile.title") }),
|
|
8853
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { children: t("userProfile.description") })
|
|
8687
8854
|
] }),
|
|
8688
8855
|
content,
|
|
8689
|
-
/* @__PURE__ */ (0,
|
|
8856
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(AuthOwlBadge, {}) })
|
|
8690
8857
|
] });
|
|
8691
8858
|
}
|
|
8692
8859
|
function UserProfileBody({
|
|
@@ -8697,8 +8864,8 @@ function UserProfileBody({
|
|
|
8697
8864
|
capabilities
|
|
8698
8865
|
}) {
|
|
8699
8866
|
const t = useT();
|
|
8700
|
-
return /* @__PURE__ */ (0,
|
|
8701
|
-
/* @__PURE__ */ (0,
|
|
8867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "ba-profile-layout", children: [
|
|
8868
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("nav", { className: "ba-profile-nav", "aria-label": t("userProfile.nav.aria"), children: sections.map((item) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
8702
8869
|
"button",
|
|
8703
8870
|
{
|
|
8704
8871
|
type: "button",
|
|
@@ -8709,8 +8876,8 @@ function UserProfileBody({
|
|
|
8709
8876
|
},
|
|
8710
8877
|
item
|
|
8711
8878
|
)) }),
|
|
8712
|
-
/* @__PURE__ */ (0,
|
|
8713
|
-
active === "profile" && /* @__PURE__ */ (0,
|
|
8879
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "ba-profile-content", "data-section": active, children: [
|
|
8880
|
+
active === "profile" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
8714
8881
|
ProfileSection,
|
|
8715
8882
|
{
|
|
8716
8883
|
firstLastName: capabilities.firstLastName,
|
|
@@ -8718,41 +8885,41 @@ function UserProfileBody({
|
|
|
8718
8885
|
legacyNameField: capabilities.legacyNameField
|
|
8719
8886
|
}
|
|
8720
8887
|
),
|
|
8721
|
-
active === "email" && /* @__PURE__ */ (0,
|
|
8722
|
-
active === "password" && /* @__PURE__ */ (0,
|
|
8723
|
-
active === "social" && /* @__PURE__ */ (0,
|
|
8724
|
-
active === "sessions" && /* @__PURE__ */ (0,
|
|
8725
|
-
active === "passkeys" && /* @__PURE__ */ (0,
|
|
8726
|
-
active === "mfa" && /* @__PURE__ */ (0,
|
|
8727
|
-
active === "recovery" && /* @__PURE__ */ (0,
|
|
8728
|
-
active === "privacy" && /* @__PURE__ */ (0,
|
|
8729
|
-
active === "danger" && /* @__PURE__ */ (0,
|
|
8888
|
+
active === "email" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(EmailSection, { allowChange: capabilities.emailChange }),
|
|
8889
|
+
active === "password" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(PasswordSection, {}),
|
|
8890
|
+
active === "social" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SocialSection, {}),
|
|
8891
|
+
active === "sessions" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SessionsSection, {}),
|
|
8892
|
+
active === "passkeys" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(PasskeysSection, { allowAdd: capabilities.passkeyAdd }),
|
|
8893
|
+
active === "mfa" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(MfaSection, {}),
|
|
8894
|
+
active === "recovery" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(RecoverySection, {}),
|
|
8895
|
+
active === "privacy" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(PrivacyCenter, {}),
|
|
8896
|
+
active === "danger" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DeleteAccountSection, { onDeleted })
|
|
8730
8897
|
] })
|
|
8731
8898
|
] });
|
|
8732
8899
|
}
|
|
8733
8900
|
|
|
8734
8901
|
// src/components/UserButton.tsx
|
|
8735
|
-
var
|
|
8902
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
8736
8903
|
function UserButton() {
|
|
8737
8904
|
const t = useT();
|
|
8738
8905
|
const { user, isLoaded } = useUser();
|
|
8739
8906
|
const { signOut } = useSignOut();
|
|
8740
|
-
const [open, setOpen] =
|
|
8741
|
-
const [profileOpen, setProfileOpen] =
|
|
8742
|
-
const [failedImage, setFailedImage] =
|
|
8743
|
-
const triggerRef =
|
|
8907
|
+
const [open, setOpen] = React49.useState(false);
|
|
8908
|
+
const [profileOpen, setProfileOpen] = React49.useState(false);
|
|
8909
|
+
const [failedImage, setFailedImage] = React49.useState(null);
|
|
8910
|
+
const triggerRef = React49.useRef(null);
|
|
8744
8911
|
if (!isLoaded || !user) return null;
|
|
8745
8912
|
const identity = user.email ?? user.phoneNumber ?? user.name ?? "?";
|
|
8746
8913
|
const image = user.image ?? null;
|
|
8747
|
-
return /* @__PURE__ */ (0,
|
|
8748
|
-
/* @__PURE__ */ (0,
|
|
8914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ba-user-button", "data-testid": "user-button", children: [
|
|
8915
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
8749
8916
|
"button",
|
|
8750
8917
|
{
|
|
8751
8918
|
ref: triggerRef,
|
|
8752
8919
|
className: "ba-user-button-trigger",
|
|
8753
8920
|
"aria-label": t("userButton.openMenuAria"),
|
|
8754
8921
|
onClick: () => setOpen((v) => !v),
|
|
8755
|
-
children: image && failedImage !== image ? /* @__PURE__ */ (0,
|
|
8922
|
+
children: image && failedImage !== image ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
8756
8923
|
"img",
|
|
8757
8924
|
{
|
|
8758
8925
|
className: "ba-avatar",
|
|
@@ -8761,12 +8928,12 @@ function UserButton() {
|
|
|
8761
8928
|
referrerPolicy: "no-referrer",
|
|
8762
8929
|
onError: () => setFailedImage(image)
|
|
8763
8930
|
}
|
|
8764
|
-
) : /* @__PURE__ */ (0,
|
|
8931
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ba-avatar ba-avatar-fallback", children: identity[0]?.toUpperCase() })
|
|
8765
8932
|
}
|
|
8766
8933
|
),
|
|
8767
|
-
open && /* @__PURE__ */ (0,
|
|
8768
|
-
/* @__PURE__ */ (0,
|
|
8769
|
-
/* @__PURE__ */ (0,
|
|
8934
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ba-menu", children: [
|
|
8935
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "ba-menu-label", children: identity }),
|
|
8936
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
8770
8937
|
"button",
|
|
8771
8938
|
{
|
|
8772
8939
|
className: "ba-menu-item",
|
|
@@ -8777,10 +8944,10 @@ function UserButton() {
|
|
|
8777
8944
|
children: t("userButton.manageAccount")
|
|
8778
8945
|
}
|
|
8779
8946
|
),
|
|
8780
|
-
/* @__PURE__ */ (0,
|
|
8781
|
-
/* @__PURE__ */ (0,
|
|
8947
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { className: "ba-menu-item", onClick: () => signOut(), children: t("userButton.signOut") }),
|
|
8948
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ba-menu-badge", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AuthOwlBadge, {}) })
|
|
8782
8949
|
] }),
|
|
8783
|
-
profileOpen && /* @__PURE__ */ (0,
|
|
8950
|
+
profileOpen && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
8784
8951
|
UserProfile,
|
|
8785
8952
|
{
|
|
8786
8953
|
mode: "modal",
|
|
@@ -8796,18 +8963,18 @@ function UserButton() {
|
|
|
8796
8963
|
}
|
|
8797
8964
|
|
|
8798
8965
|
// src/components/OrganizationSwitcher.tsx
|
|
8799
|
-
var
|
|
8800
|
-
var
|
|
8801
|
-
var OrganizationSwitcherContent2 =
|
|
8966
|
+
var React64 = __toESM(require("react"), 1);
|
|
8967
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
8968
|
+
var OrganizationSwitcherContent2 = React64.lazy(async () => {
|
|
8802
8969
|
const module2 = await Promise.resolve().then(() => (init_OrganizationSwitcherContent(), OrganizationSwitcherContent_exports));
|
|
8803
8970
|
return { default: module2.OrganizationSwitcherContent };
|
|
8804
8971
|
});
|
|
8805
8972
|
function OrganizationSwitcher(props = {}) {
|
|
8806
|
-
return /* @__PURE__ */ (0,
|
|
8807
|
-
|
|
8973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
8974
|
+
React64.Suspense,
|
|
8808
8975
|
{
|
|
8809
|
-
fallback: /* @__PURE__ */ (0,
|
|
8810
|
-
children: /* @__PURE__ */ (0,
|
|
8976
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-busy": "true" }),
|
|
8977
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(OrganizationSwitcherContent2, { ...props })
|
|
8811
8978
|
}
|
|
8812
8979
|
);
|
|
8813
8980
|
}
|
|
@@ -8816,14 +8983,14 @@ function OrganizationSwitcher(props = {}) {
|
|
|
8816
8983
|
init_InvitationPrompt();
|
|
8817
8984
|
|
|
8818
8985
|
// src/components/OrganizationList.tsx
|
|
8819
|
-
var
|
|
8820
|
-
var
|
|
8821
|
-
var OrganizationListContent2 =
|
|
8986
|
+
var React66 = __toESM(require("react"), 1);
|
|
8987
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
8988
|
+
var OrganizationListContent2 = React66.lazy(async () => {
|
|
8822
8989
|
const module2 = await Promise.resolve().then(() => (init_OrganizationListContent(), OrganizationListContent_exports));
|
|
8823
8990
|
return { default: module2.OrganizationListContent };
|
|
8824
8991
|
});
|
|
8825
8992
|
function OrganizationList(props = {}) {
|
|
8826
|
-
return /* @__PURE__ */ (0,
|
|
8993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(React66.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ba-skeleton", "aria-busy": "true" }), children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(OrganizationListContent2, { ...props }) });
|
|
8827
8994
|
}
|
|
8828
8995
|
|
|
8829
8996
|
// src/index.ts
|
|
@@ -8831,7 +8998,7 @@ init_CreateOrganization();
|
|
|
8831
8998
|
init_OrganizationProfile();
|
|
8832
8999
|
|
|
8833
9000
|
// src/components/GoogleOneTap.tsx
|
|
8834
|
-
var
|
|
9001
|
+
var React67 = __toESM(require("react"), 1);
|
|
8835
9002
|
init_hooks();
|
|
8836
9003
|
|
|
8837
9004
|
// src/components/google-one-tap.ts
|
|
@@ -9008,16 +9175,16 @@ function GoogleOneTap({
|
|
|
9008
9175
|
const { config, isLoading: configLoading, isError: configError } = usePublicConfig();
|
|
9009
9176
|
const { user, isLoaded: sessionLoaded } = useUser();
|
|
9010
9177
|
const { signInSocial } = useSignIn();
|
|
9011
|
-
const callbacks =
|
|
9178
|
+
const callbacks = React67.useRef({ onSignedIn, onSkipped, onDismissed, onError });
|
|
9012
9179
|
callbacks.current = { onSignedIn, onSkipped, onDismissed, onError };
|
|
9013
9180
|
const googleEnabled = config?.socialProviders.includes("google") === true;
|
|
9014
9181
|
const clientId = config?.socialProviderClientIds?.google;
|
|
9015
|
-
|
|
9182
|
+
React67.useEffect(() => {
|
|
9016
9183
|
if (process.env.NODE_ENV === "production") return;
|
|
9017
9184
|
if (disabled || !googleEnabled || !clientId || nonce) return;
|
|
9018
9185
|
warnOneTapWithoutNonce(clientId);
|
|
9019
9186
|
}, [clientId, disabled, googleEnabled, nonce]);
|
|
9020
|
-
|
|
9187
|
+
React67.useEffect(() => {
|
|
9021
9188
|
if (configLoading || !sessionLoaded) return;
|
|
9022
9189
|
if (disabled) {
|
|
9023
9190
|
callbacks.current.onSkipped?.("disabled");
|
|
@@ -9133,8 +9300,8 @@ function GoogleOneTap({
|
|
|
9133
9300
|
}
|
|
9134
9301
|
|
|
9135
9302
|
// src/index.ts
|
|
9136
|
-
var
|
|
9137
|
-
var
|
|
9303
|
+
var import_core11 = require("@authowl/core");
|
|
9304
|
+
var import_core12 = require("@authowl/core");
|
|
9138
9305
|
init_last_used_method();
|
|
9139
9306
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9140
9307
|
0 && (module.exports = {
|
|
@@ -9165,11 +9332,13 @@ init_last_used_method();
|
|
|
9165
9332
|
OrganizationSwitcher,
|
|
9166
9333
|
PasskeyButton,
|
|
9167
9334
|
PasskeyManager,
|
|
9335
|
+
PasskeyOfferGate,
|
|
9168
9336
|
PhoneOTP,
|
|
9169
9337
|
PrivacyCenter,
|
|
9170
9338
|
Protect,
|
|
9171
9339
|
RateLimitedError,
|
|
9172
9340
|
ResetPassword,
|
|
9341
|
+
SECOND_FACTOR_REQUIRED,
|
|
9173
9342
|
SignIn,
|
|
9174
9343
|
SignOutButton,
|
|
9175
9344
|
SignUp,
|
|
@@ -9208,6 +9377,7 @@ init_last_used_method();
|
|
|
9208
9377
|
useSignIn,
|
|
9209
9378
|
useSignOut,
|
|
9210
9379
|
useSignUp,
|
|
9380
|
+
useStepUpAction,
|
|
9211
9381
|
useUser,
|
|
9212
9382
|
useWaitlist
|
|
9213
9383
|
});
|