@authowl/react 0.19.1 → 0.21.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/dist/TeamsSection-SHXAL64Q.js +295 -0
- package/dist/chunk-K67DJJHP.js +959 -0
- package/dist/index.cjs +1073 -351
- package/dist/index.d.cts +25 -4
- package/dist/index.d.ts +25 -4
- package/dist/index.js +1078 -1884
- package/dist/styles.css +1 -1
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -6,6 +6,14 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __esm = (fn, res, err) => function __init() {
|
|
10
|
+
if (err) throw err[0];
|
|
11
|
+
try {
|
|
12
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
13
|
+
} catch (e) {
|
|
14
|
+
throw err = [e], e;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
9
17
|
var __export = (target, all) => {
|
|
10
18
|
for (var name in all)
|
|
11
19
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -28,87 +36,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
36
|
));
|
|
29
37
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
38
|
|
|
31
|
-
// src/index.ts
|
|
32
|
-
var index_exports = {};
|
|
33
|
-
__export(index_exports, {
|
|
34
|
-
AuthLoaded: () => AuthLoaded,
|
|
35
|
-
AuthLoading: () => AuthLoading,
|
|
36
|
-
AuthOwlBadge: () => AuthOwlBadge,
|
|
37
|
-
AuthOwlBranding: () => AuthOwlBranding,
|
|
38
|
-
AuthOwlError: () => import_core7.AuthOwlError,
|
|
39
|
-
AuthOwlProvider: () => AuthOwlProvider,
|
|
40
|
-
BackupCodesManager: () => BackupCodesManager,
|
|
41
|
-
Bidi: () => Bidi,
|
|
42
|
-
ConsentDocLinks: () => ConsentDocLinks,
|
|
43
|
-
ConsentGate: () => ConsentGate,
|
|
44
|
-
CreateOrganization: () => CreateOrganization,
|
|
45
|
-
DEFAULT_BRAND_COLOR: () => DEFAULT_BRAND_COLOR,
|
|
46
|
-
EmailOtpForm: () => EmailOtpForm,
|
|
47
|
-
ForgotPassword: () => ForgotPassword,
|
|
48
|
-
GoogleOneTap: () => GoogleOneTap,
|
|
49
|
-
InvalidKeyError: () => import_core7.InvalidKeyError,
|
|
50
|
-
InvitationPrompt: () => InvitationPrompt,
|
|
51
|
-
KNOWN_METHODS: () => KNOWN_METHODS,
|
|
52
|
-
MFAChallenge: () => MFAChallenge,
|
|
53
|
-
MFAEnrollment: () => MFAEnrollment,
|
|
54
|
-
MFARequiredGate: () => MFARequiredGate,
|
|
55
|
-
MagicLinkForm: () => MagicLinkForm,
|
|
56
|
-
OrganizationList: () => OrganizationList,
|
|
57
|
-
OrganizationProfile: () => OrganizationProfile,
|
|
58
|
-
OrganizationSwitcher: () => OrganizationSwitcher,
|
|
59
|
-
PasskeyButton: () => PasskeyButton,
|
|
60
|
-
PasskeyManager: () => PasskeyManager,
|
|
61
|
-
PhoneOTP: () => PhoneOTP,
|
|
62
|
-
Protect: () => Protect,
|
|
63
|
-
RateLimitedError: () => import_core7.RateLimitedError,
|
|
64
|
-
ResetPassword: () => ResetPassword,
|
|
65
|
-
SignIn: () => SignIn,
|
|
66
|
-
SignOutButton: () => SignOutButton,
|
|
67
|
-
SignUp: () => SignUp,
|
|
68
|
-
SignedIn: () => SignedIn,
|
|
69
|
-
SignedOut: () => SignedOut,
|
|
70
|
-
SocialButtons: () => SocialButtons,
|
|
71
|
-
Spinner: () => Spinner,
|
|
72
|
-
UserButton: () => UserButton,
|
|
73
|
-
UserProfile: () => UserProfile,
|
|
74
|
-
VerificationPending: () => VerificationPending,
|
|
75
|
-
VerifyEmail: () => VerifyEmail,
|
|
76
|
-
Waitlist: () => Waitlist,
|
|
77
|
-
createMembershipHas: () => import_core8.createMembershipHas,
|
|
78
|
-
emailAutocomplete: () => emailAutocomplete,
|
|
79
|
-
membershipHas: () => import_core8.membershipHas,
|
|
80
|
-
membershipHasPermission: () => import_core8.membershipHasPermission,
|
|
81
|
-
membershipHasTeam: () => import_core8.membershipHasTeam,
|
|
82
|
-
resolveSignInMethods: () => resolveSignInMethods,
|
|
83
|
-
useAccount: () => useAccount,
|
|
84
|
-
useAuth: () => useAuth,
|
|
85
|
-
useAuthClient: () => useAuthClient,
|
|
86
|
-
useAuthOwlContext: () => useAuthOwlContext,
|
|
87
|
-
useConsent: () => useConsent,
|
|
88
|
-
useEmailVerification: () => useEmailVerification,
|
|
89
|
-
useLocale: () => useLocale,
|
|
90
|
-
useMFA: () => useMFA,
|
|
91
|
-
useOrganization: () => useOrganization,
|
|
92
|
-
useOrganizationInvitation: () => useOrganizationInvitation,
|
|
93
|
-
usePasskeys: () => usePasskeys,
|
|
94
|
-
usePasswordReset: () => usePasswordReset,
|
|
95
|
-
usePublicConfig: () => usePublicConfig,
|
|
96
|
-
useSession: () => useSession,
|
|
97
|
-
useSignIn: () => useSignIn,
|
|
98
|
-
useSignOut: () => useSignOut,
|
|
99
|
-
useSignUp: () => useSignUp,
|
|
100
|
-
useUser: () => useUser,
|
|
101
|
-
useWaitlist: () => useWaitlist
|
|
102
|
-
});
|
|
103
|
-
module.exports = __toCommonJS(index_exports);
|
|
104
|
-
|
|
105
|
-
// src/provider.tsx
|
|
106
|
-
var React5 = __toESM(require("react"), 1);
|
|
107
|
-
var import_core2 = require("@authowl/core");
|
|
108
|
-
|
|
109
39
|
// src/brand.ts
|
|
110
|
-
var DEFAULT_BRAND_COLOR = "#F5B84C";
|
|
111
|
-
var HEX6 = /^#[0-9a-fA-F]{6}$/;
|
|
112
40
|
function isHex6(value) {
|
|
113
41
|
return typeof value === "string" && HEX6.test(value);
|
|
114
42
|
}
|
|
@@ -166,7 +94,6 @@ function oklchToLinearRgb({ L, C, h }) {
|
|
|
166
94
|
b: -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s
|
|
167
95
|
};
|
|
168
96
|
}
|
|
169
|
-
var GAMUT_EPS = 1e-4;
|
|
170
97
|
function inGamut({ r, g, b }) {
|
|
171
98
|
return r >= -GAMUT_EPS && r <= 1 + GAMUT_EPS && g >= -GAMUT_EPS && g <= 1 + GAMUT_EPS && b >= -GAMUT_EPS && b <= 1 + GAMUT_EPS;
|
|
172
99
|
}
|
|
@@ -198,10 +125,6 @@ function contrastRatio(hexA, hexB) {
|
|
|
198
125
|
const [hi, lo] = la >= lb ? [la, lb] : [lb, la];
|
|
199
126
|
return (hi + 0.05) / (lo + 0.05);
|
|
200
127
|
}
|
|
201
|
-
var NEAR_BLACK = "#18181b";
|
|
202
|
-
var WHITE = "#ffffff";
|
|
203
|
-
var AA_TEXT = 4.5;
|
|
204
|
-
var PURE_BLACK = "#000000";
|
|
205
128
|
function readableForeground(solidHex) {
|
|
206
129
|
const white = contrastRatio(WHITE, solidHex);
|
|
207
130
|
const nearBlack = contrastRatio(NEAR_BLACK, solidHex);
|
|
@@ -223,8 +146,6 @@ function readableAccent(brandHex, surfaceHex, dir) {
|
|
|
223
146
|
}
|
|
224
147
|
return dir === 1 ? WHITE : NEAR_BLACK;
|
|
225
148
|
}
|
|
226
|
-
var LIGHT_SURFACE = "#ffffff";
|
|
227
|
-
var DARK_SURFACE = "#18181b";
|
|
228
149
|
function deriveBrandRamp(primaryHex) {
|
|
229
150
|
const solid = normalizeHex(primaryHex) ?? DEFAULT_BRAND_COLOR.toLowerCase();
|
|
230
151
|
const fg = readableForeground(solid);
|
|
@@ -257,6 +178,21 @@ function brandRampVars(set) {
|
|
|
257
178
|
"--ba-rt-accent-fg": set.light.accentFg
|
|
258
179
|
};
|
|
259
180
|
}
|
|
181
|
+
var DEFAULT_BRAND_COLOR, HEX6, GAMUT_EPS, NEAR_BLACK, WHITE, AA_TEXT, PURE_BLACK, LIGHT_SURFACE, DARK_SURFACE;
|
|
182
|
+
var init_brand = __esm({
|
|
183
|
+
"src/brand.ts"() {
|
|
184
|
+
"use strict";
|
|
185
|
+
DEFAULT_BRAND_COLOR = "#F5B84C";
|
|
186
|
+
HEX6 = /^#[0-9a-fA-F]{6}$/;
|
|
187
|
+
GAMUT_EPS = 1e-4;
|
|
188
|
+
NEAR_BLACK = "#18181b";
|
|
189
|
+
WHITE = "#ffffff";
|
|
190
|
+
AA_TEXT = 4.5;
|
|
191
|
+
PURE_BLACK = "#000000";
|
|
192
|
+
LIGHT_SURFACE = "#ffffff";
|
|
193
|
+
DARK_SURFACE = "#18181b";
|
|
194
|
+
}
|
|
195
|
+
});
|
|
260
196
|
|
|
261
197
|
// src/appearance.ts
|
|
262
198
|
function resolveAppearance(appearance, config) {
|
|
@@ -270,13 +206,12 @@ function resolveAppearance(appearance, config) {
|
|
|
270
206
|
}
|
|
271
207
|
return { theme, primaryColor, style };
|
|
272
208
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
var import_core = require("@authowl/core");
|
|
209
|
+
var init_appearance = __esm({
|
|
210
|
+
"src/appearance.ts"() {
|
|
211
|
+
"use strict";
|
|
212
|
+
init_brand();
|
|
213
|
+
}
|
|
214
|
+
});
|
|
280
215
|
|
|
281
216
|
// src/components/auth-state.ts
|
|
282
217
|
function sessionAuthState(data) {
|
|
@@ -287,6 +222,11 @@ function sessionAuthState(data) {
|
|
|
287
222
|
needsMfaEnrollment: hasUser && pending
|
|
288
223
|
};
|
|
289
224
|
}
|
|
225
|
+
var init_auth_state = __esm({
|
|
226
|
+
"src/components/auth-state.ts"() {
|
|
227
|
+
"use strict";
|
|
228
|
+
}
|
|
229
|
+
});
|
|
290
230
|
|
|
291
231
|
// src/hooks.ts
|
|
292
232
|
function useAuthClient() {
|
|
@@ -381,6 +321,43 @@ function useOrganization() {
|
|
|
381
321
|
isLoaded: !isPending && orgLoaded
|
|
382
322
|
};
|
|
383
323
|
}
|
|
324
|
+
function useInvitationRecipientHint() {
|
|
325
|
+
const client = useAuthClient();
|
|
326
|
+
const apiRef = React.useRef(client.organization);
|
|
327
|
+
apiRef.current = client.organization;
|
|
328
|
+
const [result, setResult] = React.useState({
|
|
329
|
+
recipientHint: null,
|
|
330
|
+
isLoaded: false
|
|
331
|
+
});
|
|
332
|
+
React.useEffect(() => {
|
|
333
|
+
let active = true;
|
|
334
|
+
const claim = (0, import_core.readInvitationClaim)();
|
|
335
|
+
if (!claim) {
|
|
336
|
+
setResult({ recipientHint: null, isLoaded: true });
|
|
337
|
+
return () => {
|
|
338
|
+
active = false;
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
void (async () => {
|
|
342
|
+
try {
|
|
343
|
+
const response = await apiRef.current.getInvitationRecipientHint({
|
|
344
|
+
invitationId: claim.id
|
|
345
|
+
});
|
|
346
|
+
if (!active) return;
|
|
347
|
+
setResult({
|
|
348
|
+
recipientHint: response.data?.recipientHint ?? null,
|
|
349
|
+
isLoaded: true
|
|
350
|
+
});
|
|
351
|
+
} catch {
|
|
352
|
+
if (active) setResult({ recipientHint: null, isLoaded: true });
|
|
353
|
+
}
|
|
354
|
+
})();
|
|
355
|
+
return () => {
|
|
356
|
+
active = false;
|
|
357
|
+
};
|
|
358
|
+
}, []);
|
|
359
|
+
return result;
|
|
360
|
+
}
|
|
384
361
|
function useOrganizationInvitation() {
|
|
385
362
|
const client = useAuthClient();
|
|
386
363
|
const apiRef = React.useRef(client.organization);
|
|
@@ -548,12 +525,19 @@ function useSignOut() {
|
|
|
548
525
|
const client = useAuthClient();
|
|
549
526
|
return { signOut: client.signOut };
|
|
550
527
|
}
|
|
528
|
+
var React, import_core;
|
|
529
|
+
var init_hooks = __esm({
|
|
530
|
+
"src/hooks.ts"() {
|
|
531
|
+
"use strict";
|
|
532
|
+
"use client";
|
|
533
|
+
React = __toESM(require("react"), 1);
|
|
534
|
+
import_core = require("@authowl/core");
|
|
535
|
+
init_provider();
|
|
536
|
+
init_auth_state();
|
|
537
|
+
}
|
|
538
|
+
});
|
|
551
539
|
|
|
552
540
|
// src/i18n/index.tsx
|
|
553
|
-
var React2 = __toESM(require("react"), 1);
|
|
554
|
-
var import_i18n = require("@authowl/core/i18n");
|
|
555
|
-
var import_i18n2 = require("@authowl/core/i18n");
|
|
556
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
557
541
|
function useLocale() {
|
|
558
542
|
return useAuthOwlContext().locale;
|
|
559
543
|
}
|
|
@@ -583,12 +567,20 @@ function useServerError() {
|
|
|
583
567
|
[locale]
|
|
584
568
|
);
|
|
585
569
|
}
|
|
570
|
+
var React2, import_i18n, import_i18n2, import_jsx_runtime;
|
|
571
|
+
var init_i18n = __esm({
|
|
572
|
+
"src/i18n/index.tsx"() {
|
|
573
|
+
"use strict";
|
|
574
|
+
"use client";
|
|
575
|
+
React2 = __toESM(require("react"), 1);
|
|
576
|
+
import_i18n = require("@authowl/core/i18n");
|
|
577
|
+
init_provider();
|
|
578
|
+
import_i18n2 = require("@authowl/core/i18n");
|
|
579
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
580
|
+
}
|
|
581
|
+
});
|
|
586
582
|
|
|
587
583
|
// src/components/ModalSurface.tsx
|
|
588
|
-
var React3 = __toESM(require("react"), 1);
|
|
589
|
-
var import_react_dom = require("react-dom");
|
|
590
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
591
|
-
var useClientLayoutEffect = typeof document === "undefined" ? React3.useEffect : React3.useLayoutEffect;
|
|
592
584
|
function ModalSurface({
|
|
593
585
|
overlayClassName,
|
|
594
586
|
panelClassName,
|
|
@@ -661,9 +653,19 @@ function ModalSurface({
|
|
|
661
653
|
portalTarget ? (0, import_react_dom.createPortal)(surface, portalTarget) : null
|
|
662
654
|
] });
|
|
663
655
|
}
|
|
656
|
+
var React3, import_react_dom, import_jsx_runtime2, useClientLayoutEffect;
|
|
657
|
+
var init_ModalSurface = __esm({
|
|
658
|
+
"src/components/ModalSurface.tsx"() {
|
|
659
|
+
"use strict";
|
|
660
|
+
"use client";
|
|
661
|
+
React3 = __toESM(require("react"), 1);
|
|
662
|
+
import_react_dom = require("react-dom");
|
|
663
|
+
import_jsx_runtime2 = require("react/jsx-runtime");
|
|
664
|
+
useClientLayoutEffect = typeof document === "undefined" ? React3.useEffect : React3.useLayoutEffect;
|
|
665
|
+
}
|
|
666
|
+
});
|
|
664
667
|
|
|
665
668
|
// src/components/InvitationPrompt.tsx
|
|
666
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
667
669
|
function InvitationPrompt() {
|
|
668
670
|
const t = useT();
|
|
669
671
|
const { invitation, status, accept, dismiss } = useOrganizationInvitation();
|
|
@@ -721,10 +723,20 @@ function InvitationPrompt() {
|
|
|
721
723
|
}
|
|
722
724
|
);
|
|
723
725
|
}
|
|
726
|
+
var React4, import_jsx_runtime3;
|
|
727
|
+
var init_InvitationPrompt = __esm({
|
|
728
|
+
"src/components/InvitationPrompt.tsx"() {
|
|
729
|
+
"use strict";
|
|
730
|
+
"use client";
|
|
731
|
+
React4 = __toESM(require("react"), 1);
|
|
732
|
+
init_hooks();
|
|
733
|
+
init_i18n();
|
|
734
|
+
init_ModalSurface();
|
|
735
|
+
import_jsx_runtime3 = require("react/jsx-runtime");
|
|
736
|
+
}
|
|
737
|
+
});
|
|
724
738
|
|
|
725
739
|
// src/provider.tsx
|
|
726
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
727
|
-
var warnedConfigProjects = /* @__PURE__ */ new Set();
|
|
728
740
|
function warnPublicConfigFailed(resolved, error) {
|
|
729
741
|
let origin = resolved.apiUrl;
|
|
730
742
|
try {
|
|
@@ -739,7 +751,6 @@ function warnPublicConfigFailed(resolved, error) {
|
|
|
739
751
|
`[AuthOwl] Could not load this project's public config from ${origin} (${reason}). Falling back to a password-only sign-in form, regardless of the methods this project actually enabled. Likely causes: the API is unreachable, \`apiUrl\` is wrong, or the publishable key points at a missing/mismatched project. If password sign-in is not enabled for this project, the form will dead-end at submit - check \`apiUrl\` and \`publishableKey\` on <AuthOwlProvider>. (This warning is dev-only.)`
|
|
740
752
|
);
|
|
741
753
|
}
|
|
742
|
-
var Context = React5.createContext(null);
|
|
743
754
|
function detectLocale() {
|
|
744
755
|
if (typeof document !== "undefined") {
|
|
745
756
|
const root = document.documentElement;
|
|
@@ -818,13 +829,603 @@ function AuthOwlProvider({
|
|
|
818
829
|
}
|
|
819
830
|
) });
|
|
820
831
|
}
|
|
821
|
-
function useAuthOwlContext() {
|
|
822
|
-
const v = React5.useContext(Context);
|
|
823
|
-
if (!v) {
|
|
824
|
-
throw new Error("AuthOwl hooks must be used inside <AuthOwlProvider>");
|
|
832
|
+
function useAuthOwlContext() {
|
|
833
|
+
const v = React5.useContext(Context);
|
|
834
|
+
if (!v) {
|
|
835
|
+
throw new Error("AuthOwl hooks must be used inside <AuthOwlProvider>");
|
|
836
|
+
}
|
|
837
|
+
return v;
|
|
838
|
+
}
|
|
839
|
+
var React5, import_core2, import_jsx_runtime4, warnedConfigProjects, Context;
|
|
840
|
+
var init_provider = __esm({
|
|
841
|
+
"src/provider.tsx"() {
|
|
842
|
+
"use strict";
|
|
843
|
+
"use client";
|
|
844
|
+
React5 = __toESM(require("react"), 1);
|
|
845
|
+
import_core2 = require("@authowl/core");
|
|
846
|
+
init_appearance();
|
|
847
|
+
init_InvitationPrompt();
|
|
848
|
+
import_jsx_runtime4 = require("react/jsx-runtime");
|
|
849
|
+
warnedConfigProjects = /* @__PURE__ */ new Set();
|
|
850
|
+
Context = React5.createContext(null);
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
|
|
854
|
+
// src/components/use-submit-action.ts
|
|
855
|
+
function useSubmitAction() {
|
|
856
|
+
const [pending, setPending] = React6.useState(false);
|
|
857
|
+
const [error, setError] = React6.useState(null);
|
|
858
|
+
const toMessage = useServerError();
|
|
859
|
+
const run = React6.useCallback(
|
|
860
|
+
async (action, { failure, onSuccess, mapError, keepPendingOnSuccess }) => {
|
|
861
|
+
setError(null);
|
|
862
|
+
setPending(true);
|
|
863
|
+
try {
|
|
864
|
+
const res = await action();
|
|
865
|
+
if (res?.error) {
|
|
866
|
+
setError(mapError?.(res.error) ?? toMessage(res.error, failure));
|
|
867
|
+
setPending(false);
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
await onSuccess?.(res ?? { data: null, error: null });
|
|
871
|
+
if (!keepPendingOnSuccess) setPending(false);
|
|
872
|
+
} catch {
|
|
873
|
+
setError(failure);
|
|
874
|
+
setPending(false);
|
|
875
|
+
}
|
|
876
|
+
},
|
|
877
|
+
[toMessage]
|
|
878
|
+
);
|
|
879
|
+
return { pending, error, setError, run };
|
|
880
|
+
}
|
|
881
|
+
var React6;
|
|
882
|
+
var init_use_submit_action = __esm({
|
|
883
|
+
"src/components/use-submit-action.ts"() {
|
|
884
|
+
"use strict";
|
|
885
|
+
"use client";
|
|
886
|
+
React6 = __toESM(require("react"), 1);
|
|
887
|
+
init_i18n();
|
|
888
|
+
}
|
|
889
|
+
});
|
|
890
|
+
|
|
891
|
+
// src/components/Spinner.tsx
|
|
892
|
+
function Spinner() {
|
|
893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ba-spinner", "aria-hidden": "true" });
|
|
894
|
+
}
|
|
895
|
+
function Busy({ busy, label: label2, children }) {
|
|
896
|
+
return busy ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, {}),
|
|
898
|
+
label2
|
|
899
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children });
|
|
900
|
+
}
|
|
901
|
+
var import_jsx_runtime6;
|
|
902
|
+
var init_Spinner = __esm({
|
|
903
|
+
"src/components/Spinner.tsx"() {
|
|
904
|
+
"use strict";
|
|
905
|
+
"use client";
|
|
906
|
+
import_jsx_runtime6 = require("react/jsx-runtime");
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
|
|
910
|
+
// src/components/FormError.tsx
|
|
911
|
+
function FormError({ children, className, "data-testid": testId }) {
|
|
912
|
+
if (children == null || children === "" || children === false) return null;
|
|
913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
914
|
+
"p",
|
|
915
|
+
{
|
|
916
|
+
className: className ? `ba-error ${className}` : "ba-error",
|
|
917
|
+
role: "alert",
|
|
918
|
+
"aria-live": "assertive",
|
|
919
|
+
"data-testid": testId,
|
|
920
|
+
children
|
|
921
|
+
}
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
var import_jsx_runtime7;
|
|
925
|
+
var init_FormError = __esm({
|
|
926
|
+
"src/components/FormError.tsx"() {
|
|
927
|
+
"use strict";
|
|
928
|
+
"use client";
|
|
929
|
+
import_jsx_runtime7 = require("react/jsx-runtime");
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
|
|
933
|
+
// src/components/organization/model.ts
|
|
934
|
+
function organizationSlugFromName(name) {
|
|
935
|
+
return name.normalize("NFKD").toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
|
|
936
|
+
}
|
|
937
|
+
function organizationRoles(role) {
|
|
938
|
+
return role.split(",").map((value) => value.trim()).filter(Boolean);
|
|
939
|
+
}
|
|
940
|
+
function hasOrganizationRole(member, role) {
|
|
941
|
+
return member ? organizationRoles(member.role).includes(role) : false;
|
|
942
|
+
}
|
|
943
|
+
function canManageOrganization(member) {
|
|
944
|
+
return hasOrganizationRole(member, "owner") || hasOrganizationRole(member, "admin");
|
|
945
|
+
}
|
|
946
|
+
function roleHasStatement(roles, heldRoles, resource, action) {
|
|
947
|
+
return roles.some((role) => {
|
|
948
|
+
if (!heldRoles.has(role.role) || typeof role.permission !== "object" || role.permission === null) {
|
|
949
|
+
return false;
|
|
950
|
+
}
|
|
951
|
+
const actions = role.permission[resource];
|
|
952
|
+
return Array.isArray(actions) && actions.includes(action);
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
function teamManagementCapabilities(member, dynamicRoles) {
|
|
956
|
+
const heldRoles = new Set(organizationRoles(member.role));
|
|
957
|
+
if (heldRoles.has("owner") || heldRoles.has("admin")) {
|
|
958
|
+
return {
|
|
959
|
+
createTeam: true,
|
|
960
|
+
updateTeam: true,
|
|
961
|
+
deleteTeam: true,
|
|
962
|
+
addTeamMember: true,
|
|
963
|
+
removeTeamMember: true
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
return {
|
|
967
|
+
createTeam: roleHasStatement(dynamicRoles, heldRoles, "team", "create"),
|
|
968
|
+
updateTeam: roleHasStatement(dynamicRoles, heldRoles, "team", "update"),
|
|
969
|
+
deleteTeam: roleHasStatement(dynamicRoles, heldRoles, "team", "delete"),
|
|
970
|
+
addTeamMember: roleHasStatement(dynamicRoles, heldRoles, "member", "update"),
|
|
971
|
+
removeTeamMember: roleHasStatement(dynamicRoles, heldRoles, "member", "delete")
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
var init_model = __esm({
|
|
975
|
+
"src/components/organization/model.ts"() {
|
|
976
|
+
"use strict";
|
|
977
|
+
}
|
|
978
|
+
});
|
|
979
|
+
|
|
980
|
+
// src/components/organization/use-organization-roles.ts
|
|
981
|
+
function useOrganizationRoles(organizationId) {
|
|
982
|
+
const api = useAuthClient().organization;
|
|
983
|
+
const apiRef = React49.useRef(api);
|
|
984
|
+
apiRef.current = api;
|
|
985
|
+
const [dynamicRoles, setDynamicRoles] = React49.useState([]);
|
|
986
|
+
const requestRef = React49.useRef(0);
|
|
987
|
+
React49.useEffect(() => {
|
|
988
|
+
const token = ++requestRef.current;
|
|
989
|
+
setDynamicRoles([]);
|
|
990
|
+
if (!organizationId) return;
|
|
991
|
+
void (async () => {
|
|
992
|
+
try {
|
|
993
|
+
const result = await apiRef.current.listRoles({ organizationId });
|
|
994
|
+
if (token !== requestRef.current) return;
|
|
995
|
+
setDynamicRoles((result.data ?? []).filter((entry) => entry.role.trim().length > 0));
|
|
996
|
+
} catch {
|
|
997
|
+
}
|
|
998
|
+
})();
|
|
999
|
+
return () => {
|
|
1000
|
+
requestRef.current += 1;
|
|
1001
|
+
};
|
|
1002
|
+
}, [organizationId]);
|
|
1003
|
+
const roles = React49.useMemo(() => {
|
|
1004
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1005
|
+
const out = [];
|
|
1006
|
+
for (const candidate of [...BUILTIN_ROLES, ...dynamicRoles.map((entry) => entry.role)]) {
|
|
1007
|
+
const key = candidate.trim();
|
|
1008
|
+
if (!key || seen.has(key)) continue;
|
|
1009
|
+
seen.add(key);
|
|
1010
|
+
out.push(key);
|
|
1011
|
+
}
|
|
1012
|
+
return out;
|
|
1013
|
+
}, [dynamicRoles]);
|
|
1014
|
+
return { roles, dynamicRoles };
|
|
1015
|
+
}
|
|
1016
|
+
var React49, BUILTIN_ROLES;
|
|
1017
|
+
var init_use_organization_roles = __esm({
|
|
1018
|
+
"src/components/organization/use-organization-roles.ts"() {
|
|
1019
|
+
"use strict";
|
|
1020
|
+
"use client";
|
|
1021
|
+
React49 = __toESM(require("react"), 1);
|
|
1022
|
+
init_hooks();
|
|
1023
|
+
BUILTIN_ROLES = ["owner", "admin", "member"];
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
|
|
1027
|
+
// src/components/organization/use-organization-list-resource.ts
|
|
1028
|
+
function useOrganizationListResource({
|
|
1029
|
+
enabled,
|
|
1030
|
+
resourceKey,
|
|
1031
|
+
request,
|
|
1032
|
+
fallback,
|
|
1033
|
+
inactiveData = null
|
|
1034
|
+
}) {
|
|
1035
|
+
const toServerError = useServerError();
|
|
1036
|
+
const requestFn = React51.useRef(request);
|
|
1037
|
+
requestFn.current = request;
|
|
1038
|
+
const [data, setData] = React51.useState(null);
|
|
1039
|
+
const [error, setError] = React51.useState(null);
|
|
1040
|
+
const requestToken = React51.useRef(0);
|
|
1041
|
+
const refresh = React51.useCallback(async () => {
|
|
1042
|
+
const token = ++requestToken.current;
|
|
1043
|
+
if (!enabled || !resourceKey) {
|
|
1044
|
+
setData(inactiveData);
|
|
1045
|
+
setError(null);
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
setError(null);
|
|
1049
|
+
try {
|
|
1050
|
+
const result = await requestFn.current();
|
|
1051
|
+
if (token !== requestToken.current) return;
|
|
1052
|
+
if (result.error) {
|
|
1053
|
+
setError(toServerError(result.error, fallback));
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
1056
|
+
setData(result.data ?? []);
|
|
1057
|
+
} catch {
|
|
1058
|
+
if (token === requestToken.current) setError(fallback);
|
|
1059
|
+
}
|
|
1060
|
+
}, [enabled, fallback, inactiveData, resourceKey, toServerError]);
|
|
1061
|
+
React51.useEffect(() => {
|
|
1062
|
+
setData(enabled && resourceKey ? null : inactiveData);
|
|
1063
|
+
setError(null);
|
|
1064
|
+
void refresh();
|
|
1065
|
+
return () => {
|
|
1066
|
+
requestToken.current += 1;
|
|
1067
|
+
};
|
|
1068
|
+
}, [enabled, inactiveData, refresh, resourceKey]);
|
|
1069
|
+
return { data, isLoading: data === null && error === null, error, refresh };
|
|
1070
|
+
}
|
|
1071
|
+
var React51;
|
|
1072
|
+
var init_use_organization_list_resource = __esm({
|
|
1073
|
+
"src/components/organization/use-organization-list-resource.ts"() {
|
|
1074
|
+
"use strict";
|
|
1075
|
+
"use client";
|
|
1076
|
+
React51 = __toESM(require("react"), 1);
|
|
1077
|
+
init_i18n();
|
|
1078
|
+
}
|
|
1079
|
+
});
|
|
1080
|
+
|
|
1081
|
+
// src/components/organization/use-team-resources.ts
|
|
1082
|
+
function useTeamsResource(organizationId) {
|
|
1083
|
+
const api = useAuthClient().organization;
|
|
1084
|
+
const apiRef = React52.useRef(api);
|
|
1085
|
+
apiRef.current = api;
|
|
1086
|
+
const t = useT();
|
|
1087
|
+
const resource = useOrganizationListResource({
|
|
1088
|
+
enabled: true,
|
|
1089
|
+
resourceKey: organizationId,
|
|
1090
|
+
request: () => apiRef.current.listTeams({ organizationId }),
|
|
1091
|
+
fallback: t("organization.profile.loadError")
|
|
1092
|
+
});
|
|
1093
|
+
return { teams: resource.data, error: resource.error, reload: resource.refresh };
|
|
1094
|
+
}
|
|
1095
|
+
function useTeamMembersResource(selectedTeamId) {
|
|
1096
|
+
const api = useAuthClient().organization;
|
|
1097
|
+
const apiRef = React52.useRef(api);
|
|
1098
|
+
apiRef.current = api;
|
|
1099
|
+
const t = useT();
|
|
1100
|
+
const resource = useOrganizationListResource({
|
|
1101
|
+
enabled: selectedTeamId !== null,
|
|
1102
|
+
resourceKey: selectedTeamId,
|
|
1103
|
+
request: () => apiRef.current.listTeamMembers({ teamId: selectedTeamId }),
|
|
1104
|
+
fallback: t("organization.profile.loadError")
|
|
1105
|
+
});
|
|
1106
|
+
return { members: resource.data, error: resource.error, reload: resource.refresh };
|
|
1107
|
+
}
|
|
1108
|
+
var React52;
|
|
1109
|
+
var init_use_team_resources = __esm({
|
|
1110
|
+
"src/components/organization/use-team-resources.ts"() {
|
|
1111
|
+
"use strict";
|
|
1112
|
+
"use client";
|
|
1113
|
+
React52 = __toESM(require("react"), 1);
|
|
1114
|
+
init_hooks();
|
|
1115
|
+
init_i18n();
|
|
1116
|
+
init_use_organization_list_resource();
|
|
1117
|
+
}
|
|
1118
|
+
});
|
|
1119
|
+
|
|
1120
|
+
// src/components/organization/TeamMembersPanel.tsx
|
|
1121
|
+
function TeamMembersPanel({
|
|
1122
|
+
organization,
|
|
1123
|
+
team,
|
|
1124
|
+
canAdd,
|
|
1125
|
+
canRemove
|
|
1126
|
+
}) {
|
|
1127
|
+
const t = useT();
|
|
1128
|
+
const api = useAuthClient().organization;
|
|
1129
|
+
const { pending, error: actionError, run } = useSubmitAction();
|
|
1130
|
+
const [userId, setUserId] = React53.useState("");
|
|
1131
|
+
const { members, error, reload } = useTeamMembersResource(team.id);
|
|
1132
|
+
const assignedUserIds = new Set(members?.map((member) => member.userId));
|
|
1133
|
+
const availableMembers = organization.members.filter((member) => !assignedUserIds.has(member.userId));
|
|
1134
|
+
const addableUserId = availableMembers.some((member) => member.userId === userId) ? userId : availableMembers[0]?.userId ?? "";
|
|
1135
|
+
const addMember = (event) => {
|
|
1136
|
+
event.preventDefault();
|
|
1137
|
+
if (!addableUserId) return;
|
|
1138
|
+
void run(
|
|
1139
|
+
() => api.addTeamMember({
|
|
1140
|
+
teamId: team.id,
|
|
1141
|
+
userId: addableUserId,
|
|
1142
|
+
organizationId: organization.id
|
|
1143
|
+
}),
|
|
1144
|
+
{
|
|
1145
|
+
failure: t("organization.profile.general.error"),
|
|
1146
|
+
onSuccess: async () => {
|
|
1147
|
+
setUserId("");
|
|
1148
|
+
await reload();
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
);
|
|
1152
|
+
};
|
|
1153
|
+
const removeMember = (member) => {
|
|
1154
|
+
const organizationMember = organization.members.find((entry) => entry.userId === member.userId);
|
|
1155
|
+
const displayName = organizationMember?.user.name || member.userId;
|
|
1156
|
+
if (!window.confirm(t("organization.profile.teams.removeMemberConfirm", { name: displayName }))) return;
|
|
1157
|
+
void run(
|
|
1158
|
+
() => api.removeTeamMember({
|
|
1159
|
+
teamId: team.id,
|
|
1160
|
+
userId: member.userId,
|
|
1161
|
+
organizationId: organization.id
|
|
1162
|
+
}),
|
|
1163
|
+
{
|
|
1164
|
+
failure: t("organization.profile.general.error"),
|
|
1165
|
+
onSuccess: reload
|
|
1166
|
+
}
|
|
1167
|
+
);
|
|
1168
|
+
};
|
|
1169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ba-organization-user-invitations", children: [
|
|
1170
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("h4", { children: t("organization.profile.teams.manageMembers") }),
|
|
1171
|
+
canAdd && availableMembers.length > 0 && members !== null && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("form", { method: "post", className: "ba-organization-invite-form", onSubmit: addMember, children: [
|
|
1172
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("label", { className: "ba-label", children: [
|
|
1173
|
+
t("organization.profile.teams.addMember"),
|
|
1174
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("select", { className: "ba-input", value: addableUserId, onChange: (event) => setUserId(event.target.value), children: availableMembers.map((member) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("option", { value: member.userId, children: member.user.name || member.user.email || member.userId }, member.userId)) })
|
|
1175
|
+
] }),
|
|
1176
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { className: "ba-button", type: "submit", disabled: pending || !addableUserId, children: t("organization.profile.teams.addMember") })
|
|
1177
|
+
] }),
|
|
1178
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(FormError, { children: actionError }),
|
|
1179
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "ba-inline-error", children: [
|
|
1180
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(FormError, { children: error }),
|
|
1181
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void reload(), children: t("organization.retry") })
|
|
1182
|
+
] }),
|
|
1183
|
+
members?.length ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("ul", { className: "ba-organization-list", children: members.map((member) => {
|
|
1184
|
+
const organizationMember = organization.members.find((entry) => entry.userId === member.userId);
|
|
1185
|
+
const displayName = organizationMember?.user.name || member.userId;
|
|
1186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("li", { className: "ba-organization-member", children: [
|
|
1187
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "ba-organization-member-copy", children: [
|
|
1188
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("strong", { children: displayName }),
|
|
1189
|
+
organizationMember?.user.email && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("small", { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Bidi, { children: organizationMember.user.email }) })
|
|
1190
|
+
] }),
|
|
1191
|
+
canRemove && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => removeMember(member), children: t("organization.profile.teams.removeMember") })
|
|
1192
|
+
] }, member.id);
|
|
1193
|
+
}) }) : error ? null : members === null ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "ba-skeleton", "aria-label": t("common.loading") }) : members.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { className: "ba-muted", children: t("organization.profile.teams.membersEmpty") }) : null
|
|
1194
|
+
] });
|
|
1195
|
+
}
|
|
1196
|
+
var React53, import_jsx_runtime58;
|
|
1197
|
+
var init_TeamMembersPanel = __esm({
|
|
1198
|
+
"src/components/organization/TeamMembersPanel.tsx"() {
|
|
1199
|
+
"use strict";
|
|
1200
|
+
"use client";
|
|
1201
|
+
React53 = __toESM(require("react"), 1);
|
|
1202
|
+
init_hooks();
|
|
1203
|
+
init_i18n();
|
|
1204
|
+
init_FormError();
|
|
1205
|
+
init_use_submit_action();
|
|
1206
|
+
init_use_team_resources();
|
|
1207
|
+
import_jsx_runtime58 = require("react/jsx-runtime");
|
|
825
1208
|
}
|
|
826
|
-
|
|
1209
|
+
});
|
|
1210
|
+
|
|
1211
|
+
// src/components/organization/TeamsSection.tsx
|
|
1212
|
+
var TeamsSection_exports = {};
|
|
1213
|
+
__export(TeamsSection_exports, {
|
|
1214
|
+
default: () => TeamsSection
|
|
1215
|
+
});
|
|
1216
|
+
function TeamsSection({
|
|
1217
|
+
organization,
|
|
1218
|
+
membership
|
|
1219
|
+
}) {
|
|
1220
|
+
const t = useT();
|
|
1221
|
+
const api = useAuthClient().organization;
|
|
1222
|
+
const { pending, error: actionError, run } = useSubmitAction();
|
|
1223
|
+
const { teams, error: teamsError, reload } = useTeamsResource(organization.id);
|
|
1224
|
+
const { dynamicRoles } = useOrganizationRoles(organization.id);
|
|
1225
|
+
const capabilities = teamManagementCapabilities(membership, dynamicRoles);
|
|
1226
|
+
const [name, setName] = React54.useState("");
|
|
1227
|
+
const [selectedTeamId, setSelectedTeamId] = React54.useState(null);
|
|
1228
|
+
const [editingTeamId, setEditingTeamId] = React54.useState(null);
|
|
1229
|
+
const [editingName, setEditingName] = React54.useState("");
|
|
1230
|
+
React54.useEffect(() => {
|
|
1231
|
+
setSelectedTeamId(null);
|
|
1232
|
+
setEditingTeamId(null);
|
|
1233
|
+
setEditingName("");
|
|
1234
|
+
}, [organization.id]);
|
|
1235
|
+
const create = (event) => {
|
|
1236
|
+
event.preventDefault();
|
|
1237
|
+
void run(
|
|
1238
|
+
() => api.createTeam({ organizationId: organization.id, name: name.trim() }),
|
|
1239
|
+
{
|
|
1240
|
+
failure: t("organization.profile.general.error"),
|
|
1241
|
+
onSuccess: async () => {
|
|
1242
|
+
setName("");
|
|
1243
|
+
await reload();
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
);
|
|
1247
|
+
};
|
|
1248
|
+
const beginRename = (team) => {
|
|
1249
|
+
setEditingTeamId(team.id);
|
|
1250
|
+
setEditingName(team.name);
|
|
1251
|
+
};
|
|
1252
|
+
const rename = (event, team) => {
|
|
1253
|
+
event.preventDefault();
|
|
1254
|
+
const nextName = editingName.trim();
|
|
1255
|
+
if (!nextName || nextName === team.name) return;
|
|
1256
|
+
void run(
|
|
1257
|
+
() => api.updateTeam({
|
|
1258
|
+
teamId: team.id,
|
|
1259
|
+
data: { name: nextName, organizationId: organization.id }
|
|
1260
|
+
}),
|
|
1261
|
+
{
|
|
1262
|
+
failure: t("organization.profile.general.error"),
|
|
1263
|
+
onSuccess: async () => {
|
|
1264
|
+
setEditingTeamId(null);
|
|
1265
|
+
setEditingName("");
|
|
1266
|
+
await reload();
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
);
|
|
1270
|
+
};
|
|
1271
|
+
const remove = (team) => {
|
|
1272
|
+
if (!window.confirm(t("organization.profile.teams.removeTeamConfirm", { name: team.name }))) return;
|
|
1273
|
+
void run(
|
|
1274
|
+
() => api.removeTeam({ teamId: team.id, organizationId: organization.id }),
|
|
1275
|
+
{
|
|
1276
|
+
failure: t("organization.profile.general.error"),
|
|
1277
|
+
onSuccess: async () => {
|
|
1278
|
+
if (selectedTeamId === team.id) setSelectedTeamId(null);
|
|
1279
|
+
if (editingTeamId === team.id) setEditingTeamId(null);
|
|
1280
|
+
await reload();
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
);
|
|
1284
|
+
};
|
|
1285
|
+
const selectedTeam = teams?.find((team) => team.id === selectedTeamId);
|
|
1286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("section", { className: "ba-organization-section", children: [
|
|
1287
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
1288
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h3", { className: "ba-title", children: t("organization.profile.teams.title") }),
|
|
1289
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "ba-muted", children: t("organization.profile.teams.description") })
|
|
1290
|
+
] }),
|
|
1291
|
+
capabilities.createTeam ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("form", { method: "post", className: "ba-organization-invite-form", onSubmit: create, children: [
|
|
1292
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("label", { className: "ba-label", children: [
|
|
1293
|
+
t("organization.profile.teams.create"),
|
|
1294
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("input", { className: "ba-input", value: name, onChange: (event) => setName(event.target.value), required: true })
|
|
1295
|
+
] }),
|
|
1296
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-button", type: "submit", disabled: pending || !name.trim(), "aria-busy": pending || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.teams.create") }) })
|
|
1297
|
+
] }) : null,
|
|
1298
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(FormError, { children: actionError }),
|
|
1299
|
+
teamsError && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ba-inline-error", children: [
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(FormError, { children: teamsError }),
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void reload(), children: t("organization.retry") })
|
|
1302
|
+
] }),
|
|
1303
|
+
teams?.length ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("ul", { className: "ba-organization-list", children: teams.map((team) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("li", { className: "ba-organization-member", children: [
|
|
1304
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: team.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
1305
|
+
editingTeamId === team.id ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("form", { method: "post", className: "ba-organization-invite-form", onSubmit: (event) => rename(event, team), children: [
|
|
1306
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("label", { className: "ba-label", children: [
|
|
1307
|
+
t("organization.profile.teams.rename"),
|
|
1308
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("input", { className: "ba-input", value: editingName, onChange: (event) => setEditingName(event.target.value), required: true, autoFocus: true })
|
|
1309
|
+
] }),
|
|
1310
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-button", type: "submit", disabled: pending || !editingName.trim(), children: t("organization.profile.teams.rename") }),
|
|
1311
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => setEditingTeamId(null), children: t("organization.profile.teams.cancel") })
|
|
1312
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
1313
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ba-organization-member-copy", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("strong", { children: team.name }) }),
|
|
1314
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "ba-organization-member-actions", children: [
|
|
1315
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.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") }),
|
|
1316
|
+
capabilities.updateTeam && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => beginRename(team), children: t("organization.profile.teams.rename") }),
|
|
1317
|
+
capabilities.deleteTeam && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => remove(team), children: t("organization.profile.teams.removeTeam") })
|
|
1318
|
+
] })
|
|
1319
|
+
] })
|
|
1320
|
+
] }, team.id)) }) : teamsError ? null : teams === null ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ba-skeleton", "aria-label": t("common.loading") }) : teams.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "ba-muted", children: t("organization.profile.teams.empty") }) : null,
|
|
1321
|
+
selectedTeam && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
1322
|
+
TeamMembersPanel,
|
|
1323
|
+
{
|
|
1324
|
+
organization,
|
|
1325
|
+
team: selectedTeam,
|
|
1326
|
+
canAdd: capabilities.addTeamMember,
|
|
1327
|
+
canRemove: capabilities.removeTeamMember
|
|
1328
|
+
}
|
|
1329
|
+
)
|
|
1330
|
+
] });
|
|
827
1331
|
}
|
|
1332
|
+
var React54, import_jsx_runtime59;
|
|
1333
|
+
var init_TeamsSection = __esm({
|
|
1334
|
+
"src/components/organization/TeamsSection.tsx"() {
|
|
1335
|
+
"use strict";
|
|
1336
|
+
"use client";
|
|
1337
|
+
React54 = __toESM(require("react"), 1);
|
|
1338
|
+
init_hooks();
|
|
1339
|
+
init_i18n();
|
|
1340
|
+
init_FormError();
|
|
1341
|
+
init_Spinner();
|
|
1342
|
+
init_use_submit_action();
|
|
1343
|
+
init_TeamMembersPanel();
|
|
1344
|
+
init_model();
|
|
1345
|
+
init_use_organization_roles();
|
|
1346
|
+
init_use_team_resources();
|
|
1347
|
+
import_jsx_runtime59 = require("react/jsx-runtime");
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
|
|
1351
|
+
// src/index.ts
|
|
1352
|
+
var index_exports = {};
|
|
1353
|
+
__export(index_exports, {
|
|
1354
|
+
AuthLoaded: () => AuthLoaded,
|
|
1355
|
+
AuthLoading: () => AuthLoading,
|
|
1356
|
+
AuthOwlBadge: () => AuthOwlBadge,
|
|
1357
|
+
AuthOwlBranding: () => AuthOwlBranding,
|
|
1358
|
+
AuthOwlError: () => import_core7.AuthOwlError,
|
|
1359
|
+
AuthOwlProvider: () => AuthOwlProvider,
|
|
1360
|
+
BackupCodesManager: () => BackupCodesManager,
|
|
1361
|
+
Bidi: () => Bidi,
|
|
1362
|
+
ConsentDocLinks: () => ConsentDocLinks,
|
|
1363
|
+
ConsentGate: () => ConsentGate,
|
|
1364
|
+
CreateOrganization: () => CreateOrganization,
|
|
1365
|
+
DEFAULT_BRAND_COLOR: () => DEFAULT_BRAND_COLOR,
|
|
1366
|
+
EmailOtpForm: () => EmailOtpForm,
|
|
1367
|
+
ForgotPassword: () => ForgotPassword,
|
|
1368
|
+
GoogleOneTap: () => GoogleOneTap,
|
|
1369
|
+
InvalidKeyError: () => import_core7.InvalidKeyError,
|
|
1370
|
+
InvitationPrompt: () => InvitationPrompt,
|
|
1371
|
+
KNOWN_METHODS: () => KNOWN_METHODS,
|
|
1372
|
+
MFAChallenge: () => MFAChallenge,
|
|
1373
|
+
MFAEnrollment: () => MFAEnrollment,
|
|
1374
|
+
MFARequiredGate: () => MFARequiredGate,
|
|
1375
|
+
MagicLinkForm: () => MagicLinkForm,
|
|
1376
|
+
OrganizationList: () => OrganizationList,
|
|
1377
|
+
OrganizationProfile: () => OrganizationProfile,
|
|
1378
|
+
OrganizationSwitcher: () => OrganizationSwitcher,
|
|
1379
|
+
PasskeyButton: () => PasskeyButton,
|
|
1380
|
+
PasskeyManager: () => PasskeyManager,
|
|
1381
|
+
PhoneOTP: () => PhoneOTP,
|
|
1382
|
+
Protect: () => Protect,
|
|
1383
|
+
RateLimitedError: () => import_core7.RateLimitedError,
|
|
1384
|
+
ResetPassword: () => ResetPassword,
|
|
1385
|
+
SignIn: () => SignIn,
|
|
1386
|
+
SignOutButton: () => SignOutButton,
|
|
1387
|
+
SignUp: () => SignUp,
|
|
1388
|
+
SignedIn: () => SignedIn,
|
|
1389
|
+
SignedOut: () => SignedOut,
|
|
1390
|
+
SocialButtons: () => SocialButtons,
|
|
1391
|
+
Spinner: () => Spinner,
|
|
1392
|
+
UserButton: () => UserButton,
|
|
1393
|
+
UserProfile: () => UserProfile,
|
|
1394
|
+
VerificationPending: () => VerificationPending,
|
|
1395
|
+
VerifyEmail: () => VerifyEmail,
|
|
1396
|
+
Waitlist: () => Waitlist,
|
|
1397
|
+
createMembershipHas: () => import_core8.createMembershipHas,
|
|
1398
|
+
emailAutocomplete: () => emailAutocomplete,
|
|
1399
|
+
membershipHas: () => import_core8.membershipHas,
|
|
1400
|
+
membershipHasPermission: () => import_core8.membershipHasPermission,
|
|
1401
|
+
membershipHasTeam: () => import_core8.membershipHasTeam,
|
|
1402
|
+
resolveSignInMethods: () => resolveSignInMethods,
|
|
1403
|
+
useAccount: () => useAccount,
|
|
1404
|
+
useAuth: () => useAuth,
|
|
1405
|
+
useAuthClient: () => useAuthClient,
|
|
1406
|
+
useAuthOwlContext: () => useAuthOwlContext,
|
|
1407
|
+
useConsent: () => useConsent,
|
|
1408
|
+
useEmailVerification: () => useEmailVerification,
|
|
1409
|
+
useInvitationRecipientHint: () => useInvitationRecipientHint,
|
|
1410
|
+
useLocale: () => useLocale,
|
|
1411
|
+
useMFA: () => useMFA,
|
|
1412
|
+
useOrganization: () => useOrganization,
|
|
1413
|
+
useOrganizationInvitation: () => useOrganizationInvitation,
|
|
1414
|
+
usePasskeys: () => usePasskeys,
|
|
1415
|
+
usePasswordReset: () => usePasswordReset,
|
|
1416
|
+
usePublicConfig: () => usePublicConfig,
|
|
1417
|
+
useSession: () => useSession,
|
|
1418
|
+
useSignIn: () => useSignIn,
|
|
1419
|
+
useSignOut: () => useSignOut,
|
|
1420
|
+
useSignUp: () => useSignUp,
|
|
1421
|
+
useUser: () => useUser,
|
|
1422
|
+
useWaitlist: () => useWaitlist
|
|
1423
|
+
});
|
|
1424
|
+
module.exports = __toCommonJS(index_exports);
|
|
1425
|
+
init_provider();
|
|
1426
|
+
init_i18n();
|
|
1427
|
+
init_brand();
|
|
1428
|
+
init_hooks();
|
|
828
1429
|
|
|
829
1430
|
// src/project-capabilities.ts
|
|
830
1431
|
var import_core3 = require("@authowl/core");
|
|
@@ -899,6 +1500,8 @@ function resolveSignInMethods(config, pageHost) {
|
|
|
899
1500
|
|
|
900
1501
|
// src/components/SignIn.tsx
|
|
901
1502
|
var React19 = __toESM(require("react"), 1);
|
|
1503
|
+
init_hooks();
|
|
1504
|
+
init_i18n();
|
|
902
1505
|
|
|
903
1506
|
// src/components/redirect.ts
|
|
904
1507
|
function isSafeRedirect(redirectTo, origin) {
|
|
@@ -958,37 +1561,12 @@ async function finishSignIn(opts) {
|
|
|
958
1561
|
}
|
|
959
1562
|
}
|
|
960
1563
|
|
|
961
|
-
// src/components/
|
|
962
|
-
|
|
963
|
-
function useSubmitAction() {
|
|
964
|
-
const [pending, setPending] = React6.useState(false);
|
|
965
|
-
const [error, setError] = React6.useState(null);
|
|
966
|
-
const toMessage = useServerError();
|
|
967
|
-
const run = React6.useCallback(
|
|
968
|
-
async (action, { failure, onSuccess, mapError, keepPendingOnSuccess }) => {
|
|
969
|
-
setError(null);
|
|
970
|
-
setPending(true);
|
|
971
|
-
try {
|
|
972
|
-
const res = await action();
|
|
973
|
-
if (res?.error) {
|
|
974
|
-
setError(mapError?.(res.error) ?? toMessage(res.error, failure));
|
|
975
|
-
setPending(false);
|
|
976
|
-
return;
|
|
977
|
-
}
|
|
978
|
-
await onSuccess?.(res ?? { data: null, error: null });
|
|
979
|
-
if (!keepPendingOnSuccess) setPending(false);
|
|
980
|
-
} catch {
|
|
981
|
-
setError(failure);
|
|
982
|
-
setPending(false);
|
|
983
|
-
}
|
|
984
|
-
},
|
|
985
|
-
[toMessage]
|
|
986
|
-
);
|
|
987
|
-
return { pending, error, setError, run };
|
|
988
|
-
}
|
|
1564
|
+
// src/components/SignIn.tsx
|
|
1565
|
+
init_use_submit_action();
|
|
989
1566
|
|
|
990
1567
|
// src/components/passkey-autofill.ts
|
|
991
1568
|
var React7 = __toESM(require("react"), 1);
|
|
1569
|
+
init_hooks();
|
|
992
1570
|
function usePasskeyAutofill(opts) {
|
|
993
1571
|
const { signInPasskey } = useSignIn();
|
|
994
1572
|
const { sessionStore } = useAuthClient();
|
|
@@ -1015,6 +1593,8 @@ function usePasskeyAutofill(opts) {
|
|
|
1015
1593
|
|
|
1016
1594
|
// src/components/SocialButtons.tsx
|
|
1017
1595
|
var React8 = __toESM(require("react"), 1);
|
|
1596
|
+
init_hooks();
|
|
1597
|
+
init_i18n();
|
|
1018
1598
|
|
|
1019
1599
|
// src/components/social-icons.tsx
|
|
1020
1600
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -1069,35 +1649,9 @@ function ProviderIcon({ provider }) {
|
|
|
1069
1649
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: ICONS[provider] ?? null });
|
|
1070
1650
|
}
|
|
1071
1651
|
|
|
1072
|
-
// src/components/Spinner.tsx
|
|
1073
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1074
|
-
function Spinner() {
|
|
1075
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ba-spinner", "aria-hidden": "true" });
|
|
1076
|
-
}
|
|
1077
|
-
function Busy({ busy, label: label2, children }) {
|
|
1078
|
-
return busy ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1079
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Spinner, {}),
|
|
1080
|
-
label2
|
|
1081
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children });
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
// src/components/FormError.tsx
|
|
1085
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1086
|
-
function FormError({ children, className, "data-testid": testId }) {
|
|
1087
|
-
if (children == null || children === "" || children === false) return null;
|
|
1088
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1089
|
-
"p",
|
|
1090
|
-
{
|
|
1091
|
-
className: className ? `ba-error ${className}` : "ba-error",
|
|
1092
|
-
role: "alert",
|
|
1093
|
-
"aria-live": "assertive",
|
|
1094
|
-
"data-testid": testId,
|
|
1095
|
-
children
|
|
1096
|
-
}
|
|
1097
|
-
);
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
1652
|
// src/components/SocialButtons.tsx
|
|
1653
|
+
init_Spinner();
|
|
1654
|
+
init_FormError();
|
|
1101
1655
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1102
1656
|
var LABELS = {
|
|
1103
1657
|
google: "Google",
|
|
@@ -1168,6 +1722,11 @@ function SocialButtons({ providers, callbackURL }) {
|
|
|
1168
1722
|
}
|
|
1169
1723
|
|
|
1170
1724
|
// src/components/PasskeyButton.tsx
|
|
1725
|
+
init_hooks();
|
|
1726
|
+
init_i18n();
|
|
1727
|
+
init_use_submit_action();
|
|
1728
|
+
init_Spinner();
|
|
1729
|
+
init_FormError();
|
|
1171
1730
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1172
1731
|
function PasskeyButton({ redirectTo, onSignedIn }) {
|
|
1173
1732
|
const t = useT();
|
|
@@ -1199,9 +1758,15 @@ function PasskeyButton({ redirectTo, onSignedIn }) {
|
|
|
1199
1758
|
|
|
1200
1759
|
// src/components/ForgotPassword.tsx
|
|
1201
1760
|
var React11 = __toESM(require("react"), 1);
|
|
1761
|
+
init_hooks();
|
|
1762
|
+
init_i18n();
|
|
1763
|
+
init_use_submit_action();
|
|
1764
|
+
init_Spinner();
|
|
1202
1765
|
|
|
1203
1766
|
// src/components/AuthChallenge.tsx
|
|
1204
1767
|
var React10 = __toESM(require("react"), 1);
|
|
1768
|
+
init_hooks();
|
|
1769
|
+
init_i18n();
|
|
1205
1770
|
|
|
1206
1771
|
// src/components/Turnstile.tsx
|
|
1207
1772
|
var React9 = __toESM(require("react"), 1);
|
|
@@ -1411,6 +1976,7 @@ function useAuthChallenge() {
|
|
|
1411
1976
|
}
|
|
1412
1977
|
|
|
1413
1978
|
// src/components/ForgotPassword.tsx
|
|
1979
|
+
init_FormError();
|
|
1414
1980
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1415
1981
|
function ForgotPassword({ resetPasswordUrl, onBack }) {
|
|
1416
1982
|
const t = useT();
|
|
@@ -1472,6 +2038,9 @@ function ForgotPassword({ resetPasswordUrl, onBack }) {
|
|
|
1472
2038
|
}
|
|
1473
2039
|
|
|
1474
2040
|
// src/components/OtpCodeForm.tsx
|
|
2041
|
+
init_i18n();
|
|
2042
|
+
init_Spinner();
|
|
2043
|
+
init_FormError();
|
|
1475
2044
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1476
2045
|
function OtpCodeForm({
|
|
1477
2046
|
email,
|
|
@@ -1519,6 +2088,11 @@ function OtpCodeForm({
|
|
|
1519
2088
|
|
|
1520
2089
|
// src/components/MFAChallenge.tsx
|
|
1521
2090
|
var React12 = __toESM(require("react"), 1);
|
|
2091
|
+
init_hooks();
|
|
2092
|
+
init_i18n();
|
|
2093
|
+
init_use_submit_action();
|
|
2094
|
+
init_Spinner();
|
|
2095
|
+
init_FormError();
|
|
1522
2096
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1523
2097
|
function MFAChallenge({ onVerified, allowTrustDevice = true }) {
|
|
1524
2098
|
const t = useT();
|
|
@@ -1587,9 +2161,15 @@ function MFAChallenge({ onVerified, allowTrustDevice = true }) {
|
|
|
1587
2161
|
|
|
1588
2162
|
// src/components/mfa-enrollment-step.tsx
|
|
1589
2163
|
var React15 = __toESM(require("react"), 1);
|
|
2164
|
+
init_hooks();
|
|
2165
|
+
init_i18n();
|
|
1590
2166
|
|
|
1591
2167
|
// src/components/MFAEnrollment.tsx
|
|
1592
2168
|
var React14 = __toESM(require("react"), 1);
|
|
2169
|
+
init_hooks();
|
|
2170
|
+
init_i18n();
|
|
2171
|
+
init_use_submit_action();
|
|
2172
|
+
init_Spinner();
|
|
1593
2173
|
|
|
1594
2174
|
// src/components/mfa-enrollment.ts
|
|
1595
2175
|
function shouldDiscardSetup(args) {
|
|
@@ -1599,6 +2179,7 @@ function shouldDiscardSetup(args) {
|
|
|
1599
2179
|
|
|
1600
2180
|
// src/components/QrCode.tsx
|
|
1601
2181
|
var React13 = __toESM(require("react"), 1);
|
|
2182
|
+
init_i18n();
|
|
1602
2183
|
|
|
1603
2184
|
// ../../node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs
|
|
1604
2185
|
var qrcode = function(typeNumber, errorCorrectionLevel) {
|
|
@@ -3281,6 +3862,7 @@ function QrCode({ value, size = 200 }) {
|
|
|
3281
3862
|
}
|
|
3282
3863
|
|
|
3283
3864
|
// src/components/MFAEnrollment.tsx
|
|
3865
|
+
init_FormError();
|
|
3284
3866
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3285
3867
|
function secretFromUri(uri) {
|
|
3286
3868
|
try {
|
|
@@ -3464,6 +4046,8 @@ function MfaEnrollmentStep({ title }) {
|
|
|
3464
4046
|
}
|
|
3465
4047
|
|
|
3466
4048
|
// src/components/AuthOwlBadge.tsx
|
|
4049
|
+
init_hooks();
|
|
4050
|
+
init_i18n();
|
|
3467
4051
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3468
4052
|
function OwlMark() {
|
|
3469
4053
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", { className: "ba-badge-mark", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: [
|
|
@@ -3497,11 +4081,20 @@ function AuthOwlBadge({ href = "https://authowl.dev", force } = {}) {
|
|
|
3497
4081
|
);
|
|
3498
4082
|
}
|
|
3499
4083
|
|
|
4084
|
+
// src/components/SignIn.tsx
|
|
4085
|
+
init_Spinner();
|
|
4086
|
+
|
|
3500
4087
|
// src/components/PhoneOTP.tsx
|
|
3501
4088
|
var React16 = __toESM(require("react"), 1);
|
|
3502
4089
|
var import_core4 = require("@authowl/core");
|
|
4090
|
+
init_hooks();
|
|
4091
|
+
init_i18n();
|
|
4092
|
+
|
|
4093
|
+
// src/components/LegalConsentCheckbox.tsx
|
|
4094
|
+
init_i18n();
|
|
3503
4095
|
|
|
3504
4096
|
// src/components/ConsentDocLinks.tsx
|
|
4097
|
+
init_i18n();
|
|
3505
4098
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3506
4099
|
function ConsentDocLinks({ termsUrl, privacyUrl }) {
|
|
3507
4100
|
const t = useT();
|
|
@@ -3543,6 +4136,9 @@ function LegalConsentCheckbox({
|
|
|
3543
4136
|
}
|
|
3544
4137
|
|
|
3545
4138
|
// src/components/PhoneOTP.tsx
|
|
4139
|
+
init_use_submit_action();
|
|
4140
|
+
init_Spinner();
|
|
4141
|
+
init_FormError();
|
|
3546
4142
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3547
4143
|
function PhoneOTP({
|
|
3548
4144
|
redirectTo,
|
|
@@ -3790,8 +4386,13 @@ function PhoneOTP({
|
|
|
3790
4386
|
);
|
|
3791
4387
|
}
|
|
3792
4388
|
|
|
4389
|
+
// src/components/SignIn.tsx
|
|
4390
|
+
init_FormError();
|
|
4391
|
+
|
|
3793
4392
|
// src/components/AuthOwlBranding.tsx
|
|
3794
4393
|
var React17 = __toESM(require("react"), 1);
|
|
4394
|
+
init_hooks();
|
|
4395
|
+
init_i18n();
|
|
3795
4396
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3796
4397
|
function AuthOwlBranding({ href, showEnvironment = true } = {}) {
|
|
3797
4398
|
const t = useT();
|
|
@@ -3843,6 +4444,7 @@ function AuthOwlBranding({ href, showEnvironment = true } = {}) {
|
|
|
3843
4444
|
// src/components/InvitationBanner.tsx
|
|
3844
4445
|
var React18 = __toESM(require("react"), 1);
|
|
3845
4446
|
var import_core5 = require("@authowl/core");
|
|
4447
|
+
init_i18n();
|
|
3846
4448
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3847
4449
|
function InvitationBanner() {
|
|
3848
4450
|
const t = useT();
|
|
@@ -4185,9 +4787,16 @@ function SignIn({
|
|
|
4185
4787
|
|
|
4186
4788
|
// src/components/SignUp.tsx
|
|
4187
4789
|
var React23 = __toESM(require("react"), 1);
|
|
4790
|
+
init_hooks();
|
|
4791
|
+
init_i18n();
|
|
4188
4792
|
|
|
4189
4793
|
// src/components/VerificationPending.tsx
|
|
4190
4794
|
var React20 = __toESM(require("react"), 1);
|
|
4795
|
+
init_hooks();
|
|
4796
|
+
init_i18n();
|
|
4797
|
+
init_use_submit_action();
|
|
4798
|
+
init_Spinner();
|
|
4799
|
+
init_FormError();
|
|
4191
4800
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4192
4801
|
function VerificationPending({
|
|
4193
4802
|
email,
|
|
@@ -4308,6 +4917,11 @@ function VerificationPending({
|
|
|
4308
4917
|
|
|
4309
4918
|
// src/components/PasswordlessSignUp.tsx
|
|
4310
4919
|
var React21 = __toESM(require("react"), 1);
|
|
4920
|
+
init_hooks();
|
|
4921
|
+
init_i18n();
|
|
4922
|
+
init_use_submit_action();
|
|
4923
|
+
init_Spinner();
|
|
4924
|
+
init_FormError();
|
|
4311
4925
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4312
4926
|
function PasswordlessSignUp({ onAuthenticated }) {
|
|
4313
4927
|
const t = useT();
|
|
@@ -4384,6 +4998,11 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
4384
4998
|
}
|
|
4385
4999
|
|
|
4386
5000
|
// src/components/PasskeySignUpCompletion.tsx
|
|
5001
|
+
init_hooks();
|
|
5002
|
+
init_i18n();
|
|
5003
|
+
init_use_submit_action();
|
|
5004
|
+
init_Spinner();
|
|
5005
|
+
init_FormError();
|
|
4387
5006
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4388
5007
|
function PasskeySignUpCompletion({ onComplete }) {
|
|
4389
5008
|
const t = useT();
|
|
@@ -4411,8 +5030,17 @@ function PasskeySignUpCompletion({ onComplete }) {
|
|
|
4411
5030
|
] });
|
|
4412
5031
|
}
|
|
4413
5032
|
|
|
5033
|
+
// src/components/SignUp.tsx
|
|
5034
|
+
init_Spinner();
|
|
5035
|
+
init_FormError();
|
|
5036
|
+
|
|
4414
5037
|
// src/components/Waitlist.tsx
|
|
4415
5038
|
var React22 = __toESM(require("react"), 1);
|
|
5039
|
+
init_hooks();
|
|
5040
|
+
init_i18n();
|
|
5041
|
+
init_FormError();
|
|
5042
|
+
init_Spinner();
|
|
5043
|
+
init_use_submit_action();
|
|
4416
5044
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4417
5045
|
function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
|
|
4418
5046
|
const t = useT();
|
|
@@ -4754,6 +5382,11 @@ function SignUp({
|
|
|
4754
5382
|
}
|
|
4755
5383
|
|
|
4756
5384
|
// src/components/ConsentGate.tsx
|
|
5385
|
+
init_hooks();
|
|
5386
|
+
init_i18n();
|
|
5387
|
+
init_use_submit_action();
|
|
5388
|
+
init_Spinner();
|
|
5389
|
+
init_FormError();
|
|
4757
5390
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4758
5391
|
function ConsentGate({ children, title }) {
|
|
4759
5392
|
const t = useT();
|
|
@@ -4801,6 +5434,11 @@ function MFARequiredGate({ children, title }) {
|
|
|
4801
5434
|
|
|
4802
5435
|
// src/components/BackupCodesManager.tsx
|
|
4803
5436
|
var React24 = __toESM(require("react"), 1);
|
|
5437
|
+
init_hooks();
|
|
5438
|
+
init_i18n();
|
|
5439
|
+
init_use_submit_action();
|
|
5440
|
+
init_Spinner();
|
|
5441
|
+
init_FormError();
|
|
4804
5442
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4805
5443
|
function BackupCodesManager({ title }) {
|
|
4806
5444
|
const t = useT();
|
|
@@ -4853,6 +5491,11 @@ function BackupCodesManager({ title }) {
|
|
|
4853
5491
|
|
|
4854
5492
|
// src/components/MagicLinkForm.tsx
|
|
4855
5493
|
var React25 = __toESM(require("react"), 1);
|
|
5494
|
+
init_hooks();
|
|
5495
|
+
init_i18n();
|
|
5496
|
+
init_use_submit_action();
|
|
5497
|
+
init_Spinner();
|
|
5498
|
+
init_FormError();
|
|
4856
5499
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4857
5500
|
function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
4858
5501
|
const t = useT();
|
|
@@ -4911,6 +5554,11 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
4911
5554
|
|
|
4912
5555
|
// src/components/EmailOtpForm.tsx
|
|
4913
5556
|
var React26 = __toESM(require("react"), 1);
|
|
5557
|
+
init_hooks();
|
|
5558
|
+
init_i18n();
|
|
5559
|
+
init_use_submit_action();
|
|
5560
|
+
init_Spinner();
|
|
5561
|
+
init_FormError();
|
|
4914
5562
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4915
5563
|
function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
4916
5564
|
const t = useT();
|
|
@@ -4995,6 +5643,11 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
4995
5643
|
|
|
4996
5644
|
// src/components/ResetPassword.tsx
|
|
4997
5645
|
var React27 = __toESM(require("react"), 1);
|
|
5646
|
+
init_hooks();
|
|
5647
|
+
init_i18n();
|
|
5648
|
+
init_use_submit_action();
|
|
5649
|
+
init_Spinner();
|
|
5650
|
+
init_FormError();
|
|
4998
5651
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4999
5652
|
function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
5000
5653
|
const t = useT();
|
|
@@ -5096,6 +5749,11 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
5096
5749
|
|
|
5097
5750
|
// src/components/VerifyEmail.tsx
|
|
5098
5751
|
var React28 = __toESM(require("react"), 1);
|
|
5752
|
+
init_hooks();
|
|
5753
|
+
init_i18n();
|
|
5754
|
+
init_use_submit_action();
|
|
5755
|
+
init_Spinner();
|
|
5756
|
+
init_FormError();
|
|
5099
5757
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
5100
5758
|
function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
5101
5759
|
const t = useT();
|
|
@@ -5172,6 +5830,11 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
5172
5830
|
|
|
5173
5831
|
// src/components/PasskeyManager.tsx
|
|
5174
5832
|
var React29 = __toESM(require("react"), 1);
|
|
5833
|
+
init_hooks();
|
|
5834
|
+
init_i18n();
|
|
5835
|
+
init_use_submit_action();
|
|
5836
|
+
init_Spinner();
|
|
5837
|
+
init_FormError();
|
|
5175
5838
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
5176
5839
|
function PasskeyManager({ title, allowAdd = true } = {}) {
|
|
5177
5840
|
const t = useT();
|
|
@@ -5284,6 +5947,9 @@ function PasskeyManagerBody({
|
|
|
5284
5947
|
|
|
5285
5948
|
// src/components/control.tsx
|
|
5286
5949
|
var import_core6 = require("@authowl/core");
|
|
5950
|
+
init_hooks();
|
|
5951
|
+
init_i18n();
|
|
5952
|
+
init_Spinner();
|
|
5287
5953
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
5288
5954
|
function SignedIn({ children }) {
|
|
5289
5955
|
const { isLoaded, isSignedIn } = useUser();
|
|
@@ -5325,8 +5991,14 @@ function AuthLoaded({ children }) {
|
|
|
5325
5991
|
return useUser().isLoaded ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children }) : null;
|
|
5326
5992
|
}
|
|
5327
5993
|
|
|
5994
|
+
// src/index.ts
|
|
5995
|
+
init_Spinner();
|
|
5996
|
+
|
|
5328
5997
|
// src/components/SignOutButton.tsx
|
|
5329
5998
|
var React30 = __toESM(require("react"), 1);
|
|
5999
|
+
init_hooks();
|
|
6000
|
+
init_i18n();
|
|
6001
|
+
init_Spinner();
|
|
5330
6002
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
5331
6003
|
function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
5332
6004
|
const t = useT();
|
|
@@ -5358,12 +6030,21 @@ function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
|
5358
6030
|
|
|
5359
6031
|
// src/components/UserButton.tsx
|
|
5360
6032
|
var React43 = __toESM(require("react"), 1);
|
|
6033
|
+
init_hooks();
|
|
6034
|
+
init_i18n();
|
|
5361
6035
|
|
|
5362
6036
|
// src/components/UserProfile.tsx
|
|
5363
6037
|
var React42 = __toESM(require("react"), 1);
|
|
6038
|
+
init_hooks();
|
|
6039
|
+
init_i18n();
|
|
5364
6040
|
|
|
5365
6041
|
// src/components/user-profile/EmailSection.tsx
|
|
5366
6042
|
var React31 = __toESM(require("react"), 1);
|
|
6043
|
+
init_hooks();
|
|
6044
|
+
init_i18n();
|
|
6045
|
+
init_use_submit_action();
|
|
6046
|
+
init_Spinner();
|
|
6047
|
+
init_FormError();
|
|
5367
6048
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
5368
6049
|
function EmailSection({ allowChange }) {
|
|
5369
6050
|
const t = useT();
|
|
@@ -5438,6 +6119,11 @@ function EmailSection({ allowChange }) {
|
|
|
5438
6119
|
|
|
5439
6120
|
// src/components/user-profile/DeleteAccountSection.tsx
|
|
5440
6121
|
var React32 = __toESM(require("react"), 1);
|
|
6122
|
+
init_hooks();
|
|
6123
|
+
init_i18n();
|
|
6124
|
+
init_use_submit_action();
|
|
6125
|
+
init_Spinner();
|
|
6126
|
+
init_FormError();
|
|
5441
6127
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
5442
6128
|
function DeleteAccountSection({ onDeleted }) {
|
|
5443
6129
|
const t = useT();
|
|
@@ -5505,6 +6191,11 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
5505
6191
|
|
|
5506
6192
|
// src/components/user-profile/MfaSection.tsx
|
|
5507
6193
|
var React33 = __toESM(require("react"), 1);
|
|
6194
|
+
init_hooks();
|
|
6195
|
+
init_i18n();
|
|
6196
|
+
init_use_submit_action();
|
|
6197
|
+
init_Spinner();
|
|
6198
|
+
init_FormError();
|
|
5508
6199
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
5509
6200
|
function MfaSection() {
|
|
5510
6201
|
const t = useT();
|
|
@@ -5611,6 +6302,11 @@ function MfaSection() {
|
|
|
5611
6302
|
|
|
5612
6303
|
// src/components/user-profile/PasswordSection.tsx
|
|
5613
6304
|
var React34 = __toESM(require("react"), 1);
|
|
6305
|
+
init_hooks();
|
|
6306
|
+
init_i18n();
|
|
6307
|
+
init_use_submit_action();
|
|
6308
|
+
init_Spinner();
|
|
6309
|
+
init_FormError();
|
|
5614
6310
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
5615
6311
|
function PasswordSection() {
|
|
5616
6312
|
const t = useT();
|
|
@@ -5692,6 +6388,7 @@ function PasswordSection() {
|
|
|
5692
6388
|
|
|
5693
6389
|
// src/components/user-profile/PasskeysSection.tsx
|
|
5694
6390
|
var React35 = __toESM(require("react"), 1);
|
|
6391
|
+
init_i18n();
|
|
5695
6392
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
5696
6393
|
function PasskeysSection({ allowAdd }) {
|
|
5697
6394
|
const t = useT();
|
|
@@ -5707,6 +6404,11 @@ function PasskeysSection({ allowAdd }) {
|
|
|
5707
6404
|
|
|
5708
6405
|
// src/components/user-profile/ProfileSection.tsx
|
|
5709
6406
|
var React36 = __toESM(require("react"), 1);
|
|
6407
|
+
init_hooks();
|
|
6408
|
+
init_i18n();
|
|
6409
|
+
init_use_submit_action();
|
|
6410
|
+
init_Spinner();
|
|
6411
|
+
init_FormError();
|
|
5710
6412
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
5711
6413
|
function ProfileSection({
|
|
5712
6414
|
firstLastName,
|
|
@@ -5837,6 +6539,8 @@ function ProfileSection({
|
|
|
5837
6539
|
|
|
5838
6540
|
// src/components/user-profile/RecoverySection.tsx
|
|
5839
6541
|
var React37 = __toESM(require("react"), 1);
|
|
6542
|
+
init_hooks();
|
|
6543
|
+
init_i18n();
|
|
5840
6544
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5841
6545
|
function RecoverySection() {
|
|
5842
6546
|
const t = useT();
|
|
@@ -5860,6 +6564,9 @@ function RecoverySection() {
|
|
|
5860
6564
|
|
|
5861
6565
|
// src/components/user-profile/SessionsSection.tsx
|
|
5862
6566
|
var React39 = __toESM(require("react"), 1);
|
|
6567
|
+
init_hooks();
|
|
6568
|
+
init_i18n();
|
|
6569
|
+
init_use_submit_action();
|
|
5863
6570
|
|
|
5864
6571
|
// src/components/user-profile/model.ts
|
|
5865
6572
|
var USER_PROFILE_SECTIONS = [
|
|
@@ -5907,6 +6614,7 @@ function formatSessionTime(date, locale) {
|
|
|
5907
6614
|
|
|
5908
6615
|
// src/components/user-profile/use-account-resource.ts
|
|
5909
6616
|
var React38 = __toESM(require("react"), 1);
|
|
6617
|
+
init_i18n();
|
|
5910
6618
|
function useAccountResource(loader2, failure) {
|
|
5911
6619
|
const loaderRef = React38.useRef(loader2);
|
|
5912
6620
|
loaderRef.current = loader2;
|
|
@@ -5946,6 +6654,7 @@ function useAccountResource(loader2, failure) {
|
|
|
5946
6654
|
}
|
|
5947
6655
|
|
|
5948
6656
|
// src/components/user-profile/SessionsSection.tsx
|
|
6657
|
+
init_FormError();
|
|
5949
6658
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5950
6659
|
function SessionsSection() {
|
|
5951
6660
|
const t = useT();
|
|
@@ -6025,6 +6734,10 @@ function SessionsSection() {
|
|
|
6025
6734
|
|
|
6026
6735
|
// src/components/user-profile/SocialSection.tsx
|
|
6027
6736
|
var React40 = __toESM(require("react"), 1);
|
|
6737
|
+
init_hooks();
|
|
6738
|
+
init_i18n();
|
|
6739
|
+
init_use_submit_action();
|
|
6740
|
+
init_FormError();
|
|
6028
6741
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
6029
6742
|
function providerLabel(provider) {
|
|
6030
6743
|
return provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
@@ -6107,6 +6820,8 @@ function SocialSection() {
|
|
|
6107
6820
|
|
|
6108
6821
|
// src/components/user-profile/UserProfileModal.tsx
|
|
6109
6822
|
var React41 = __toESM(require("react"), 1);
|
|
6823
|
+
init_i18n();
|
|
6824
|
+
init_ModalSurface();
|
|
6110
6825
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
6111
6826
|
function UserProfileModal({
|
|
6112
6827
|
children,
|
|
@@ -6354,26 +7069,18 @@ function UserButton() {
|
|
|
6354
7069
|
}
|
|
6355
7070
|
|
|
6356
7071
|
// src/components/OrganizationSwitcher.tsx
|
|
6357
|
-
var
|
|
7072
|
+
var React56 = __toESM(require("react"), 1);
|
|
7073
|
+
init_hooks();
|
|
7074
|
+
init_i18n();
|
|
6358
7075
|
|
|
6359
7076
|
// src/components/CreateOrganization.tsx
|
|
6360
7077
|
var React44 = __toESM(require("react"), 1);
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
return role.split(",").map((value) => value.trim()).filter(Boolean);
|
|
6368
|
-
}
|
|
6369
|
-
function hasOrganizationRole(member, role) {
|
|
6370
|
-
return member ? organizationRoles(member.role).includes(role) : false;
|
|
6371
|
-
}
|
|
6372
|
-
function canManageOrganization(member) {
|
|
6373
|
-
return hasOrganizationRole(member, "owner") || hasOrganizationRole(member, "admin");
|
|
6374
|
-
}
|
|
6375
|
-
|
|
6376
|
-
// src/components/CreateOrganization.tsx
|
|
7078
|
+
init_hooks();
|
|
7079
|
+
init_i18n();
|
|
7080
|
+
init_model();
|
|
7081
|
+
init_use_submit_action();
|
|
7082
|
+
init_Spinner();
|
|
7083
|
+
init_FormError();
|
|
6377
7084
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
6378
7085
|
function CreateOrganization({ onCreated, title } = {}) {
|
|
6379
7086
|
const t = useT();
|
|
@@ -6485,6 +7192,8 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
6485
7192
|
|
|
6486
7193
|
// src/components/organization/OrganizationModal.tsx
|
|
6487
7194
|
var React45 = __toESM(require("react"), 1);
|
|
7195
|
+
init_i18n();
|
|
7196
|
+
init_ModalSurface();
|
|
6488
7197
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
6489
7198
|
function OrganizationModal({
|
|
6490
7199
|
title,
|
|
@@ -6525,6 +7234,8 @@ function OrganizationModal({
|
|
|
6525
7234
|
|
|
6526
7235
|
// src/components/organization/use-organizations-resource.ts
|
|
6527
7236
|
var React46 = __toESM(require("react"), 1);
|
|
7237
|
+
init_hooks();
|
|
7238
|
+
init_i18n();
|
|
6528
7239
|
function useOrganizationsResource(enabled = true) {
|
|
6529
7240
|
const api = useAuthClient().organization;
|
|
6530
7241
|
const apiRef = React46.useRef(api);
|
|
@@ -6565,6 +7276,10 @@ function useOrganizationsResource(enabled = true) {
|
|
|
6565
7276
|
requestRef.current += 1;
|
|
6566
7277
|
};
|
|
6567
7278
|
}, [identity, isLoaded, refresh]);
|
|
7279
|
+
React46.useEffect(
|
|
7280
|
+
() => api.subscribe(() => void refresh()),
|
|
7281
|
+
[api, refresh]
|
|
7282
|
+
);
|
|
6568
7283
|
return {
|
|
6569
7284
|
organizations,
|
|
6570
7285
|
isLoading: !isLoaded || organizations === null && error === null,
|
|
@@ -6574,10 +7289,18 @@ function useOrganizationsResource(enabled = true) {
|
|
|
6574
7289
|
}
|
|
6575
7290
|
|
|
6576
7291
|
// src/components/OrganizationProfile.tsx
|
|
6577
|
-
var
|
|
7292
|
+
var React55 = __toESM(require("react"), 1);
|
|
7293
|
+
init_hooks();
|
|
7294
|
+
init_i18n();
|
|
6578
7295
|
|
|
6579
7296
|
// src/components/organization/DangerSection.tsx
|
|
6580
7297
|
var React47 = __toESM(require("react"), 1);
|
|
7298
|
+
init_hooks();
|
|
7299
|
+
init_i18n();
|
|
7300
|
+
init_use_submit_action();
|
|
7301
|
+
init_Spinner();
|
|
7302
|
+
init_model();
|
|
7303
|
+
init_FormError();
|
|
6581
7304
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
6582
7305
|
function DangerSection({
|
|
6583
7306
|
organization,
|
|
@@ -6655,6 +7378,12 @@ function DangerSection({
|
|
|
6655
7378
|
|
|
6656
7379
|
// src/components/organization/GeneralSection.tsx
|
|
6657
7380
|
var React48 = __toESM(require("react"), 1);
|
|
7381
|
+
init_hooks();
|
|
7382
|
+
init_i18n();
|
|
7383
|
+
init_use_submit_action();
|
|
7384
|
+
init_Spinner();
|
|
7385
|
+
init_model();
|
|
7386
|
+
init_FormError();
|
|
6658
7387
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
6659
7388
|
function GeneralSection({
|
|
6660
7389
|
organization,
|
|
@@ -6745,56 +7474,27 @@ function GeneralSection({
|
|
|
6745
7474
|
|
|
6746
7475
|
// src/components/organization/InvitationsSection.tsx
|
|
6747
7476
|
var React50 = __toESM(require("react"), 1);
|
|
7477
|
+
init_hooks();
|
|
7478
|
+
init_i18n();
|
|
7479
|
+
init_use_submit_action();
|
|
7480
|
+
init_Spinner();
|
|
6748
7481
|
|
|
6749
7482
|
// src/components/organization/role-label.ts
|
|
7483
|
+
init_model();
|
|
6750
7484
|
function organizationRoleLabel(role, t) {
|
|
6751
|
-
const
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
}
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
var React49 = __toESM(require("react"), 1);
|
|
6760
|
-
var BUILTIN_ROLES = ["owner", "admin", "member"];
|
|
6761
|
-
function useOrganizationRoles(organizationId) {
|
|
6762
|
-
const api = useAuthClient().organization;
|
|
6763
|
-
const apiRef = React49.useRef(api);
|
|
6764
|
-
apiRef.current = api;
|
|
6765
|
-
const [dynamic, setDynamic] = React49.useState([]);
|
|
6766
|
-
const requestRef = React49.useRef(0);
|
|
6767
|
-
React49.useEffect(() => {
|
|
6768
|
-
const token = ++requestRef.current;
|
|
6769
|
-
setDynamic([]);
|
|
6770
|
-
if (!organizationId) return;
|
|
6771
|
-
void (async () => {
|
|
6772
|
-
try {
|
|
6773
|
-
const result = await apiRef.current.listRoles({ organizationId });
|
|
6774
|
-
if (token !== requestRef.current) return;
|
|
6775
|
-
setDynamic((result.data ?? []).map((entry) => entry.role).filter(Boolean));
|
|
6776
|
-
} catch {
|
|
6777
|
-
}
|
|
6778
|
-
})();
|
|
6779
|
-
return () => {
|
|
6780
|
-
requestRef.current += 1;
|
|
6781
|
-
};
|
|
6782
|
-
}, [organizationId]);
|
|
6783
|
-
const roles = React49.useMemo(() => {
|
|
6784
|
-
const seen = /* @__PURE__ */ new Set();
|
|
6785
|
-
const out = [];
|
|
6786
|
-
for (const candidate of [...BUILTIN_ROLES, ...dynamic]) {
|
|
6787
|
-
const key = candidate.trim();
|
|
6788
|
-
if (!key || seen.has(key)) continue;
|
|
6789
|
-
seen.add(key);
|
|
6790
|
-
out.push(key);
|
|
6791
|
-
}
|
|
6792
|
-
return out;
|
|
6793
|
-
}, [dynamic]);
|
|
6794
|
-
return { roles };
|
|
7485
|
+
const roles = organizationRoles(role);
|
|
7486
|
+
return (roles.length > 0 ? roles : [role]).map((roleKey) => {
|
|
7487
|
+
if (roleKey === "owner") return t("organization.role.owner");
|
|
7488
|
+
if (roleKey === "admin") return t("organization.role.admin");
|
|
7489
|
+
if (roleKey === "member") return t("organization.role.member");
|
|
7490
|
+
const label2 = roleKey.split(/[-_]+/).filter(Boolean).map((word) => `${word.charAt(0).toUpperCase()}${word.slice(1)}`).join(" ");
|
|
7491
|
+
return t("organization.role.custom", { role: label2 });
|
|
7492
|
+
}).join(t("organization.role.separator"));
|
|
6795
7493
|
}
|
|
6796
7494
|
|
|
6797
7495
|
// src/components/organization/InvitationsSection.tsx
|
|
7496
|
+
init_use_organization_roles();
|
|
7497
|
+
init_FormError();
|
|
6798
7498
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
6799
7499
|
function InvitationsSection({
|
|
6800
7500
|
organization,
|
|
@@ -6864,6 +7564,12 @@ function InvitationsSection({
|
|
|
6864
7564
|
}
|
|
6865
7565
|
|
|
6866
7566
|
// src/components/organization/MembersSection.tsx
|
|
7567
|
+
init_hooks();
|
|
7568
|
+
init_i18n();
|
|
7569
|
+
init_use_submit_action();
|
|
7570
|
+
init_model();
|
|
7571
|
+
init_use_organization_roles();
|
|
7572
|
+
init_FormError();
|
|
6867
7573
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
6868
7574
|
function MembersSection({
|
|
6869
7575
|
organization,
|
|
@@ -6923,20 +7629,24 @@ function MembersSection({
|
|
|
6923
7629
|
}
|
|
6924
7630
|
),
|
|
6925
7631
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => remove(member), children: t("organization.profile.members.remove") })
|
|
6926
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "ba-organization-role-label", children: organizationRoleLabel(
|
|
7632
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "ba-organization-role-label", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Bidi, { children: organizationRoleLabel(member.role, t) }) })
|
|
6927
7633
|
] }, member.id);
|
|
6928
7634
|
}) })
|
|
6929
7635
|
] });
|
|
6930
7636
|
}
|
|
6931
7637
|
|
|
6932
7638
|
// src/components/OrganizationProfile.tsx
|
|
6933
|
-
|
|
7639
|
+
init_model();
|
|
7640
|
+
init_FormError();
|
|
7641
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6934
7642
|
var SECTION_KEYS2 = {
|
|
6935
7643
|
general: "organization.profile.nav.general",
|
|
6936
7644
|
members: "organization.profile.nav.members",
|
|
7645
|
+
teams: "organization.profile.nav.teams",
|
|
6937
7646
|
invitations: "organization.profile.nav.invitations",
|
|
6938
7647
|
danger: "organization.profile.nav.danger"
|
|
6939
7648
|
};
|
|
7649
|
+
var TeamsSection2 = React55.lazy(() => Promise.resolve().then(() => (init_TeamsSection(), TeamsSection_exports)));
|
|
6940
7650
|
function OrganizationProfile({ organizationId, defaultSection = "general", onDeleted, onLeft } = {}) {
|
|
6941
7651
|
const t = useT();
|
|
6942
7652
|
const toServerError = useServerError();
|
|
@@ -6944,17 +7654,17 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
6944
7654
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
6945
7655
|
const session = useSession();
|
|
6946
7656
|
const api = useAuthClient().organization;
|
|
6947
|
-
const apiRef =
|
|
7657
|
+
const apiRef = React55.useRef(api);
|
|
6948
7658
|
apiRef.current = api;
|
|
6949
7659
|
const activeOrganizationId = session.data?.session.activeOrganizationId ?? null;
|
|
6950
7660
|
const requestedId = organizationId ?? activeOrganizationId;
|
|
6951
7661
|
const enabled = config?.organizations === true && isSignedIn;
|
|
6952
|
-
const [organization, setOrganization] =
|
|
6953
|
-
const [error, setError] =
|
|
6954
|
-
const [wasRemoved, setWasRemoved] =
|
|
6955
|
-
const [section, setSection] =
|
|
6956
|
-
const requestRef =
|
|
6957
|
-
const load =
|
|
7662
|
+
const [organization, setOrganization] = React55.useState(null);
|
|
7663
|
+
const [error, setError] = React55.useState(null);
|
|
7664
|
+
const [wasRemoved, setWasRemoved] = React55.useState(false);
|
|
7665
|
+
const [section, setSection] = React55.useState(defaultSection);
|
|
7666
|
+
const requestRef = React55.useRef(0);
|
|
7667
|
+
const load = React55.useCallback(async () => {
|
|
6958
7668
|
const token = ++requestRef.current;
|
|
6959
7669
|
if (!enabled || !requestedId) {
|
|
6960
7670
|
setOrganization(null);
|
|
@@ -6974,7 +7684,7 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
6974
7684
|
if (token === requestRef.current) setError(t("organization.profile.loadError"));
|
|
6975
7685
|
}
|
|
6976
7686
|
}, [enabled, requestedId, t, toServerError]);
|
|
6977
|
-
|
|
7687
|
+
React55.useEffect(() => {
|
|
6978
7688
|
setOrganization(null);
|
|
6979
7689
|
setError(null);
|
|
6980
7690
|
setWasRemoved(false);
|
|
@@ -6983,38 +7693,38 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
6983
7693
|
requestRef.current += 1;
|
|
6984
7694
|
};
|
|
6985
7695
|
}, [load]);
|
|
6986
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */ (0,
|
|
7696
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
6987
7697
|
if (config?.organizations !== true) return null;
|
|
6988
|
-
if (!isSignedIn || !user) return /* @__PURE__ */ (0,
|
|
6989
|
-
if (wasRemoved) return /* @__PURE__ */ (0,
|
|
6990
|
-
if (!requestedId) return /* @__PURE__ */ (0,
|
|
7698
|
+
if (!isSignedIn || !user) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
7699
|
+
if (wasRemoved) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.profile.noActive") });
|
|
7700
|
+
if (!requestedId) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.profile.noActive") });
|
|
6991
7701
|
if (error) {
|
|
6992
|
-
return /* @__PURE__ */ (0,
|
|
6993
|
-
/* @__PURE__ */ (0,
|
|
6994
|
-
/* @__PURE__ */ (0,
|
|
7702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ba-inline-error", children: [
|
|
7703
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(FormError, { children: error }),
|
|
7704
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("organization.retry") })
|
|
6995
7705
|
] });
|
|
6996
7706
|
}
|
|
6997
|
-
if (!organization) return /* @__PURE__ */ (0,
|
|
7707
|
+
if (!organization) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
6998
7708
|
const membership = organization.members.find((member) => member.userId === user.id);
|
|
6999
|
-
if (!membership) return /* @__PURE__ */ (0,
|
|
7709
|
+
if (!membership) return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: t("organization.profile.notMember") });
|
|
7000
7710
|
const canManage = canManageOrganization(membership);
|
|
7001
|
-
const visibleSections = canManage ? ["general", "members", "invitations", "danger"] : ["general", "members", "danger"];
|
|
7711
|
+
const visibleSections = canManage ? ["general", "members", "teams", "invitations", "danger"] : ["general", "members", "teams", "danger"];
|
|
7002
7712
|
const activeSection = visibleSections.includes(section) ? section : "general";
|
|
7003
7713
|
const handleRemoval = (callback) => (removedOrganization) => {
|
|
7004
7714
|
setWasRemoved(true);
|
|
7005
7715
|
setOrganization(null);
|
|
7006
7716
|
callback?.(removedOrganization);
|
|
7007
7717
|
};
|
|
7008
|
-
return /* @__PURE__ */ (0,
|
|
7009
|
-
/* @__PURE__ */ (0,
|
|
7010
|
-
/* @__PURE__ */ (0,
|
|
7011
|
-
/* @__PURE__ */ (0,
|
|
7012
|
-
/* @__PURE__ */ (0,
|
|
7013
|
-
/* @__PURE__ */ (0,
|
|
7718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("article", { className: "ba-organization-profile", children: [
|
|
7719
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("header", { className: "ba-organization-profile-heading", children: [
|
|
7720
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
7721
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { children: [
|
|
7722
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h2", { className: "ba-title", children: organization.name }),
|
|
7723
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "ba-muted", children: organization.slug })
|
|
7014
7724
|
] })
|
|
7015
7725
|
] }),
|
|
7016
|
-
/* @__PURE__ */ (0,
|
|
7017
|
-
/* @__PURE__ */ (0,
|
|
7726
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ba-organization-profile-layout", children: [
|
|
7727
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("nav", { className: "ba-organization-profile-nav", "aria-label": t("organization.profile.nav.label"), children: visibleSections.map((item) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
7018
7728
|
"button",
|
|
7019
7729
|
{
|
|
7020
7730
|
className: "ba-profile-nav-item",
|
|
@@ -7025,11 +7735,12 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7025
7735
|
},
|
|
7026
7736
|
item
|
|
7027
7737
|
)) }),
|
|
7028
|
-
/* @__PURE__ */ (0,
|
|
7029
|
-
activeSection === "general" && /* @__PURE__ */ (0,
|
|
7030
|
-
activeSection === "members" && /* @__PURE__ */ (0,
|
|
7031
|
-
activeSection === "
|
|
7032
|
-
activeSection === "
|
|
7738
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "ba-organization-profile-content", children: [
|
|
7739
|
+
activeSection === "general" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(GeneralSection, { organization, canManage, onChanged: load }),
|
|
7740
|
+
activeSection === "members" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(MembersSection, { organization, userId: user.id, canManage, onChanged: load }),
|
|
7741
|
+
activeSection === "teams" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(React55.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TeamsSection2, { organization, membership }) }),
|
|
7742
|
+
activeSection === "invitations" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(InvitationsSection, { organization, onChanged: load }),
|
|
7743
|
+
activeSection === "danger" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
7033
7744
|
DangerSection,
|
|
7034
7745
|
{
|
|
7035
7746
|
organization,
|
|
@@ -7044,7 +7755,9 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
7044
7755
|
}
|
|
7045
7756
|
|
|
7046
7757
|
// src/components/OrganizationSwitcher.tsx
|
|
7047
|
-
|
|
7758
|
+
init_use_submit_action();
|
|
7759
|
+
init_FormError();
|
|
7760
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
7048
7761
|
function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChange } = {}) {
|
|
7049
7762
|
const t = useT();
|
|
7050
7763
|
const { config, isLoading: configLoading } = usePublicConfig();
|
|
@@ -7054,15 +7767,15 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7054
7767
|
const enabled = config?.organizations === true && isSignedIn;
|
|
7055
7768
|
const { organizations, isLoading, error: loadError, refresh } = useOrganizationsResource(enabled);
|
|
7056
7769
|
const { pending, error, run } = useSubmitAction();
|
|
7057
|
-
const [open, setOpen] =
|
|
7058
|
-
const [dialog, setDialog] =
|
|
7059
|
-
const rootRef =
|
|
7060
|
-
const triggerRef =
|
|
7061
|
-
const menuRef =
|
|
7062
|
-
const menuId =
|
|
7770
|
+
const [open, setOpen] = React56.useState(false);
|
|
7771
|
+
const [dialog, setDialog] = React56.useState(null);
|
|
7772
|
+
const rootRef = React56.useRef(null);
|
|
7773
|
+
const triggerRef = React56.useRef(null);
|
|
7774
|
+
const menuRef = React56.useRef(null);
|
|
7775
|
+
const menuId = React56.useId();
|
|
7063
7776
|
const activeId = session.data?.session.activeOrganizationId ?? null;
|
|
7064
7777
|
const active = organizations?.find((organization) => organization.id === activeId) ?? null;
|
|
7065
|
-
|
|
7778
|
+
React56.useEffect(() => {
|
|
7066
7779
|
if (!open) return;
|
|
7067
7780
|
const onPointerDown = (event) => {
|
|
7068
7781
|
if (!rootRef.current?.contains(event.target)) setOpen(false);
|
|
@@ -7077,9 +7790,9 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7077
7790
|
document.removeEventListener("keydown", onKeyDown);
|
|
7078
7791
|
};
|
|
7079
7792
|
}, [open]);
|
|
7080
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */ (0,
|
|
7793
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-label": t("organization.loading") });
|
|
7081
7794
|
if (config?.organizations !== true) return null;
|
|
7082
|
-
if (!isSignedIn) return /* @__PURE__ */ (0,
|
|
7795
|
+
if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
7083
7796
|
const select = (organization) => {
|
|
7084
7797
|
void run(
|
|
7085
7798
|
() => api.setActive({ organizationId: organization?.id ?? null }),
|
|
@@ -7122,9 +7835,9 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7122
7835
|
else if (event.key === "ArrowDown") items[(current + 1 + items.length) % items.length]?.focus();
|
|
7123
7836
|
else items[(current - 1 + items.length) % items.length]?.focus();
|
|
7124
7837
|
};
|
|
7125
|
-
return /* @__PURE__ */ (0,
|
|
7126
|
-
/* @__PURE__ */ (0,
|
|
7127
|
-
/* @__PURE__ */ (0,
|
|
7838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
|
|
7839
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { ref: rootRef, className: "ba-organization-switcher", children: [
|
|
7840
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
7128
7841
|
"button",
|
|
7129
7842
|
{
|
|
7130
7843
|
ref: triggerRef,
|
|
@@ -7141,43 +7854,43 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7141
7854
|
focusMenuItem(event.key === "ArrowDown" ? "first" : "last");
|
|
7142
7855
|
},
|
|
7143
7856
|
children: [
|
|
7144
|
-
/* @__PURE__ */ (0,
|
|
7145
|
-
/* @__PURE__ */ (0,
|
|
7146
|
-
/* @__PURE__ */ (0,
|
|
7857
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: active?.name.trim().charAt(0).toUpperCase() || "P" }),
|
|
7858
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { children: active?.name ?? t("organization.personal") }),
|
|
7859
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { "aria-hidden": "true", children: "\u2304" })
|
|
7147
7860
|
]
|
|
7148
7861
|
}
|
|
7149
7862
|
),
|
|
7150
|
-
open && /* @__PURE__ */ (0,
|
|
7151
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
7152
|
-
showPersonalWorkspace && /* @__PURE__ */ (0,
|
|
7153
|
-
/* @__PURE__ */ (0,
|
|
7154
|
-
/* @__PURE__ */ (0,
|
|
7863
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { ref: menuRef, id: menuId, className: "ba-organization-menu", role: "menu", "aria-label": t("organization.switcher.label"), onKeyDown: onMenuKeyDown, children: [
|
|
7864
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "ba-skeleton" }) : /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
|
|
7865
|
+
showPersonalWorkspace && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === null ? "true" : void 0, disabled: pending, onClick: () => select(null), children: [
|
|
7866
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: "P" }),
|
|
7867
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { children: t("organization.personal") })
|
|
7155
7868
|
] }),
|
|
7156
|
-
organizations?.map((organization) => /* @__PURE__ */ (0,
|
|
7157
|
-
/* @__PURE__ */ (0,
|
|
7158
|
-
/* @__PURE__ */ (0,
|
|
7869
|
+
organizations?.map((organization) => /* @__PURE__ */ (0, import_jsx_runtime61.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: [
|
|
7870
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
7871
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { children: [
|
|
7159
7872
|
organization.name,
|
|
7160
|
-
/* @__PURE__ */ (0,
|
|
7873
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("small", { children: organization.slug })
|
|
7161
7874
|
] })
|
|
7162
7875
|
] }, organization.id))
|
|
7163
7876
|
] }),
|
|
7164
|
-
(loadError || error) && /* @__PURE__ */ (0,
|
|
7165
|
-
/* @__PURE__ */ (0,
|
|
7166
|
-
loadError && /* @__PURE__ */ (0,
|
|
7877
|
+
(loadError || error) && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "ba-inline-error", children: [
|
|
7878
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(FormError, { children: loadError ?? error }),
|
|
7879
|
+
loadError && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
|
|
7167
7880
|
] }),
|
|
7168
|
-
/* @__PURE__ */ (0,
|
|
7169
|
-
active && /* @__PURE__ */ (0,
|
|
7881
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "ba-organization-menu-actions", children: [
|
|
7882
|
+
active && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
|
|
7170
7883
|
setOpen(false);
|
|
7171
7884
|
setDialog("profile");
|
|
7172
7885
|
}, children: t("organization.switcher.manage") }),
|
|
7173
|
-
/* @__PURE__ */ (0,
|
|
7886
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
|
|
7174
7887
|
setOpen(false);
|
|
7175
7888
|
setDialog("create");
|
|
7176
7889
|
}, children: t("organization.switcher.create") })
|
|
7177
7890
|
] })
|
|
7178
7891
|
] })
|
|
7179
7892
|
] }),
|
|
7180
|
-
dialog === "create" && /* @__PURE__ */ (0,
|
|
7893
|
+
dialog === "create" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
7181
7894
|
CreateOrganization,
|
|
7182
7895
|
{
|
|
7183
7896
|
title: null,
|
|
@@ -7191,13 +7904,20 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
7191
7904
|
}
|
|
7192
7905
|
}
|
|
7193
7906
|
) }),
|
|
7194
|
-
dialog === "profile" && active && /* @__PURE__ */ (0,
|
|
7907
|
+
dialog === "profile" && active && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(OrganizationProfile, { organizationId: active.id, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
|
|
7195
7908
|
] });
|
|
7196
7909
|
}
|
|
7197
7910
|
|
|
7911
|
+
// src/index.ts
|
|
7912
|
+
init_InvitationPrompt();
|
|
7913
|
+
|
|
7198
7914
|
// src/components/OrganizationList.tsx
|
|
7199
|
-
var
|
|
7200
|
-
|
|
7915
|
+
var React57 = __toESM(require("react"), 1);
|
|
7916
|
+
init_hooks();
|
|
7917
|
+
init_i18n();
|
|
7918
|
+
init_use_submit_action();
|
|
7919
|
+
init_FormError();
|
|
7920
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
7201
7921
|
function OrganizationList({ onOrganizationChange } = {}) {
|
|
7202
7922
|
const t = useT();
|
|
7203
7923
|
const toServerError = useServerError();
|
|
@@ -7205,19 +7925,19 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
7205
7925
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
7206
7926
|
const session = useSession();
|
|
7207
7927
|
const api = useAuthClient().organization;
|
|
7208
|
-
const apiRef =
|
|
7928
|
+
const apiRef = React57.useRef(api);
|
|
7209
7929
|
apiRef.current = api;
|
|
7210
7930
|
const enabled = config?.organizations === true && isSignedIn;
|
|
7211
7931
|
const { organizations, isLoading, error: organizationError, refresh } = useOrganizationsResource(enabled);
|
|
7212
7932
|
const { pending, error, run } = useSubmitAction();
|
|
7213
|
-
const [invitations, setInvitations] =
|
|
7214
|
-
const [invitationError, setInvitationError] =
|
|
7215
|
-
const [dialog, setDialog] =
|
|
7216
|
-
const [profileId, setProfileId] =
|
|
7217
|
-
const dialogReturnFocusRef =
|
|
7218
|
-
const invitationRequestRef =
|
|
7933
|
+
const [invitations, setInvitations] = React57.useState(null);
|
|
7934
|
+
const [invitationError, setInvitationError] = React57.useState(null);
|
|
7935
|
+
const [dialog, setDialog] = React57.useState(null);
|
|
7936
|
+
const [profileId, setProfileId] = React57.useState(null);
|
|
7937
|
+
const dialogReturnFocusRef = React57.useRef(null);
|
|
7938
|
+
const invitationRequestRef = React57.useRef(0);
|
|
7219
7939
|
const activeId = session.data?.session.activeOrganizationId ?? null;
|
|
7220
|
-
const loadInvitations =
|
|
7940
|
+
const loadInvitations = React57.useCallback(async () => {
|
|
7221
7941
|
const token = ++invitationRequestRef.current;
|
|
7222
7942
|
if (!enabled) {
|
|
7223
7943
|
setInvitations([]);
|
|
@@ -7237,7 +7957,7 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
7237
7957
|
if (token === invitationRequestRef.current) setInvitationError(t("organization.list.invitationsError"));
|
|
7238
7958
|
}
|
|
7239
7959
|
}, [enabled, t, toServerError]);
|
|
7240
|
-
|
|
7960
|
+
React57.useEffect(() => {
|
|
7241
7961
|
setInvitations(null);
|
|
7242
7962
|
setInvitationError(null);
|
|
7243
7963
|
if (!isLoaded) return;
|
|
@@ -7246,9 +7966,9 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
7246
7966
|
invitationRequestRef.current += 1;
|
|
7247
7967
|
};
|
|
7248
7968
|
}, [isLoaded, loadInvitations, user?.id]);
|
|
7249
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */ (0,
|
|
7969
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
7250
7970
|
if (config?.organizations !== true) return null;
|
|
7251
|
-
if (!isSignedIn) return /* @__PURE__ */ (0,
|
|
7971
|
+
if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
7252
7972
|
const setActive = (organization) => {
|
|
7253
7973
|
void run(
|
|
7254
7974
|
() => api.setActive({ organizationId: organization.id }),
|
|
@@ -7289,71 +8009,72 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
7289
8009
|
setDialog(null);
|
|
7290
8010
|
setProfileId(null);
|
|
7291
8011
|
};
|
|
7292
|
-
return /* @__PURE__ */ (0,
|
|
7293
|
-
/* @__PURE__ */ (0,
|
|
7294
|
-
/* @__PURE__ */ (0,
|
|
7295
|
-
/* @__PURE__ */ (0,
|
|
7296
|
-
/* @__PURE__ */ (0,
|
|
7297
|
-
/* @__PURE__ */ (0,
|
|
8012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
8013
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", { className: "ba-organization-directory", children: [
|
|
8014
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("header", { className: "ba-organization-directory-header", children: [
|
|
8015
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { children: [
|
|
8016
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("h2", { className: "ba-title", children: t("organization.list.title") }),
|
|
8017
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "ba-muted", children: t("organization.list.description") })
|
|
7298
8018
|
] }),
|
|
7299
|
-
/* @__PURE__ */ (0,
|
|
8019
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-button", type: "button", onClick: (event) => {
|
|
7300
8020
|
dialogReturnFocusRef.current = event.currentTarget;
|
|
7301
8021
|
setDialog("create");
|
|
7302
8022
|
}, children: t("organization.switcher.create") })
|
|
7303
8023
|
] }),
|
|
7304
|
-
(organizationError || error) && /* @__PURE__ */ (0,
|
|
7305
|
-
/* @__PURE__ */ (0,
|
|
7306
|
-
organizationError && /* @__PURE__ */ (0,
|
|
8024
|
+
(organizationError || error) && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ba-inline-error", children: [
|
|
8025
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(FormError, { children: organizationError ?? error }),
|
|
8026
|
+
organizationError && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
|
|
7307
8027
|
] }),
|
|
7308
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
7309
|
-
/* @__PURE__ */ (0,
|
|
7310
|
-
/* @__PURE__ */ (0,
|
|
7311
|
-
] }) : organizations?.length ? /* @__PURE__ */ (0,
|
|
7312
|
-
/* @__PURE__ */ (0,
|
|
7313
|
-
/* @__PURE__ */ (0,
|
|
7314
|
-
/* @__PURE__ */ (0,
|
|
7315
|
-
/* @__PURE__ */ (0,
|
|
8028
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ba-organization-card-grid", children: [
|
|
8029
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ba-skeleton" }),
|
|
8030
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ba-skeleton" })
|
|
8031
|
+
] }) : organizations?.length ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("ul", { className: "ba-organization-card-grid", children: organizations.map((organization) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("li", { className: "ba-organization-card", children: [
|
|
8032
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
8033
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ba-organization-card-copy", children: [
|
|
8034
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("strong", { children: organization.name }),
|
|
8035
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("small", { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Bidi, { children: organization.slug }) })
|
|
7316
8036
|
] }),
|
|
7317
|
-
activeId === organization.id && /* @__PURE__ */ (0,
|
|
7318
|
-
/* @__PURE__ */ (0,
|
|
7319
|
-
activeId !== organization.id && /* @__PURE__ */ (0,
|
|
7320
|
-
/* @__PURE__ */ (0,
|
|
8037
|
+
activeId === organization.id && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ba-organization-active", children: t("organization.list.active") }),
|
|
8038
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ba-organization-card-actions", children: [
|
|
8039
|
+
activeId !== organization.id && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: () => setActive(organization), children: t("organization.list.switch") }),
|
|
8040
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-link-button", type: "button", onClick: (event) => openProfile(organization, event.currentTarget), children: t("organization.list.manage") })
|
|
7321
8041
|
] })
|
|
7322
|
-
] }, organization.id)) }) : organizationError ? null : /* @__PURE__ */ (0,
|
|
7323
|
-
/* @__PURE__ */ (0,
|
|
7324
|
-
/* @__PURE__ */ (0,
|
|
7325
|
-
/* @__PURE__ */ (0,
|
|
7326
|
-
/* @__PURE__ */ (0,
|
|
8042
|
+
] }, organization.id)) }) : organizationError ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "ba-muted", children: t("organization.list.empty") }),
|
|
8043
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", { className: "ba-organization-user-invitations", children: [
|
|
8044
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("header", { className: "ba-organization-section-header", children: [
|
|
8045
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("h3", { className: "ba-title", children: t("organization.list.invitationsTitle") }),
|
|
8046
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "ba-muted", children: t("organization.list.invitationsDescription") })
|
|
7327
8047
|
] }),
|
|
7328
|
-
invitationError && /* @__PURE__ */ (0,
|
|
7329
|
-
/* @__PURE__ */ (0,
|
|
7330
|
-
/* @__PURE__ */ (0,
|
|
8048
|
+
invitationError && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ba-inline-error", children: [
|
|
8049
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(FormError, { children: invitationError }),
|
|
8050
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-link-button", type: "button", onClick: () => void loadInvitations(), children: t("organization.retry") })
|
|
7331
8051
|
] }),
|
|
7332
|
-
invitations
|
|
7333
|
-
/* @__PURE__ */ (0,
|
|
7334
|
-
/* @__PURE__ */ (0,
|
|
7335
|
-
/* @__PURE__ */ (0,
|
|
8052
|
+
invitations?.length ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("li", { className: "ba-organization-invitation", children: [
|
|
8053
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { children: [
|
|
8054
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("strong", { children: invitation.organizationName }),
|
|
8055
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("small", { children: organizationRoleLabel(invitation.role, t) })
|
|
7336
8056
|
] }),
|
|
7337
|
-
/* @__PURE__ */ (0,
|
|
7338
|
-
/* @__PURE__ */ (0,
|
|
7339
|
-
/* @__PURE__ */ (0,
|
|
8057
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "ba-organization-card-actions", children: [
|
|
8058
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "accept"), children: t("organization.list.accept") }),
|
|
8059
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "reject"), children: t("organization.list.reject") })
|
|
7340
8060
|
] })
|
|
7341
|
-
] }, invitation.id)) }) : /* @__PURE__ */ (0,
|
|
8061
|
+
] }, invitation.id)) }) : invitationError ? null : invitations === null ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ba-skeleton" }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "ba-muted", children: t("organization.list.noInvitations") })
|
|
7342
8062
|
] })
|
|
7343
8063
|
] }),
|
|
7344
|
-
dialog === "create" && /* @__PURE__ */ (0,
|
|
8064
|
+
dialog === "create" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CreateOrganization, { title: null, onCreated: () => {
|
|
7345
8065
|
void (async () => {
|
|
7346
8066
|
await refresh();
|
|
7347
8067
|
await session.refetch({ query: { disableCookieCache: true } });
|
|
7348
8068
|
setDialog(null);
|
|
7349
8069
|
})();
|
|
7350
8070
|
} }) }),
|
|
7351
|
-
dialog === "profile" && profileId && /* @__PURE__ */ (0,
|
|
8071
|
+
dialog === "profile" && profileId && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(OrganizationProfile, { organizationId: profileId, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
|
|
7352
8072
|
] });
|
|
7353
8073
|
}
|
|
7354
8074
|
|
|
7355
8075
|
// src/components/GoogleOneTap.tsx
|
|
7356
|
-
var
|
|
8076
|
+
var React58 = __toESM(require("react"), 1);
|
|
8077
|
+
init_hooks();
|
|
7357
8078
|
|
|
7358
8079
|
// src/components/google-one-tap.ts
|
|
7359
8080
|
var GOOGLE_IDENTITY_SCRIPT = "https://accounts.google.com/gsi/client";
|
|
@@ -7521,11 +8242,11 @@ function GoogleOneTap({
|
|
|
7521
8242
|
const { config, isLoading: configLoading, isError: configError } = usePublicConfig();
|
|
7522
8243
|
const { user, isLoaded: sessionLoaded } = useUser();
|
|
7523
8244
|
const { signInSocial } = useSignIn();
|
|
7524
|
-
const callbacks =
|
|
8245
|
+
const callbacks = React58.useRef({ onSignedIn, onSkipped, onDismissed, onError });
|
|
7525
8246
|
callbacks.current = { onSignedIn, onSkipped, onDismissed, onError };
|
|
7526
8247
|
const googleEnabled = config?.socialProviders.includes("google") === true;
|
|
7527
8248
|
const clientId = config?.socialProviderClientIds?.google;
|
|
7528
|
-
|
|
8249
|
+
React58.useEffect(() => {
|
|
7529
8250
|
if (configLoading || !sessionLoaded) return;
|
|
7530
8251
|
if (disabled) {
|
|
7531
8252
|
callbacks.current.onSkipped?.("disabled");
|
|
@@ -7700,6 +8421,7 @@ var import_core8 = require("@authowl/core");
|
|
|
7700
8421
|
useAuthOwlContext,
|
|
7701
8422
|
useConsent,
|
|
7702
8423
|
useEmailVerification,
|
|
8424
|
+
useInvitationRecipientHint,
|
|
7703
8425
|
useLocale,
|
|
7704
8426
|
useMFA,
|
|
7705
8427
|
useOrganization,
|