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