@asgardeo/react 0.5.3 → 0.5.4
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/AsgardeoReactClient.d.ts +6 -4
- package/dist/__temp__/api.d.ts +1 -1
- package/dist/__temp__/models.d.ts +1 -1
- package/dist/cjs/index.js +866 -504
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/primitives/MultiInput/MultiInput.d.ts +86 -0
- package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +2 -0
- package/dist/contexts/Theme/ThemeProvider.d.ts +13 -2
- package/dist/contexts/User/UserContext.d.ts +9 -1
- package/dist/contexts/User/UserProvider.d.ts +9 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +850 -481
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
BaseUser: () => BaseUser_default,
|
|
51
51
|
BaseUserDropdown: () => BaseUserDropdown_default,
|
|
52
52
|
BaseUserProfile: () => BaseUserProfile_default,
|
|
53
|
+
BuildingAlt: () => BuildingAlt_default,
|
|
53
54
|
Button: () => Button_default,
|
|
54
55
|
Card: () => Card_default,
|
|
55
56
|
CardAction: () => CardAction,
|
|
@@ -83,6 +84,7 @@ __export(index_exports, {
|
|
|
83
84
|
LinkedInButton: () => LinkedInButton_default,
|
|
84
85
|
LogOut: () => LogOut_default,
|
|
85
86
|
MicrosoftButton: () => MicrosoftButton_default,
|
|
87
|
+
MultiInput: () => MultiInput_default,
|
|
86
88
|
MultiOptionButton: () => MultiOptionButton_default,
|
|
87
89
|
Organization: () => Organization_default,
|
|
88
90
|
OrganizationContext: () => OrganizationContext_default,
|
|
@@ -119,7 +121,7 @@ __export(index_exports, {
|
|
|
119
121
|
UsernamePassword: () => UsernamePassword_default,
|
|
120
122
|
createField: () => createField,
|
|
121
123
|
createOrganization: () => createOrganization_default,
|
|
122
|
-
createPatchOperations: () =>
|
|
124
|
+
createPatchOperations: () => import_browser61.createPatchOperations,
|
|
123
125
|
createSignInOption: () => createSignInOption,
|
|
124
126
|
createSignInOptionFromAuthenticator: () => createSignInOptionFromAuthenticator,
|
|
125
127
|
getAllOrganizations: () => getAllOrganizations_default,
|
|
@@ -149,6 +151,8 @@ var import_react13 = require("react");
|
|
|
149
151
|
// src/contexts/Asgardeo/AsgardeoContext.ts
|
|
150
152
|
var import_react = require("react");
|
|
151
153
|
var AsgardeoContext = (0, import_react.createContext)({
|
|
154
|
+
organizationHandle: void 0,
|
|
155
|
+
applicationId: void 0,
|
|
152
156
|
signInUrl: void 0,
|
|
153
157
|
signUpUrl: void 0,
|
|
154
158
|
afterSignInUrl: void 0,
|
|
@@ -370,8 +374,8 @@ var _AuthAPI = class _AuthAPI {
|
|
|
370
374
|
* @return {Promise<DecodedIDTokenPayloadInterface>} - A Promise that resolves with
|
|
371
375
|
* the decoded payload of the id token.
|
|
372
376
|
*/
|
|
373
|
-
async getDecodedIdToken() {
|
|
374
|
-
return this._client.getDecodedIdToken();
|
|
377
|
+
async getDecodedIdToken(sessionId) {
|
|
378
|
+
return this._client.getDecodedIdToken(sessionId);
|
|
375
379
|
}
|
|
376
380
|
/**
|
|
377
381
|
* This method decodes the payload of the idp id token and returns it.
|
|
@@ -598,12 +602,22 @@ var AsgardeoReactClient = class extends import_browser5.AsgardeoBrowserClient {
|
|
|
598
602
|
this.asgardeo = new api_default();
|
|
599
603
|
}
|
|
600
604
|
initialize(config) {
|
|
601
|
-
|
|
605
|
+
let resolvedOrganizationHandle = config?.organizationHandle;
|
|
606
|
+
if (!resolvedOrganizationHandle) {
|
|
607
|
+
resolvedOrganizationHandle = (0, import_browser5.deriveOrganizationHandleFromBaseUrl)(config?.baseUrl);
|
|
608
|
+
}
|
|
609
|
+
return this.asgardeo.init({ ...config, organizationHandle: resolvedOrganizationHandle });
|
|
602
610
|
}
|
|
603
|
-
async
|
|
611
|
+
async updateUserProfile(payload, userId) {
|
|
612
|
+
throw new Error("Not implemented");
|
|
613
|
+
}
|
|
614
|
+
async getUser(options) {
|
|
604
615
|
try {
|
|
605
|
-
|
|
606
|
-
|
|
616
|
+
let baseUrl = options?.baseUrl;
|
|
617
|
+
if (!baseUrl) {
|
|
618
|
+
const configData = await this.asgardeo.getConfigData();
|
|
619
|
+
baseUrl = configData?.baseUrl;
|
|
620
|
+
}
|
|
607
621
|
const profile = await getScim2Me_default({ baseUrl });
|
|
608
622
|
const schemas = await getSchemas_default({ baseUrl });
|
|
609
623
|
return (0, import_browser5.generateUserProfile)(profile, (0, import_browser5.flattenUserSchema)(schemas));
|
|
@@ -611,10 +625,16 @@ var AsgardeoReactClient = class extends import_browser5.AsgardeoBrowserClient {
|
|
|
611
625
|
return this.asgardeo.getDecodedIdToken();
|
|
612
626
|
}
|
|
613
627
|
}
|
|
614
|
-
async
|
|
628
|
+
async getDecodedIdToken(sessionId) {
|
|
629
|
+
return this.asgardeo.getDecodedIdToken(sessionId);
|
|
630
|
+
}
|
|
631
|
+
async getUserProfile(options) {
|
|
615
632
|
try {
|
|
616
|
-
|
|
617
|
-
|
|
633
|
+
let baseUrl = options?.baseUrl;
|
|
634
|
+
if (!baseUrl) {
|
|
635
|
+
const configData = await this.asgardeo.getConfigData();
|
|
636
|
+
baseUrl = configData?.baseUrl;
|
|
637
|
+
}
|
|
618
638
|
const profile = await getScim2Me_default({ baseUrl });
|
|
619
639
|
const schemas = await getSchemas_default({ baseUrl });
|
|
620
640
|
const processedSchemas = (0, import_browser5.flattenUserSchema)(schemas);
|
|
@@ -632,10 +652,13 @@ var AsgardeoReactClient = class extends import_browser5.AsgardeoBrowserClient {
|
|
|
632
652
|
};
|
|
633
653
|
}
|
|
634
654
|
}
|
|
635
|
-
async getOrganizations() {
|
|
655
|
+
async getOrganizations(options) {
|
|
636
656
|
try {
|
|
637
|
-
|
|
638
|
-
|
|
657
|
+
let baseUrl = options?.baseUrl;
|
|
658
|
+
if (!baseUrl) {
|
|
659
|
+
const configData = await this.asgardeo.getConfigData();
|
|
660
|
+
baseUrl = configData?.baseUrl;
|
|
661
|
+
}
|
|
639
662
|
const organizations = await getMeOrganizations_default({ baseUrl });
|
|
640
663
|
return organizations;
|
|
641
664
|
} catch (error) {
|
|
@@ -716,7 +739,7 @@ var AsgardeoReactClient = class extends import_browser5.AsgardeoBrowserClient {
|
|
|
716
739
|
url: arg2.url
|
|
717
740
|
});
|
|
718
741
|
}
|
|
719
|
-
return this.asgardeo.signIn(arg1);
|
|
742
|
+
return await this.asgardeo.signIn(arg1);
|
|
720
743
|
}
|
|
721
744
|
async signOut(...args) {
|
|
722
745
|
if (args[1] && typeof args[1] !== "function") {
|
|
@@ -1099,6 +1122,7 @@ var OrganizationProvider = ({
|
|
|
1099
1122
|
const [switchableOrgIds, setSwitchableOrgIds] = (0, import_react8.useState)(/* @__PURE__ */ new Set());
|
|
1100
1123
|
const [currentPage, setCurrentPage] = (0, import_react8.useState)(1);
|
|
1101
1124
|
const [currentFilter, setCurrentFilter] = (0, import_react8.useState)({});
|
|
1125
|
+
const [isFetching, setIsFetching] = (0, import_react8.useState)(false);
|
|
1102
1126
|
const fetchOrganizations = (0, import_react8.useCallback)(async () => {
|
|
1103
1127
|
if (!isSignedIn) {
|
|
1104
1128
|
return;
|
|
@@ -1161,9 +1185,10 @@ var OrganizationProvider = ({
|
|
|
1161
1185
|
const fetchPaginatedOrganizations = (0, import_react8.useCallback)(
|
|
1162
1186
|
async (config = {}) => {
|
|
1163
1187
|
const { filter = "", limit = 10, recursive = false, reset = false } = config;
|
|
1164
|
-
if (!isSignedIn || !baseUrl) {
|
|
1188
|
+
if (!isSignedIn || !baseUrl || isFetching) {
|
|
1165
1189
|
return;
|
|
1166
1190
|
}
|
|
1191
|
+
setIsFetching(true);
|
|
1167
1192
|
try {
|
|
1168
1193
|
if (reset) {
|
|
1169
1194
|
setIsLoading(true);
|
|
@@ -1194,7 +1219,23 @@ var OrganizationProvider = ({
|
|
|
1194
1219
|
filter,
|
|
1195
1220
|
limit,
|
|
1196
1221
|
recursive,
|
|
1197
|
-
...reset ? {} : { startIndex: (currentPage - 1) * limit }
|
|
1222
|
+
...reset ? {} : { startIndex: (currentPage - 1) * limit },
|
|
1223
|
+
fetcher: async (url, config2) => {
|
|
1224
|
+
try {
|
|
1225
|
+
const response2 = await fetch(url, config2);
|
|
1226
|
+
if (response2.status === 401 || response2.status === 403) {
|
|
1227
|
+
const error2 = new Error("Insufficient permissions");
|
|
1228
|
+
error2.status = response2.status;
|
|
1229
|
+
throw error2;
|
|
1230
|
+
}
|
|
1231
|
+
return response2;
|
|
1232
|
+
} catch (error2) {
|
|
1233
|
+
if (error2.status === 401 || error2.status === 403) {
|
|
1234
|
+
error2.noRetry = true;
|
|
1235
|
+
}
|
|
1236
|
+
throw error2;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1198
1239
|
});
|
|
1199
1240
|
const organizationsWithAccess = response.organizations.map(
|
|
1200
1241
|
(org) => ({
|
|
@@ -1214,14 +1255,22 @@ var OrganizationProvider = ({
|
|
|
1214
1255
|
setHasMore(response.hasMore || false);
|
|
1215
1256
|
setTotalCount(response.totalCount || organizationsWithAccess.length);
|
|
1216
1257
|
} catch (fetchError) {
|
|
1217
|
-
const
|
|
1258
|
+
const isAuthError = fetchError.status === 403 || fetchError.status === 401 || fetchError.noRetry === true;
|
|
1259
|
+
const errorMessage = isAuthError ? "Insufficient permissions to fetch organizations" : fetchError.message || "Failed to fetch paginated organizations";
|
|
1218
1260
|
setError(errorMessage);
|
|
1261
|
+
if (isAuthError) {
|
|
1262
|
+
setHasMore(false);
|
|
1263
|
+
setIsLoadingMore(false);
|
|
1264
|
+
setIsLoading(false);
|
|
1265
|
+
return;
|
|
1266
|
+
}
|
|
1219
1267
|
if (onError) {
|
|
1220
1268
|
onError(errorMessage);
|
|
1221
1269
|
}
|
|
1222
1270
|
} finally {
|
|
1223
1271
|
setIsLoading(false);
|
|
1224
1272
|
setIsLoadingMore(false);
|
|
1273
|
+
setIsFetching(false);
|
|
1225
1274
|
}
|
|
1226
1275
|
},
|
|
1227
1276
|
[baseUrl, isSignedIn, onError, switchableOrgIds, currentPage]
|
|
@@ -1294,13 +1343,46 @@ var applyThemeToDOM = (theme) => {
|
|
|
1294
1343
|
var ThemeProvider = ({
|
|
1295
1344
|
children,
|
|
1296
1345
|
theme: themeConfig,
|
|
1297
|
-
|
|
1346
|
+
mode = "system",
|
|
1347
|
+
detection = {}
|
|
1298
1348
|
}) => {
|
|
1299
|
-
const [colorScheme, setColorScheme] = (0, import_react10.useState)(
|
|
1349
|
+
const [colorScheme, setColorScheme] = (0, import_react10.useState)(() => {
|
|
1350
|
+
if (mode === "light" || mode === "dark") {
|
|
1351
|
+
return mode;
|
|
1352
|
+
}
|
|
1353
|
+
return (0, import_browser11.detectThemeMode)(mode, detection);
|
|
1354
|
+
});
|
|
1300
1355
|
const theme = (0, import_react10.useMemo)(() => (0, import_browser11.createTheme)(themeConfig, colorScheme === "dark"), [themeConfig, colorScheme]);
|
|
1301
|
-
const
|
|
1356
|
+
const handleThemeChange = (0, import_react10.useCallback)((isDark) => {
|
|
1357
|
+
setColorScheme(isDark ? "dark" : "light");
|
|
1358
|
+
}, []);
|
|
1359
|
+
const toggleTheme = (0, import_react10.useCallback)(() => {
|
|
1302
1360
|
setColorScheme((prev) => prev === "light" ? "dark" : "light");
|
|
1303
|
-
};
|
|
1361
|
+
}, []);
|
|
1362
|
+
(0, import_react10.useEffect)(() => {
|
|
1363
|
+
let observer = null;
|
|
1364
|
+
let mediaQuery = null;
|
|
1365
|
+
if (mode === "class") {
|
|
1366
|
+
const targetElement = detection.targetElement || document.documentElement;
|
|
1367
|
+
if (targetElement) {
|
|
1368
|
+
observer = (0, import_browser11.createClassObserver)(targetElement, handleThemeChange, detection);
|
|
1369
|
+
}
|
|
1370
|
+
} else if (mode === "system") {
|
|
1371
|
+
mediaQuery = (0, import_browser11.createMediaQueryListener)(handleThemeChange);
|
|
1372
|
+
}
|
|
1373
|
+
return () => {
|
|
1374
|
+
if (observer) {
|
|
1375
|
+
observer.disconnect();
|
|
1376
|
+
}
|
|
1377
|
+
if (mediaQuery) {
|
|
1378
|
+
if (mediaQuery.removeEventListener) {
|
|
1379
|
+
mediaQuery.removeEventListener("change", handleThemeChange);
|
|
1380
|
+
} else {
|
|
1381
|
+
mediaQuery.removeListener(handleThemeChange);
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1385
|
+
}, [mode, detection, handleThemeChange]);
|
|
1304
1386
|
(0, import_react10.useEffect)(() => {
|
|
1305
1387
|
applyThemeToDOM(theme);
|
|
1306
1388
|
}, [theme]);
|
|
@@ -1322,7 +1404,9 @@ var UserContext = (0, import_react11.createContext)({
|
|
|
1322
1404
|
profile: null,
|
|
1323
1405
|
schemas: null,
|
|
1324
1406
|
flattenedProfile: null,
|
|
1325
|
-
revalidateProfile: () => null
|
|
1407
|
+
revalidateProfile: () => null,
|
|
1408
|
+
updateProfile: () => null,
|
|
1409
|
+
onUpdateProfile: () => null
|
|
1326
1410
|
});
|
|
1327
1411
|
UserContext.displayName = "UserContext";
|
|
1328
1412
|
var UserContext_default = UserContext;
|
|
@@ -1332,16 +1416,20 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
|
1332
1416
|
var UserProvider = ({
|
|
1333
1417
|
children,
|
|
1334
1418
|
profile,
|
|
1335
|
-
revalidateProfile
|
|
1419
|
+
revalidateProfile,
|
|
1420
|
+
onUpdateProfile,
|
|
1421
|
+
updateProfile
|
|
1336
1422
|
}) => {
|
|
1337
1423
|
const contextValue = (0, import_react12.useMemo)(
|
|
1338
1424
|
() => ({
|
|
1339
1425
|
schemas: profile?.schemas,
|
|
1340
1426
|
profile: profile?.profile,
|
|
1341
1427
|
flattenedProfile: profile?.flattenedProfile,
|
|
1342
|
-
revalidateProfile
|
|
1428
|
+
revalidateProfile,
|
|
1429
|
+
updateProfile,
|
|
1430
|
+
onUpdateProfile
|
|
1343
1431
|
}),
|
|
1344
|
-
[profile]
|
|
1432
|
+
[profile, onUpdateProfile, revalidateProfile, updateProfile]
|
|
1345
1433
|
);
|
|
1346
1434
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UserContext_default.Provider, { value: contextValue, children });
|
|
1347
1435
|
};
|
|
@@ -1352,13 +1440,15 @@ var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
|
1352
1440
|
var AsgardeoProvider = ({
|
|
1353
1441
|
afterSignInUrl = window.location.origin,
|
|
1354
1442
|
afterSignOutUrl = window.location.origin,
|
|
1355
|
-
baseUrl,
|
|
1443
|
+
baseUrl: _baseUrl,
|
|
1356
1444
|
clientId,
|
|
1357
1445
|
children,
|
|
1358
1446
|
scopes,
|
|
1359
1447
|
preferences,
|
|
1360
1448
|
signInUrl,
|
|
1361
1449
|
signUpUrl,
|
|
1450
|
+
organizationHandle,
|
|
1451
|
+
applicationId,
|
|
1362
1452
|
...rest
|
|
1363
1453
|
}) => {
|
|
1364
1454
|
const reRenderCheckRef = (0, import_react13.useRef)(false);
|
|
@@ -1369,18 +1459,26 @@ var AsgardeoProvider = ({
|
|
|
1369
1459
|
const [isSignedInSync, setIsSignedInSync] = (0, import_react13.useState)(false);
|
|
1370
1460
|
const [isInitializedSync, setIsInitializedSync] = (0, import_react13.useState)(false);
|
|
1371
1461
|
const [userProfile, setUserProfile] = (0, import_react13.useState)(null);
|
|
1462
|
+
const [baseUrl, setBaseUrl] = (0, import_react13.useState)(_baseUrl);
|
|
1463
|
+
const [config, setConfig] = (0, import_react13.useState)({
|
|
1464
|
+
applicationId,
|
|
1465
|
+
organizationHandle,
|
|
1466
|
+
afterSignInUrl,
|
|
1467
|
+
afterSignOutUrl,
|
|
1468
|
+
baseUrl,
|
|
1469
|
+
clientId,
|
|
1470
|
+
scopes,
|
|
1471
|
+
signUpUrl,
|
|
1472
|
+
signInUrl,
|
|
1473
|
+
...rest
|
|
1474
|
+
});
|
|
1475
|
+
(0, import_react13.useEffect)(() => {
|
|
1476
|
+
setBaseUrl(_baseUrl);
|
|
1477
|
+
}, [_baseUrl]);
|
|
1372
1478
|
(0, import_react13.useEffect)(() => {
|
|
1373
1479
|
(async () => {
|
|
1374
|
-
await asgardeo.initialize(
|
|
1375
|
-
|
|
1376
|
-
afterSignOutUrl,
|
|
1377
|
-
baseUrl,
|
|
1378
|
-
clientId,
|
|
1379
|
-
scopes,
|
|
1380
|
-
signUpUrl,
|
|
1381
|
-
signInUrl,
|
|
1382
|
-
...rest
|
|
1383
|
-
});
|
|
1480
|
+
await asgardeo.initialize(config);
|
|
1481
|
+
setConfig(await asgardeo.getConfiguration());
|
|
1384
1482
|
})();
|
|
1385
1483
|
}, []);
|
|
1386
1484
|
(0, import_react13.useEffect)(() => {
|
|
@@ -1390,9 +1488,7 @@ var AsgardeoProvider = ({
|
|
|
1390
1488
|
reRenderCheckRef.current = true;
|
|
1391
1489
|
(async () => {
|
|
1392
1490
|
if (await asgardeo.isSignedIn()) {
|
|
1393
|
-
|
|
1394
|
-
setUserProfile(await asgardeo.getUserProfile());
|
|
1395
|
-
setCurrentOrganization(await asgardeo.getCurrentOrganization());
|
|
1491
|
+
await updateSession();
|
|
1396
1492
|
return;
|
|
1397
1493
|
}
|
|
1398
1494
|
if (hasAuthParams(new URL(window.location.href), afterSignInUrl)) {
|
|
@@ -1445,13 +1541,21 @@ var AsgardeoProvider = ({
|
|
|
1445
1541
|
}
|
|
1446
1542
|
})();
|
|
1447
1543
|
}, [asgardeo]);
|
|
1544
|
+
const updateSession = async () => {
|
|
1545
|
+
let _baseUrl2 = baseUrl;
|
|
1546
|
+
if ((await asgardeo.getDecodedIdToken())?.["user_org"]) {
|
|
1547
|
+
_baseUrl2 = `${(await asgardeo.getConfiguration()).baseUrl}/o`;
|
|
1548
|
+
setBaseUrl(_baseUrl2);
|
|
1549
|
+
}
|
|
1550
|
+
setUser(await asgardeo.getUser({ baseUrl: _baseUrl2 }));
|
|
1551
|
+
setUserProfile(await asgardeo.getUserProfile({ baseUrl: _baseUrl2 }));
|
|
1552
|
+
setCurrentOrganization(await asgardeo.getCurrentOrganization());
|
|
1553
|
+
};
|
|
1448
1554
|
const signIn = async (...args) => {
|
|
1449
1555
|
try {
|
|
1450
1556
|
const response = await asgardeo.signIn(...args);
|
|
1451
1557
|
if (await asgardeo.isSignedIn()) {
|
|
1452
|
-
|
|
1453
|
-
setUserProfile(await asgardeo.getUserProfile());
|
|
1454
|
-
setCurrentOrganization(await asgardeo.getCurrentOrganization());
|
|
1558
|
+
await updateSession();
|
|
1455
1559
|
}
|
|
1456
1560
|
return response;
|
|
1457
1561
|
} catch (error) {
|
|
@@ -1475,9 +1579,7 @@ var AsgardeoProvider = ({
|
|
|
1475
1579
|
try {
|
|
1476
1580
|
await asgardeo.switchOrganization(organization);
|
|
1477
1581
|
if (await asgardeo.isSignedIn()) {
|
|
1478
|
-
|
|
1479
|
-
setUserProfile(await asgardeo.getUserProfile());
|
|
1480
|
-
setCurrentOrganization(await asgardeo.getCurrentOrganization());
|
|
1582
|
+
await updateSession();
|
|
1481
1583
|
}
|
|
1482
1584
|
} catch (error) {
|
|
1483
1585
|
throw new import_browser12.AsgardeoRuntimeError(
|
|
@@ -1494,10 +1596,20 @@ var AsgardeoProvider = ({
|
|
|
1494
1596
|
}
|
|
1495
1597
|
return preferences.theme.mode === "dark";
|
|
1496
1598
|
}, [preferences?.theme?.mode]);
|
|
1599
|
+
const handleProfileUpdate = (payload) => {
|
|
1600
|
+
setUser(payload);
|
|
1601
|
+
setUserProfile((prev) => ({
|
|
1602
|
+
...prev,
|
|
1603
|
+
profile: payload,
|
|
1604
|
+
flattenedProfile: (0, import_browser12.generateFlattenedUserProfile)(payload, prev?.schemas)
|
|
1605
|
+
}));
|
|
1606
|
+
};
|
|
1497
1607
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1498
1608
|
AsgardeoContext_default.Provider,
|
|
1499
1609
|
{
|
|
1500
1610
|
value: {
|
|
1611
|
+
applicationId,
|
|
1612
|
+
organizationHandle: config?.organizationHandle,
|
|
1501
1613
|
signInUrl,
|
|
1502
1614
|
signUpUrl,
|
|
1503
1615
|
afterSignInUrl,
|
|
@@ -1511,22 +1623,15 @@ var AsgardeoProvider = ({
|
|
|
1511
1623
|
signUp,
|
|
1512
1624
|
user
|
|
1513
1625
|
},
|
|
1514
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(I18nProvider_default, { preferences: preferences?.i18n, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ThemeProvider_default, { theme: preferences?.theme?.overrides,
|
|
1515
|
-
|
|
1626
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(I18nProvider_default, { preferences: preferences?.i18n, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ThemeProvider_default, { theme: preferences?.theme?.overrides, mode: isDarkMode ? "dark" : "light", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FlowProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(UserProvider_default, { profile: userProfile, onUpdateProfile: handleProfileUpdate, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1627
|
+
OrganizationProvider_default,
|
|
1516
1628
|
{
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
{
|
|
1522
|
-
getOrganizations: async () => asgardeo.getOrganizations(),
|
|
1523
|
-
currentOrganization,
|
|
1524
|
-
onOrganizationSwitch: switchOrganization,
|
|
1525
|
-
children
|
|
1526
|
-
}
|
|
1527
|
-
)
|
|
1629
|
+
getOrganizations: async () => asgardeo.getOrganizations(),
|
|
1630
|
+
currentOrganization,
|
|
1631
|
+
onOrganizationSwitch: switchOrganization,
|
|
1632
|
+
children
|
|
1528
1633
|
}
|
|
1529
|
-
) }) }) })
|
|
1634
|
+
) }) }) }) })
|
|
1530
1635
|
}
|
|
1531
1636
|
);
|
|
1532
1637
|
};
|
|
@@ -4341,8 +4446,7 @@ var useCardStyles = (variant, clickable) => {
|
|
|
4341
4446
|
},
|
|
4342
4447
|
outlined: {
|
|
4343
4448
|
...baseStyles,
|
|
4344
|
-
border: `1px solid ${theme.colors.border}
|
|
4345
|
-
backgroundColor: "transparent"
|
|
4449
|
+
border: `1px solid ${theme.colors.border}`
|
|
4346
4450
|
},
|
|
4347
4451
|
elevated: {
|
|
4348
4452
|
...baseStyles,
|
|
@@ -5508,7 +5612,7 @@ var BaseSignIn_default = BaseSignIn;
|
|
|
5508
5612
|
|
|
5509
5613
|
// src/components/presentation/SignIn/SignIn.tsx
|
|
5510
5614
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5511
|
-
var SignIn = ({ className, size = "medium",
|
|
5615
|
+
var SignIn = ({ className, size = "medium", ...rest }) => {
|
|
5512
5616
|
const { signIn, afterSignInUrl, isInitialized, isLoading } = useAsgardeo_default();
|
|
5513
5617
|
const handleInitialize = async () => {
|
|
5514
5618
|
return await signIn({ response_mode: "direct" });
|
|
@@ -5537,7 +5641,7 @@ var SignIn = ({ className, size = "medium", variant = "outlined" }) => {
|
|
|
5537
5641
|
onSuccess: handleSuccess,
|
|
5538
5642
|
className,
|
|
5539
5643
|
size,
|
|
5540
|
-
|
|
5644
|
+
...rest
|
|
5541
5645
|
}
|
|
5542
5646
|
);
|
|
5543
5647
|
};
|
|
@@ -6489,11 +6593,11 @@ var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
|
6489
6593
|
var SignUp = ({
|
|
6490
6594
|
className,
|
|
6491
6595
|
size = "medium",
|
|
6492
|
-
variant = "outlined",
|
|
6493
6596
|
afterSignUpUrl,
|
|
6494
6597
|
onError,
|
|
6495
6598
|
onComplete,
|
|
6496
|
-
shouldRedirectAfterSignUp = true
|
|
6599
|
+
shouldRedirectAfterSignUp = true,
|
|
6600
|
+
...rest
|
|
6497
6601
|
}) => {
|
|
6498
6602
|
const { signUp, isInitialized } = useAsgardeo_default();
|
|
6499
6603
|
const handleInitialize = async (payload) => await signUp(
|
|
@@ -6522,8 +6626,8 @@ var SignUp = ({
|
|
|
6522
6626
|
onComplete: handleComplete,
|
|
6523
6627
|
className,
|
|
6524
6628
|
size,
|
|
6525
|
-
|
|
6526
|
-
|
|
6629
|
+
isInitialized,
|
|
6630
|
+
...rest
|
|
6527
6631
|
}
|
|
6528
6632
|
);
|
|
6529
6633
|
};
|
|
@@ -6570,9 +6674,9 @@ Organization5.displayName = "Organization";
|
|
|
6570
6674
|
var Organization_default = Organization5;
|
|
6571
6675
|
|
|
6572
6676
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
6573
|
-
var
|
|
6574
|
-
var
|
|
6575
|
-
var
|
|
6677
|
+
var import_browser52 = require("@asgardeo/browser");
|
|
6678
|
+
var import_clsx20 = __toESM(require("clsx"), 1);
|
|
6679
|
+
var import_react44 = require("react");
|
|
6576
6680
|
|
|
6577
6681
|
// src/utils/getMappedUserProfileValue.ts
|
|
6578
6682
|
var import_browser48 = require("@asgardeo/browser");
|
|
@@ -7095,8 +7199,238 @@ var LegacyPopover = ({ isOpen, children, onClose, className = "", mode = "modal"
|
|
|
7095
7199
|
LegacyPopover.Header = LegacyPopoverHeader;
|
|
7096
7200
|
LegacyPopover.Content = LegacyPopoverContent;
|
|
7097
7201
|
|
|
7098
|
-
// src/components/
|
|
7202
|
+
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
7203
|
+
var import_react43 = require("react");
|
|
7204
|
+
var import_clsx19 = __toESM(require("clsx"), 1);
|
|
7205
|
+
var import_browser51 = require("@asgardeo/browser");
|
|
7099
7206
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
7207
|
+
var useStyles4 = () => {
|
|
7208
|
+
const { theme } = useTheme_default();
|
|
7209
|
+
return (0, import_react43.useMemo)(
|
|
7210
|
+
() => ({
|
|
7211
|
+
container: {
|
|
7212
|
+
display: "flex",
|
|
7213
|
+
flexDirection: "column",
|
|
7214
|
+
gap: `${theme.spacing.unit}px`
|
|
7215
|
+
},
|
|
7216
|
+
inputRow: {
|
|
7217
|
+
display: "flex",
|
|
7218
|
+
alignItems: "center",
|
|
7219
|
+
gap: `${theme.spacing.unit}px`,
|
|
7220
|
+
position: "relative"
|
|
7221
|
+
},
|
|
7222
|
+
inputWrapper: {
|
|
7223
|
+
flex: 1
|
|
7224
|
+
},
|
|
7225
|
+
plusIcon: {
|
|
7226
|
+
background: "var(--asgardeo-color-secondary-main)",
|
|
7227
|
+
borderRadius: "50%",
|
|
7228
|
+
outline: "4px var(--asgardeo-color-secondary-main) auto",
|
|
7229
|
+
color: "var(--asgardeo-color-secondary-contrastText)"
|
|
7230
|
+
},
|
|
7231
|
+
listContainer: {
|
|
7232
|
+
display: "flex",
|
|
7233
|
+
flexDirection: "column",
|
|
7234
|
+
gap: `${theme.spacing.unit / 2}px`
|
|
7235
|
+
},
|
|
7236
|
+
listItem: {
|
|
7237
|
+
display: "flex",
|
|
7238
|
+
alignItems: "center",
|
|
7239
|
+
justifyContent: "space-between",
|
|
7240
|
+
padding: `${theme.spacing.unit}px ${theme.spacing.unit * 1.5}px`,
|
|
7241
|
+
backgroundColor: theme.colors.background.surface,
|
|
7242
|
+
border: `1px solid ${theme.colors.border}`,
|
|
7243
|
+
borderRadius: theme.borderRadius.medium,
|
|
7244
|
+
fontSize: "1rem",
|
|
7245
|
+
color: theme.colors.text.primary
|
|
7246
|
+
},
|
|
7247
|
+
removeButton: {
|
|
7248
|
+
padding: `${theme.spacing.unit / 2}px`,
|
|
7249
|
+
minWidth: "auto",
|
|
7250
|
+
color: theme.colors.error.main
|
|
7251
|
+
}
|
|
7252
|
+
}),
|
|
7253
|
+
[theme]
|
|
7254
|
+
);
|
|
7255
|
+
};
|
|
7256
|
+
var MultiInput = ({
|
|
7257
|
+
label,
|
|
7258
|
+
error,
|
|
7259
|
+
required,
|
|
7260
|
+
className,
|
|
7261
|
+
disabled,
|
|
7262
|
+
helperText,
|
|
7263
|
+
placeholder = "Enter value",
|
|
7264
|
+
values = [],
|
|
7265
|
+
onChange,
|
|
7266
|
+
style = {},
|
|
7267
|
+
type = "text",
|
|
7268
|
+
fieldType = "STRING",
|
|
7269
|
+
startIcon,
|
|
7270
|
+
endIcon,
|
|
7271
|
+
minFields = 1,
|
|
7272
|
+
maxFields
|
|
7273
|
+
}) => {
|
|
7274
|
+
const styles = useStyles4();
|
|
7275
|
+
const PlusIcon = ({ style: style2 }) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
7276
|
+
"svg",
|
|
7277
|
+
{
|
|
7278
|
+
width: "16",
|
|
7279
|
+
height: "16",
|
|
7280
|
+
viewBox: "0 0 24 24",
|
|
7281
|
+
fill: "none",
|
|
7282
|
+
stroke: "currentColor",
|
|
7283
|
+
strokeWidth: "2",
|
|
7284
|
+
strokeLinecap: "round",
|
|
7285
|
+
strokeLinejoin: "round",
|
|
7286
|
+
style: style2,
|
|
7287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: "M12 5v14M5 12h14" })
|
|
7288
|
+
}
|
|
7289
|
+
);
|
|
7290
|
+
const BinIcon = () => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
7291
|
+
"svg",
|
|
7292
|
+
{
|
|
7293
|
+
width: "16",
|
|
7294
|
+
height: "16",
|
|
7295
|
+
viewBox: "0 0 24 24",
|
|
7296
|
+
fill: "none",
|
|
7297
|
+
stroke: "currentColor",
|
|
7298
|
+
strokeWidth: "2",
|
|
7299
|
+
strokeLinecap: "round",
|
|
7300
|
+
strokeLinejoin: "round",
|
|
7301
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: "M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14ZM10 11v6M14 11v6" })
|
|
7302
|
+
}
|
|
7303
|
+
);
|
|
7304
|
+
const handleAddValue = (0, import_react43.useCallback)(
|
|
7305
|
+
(newValue) => {
|
|
7306
|
+
if (newValue.trim() !== "" && (!maxFields || values.length < maxFields)) {
|
|
7307
|
+
onChange([...values, newValue.trim()]);
|
|
7308
|
+
}
|
|
7309
|
+
},
|
|
7310
|
+
[values, onChange, maxFields]
|
|
7311
|
+
);
|
|
7312
|
+
const handleRemoveValue = (0, import_react43.useCallback)(
|
|
7313
|
+
(index) => {
|
|
7314
|
+
if (values.length > minFields) {
|
|
7315
|
+
const updatedValues = values.filter((_, i) => i !== index);
|
|
7316
|
+
onChange(updatedValues);
|
|
7317
|
+
}
|
|
7318
|
+
},
|
|
7319
|
+
[values, onChange, minFields]
|
|
7320
|
+
);
|
|
7321
|
+
const renderInputField = (0, import_react43.useCallback)(
|
|
7322
|
+
(value, onValueChange, attachedEndIcon, onEndIconClick) => {
|
|
7323
|
+
const handleInputChange = (e) => {
|
|
7324
|
+
const newValue = e.target ? e.target.value : e;
|
|
7325
|
+
onValueChange(newValue);
|
|
7326
|
+
};
|
|
7327
|
+
const handleKeyDown = (e) => {
|
|
7328
|
+
if (e.key === "Enter" && onEndIconClick) {
|
|
7329
|
+
e.preventDefault();
|
|
7330
|
+
onEndIconClick();
|
|
7331
|
+
}
|
|
7332
|
+
};
|
|
7333
|
+
const finalEndIcon = attachedEndIcon || endIcon;
|
|
7334
|
+
const commonProps = {
|
|
7335
|
+
value,
|
|
7336
|
+
onChange: handleInputChange,
|
|
7337
|
+
onKeyDown: handleKeyDown,
|
|
7338
|
+
placeholder,
|
|
7339
|
+
disabled,
|
|
7340
|
+
startIcon,
|
|
7341
|
+
endIcon: finalEndIcon,
|
|
7342
|
+
onEndIconClick,
|
|
7343
|
+
error
|
|
7344
|
+
};
|
|
7345
|
+
switch (fieldType) {
|
|
7346
|
+
case "DATE_TIME":
|
|
7347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DatePicker_default, { ...commonProps });
|
|
7348
|
+
case "BOOLEAN":
|
|
7349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
7350
|
+
Checkbox_default,
|
|
7351
|
+
{
|
|
7352
|
+
...commonProps,
|
|
7353
|
+
checked: value === "true" || Boolean(value),
|
|
7354
|
+
onChange: (e) => onValueChange(e.target.checked ? "true" : "false")
|
|
7355
|
+
}
|
|
7356
|
+
);
|
|
7357
|
+
default:
|
|
7358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(TextField_default, { ...commonProps, type });
|
|
7359
|
+
}
|
|
7360
|
+
},
|
|
7361
|
+
[placeholder, disabled, startIcon, endIcon, error, fieldType, type]
|
|
7362
|
+
);
|
|
7363
|
+
const canAddMore = !maxFields || values.length < maxFields;
|
|
7364
|
+
const canRemove = values.length > minFields;
|
|
7365
|
+
const [currentInputValue, setCurrentInputValue] = (0, import_react43.useState)("");
|
|
7366
|
+
const handleInputSubmit = (0, import_react43.useCallback)(() => {
|
|
7367
|
+
if (currentInputValue.trim() !== "") {
|
|
7368
|
+
handleAddValue(currentInputValue);
|
|
7369
|
+
setCurrentInputValue("");
|
|
7370
|
+
}
|
|
7371
|
+
}, [currentInputValue, handleAddValue]);
|
|
7372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
7373
|
+
FormControl_default,
|
|
7374
|
+
{
|
|
7375
|
+
error,
|
|
7376
|
+
helperText,
|
|
7377
|
+
className: (0, import_clsx19.default)((0, import_browser51.withVendorCSSClassPrefix)("multi-input"), className),
|
|
7378
|
+
style,
|
|
7379
|
+
children: [
|
|
7380
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(InputLabel_default, { required, error: !!error, children: label }),
|
|
7381
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: styles.container, children: [
|
|
7382
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: styles.inputRow, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: styles.inputWrapper, children: renderInputField(
|
|
7383
|
+
currentInputValue,
|
|
7384
|
+
setCurrentInputValue,
|
|
7385
|
+
canAddMore ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PlusIcon, { style: styles.plusIcon }) : void 0,
|
|
7386
|
+
canAddMore ? handleInputSubmit : void 0
|
|
7387
|
+
) }) }),
|
|
7388
|
+
values.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: styles.listContainer, children: values.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: styles.listItem, children: [
|
|
7389
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { children: value }),
|
|
7390
|
+
canRemove && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
7391
|
+
Button_default,
|
|
7392
|
+
{
|
|
7393
|
+
size: "small",
|
|
7394
|
+
color: "secondary",
|
|
7395
|
+
variant: "text",
|
|
7396
|
+
onClick: () => handleRemoveValue(index),
|
|
7397
|
+
disabled,
|
|
7398
|
+
title: "Remove value",
|
|
7399
|
+
style: styles.removeButton,
|
|
7400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(BinIcon, {})
|
|
7401
|
+
}
|
|
7402
|
+
)
|
|
7403
|
+
] }, index)) })
|
|
7404
|
+
] })
|
|
7405
|
+
]
|
|
7406
|
+
}
|
|
7407
|
+
);
|
|
7408
|
+
};
|
|
7409
|
+
var MultiInput_default = MultiInput;
|
|
7410
|
+
|
|
7411
|
+
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
7412
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
7413
|
+
var fieldsToSkip = [
|
|
7414
|
+
"roles.default",
|
|
7415
|
+
"active",
|
|
7416
|
+
"groups",
|
|
7417
|
+
"profileUrl",
|
|
7418
|
+
"accountLocked",
|
|
7419
|
+
"accountDisabled",
|
|
7420
|
+
"oneTimePassword",
|
|
7421
|
+
"userSourceId",
|
|
7422
|
+
"idpType",
|
|
7423
|
+
"localCredentialExists",
|
|
7424
|
+
"active",
|
|
7425
|
+
"ResourceType",
|
|
7426
|
+
"ExternalID",
|
|
7427
|
+
"MetaData",
|
|
7428
|
+
"verifiedMobileNumbers",
|
|
7429
|
+
"verifiedEmailAddresses",
|
|
7430
|
+
"phoneNumbers.mobile",
|
|
7431
|
+
"emailAddresses"
|
|
7432
|
+
];
|
|
7433
|
+
var readonlyFields = ["username", "userName", "user_name"];
|
|
7100
7434
|
var BaseUserProfile = ({
|
|
7101
7435
|
fallback = null,
|
|
7102
7436
|
className = "",
|
|
@@ -7117,10 +7451,10 @@ var BaseUserProfile = ({
|
|
|
7117
7451
|
cancelButtonText = "Cancel"
|
|
7118
7452
|
}) => {
|
|
7119
7453
|
const { theme } = useTheme_default();
|
|
7120
|
-
const [editedUser, setEditedUser] = (0,
|
|
7121
|
-
const [editingFields, setEditingFields] = (0,
|
|
7122
|
-
const triggerRef = (0,
|
|
7123
|
-
const PencilIcon = () => /* @__PURE__ */ (0,
|
|
7454
|
+
const [editedUser, setEditedUser] = (0, import_react44.useState)(flattenedProfile || profile);
|
|
7455
|
+
const [editingFields, setEditingFields] = (0, import_react44.useState)({});
|
|
7456
|
+
const triggerRef = (0, import_react44.useRef)(null);
|
|
7457
|
+
const PencilIcon = () => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7124
7458
|
"svg",
|
|
7125
7459
|
{
|
|
7126
7460
|
width: "16",
|
|
@@ -7131,16 +7465,16 @@ var BaseUserProfile = ({
|
|
|
7131
7465
|
strokeWidth: "2",
|
|
7132
7466
|
strokeLinecap: "round",
|
|
7133
7467
|
strokeLinejoin: "round",
|
|
7134
|
-
children: /* @__PURE__ */ (0,
|
|
7468
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
7135
7469
|
}
|
|
7136
7470
|
);
|
|
7137
|
-
const toggleFieldEdit = (0,
|
|
7471
|
+
const toggleFieldEdit = (0, import_react44.useCallback)((fieldName) => {
|
|
7138
7472
|
setEditingFields((prev) => ({
|
|
7139
7473
|
...prev,
|
|
7140
7474
|
[fieldName]: !prev[fieldName]
|
|
7141
7475
|
}));
|
|
7142
7476
|
}, []);
|
|
7143
|
-
const getFieldPlaceholder = (0,
|
|
7477
|
+
const getFieldPlaceholder = (0, import_react44.useCallback)((schema) => {
|
|
7144
7478
|
const { type, displayName, description, name } = schema;
|
|
7145
7479
|
const fieldLabel = displayName || description || name || "value";
|
|
7146
7480
|
switch (type) {
|
|
@@ -7156,12 +7490,12 @@ var BaseUserProfile = ({
|
|
|
7156
7490
|
}, []);
|
|
7157
7491
|
const ObjectDisplay = ({ data }) => {
|
|
7158
7492
|
if (!data || typeof data !== "object") return null;
|
|
7159
|
-
return /* @__PURE__ */ (0,
|
|
7160
|
-
/* @__PURE__ */ (0,
|
|
7493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("table", { style: { width: "100%", borderCollapse: "collapse" }, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("tbody", { children: Object.entries(data).map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("tr", { style: { borderBottom: `1px solid ${theme.colors.border}` }, children: [
|
|
7494
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("td", { style: { padding: `${theme.spacing.unit}px`, verticalAlign: "top" }, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("strong", { children: [
|
|
7161
7495
|
formatLabel(key),
|
|
7162
7496
|
":"
|
|
7163
7497
|
] }) }),
|
|
7164
|
-
/* @__PURE__ */ (0,
|
|
7498
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("td", { style: { padding: `${theme.spacing.unit}px`, verticalAlign: "top" }, children: typeof value === "object" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ObjectDisplay, { data: value }) : String(value) })
|
|
7165
7499
|
] }, key)) }) });
|
|
7166
7500
|
};
|
|
7167
7501
|
function set(obj, path, value) {
|
|
@@ -7179,13 +7513,16 @@ var BaseUserProfile = ({
|
|
|
7179
7513
|
}
|
|
7180
7514
|
}
|
|
7181
7515
|
}
|
|
7182
|
-
const handleFieldSave = (0,
|
|
7516
|
+
const handleFieldSave = (0, import_react44.useCallback)(
|
|
7183
7517
|
(schema) => {
|
|
7184
7518
|
if (!onUpdate || !schema.name) return;
|
|
7185
7519
|
const fieldName = schema.name;
|
|
7186
|
-
|
|
7520
|
+
let fieldValue = editedUser && fieldName && editedUser[fieldName] !== void 0 ? editedUser[fieldName] : flattenedProfile && flattenedProfile[fieldName] !== void 0 ? flattenedProfile[fieldName] : "";
|
|
7521
|
+
if (Array.isArray(fieldValue)) {
|
|
7522
|
+
fieldValue = fieldValue.filter((v) => v !== void 0 && v !== null && v !== "");
|
|
7523
|
+
}
|
|
7187
7524
|
let payload = {};
|
|
7188
|
-
if (schema.schemaId && schema.schemaId !==
|
|
7525
|
+
if (schema.schemaId && schema.schemaId !== import_browser52.WellKnownSchemaIds.User) {
|
|
7189
7526
|
payload = {
|
|
7190
7527
|
[schema.schemaId]: {
|
|
7191
7528
|
[fieldName]: fieldValue
|
|
@@ -7199,7 +7536,7 @@ var BaseUserProfile = ({
|
|
|
7199
7536
|
},
|
|
7200
7537
|
[editedUser, flattenedProfile, onUpdate, toggleFieldEdit]
|
|
7201
7538
|
);
|
|
7202
|
-
const handleFieldCancel = (0,
|
|
7539
|
+
const handleFieldCancel = (0, import_react44.useCallback)(
|
|
7203
7540
|
(fieldName) => {
|
|
7204
7541
|
const currentUser2 = flattenedProfile || profile;
|
|
7205
7542
|
setEditedUser((prev) => ({
|
|
@@ -7210,12 +7547,12 @@ var BaseUserProfile = ({
|
|
|
7210
7547
|
},
|
|
7211
7548
|
[flattenedProfile, profile, toggleFieldEdit]
|
|
7212
7549
|
);
|
|
7213
|
-
const formatLabel = (0,
|
|
7550
|
+
const formatLabel = (0, import_react44.useCallback)(
|
|
7214
7551
|
(key) => key.split(/(?=[A-Z])|_/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" "),
|
|
7215
7552
|
[]
|
|
7216
7553
|
);
|
|
7217
|
-
const styles =
|
|
7218
|
-
const buttonStyle = (0,
|
|
7554
|
+
const styles = useStyles5();
|
|
7555
|
+
const buttonStyle = (0, import_react44.useMemo)(
|
|
7219
7556
|
() => ({
|
|
7220
7557
|
padding: `${theme.spacing.unit}px ${theme.spacing.unit * 2}px`,
|
|
7221
7558
|
margin: `${theme.spacing.unit}px`,
|
|
@@ -7227,7 +7564,7 @@ var BaseUserProfile = ({
|
|
|
7227
7564
|
}),
|
|
7228
7565
|
[theme]
|
|
7229
7566
|
);
|
|
7230
|
-
const saveButtonStyle = (0,
|
|
7567
|
+
const saveButtonStyle = (0, import_react44.useMemo)(
|
|
7231
7568
|
() => ({
|
|
7232
7569
|
...buttonStyle,
|
|
7233
7570
|
backgroundColor: theme.colors.primary.main,
|
|
@@ -7235,7 +7572,7 @@ var BaseUserProfile = ({
|
|
|
7235
7572
|
}),
|
|
7236
7573
|
[theme, buttonStyle]
|
|
7237
7574
|
);
|
|
7238
|
-
const cancelButtonStyle = (0,
|
|
7575
|
+
const cancelButtonStyle = (0, import_react44.useMemo)(
|
|
7239
7576
|
() => ({
|
|
7240
7577
|
...buttonStyle,
|
|
7241
7578
|
backgroundColor: theme.colors.secondary.main,
|
|
@@ -7253,28 +7590,66 @@ var BaseUserProfile = ({
|
|
|
7253
7590
|
const mergedMappings = { ...defaultAttributeMappings, ...attributeMapping };
|
|
7254
7591
|
const renderSchemaField = (schema, isEditing, onEditValue, onStartEdit) => {
|
|
7255
7592
|
if (!schema) return null;
|
|
7256
|
-
const { value, displayName, description, name, type, required, mutability, subAttributes } = schema;
|
|
7593
|
+
const { value, displayName, description, name, type, required, mutability, subAttributes, multiValued } = schema;
|
|
7257
7594
|
const label = displayName || description || name || "";
|
|
7258
7595
|
if (subAttributes && Array.isArray(subAttributes)) {
|
|
7259
|
-
return /* @__PURE__ */ (0,
|
|
7260
|
-
/* @__PURE__ */ (0,
|
|
7261
|
-
/* @__PURE__ */ (0,
|
|
7596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_jsx_runtime74.Fragment, { children: subAttributes.map((subAttr, index) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { style: styles.field, children: [
|
|
7597
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { style: styles.label, children: subAttr.displayName || subAttr.description || "" }),
|
|
7598
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { style: styles.value, children: Array.isArray(subAttr.value) ? subAttr.value.map((item) => typeof item === "object" ? JSON.stringify(item) : String(item)).join(", ") : typeof subAttr.value === "object" ? JSON.stringify(subAttr.value) : String(subAttr.value) })
|
|
7262
7599
|
] }, index)) });
|
|
7263
7600
|
}
|
|
7264
|
-
if (Array.isArray(value)) {
|
|
7265
|
-
const hasValues = value.length > 0;
|
|
7266
|
-
const isEditable2 = editable && mutability !== "READ_ONLY";
|
|
7601
|
+
if (Array.isArray(value) || multiValued) {
|
|
7602
|
+
const hasValues = Array.isArray(value) ? value.length > 0 : value !== void 0 && value !== null && value !== "";
|
|
7603
|
+
const isEditable2 = editable && mutability !== "READ_ONLY" && !readonlyFields.includes(name || "");
|
|
7604
|
+
if (isEditing && onEditValue && isEditable2) {
|
|
7605
|
+
const currentValue = editedUser && name && editedUser[name] !== void 0 ? editedUser[name] : flattenedProfile && name && flattenedProfile[name] !== void 0 ? flattenedProfile[name] : value;
|
|
7606
|
+
let fieldValues;
|
|
7607
|
+
if (Array.isArray(currentValue)) {
|
|
7608
|
+
fieldValues = currentValue.map(String);
|
|
7609
|
+
} else if (currentValue !== void 0 && currentValue !== null && currentValue !== "") {
|
|
7610
|
+
fieldValues = [String(currentValue)];
|
|
7611
|
+
} else {
|
|
7612
|
+
fieldValues = [];
|
|
7613
|
+
}
|
|
7614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
7615
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { style: styles.label, children: label }),
|
|
7616
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { style: styles.value, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7617
|
+
MultiInput_default,
|
|
7618
|
+
{
|
|
7619
|
+
values: fieldValues,
|
|
7620
|
+
onChange: (newValues) => {
|
|
7621
|
+
if (multiValued || Array.isArray(currentValue)) {
|
|
7622
|
+
onEditValue(newValues);
|
|
7623
|
+
} else {
|
|
7624
|
+
onEditValue(newValues[0] || "");
|
|
7625
|
+
}
|
|
7626
|
+
},
|
|
7627
|
+
placeholder: getFieldPlaceholder(schema),
|
|
7628
|
+
fieldType: type,
|
|
7629
|
+
type: type === "DATE_TIME" ? "date" : type === "STRING" ? "text" : "text",
|
|
7630
|
+
required,
|
|
7631
|
+
style: {
|
|
7632
|
+
marginBottom: 0
|
|
7633
|
+
}
|
|
7634
|
+
}
|
|
7635
|
+
) })
|
|
7636
|
+
] });
|
|
7637
|
+
}
|
|
7267
7638
|
let displayValue2;
|
|
7268
7639
|
if (hasValues) {
|
|
7269
|
-
|
|
7640
|
+
if (Array.isArray(value)) {
|
|
7641
|
+
displayValue2 = value.map((item) => typeof item === "object" ? JSON.stringify(item) : String(item)).join(", ");
|
|
7642
|
+
} else {
|
|
7643
|
+
displayValue2 = String(value);
|
|
7644
|
+
}
|
|
7270
7645
|
} else if (isEditable2) {
|
|
7271
7646
|
displayValue2 = getFieldPlaceholder(schema);
|
|
7272
7647
|
} else {
|
|
7273
7648
|
displayValue2 = "-";
|
|
7274
7649
|
}
|
|
7275
|
-
return /* @__PURE__ */ (0,
|
|
7276
|
-
/* @__PURE__ */ (0,
|
|
7277
|
-
/* @__PURE__ */ (0,
|
|
7650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
7651
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { style: styles.label, children: label }),
|
|
7652
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { style: { ...styles.value, fontStyle: hasValues ? "normal" : "italic", opacity: hasValues ? 1 : 0.7 }, children: !hasValues && isEditable2 && onStartEdit ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7278
7653
|
"button",
|
|
7279
7654
|
{
|
|
7280
7655
|
onClick: onStartEdit,
|
|
@@ -7296,9 +7671,9 @@ var BaseUserProfile = ({
|
|
|
7296
7671
|
] });
|
|
7297
7672
|
}
|
|
7298
7673
|
if (type === "COMPLEX" && typeof value === "object") {
|
|
7299
|
-
return /* @__PURE__ */ (0,
|
|
7674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ObjectDisplay, { data: value });
|
|
7300
7675
|
}
|
|
7301
|
-
if (isEditing && onEditValue && mutability !== "READ_ONLY") {
|
|
7676
|
+
if (isEditing && onEditValue && mutability !== "READ_ONLY" && !readonlyFields.includes(name || "")) {
|
|
7302
7677
|
const fieldValue = editedUser && name && editedUser[name] !== void 0 ? editedUser[name] : flattenedProfile && name && flattenedProfile[name] !== void 0 ? flattenedProfile[name] : value || "";
|
|
7303
7678
|
const commonProps = {
|
|
7304
7679
|
label: void 0,
|
|
@@ -7314,16 +7689,16 @@ var BaseUserProfile = ({
|
|
|
7314
7689
|
let field;
|
|
7315
7690
|
switch (type) {
|
|
7316
7691
|
case "STRING":
|
|
7317
|
-
field = /* @__PURE__ */ (0,
|
|
7692
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TextField_default, { ...commonProps });
|
|
7318
7693
|
break;
|
|
7319
7694
|
case "DATE_TIME":
|
|
7320
|
-
field = /* @__PURE__ */ (0,
|
|
7695
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DatePicker_default, { ...commonProps });
|
|
7321
7696
|
break;
|
|
7322
7697
|
case "BOOLEAN":
|
|
7323
|
-
field = /* @__PURE__ */ (0,
|
|
7698
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Checkbox_default, { ...commonProps, checked: !!fieldValue, onChange: (e) => onEditValue(e.target.checked) });
|
|
7324
7699
|
break;
|
|
7325
7700
|
case "COMPLEX":
|
|
7326
|
-
field = /* @__PURE__ */ (0,
|
|
7701
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7327
7702
|
"textarea",
|
|
7328
7703
|
{
|
|
7329
7704
|
value: fieldValue,
|
|
@@ -7343,15 +7718,15 @@ var BaseUserProfile = ({
|
|
|
7343
7718
|
);
|
|
7344
7719
|
break;
|
|
7345
7720
|
default:
|
|
7346
|
-
field = /* @__PURE__ */ (0,
|
|
7721
|
+
field = /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TextField_default, { ...commonProps });
|
|
7347
7722
|
}
|
|
7348
|
-
return /* @__PURE__ */ (0,
|
|
7349
|
-
/* @__PURE__ */ (0,
|
|
7350
|
-
/* @__PURE__ */ (0,
|
|
7723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
7724
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { style: styles.label, children: label }),
|
|
7725
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { style: styles.value, children: field })
|
|
7351
7726
|
] });
|
|
7352
7727
|
}
|
|
7353
7728
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
7354
|
-
const isEditable = editable && mutability !== "READ_ONLY";
|
|
7729
|
+
const isEditable = editable && mutability !== "READ_ONLY" && !readonlyFields.includes(name || "");
|
|
7355
7730
|
let displayValue;
|
|
7356
7731
|
if (hasValue) {
|
|
7357
7732
|
displayValue = String(value);
|
|
@@ -7360,9 +7735,9 @@ var BaseUserProfile = ({
|
|
|
7360
7735
|
} else {
|
|
7361
7736
|
displayValue = "-";
|
|
7362
7737
|
}
|
|
7363
|
-
return /* @__PURE__ */ (0,
|
|
7364
|
-
/* @__PURE__ */ (0,
|
|
7365
|
-
/* @__PURE__ */ (0,
|
|
7738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
7739
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { style: styles.label, children: label }),
|
|
7740
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { style: { ...styles.value, fontStyle: hasValue ? "normal" : "italic", opacity: hasValue ? 1 : 0.7 }, children: !hasValue && isEditable && onStartEdit ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7366
7741
|
"button",
|
|
7367
7742
|
{
|
|
7368
7743
|
onClick: onStartEdit,
|
|
@@ -7387,6 +7762,7 @@ var BaseUserProfile = ({
|
|
|
7387
7762
|
if (!schema || !schema.name) return null;
|
|
7388
7763
|
const hasValue = schema.value !== void 0 && schema.value !== "" && schema.value !== null;
|
|
7389
7764
|
const isFieldEditing = editingFields[schema.name];
|
|
7765
|
+
const isReadonlyField = readonlyFields.includes(schema.name);
|
|
7390
7766
|
const shouldShow = hasValue || isFieldEditing || editable && schema.mutability === "READ_WRITE";
|
|
7391
7767
|
if (!shouldShow) {
|
|
7392
7768
|
return null;
|
|
@@ -7397,8 +7773,8 @@ var BaseUserProfile = ({
|
|
|
7397
7773
|
alignItems: "center",
|
|
7398
7774
|
gap: `${theme.spacing.unit}px`
|
|
7399
7775
|
};
|
|
7400
|
-
return /* @__PURE__ */ (0,
|
|
7401
|
-
/* @__PURE__ */ (0,
|
|
7776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { style: fieldStyle, children: [
|
|
7777
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { style: { flex: 1, display: "flex", alignItems: "center", gap: `${theme.spacing.unit}px` }, children: renderSchemaField(
|
|
7402
7778
|
schema,
|
|
7403
7779
|
isFieldEditing,
|
|
7404
7780
|
(value) => {
|
|
@@ -7408,7 +7784,7 @@ var BaseUserProfile = ({
|
|
|
7408
7784
|
},
|
|
7409
7785
|
() => toggleFieldEdit(schema.name)
|
|
7410
7786
|
) }),
|
|
7411
|
-
editable && schema.mutability !== "READ_ONLY" && /* @__PURE__ */ (0,
|
|
7787
|
+
editable && schema.mutability !== "READ_ONLY" && !isReadonlyField && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
7412
7788
|
"div",
|
|
7413
7789
|
{
|
|
7414
7790
|
style: {
|
|
@@ -7418,9 +7794,9 @@ var BaseUserProfile = ({
|
|
|
7418
7794
|
marginLeft: `${theme.spacing.unit}px`
|
|
7419
7795
|
},
|
|
7420
7796
|
children: [
|
|
7421
|
-
isFieldEditing && /* @__PURE__ */ (0,
|
|
7422
|
-
/* @__PURE__ */ (0,
|
|
7423
|
-
/* @__PURE__ */ (0,
|
|
7797
|
+
isFieldEditing && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
7798
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Button_default, { size: "small", color: "primary", variant: "solid", onClick: () => handleFieldSave(schema), children: "Save" }),
|
|
7799
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7424
7800
|
Button_default,
|
|
7425
7801
|
{
|
|
7426
7802
|
size: "small",
|
|
@@ -7431,7 +7807,7 @@ var BaseUserProfile = ({
|
|
|
7431
7807
|
}
|
|
7432
7808
|
)
|
|
7433
7809
|
] }),
|
|
7434
|
-
!isFieldEditing && hasValue && /* @__PURE__ */ (0,
|
|
7810
|
+
!isFieldEditing && hasValue && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7435
7811
|
Button_default,
|
|
7436
7812
|
{
|
|
7437
7813
|
size: "small",
|
|
@@ -7442,7 +7818,7 @@ var BaseUserProfile = ({
|
|
|
7442
7818
|
style: {
|
|
7443
7819
|
padding: `${theme.spacing.unit / 2}px`
|
|
7444
7820
|
},
|
|
7445
|
-
children: /* @__PURE__ */ (0,
|
|
7821
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(PencilIcon, {})
|
|
7446
7822
|
}
|
|
7447
7823
|
)
|
|
7448
7824
|
]
|
|
@@ -7469,9 +7845,8 @@ var BaseUserProfile = ({
|
|
|
7469
7845
|
const currentUser = flattenedProfile || profile;
|
|
7470
7846
|
const avatarAttributes = ["picture"];
|
|
7471
7847
|
const excludedProps = avatarAttributes.map((attr) => mergedMappings[attr] || attr);
|
|
7472
|
-
const
|
|
7473
|
-
|
|
7474
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
7848
|
+
const profileContent = /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(Card_default, { style: containerStyle, className: (0, import_clsx20.default)((0, import_browser52.withVendorCSSClassPrefix)("user-profile"), className), children: [
|
|
7849
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { style: styles.header, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7475
7850
|
Avatar,
|
|
7476
7851
|
{
|
|
7477
7852
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, currentUser),
|
|
@@ -7480,7 +7855,7 @@ var BaseUserProfile = ({
|
|
|
7480
7855
|
alt: `${getDisplayName()}'s avatar`
|
|
7481
7856
|
}
|
|
7482
7857
|
) }),
|
|
7483
|
-
/* @__PURE__ */ (0,
|
|
7858
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { style: styles.infoContainer, children: schemas.filter((schema) => {
|
|
7484
7859
|
if (!schema.name || schema.name === "profileUrl") return false;
|
|
7485
7860
|
if (fieldsToSkip.includes(schema.name)) return false;
|
|
7486
7861
|
if (!editable) {
|
|
@@ -7498,20 +7873,20 @@ var BaseUserProfile = ({
|
|
|
7498
7873
|
...schema,
|
|
7499
7874
|
value
|
|
7500
7875
|
};
|
|
7501
|
-
return /* @__PURE__ */ (0,
|
|
7876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { children: renderUserInfo(schemaWithValue) }, schema.name || index);
|
|
7502
7877
|
}) })
|
|
7503
7878
|
] });
|
|
7504
7879
|
if (mode === "popup") {
|
|
7505
|
-
return /* @__PURE__ */ (0,
|
|
7506
|
-
/* @__PURE__ */ (0,
|
|
7507
|
-
/* @__PURE__ */ (0,
|
|
7880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(DialogContent, { children: [
|
|
7881
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DialogHeading, { children: title }),
|
|
7882
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { style: { padding: "1rem" }, children: profileContent })
|
|
7508
7883
|
] }) });
|
|
7509
7884
|
}
|
|
7510
7885
|
return profileContent;
|
|
7511
7886
|
};
|
|
7512
|
-
var
|
|
7887
|
+
var useStyles5 = () => {
|
|
7513
7888
|
const { theme, colorScheme } = useTheme_default();
|
|
7514
|
-
return (0,
|
|
7889
|
+
return (0, import_react44.useMemo)(
|
|
7515
7890
|
() => ({
|
|
7516
7891
|
root: {
|
|
7517
7892
|
padding: `${theme.spacing.unit * 4}px`,
|
|
@@ -7568,7 +7943,7 @@ var useStyles4 = () => {
|
|
|
7568
7943
|
gap: `${theme.spacing.unit}px`,
|
|
7569
7944
|
overflow: "hidden",
|
|
7570
7945
|
minHeight: "32px",
|
|
7571
|
-
"& input
|
|
7946
|
+
"& input": {
|
|
7572
7947
|
height: "32px",
|
|
7573
7948
|
margin: 0
|
|
7574
7949
|
},
|
|
@@ -7592,8 +7967,8 @@ var useStyles4 = () => {
|
|
|
7592
7967
|
var BaseUserProfile_default = BaseUserProfile;
|
|
7593
7968
|
|
|
7594
7969
|
// src/api/updateMeProfile.ts
|
|
7595
|
-
var
|
|
7596
|
-
var httpClient5 =
|
|
7970
|
+
var import_browser53 = require("@asgardeo/browser");
|
|
7971
|
+
var httpClient5 = import_browser53.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser53.AsgardeoSPAClient.getInstance());
|
|
7597
7972
|
var updateMeProfile = async ({ fetcher, ...requestConfig }) => {
|
|
7598
7973
|
const defaultFetcher = async (url, config) => {
|
|
7599
7974
|
const response = await httpClient5({
|
|
@@ -7610,7 +7985,7 @@ var updateMeProfile = async ({ fetcher, ...requestConfig }) => {
|
|
|
7610
7985
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
7611
7986
|
};
|
|
7612
7987
|
};
|
|
7613
|
-
return (0,
|
|
7988
|
+
return (0, import_browser53.updateMeProfile)({
|
|
7614
7989
|
...requestConfig,
|
|
7615
7990
|
fetcher: fetcher || defaultFetcher
|
|
7616
7991
|
});
|
|
@@ -7618,15 +7993,15 @@ var updateMeProfile = async ({ fetcher, ...requestConfig }) => {
|
|
|
7618
7993
|
var updateMeProfile_default = updateMeProfile;
|
|
7619
7994
|
|
|
7620
7995
|
// src/components/presentation/UserProfile/UserProfile.tsx
|
|
7621
|
-
var
|
|
7996
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
7622
7997
|
var UserProfile3 = ({ ...rest }) => {
|
|
7623
7998
|
const { baseUrl } = useAsgardeo_default();
|
|
7624
|
-
const { profile, flattenedProfile, schemas,
|
|
7999
|
+
const { profile, flattenedProfile, schemas, onUpdateProfile } = useUser_default();
|
|
7625
8000
|
const handleProfileUpdate = async (payload) => {
|
|
7626
|
-
await updateMeProfile_default({ baseUrl, payload });
|
|
7627
|
-
|
|
8001
|
+
const response = await updateMeProfile_default({ baseUrl, payload });
|
|
8002
|
+
onUpdateProfile(response);
|
|
7628
8003
|
};
|
|
7629
|
-
return /* @__PURE__ */ (0,
|
|
8004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
7630
8005
|
BaseUserProfile_default,
|
|
7631
8006
|
{
|
|
7632
8007
|
profile,
|
|
@@ -7640,14 +8015,14 @@ var UserProfile3 = ({ ...rest }) => {
|
|
|
7640
8015
|
var UserProfile_default = UserProfile3;
|
|
7641
8016
|
|
|
7642
8017
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
7643
|
-
var
|
|
7644
|
-
var
|
|
7645
|
-
var
|
|
7646
|
-
var
|
|
7647
|
-
var
|
|
7648
|
-
var
|
|
8018
|
+
var import_browser54 = require("@asgardeo/browser");
|
|
8019
|
+
var import_react45 = require("@floating-ui/react");
|
|
8020
|
+
var import_clsx21 = __toESM(require("clsx"), 1);
|
|
8021
|
+
var import_react46 = require("react");
|
|
8022
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
8023
|
+
var useStyles6 = () => {
|
|
7649
8024
|
const { theme, colorScheme } = useTheme_default();
|
|
7650
|
-
return (0,
|
|
8025
|
+
return (0, import_react46.useMemo)(
|
|
7651
8026
|
() => ({
|
|
7652
8027
|
trigger: {
|
|
7653
8028
|
display: "inline-flex",
|
|
@@ -7785,22 +8160,22 @@ var BaseUserDropdown = ({
|
|
|
7785
8160
|
onSignOut,
|
|
7786
8161
|
attributeMapping = {}
|
|
7787
8162
|
}) => {
|
|
7788
|
-
const styles =
|
|
7789
|
-
const [isOpen, setIsOpen] = (0,
|
|
7790
|
-
const [hoveredItemIndex, setHoveredItemIndex] = (0,
|
|
8163
|
+
const styles = useStyles6();
|
|
8164
|
+
const [isOpen, setIsOpen] = (0, import_react46.useState)(false);
|
|
8165
|
+
const [hoveredItemIndex, setHoveredItemIndex] = (0, import_react46.useState)(null);
|
|
7791
8166
|
const { theme, colorScheme } = useTheme_default();
|
|
7792
8167
|
const hoverBackgroundColor = colorScheme === "dark" ? "rgba(255, 255, 255, 0.08)" : "rgba(0, 0, 0, 0.04)";
|
|
7793
|
-
const { refs, floatingStyles, context } = (0,
|
|
8168
|
+
const { refs, floatingStyles, context } = (0, import_react45.useFloating)({
|
|
7794
8169
|
open: isOpen,
|
|
7795
8170
|
onOpenChange: setIsOpen,
|
|
7796
8171
|
placement: "bottom-end",
|
|
7797
|
-
middleware: [(0,
|
|
7798
|
-
whileElementsMounted:
|
|
8172
|
+
middleware: [(0, import_react45.offset)(5), (0, import_react45.flip)({ fallbackAxisSideDirection: "end" }), (0, import_react45.shift)({ padding: 5 })],
|
|
8173
|
+
whileElementsMounted: import_react45.autoUpdate
|
|
7799
8174
|
});
|
|
7800
|
-
const click = (0,
|
|
7801
|
-
const dismiss = (0,
|
|
7802
|
-
const role = (0,
|
|
7803
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
8175
|
+
const click = (0, import_react45.useClick)(context);
|
|
8176
|
+
const dismiss = (0, import_react45.useDismiss)(context);
|
|
8177
|
+
const role = (0, import_react45.useRole)(context);
|
|
8178
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react45.useInteractions)([click, dismiss, role]);
|
|
7804
8179
|
const defaultAttributeMappings = {
|
|
7805
8180
|
picture: ["profile", "profileUrl", "picture", "URL"],
|
|
7806
8181
|
firstName: ["name.givenName", "given_name"],
|
|
@@ -7831,14 +8206,14 @@ var BaseUserDropdown = ({
|
|
|
7831
8206
|
defaultMenuItems.push({
|
|
7832
8207
|
label: "Manage Profile",
|
|
7833
8208
|
onClick: onManageProfile,
|
|
7834
|
-
icon: /* @__PURE__ */ (0,
|
|
8209
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(User_default2, { width: "16", height: "16" })
|
|
7835
8210
|
});
|
|
7836
8211
|
}
|
|
7837
8212
|
if (onSignOut) {
|
|
7838
8213
|
defaultMenuItems.push({
|
|
7839
8214
|
label: "Sign Out",
|
|
7840
8215
|
onClick: onSignOut,
|
|
7841
|
-
icon: /* @__PURE__ */ (0,
|
|
8216
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(LogOut_default, { width: "16", height: "16" })
|
|
7842
8217
|
});
|
|
7843
8218
|
}
|
|
7844
8219
|
const allMenuItems = [...menuItems];
|
|
@@ -7848,19 +8223,19 @@ var BaseUserDropdown = ({
|
|
|
7848
8223
|
}
|
|
7849
8224
|
allMenuItems.push(...defaultMenuItems);
|
|
7850
8225
|
}
|
|
7851
|
-
return /* @__PURE__ */ (0,
|
|
7852
|
-
/* @__PURE__ */ (0,
|
|
8226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: (0, import_clsx21.default)((0, import_browser54.withVendorCSSClassPrefix)("user-dropdown"), className), children: [
|
|
8227
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
7853
8228
|
Button_default,
|
|
7854
8229
|
{
|
|
7855
8230
|
ref: refs.setReference,
|
|
7856
|
-
className: (0,
|
|
8231
|
+
className: (0, import_browser54.withVendorCSSClassPrefix)("user-dropdown__trigger"),
|
|
7857
8232
|
style: styles.trigger,
|
|
7858
8233
|
color: "tertiary",
|
|
7859
8234
|
variant: "text",
|
|
7860
8235
|
size: "medium",
|
|
7861
8236
|
...getReferenceProps(),
|
|
7862
8237
|
children: [
|
|
7863
|
-
/* @__PURE__ */ (0,
|
|
8238
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
7864
8239
|
Avatar,
|
|
7865
8240
|
{
|
|
7866
8241
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -7869,11 +8244,11 @@ var BaseUserDropdown = ({
|
|
|
7869
8244
|
alt: `${getDisplayName()}'s avatar`
|
|
7870
8245
|
}
|
|
7871
8246
|
),
|
|
7872
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
8247
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
7873
8248
|
Typography_default,
|
|
7874
8249
|
{
|
|
7875
8250
|
variant: "body2",
|
|
7876
|
-
className: (0,
|
|
8251
|
+
className: (0, import_browser54.withVendorCSSClassPrefix)("user-dropdown__trigger-label"),
|
|
7877
8252
|
style: styles.userName,
|
|
7878
8253
|
children: getDisplayName()
|
|
7879
8254
|
}
|
|
@@ -7881,16 +8256,16 @@ var BaseUserDropdown = ({
|
|
|
7881
8256
|
]
|
|
7882
8257
|
}
|
|
7883
8258
|
),
|
|
7884
|
-
isOpen && /* @__PURE__ */ (0,
|
|
8259
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react45.FloatingPortal, { id: portalId, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react45.FloatingFocusManager, { context, modal: false, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
7885
8260
|
"div",
|
|
7886
8261
|
{
|
|
7887
8262
|
ref: refs.setFloating,
|
|
7888
|
-
className: (0,
|
|
8263
|
+
className: (0, import_browser54.withVendorCSSClassPrefix)("user-dropdown__content"),
|
|
7889
8264
|
style: { ...floatingStyles, ...styles.dropdownContent },
|
|
7890
8265
|
...getFloatingProps(),
|
|
7891
8266
|
children: [
|
|
7892
|
-
/* @__PURE__ */ (0,
|
|
7893
|
-
/* @__PURE__ */ (0,
|
|
8267
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: (0, import_browser54.withVendorCSSClassPrefix)("user-dropdown__header"), style: styles.dropdownHeader, children: [
|
|
8268
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
7894
8269
|
Avatar,
|
|
7895
8270
|
{
|
|
7896
8271
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -7899,22 +8274,22 @@ var BaseUserDropdown = ({
|
|
|
7899
8274
|
alt: `${getDisplayName()}'s avatar`
|
|
7900
8275
|
}
|
|
7901
8276
|
),
|
|
7902
|
-
/* @__PURE__ */ (0,
|
|
7903
|
-
/* @__PURE__ */ (0,
|
|
8277
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: (0, import_browser54.withVendorCSSClassPrefix)("user-dropdown__header-info"), style: styles.headerInfo, children: [
|
|
8278
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
7904
8279
|
Typography_default,
|
|
7905
8280
|
{
|
|
7906
8281
|
noWrap: true,
|
|
7907
|
-
className: (0,
|
|
8282
|
+
className: (0, import_browser54.withVendorCSSClassPrefix)("user-dropdown__header-name"),
|
|
7908
8283
|
variant: "body1",
|
|
7909
8284
|
fontWeight: "medium",
|
|
7910
8285
|
children: getDisplayName()
|
|
7911
8286
|
}
|
|
7912
8287
|
),
|
|
7913
|
-
/* @__PURE__ */ (0,
|
|
8288
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
7914
8289
|
Typography_default,
|
|
7915
8290
|
{
|
|
7916
8291
|
noWrap: true,
|
|
7917
|
-
className: (0,
|
|
8292
|
+
className: (0, import_browser54.withVendorCSSClassPrefix)("user-dropdown__header-email"),
|
|
7918
8293
|
variant: "caption",
|
|
7919
8294
|
color: "secondary",
|
|
7920
8295
|
children: getMappedUserProfileValue_default("username", mergedMappings, user) || getMappedUserProfileValue_default("email", mergedMappings, user)
|
|
@@ -7922,10 +8297,10 @@ var BaseUserDropdown = ({
|
|
|
7922
8297
|
)
|
|
7923
8298
|
] })
|
|
7924
8299
|
] }),
|
|
7925
|
-
/* @__PURE__ */ (0,
|
|
8300
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: (0, import_browser54.withVendorCSSClassPrefix)("user-dropdown__menu"), style: styles.dropdownMenu, children: allMenuItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { children: item.label === "" ? (
|
|
7926
8301
|
// Render divider for empty label placeholder
|
|
7927
|
-
/* @__PURE__ */ (0,
|
|
7928
|
-
) : item.href ? /* @__PURE__ */ (0,
|
|
8302
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: (0, import_browser54.withVendorCSSClassPrefix)("user-dropdown__menu-divider"), style: styles.divider })
|
|
8303
|
+
) : item.href ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
7929
8304
|
"a",
|
|
7930
8305
|
{
|
|
7931
8306
|
href: item.href,
|
|
@@ -7933,17 +8308,17 @@ var BaseUserDropdown = ({
|
|
|
7933
8308
|
...styles.menuItemAnchor,
|
|
7934
8309
|
backgroundColor: hoveredItemIndex === index ? hoverBackgroundColor : "transparent"
|
|
7935
8310
|
},
|
|
7936
|
-
className: (0,
|
|
8311
|
+
className: (0, import_browser54.withVendorCSSClassPrefix)("user-dropdown__menu-item"),
|
|
7937
8312
|
onMouseEnter: () => setHoveredItemIndex(index),
|
|
7938
8313
|
onMouseLeave: () => setHoveredItemIndex(null),
|
|
7939
8314
|
onFocus: () => setHoveredItemIndex(index),
|
|
7940
8315
|
onBlur: () => setHoveredItemIndex(null),
|
|
7941
8316
|
children: [
|
|
7942
8317
|
item.icon,
|
|
7943
|
-
/* @__PURE__ */ (0,
|
|
8318
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { children: item.label })
|
|
7944
8319
|
]
|
|
7945
8320
|
}
|
|
7946
|
-
) : /* @__PURE__ */ (0,
|
|
8321
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
7947
8322
|
Button_default,
|
|
7948
8323
|
{
|
|
7949
8324
|
onClick: () => handleMenuItemClick(item),
|
|
@@ -7951,7 +8326,7 @@ var BaseUserDropdown = ({
|
|
|
7951
8326
|
...styles.menuItem,
|
|
7952
8327
|
backgroundColor: hoveredItemIndex === index ? hoverBackgroundColor : "transparent"
|
|
7953
8328
|
},
|
|
7954
|
-
className: (0,
|
|
8329
|
+
className: (0, import_browser54.withVendorCSSClassPrefix)("user-dropdown__menu-item"),
|
|
7955
8330
|
color: "tertiary",
|
|
7956
8331
|
variant: "text",
|
|
7957
8332
|
size: "small",
|
|
@@ -7969,8 +8344,8 @@ var BaseUserDropdown = ({
|
|
|
7969
8344
|
var BaseUserDropdown_default = BaseUserDropdown;
|
|
7970
8345
|
|
|
7971
8346
|
// src/components/presentation/UserDropdown/UserDropdown.tsx
|
|
7972
|
-
var
|
|
7973
|
-
var
|
|
8347
|
+
var import_react47 = require("react");
|
|
8348
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
7974
8349
|
var UserDropdown = ({
|
|
7975
8350
|
children,
|
|
7976
8351
|
renderTrigger,
|
|
@@ -7979,7 +8354,7 @@ var UserDropdown = ({
|
|
|
7979
8354
|
...rest
|
|
7980
8355
|
}) => {
|
|
7981
8356
|
const { user, isLoading, signOut } = useAsgardeo_default();
|
|
7982
|
-
const [isProfileOpen, setIsProfileOpen] = (0,
|
|
8357
|
+
const [isProfileOpen, setIsProfileOpen] = (0, import_react47.useState)(false);
|
|
7983
8358
|
const handleManageProfile = () => {
|
|
7984
8359
|
setIsProfileOpen(true);
|
|
7985
8360
|
};
|
|
@@ -7999,14 +8374,14 @@ var UserDropdown = ({
|
|
|
7999
8374
|
closeProfile
|
|
8000
8375
|
};
|
|
8001
8376
|
if (children) {
|
|
8002
|
-
return /* @__PURE__ */ (0,
|
|
8377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
8003
8378
|
children(renderProps),
|
|
8004
|
-
/* @__PURE__ */ (0,
|
|
8379
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
8005
8380
|
] });
|
|
8006
8381
|
}
|
|
8007
8382
|
if (renderTrigger || renderDropdown) {
|
|
8008
|
-
return /* @__PURE__ */ (0,
|
|
8009
|
-
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */ (0,
|
|
8383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
8384
|
+
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
8010
8385
|
BaseUserDropdown_default,
|
|
8011
8386
|
{
|
|
8012
8387
|
user,
|
|
@@ -8016,11 +8391,11 @@ var UserDropdown = ({
|
|
|
8016
8391
|
...rest
|
|
8017
8392
|
}
|
|
8018
8393
|
),
|
|
8019
|
-
/* @__PURE__ */ (0,
|
|
8394
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
8020
8395
|
] });
|
|
8021
8396
|
}
|
|
8022
|
-
return /* @__PURE__ */ (0,
|
|
8023
|
-
/* @__PURE__ */ (0,
|
|
8397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
8398
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
8024
8399
|
BaseUserDropdown_default,
|
|
8025
8400
|
{
|
|
8026
8401
|
user,
|
|
@@ -8030,21 +8405,21 @@ var UserDropdown = ({
|
|
|
8030
8405
|
...rest
|
|
8031
8406
|
}
|
|
8032
8407
|
),
|
|
8033
|
-
isProfileOpen && /* @__PURE__ */ (0,
|
|
8408
|
+
isProfileOpen && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
8034
8409
|
] });
|
|
8035
8410
|
};
|
|
8036
8411
|
var UserDropdown_default = UserDropdown;
|
|
8037
8412
|
|
|
8038
8413
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx
|
|
8039
|
-
var
|
|
8040
|
-
var
|
|
8041
|
-
var
|
|
8042
|
-
var
|
|
8414
|
+
var import_browser55 = require("@asgardeo/browser");
|
|
8415
|
+
var import_react48 = require("@floating-ui/react");
|
|
8416
|
+
var import_clsx22 = __toESM(require("clsx"), 1);
|
|
8417
|
+
var import_react49 = require("react");
|
|
8043
8418
|
|
|
8044
8419
|
// src/components/primitives/Icons/Building.tsx
|
|
8045
|
-
var
|
|
8046
|
-
var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
8047
|
-
/* @__PURE__ */ (0,
|
|
8420
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
8421
|
+
var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
8422
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
8048
8423
|
"path",
|
|
8049
8424
|
{
|
|
8050
8425
|
d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",
|
|
@@ -8054,33 +8429,33 @@ var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PU
|
|
|
8054
8429
|
strokeLinejoin: "round"
|
|
8055
8430
|
}
|
|
8056
8431
|
),
|
|
8057
|
-
/* @__PURE__ */ (0,
|
|
8058
|
-
/* @__PURE__ */ (0,
|
|
8059
|
-
/* @__PURE__ */ (0,
|
|
8060
|
-
/* @__PURE__ */ (0,
|
|
8061
|
-
/* @__PURE__ */ (0,
|
|
8062
|
-
/* @__PURE__ */ (0,
|
|
8432
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("path", { d: "M6 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
8433
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("path", { d: "M6 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
8434
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("path", { d: "M14 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
8435
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("path", { d: "M14 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
8436
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("path", { d: "M6 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
8437
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("path", { d: "M14 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
8063
8438
|
] });
|
|
8064
8439
|
Building.displayName = "Building";
|
|
8065
8440
|
var Building_default = Building;
|
|
8066
8441
|
|
|
8067
8442
|
// src/components/primitives/Icons/Check.tsx
|
|
8068
|
-
var
|
|
8069
|
-
var Check = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
8443
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
8444
|
+
var Check = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("path", { d: "M20 6 9 17l-5-5", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
8070
8445
|
Check.displayName = "Check";
|
|
8071
8446
|
var Check_default = Check;
|
|
8072
8447
|
|
|
8073
8448
|
// src/components/primitives/Icons/ChevronDown.tsx
|
|
8074
|
-
var
|
|
8075
|
-
var ChevronDown = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
8449
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
8450
|
+
var ChevronDown = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("path", { d: "m6 9 6 6 6-6", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
8076
8451
|
ChevronDown.displayName = "ChevronDown";
|
|
8077
8452
|
var ChevronDown_default = ChevronDown;
|
|
8078
8453
|
|
|
8079
8454
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx
|
|
8080
|
-
var
|
|
8081
|
-
var
|
|
8455
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
8456
|
+
var useStyles7 = () => {
|
|
8082
8457
|
const { theme, colorScheme } = useTheme_default();
|
|
8083
|
-
return (0,
|
|
8458
|
+
return (0, import_react49.useMemo)(
|
|
8084
8459
|
() => ({
|
|
8085
8460
|
trigger: {
|
|
8086
8461
|
display: "inline-flex",
|
|
@@ -8236,23 +8611,23 @@ var BaseOrganizationSwitcher = ({
|
|
|
8236
8611
|
avatarSize = 24,
|
|
8237
8612
|
fallback = null
|
|
8238
8613
|
}) => {
|
|
8239
|
-
const styles =
|
|
8240
|
-
const [isOpen, setIsOpen] = (0,
|
|
8241
|
-
const [hoveredItemIndex, setHoveredItemIndex] = (0,
|
|
8614
|
+
const styles = useStyles7();
|
|
8615
|
+
const [isOpen, setIsOpen] = (0, import_react49.useState)(false);
|
|
8616
|
+
const [hoveredItemIndex, setHoveredItemIndex] = (0, import_react49.useState)(null);
|
|
8242
8617
|
const { theme, colorScheme } = useTheme_default();
|
|
8243
8618
|
const { t } = useTranslation_default();
|
|
8244
8619
|
const hoverBackgroundColor = colorScheme === "dark" ? "rgba(255, 255, 255, 0.08)" : "rgba(0, 0, 0, 0.04)";
|
|
8245
|
-
const { refs, floatingStyles, context } = (0,
|
|
8620
|
+
const { refs, floatingStyles, context } = (0, import_react48.useFloating)({
|
|
8246
8621
|
open: isOpen,
|
|
8247
8622
|
onOpenChange: setIsOpen,
|
|
8248
8623
|
placement: "bottom-end",
|
|
8249
|
-
middleware: [(0,
|
|
8250
|
-
whileElementsMounted:
|
|
8624
|
+
middleware: [(0, import_react48.offset)(5), (0, import_react48.flip)({ fallbackAxisSideDirection: "end" }), (0, import_react48.shift)({ padding: 5 })],
|
|
8625
|
+
whileElementsMounted: import_react48.autoUpdate
|
|
8251
8626
|
});
|
|
8252
|
-
const click = (0,
|
|
8253
|
-
const dismiss = (0,
|
|
8254
|
-
const role = (0,
|
|
8255
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
8627
|
+
const click = (0, import_react48.useClick)(context);
|
|
8628
|
+
const dismiss = (0, import_react48.useDismiss)(context);
|
|
8629
|
+
const role = (0, import_react48.useRole)(context);
|
|
8630
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react48.useInteractions)([click, dismiss, role]);
|
|
8256
8631
|
if (fallback && !currentOrganization && !loading && organizations.length === 0) {
|
|
8257
8632
|
return fallback;
|
|
8258
8633
|
}
|
|
@@ -8269,8 +8644,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
8269
8644
|
const switchableOrganizations = organizations.filter(
|
|
8270
8645
|
(org) => org.id !== currentOrganization?.id
|
|
8271
8646
|
);
|
|
8272
|
-
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */ (0,
|
|
8273
|
-
/* @__PURE__ */ (0,
|
|
8647
|
+
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
|
|
8648
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
8274
8649
|
Avatar,
|
|
8275
8650
|
{
|
|
8276
8651
|
variant: "square",
|
|
@@ -8280,36 +8655,36 @@ var BaseOrganizationSwitcher = ({
|
|
|
8280
8655
|
alt: `${organization.name} avatar`
|
|
8281
8656
|
}
|
|
8282
8657
|
),
|
|
8283
|
-
/* @__PURE__ */ (0,
|
|
8284
|
-
/* @__PURE__ */ (0,
|
|
8285
|
-
/* @__PURE__ */ (0,
|
|
8286
|
-
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
8658
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { style: styles.organizationInfo, children: [
|
|
8659
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Typography_default, { variant: "body2", fontWeight: "medium", style: styles.organizationName, children: organization.name }),
|
|
8660
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { style: styles.organizationMeta, children: [
|
|
8661
|
+
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { children: [
|
|
8287
8662
|
organization.memberCount,
|
|
8288
8663
|
" ",
|
|
8289
8664
|
organization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members")
|
|
8290
8665
|
] }),
|
|
8291
|
-
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
8292
|
-
showRole && organization.role && /* @__PURE__ */ (0,
|
|
8666
|
+
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { children: " \u2022 " }),
|
|
8667
|
+
showRole && organization.role && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { style: styles.roleCapitalized, children: organization.role })
|
|
8293
8668
|
] })
|
|
8294
8669
|
] }),
|
|
8295
|
-
isSelected && /* @__PURE__ */ (0,
|
|
8670
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Check_default, { width: "16", height: "16", color: theme.colors.text.primary })
|
|
8296
8671
|
] });
|
|
8297
|
-
const defaultRenderLoading2 = () => /* @__PURE__ */ (0,
|
|
8298
|
-
const defaultRenderError2 = (errorMessage) => /* @__PURE__ */ (0,
|
|
8299
|
-
return /* @__PURE__ */ (0,
|
|
8300
|
-
/* @__PURE__ */ (0,
|
|
8672
|
+
const defaultRenderLoading2 = () => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { style: styles.loadingContainer, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Typography_default, { variant: "caption", style: styles.loadingText, children: t("organization.switcher.loading.organizations") }) });
|
|
8673
|
+
const defaultRenderError2 = (errorMessage) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { style: styles.errorContainer, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Typography_default, { variant: "caption", style: styles.errorText, children: errorMessage }) });
|
|
8674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: (0, import_clsx22.default)((0, import_browser55.withVendorCSSClassPrefix)("organization-switcher"), className), style, children: [
|
|
8675
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
8301
8676
|
Button_default,
|
|
8302
8677
|
{
|
|
8303
8678
|
ref: refs.setReference,
|
|
8304
|
-
className: (0,
|
|
8679
|
+
className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__trigger"),
|
|
8305
8680
|
style: styles.trigger,
|
|
8306
8681
|
color: "tertiary",
|
|
8307
8682
|
variant: "outline",
|
|
8308
8683
|
size: "medium",
|
|
8309
8684
|
...getReferenceProps(),
|
|
8310
8685
|
children: [
|
|
8311
|
-
currentOrganization ? /* @__PURE__ */ (0,
|
|
8312
|
-
/* @__PURE__ */ (0,
|
|
8686
|
+
currentOrganization ? /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
|
|
8687
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
8313
8688
|
Avatar,
|
|
8314
8689
|
{
|
|
8315
8690
|
variant: "square",
|
|
@@ -8319,46 +8694,46 @@ var BaseOrganizationSwitcher = ({
|
|
|
8319
8694
|
alt: `${currentOrganization.name} avatar`
|
|
8320
8695
|
}
|
|
8321
8696
|
),
|
|
8322
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
8697
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
8323
8698
|
Typography_default,
|
|
8324
8699
|
{
|
|
8325
8700
|
variant: "body2",
|
|
8326
|
-
className: (0,
|
|
8701
|
+
className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__trigger-label"),
|
|
8327
8702
|
style: styles.orgName,
|
|
8328
8703
|
children: currentOrganization.name
|
|
8329
8704
|
}
|
|
8330
8705
|
)
|
|
8331
|
-
] }) : /* @__PURE__ */ (0,
|
|
8332
|
-
/* @__PURE__ */ (0,
|
|
8333
|
-
showTriggerLabel && /* @__PURE__ */ (0,
|
|
8706
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
|
|
8707
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Building_default, { width: avatarSize, height: avatarSize }),
|
|
8708
|
+
showTriggerLabel && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
8334
8709
|
Typography_default,
|
|
8335
8710
|
{
|
|
8336
8711
|
variant: "body2",
|
|
8337
|
-
className: (0,
|
|
8712
|
+
className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__trigger-label"),
|
|
8338
8713
|
style: styles.orgName,
|
|
8339
8714
|
children: t("organization.switcher.select.organization")
|
|
8340
8715
|
}
|
|
8341
8716
|
)
|
|
8342
8717
|
] }),
|
|
8343
|
-
/* @__PURE__ */ (0,
|
|
8718
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ChevronDown_default, { width: "16", height: "16" })
|
|
8344
8719
|
]
|
|
8345
8720
|
}
|
|
8346
8721
|
),
|
|
8347
|
-
isOpen && /* @__PURE__ */ (0,
|
|
8722
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react48.FloatingPortal, { id: portalId, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react48.FloatingFocusManager, { context, modal: false, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
8348
8723
|
"div",
|
|
8349
8724
|
{
|
|
8350
8725
|
ref: refs.setFloating,
|
|
8351
|
-
className: (0,
|
|
8726
|
+
className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__content"),
|
|
8352
8727
|
style: { ...floatingStyles, ...styles.dropdownContent },
|
|
8353
8728
|
...getFloatingProps(),
|
|
8354
8729
|
children: [
|
|
8355
|
-
currentOrganization && /* @__PURE__ */ (0,
|
|
8730
|
+
currentOrganization && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
8356
8731
|
"div",
|
|
8357
8732
|
{
|
|
8358
|
-
className: (0,
|
|
8733
|
+
className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__header"),
|
|
8359
8734
|
style: styles.dropdownHeader,
|
|
8360
8735
|
children: [
|
|
8361
|
-
/* @__PURE__ */ (0,
|
|
8736
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
8362
8737
|
Avatar,
|
|
8363
8738
|
{
|
|
8364
8739
|
variant: "square",
|
|
@@ -8368,47 +8743,47 @@ var BaseOrganizationSwitcher = ({
|
|
|
8368
8743
|
alt: `${currentOrganization.name} avatar`
|
|
8369
8744
|
}
|
|
8370
8745
|
),
|
|
8371
|
-
/* @__PURE__ */ (0,
|
|
8746
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
8372
8747
|
"div",
|
|
8373
8748
|
{
|
|
8374
|
-
className: (0,
|
|
8749
|
+
className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__header-info"),
|
|
8375
8750
|
style: styles.organizationInfo,
|
|
8376
8751
|
children: [
|
|
8377
|
-
/* @__PURE__ */ (0,
|
|
8752
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
8378
8753
|
Typography_default,
|
|
8379
8754
|
{
|
|
8380
8755
|
noWrap: true,
|
|
8381
|
-
className: (0,
|
|
8756
|
+
className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__header-name"),
|
|
8382
8757
|
variant: "body1",
|
|
8383
8758
|
fontWeight: "medium",
|
|
8384
8759
|
style: styles.organizationName,
|
|
8385
8760
|
children: currentOrganization.name
|
|
8386
8761
|
}
|
|
8387
8762
|
),
|
|
8388
|
-
/* @__PURE__ */ (0,
|
|
8389
|
-
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */ (0,
|
|
8763
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { style: styles.organizationMeta, children: [
|
|
8764
|
+
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
8390
8765
|
Typography_default,
|
|
8391
8766
|
{
|
|
8392
8767
|
noWrap: true,
|
|
8393
|
-
className: (0,
|
|
8768
|
+
className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__header-meta"),
|
|
8394
8769
|
variant: "caption",
|
|
8395
8770
|
color: "secondary",
|
|
8396
8771
|
children: [
|
|
8397
8772
|
currentOrganization.memberCount,
|
|
8398
8773
|
" ",
|
|
8399
8774
|
currentOrganization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members"),
|
|
8400
|
-
showRole && currentOrganization.role && /* @__PURE__ */ (0,
|
|
8775
|
+
showRole && currentOrganization.role && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { children: [
|
|
8401
8776
|
" \u2022 ",
|
|
8402
8777
|
currentOrganization.role
|
|
8403
8778
|
] })
|
|
8404
8779
|
]
|
|
8405
8780
|
}
|
|
8406
8781
|
),
|
|
8407
|
-
showRole && currentOrganization.role && (!showMemberCount || currentOrganization.memberCount === void 0) && /* @__PURE__ */ (0,
|
|
8782
|
+
showRole && currentOrganization.role && (!showMemberCount || currentOrganization.memberCount === void 0) && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
8408
8783
|
Typography_default,
|
|
8409
8784
|
{
|
|
8410
8785
|
noWrap: true,
|
|
8411
|
-
className: (0,
|
|
8786
|
+
className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__header-role"),
|
|
8412
8787
|
variant: "caption",
|
|
8413
8788
|
color: "secondary",
|
|
8414
8789
|
style: styles.roleCapitalized,
|
|
@@ -8419,7 +8794,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
8419
8794
|
]
|
|
8420
8795
|
}
|
|
8421
8796
|
),
|
|
8422
|
-
onManageProfile && /* @__PURE__ */ (0,
|
|
8797
|
+
onManageProfile && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
8423
8798
|
Button_default,
|
|
8424
8799
|
{
|
|
8425
8800
|
onClick: onManageProfile,
|
|
@@ -8428,7 +8803,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
8428
8803
|
size: "small",
|
|
8429
8804
|
"aria-label": "Manage Organization Profile",
|
|
8430
8805
|
style: styles.manageButton,
|
|
8431
|
-
endIcon: /* @__PURE__ */ (0,
|
|
8806
|
+
endIcon: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
8432
8807
|
"svg",
|
|
8433
8808
|
{
|
|
8434
8809
|
width: "16",
|
|
@@ -8440,8 +8815,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
8440
8815
|
strokeLinecap: "round",
|
|
8441
8816
|
strokeLinejoin: "round",
|
|
8442
8817
|
children: [
|
|
8443
|
-
/* @__PURE__ */ (0,
|
|
8444
|
-
/* @__PURE__ */ (0,
|
|
8818
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("circle", { cx: "12", cy: "12", r: "3" }),
|
|
8819
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1 1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" })
|
|
8445
8820
|
]
|
|
8446
8821
|
}
|
|
8447
8822
|
),
|
|
@@ -8451,7 +8826,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
8451
8826
|
]
|
|
8452
8827
|
}
|
|
8453
8828
|
),
|
|
8454
|
-
organizations.length > 1 && /* @__PURE__ */ (0,
|
|
8829
|
+
organizations.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
8455
8830
|
"div",
|
|
8456
8831
|
{
|
|
8457
8832
|
style: {
|
|
@@ -8459,17 +8834,17 @@ var BaseOrganizationSwitcher = ({
|
|
|
8459
8834
|
...styles.sectionHeaderContainer,
|
|
8460
8835
|
borderTop: currentOrganization ? `1px solid ${theme.colors.border}` : "none"
|
|
8461
8836
|
},
|
|
8462
|
-
children: /* @__PURE__ */ (0,
|
|
8837
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Typography_default, { variant: "caption", fontWeight: 600, style: styles.sectionHeader, children: t("organization.switcher.switch.organization") })
|
|
8463
8838
|
}
|
|
8464
8839
|
),
|
|
8465
|
-
/* @__PURE__ */ (0,
|
|
8840
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__menu"), style: styles.dropdownMenu, children: loading ? renderLoading ? renderLoading() : defaultRenderLoading2() : error ? renderError ? renderError(error) : defaultRenderError2(error) : /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
|
|
8466
8841
|
switchableOrganizations.map((organization) => {
|
|
8467
8842
|
const isSelected = false;
|
|
8468
|
-
return /* @__PURE__ */ (0,
|
|
8843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
8469
8844
|
Button_default,
|
|
8470
8845
|
{
|
|
8471
8846
|
onClick: () => handleOrganizationSwitch(organization),
|
|
8472
|
-
className: (0,
|
|
8847
|
+
className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__menu-item"),
|
|
8473
8848
|
color: "tertiary",
|
|
8474
8849
|
variant: "text",
|
|
8475
8850
|
size: "small",
|
|
@@ -8484,16 +8859,16 @@ var BaseOrganizationSwitcher = ({
|
|
|
8484
8859
|
organization.id
|
|
8485
8860
|
);
|
|
8486
8861
|
}),
|
|
8487
|
-
menuItems.length > 0 && /* @__PURE__ */ (0,
|
|
8488
|
-
/* @__PURE__ */ (0,
|
|
8862
|
+
menuItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
|
|
8863
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
8489
8864
|
"div",
|
|
8490
8865
|
{
|
|
8491
|
-
className: (0,
|
|
8866
|
+
className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__menu-divider"),
|
|
8492
8867
|
style: styles.divider
|
|
8493
8868
|
}
|
|
8494
8869
|
),
|
|
8495
8870
|
menuItems.map(
|
|
8496
|
-
(item, index) => /* @__PURE__ */ (0,
|
|
8871
|
+
(item, index) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { children: item.href ? /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
8497
8872
|
"a",
|
|
8498
8873
|
{
|
|
8499
8874
|
href: item.href,
|
|
@@ -8501,17 +8876,17 @@ var BaseOrganizationSwitcher = ({
|
|
|
8501
8876
|
...styles.menuItem,
|
|
8502
8877
|
backgroundColor: hoveredItemIndex === switchableOrganizations.length + index ? hoverBackgroundColor : "transparent"
|
|
8503
8878
|
},
|
|
8504
|
-
className: (0,
|
|
8879
|
+
className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__menu-item"),
|
|
8505
8880
|
onMouseEnter: () => setHoveredItemIndex(switchableOrganizations.length + index),
|
|
8506
8881
|
onMouseLeave: () => setHoveredItemIndex(null),
|
|
8507
8882
|
onFocus: () => setHoveredItemIndex(switchableOrganizations.length + index),
|
|
8508
8883
|
onBlur: () => setHoveredItemIndex(null),
|
|
8509
8884
|
children: [
|
|
8510
8885
|
item.icon,
|
|
8511
|
-
/* @__PURE__ */ (0,
|
|
8886
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { children: item.label })
|
|
8512
8887
|
]
|
|
8513
8888
|
}
|
|
8514
|
-
) : /* @__PURE__ */ (0,
|
|
8889
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
8515
8890
|
Button_default,
|
|
8516
8891
|
{
|
|
8517
8892
|
onClick: () => handleMenuItemClick(item),
|
|
@@ -8519,7 +8894,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
8519
8894
|
...styles.menuItem,
|
|
8520
8895
|
backgroundColor: hoveredItemIndex === switchableOrganizations.length + index ? hoverBackgroundColor : "transparent"
|
|
8521
8896
|
},
|
|
8522
|
-
className: (0,
|
|
8897
|
+
className: (0, import_browser55.withVendorCSSClassPrefix)("organization-switcher__menu-item"),
|
|
8523
8898
|
color: "tertiary",
|
|
8524
8899
|
variant: "text",
|
|
8525
8900
|
size: "small",
|
|
@@ -8540,19 +8915,19 @@ var BaseOrganizationSwitcher = ({
|
|
|
8540
8915
|
var BaseOrganizationSwitcher_default = BaseOrganizationSwitcher;
|
|
8541
8916
|
|
|
8542
8917
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
8543
|
-
var
|
|
8918
|
+
var import_react57 = require("react");
|
|
8544
8919
|
|
|
8545
8920
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
8546
|
-
var
|
|
8921
|
+
var import_react51 = require("react");
|
|
8547
8922
|
|
|
8548
8923
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
8549
|
-
var
|
|
8550
|
-
var
|
|
8551
|
-
var
|
|
8552
|
-
var
|
|
8553
|
-
var
|
|
8924
|
+
var import_browser56 = require("@asgardeo/browser");
|
|
8925
|
+
var import_clsx23 = __toESM(require("clsx"), 1);
|
|
8926
|
+
var import_react50 = require("react");
|
|
8927
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
8928
|
+
var useStyles8 = () => {
|
|
8554
8929
|
const { theme, colorScheme } = useTheme_default();
|
|
8555
|
-
return (0,
|
|
8930
|
+
return (0, import_react50.useMemo)(
|
|
8556
8931
|
() => ({
|
|
8557
8932
|
root: {
|
|
8558
8933
|
padding: `${theme.spacing.unit * 4}px`,
|
|
@@ -8661,16 +9036,16 @@ var BaseCreateOrganization = ({
|
|
|
8661
9036
|
style,
|
|
8662
9037
|
title = "Create Organization"
|
|
8663
9038
|
}) => {
|
|
8664
|
-
const styles =
|
|
9039
|
+
const styles = useStyles8();
|
|
8665
9040
|
const { theme } = useTheme_default();
|
|
8666
9041
|
const { t } = useTranslation_default();
|
|
8667
|
-
const [formData, setFormData] = (0,
|
|
9042
|
+
const [formData, setFormData] = (0, import_react50.useState)({
|
|
8668
9043
|
description: "",
|
|
8669
9044
|
handle: "",
|
|
8670
9045
|
name: "",
|
|
8671
9046
|
...initialValues
|
|
8672
9047
|
});
|
|
8673
|
-
const [formErrors, setFormErrors] = (0,
|
|
9048
|
+
const [formErrors, setFormErrors] = (0, import_react50.useState)({});
|
|
8674
9049
|
const validateForm = () => {
|
|
8675
9050
|
const errors = {};
|
|
8676
9051
|
if (!formData.name.trim()) {
|
|
@@ -8734,21 +9109,21 @@ var BaseCreateOrganization = ({
|
|
|
8734
9109
|
...styles.root,
|
|
8735
9110
|
...cardLayout ? styles.card : {}
|
|
8736
9111
|
};
|
|
8737
|
-
const createOrganizationContent = /* @__PURE__ */ (0,
|
|
9112
|
+
const createOrganizationContent = /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
8738
9113
|
"div",
|
|
8739
9114
|
{
|
|
8740
|
-
className: (0,
|
|
9115
|
+
className: (0, import_clsx23.default)((0, import_browser56.withVendorCSSClassPrefix)("create-organization"), className),
|
|
8741
9116
|
style: { ...containerStyle, ...style },
|
|
8742
|
-
children: /* @__PURE__ */ (0,
|
|
8743
|
-
/* @__PURE__ */ (0,
|
|
9117
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: (0, import_browser56.withVendorCSSClassPrefix)("create-organization__content"), style: styles.content, children: [
|
|
9118
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
8744
9119
|
"form",
|
|
8745
9120
|
{
|
|
8746
9121
|
id: "create-organization-form",
|
|
8747
|
-
className: (0,
|
|
9122
|
+
className: (0, import_browser56.withVendorCSSClassPrefix)("create-organization__form"),
|
|
8748
9123
|
style: styles.form,
|
|
8749
9124
|
onSubmit: handleSubmit,
|
|
8750
9125
|
children: [
|
|
8751
|
-
/* @__PURE__ */ (0,
|
|
9126
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: (0, import_browser56.withVendorCSSClassPrefix)("create-organization__field-group"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
8752
9127
|
TextField_default,
|
|
8753
9128
|
{
|
|
8754
9129
|
label: `${t("organization.create.name.label")}`,
|
|
@@ -8758,10 +9133,10 @@ var BaseCreateOrganization = ({
|
|
|
8758
9133
|
disabled: loading,
|
|
8759
9134
|
required: true,
|
|
8760
9135
|
error: formErrors.name,
|
|
8761
|
-
className: (0,
|
|
9136
|
+
className: (0, import_browser56.withVendorCSSClassPrefix)("create-organization__input")
|
|
8762
9137
|
}
|
|
8763
9138
|
) }),
|
|
8764
|
-
/* @__PURE__ */ (0,
|
|
9139
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: (0, import_browser56.withVendorCSSClassPrefix)("create-organization__field-group"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
8765
9140
|
TextField_default,
|
|
8766
9141
|
{
|
|
8767
9142
|
label: `${t("organization.create.handle.label") || "Organization Handle"}`,
|
|
@@ -8772,15 +9147,15 @@ var BaseCreateOrganization = ({
|
|
|
8772
9147
|
required: true,
|
|
8773
9148
|
error: formErrors.handle,
|
|
8774
9149
|
helperText: "This will be your organization's unique identifier. Only lowercase letters, numbers, and hyphens are allowed.",
|
|
8775
|
-
className: (0,
|
|
9150
|
+
className: (0, import_browser56.withVendorCSSClassPrefix)("create-organization__input")
|
|
8776
9151
|
}
|
|
8777
9152
|
) }),
|
|
8778
|
-
/* @__PURE__ */ (0,
|
|
8779
|
-
/* @__PURE__ */ (0,
|
|
8780
|
-
/* @__PURE__ */ (0,
|
|
9153
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: (0, import_browser56.withVendorCSSClassPrefix)("create-organization__field-group"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(FormControl_default, { error: formErrors.description, children: [
|
|
9154
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(InputLabel_default, { required: true, children: t("organization.create.description.label") }),
|
|
9155
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
8781
9156
|
"textarea",
|
|
8782
9157
|
{
|
|
8783
|
-
className: (0,
|
|
9158
|
+
className: (0, import_browser56.withVendorCSSClassPrefix)("create-organization__textarea"),
|
|
8784
9159
|
style: {
|
|
8785
9160
|
...styles.textarea,
|
|
8786
9161
|
borderColor: formErrors.description ? theme.colors.error.main : theme.colors.border
|
|
@@ -8794,29 +9169,29 @@ var BaseCreateOrganization = ({
|
|
|
8794
9169
|
)
|
|
8795
9170
|
] }) }),
|
|
8796
9171
|
renderAdditionalFields && renderAdditionalFields(),
|
|
8797
|
-
error && /* @__PURE__ */ (0,
|
|
9172
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography_default, { variant: "body2", style: { color: theme.colors.error.main, fontSize: "0.875rem" }, children: error })
|
|
8798
9173
|
]
|
|
8799
9174
|
}
|
|
8800
9175
|
),
|
|
8801
|
-
/* @__PURE__ */ (0,
|
|
8802
|
-
onCancel && /* @__PURE__ */ (0,
|
|
8803
|
-
/* @__PURE__ */ (0,
|
|
9176
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: (0, import_browser56.withVendorCSSClassPrefix)("create-organization__actions"), style: styles.actions, children: [
|
|
9177
|
+
onCancel && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Button_default, { type: "button", variant: "outline", onClick: onCancel, disabled: loading, children: t("organization.create.cancel") }),
|
|
9178
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Button_default, { type: "submit", variant: "solid", color: "primary", disabled: loading, form: "create-organization-form", children: loading ? t("organization.create.creating") : t("organization.create.button") })
|
|
8804
9179
|
] })
|
|
8805
9180
|
] })
|
|
8806
9181
|
}
|
|
8807
9182
|
);
|
|
8808
9183
|
if (mode === "popup") {
|
|
8809
|
-
return /* @__PURE__ */ (0,
|
|
8810
|
-
/* @__PURE__ */ (0,
|
|
8811
|
-
/* @__PURE__ */ (0,
|
|
9184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(DialogContent, { children: [
|
|
9185
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(DialogHeading, { children: title }),
|
|
9186
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { style: { padding: "1rem" }, children: createOrganizationContent })
|
|
8812
9187
|
] }) });
|
|
8813
9188
|
}
|
|
8814
9189
|
return createOrganizationContent;
|
|
8815
9190
|
};
|
|
8816
9191
|
|
|
8817
9192
|
// src/api/createOrganization.ts
|
|
8818
|
-
var
|
|
8819
|
-
var httpClient6 =
|
|
9193
|
+
var import_browser57 = require("@asgardeo/browser");
|
|
9194
|
+
var httpClient6 = import_browser57.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser57.AsgardeoSPAClient.getInstance());
|
|
8820
9195
|
var createOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
8821
9196
|
const defaultFetcher = async (url, config) => {
|
|
8822
9197
|
const response = await httpClient6({
|
|
@@ -8833,7 +9208,7 @@ var createOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
8833
9208
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
8834
9209
|
};
|
|
8835
9210
|
};
|
|
8836
|
-
return (0,
|
|
9211
|
+
return (0, import_browser57.createOrganization)({
|
|
8837
9212
|
...requestConfig,
|
|
8838
9213
|
fetcher: fetcher || defaultFetcher
|
|
8839
9214
|
});
|
|
@@ -8841,7 +9216,7 @@ var createOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
8841
9216
|
var createOrganization_default = createOrganization;
|
|
8842
9217
|
|
|
8843
9218
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
8844
|
-
var
|
|
9219
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
8845
9220
|
var CreateOrganization = ({
|
|
8846
9221
|
onCreateOrganization,
|
|
8847
9222
|
fallback = null,
|
|
@@ -8851,13 +9226,13 @@ var CreateOrganization = ({
|
|
|
8851
9226
|
}) => {
|
|
8852
9227
|
const { isSignedIn, baseUrl } = useAsgardeo_default();
|
|
8853
9228
|
const { currentOrganization, revalidateOrganizations } = useOrganization_default();
|
|
8854
|
-
const [loading, setLoading] = (0,
|
|
8855
|
-
const [error, setError] = (0,
|
|
9229
|
+
const [loading, setLoading] = (0, import_react51.useState)(false);
|
|
9230
|
+
const [error, setError] = (0, import_react51.useState)(null);
|
|
8856
9231
|
if (!isSignedIn && fallback) {
|
|
8857
9232
|
return fallback;
|
|
8858
9233
|
}
|
|
8859
9234
|
if (!isSignedIn) {
|
|
8860
|
-
return /* @__PURE__ */ (0,
|
|
9235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_jsx_runtime83.Fragment, {});
|
|
8861
9236
|
}
|
|
8862
9237
|
const parentId = defaultParentId || currentOrganization?.id || "";
|
|
8863
9238
|
const handleSubmit = async (payload) => {
|
|
@@ -8891,7 +9266,7 @@ var CreateOrganization = ({
|
|
|
8891
9266
|
setLoading(false);
|
|
8892
9267
|
}
|
|
8893
9268
|
};
|
|
8894
|
-
return /* @__PURE__ */ (0,
|
|
9269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
8895
9270
|
BaseCreateOrganization,
|
|
8896
9271
|
{
|
|
8897
9272
|
onSubmit: handleSubmit,
|
|
@@ -8905,18 +9280,18 @@ var CreateOrganization = ({
|
|
|
8905
9280
|
};
|
|
8906
9281
|
|
|
8907
9282
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
8908
|
-
var
|
|
9283
|
+
var import_react54 = require("react");
|
|
8909
9284
|
|
|
8910
9285
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
9286
|
+
var import_browser59 = require("@asgardeo/browser");
|
|
9287
|
+
var import_clsx25 = __toESM(require("clsx"), 1);
|
|
9288
|
+
var import_react53 = require("react");
|
|
9289
|
+
|
|
9290
|
+
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
8911
9291
|
var import_browser58 = require("@asgardeo/browser");
|
|
8912
9292
|
var import_clsx24 = __toESM(require("clsx"), 1);
|
|
8913
9293
|
var import_react52 = require("react");
|
|
8914
|
-
|
|
8915
|
-
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
8916
|
-
var import_browser57 = require("@asgardeo/browser");
|
|
8917
|
-
var import_clsx23 = __toESM(require("clsx"), 1);
|
|
8918
|
-
var import_react51 = require("react");
|
|
8919
|
-
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
9294
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
8920
9295
|
var KeyValueInput = ({
|
|
8921
9296
|
className = "",
|
|
8922
9297
|
disabled = false,
|
|
@@ -8938,10 +9313,10 @@ var KeyValueInput = ({
|
|
|
8938
9313
|
}) => {
|
|
8939
9314
|
const { theme } = useTheme_default();
|
|
8940
9315
|
const initialPairs = Array.isArray(value) ? value : Object.entries(value).map(([key, val]) => ({ key, value: String(val) }));
|
|
8941
|
-
const [pairs, setPairs] = (0,
|
|
8942
|
-
const [newKey, setNewKey] = (0,
|
|
8943
|
-
const [newValue, setNewValue] = (0,
|
|
8944
|
-
const handleAddPair = (0,
|
|
9316
|
+
const [pairs, setPairs] = (0, import_react52.useState)(initialPairs);
|
|
9317
|
+
const [newKey, setNewKey] = (0, import_react52.useState)("");
|
|
9318
|
+
const [newValue, setNewValue] = (0, import_react52.useState)("");
|
|
9319
|
+
const handleAddPair = (0, import_react52.useCallback)(() => {
|
|
8945
9320
|
if (!newKey.trim() || !newValue.trim()) return;
|
|
8946
9321
|
if (maxPairs && pairs.length >= maxPairs) return;
|
|
8947
9322
|
const newPair = {
|
|
@@ -8959,7 +9334,7 @@ var KeyValueInput = ({
|
|
|
8959
9334
|
onAdd(newPair);
|
|
8960
9335
|
}
|
|
8961
9336
|
}, [newKey, newValue, pairs, maxPairs, onChange, onAdd]);
|
|
8962
|
-
const handleRemovePair = (0,
|
|
9337
|
+
const handleRemovePair = (0, import_react52.useCallback)(
|
|
8963
9338
|
(index) => {
|
|
8964
9339
|
const pairToRemove = pairs[index];
|
|
8965
9340
|
const updatedPairs = pairs.filter((_, i) => i !== index);
|
|
@@ -8973,7 +9348,7 @@ var KeyValueInput = ({
|
|
|
8973
9348
|
},
|
|
8974
9349
|
[pairs, onChange, onRemove]
|
|
8975
9350
|
);
|
|
8976
|
-
const handleUpdatePair = (0,
|
|
9351
|
+
const handleUpdatePair = (0, import_react52.useCallback)(
|
|
8977
9352
|
(index, field, newVal) => {
|
|
8978
9353
|
const updatedPairs = pairs.map((pair, i) => {
|
|
8979
9354
|
if (i === index) {
|
|
@@ -9100,20 +9475,20 @@ var KeyValueInput = ({
|
|
|
9100
9475
|
flex: 1
|
|
9101
9476
|
}
|
|
9102
9477
|
};
|
|
9103
|
-
return /* @__PURE__ */ (0,
|
|
9104
|
-
label && /* @__PURE__ */ (0,
|
|
9478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: (0, import_clsx24.default)((0, import_browser58.withVendorCSSClassPrefix)("key-value-input"), className), style: styles.container, children: [
|
|
9479
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("label", { style: styles.label, children: [
|
|
9105
9480
|
label,
|
|
9106
|
-
required && /* @__PURE__ */ (0,
|
|
9481
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { style: { color: theme.colors.error.main }, children: " *" })
|
|
9107
9482
|
] }),
|
|
9108
|
-
/* @__PURE__ */ (0,
|
|
9109
|
-
pairs.length === 0 && readOnly ? /* @__PURE__ */ (0,
|
|
9110
|
-
/* @__PURE__ */ (0,
|
|
9483
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { style: styles.pairsList, children: [
|
|
9484
|
+
pairs.length === 0 && readOnly ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { style: styles.emptyState, children: "No attributes defined" }) : readOnly ? pairs.map((pair, index) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { style: styles.readOnlyPair, children: [
|
|
9485
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("span", { style: styles.readOnlyKey, children: [
|
|
9111
9486
|
pair.key,
|
|
9112
9487
|
":"
|
|
9113
9488
|
] }),
|
|
9114
|
-
/* @__PURE__ */ (0,
|
|
9115
|
-
] }, `${pair.key}-${index}`)) : pairs.map((pair, index) => /* @__PURE__ */ (0,
|
|
9116
|
-
/* @__PURE__ */ (0,
|
|
9489
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { style: styles.readOnlyValue, children: pair.value })
|
|
9490
|
+
] }, `${pair.key}-${index}`)) : pairs.map((pair, index) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { style: styles.pairRow, children: [
|
|
9491
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
9117
9492
|
TextField_default,
|
|
9118
9493
|
{
|
|
9119
9494
|
placeholder: keyPlaceholder,
|
|
@@ -9124,7 +9499,7 @@ var KeyValueInput = ({
|
|
|
9124
9499
|
"aria-label": `${keyLabel} ${index + 1}`
|
|
9125
9500
|
}
|
|
9126
9501
|
),
|
|
9127
|
-
/* @__PURE__ */ (0,
|
|
9502
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
9128
9503
|
TextField_default,
|
|
9129
9504
|
{
|
|
9130
9505
|
placeholder: valuePlaceholder,
|
|
@@ -9135,7 +9510,7 @@ var KeyValueInput = ({
|
|
|
9135
9510
|
"aria-label": `${valueLabel} ${index + 1}`
|
|
9136
9511
|
}
|
|
9137
9512
|
),
|
|
9138
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
9513
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
9139
9514
|
Button_default,
|
|
9140
9515
|
{
|
|
9141
9516
|
variant: "outline",
|
|
@@ -9144,12 +9519,12 @@ var KeyValueInput = ({
|
|
|
9144
9519
|
disabled,
|
|
9145
9520
|
style: styles.removeButton,
|
|
9146
9521
|
"aria-label": `${removeButtonText} ${pair.key}`,
|
|
9147
|
-
children: /* @__PURE__ */ (0,
|
|
9522
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(X_default, { width: 16, height: 16 })
|
|
9148
9523
|
}
|
|
9149
9524
|
)
|
|
9150
9525
|
] }, `${pair.key}-${index}`)),
|
|
9151
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
9152
|
-
/* @__PURE__ */ (0,
|
|
9526
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { style: styles.addRow, children: [
|
|
9527
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
9153
9528
|
TextField_default,
|
|
9154
9529
|
{
|
|
9155
9530
|
placeholder: keyPlaceholder,
|
|
@@ -9160,7 +9535,7 @@ var KeyValueInput = ({
|
|
|
9160
9535
|
"aria-label": "New key"
|
|
9161
9536
|
}
|
|
9162
9537
|
),
|
|
9163
|
-
/* @__PURE__ */ (0,
|
|
9538
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
9164
9539
|
TextField_default,
|
|
9165
9540
|
{
|
|
9166
9541
|
placeholder: valuePlaceholder,
|
|
@@ -9176,7 +9551,7 @@ var KeyValueInput = ({
|
|
|
9176
9551
|
}
|
|
9177
9552
|
}
|
|
9178
9553
|
),
|
|
9179
|
-
/* @__PURE__ */ (0,
|
|
9554
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
9180
9555
|
Button_default,
|
|
9181
9556
|
{
|
|
9182
9557
|
variant: "solid",
|
|
@@ -9185,13 +9560,13 @@ var KeyValueInput = ({
|
|
|
9185
9560
|
disabled: isAddDisabled,
|
|
9186
9561
|
style: styles.addButton,
|
|
9187
9562
|
"aria-label": "Add new key-value pair",
|
|
9188
|
-
children: /* @__PURE__ */ (0,
|
|
9563
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Plus_default, { width: 16, height: 16 })
|
|
9189
9564
|
}
|
|
9190
9565
|
)
|
|
9191
9566
|
] })
|
|
9192
9567
|
] }),
|
|
9193
|
-
(helperText || error) && /* @__PURE__ */ (0,
|
|
9194
|
-
maxPairs && /* @__PURE__ */ (0,
|
|
9568
|
+
(helperText || error) && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { style: styles.helperText, children: error || helperText }),
|
|
9569
|
+
maxPairs && /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { style: styles.helperText, children: [
|
|
9195
9570
|
pairs.length,
|
|
9196
9571
|
" of ",
|
|
9197
9572
|
maxPairs,
|
|
@@ -9202,7 +9577,7 @@ var KeyValueInput = ({
|
|
|
9202
9577
|
var KeyValueInput_default = KeyValueInput;
|
|
9203
9578
|
|
|
9204
9579
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
9205
|
-
var
|
|
9580
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
9206
9581
|
var formatDate = (dateString) => {
|
|
9207
9582
|
if (!dateString) return "-";
|
|
9208
9583
|
try {
|
|
@@ -9262,10 +9637,10 @@ var BaseOrganizationProfile = ({
|
|
|
9262
9637
|
]
|
|
9263
9638
|
}) => {
|
|
9264
9639
|
const { theme } = useTheme_default();
|
|
9265
|
-
const [editedOrganization, setEditedOrganization] = (0,
|
|
9266
|
-
const [editingFields, setEditingFields] = (0,
|
|
9267
|
-
const triggerRef = (0,
|
|
9268
|
-
const PencilIcon = () => /* @__PURE__ */ (0,
|
|
9640
|
+
const [editedOrganization, setEditedOrganization] = (0, import_react53.useState)(organization);
|
|
9641
|
+
const [editingFields, setEditingFields] = (0, import_react53.useState)({});
|
|
9642
|
+
const triggerRef = (0, import_react53.useRef)(null);
|
|
9643
|
+
const PencilIcon = () => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9269
9644
|
"svg",
|
|
9270
9645
|
{
|
|
9271
9646
|
width: "16",
|
|
@@ -9276,16 +9651,16 @@ var BaseOrganizationProfile = ({
|
|
|
9276
9651
|
strokeWidth: "2",
|
|
9277
9652
|
strokeLinecap: "round",
|
|
9278
9653
|
strokeLinejoin: "round",
|
|
9279
|
-
children: /* @__PURE__ */ (0,
|
|
9654
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
9280
9655
|
}
|
|
9281
9656
|
);
|
|
9282
|
-
const toggleFieldEdit = (0,
|
|
9657
|
+
const toggleFieldEdit = (0, import_react53.useCallback)((fieldName) => {
|
|
9283
9658
|
setEditingFields((prev) => ({
|
|
9284
9659
|
...prev,
|
|
9285
9660
|
[fieldName]: !prev[fieldName]
|
|
9286
9661
|
}));
|
|
9287
9662
|
}, []);
|
|
9288
|
-
const getFieldPlaceholder = (0,
|
|
9663
|
+
const getFieldPlaceholder = (0, import_react53.useCallback)((fieldKey) => {
|
|
9289
9664
|
const fieldLabels = {
|
|
9290
9665
|
name: "organization name",
|
|
9291
9666
|
description: "organization description",
|
|
@@ -9296,7 +9671,7 @@ var BaseOrganizationProfile = ({
|
|
|
9296
9671
|
const fieldLabel = fieldLabels[fieldKey] || fieldKey.toLowerCase();
|
|
9297
9672
|
return `Enter ${fieldLabel}`;
|
|
9298
9673
|
}, []);
|
|
9299
|
-
const handleFieldSave = (0,
|
|
9674
|
+
const handleFieldSave = (0, import_react53.useCallback)(
|
|
9300
9675
|
(fieldKey) => {
|
|
9301
9676
|
if (!onUpdate || !fieldKey) return;
|
|
9302
9677
|
const fieldValue = editedOrganization && fieldKey && editedOrganization[fieldKey] !== void 0 ? editedOrganization[fieldKey] : organization && organization[fieldKey] !== void 0 ? organization[fieldKey] : "";
|
|
@@ -9308,7 +9683,7 @@ var BaseOrganizationProfile = ({
|
|
|
9308
9683
|
},
|
|
9309
9684
|
[editedOrganization, organization, onUpdate, toggleFieldEdit]
|
|
9310
9685
|
);
|
|
9311
|
-
const handleFieldCancel = (0,
|
|
9686
|
+
const handleFieldCancel = (0, import_react53.useCallback)(
|
|
9312
9687
|
(fieldKey) => {
|
|
9313
9688
|
setEditedOrganization((prev) => ({
|
|
9314
9689
|
...prev,
|
|
@@ -9335,8 +9710,8 @@ var BaseOrganizationProfile = ({
|
|
|
9335
9710
|
if (!name) return "ORG";
|
|
9336
9711
|
return name.split(" ").map((word) => word.charAt(0)).join("").toUpperCase().slice(0, 2);
|
|
9337
9712
|
};
|
|
9338
|
-
const styles =
|
|
9339
|
-
const buttonStyle = (0,
|
|
9713
|
+
const styles = useStyles9();
|
|
9714
|
+
const buttonStyle = (0, import_react53.useMemo)(
|
|
9340
9715
|
() => ({
|
|
9341
9716
|
padding: `${theme.spacing.unit}px ${theme.spacing.unit * 2}px`,
|
|
9342
9717
|
margin: `${theme.spacing.unit}px`,
|
|
@@ -9348,7 +9723,7 @@ var BaseOrganizationProfile = ({
|
|
|
9348
9723
|
}),
|
|
9349
9724
|
[theme]
|
|
9350
9725
|
);
|
|
9351
|
-
const saveButtonStyle = (0,
|
|
9726
|
+
const saveButtonStyle = (0, import_react53.useMemo)(
|
|
9352
9727
|
() => ({
|
|
9353
9728
|
...buttonStyle,
|
|
9354
9729
|
backgroundColor: theme.colors.primary.main,
|
|
@@ -9356,7 +9731,7 @@ var BaseOrganizationProfile = ({
|
|
|
9356
9731
|
}),
|
|
9357
9732
|
[theme, buttonStyle]
|
|
9358
9733
|
);
|
|
9359
|
-
const cancelButtonStyle = (0,
|
|
9734
|
+
const cancelButtonStyle = (0, import_react53.useMemo)(
|
|
9360
9735
|
() => ({
|
|
9361
9736
|
...buttonStyle,
|
|
9362
9737
|
backgroundColor: theme.colors.secondary.main,
|
|
@@ -9383,7 +9758,7 @@ var BaseOrganizationProfile = ({
|
|
|
9383
9758
|
let fieldInput;
|
|
9384
9759
|
if (key === "attributes") {
|
|
9385
9760
|
const attributesValue = typeof fieldValue === "object" && fieldValue !== null ? fieldValue : {};
|
|
9386
|
-
fieldInput = /* @__PURE__ */ (0,
|
|
9761
|
+
fieldInput = /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9387
9762
|
KeyValueInput_default,
|
|
9388
9763
|
{
|
|
9389
9764
|
value: attributesValue,
|
|
@@ -9421,26 +9796,26 @@ var BaseOrganizationProfile = ({
|
|
|
9421
9796
|
}
|
|
9422
9797
|
);
|
|
9423
9798
|
} else {
|
|
9424
|
-
fieldInput = /* @__PURE__ */ (0,
|
|
9799
|
+
fieldInput = /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TextField_default, { ...commonProps });
|
|
9425
9800
|
}
|
|
9426
|
-
return /* @__PURE__ */ (0,
|
|
9427
|
-
/* @__PURE__ */ (0,
|
|
9428
|
-
/* @__PURE__ */ (0,
|
|
9801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
|
|
9802
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { style: styles.label, children: label }),
|
|
9803
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: styles.value, children: fieldInput })
|
|
9429
9804
|
] });
|
|
9430
9805
|
}
|
|
9431
9806
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
9432
9807
|
const isFieldEditable = editable && fieldEditable;
|
|
9433
9808
|
let displayValue;
|
|
9434
9809
|
if (hasValue) {
|
|
9435
|
-
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */ (0,
|
|
9810
|
+
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(KeyValueInput_default, { value, readOnly: true, label: "" }) : String(renderedValue);
|
|
9436
9811
|
} else if (isFieldEditable) {
|
|
9437
9812
|
displayValue = getFieldPlaceholder(key);
|
|
9438
9813
|
} else {
|
|
9439
9814
|
displayValue = "-";
|
|
9440
9815
|
}
|
|
9441
|
-
return /* @__PURE__ */ (0,
|
|
9442
|
-
/* @__PURE__ */ (0,
|
|
9443
|
-
/* @__PURE__ */ (0,
|
|
9816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
|
|
9817
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { style: styles.label, children: label }),
|
|
9818
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9444
9819
|
"div",
|
|
9445
9820
|
{
|
|
9446
9821
|
style: {
|
|
@@ -9448,7 +9823,7 @@ var BaseOrganizationProfile = ({
|
|
|
9448
9823
|
fontStyle: hasValue ? "normal" : "italic",
|
|
9449
9824
|
opacity: hasValue ? 1 : 0.7
|
|
9450
9825
|
},
|
|
9451
|
-
children: !hasValue && isFieldEditable && onStartEdit ? /* @__PURE__ */ (0,
|
|
9826
|
+
children: !hasValue && isFieldEditable && onStartEdit ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9452
9827
|
"button",
|
|
9453
9828
|
{
|
|
9454
9829
|
onClick: onStartEdit,
|
|
@@ -9486,8 +9861,8 @@ var BaseOrganizationProfile = ({
|
|
|
9486
9861
|
alignItems: "center",
|
|
9487
9862
|
gap: `${theme.spacing.unit}px`
|
|
9488
9863
|
};
|
|
9489
|
-
return /* @__PURE__ */ (0,
|
|
9490
|
-
/* @__PURE__ */ (0,
|
|
9864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { style: fieldStyle, children: [
|
|
9865
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { flex: 1, display: "flex", alignItems: "center", gap: `${theme.spacing.unit}px` }, children: renderField(
|
|
9491
9866
|
field,
|
|
9492
9867
|
isFieldEditing,
|
|
9493
9868
|
(value) => {
|
|
@@ -9497,12 +9872,12 @@ var BaseOrganizationProfile = ({
|
|
|
9497
9872
|
},
|
|
9498
9873
|
() => toggleFieldEdit(field.key)
|
|
9499
9874
|
) }),
|
|
9500
|
-
isFieldEditable && /* @__PURE__ */ (0,
|
|
9501
|
-
/* @__PURE__ */ (0,
|
|
9502
|
-
/* @__PURE__ */ (0,
|
|
9875
|
+
isFieldEditable && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { display: "flex", alignItems: "center", gap: `${theme.spacing.unit / 2}px` }, children: isFieldEditing ? /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
|
|
9876
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { onClick: () => handleFieldSave(field.key), style: saveButtonStyle, title: "Save changes", children: saveButtonText }),
|
|
9877
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { onClick: () => handleFieldCancel(field.key), style: cancelButtonStyle, title: "Cancel editing", children: cancelButtonText })
|
|
9503
9878
|
] }) : (
|
|
9504
9879
|
// Only show pencil icon when there's a value
|
|
9505
|
-
hasValue && /* @__PURE__ */ (0,
|
|
9880
|
+
hasValue && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9506
9881
|
"button",
|
|
9507
9882
|
{
|
|
9508
9883
|
onClick: () => toggleFieldEdit(field.key),
|
|
@@ -9518,7 +9893,7 @@ var BaseOrganizationProfile = ({
|
|
|
9518
9893
|
color: theme.colors.text.secondary
|
|
9519
9894
|
},
|
|
9520
9895
|
title: "Edit field",
|
|
9521
|
-
children: /* @__PURE__ */ (0,
|
|
9896
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(PencilIcon, {})
|
|
9522
9897
|
}
|
|
9523
9898
|
)
|
|
9524
9899
|
) })
|
|
@@ -9531,30 +9906,30 @@ var BaseOrganizationProfile = ({
|
|
|
9531
9906
|
...styles.root,
|
|
9532
9907
|
...cardLayout ? styles.card : {}
|
|
9533
9908
|
};
|
|
9534
|
-
const profileContent = /* @__PURE__ */ (0,
|
|
9535
|
-
/* @__PURE__ */ (0,
|
|
9536
|
-
/* @__PURE__ */ (0,
|
|
9537
|
-
/* @__PURE__ */ (0,
|
|
9538
|
-
/* @__PURE__ */ (0,
|
|
9539
|
-
organization.orgHandle && /* @__PURE__ */ (0,
|
|
9909
|
+
const profileContent = /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Card_default, { style: containerStyle, className: (0, import_clsx25.default)((0, import_browser59.withVendorCSSClassPrefix)("organization-profile"), className), children: [
|
|
9910
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { style: styles.header, children: [
|
|
9911
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Avatar, { name: getOrgInitials(organization.name), size: 80, alt: `${organization.name} logo` }),
|
|
9912
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { style: styles.orgInfo, children: [
|
|
9913
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("h2", { style: styles.name, children: organization.name }),
|
|
9914
|
+
organization.orgHandle && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("p", { style: styles.handle, children: [
|
|
9540
9915
|
"@",
|
|
9541
9916
|
organization.orgHandle
|
|
9542
9917
|
] })
|
|
9543
9918
|
] })
|
|
9544
9919
|
] }),
|
|
9545
|
-
/* @__PURE__ */ (0,
|
|
9920
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: styles.infoContainer, children: fields.map((field, index) => renderOrganizationField(field)) })
|
|
9546
9921
|
] });
|
|
9547
9922
|
if (mode === "popup") {
|
|
9548
|
-
return /* @__PURE__ */ (0,
|
|
9549
|
-
/* @__PURE__ */ (0,
|
|
9550
|
-
/* @__PURE__ */ (0,
|
|
9923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(DialogContent, { children: [
|
|
9924
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(DialogHeading, { children: title }),
|
|
9925
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { padding: "1rem" }, children: profileContent })
|
|
9551
9926
|
] }) });
|
|
9552
9927
|
}
|
|
9553
9928
|
return profileContent;
|
|
9554
9929
|
};
|
|
9555
|
-
var
|
|
9930
|
+
var useStyles9 = () => {
|
|
9556
9931
|
const { theme, colorScheme } = useTheme_default();
|
|
9557
|
-
return (0,
|
|
9932
|
+
return (0, import_react53.useMemo)(
|
|
9558
9933
|
() => ({
|
|
9559
9934
|
root: {
|
|
9560
9935
|
padding: `${theme.spacing.unit * 4}px`,
|
|
@@ -9674,8 +10049,8 @@ var useStyles8 = () => {
|
|
|
9674
10049
|
var BaseOrganizationProfile_default = BaseOrganizationProfile;
|
|
9675
10050
|
|
|
9676
10051
|
// src/api/getOrganization.ts
|
|
9677
|
-
var
|
|
9678
|
-
var httpClient7 =
|
|
10052
|
+
var import_browser60 = require("@asgardeo/browser");
|
|
10053
|
+
var httpClient7 = import_browser60.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser60.AsgardeoSPAClient.getInstance());
|
|
9679
10054
|
var getOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
9680
10055
|
const defaultFetcher = async (url, config) => {
|
|
9681
10056
|
const response = await httpClient7({
|
|
@@ -9691,7 +10066,7 @@ var getOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
9691
10066
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
9692
10067
|
};
|
|
9693
10068
|
};
|
|
9694
|
-
return (0,
|
|
10069
|
+
return (0, import_browser60.getOrganization)({
|
|
9695
10070
|
...requestConfig,
|
|
9696
10071
|
fetcher: fetcher || defaultFetcher
|
|
9697
10072
|
});
|
|
@@ -9699,8 +10074,8 @@ var getOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
9699
10074
|
var getOrganization_default = getOrganization;
|
|
9700
10075
|
|
|
9701
10076
|
// src/api/updateOrganization.ts
|
|
9702
|
-
var
|
|
9703
|
-
var httpClient8 =
|
|
10077
|
+
var import_browser61 = require("@asgardeo/browser");
|
|
10078
|
+
var httpClient8 = import_browser61.AsgardeoSPAClient.getInstance().httpRequest.bind(import_browser61.AsgardeoSPAClient.getInstance());
|
|
9704
10079
|
var updateOrganization = async ({
|
|
9705
10080
|
fetcher,
|
|
9706
10081
|
...requestConfig
|
|
@@ -9720,7 +10095,7 @@ var updateOrganization = async ({
|
|
|
9720
10095
|
text: () => Promise.resolve(typeof response.data === "string" ? response.data : JSON.stringify(response.data))
|
|
9721
10096
|
};
|
|
9722
10097
|
};
|
|
9723
|
-
return (0,
|
|
10098
|
+
return (0, import_browser61.updateOrganization)({
|
|
9724
10099
|
...requestConfig,
|
|
9725
10100
|
fetcher: fetcher || defaultFetcher
|
|
9726
10101
|
});
|
|
@@ -9728,7 +10103,7 @@ var updateOrganization = async ({
|
|
|
9728
10103
|
var updateOrganization_default = updateOrganization;
|
|
9729
10104
|
|
|
9730
10105
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
9731
|
-
var
|
|
10106
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
9732
10107
|
var OrganizationProfile = ({
|
|
9733
10108
|
organizationId,
|
|
9734
10109
|
mode = "default",
|
|
@@ -9736,15 +10111,15 @@ var OrganizationProfile = ({
|
|
|
9736
10111
|
onOpenChange,
|
|
9737
10112
|
onUpdate,
|
|
9738
10113
|
popupTitle,
|
|
9739
|
-
loadingFallback = /* @__PURE__ */ (0,
|
|
9740
|
-
errorFallback = /* @__PURE__ */ (0,
|
|
10114
|
+
loadingFallback = /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { children: "Loading organization..." }),
|
|
10115
|
+
errorFallback = /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { children: "Failed to load organization data" }),
|
|
9741
10116
|
...rest
|
|
9742
10117
|
}) => {
|
|
9743
10118
|
const { baseUrl } = useAsgardeo_default();
|
|
9744
10119
|
const { t } = useTranslation_default();
|
|
9745
|
-
const [organization, setOrganization] = (0,
|
|
9746
|
-
const [loading, setLoading] = (0,
|
|
9747
|
-
const [error, setError] = (0,
|
|
10120
|
+
const [organization, setOrganization] = (0, import_react54.useState)(null);
|
|
10121
|
+
const [loading, setLoading] = (0, import_react54.useState)(true);
|
|
10122
|
+
const [error, setError] = (0, import_react54.useState)(false);
|
|
9748
10123
|
const fetchOrganization = async () => {
|
|
9749
10124
|
if (!baseUrl || !organizationId) {
|
|
9750
10125
|
setLoading(false);
|
|
@@ -9767,13 +10142,13 @@ var OrganizationProfile = ({
|
|
|
9767
10142
|
setLoading(false);
|
|
9768
10143
|
}
|
|
9769
10144
|
};
|
|
9770
|
-
(0,
|
|
10145
|
+
(0, import_react54.useEffect)(() => {
|
|
9771
10146
|
fetchOrganization();
|
|
9772
10147
|
}, [baseUrl, organizationId]);
|
|
9773
10148
|
const handleOrganizationUpdate = async (payload) => {
|
|
9774
10149
|
if (!baseUrl || !organizationId) return;
|
|
9775
10150
|
try {
|
|
9776
|
-
const operations = (0,
|
|
10151
|
+
const operations = (0, import_browser61.createPatchOperations)(payload);
|
|
9777
10152
|
await updateOrganization_default({
|
|
9778
10153
|
baseUrl,
|
|
9779
10154
|
organizationId,
|
|
@@ -9788,19 +10163,7 @@ var OrganizationProfile = ({
|
|
|
9788
10163
|
throw err;
|
|
9789
10164
|
}
|
|
9790
10165
|
};
|
|
9791
|
-
|
|
9792
|
-
return mode === "popup" ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(DialogContent, { children: [
|
|
9793
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(DialogHeading, { children: popupTitle || t("organization.profile.title") }),
|
|
9794
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { padding: "1rem" }, children: loadingFallback })
|
|
9795
|
-
] }) }) : loadingFallback;
|
|
9796
|
-
}
|
|
9797
|
-
if (error) {
|
|
9798
|
-
return mode === "popup" ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(DialogContent, { children: [
|
|
9799
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(DialogHeading, { children: popupTitle || t("organization.profile.title") }),
|
|
9800
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { padding: "1rem" }, children: errorFallback })
|
|
9801
|
-
] }) }) : errorFallback;
|
|
9802
|
-
}
|
|
9803
|
-
const profileContent = /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
10166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
9804
10167
|
BaseOrganizationProfile_default,
|
|
9805
10168
|
{
|
|
9806
10169
|
organization,
|
|
@@ -9812,36 +10175,35 @@ var OrganizationProfile = ({
|
|
|
9812
10175
|
...rest
|
|
9813
10176
|
}
|
|
9814
10177
|
);
|
|
9815
|
-
return profileContent;
|
|
9816
10178
|
};
|
|
9817
10179
|
var OrganizationProfile_default = OrganizationProfile;
|
|
9818
10180
|
|
|
9819
10181
|
// src/components/presentation/OrganizationList/OrganizationList.tsx
|
|
9820
|
-
var
|
|
10182
|
+
var import_react56 = require("react");
|
|
9821
10183
|
|
|
9822
10184
|
// src/components/presentation/OrganizationList/BaseOrganizationList.tsx
|
|
9823
|
-
var
|
|
9824
|
-
var
|
|
9825
|
-
var
|
|
9826
|
-
var
|
|
10185
|
+
var import_browser62 = require("@asgardeo/browser");
|
|
10186
|
+
var import_clsx26 = __toESM(require("clsx"), 1);
|
|
10187
|
+
var import_react55 = require("react");
|
|
10188
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
9827
10189
|
var defaultRenderOrganization = (organization, styles) => {
|
|
9828
10190
|
const getOrgInitials = (name) => {
|
|
9829
10191
|
if (!name) return "ORG";
|
|
9830
10192
|
return name.split(" ").map((word) => word.charAt(0)).join("").toUpperCase().slice(0, 2);
|
|
9831
10193
|
};
|
|
9832
|
-
return /* @__PURE__ */ (0,
|
|
9833
|
-
/* @__PURE__ */ (0,
|
|
9834
|
-
/* @__PURE__ */ (0,
|
|
9835
|
-
/* @__PURE__ */ (0,
|
|
9836
|
-
/* @__PURE__ */ (0,
|
|
9837
|
-
/* @__PURE__ */ (0,
|
|
10194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { style: styles.organizationItem, children: [
|
|
10195
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { style: styles.organizationContent, children: [
|
|
10196
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Avatar, { name: getOrgInitials(organization.name), size: 48, alt: `${organization.name} logo` }),
|
|
10197
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { style: styles.organizationInfo, children: [
|
|
10198
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("h3", { style: styles.organizationName, children: organization.name }),
|
|
10199
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("p", { style: styles.organizationHandle, children: [
|
|
9838
10200
|
"@",
|
|
9839
10201
|
organization.orgHandle
|
|
9840
10202
|
] }),
|
|
9841
|
-
/* @__PURE__ */ (0,
|
|
10203
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("p", { style: styles.organizationStatus, children: [
|
|
9842
10204
|
"Status:",
|
|
9843
10205
|
" ",
|
|
9844
|
-
/* @__PURE__ */ (0,
|
|
10206
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
9845
10207
|
"span",
|
|
9846
10208
|
{
|
|
9847
10209
|
style: {
|
|
@@ -9854,16 +10216,16 @@ var defaultRenderOrganization = (organization, styles) => {
|
|
|
9854
10216
|
] })
|
|
9855
10217
|
] })
|
|
9856
10218
|
] }),
|
|
9857
|
-
/* @__PURE__ */ (0,
|
|
10219
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: styles.organizationActions, children: organization.canSwitch ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { style: { ...styles.badge, ...styles.successBadge }, children: "Can Switch" }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { style: { ...styles.badge, ...styles.errorBadge }, children: "No Access" }) })
|
|
9858
10220
|
] }, organization.id);
|
|
9859
10221
|
};
|
|
9860
|
-
var defaultRenderLoading = (styles) => /* @__PURE__ */ (0,
|
|
9861
|
-
var defaultRenderError = (error, styles) => /* @__PURE__ */ (0,
|
|
9862
|
-
/* @__PURE__ */ (0,
|
|
10222
|
+
var defaultRenderLoading = (styles) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: styles.loadingContainer, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: styles.loadingText, children: "Loading organizations..." }) });
|
|
10223
|
+
var defaultRenderError = (error, styles) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { style: styles.errorContainer, children: [
|
|
10224
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("strong", { children: "Error:" }),
|
|
9863
10225
|
" ",
|
|
9864
10226
|
error
|
|
9865
10227
|
] });
|
|
9866
|
-
var defaultRenderLoadMore = (onLoadMore, isLoading, styles) => /* @__PURE__ */ (0,
|
|
10228
|
+
var defaultRenderLoadMore = (onLoadMore, isLoading, styles) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
9867
10229
|
"button",
|
|
9868
10230
|
{
|
|
9869
10231
|
onClick: onLoadMore,
|
|
@@ -9876,7 +10238,7 @@ var defaultRenderLoadMore = (onLoadMore, isLoading, styles) => /* @__PURE__ */ (
|
|
|
9876
10238
|
children: isLoading ? "Loading..." : "Load More Organizations"
|
|
9877
10239
|
}
|
|
9878
10240
|
);
|
|
9879
|
-
var defaultRenderEmpty = (styles) => /* @__PURE__ */ (0,
|
|
10241
|
+
var defaultRenderEmpty = (styles) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: styles.emptyContainer, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: styles.emptyText, children: "No organizations found" }) });
|
|
9880
10242
|
var BaseOrganizationList = ({
|
|
9881
10243
|
className = "",
|
|
9882
10244
|
data,
|
|
@@ -9898,68 +10260,68 @@ var BaseOrganizationList = ({
|
|
|
9898
10260
|
title = "Organizations",
|
|
9899
10261
|
totalCount
|
|
9900
10262
|
}) => {
|
|
9901
|
-
const styles =
|
|
10263
|
+
const styles = useStyles10();
|
|
9902
10264
|
const renderLoadingWithStyles = renderLoading || (() => defaultRenderLoading(styles));
|
|
9903
10265
|
const renderErrorWithStyles = renderError || ((error2) => defaultRenderError(error2, styles));
|
|
9904
10266
|
const renderEmptyWithStyles = renderEmpty || (() => defaultRenderEmpty(styles));
|
|
9905
10267
|
const renderLoadMoreWithStyles = renderLoadMore || ((onLoadMore, isLoading2) => defaultRenderLoadMore(onLoadMore, isLoading2, styles));
|
|
9906
10268
|
const renderOrganizationWithStyles = renderOrganization || ((org) => defaultRenderOrganization(org, styles));
|
|
9907
10269
|
if (isLoading && data.length === 0) {
|
|
9908
|
-
const loadingContent = /* @__PURE__ */ (0,
|
|
10270
|
+
const loadingContent = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
9909
10271
|
"div",
|
|
9910
10272
|
{
|
|
9911
|
-
className: (0,
|
|
10273
|
+
className: (0, import_clsx26.default)((0, import_browser62.withVendorCSSClassPrefix)("organization-list"), className),
|
|
9912
10274
|
style: { ...styles.root, ...style },
|
|
9913
10275
|
children: renderLoadingWithStyles()
|
|
9914
10276
|
}
|
|
9915
10277
|
);
|
|
9916
10278
|
if (mode === "popup") {
|
|
9917
|
-
return /* @__PURE__ */ (0,
|
|
9918
|
-
/* @__PURE__ */ (0,
|
|
9919
|
-
/* @__PURE__ */ (0,
|
|
10279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(DialogContent, { children: [
|
|
10280
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(DialogHeading, { children: title }),
|
|
10281
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: styles.popupContent, children: loadingContent })
|
|
9920
10282
|
] }) });
|
|
9921
10283
|
}
|
|
9922
10284
|
return loadingContent;
|
|
9923
10285
|
}
|
|
9924
10286
|
if (error && data.length === 0) {
|
|
9925
|
-
const errorContent = /* @__PURE__ */ (0,
|
|
10287
|
+
const errorContent = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
9926
10288
|
"div",
|
|
9927
10289
|
{
|
|
9928
|
-
className: (0,
|
|
10290
|
+
className: (0, import_clsx26.default)((0, import_browser62.withVendorCSSClassPrefix)("organization-list"), className),
|
|
9929
10291
|
style: { ...styles.root, ...style },
|
|
9930
10292
|
children: renderErrorWithStyles(error)
|
|
9931
10293
|
}
|
|
9932
10294
|
);
|
|
9933
10295
|
if (mode === "popup") {
|
|
9934
|
-
return /* @__PURE__ */ (0,
|
|
9935
|
-
/* @__PURE__ */ (0,
|
|
9936
|
-
/* @__PURE__ */ (0,
|
|
10296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(DialogContent, { children: [
|
|
10297
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(DialogHeading, { children: title }),
|
|
10298
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: styles.popupContent, children: errorContent })
|
|
9937
10299
|
] }) });
|
|
9938
10300
|
}
|
|
9939
10301
|
return errorContent;
|
|
9940
10302
|
}
|
|
9941
10303
|
if (!isLoading && data.length === 0) {
|
|
9942
|
-
const emptyContent = /* @__PURE__ */ (0,
|
|
10304
|
+
const emptyContent = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
9943
10305
|
"div",
|
|
9944
10306
|
{
|
|
9945
|
-
className: (0,
|
|
10307
|
+
className: (0, import_clsx26.default)((0, import_browser62.withVendorCSSClassPrefix)("organization-list"), className),
|
|
9946
10308
|
style: { ...styles.root, ...style },
|
|
9947
10309
|
children: renderEmptyWithStyles()
|
|
9948
10310
|
}
|
|
9949
10311
|
);
|
|
9950
10312
|
if (mode === "popup") {
|
|
9951
|
-
return /* @__PURE__ */ (0,
|
|
9952
|
-
/* @__PURE__ */ (0,
|
|
9953
|
-
/* @__PURE__ */ (0,
|
|
10313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(DialogContent, { children: [
|
|
10314
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(DialogHeading, { children: title }),
|
|
10315
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: styles.popupContent, children: emptyContent })
|
|
9954
10316
|
] }) });
|
|
9955
10317
|
}
|
|
9956
10318
|
return emptyContent;
|
|
9957
10319
|
}
|
|
9958
|
-
const organizationListContent = /* @__PURE__ */ (0,
|
|
9959
|
-
/* @__PURE__ */ (0,
|
|
9960
|
-
/* @__PURE__ */ (0,
|
|
9961
|
-
/* @__PURE__ */ (0,
|
|
9962
|
-
totalCount !== void 0 && /* @__PURE__ */ (0,
|
|
10320
|
+
const organizationListContent = /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: (0, import_clsx26.default)((0, import_browser62.withVendorCSSClassPrefix)("organization-list"), className), style: { ...styles.root, ...style }, children: [
|
|
10321
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { style: styles.header, children: [
|
|
10322
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { style: styles.headerInfo, children: [
|
|
10323
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("h2", { style: styles.title, children: "Organizations" }),
|
|
10324
|
+
totalCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("p", { style: styles.subtitle, children: [
|
|
9963
10325
|
"Showing ",
|
|
9964
10326
|
data.length,
|
|
9965
10327
|
" of ",
|
|
@@ -9967,25 +10329,25 @@ var BaseOrganizationList = ({
|
|
|
9967
10329
|
" organizations"
|
|
9968
10330
|
] })
|
|
9969
10331
|
] }),
|
|
9970
|
-
onRefresh && /* @__PURE__ */ (0,
|
|
10332
|
+
onRefresh && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("button", { onClick: onRefresh, style: styles.refreshButton, type: "button", children: "Refresh" })
|
|
9971
10333
|
] }),
|
|
9972
|
-
/* @__PURE__ */ (0,
|
|
10334
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: styles.listContainer, children: data.map(
|
|
9973
10335
|
(organization, index) => renderOrganizationWithStyles(organization, index)
|
|
9974
10336
|
) }),
|
|
9975
|
-
error && data.length > 0 && /* @__PURE__ */ (0,
|
|
9976
|
-
hasMore && fetchMore && /* @__PURE__ */ (0,
|
|
10337
|
+
error && data.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: styles.errorMargin, children: renderErrorWithStyles(error) }),
|
|
10338
|
+
hasMore && fetchMore && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: styles.loadMoreMargin, children: renderLoadMoreWithStyles(fetchMore, isLoadingMore) })
|
|
9977
10339
|
] });
|
|
9978
10340
|
if (mode === "popup") {
|
|
9979
|
-
return /* @__PURE__ */ (0,
|
|
9980
|
-
/* @__PURE__ */ (0,
|
|
9981
|
-
/* @__PURE__ */ (0,
|
|
10341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(DialogContent, { children: [
|
|
10342
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(DialogHeading, { children: title }),
|
|
10343
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: styles.popupContent, children: organizationListContent })
|
|
9982
10344
|
] }) });
|
|
9983
10345
|
}
|
|
9984
10346
|
return organizationListContent;
|
|
9985
10347
|
};
|
|
9986
|
-
var
|
|
10348
|
+
var useStyles10 = () => {
|
|
9987
10349
|
const { theme, colorScheme } = useTheme_default();
|
|
9988
|
-
return (0,
|
|
10350
|
+
return (0, import_react55.useMemo)(
|
|
9989
10351
|
() => ({
|
|
9990
10352
|
root: {
|
|
9991
10353
|
padding: `${theme.spacing.unit * 4}px`,
|
|
@@ -10149,7 +10511,7 @@ var useStyles9 = () => {
|
|
|
10149
10511
|
var BaseOrganizationList_default = BaseOrganizationList;
|
|
10150
10512
|
|
|
10151
10513
|
// src/components/presentation/OrganizationList/OrganizationList.tsx
|
|
10152
|
-
var
|
|
10514
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
10153
10515
|
var OrganizationList = ({
|
|
10154
10516
|
autoFetch = true,
|
|
10155
10517
|
filter = "",
|
|
@@ -10168,7 +10530,7 @@ var OrganizationList = ({
|
|
|
10168
10530
|
totalCount,
|
|
10169
10531
|
fetchPaginatedOrganizations
|
|
10170
10532
|
} = useOrganization_default();
|
|
10171
|
-
(0,
|
|
10533
|
+
(0, import_react56.useEffect)(() => {
|
|
10172
10534
|
if (autoFetch) {
|
|
10173
10535
|
fetchPaginatedOrganizations({
|
|
10174
10536
|
filter,
|
|
@@ -10178,7 +10540,7 @@ var OrganizationList = ({
|
|
|
10178
10540
|
});
|
|
10179
10541
|
}
|
|
10180
10542
|
}, [autoFetch, filter, limit, recursive, fetchPaginatedOrganizations]);
|
|
10181
|
-
const enhancedRenderOrganization = baseProps.renderOrganization ? baseProps.renderOrganization : onOrganizationSelect ? (organization, index) => /* @__PURE__ */ (0,
|
|
10543
|
+
const enhancedRenderOrganization = baseProps.renderOrganization ? baseProps.renderOrganization : onOrganizationSelect ? (organization, index) => /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
10182
10544
|
"div",
|
|
10183
10545
|
{
|
|
10184
10546
|
onClick: () => onOrganizationSelect(organization),
|
|
@@ -10200,19 +10562,19 @@ var OrganizationList = ({
|
|
|
10200
10562
|
e.currentTarget.style.borderColor = "#e5e7eb";
|
|
10201
10563
|
},
|
|
10202
10564
|
children: [
|
|
10203
|
-
/* @__PURE__ */ (0,
|
|
10204
|
-
/* @__PURE__ */ (0,
|
|
10205
|
-
/* @__PURE__ */ (0,
|
|
10565
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { children: [
|
|
10566
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("h3", { style: { fontSize: "18px", fontWeight: "bold", margin: "0 0 8px 0" }, children: organization.name }),
|
|
10567
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("p", { style: { color: "#6b7280", fontSize: "14px", margin: "0" }, children: [
|
|
10206
10568
|
"Handle: ",
|
|
10207
10569
|
organization.orgHandle
|
|
10208
10570
|
] }),
|
|
10209
|
-
/* @__PURE__ */ (0,
|
|
10571
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("p", { style: { color: "#6b7280", fontSize: "14px", margin: "4px 0 0 0" }, children: [
|
|
10210
10572
|
"Status:",
|
|
10211
10573
|
" ",
|
|
10212
|
-
/* @__PURE__ */ (0,
|
|
10574
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { style: { color: organization.status === "ACTIVE" ? "#10b981" : "#ef4444" }, children: organization.status })
|
|
10213
10575
|
] })
|
|
10214
10576
|
] }),
|
|
10215
|
-
/* @__PURE__ */ (0,
|
|
10577
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { style: { alignItems: "center", display: "flex" }, children: organization.canSwitch ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
10216
10578
|
"span",
|
|
10217
10579
|
{
|
|
10218
10580
|
style: {
|
|
@@ -10225,7 +10587,7 @@ var OrganizationList = ({
|
|
|
10225
10587
|
},
|
|
10226
10588
|
children: "Can Switch"
|
|
10227
10589
|
}
|
|
10228
|
-
) : /* @__PURE__ */ (0,
|
|
10590
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
10229
10591
|
"span",
|
|
10230
10592
|
{
|
|
10231
10593
|
style: {
|
|
@@ -10251,7 +10613,7 @@ var OrganizationList = ({
|
|
|
10251
10613
|
reset: true
|
|
10252
10614
|
});
|
|
10253
10615
|
};
|
|
10254
|
-
return /* @__PURE__ */ (0,
|
|
10616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
10255
10617
|
BaseOrganizationList_default,
|
|
10256
10618
|
{
|
|
10257
10619
|
data: paginatedOrganizations,
|
|
@@ -10270,8 +10632,8 @@ var OrganizationList = ({
|
|
|
10270
10632
|
var OrganizationList_default = OrganizationList;
|
|
10271
10633
|
|
|
10272
10634
|
// src/components/primitives/Icons/BuildingAlt.tsx
|
|
10273
|
-
var
|
|
10274
|
-
var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0,
|
|
10635
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
10636
|
+
var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
10275
10637
|
"svg",
|
|
10276
10638
|
{
|
|
10277
10639
|
width,
|
|
@@ -10284,13 +10646,13 @@ var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @_
|
|
|
10284
10646
|
"stroke-linecap": "round",
|
|
10285
10647
|
"stroke-linejoin": "round",
|
|
10286
10648
|
children: [
|
|
10287
|
-
/* @__PURE__ */ (0,
|
|
10288
|
-
/* @__PURE__ */ (0,
|
|
10289
|
-
/* @__PURE__ */ (0,
|
|
10290
|
-
/* @__PURE__ */ (0,
|
|
10291
|
-
/* @__PURE__ */ (0,
|
|
10292
|
-
/* @__PURE__ */ (0,
|
|
10293
|
-
/* @__PURE__ */ (0,
|
|
10649
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" }),
|
|
10650
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { d: "M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" }),
|
|
10651
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { d: "M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" }),
|
|
10652
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { d: "M10 6h4" }),
|
|
10653
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { d: "M10 10h4" }),
|
|
10654
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { d: "M10 14h4" }),
|
|
10655
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { d: "M10 18h4" })
|
|
10294
10656
|
]
|
|
10295
10657
|
}
|
|
10296
10658
|
);
|
|
@@ -10298,7 +10660,7 @@ BuildingAlt.displayName = "BuildingAlt";
|
|
|
10298
10660
|
var BuildingAlt_default = BuildingAlt;
|
|
10299
10661
|
|
|
10300
10662
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
10301
|
-
var
|
|
10663
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
10302
10664
|
var OrganizationSwitcher = ({
|
|
10303
10665
|
currentOrganization: propCurrentOrganization,
|
|
10304
10666
|
fallback = null,
|
|
@@ -10314,15 +10676,15 @@ var OrganizationSwitcher = ({
|
|
|
10314
10676
|
isLoading,
|
|
10315
10677
|
error
|
|
10316
10678
|
} = useOrganization_default();
|
|
10317
|
-
const [isCreateOrgOpen, setIsCreateOrgOpen] = (0,
|
|
10318
|
-
const [isProfileOpen, setIsProfileOpen] = (0,
|
|
10319
|
-
const [isOrganizationListOpen, setIsOrganizationListOpen] = (0,
|
|
10679
|
+
const [isCreateOrgOpen, setIsCreateOrgOpen] = (0, import_react57.useState)(false);
|
|
10680
|
+
const [isProfileOpen, setIsProfileOpen] = (0, import_react57.useState)(false);
|
|
10681
|
+
const [isOrganizationListOpen, setIsOrganizationListOpen] = (0, import_react57.useState)(false);
|
|
10320
10682
|
const { t } = useTranslation_default();
|
|
10321
10683
|
if (!isSignedIn && fallback) {
|
|
10322
10684
|
return fallback;
|
|
10323
10685
|
}
|
|
10324
10686
|
if (!isSignedIn) {
|
|
10325
|
-
return /* @__PURE__ */ (0,
|
|
10687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_jsx_runtime90.Fragment, {});
|
|
10326
10688
|
}
|
|
10327
10689
|
const organizations = propOrganizations || contextOrganizations || [];
|
|
10328
10690
|
const currentOrganization = propCurrentOrganization || contextCurrentOrganization;
|
|
@@ -10336,19 +10698,19 @@ var OrganizationSwitcher = ({
|
|
|
10336
10698
|
const defaultMenuItems = [];
|
|
10337
10699
|
if (currentOrganization) {
|
|
10338
10700
|
defaultMenuItems.push({
|
|
10339
|
-
icon: /* @__PURE__ */ (0,
|
|
10701
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(BuildingAlt_default, {}),
|
|
10340
10702
|
label: t("organization.switcher.manage.organizations"),
|
|
10341
10703
|
onClick: handleManageOrganizations
|
|
10342
10704
|
});
|
|
10343
10705
|
}
|
|
10344
10706
|
defaultMenuItems.push({
|
|
10345
|
-
icon: /* @__PURE__ */ (0,
|
|
10707
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("path", { d: "M12 5v14m-7-7h14" }) }),
|
|
10346
10708
|
label: t("organization.switcher.create.organization"),
|
|
10347
10709
|
onClick: () => setIsCreateOrgOpen(true)
|
|
10348
10710
|
});
|
|
10349
10711
|
const menuItems = props.menuItems ? [...defaultMenuItems, ...props.menuItems] : defaultMenuItems;
|
|
10350
|
-
return /* @__PURE__ */ (0,
|
|
10351
|
-
/* @__PURE__ */ (0,
|
|
10712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_jsx_runtime90.Fragment, { children: [
|
|
10713
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
10352
10714
|
BaseOrganizationSwitcher_default,
|
|
10353
10715
|
{
|
|
10354
10716
|
organizations,
|
|
@@ -10361,7 +10723,7 @@ var OrganizationSwitcher = ({
|
|
|
10361
10723
|
...props
|
|
10362
10724
|
}
|
|
10363
10725
|
),
|
|
10364
|
-
/* @__PURE__ */ (0,
|
|
10726
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
10365
10727
|
CreateOrganization,
|
|
10366
10728
|
{
|
|
10367
10729
|
mode: "popup",
|
|
@@ -10375,7 +10737,7 @@ var OrganizationSwitcher = ({
|
|
|
10375
10737
|
}
|
|
10376
10738
|
}
|
|
10377
10739
|
),
|
|
10378
|
-
currentOrganization && /* @__PURE__ */ (0,
|
|
10740
|
+
currentOrganization && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
10379
10741
|
OrganizationProfile_default,
|
|
10380
10742
|
{
|
|
10381
10743
|
organizationId: currentOrganization.id,
|
|
@@ -10383,11 +10745,11 @@ var OrganizationSwitcher = ({
|
|
|
10383
10745
|
open: isProfileOpen,
|
|
10384
10746
|
onOpenChange: setIsProfileOpen,
|
|
10385
10747
|
cardLayout: true,
|
|
10386
|
-
loadingFallback: /* @__PURE__ */ (0,
|
|
10387
|
-
errorFallback: /* @__PURE__ */ (0,
|
|
10748
|
+
loadingFallback: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { children: t("organization.profile.loading") }),
|
|
10749
|
+
errorFallback: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { children: t("organization.profile.error") })
|
|
10388
10750
|
}
|
|
10389
10751
|
),
|
|
10390
|
-
/* @__PURE__ */ (0,
|
|
10752
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
10391
10753
|
OrganizationList_default,
|
|
10392
10754
|
{
|
|
10393
10755
|
mode: "popup",
|