@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/index.js
CHANGED
|
@@ -4,13 +4,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4
4
|
|
|
5
5
|
// src/contexts/Asgardeo/AsgardeoProvider.tsx
|
|
6
6
|
import {
|
|
7
|
-
AsgardeoRuntimeError as AsgardeoRuntimeError3
|
|
7
|
+
AsgardeoRuntimeError as AsgardeoRuntimeError3,
|
|
8
|
+
generateFlattenedUserProfile as generateFlattenedUserProfile2
|
|
8
9
|
} from "@asgardeo/browser";
|
|
9
10
|
import { useEffect as useEffect5, useMemo as useMemo6, useRef, useState as useState6 } from "react";
|
|
10
11
|
|
|
11
12
|
// src/contexts/Asgardeo/AsgardeoContext.ts
|
|
12
13
|
import { createContext } from "react";
|
|
13
14
|
var AsgardeoContext = createContext({
|
|
15
|
+
organizationHandle: void 0,
|
|
16
|
+
applicationId: void 0,
|
|
14
17
|
signInUrl: void 0,
|
|
15
18
|
signUpUrl: void 0,
|
|
16
19
|
afterSignInUrl: void 0,
|
|
@@ -35,7 +38,8 @@ import {
|
|
|
35
38
|
generateUserProfile,
|
|
36
39
|
AsgardeoRuntimeError,
|
|
37
40
|
executeEmbeddedSignUpFlow,
|
|
38
|
-
executeEmbeddedSignInFlow
|
|
41
|
+
executeEmbeddedSignInFlow,
|
|
42
|
+
deriveOrganizationHandleFromBaseUrl
|
|
39
43
|
} from "@asgardeo/browser";
|
|
40
44
|
|
|
41
45
|
// src/__temp__/api.ts
|
|
@@ -243,8 +247,8 @@ var _AuthAPI = class _AuthAPI {
|
|
|
243
247
|
* @return {Promise<DecodedIDTokenPayloadInterface>} - A Promise that resolves with
|
|
244
248
|
* the decoded payload of the id token.
|
|
245
249
|
*/
|
|
246
|
-
async getDecodedIdToken() {
|
|
247
|
-
return this._client.getDecodedIdToken();
|
|
250
|
+
async getDecodedIdToken(sessionId) {
|
|
251
|
+
return this._client.getDecodedIdToken(sessionId);
|
|
248
252
|
}
|
|
249
253
|
/**
|
|
250
254
|
* This method decodes the payload of the idp id token and returns it.
|
|
@@ -480,12 +484,22 @@ var AsgardeoReactClient = class extends AsgardeoBrowserClient {
|
|
|
480
484
|
this.asgardeo = new api_default();
|
|
481
485
|
}
|
|
482
486
|
initialize(config) {
|
|
483
|
-
|
|
487
|
+
let resolvedOrganizationHandle = config?.organizationHandle;
|
|
488
|
+
if (!resolvedOrganizationHandle) {
|
|
489
|
+
resolvedOrganizationHandle = deriveOrganizationHandleFromBaseUrl(config?.baseUrl);
|
|
490
|
+
}
|
|
491
|
+
return this.asgardeo.init({ ...config, organizationHandle: resolvedOrganizationHandle });
|
|
484
492
|
}
|
|
485
|
-
async
|
|
493
|
+
async updateUserProfile(payload, userId) {
|
|
494
|
+
throw new Error("Not implemented");
|
|
495
|
+
}
|
|
496
|
+
async getUser(options) {
|
|
486
497
|
try {
|
|
487
|
-
|
|
488
|
-
|
|
498
|
+
let baseUrl = options?.baseUrl;
|
|
499
|
+
if (!baseUrl) {
|
|
500
|
+
const configData = await this.asgardeo.getConfigData();
|
|
501
|
+
baseUrl = configData?.baseUrl;
|
|
502
|
+
}
|
|
489
503
|
const profile = await getScim2Me_default({ baseUrl });
|
|
490
504
|
const schemas = await getSchemas_default({ baseUrl });
|
|
491
505
|
return generateUserProfile(profile, flattenUserSchema(schemas));
|
|
@@ -493,10 +507,16 @@ var AsgardeoReactClient = class extends AsgardeoBrowserClient {
|
|
|
493
507
|
return this.asgardeo.getDecodedIdToken();
|
|
494
508
|
}
|
|
495
509
|
}
|
|
496
|
-
async
|
|
510
|
+
async getDecodedIdToken(sessionId) {
|
|
511
|
+
return this.asgardeo.getDecodedIdToken(sessionId);
|
|
512
|
+
}
|
|
513
|
+
async getUserProfile(options) {
|
|
497
514
|
try {
|
|
498
|
-
|
|
499
|
-
|
|
515
|
+
let baseUrl = options?.baseUrl;
|
|
516
|
+
if (!baseUrl) {
|
|
517
|
+
const configData = await this.asgardeo.getConfigData();
|
|
518
|
+
baseUrl = configData?.baseUrl;
|
|
519
|
+
}
|
|
500
520
|
const profile = await getScim2Me_default({ baseUrl });
|
|
501
521
|
const schemas = await getSchemas_default({ baseUrl });
|
|
502
522
|
const processedSchemas = flattenUserSchema(schemas);
|
|
@@ -514,10 +534,13 @@ var AsgardeoReactClient = class extends AsgardeoBrowserClient {
|
|
|
514
534
|
};
|
|
515
535
|
}
|
|
516
536
|
}
|
|
517
|
-
async getOrganizations() {
|
|
537
|
+
async getOrganizations(options) {
|
|
518
538
|
try {
|
|
519
|
-
|
|
520
|
-
|
|
539
|
+
let baseUrl = options?.baseUrl;
|
|
540
|
+
if (!baseUrl) {
|
|
541
|
+
const configData = await this.asgardeo.getConfigData();
|
|
542
|
+
baseUrl = configData?.baseUrl;
|
|
543
|
+
}
|
|
521
544
|
const organizations = await getMeOrganizations_default({ baseUrl });
|
|
522
545
|
return organizations;
|
|
523
546
|
} catch (error) {
|
|
@@ -598,7 +621,7 @@ var AsgardeoReactClient = class extends AsgardeoBrowserClient {
|
|
|
598
621
|
url: arg2.url
|
|
599
622
|
});
|
|
600
623
|
}
|
|
601
|
-
return this.asgardeo.signIn(arg1);
|
|
624
|
+
return await this.asgardeo.signIn(arg1);
|
|
602
625
|
}
|
|
603
626
|
async signOut(...args) {
|
|
604
627
|
if (args[1] && typeof args[1] !== "function") {
|
|
@@ -984,6 +1007,7 @@ var OrganizationProvider = ({
|
|
|
984
1007
|
const [switchableOrgIds, setSwitchableOrgIds] = useState3(/* @__PURE__ */ new Set());
|
|
985
1008
|
const [currentPage, setCurrentPage] = useState3(1);
|
|
986
1009
|
const [currentFilter, setCurrentFilter] = useState3({});
|
|
1010
|
+
const [isFetching, setIsFetching] = useState3(false);
|
|
987
1011
|
const fetchOrganizations = useCallback3(async () => {
|
|
988
1012
|
if (!isSignedIn) {
|
|
989
1013
|
return;
|
|
@@ -1046,9 +1070,10 @@ var OrganizationProvider = ({
|
|
|
1046
1070
|
const fetchPaginatedOrganizations = useCallback3(
|
|
1047
1071
|
async (config = {}) => {
|
|
1048
1072
|
const { filter = "", limit = 10, recursive = false, reset = false } = config;
|
|
1049
|
-
if (!isSignedIn || !baseUrl) {
|
|
1073
|
+
if (!isSignedIn || !baseUrl || isFetching) {
|
|
1050
1074
|
return;
|
|
1051
1075
|
}
|
|
1076
|
+
setIsFetching(true);
|
|
1052
1077
|
try {
|
|
1053
1078
|
if (reset) {
|
|
1054
1079
|
setIsLoading(true);
|
|
@@ -1079,7 +1104,23 @@ var OrganizationProvider = ({
|
|
|
1079
1104
|
filter,
|
|
1080
1105
|
limit,
|
|
1081
1106
|
recursive,
|
|
1082
|
-
...reset ? {} : { startIndex: (currentPage - 1) * limit }
|
|
1107
|
+
...reset ? {} : { startIndex: (currentPage - 1) * limit },
|
|
1108
|
+
fetcher: async (url, config2) => {
|
|
1109
|
+
try {
|
|
1110
|
+
const response2 = await fetch(url, config2);
|
|
1111
|
+
if (response2.status === 401 || response2.status === 403) {
|
|
1112
|
+
const error2 = new Error("Insufficient permissions");
|
|
1113
|
+
error2.status = response2.status;
|
|
1114
|
+
throw error2;
|
|
1115
|
+
}
|
|
1116
|
+
return response2;
|
|
1117
|
+
} catch (error2) {
|
|
1118
|
+
if (error2.status === 401 || error2.status === 403) {
|
|
1119
|
+
error2.noRetry = true;
|
|
1120
|
+
}
|
|
1121
|
+
throw error2;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1083
1124
|
});
|
|
1084
1125
|
const organizationsWithAccess = response.organizations.map(
|
|
1085
1126
|
(org) => ({
|
|
@@ -1099,14 +1140,22 @@ var OrganizationProvider = ({
|
|
|
1099
1140
|
setHasMore(response.hasMore || false);
|
|
1100
1141
|
setTotalCount(response.totalCount || organizationsWithAccess.length);
|
|
1101
1142
|
} catch (fetchError) {
|
|
1102
|
-
const
|
|
1143
|
+
const isAuthError = fetchError.status === 403 || fetchError.status === 401 || fetchError.noRetry === true;
|
|
1144
|
+
const errorMessage = isAuthError ? "Insufficient permissions to fetch organizations" : fetchError.message || "Failed to fetch paginated organizations";
|
|
1103
1145
|
setError(errorMessage);
|
|
1146
|
+
if (isAuthError) {
|
|
1147
|
+
setHasMore(false);
|
|
1148
|
+
setIsLoadingMore(false);
|
|
1149
|
+
setIsLoading(false);
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1104
1152
|
if (onError) {
|
|
1105
1153
|
onError(errorMessage);
|
|
1106
1154
|
}
|
|
1107
1155
|
} finally {
|
|
1108
1156
|
setIsLoading(false);
|
|
1109
1157
|
setIsLoadingMore(false);
|
|
1158
|
+
setIsFetching(false);
|
|
1110
1159
|
}
|
|
1111
1160
|
},
|
|
1112
1161
|
[baseUrl, isSignedIn, onError, switchableOrgIds, currentPage]
|
|
@@ -1160,8 +1209,13 @@ var OrganizationProvider = ({
|
|
|
1160
1209
|
var OrganizationProvider_default = OrganizationProvider;
|
|
1161
1210
|
|
|
1162
1211
|
// src/contexts/Theme/ThemeProvider.tsx
|
|
1163
|
-
import { useEffect as useEffect3, useMemo as useMemo4, useState as useState4 } from "react";
|
|
1164
|
-
import {
|
|
1212
|
+
import { useEffect as useEffect3, useMemo as useMemo4, useState as useState4, useCallback as useCallback4 } from "react";
|
|
1213
|
+
import {
|
|
1214
|
+
createTheme,
|
|
1215
|
+
detectThemeMode,
|
|
1216
|
+
createClassObserver,
|
|
1217
|
+
createMediaQueryListener
|
|
1218
|
+
} from "@asgardeo/browser";
|
|
1165
1219
|
|
|
1166
1220
|
// src/contexts/Theme/ThemeContext.ts
|
|
1167
1221
|
import { createContext as createContext5 } from "react";
|
|
@@ -1179,13 +1233,46 @@ var applyThemeToDOM = (theme) => {
|
|
|
1179
1233
|
var ThemeProvider = ({
|
|
1180
1234
|
children,
|
|
1181
1235
|
theme: themeConfig,
|
|
1182
|
-
|
|
1236
|
+
mode = "system",
|
|
1237
|
+
detection = {}
|
|
1183
1238
|
}) => {
|
|
1184
|
-
const [colorScheme, setColorScheme] = useState4(
|
|
1239
|
+
const [colorScheme, setColorScheme] = useState4(() => {
|
|
1240
|
+
if (mode === "light" || mode === "dark") {
|
|
1241
|
+
return mode;
|
|
1242
|
+
}
|
|
1243
|
+
return detectThemeMode(mode, detection);
|
|
1244
|
+
});
|
|
1185
1245
|
const theme = useMemo4(() => createTheme(themeConfig, colorScheme === "dark"), [themeConfig, colorScheme]);
|
|
1186
|
-
const
|
|
1246
|
+
const handleThemeChange = useCallback4((isDark) => {
|
|
1247
|
+
setColorScheme(isDark ? "dark" : "light");
|
|
1248
|
+
}, []);
|
|
1249
|
+
const toggleTheme = useCallback4(() => {
|
|
1187
1250
|
setColorScheme((prev) => prev === "light" ? "dark" : "light");
|
|
1188
|
-
};
|
|
1251
|
+
}, []);
|
|
1252
|
+
useEffect3(() => {
|
|
1253
|
+
let observer = null;
|
|
1254
|
+
let mediaQuery = null;
|
|
1255
|
+
if (mode === "class") {
|
|
1256
|
+
const targetElement = detection.targetElement || document.documentElement;
|
|
1257
|
+
if (targetElement) {
|
|
1258
|
+
observer = createClassObserver(targetElement, handleThemeChange, detection);
|
|
1259
|
+
}
|
|
1260
|
+
} else if (mode === "system") {
|
|
1261
|
+
mediaQuery = createMediaQueryListener(handleThemeChange);
|
|
1262
|
+
}
|
|
1263
|
+
return () => {
|
|
1264
|
+
if (observer) {
|
|
1265
|
+
observer.disconnect();
|
|
1266
|
+
}
|
|
1267
|
+
if (mediaQuery) {
|
|
1268
|
+
if (mediaQuery.removeEventListener) {
|
|
1269
|
+
mediaQuery.removeEventListener("change", handleThemeChange);
|
|
1270
|
+
} else {
|
|
1271
|
+
mediaQuery.removeListener(handleThemeChange);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
};
|
|
1275
|
+
}, [mode, detection, handleThemeChange]);
|
|
1189
1276
|
useEffect3(() => {
|
|
1190
1277
|
applyThemeToDOM(theme);
|
|
1191
1278
|
}, [theme]);
|
|
@@ -1207,7 +1294,9 @@ var UserContext = createContext6({
|
|
|
1207
1294
|
profile: null,
|
|
1208
1295
|
schemas: null,
|
|
1209
1296
|
flattenedProfile: null,
|
|
1210
|
-
revalidateProfile: () => null
|
|
1297
|
+
revalidateProfile: () => null,
|
|
1298
|
+
updateProfile: () => null,
|
|
1299
|
+
onUpdateProfile: () => null
|
|
1211
1300
|
});
|
|
1212
1301
|
UserContext.displayName = "UserContext";
|
|
1213
1302
|
var UserContext_default = UserContext;
|
|
@@ -1217,16 +1306,20 @@ import { jsx as jsx5 } from "react/jsx-runtime";
|
|
|
1217
1306
|
var UserProvider = ({
|
|
1218
1307
|
children,
|
|
1219
1308
|
profile,
|
|
1220
|
-
revalidateProfile
|
|
1309
|
+
revalidateProfile,
|
|
1310
|
+
onUpdateProfile,
|
|
1311
|
+
updateProfile
|
|
1221
1312
|
}) => {
|
|
1222
1313
|
const contextValue = useMemo5(
|
|
1223
1314
|
() => ({
|
|
1224
1315
|
schemas: profile?.schemas,
|
|
1225
1316
|
profile: profile?.profile,
|
|
1226
1317
|
flattenedProfile: profile?.flattenedProfile,
|
|
1227
|
-
revalidateProfile
|
|
1318
|
+
revalidateProfile,
|
|
1319
|
+
updateProfile,
|
|
1320
|
+
onUpdateProfile
|
|
1228
1321
|
}),
|
|
1229
|
-
[profile]
|
|
1322
|
+
[profile, onUpdateProfile, revalidateProfile, updateProfile]
|
|
1230
1323
|
);
|
|
1231
1324
|
return /* @__PURE__ */ jsx5(UserContext_default.Provider, { value: contextValue, children });
|
|
1232
1325
|
};
|
|
@@ -1237,13 +1330,15 @@ import { jsx as jsx6 } from "react/jsx-runtime";
|
|
|
1237
1330
|
var AsgardeoProvider = ({
|
|
1238
1331
|
afterSignInUrl = window.location.origin,
|
|
1239
1332
|
afterSignOutUrl = window.location.origin,
|
|
1240
|
-
baseUrl,
|
|
1333
|
+
baseUrl: _baseUrl,
|
|
1241
1334
|
clientId,
|
|
1242
1335
|
children,
|
|
1243
1336
|
scopes,
|
|
1244
1337
|
preferences,
|
|
1245
1338
|
signInUrl,
|
|
1246
1339
|
signUpUrl,
|
|
1340
|
+
organizationHandle,
|
|
1341
|
+
applicationId,
|
|
1247
1342
|
...rest
|
|
1248
1343
|
}) => {
|
|
1249
1344
|
const reRenderCheckRef = useRef(false);
|
|
@@ -1254,18 +1349,26 @@ var AsgardeoProvider = ({
|
|
|
1254
1349
|
const [isSignedInSync, setIsSignedInSync] = useState6(false);
|
|
1255
1350
|
const [isInitializedSync, setIsInitializedSync] = useState6(false);
|
|
1256
1351
|
const [userProfile, setUserProfile] = useState6(null);
|
|
1352
|
+
const [baseUrl, setBaseUrl] = useState6(_baseUrl);
|
|
1353
|
+
const [config, setConfig] = useState6({
|
|
1354
|
+
applicationId,
|
|
1355
|
+
organizationHandle,
|
|
1356
|
+
afterSignInUrl,
|
|
1357
|
+
afterSignOutUrl,
|
|
1358
|
+
baseUrl,
|
|
1359
|
+
clientId,
|
|
1360
|
+
scopes,
|
|
1361
|
+
signUpUrl,
|
|
1362
|
+
signInUrl,
|
|
1363
|
+
...rest
|
|
1364
|
+
});
|
|
1365
|
+
useEffect5(() => {
|
|
1366
|
+
setBaseUrl(_baseUrl);
|
|
1367
|
+
}, [_baseUrl]);
|
|
1257
1368
|
useEffect5(() => {
|
|
1258
1369
|
(async () => {
|
|
1259
|
-
await asgardeo.initialize(
|
|
1260
|
-
|
|
1261
|
-
afterSignOutUrl,
|
|
1262
|
-
baseUrl,
|
|
1263
|
-
clientId,
|
|
1264
|
-
scopes,
|
|
1265
|
-
signUpUrl,
|
|
1266
|
-
signInUrl,
|
|
1267
|
-
...rest
|
|
1268
|
-
});
|
|
1370
|
+
await asgardeo.initialize(config);
|
|
1371
|
+
setConfig(await asgardeo.getConfiguration());
|
|
1269
1372
|
})();
|
|
1270
1373
|
}, []);
|
|
1271
1374
|
useEffect5(() => {
|
|
@@ -1275,9 +1378,7 @@ var AsgardeoProvider = ({
|
|
|
1275
1378
|
reRenderCheckRef.current = true;
|
|
1276
1379
|
(async () => {
|
|
1277
1380
|
if (await asgardeo.isSignedIn()) {
|
|
1278
|
-
|
|
1279
|
-
setUserProfile(await asgardeo.getUserProfile());
|
|
1280
|
-
setCurrentOrganization(await asgardeo.getCurrentOrganization());
|
|
1381
|
+
await updateSession();
|
|
1281
1382
|
return;
|
|
1282
1383
|
}
|
|
1283
1384
|
if (hasAuthParams(new URL(window.location.href), afterSignInUrl)) {
|
|
@@ -1330,13 +1431,21 @@ var AsgardeoProvider = ({
|
|
|
1330
1431
|
}
|
|
1331
1432
|
})();
|
|
1332
1433
|
}, [asgardeo]);
|
|
1434
|
+
const updateSession = async () => {
|
|
1435
|
+
let _baseUrl2 = baseUrl;
|
|
1436
|
+
if ((await asgardeo.getDecodedIdToken())?.["user_org"]) {
|
|
1437
|
+
_baseUrl2 = `${(await asgardeo.getConfiguration()).baseUrl}/o`;
|
|
1438
|
+
setBaseUrl(_baseUrl2);
|
|
1439
|
+
}
|
|
1440
|
+
setUser(await asgardeo.getUser({ baseUrl: _baseUrl2 }));
|
|
1441
|
+
setUserProfile(await asgardeo.getUserProfile({ baseUrl: _baseUrl2 }));
|
|
1442
|
+
setCurrentOrganization(await asgardeo.getCurrentOrganization());
|
|
1443
|
+
};
|
|
1333
1444
|
const signIn = async (...args) => {
|
|
1334
1445
|
try {
|
|
1335
1446
|
const response = await asgardeo.signIn(...args);
|
|
1336
1447
|
if (await asgardeo.isSignedIn()) {
|
|
1337
|
-
|
|
1338
|
-
setUserProfile(await asgardeo.getUserProfile());
|
|
1339
|
-
setCurrentOrganization(await asgardeo.getCurrentOrganization());
|
|
1448
|
+
await updateSession();
|
|
1340
1449
|
}
|
|
1341
1450
|
return response;
|
|
1342
1451
|
} catch (error) {
|
|
@@ -1360,9 +1469,7 @@ var AsgardeoProvider = ({
|
|
|
1360
1469
|
try {
|
|
1361
1470
|
await asgardeo.switchOrganization(organization);
|
|
1362
1471
|
if (await asgardeo.isSignedIn()) {
|
|
1363
|
-
|
|
1364
|
-
setUserProfile(await asgardeo.getUserProfile());
|
|
1365
|
-
setCurrentOrganization(await asgardeo.getCurrentOrganization());
|
|
1472
|
+
await updateSession();
|
|
1366
1473
|
}
|
|
1367
1474
|
} catch (error) {
|
|
1368
1475
|
throw new AsgardeoRuntimeError3(
|
|
@@ -1379,10 +1486,20 @@ var AsgardeoProvider = ({
|
|
|
1379
1486
|
}
|
|
1380
1487
|
return preferences.theme.mode === "dark";
|
|
1381
1488
|
}, [preferences?.theme?.mode]);
|
|
1489
|
+
const handleProfileUpdate = (payload) => {
|
|
1490
|
+
setUser(payload);
|
|
1491
|
+
setUserProfile((prev) => ({
|
|
1492
|
+
...prev,
|
|
1493
|
+
profile: payload,
|
|
1494
|
+
flattenedProfile: generateFlattenedUserProfile2(payload, prev?.schemas)
|
|
1495
|
+
}));
|
|
1496
|
+
};
|
|
1382
1497
|
return /* @__PURE__ */ jsx6(
|
|
1383
1498
|
AsgardeoContext_default.Provider,
|
|
1384
1499
|
{
|
|
1385
1500
|
value: {
|
|
1501
|
+
applicationId,
|
|
1502
|
+
organizationHandle: config?.organizationHandle,
|
|
1386
1503
|
signInUrl,
|
|
1387
1504
|
signUpUrl,
|
|
1388
1505
|
afterSignInUrl,
|
|
@@ -1396,22 +1513,15 @@ var AsgardeoProvider = ({
|
|
|
1396
1513
|
signUp,
|
|
1397
1514
|
user
|
|
1398
1515
|
},
|
|
1399
|
-
children: /* @__PURE__ */ jsx6(I18nProvider_default, { preferences: preferences?.i18n, children: /* @__PURE__ */ jsx6(ThemeProvider_default, { theme: preferences?.theme?.overrides,
|
|
1400
|
-
|
|
1516
|
+
children: /* @__PURE__ */ jsx6(I18nProvider_default, { preferences: preferences?.i18n, children: /* @__PURE__ */ jsx6(ThemeProvider_default, { theme: preferences?.theme?.overrides, mode: isDarkMode ? "dark" : "light", children: /* @__PURE__ */ jsx6(FlowProvider_default, { children: /* @__PURE__ */ jsx6(UserProvider_default, { profile: userProfile, onUpdateProfile: handleProfileUpdate, children: /* @__PURE__ */ jsx6(
|
|
1517
|
+
OrganizationProvider_default,
|
|
1401
1518
|
{
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
{
|
|
1407
|
-
getOrganizations: async () => asgardeo.getOrganizations(),
|
|
1408
|
-
currentOrganization,
|
|
1409
|
-
onOrganizationSwitch: switchOrganization,
|
|
1410
|
-
children
|
|
1411
|
-
}
|
|
1412
|
-
)
|
|
1519
|
+
getOrganizations: async () => asgardeo.getOrganizations(),
|
|
1520
|
+
currentOrganization,
|
|
1521
|
+
onOrganizationSwitch: switchOrganization,
|
|
1522
|
+
children
|
|
1413
1523
|
}
|
|
1414
|
-
) }) }) })
|
|
1524
|
+
) }) }) }) })
|
|
1415
1525
|
}
|
|
1416
1526
|
);
|
|
1417
1527
|
};
|
|
@@ -1543,7 +1653,7 @@ var useTranslation = (componentPreferences) => {
|
|
|
1543
1653
|
var useTranslation_default = useTranslation;
|
|
1544
1654
|
|
|
1545
1655
|
// src/hooks/useForm.ts
|
|
1546
|
-
import { useState as useState7, useCallback as
|
|
1656
|
+
import { useState as useState7, useCallback as useCallback6 } from "react";
|
|
1547
1657
|
var useForm = (config = {}) => {
|
|
1548
1658
|
const {
|
|
1549
1659
|
initialValues = {},
|
|
@@ -1557,11 +1667,11 @@ var useForm = (config = {}) => {
|
|
|
1557
1667
|
const [touched, setFormTouched] = useState7({});
|
|
1558
1668
|
const [errors, setFormErrors] = useState7({});
|
|
1559
1669
|
const [isSubmitted, setIsSubmitted] = useState7(false);
|
|
1560
|
-
const getFieldConfig =
|
|
1670
|
+
const getFieldConfig = useCallback6(
|
|
1561
1671
|
(name) => fields.find((field) => field.name === name),
|
|
1562
1672
|
[fields]
|
|
1563
1673
|
);
|
|
1564
|
-
const validateField =
|
|
1674
|
+
const validateField = useCallback6(
|
|
1565
1675
|
(name) => {
|
|
1566
1676
|
const value = values[name] || "";
|
|
1567
1677
|
const fieldConfig = getFieldConfig(name);
|
|
@@ -1576,7 +1686,7 @@ var useForm = (config = {}) => {
|
|
|
1576
1686
|
},
|
|
1577
1687
|
[values, getFieldConfig, requiredMessage]
|
|
1578
1688
|
);
|
|
1579
|
-
const validateForm =
|
|
1689
|
+
const validateForm = useCallback6(() => {
|
|
1580
1690
|
const newErrors = {};
|
|
1581
1691
|
fields.forEach((field) => {
|
|
1582
1692
|
const error = validateField(field.name);
|
|
@@ -1598,7 +1708,7 @@ var useForm = (config = {}) => {
|
|
|
1598
1708
|
};
|
|
1599
1709
|
}, [fields, validateField, validator, values]);
|
|
1600
1710
|
const isValid = Object.keys(errors).length === 0;
|
|
1601
|
-
const setValue =
|
|
1711
|
+
const setValue = useCallback6(
|
|
1602
1712
|
(name, value) => {
|
|
1603
1713
|
setFormValues((prev) => ({
|
|
1604
1714
|
...prev,
|
|
@@ -1619,13 +1729,13 @@ var useForm = (config = {}) => {
|
|
|
1619
1729
|
},
|
|
1620
1730
|
[validateField, validateOnChange]
|
|
1621
1731
|
);
|
|
1622
|
-
const setValues =
|
|
1732
|
+
const setValues = useCallback6((newValues) => {
|
|
1623
1733
|
setFormValues((prev) => ({
|
|
1624
1734
|
...prev,
|
|
1625
1735
|
...newValues
|
|
1626
1736
|
}));
|
|
1627
1737
|
}, []);
|
|
1628
|
-
const setTouched =
|
|
1738
|
+
const setTouched = useCallback6(
|
|
1629
1739
|
(name, isTouched = true) => {
|
|
1630
1740
|
setFormTouched((prev) => ({
|
|
1631
1741
|
...prev,
|
|
@@ -1646,13 +1756,13 @@ var useForm = (config = {}) => {
|
|
|
1646
1756
|
},
|
|
1647
1757
|
[validateField, validateOnBlur]
|
|
1648
1758
|
);
|
|
1649
|
-
const setTouchedFields =
|
|
1759
|
+
const setTouchedFields = useCallback6((touchedFields) => {
|
|
1650
1760
|
setFormTouched((prev) => ({
|
|
1651
1761
|
...prev,
|
|
1652
1762
|
...touchedFields
|
|
1653
1763
|
}));
|
|
1654
1764
|
}, []);
|
|
1655
|
-
const touchAllFields =
|
|
1765
|
+
const touchAllFields = useCallback6(() => {
|
|
1656
1766
|
const allTouched = fields.reduce((acc, field) => {
|
|
1657
1767
|
acc[field.name] = true;
|
|
1658
1768
|
return acc;
|
|
@@ -1661,28 +1771,28 @@ var useForm = (config = {}) => {
|
|
|
1661
1771
|
const validation = validateForm();
|
|
1662
1772
|
setFormErrors(validation.errors);
|
|
1663
1773
|
}, [fields, validateForm]);
|
|
1664
|
-
const setError =
|
|
1774
|
+
const setError = useCallback6((name, error) => {
|
|
1665
1775
|
setFormErrors((prev) => ({
|
|
1666
1776
|
...prev,
|
|
1667
1777
|
[name]: error
|
|
1668
1778
|
}));
|
|
1669
1779
|
}, []);
|
|
1670
|
-
const setErrors =
|
|
1780
|
+
const setErrors = useCallback6((newErrors) => {
|
|
1671
1781
|
setFormErrors((prev) => ({
|
|
1672
1782
|
...prev,
|
|
1673
1783
|
...newErrors
|
|
1674
1784
|
}));
|
|
1675
1785
|
}, []);
|
|
1676
|
-
const clearErrors =
|
|
1786
|
+
const clearErrors = useCallback6(() => {
|
|
1677
1787
|
setFormErrors({});
|
|
1678
1788
|
}, []);
|
|
1679
|
-
const reset =
|
|
1789
|
+
const reset = useCallback6(() => {
|
|
1680
1790
|
setFormValues({ ...initialValues });
|
|
1681
1791
|
setFormTouched({});
|
|
1682
1792
|
setFormErrors({});
|
|
1683
1793
|
setIsSubmitted(false);
|
|
1684
1794
|
}, [initialValues]);
|
|
1685
|
-
const handleSubmit =
|
|
1795
|
+
const handleSubmit = useCallback6(
|
|
1686
1796
|
(onSubmit) => async (e) => {
|
|
1687
1797
|
if (e) {
|
|
1688
1798
|
e.preventDefault();
|
|
@@ -1696,7 +1806,7 @@ var useForm = (config = {}) => {
|
|
|
1696
1806
|
},
|
|
1697
1807
|
[values, touchAllFields, validateForm]
|
|
1698
1808
|
);
|
|
1699
|
-
const getFieldProps =
|
|
1809
|
+
const getFieldProps = useCallback6(
|
|
1700
1810
|
(name) => {
|
|
1701
1811
|
const fieldConfig = getFieldConfig(name);
|
|
1702
1812
|
return {
|
|
@@ -2313,7 +2423,7 @@ import {
|
|
|
2313
2423
|
withVendorCSSClassPrefix as withVendorCSSClassPrefix14
|
|
2314
2424
|
} from "@asgardeo/browser";
|
|
2315
2425
|
import { clsx as clsx15 } from "clsx";
|
|
2316
|
-
import { useEffect as useEffect12, useState as useState13, useCallback as
|
|
2426
|
+
import { useEffect as useEffect12, useState as useState13, useCallback as useCallback7, useRef as useRef3 } from "react";
|
|
2317
2427
|
|
|
2318
2428
|
// src/components/presentation/SignIn/options/SignInOptionFactory.tsx
|
|
2319
2429
|
import {
|
|
@@ -4248,8 +4358,7 @@ var useCardStyles = (variant, clickable) => {
|
|
|
4248
4358
|
},
|
|
4249
4359
|
outlined: {
|
|
4250
4360
|
...baseStyles,
|
|
4251
|
-
border: `1px solid ${theme.colors.border}
|
|
4252
|
-
backgroundColor: "transparent"
|
|
4361
|
+
border: `1px solid ${theme.colors.border}`
|
|
4253
4362
|
},
|
|
4254
4363
|
elevated: {
|
|
4255
4364
|
...baseStyles,
|
|
@@ -4775,7 +4884,7 @@ var BaseSignInContent = ({
|
|
|
4775
4884
|
touchAllFields,
|
|
4776
4885
|
reset: resetForm
|
|
4777
4886
|
} = form;
|
|
4778
|
-
const setupFormFields =
|
|
4887
|
+
const setupFormFields = useCallback7(
|
|
4779
4888
|
(authenticator) => {
|
|
4780
4889
|
const initialValues = {};
|
|
4781
4890
|
authenticator.metadata?.params?.forEach((param) => {
|
|
@@ -5174,11 +5283,11 @@ var BaseSignInContent = ({
|
|
|
5174
5283
|
setFormValue(param, value);
|
|
5175
5284
|
setFormTouched(param, true);
|
|
5176
5285
|
};
|
|
5177
|
-
const hasMultipleOptions =
|
|
5286
|
+
const hasMultipleOptions = useCallback7(
|
|
5178
5287
|
() => currentFlow && "nextStep" in currentFlow && currentFlow.nextStep?.stepType === EmbeddedSignInFlowStepType.MultiOptionsPrompt && currentFlow.nextStep?.authenticators && currentFlow.nextStep.authenticators.length > 1,
|
|
5179
5288
|
[currentFlow]
|
|
5180
5289
|
);
|
|
5181
|
-
const getAvailableAuthenticators =
|
|
5290
|
+
const getAvailableAuthenticators = useCallback7(() => {
|
|
5182
5291
|
if (!currentFlow || !("nextStep" in currentFlow) || !currentFlow.nextStep?.authenticators) {
|
|
5183
5292
|
return [];
|
|
5184
5293
|
}
|
|
@@ -5415,7 +5524,7 @@ var BaseSignIn_default = BaseSignIn;
|
|
|
5415
5524
|
|
|
5416
5525
|
// src/components/presentation/SignIn/SignIn.tsx
|
|
5417
5526
|
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
5418
|
-
var SignIn = ({ className, size = "medium",
|
|
5527
|
+
var SignIn = ({ className, size = "medium", ...rest }) => {
|
|
5419
5528
|
const { signIn, afterSignInUrl, isInitialized, isLoading } = useAsgardeo_default();
|
|
5420
5529
|
const handleInitialize = async () => {
|
|
5421
5530
|
return await signIn({ response_mode: "direct" });
|
|
@@ -5444,7 +5553,7 @@ var SignIn = ({ className, size = "medium", variant = "outlined" }) => {
|
|
|
5444
5553
|
onSuccess: handleSuccess,
|
|
5445
5554
|
className,
|
|
5446
5555
|
size,
|
|
5447
|
-
|
|
5556
|
+
...rest
|
|
5448
5557
|
}
|
|
5449
5558
|
);
|
|
5450
5559
|
};
|
|
@@ -5459,7 +5568,7 @@ import {
|
|
|
5459
5568
|
AsgardeoAPIError as AsgardeoAPIError3
|
|
5460
5569
|
} from "@asgardeo/browser";
|
|
5461
5570
|
import { clsx as clsx16 } from "clsx";
|
|
5462
|
-
import { useEffect as useEffect13, useState as useState14, useCallback as
|
|
5571
|
+
import { useEffect as useEffect13, useState as useState14, useCallback as useCallback8, useRef as useRef4 } from "react";
|
|
5463
5572
|
|
|
5464
5573
|
// src/components/presentation/SignUp/options/SignUpOptionFactory.tsx
|
|
5465
5574
|
import { EmbeddedFlowComponentType } from "@asgardeo/browser";
|
|
@@ -6036,7 +6145,7 @@ var BaseSignUpContent = ({
|
|
|
6036
6145
|
const [error, setError] = useState14(null);
|
|
6037
6146
|
const [formData, setFormData] = useState14({});
|
|
6038
6147
|
const initializationAttemptedRef = useRef4(false);
|
|
6039
|
-
const extractFormFields =
|
|
6148
|
+
const extractFormFields = useCallback8(
|
|
6040
6149
|
(components) => {
|
|
6041
6150
|
const fields = [];
|
|
6042
6151
|
const processComponents = (comps) => {
|
|
@@ -6092,7 +6201,7 @@ var BaseSignUpContent = ({
|
|
|
6092
6201
|
touchAllFields,
|
|
6093
6202
|
reset: resetForm
|
|
6094
6203
|
} = form;
|
|
6095
|
-
const setupFormFields =
|
|
6204
|
+
const setupFormFields = useCallback8(
|
|
6096
6205
|
(flowResponse) => {
|
|
6097
6206
|
const fields = extractFormFields(flowResponse.data?.components || []);
|
|
6098
6207
|
const initialValues = {};
|
|
@@ -6294,7 +6403,7 @@ var BaseSignUpContent = ({
|
|
|
6294
6403
|
);
|
|
6295
6404
|
const errorClasses = clsx16([withVendorCSSClassPrefix15("signup__error")], errorClassName);
|
|
6296
6405
|
const messageClasses = clsx16([withVendorCSSClassPrefix15("signup__messages")], messageClassName);
|
|
6297
|
-
const renderComponents =
|
|
6406
|
+
const renderComponents = useCallback8(
|
|
6298
6407
|
(components) => renderSignUpComponents(
|
|
6299
6408
|
components,
|
|
6300
6409
|
formValues,
|
|
@@ -6405,11 +6514,11 @@ import { jsx as jsx62 } from "react/jsx-runtime";
|
|
|
6405
6514
|
var SignUp = ({
|
|
6406
6515
|
className,
|
|
6407
6516
|
size = "medium",
|
|
6408
|
-
variant = "outlined",
|
|
6409
6517
|
afterSignUpUrl,
|
|
6410
6518
|
onError,
|
|
6411
6519
|
onComplete,
|
|
6412
|
-
shouldRedirectAfterSignUp = true
|
|
6520
|
+
shouldRedirectAfterSignUp = true,
|
|
6521
|
+
...rest
|
|
6413
6522
|
}) => {
|
|
6414
6523
|
const { signUp, isInitialized } = useAsgardeo_default();
|
|
6415
6524
|
const handleInitialize = async (payload) => await signUp(
|
|
@@ -6438,8 +6547,8 @@ var SignUp = ({
|
|
|
6438
6547
|
onComplete: handleComplete,
|
|
6439
6548
|
className,
|
|
6440
6549
|
size,
|
|
6441
|
-
|
|
6442
|
-
|
|
6550
|
+
isInitialized,
|
|
6551
|
+
...rest
|
|
6443
6552
|
}
|
|
6444
6553
|
);
|
|
6445
6554
|
};
|
|
@@ -6486,9 +6595,9 @@ Organization5.displayName = "Organization";
|
|
|
6486
6595
|
var Organization_default = Organization5;
|
|
6487
6596
|
|
|
6488
6597
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
6489
|
-
import { withVendorCSSClassPrefix as
|
|
6490
|
-
import
|
|
6491
|
-
import { useMemo as
|
|
6598
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix19, WellKnownSchemaIds } from "@asgardeo/browser";
|
|
6599
|
+
import clsx20 from "clsx";
|
|
6600
|
+
import { useMemo as useMemo15, useState as useState16, useCallback as useCallback10, useRef as useRef5 } from "react";
|
|
6492
6601
|
|
|
6493
6602
|
// src/utils/getMappedUserProfileValue.ts
|
|
6494
6603
|
import { get } from "@asgardeo/browser";
|
|
@@ -7026,8 +7135,238 @@ var LegacyPopover = ({ isOpen, children, onClose, className = "", mode = "modal"
|
|
|
7026
7135
|
LegacyPopover.Header = LegacyPopoverHeader;
|
|
7027
7136
|
LegacyPopover.Content = LegacyPopoverContent;
|
|
7028
7137
|
|
|
7138
|
+
// src/components/primitives/MultiInput/MultiInput.tsx
|
|
7139
|
+
import { useCallback as useCallback9, useState as useState15, useMemo as useMemo14 } from "react";
|
|
7140
|
+
import clsx19 from "clsx";
|
|
7141
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix18 } from "@asgardeo/browser";
|
|
7142
|
+
import { jsx as jsx73, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
7143
|
+
var useStyles4 = () => {
|
|
7144
|
+
const { theme } = useTheme_default();
|
|
7145
|
+
return useMemo14(
|
|
7146
|
+
() => ({
|
|
7147
|
+
container: {
|
|
7148
|
+
display: "flex",
|
|
7149
|
+
flexDirection: "column",
|
|
7150
|
+
gap: `${theme.spacing.unit}px`
|
|
7151
|
+
},
|
|
7152
|
+
inputRow: {
|
|
7153
|
+
display: "flex",
|
|
7154
|
+
alignItems: "center",
|
|
7155
|
+
gap: `${theme.spacing.unit}px`,
|
|
7156
|
+
position: "relative"
|
|
7157
|
+
},
|
|
7158
|
+
inputWrapper: {
|
|
7159
|
+
flex: 1
|
|
7160
|
+
},
|
|
7161
|
+
plusIcon: {
|
|
7162
|
+
background: "var(--asgardeo-color-secondary-main)",
|
|
7163
|
+
borderRadius: "50%",
|
|
7164
|
+
outline: "4px var(--asgardeo-color-secondary-main) auto",
|
|
7165
|
+
color: "var(--asgardeo-color-secondary-contrastText)"
|
|
7166
|
+
},
|
|
7167
|
+
listContainer: {
|
|
7168
|
+
display: "flex",
|
|
7169
|
+
flexDirection: "column",
|
|
7170
|
+
gap: `${theme.spacing.unit / 2}px`
|
|
7171
|
+
},
|
|
7172
|
+
listItem: {
|
|
7173
|
+
display: "flex",
|
|
7174
|
+
alignItems: "center",
|
|
7175
|
+
justifyContent: "space-between",
|
|
7176
|
+
padding: `${theme.spacing.unit}px ${theme.spacing.unit * 1.5}px`,
|
|
7177
|
+
backgroundColor: theme.colors.background.surface,
|
|
7178
|
+
border: `1px solid ${theme.colors.border}`,
|
|
7179
|
+
borderRadius: theme.borderRadius.medium,
|
|
7180
|
+
fontSize: "1rem",
|
|
7181
|
+
color: theme.colors.text.primary
|
|
7182
|
+
},
|
|
7183
|
+
removeButton: {
|
|
7184
|
+
padding: `${theme.spacing.unit / 2}px`,
|
|
7185
|
+
minWidth: "auto",
|
|
7186
|
+
color: theme.colors.error.main
|
|
7187
|
+
}
|
|
7188
|
+
}),
|
|
7189
|
+
[theme]
|
|
7190
|
+
);
|
|
7191
|
+
};
|
|
7192
|
+
var MultiInput = ({
|
|
7193
|
+
label,
|
|
7194
|
+
error,
|
|
7195
|
+
required,
|
|
7196
|
+
className,
|
|
7197
|
+
disabled,
|
|
7198
|
+
helperText,
|
|
7199
|
+
placeholder = "Enter value",
|
|
7200
|
+
values = [],
|
|
7201
|
+
onChange,
|
|
7202
|
+
style = {},
|
|
7203
|
+
type = "text",
|
|
7204
|
+
fieldType = "STRING",
|
|
7205
|
+
startIcon,
|
|
7206
|
+
endIcon,
|
|
7207
|
+
minFields = 1,
|
|
7208
|
+
maxFields
|
|
7209
|
+
}) => {
|
|
7210
|
+
const styles = useStyles4();
|
|
7211
|
+
const PlusIcon = ({ style: style2 }) => /* @__PURE__ */ jsx73(
|
|
7212
|
+
"svg",
|
|
7213
|
+
{
|
|
7214
|
+
width: "16",
|
|
7215
|
+
height: "16",
|
|
7216
|
+
viewBox: "0 0 24 24",
|
|
7217
|
+
fill: "none",
|
|
7218
|
+
stroke: "currentColor",
|
|
7219
|
+
strokeWidth: "2",
|
|
7220
|
+
strokeLinecap: "round",
|
|
7221
|
+
strokeLinejoin: "round",
|
|
7222
|
+
style: style2,
|
|
7223
|
+
children: /* @__PURE__ */ jsx73("path", { d: "M12 5v14M5 12h14" })
|
|
7224
|
+
}
|
|
7225
|
+
);
|
|
7226
|
+
const BinIcon = () => /* @__PURE__ */ jsx73(
|
|
7227
|
+
"svg",
|
|
7228
|
+
{
|
|
7229
|
+
width: "16",
|
|
7230
|
+
height: "16",
|
|
7231
|
+
viewBox: "0 0 24 24",
|
|
7232
|
+
fill: "none",
|
|
7233
|
+
stroke: "currentColor",
|
|
7234
|
+
strokeWidth: "2",
|
|
7235
|
+
strokeLinecap: "round",
|
|
7236
|
+
strokeLinejoin: "round",
|
|
7237
|
+
children: /* @__PURE__ */ jsx73("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" })
|
|
7238
|
+
}
|
|
7239
|
+
);
|
|
7240
|
+
const handleAddValue = useCallback9(
|
|
7241
|
+
(newValue) => {
|
|
7242
|
+
if (newValue.trim() !== "" && (!maxFields || values.length < maxFields)) {
|
|
7243
|
+
onChange([...values, newValue.trim()]);
|
|
7244
|
+
}
|
|
7245
|
+
},
|
|
7246
|
+
[values, onChange, maxFields]
|
|
7247
|
+
);
|
|
7248
|
+
const handleRemoveValue = useCallback9(
|
|
7249
|
+
(index) => {
|
|
7250
|
+
if (values.length > minFields) {
|
|
7251
|
+
const updatedValues = values.filter((_, i) => i !== index);
|
|
7252
|
+
onChange(updatedValues);
|
|
7253
|
+
}
|
|
7254
|
+
},
|
|
7255
|
+
[values, onChange, minFields]
|
|
7256
|
+
);
|
|
7257
|
+
const renderInputField = useCallback9(
|
|
7258
|
+
(value, onValueChange, attachedEndIcon, onEndIconClick) => {
|
|
7259
|
+
const handleInputChange = (e) => {
|
|
7260
|
+
const newValue = e.target ? e.target.value : e;
|
|
7261
|
+
onValueChange(newValue);
|
|
7262
|
+
};
|
|
7263
|
+
const handleKeyDown = (e) => {
|
|
7264
|
+
if (e.key === "Enter" && onEndIconClick) {
|
|
7265
|
+
e.preventDefault();
|
|
7266
|
+
onEndIconClick();
|
|
7267
|
+
}
|
|
7268
|
+
};
|
|
7269
|
+
const finalEndIcon = attachedEndIcon || endIcon;
|
|
7270
|
+
const commonProps = {
|
|
7271
|
+
value,
|
|
7272
|
+
onChange: handleInputChange,
|
|
7273
|
+
onKeyDown: handleKeyDown,
|
|
7274
|
+
placeholder,
|
|
7275
|
+
disabled,
|
|
7276
|
+
startIcon,
|
|
7277
|
+
endIcon: finalEndIcon,
|
|
7278
|
+
onEndIconClick,
|
|
7279
|
+
error
|
|
7280
|
+
};
|
|
7281
|
+
switch (fieldType) {
|
|
7282
|
+
case "DATE_TIME":
|
|
7283
|
+
return /* @__PURE__ */ jsx73(DatePicker_default, { ...commonProps });
|
|
7284
|
+
case "BOOLEAN":
|
|
7285
|
+
return /* @__PURE__ */ jsx73(
|
|
7286
|
+
Checkbox_default,
|
|
7287
|
+
{
|
|
7288
|
+
...commonProps,
|
|
7289
|
+
checked: value === "true" || Boolean(value),
|
|
7290
|
+
onChange: (e) => onValueChange(e.target.checked ? "true" : "false")
|
|
7291
|
+
}
|
|
7292
|
+
);
|
|
7293
|
+
default:
|
|
7294
|
+
return /* @__PURE__ */ jsx73(TextField_default, { ...commonProps, type });
|
|
7295
|
+
}
|
|
7296
|
+
},
|
|
7297
|
+
[placeholder, disabled, startIcon, endIcon, error, fieldType, type]
|
|
7298
|
+
);
|
|
7299
|
+
const canAddMore = !maxFields || values.length < maxFields;
|
|
7300
|
+
const canRemove = values.length > minFields;
|
|
7301
|
+
const [currentInputValue, setCurrentInputValue] = useState15("");
|
|
7302
|
+
const handleInputSubmit = useCallback9(() => {
|
|
7303
|
+
if (currentInputValue.trim() !== "") {
|
|
7304
|
+
handleAddValue(currentInputValue);
|
|
7305
|
+
setCurrentInputValue("");
|
|
7306
|
+
}
|
|
7307
|
+
}, [currentInputValue, handleAddValue]);
|
|
7308
|
+
return /* @__PURE__ */ jsxs35(
|
|
7309
|
+
FormControl_default,
|
|
7310
|
+
{
|
|
7311
|
+
error,
|
|
7312
|
+
helperText,
|
|
7313
|
+
className: clsx19(withVendorCSSClassPrefix18("multi-input"), className),
|
|
7314
|
+
style,
|
|
7315
|
+
children: [
|
|
7316
|
+
label && /* @__PURE__ */ jsx73(InputLabel_default, { required, error: !!error, children: label }),
|
|
7317
|
+
/* @__PURE__ */ jsxs35("div", { style: styles.container, children: [
|
|
7318
|
+
/* @__PURE__ */ jsx73("div", { style: styles.inputRow, children: /* @__PURE__ */ jsx73("div", { style: styles.inputWrapper, children: renderInputField(
|
|
7319
|
+
currentInputValue,
|
|
7320
|
+
setCurrentInputValue,
|
|
7321
|
+
canAddMore ? /* @__PURE__ */ jsx73(PlusIcon, { style: styles.plusIcon }) : void 0,
|
|
7322
|
+
canAddMore ? handleInputSubmit : void 0
|
|
7323
|
+
) }) }),
|
|
7324
|
+
values.length > 0 && /* @__PURE__ */ jsx73("div", { style: styles.listContainer, children: values.map((value, index) => /* @__PURE__ */ jsxs35("div", { style: styles.listItem, children: [
|
|
7325
|
+
/* @__PURE__ */ jsx73("span", { children: value }),
|
|
7326
|
+
canRemove && /* @__PURE__ */ jsx73(
|
|
7327
|
+
Button_default,
|
|
7328
|
+
{
|
|
7329
|
+
size: "small",
|
|
7330
|
+
color: "secondary",
|
|
7331
|
+
variant: "text",
|
|
7332
|
+
onClick: () => handleRemoveValue(index),
|
|
7333
|
+
disabled,
|
|
7334
|
+
title: "Remove value",
|
|
7335
|
+
style: styles.removeButton,
|
|
7336
|
+
children: /* @__PURE__ */ jsx73(BinIcon, {})
|
|
7337
|
+
}
|
|
7338
|
+
)
|
|
7339
|
+
] }, index)) })
|
|
7340
|
+
] })
|
|
7341
|
+
]
|
|
7342
|
+
}
|
|
7343
|
+
);
|
|
7344
|
+
};
|
|
7345
|
+
var MultiInput_default = MultiInput;
|
|
7346
|
+
|
|
7029
7347
|
// src/components/presentation/UserProfile/BaseUserProfile.tsx
|
|
7030
|
-
import { Fragment as Fragment16, jsx as
|
|
7348
|
+
import { Fragment as Fragment16, jsx as jsx74, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
7349
|
+
var fieldsToSkip = [
|
|
7350
|
+
"roles.default",
|
|
7351
|
+
"active",
|
|
7352
|
+
"groups",
|
|
7353
|
+
"profileUrl",
|
|
7354
|
+
"accountLocked",
|
|
7355
|
+
"accountDisabled",
|
|
7356
|
+
"oneTimePassword",
|
|
7357
|
+
"userSourceId",
|
|
7358
|
+
"idpType",
|
|
7359
|
+
"localCredentialExists",
|
|
7360
|
+
"active",
|
|
7361
|
+
"ResourceType",
|
|
7362
|
+
"ExternalID",
|
|
7363
|
+
"MetaData",
|
|
7364
|
+
"verifiedMobileNumbers",
|
|
7365
|
+
"verifiedEmailAddresses",
|
|
7366
|
+
"phoneNumbers.mobile",
|
|
7367
|
+
"emailAddresses"
|
|
7368
|
+
];
|
|
7369
|
+
var readonlyFields = ["username", "userName", "user_name"];
|
|
7031
7370
|
var BaseUserProfile = ({
|
|
7032
7371
|
fallback = null,
|
|
7033
7372
|
className = "",
|
|
@@ -7048,10 +7387,10 @@ var BaseUserProfile = ({
|
|
|
7048
7387
|
cancelButtonText = "Cancel"
|
|
7049
7388
|
}) => {
|
|
7050
7389
|
const { theme } = useTheme_default();
|
|
7051
|
-
const [editedUser, setEditedUser] =
|
|
7052
|
-
const [editingFields, setEditingFields] =
|
|
7390
|
+
const [editedUser, setEditedUser] = useState16(flattenedProfile || profile);
|
|
7391
|
+
const [editingFields, setEditingFields] = useState16({});
|
|
7053
7392
|
const triggerRef = useRef5(null);
|
|
7054
|
-
const PencilIcon = () => /* @__PURE__ */
|
|
7393
|
+
const PencilIcon = () => /* @__PURE__ */ jsx74(
|
|
7055
7394
|
"svg",
|
|
7056
7395
|
{
|
|
7057
7396
|
width: "16",
|
|
@@ -7062,16 +7401,16 @@ var BaseUserProfile = ({
|
|
|
7062
7401
|
strokeWidth: "2",
|
|
7063
7402
|
strokeLinecap: "round",
|
|
7064
7403
|
strokeLinejoin: "round",
|
|
7065
|
-
children: /* @__PURE__ */
|
|
7404
|
+
children: /* @__PURE__ */ jsx74("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
7066
7405
|
}
|
|
7067
7406
|
);
|
|
7068
|
-
const toggleFieldEdit =
|
|
7407
|
+
const toggleFieldEdit = useCallback10((fieldName) => {
|
|
7069
7408
|
setEditingFields((prev) => ({
|
|
7070
7409
|
...prev,
|
|
7071
7410
|
[fieldName]: !prev[fieldName]
|
|
7072
7411
|
}));
|
|
7073
7412
|
}, []);
|
|
7074
|
-
const getFieldPlaceholder =
|
|
7413
|
+
const getFieldPlaceholder = useCallback10((schema) => {
|
|
7075
7414
|
const { type, displayName, description, name } = schema;
|
|
7076
7415
|
const fieldLabel = displayName || description || name || "value";
|
|
7077
7416
|
switch (type) {
|
|
@@ -7087,12 +7426,12 @@ var BaseUserProfile = ({
|
|
|
7087
7426
|
}, []);
|
|
7088
7427
|
const ObjectDisplay = ({ data }) => {
|
|
7089
7428
|
if (!data || typeof data !== "object") return null;
|
|
7090
|
-
return /* @__PURE__ */
|
|
7091
|
-
/* @__PURE__ */
|
|
7429
|
+
return /* @__PURE__ */ jsx74("table", { style: { width: "100%", borderCollapse: "collapse" }, children: /* @__PURE__ */ jsx74("tbody", { children: Object.entries(data).map(([key, value]) => /* @__PURE__ */ jsxs36("tr", { style: { borderBottom: `1px solid ${theme.colors.border}` }, children: [
|
|
7430
|
+
/* @__PURE__ */ jsx74("td", { style: { padding: `${theme.spacing.unit}px`, verticalAlign: "top" }, children: /* @__PURE__ */ jsxs36("strong", { children: [
|
|
7092
7431
|
formatLabel(key),
|
|
7093
7432
|
":"
|
|
7094
7433
|
] }) }),
|
|
7095
|
-
/* @__PURE__ */
|
|
7434
|
+
/* @__PURE__ */ jsx74("td", { style: { padding: `${theme.spacing.unit}px`, verticalAlign: "top" }, children: typeof value === "object" ? /* @__PURE__ */ jsx74(ObjectDisplay, { data: value }) : String(value) })
|
|
7096
7435
|
] }, key)) }) });
|
|
7097
7436
|
};
|
|
7098
7437
|
function set(obj, path, value) {
|
|
@@ -7110,11 +7449,14 @@ var BaseUserProfile = ({
|
|
|
7110
7449
|
}
|
|
7111
7450
|
}
|
|
7112
7451
|
}
|
|
7113
|
-
const handleFieldSave =
|
|
7452
|
+
const handleFieldSave = useCallback10(
|
|
7114
7453
|
(schema) => {
|
|
7115
7454
|
if (!onUpdate || !schema.name) return;
|
|
7116
7455
|
const fieldName = schema.name;
|
|
7117
|
-
|
|
7456
|
+
let fieldValue = editedUser && fieldName && editedUser[fieldName] !== void 0 ? editedUser[fieldName] : flattenedProfile && flattenedProfile[fieldName] !== void 0 ? flattenedProfile[fieldName] : "";
|
|
7457
|
+
if (Array.isArray(fieldValue)) {
|
|
7458
|
+
fieldValue = fieldValue.filter((v) => v !== void 0 && v !== null && v !== "");
|
|
7459
|
+
}
|
|
7118
7460
|
let payload = {};
|
|
7119
7461
|
if (schema.schemaId && schema.schemaId !== WellKnownSchemaIds.User) {
|
|
7120
7462
|
payload = {
|
|
@@ -7130,7 +7472,7 @@ var BaseUserProfile = ({
|
|
|
7130
7472
|
},
|
|
7131
7473
|
[editedUser, flattenedProfile, onUpdate, toggleFieldEdit]
|
|
7132
7474
|
);
|
|
7133
|
-
const handleFieldCancel =
|
|
7475
|
+
const handleFieldCancel = useCallback10(
|
|
7134
7476
|
(fieldName) => {
|
|
7135
7477
|
const currentUser2 = flattenedProfile || profile;
|
|
7136
7478
|
setEditedUser((prev) => ({
|
|
@@ -7141,12 +7483,12 @@ var BaseUserProfile = ({
|
|
|
7141
7483
|
},
|
|
7142
7484
|
[flattenedProfile, profile, toggleFieldEdit]
|
|
7143
7485
|
);
|
|
7144
|
-
const formatLabel =
|
|
7486
|
+
const formatLabel = useCallback10(
|
|
7145
7487
|
(key) => key.split(/(?=[A-Z])|_/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" "),
|
|
7146
7488
|
[]
|
|
7147
7489
|
);
|
|
7148
|
-
const styles =
|
|
7149
|
-
const buttonStyle =
|
|
7490
|
+
const styles = useStyles5();
|
|
7491
|
+
const buttonStyle = useMemo15(
|
|
7150
7492
|
() => ({
|
|
7151
7493
|
padding: `${theme.spacing.unit}px ${theme.spacing.unit * 2}px`,
|
|
7152
7494
|
margin: `${theme.spacing.unit}px`,
|
|
@@ -7158,7 +7500,7 @@ var BaseUserProfile = ({
|
|
|
7158
7500
|
}),
|
|
7159
7501
|
[theme]
|
|
7160
7502
|
);
|
|
7161
|
-
const saveButtonStyle =
|
|
7503
|
+
const saveButtonStyle = useMemo15(
|
|
7162
7504
|
() => ({
|
|
7163
7505
|
...buttonStyle,
|
|
7164
7506
|
backgroundColor: theme.colors.primary.main,
|
|
@@ -7166,7 +7508,7 @@ var BaseUserProfile = ({
|
|
|
7166
7508
|
}),
|
|
7167
7509
|
[theme, buttonStyle]
|
|
7168
7510
|
);
|
|
7169
|
-
const cancelButtonStyle =
|
|
7511
|
+
const cancelButtonStyle = useMemo15(
|
|
7170
7512
|
() => ({
|
|
7171
7513
|
...buttonStyle,
|
|
7172
7514
|
backgroundColor: theme.colors.secondary.main,
|
|
@@ -7184,28 +7526,66 @@ var BaseUserProfile = ({
|
|
|
7184
7526
|
const mergedMappings = { ...defaultAttributeMappings, ...attributeMapping };
|
|
7185
7527
|
const renderSchemaField = (schema, isEditing, onEditValue, onStartEdit) => {
|
|
7186
7528
|
if (!schema) return null;
|
|
7187
|
-
const { value, displayName, description, name, type, required, mutability, subAttributes } = schema;
|
|
7529
|
+
const { value, displayName, description, name, type, required, mutability, subAttributes, multiValued } = schema;
|
|
7188
7530
|
const label = displayName || description || name || "";
|
|
7189
7531
|
if (subAttributes && Array.isArray(subAttributes)) {
|
|
7190
|
-
return /* @__PURE__ */
|
|
7191
|
-
/* @__PURE__ */
|
|
7192
|
-
/* @__PURE__ */
|
|
7532
|
+
return /* @__PURE__ */ jsx74(Fragment16, { children: subAttributes.map((subAttr, index) => /* @__PURE__ */ jsxs36("div", { style: styles.field, children: [
|
|
7533
|
+
/* @__PURE__ */ jsx74("span", { style: styles.label, children: subAttr.displayName || subAttr.description || "" }),
|
|
7534
|
+
/* @__PURE__ */ jsx74("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) })
|
|
7193
7535
|
] }, index)) });
|
|
7194
7536
|
}
|
|
7195
|
-
if (Array.isArray(value)) {
|
|
7196
|
-
const hasValues = value.length > 0;
|
|
7197
|
-
const isEditable2 = editable && mutability !== "READ_ONLY";
|
|
7537
|
+
if (Array.isArray(value) || multiValued) {
|
|
7538
|
+
const hasValues = Array.isArray(value) ? value.length > 0 : value !== void 0 && value !== null && value !== "";
|
|
7539
|
+
const isEditable2 = editable && mutability !== "READ_ONLY" && !readonlyFields.includes(name || "");
|
|
7540
|
+
if (isEditing && onEditValue && isEditable2) {
|
|
7541
|
+
const currentValue = editedUser && name && editedUser[name] !== void 0 ? editedUser[name] : flattenedProfile && name && flattenedProfile[name] !== void 0 ? flattenedProfile[name] : value;
|
|
7542
|
+
let fieldValues;
|
|
7543
|
+
if (Array.isArray(currentValue)) {
|
|
7544
|
+
fieldValues = currentValue.map(String);
|
|
7545
|
+
} else if (currentValue !== void 0 && currentValue !== null && currentValue !== "") {
|
|
7546
|
+
fieldValues = [String(currentValue)];
|
|
7547
|
+
} else {
|
|
7548
|
+
fieldValues = [];
|
|
7549
|
+
}
|
|
7550
|
+
return /* @__PURE__ */ jsxs36(Fragment16, { children: [
|
|
7551
|
+
/* @__PURE__ */ jsx74("span", { style: styles.label, children: label }),
|
|
7552
|
+
/* @__PURE__ */ jsx74("div", { style: styles.value, children: /* @__PURE__ */ jsx74(
|
|
7553
|
+
MultiInput_default,
|
|
7554
|
+
{
|
|
7555
|
+
values: fieldValues,
|
|
7556
|
+
onChange: (newValues) => {
|
|
7557
|
+
if (multiValued || Array.isArray(currentValue)) {
|
|
7558
|
+
onEditValue(newValues);
|
|
7559
|
+
} else {
|
|
7560
|
+
onEditValue(newValues[0] || "");
|
|
7561
|
+
}
|
|
7562
|
+
},
|
|
7563
|
+
placeholder: getFieldPlaceholder(schema),
|
|
7564
|
+
fieldType: type,
|
|
7565
|
+
type: type === "DATE_TIME" ? "date" : type === "STRING" ? "text" : "text",
|
|
7566
|
+
required,
|
|
7567
|
+
style: {
|
|
7568
|
+
marginBottom: 0
|
|
7569
|
+
}
|
|
7570
|
+
}
|
|
7571
|
+
) })
|
|
7572
|
+
] });
|
|
7573
|
+
}
|
|
7198
7574
|
let displayValue2;
|
|
7199
7575
|
if (hasValues) {
|
|
7200
|
-
|
|
7576
|
+
if (Array.isArray(value)) {
|
|
7577
|
+
displayValue2 = value.map((item) => typeof item === "object" ? JSON.stringify(item) : String(item)).join(", ");
|
|
7578
|
+
} else {
|
|
7579
|
+
displayValue2 = String(value);
|
|
7580
|
+
}
|
|
7201
7581
|
} else if (isEditable2) {
|
|
7202
7582
|
displayValue2 = getFieldPlaceholder(schema);
|
|
7203
7583
|
} else {
|
|
7204
7584
|
displayValue2 = "-";
|
|
7205
7585
|
}
|
|
7206
|
-
return /* @__PURE__ */
|
|
7207
|
-
/* @__PURE__ */
|
|
7208
|
-
/* @__PURE__ */
|
|
7586
|
+
return /* @__PURE__ */ jsxs36(Fragment16, { children: [
|
|
7587
|
+
/* @__PURE__ */ jsx74("span", { style: styles.label, children: label }),
|
|
7588
|
+
/* @__PURE__ */ jsx74("div", { style: { ...styles.value, fontStyle: hasValues ? "normal" : "italic", opacity: hasValues ? 1 : 0.7 }, children: !hasValues && isEditable2 && onStartEdit ? /* @__PURE__ */ jsx74(
|
|
7209
7589
|
"button",
|
|
7210
7590
|
{
|
|
7211
7591
|
onClick: onStartEdit,
|
|
@@ -7227,9 +7607,9 @@ var BaseUserProfile = ({
|
|
|
7227
7607
|
] });
|
|
7228
7608
|
}
|
|
7229
7609
|
if (type === "COMPLEX" && typeof value === "object") {
|
|
7230
|
-
return /* @__PURE__ */
|
|
7610
|
+
return /* @__PURE__ */ jsx74(ObjectDisplay, { data: value });
|
|
7231
7611
|
}
|
|
7232
|
-
if (isEditing && onEditValue && mutability !== "READ_ONLY") {
|
|
7612
|
+
if (isEditing && onEditValue && mutability !== "READ_ONLY" && !readonlyFields.includes(name || "")) {
|
|
7233
7613
|
const fieldValue = editedUser && name && editedUser[name] !== void 0 ? editedUser[name] : flattenedProfile && name && flattenedProfile[name] !== void 0 ? flattenedProfile[name] : value || "";
|
|
7234
7614
|
const commonProps = {
|
|
7235
7615
|
label: void 0,
|
|
@@ -7245,16 +7625,16 @@ var BaseUserProfile = ({
|
|
|
7245
7625
|
let field;
|
|
7246
7626
|
switch (type) {
|
|
7247
7627
|
case "STRING":
|
|
7248
|
-
field = /* @__PURE__ */
|
|
7628
|
+
field = /* @__PURE__ */ jsx74(TextField_default, { ...commonProps });
|
|
7249
7629
|
break;
|
|
7250
7630
|
case "DATE_TIME":
|
|
7251
|
-
field = /* @__PURE__ */
|
|
7631
|
+
field = /* @__PURE__ */ jsx74(DatePicker_default, { ...commonProps });
|
|
7252
7632
|
break;
|
|
7253
7633
|
case "BOOLEAN":
|
|
7254
|
-
field = /* @__PURE__ */
|
|
7634
|
+
field = /* @__PURE__ */ jsx74(Checkbox_default, { ...commonProps, checked: !!fieldValue, onChange: (e) => onEditValue(e.target.checked) });
|
|
7255
7635
|
break;
|
|
7256
7636
|
case "COMPLEX":
|
|
7257
|
-
field = /* @__PURE__ */
|
|
7637
|
+
field = /* @__PURE__ */ jsx74(
|
|
7258
7638
|
"textarea",
|
|
7259
7639
|
{
|
|
7260
7640
|
value: fieldValue,
|
|
@@ -7274,15 +7654,15 @@ var BaseUserProfile = ({
|
|
|
7274
7654
|
);
|
|
7275
7655
|
break;
|
|
7276
7656
|
default:
|
|
7277
|
-
field = /* @__PURE__ */
|
|
7657
|
+
field = /* @__PURE__ */ jsx74(TextField_default, { ...commonProps });
|
|
7278
7658
|
}
|
|
7279
|
-
return /* @__PURE__ */
|
|
7280
|
-
/* @__PURE__ */
|
|
7281
|
-
/* @__PURE__ */
|
|
7659
|
+
return /* @__PURE__ */ jsxs36(Fragment16, { children: [
|
|
7660
|
+
/* @__PURE__ */ jsx74("span", { style: styles.label, children: label }),
|
|
7661
|
+
/* @__PURE__ */ jsx74("div", { style: styles.value, children: field })
|
|
7282
7662
|
] });
|
|
7283
7663
|
}
|
|
7284
7664
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
7285
|
-
const isEditable = editable && mutability !== "READ_ONLY";
|
|
7665
|
+
const isEditable = editable && mutability !== "READ_ONLY" && !readonlyFields.includes(name || "");
|
|
7286
7666
|
let displayValue;
|
|
7287
7667
|
if (hasValue) {
|
|
7288
7668
|
displayValue = String(value);
|
|
@@ -7291,9 +7671,9 @@ var BaseUserProfile = ({
|
|
|
7291
7671
|
} else {
|
|
7292
7672
|
displayValue = "-";
|
|
7293
7673
|
}
|
|
7294
|
-
return /* @__PURE__ */
|
|
7295
|
-
/* @__PURE__ */
|
|
7296
|
-
/* @__PURE__ */
|
|
7674
|
+
return /* @__PURE__ */ jsxs36(Fragment16, { children: [
|
|
7675
|
+
/* @__PURE__ */ jsx74("span", { style: styles.label, children: label }),
|
|
7676
|
+
/* @__PURE__ */ jsx74("div", { style: { ...styles.value, fontStyle: hasValue ? "normal" : "italic", opacity: hasValue ? 1 : 0.7 }, children: !hasValue && isEditable && onStartEdit ? /* @__PURE__ */ jsx74(
|
|
7297
7677
|
"button",
|
|
7298
7678
|
{
|
|
7299
7679
|
onClick: onStartEdit,
|
|
@@ -7318,6 +7698,7 @@ var BaseUserProfile = ({
|
|
|
7318
7698
|
if (!schema || !schema.name) return null;
|
|
7319
7699
|
const hasValue = schema.value !== void 0 && schema.value !== "" && schema.value !== null;
|
|
7320
7700
|
const isFieldEditing = editingFields[schema.name];
|
|
7701
|
+
const isReadonlyField = readonlyFields.includes(schema.name);
|
|
7321
7702
|
const shouldShow = hasValue || isFieldEditing || editable && schema.mutability === "READ_WRITE";
|
|
7322
7703
|
if (!shouldShow) {
|
|
7323
7704
|
return null;
|
|
@@ -7328,8 +7709,8 @@ var BaseUserProfile = ({
|
|
|
7328
7709
|
alignItems: "center",
|
|
7329
7710
|
gap: `${theme.spacing.unit}px`
|
|
7330
7711
|
};
|
|
7331
|
-
return /* @__PURE__ */
|
|
7332
|
-
/* @__PURE__ */
|
|
7712
|
+
return /* @__PURE__ */ jsxs36("div", { style: fieldStyle, children: [
|
|
7713
|
+
/* @__PURE__ */ jsx74("div", { style: { flex: 1, display: "flex", alignItems: "center", gap: `${theme.spacing.unit}px` }, children: renderSchemaField(
|
|
7333
7714
|
schema,
|
|
7334
7715
|
isFieldEditing,
|
|
7335
7716
|
(value) => {
|
|
@@ -7339,7 +7720,7 @@ var BaseUserProfile = ({
|
|
|
7339
7720
|
},
|
|
7340
7721
|
() => toggleFieldEdit(schema.name)
|
|
7341
7722
|
) }),
|
|
7342
|
-
editable && schema.mutability !== "READ_ONLY" && /* @__PURE__ */
|
|
7723
|
+
editable && schema.mutability !== "READ_ONLY" && !isReadonlyField && /* @__PURE__ */ jsxs36(
|
|
7343
7724
|
"div",
|
|
7344
7725
|
{
|
|
7345
7726
|
style: {
|
|
@@ -7349,9 +7730,9 @@ var BaseUserProfile = ({
|
|
|
7349
7730
|
marginLeft: `${theme.spacing.unit}px`
|
|
7350
7731
|
},
|
|
7351
7732
|
children: [
|
|
7352
|
-
isFieldEditing && /* @__PURE__ */
|
|
7353
|
-
/* @__PURE__ */
|
|
7354
|
-
/* @__PURE__ */
|
|
7733
|
+
isFieldEditing && /* @__PURE__ */ jsxs36(Fragment16, { children: [
|
|
7734
|
+
/* @__PURE__ */ jsx74(Button_default, { size: "small", color: "primary", variant: "solid", onClick: () => handleFieldSave(schema), children: "Save" }),
|
|
7735
|
+
/* @__PURE__ */ jsx74(
|
|
7355
7736
|
Button_default,
|
|
7356
7737
|
{
|
|
7357
7738
|
size: "small",
|
|
@@ -7362,7 +7743,7 @@ var BaseUserProfile = ({
|
|
|
7362
7743
|
}
|
|
7363
7744
|
)
|
|
7364
7745
|
] }),
|
|
7365
|
-
!isFieldEditing && hasValue && /* @__PURE__ */
|
|
7746
|
+
!isFieldEditing && hasValue && /* @__PURE__ */ jsx74(
|
|
7366
7747
|
Button_default,
|
|
7367
7748
|
{
|
|
7368
7749
|
size: "small",
|
|
@@ -7373,7 +7754,7 @@ var BaseUserProfile = ({
|
|
|
7373
7754
|
style: {
|
|
7374
7755
|
padding: `${theme.spacing.unit / 2}px`
|
|
7375
7756
|
},
|
|
7376
|
-
children: /* @__PURE__ */
|
|
7757
|
+
children: /* @__PURE__ */ jsx74(PencilIcon, {})
|
|
7377
7758
|
}
|
|
7378
7759
|
)
|
|
7379
7760
|
]
|
|
@@ -7400,9 +7781,8 @@ var BaseUserProfile = ({
|
|
|
7400
7781
|
const currentUser = flattenedProfile || profile;
|
|
7401
7782
|
const avatarAttributes = ["picture"];
|
|
7402
7783
|
const excludedProps = avatarAttributes.map((attr) => mergedMappings[attr] || attr);
|
|
7403
|
-
const
|
|
7404
|
-
|
|
7405
|
-
/* @__PURE__ */ jsx73("div", { style: styles.header, children: /* @__PURE__ */ jsx73(
|
|
7784
|
+
const profileContent = /* @__PURE__ */ jsxs36(Card_default, { style: containerStyle, className: clsx20(withVendorCSSClassPrefix19("user-profile"), className), children: [
|
|
7785
|
+
/* @__PURE__ */ jsx74("div", { style: styles.header, children: /* @__PURE__ */ jsx74(
|
|
7406
7786
|
Avatar,
|
|
7407
7787
|
{
|
|
7408
7788
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, currentUser),
|
|
@@ -7411,7 +7791,7 @@ var BaseUserProfile = ({
|
|
|
7411
7791
|
alt: `${getDisplayName()}'s avatar`
|
|
7412
7792
|
}
|
|
7413
7793
|
) }),
|
|
7414
|
-
/* @__PURE__ */
|
|
7794
|
+
/* @__PURE__ */ jsx74("div", { style: styles.infoContainer, children: schemas.filter((schema) => {
|
|
7415
7795
|
if (!schema.name || schema.name === "profileUrl") return false;
|
|
7416
7796
|
if (fieldsToSkip.includes(schema.name)) return false;
|
|
7417
7797
|
if (!editable) {
|
|
@@ -7429,20 +7809,20 @@ var BaseUserProfile = ({
|
|
|
7429
7809
|
...schema,
|
|
7430
7810
|
value
|
|
7431
7811
|
};
|
|
7432
|
-
return /* @__PURE__ */
|
|
7812
|
+
return /* @__PURE__ */ jsx74("div", { children: renderUserInfo(schemaWithValue) }, schema.name || index);
|
|
7433
7813
|
}) })
|
|
7434
7814
|
] });
|
|
7435
7815
|
if (mode === "popup") {
|
|
7436
|
-
return /* @__PURE__ */
|
|
7437
|
-
/* @__PURE__ */
|
|
7438
|
-
/* @__PURE__ */
|
|
7816
|
+
return /* @__PURE__ */ jsx74(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs36(DialogContent, { children: [
|
|
7817
|
+
/* @__PURE__ */ jsx74(DialogHeading, { children: title }),
|
|
7818
|
+
/* @__PURE__ */ jsx74("div", { style: { padding: "1rem" }, children: profileContent })
|
|
7439
7819
|
] }) });
|
|
7440
7820
|
}
|
|
7441
7821
|
return profileContent;
|
|
7442
7822
|
};
|
|
7443
|
-
var
|
|
7823
|
+
var useStyles5 = () => {
|
|
7444
7824
|
const { theme, colorScheme } = useTheme_default();
|
|
7445
|
-
return
|
|
7825
|
+
return useMemo15(
|
|
7446
7826
|
() => ({
|
|
7447
7827
|
root: {
|
|
7448
7828
|
padding: `${theme.spacing.unit * 4}px`,
|
|
@@ -7499,7 +7879,7 @@ var useStyles4 = () => {
|
|
|
7499
7879
|
gap: `${theme.spacing.unit}px`,
|
|
7500
7880
|
overflow: "hidden",
|
|
7501
7881
|
minHeight: "32px",
|
|
7502
|
-
"& input
|
|
7882
|
+
"& input": {
|
|
7503
7883
|
height: "32px",
|
|
7504
7884
|
margin: 0
|
|
7505
7885
|
},
|
|
@@ -7552,15 +7932,15 @@ var updateMeProfile = async ({ fetcher, ...requestConfig }) => {
|
|
|
7552
7932
|
var updateMeProfile_default = updateMeProfile;
|
|
7553
7933
|
|
|
7554
7934
|
// src/components/presentation/UserProfile/UserProfile.tsx
|
|
7555
|
-
import { jsx as
|
|
7935
|
+
import { jsx as jsx75 } from "react/jsx-runtime";
|
|
7556
7936
|
var UserProfile3 = ({ ...rest }) => {
|
|
7557
7937
|
const { baseUrl } = useAsgardeo_default();
|
|
7558
|
-
const { profile, flattenedProfile, schemas,
|
|
7938
|
+
const { profile, flattenedProfile, schemas, onUpdateProfile } = useUser_default();
|
|
7559
7939
|
const handleProfileUpdate = async (payload) => {
|
|
7560
|
-
await updateMeProfile_default({ baseUrl, payload });
|
|
7561
|
-
|
|
7940
|
+
const response = await updateMeProfile_default({ baseUrl, payload });
|
|
7941
|
+
onUpdateProfile(response);
|
|
7562
7942
|
};
|
|
7563
|
-
return /* @__PURE__ */
|
|
7943
|
+
return /* @__PURE__ */ jsx75(
|
|
7564
7944
|
BaseUserProfile_default,
|
|
7565
7945
|
{
|
|
7566
7946
|
profile,
|
|
@@ -7574,7 +7954,7 @@ var UserProfile3 = ({ ...rest }) => {
|
|
|
7574
7954
|
var UserProfile_default = UserProfile3;
|
|
7575
7955
|
|
|
7576
7956
|
// src/components/presentation/UserDropdown/BaseUserDropdown.tsx
|
|
7577
|
-
import { withVendorCSSClassPrefix as
|
|
7957
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix20 } from "@asgardeo/browser";
|
|
7578
7958
|
import {
|
|
7579
7959
|
useFloating as useFloating2,
|
|
7580
7960
|
autoUpdate as autoUpdate2,
|
|
@@ -7588,12 +7968,12 @@ import {
|
|
|
7588
7968
|
FloatingFocusManager as FloatingFocusManager2,
|
|
7589
7969
|
FloatingPortal as FloatingPortal2
|
|
7590
7970
|
} from "@floating-ui/react";
|
|
7591
|
-
import
|
|
7592
|
-
import { useMemo as
|
|
7593
|
-
import { jsx as
|
|
7594
|
-
var
|
|
7971
|
+
import clsx21 from "clsx";
|
|
7972
|
+
import { useMemo as useMemo16, useState as useState17 } from "react";
|
|
7973
|
+
import { jsx as jsx76, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
7974
|
+
var useStyles6 = () => {
|
|
7595
7975
|
const { theme, colorScheme } = useTheme_default();
|
|
7596
|
-
return
|
|
7976
|
+
return useMemo16(
|
|
7597
7977
|
() => ({
|
|
7598
7978
|
trigger: {
|
|
7599
7979
|
display: "inline-flex",
|
|
@@ -7731,9 +8111,9 @@ var BaseUserDropdown = ({
|
|
|
7731
8111
|
onSignOut,
|
|
7732
8112
|
attributeMapping = {}
|
|
7733
8113
|
}) => {
|
|
7734
|
-
const styles =
|
|
7735
|
-
const [isOpen, setIsOpen] =
|
|
7736
|
-
const [hoveredItemIndex, setHoveredItemIndex] =
|
|
8114
|
+
const styles = useStyles6();
|
|
8115
|
+
const [isOpen, setIsOpen] = useState17(false);
|
|
8116
|
+
const [hoveredItemIndex, setHoveredItemIndex] = useState17(null);
|
|
7737
8117
|
const { theme, colorScheme } = useTheme_default();
|
|
7738
8118
|
const hoverBackgroundColor = colorScheme === "dark" ? "rgba(255, 255, 255, 0.08)" : "rgba(0, 0, 0, 0.04)";
|
|
7739
8119
|
const { refs, floatingStyles, context } = useFloating2({
|
|
@@ -7777,14 +8157,14 @@ var BaseUserDropdown = ({
|
|
|
7777
8157
|
defaultMenuItems.push({
|
|
7778
8158
|
label: "Manage Profile",
|
|
7779
8159
|
onClick: onManageProfile,
|
|
7780
|
-
icon: /* @__PURE__ */
|
|
8160
|
+
icon: /* @__PURE__ */ jsx76(User_default2, { width: "16", height: "16" })
|
|
7781
8161
|
});
|
|
7782
8162
|
}
|
|
7783
8163
|
if (onSignOut) {
|
|
7784
8164
|
defaultMenuItems.push({
|
|
7785
8165
|
label: "Sign Out",
|
|
7786
8166
|
onClick: onSignOut,
|
|
7787
|
-
icon: /* @__PURE__ */
|
|
8167
|
+
icon: /* @__PURE__ */ jsx76(LogOut_default, { width: "16", height: "16" })
|
|
7788
8168
|
});
|
|
7789
8169
|
}
|
|
7790
8170
|
const allMenuItems = [...menuItems];
|
|
@@ -7794,19 +8174,19 @@ var BaseUserDropdown = ({
|
|
|
7794
8174
|
}
|
|
7795
8175
|
allMenuItems.push(...defaultMenuItems);
|
|
7796
8176
|
}
|
|
7797
|
-
return /* @__PURE__ */
|
|
7798
|
-
/* @__PURE__ */
|
|
8177
|
+
return /* @__PURE__ */ jsxs37("div", { className: clsx21(withVendorCSSClassPrefix20("user-dropdown"), className), children: [
|
|
8178
|
+
/* @__PURE__ */ jsxs37(
|
|
7799
8179
|
Button_default,
|
|
7800
8180
|
{
|
|
7801
8181
|
ref: refs.setReference,
|
|
7802
|
-
className:
|
|
8182
|
+
className: withVendorCSSClassPrefix20("user-dropdown__trigger"),
|
|
7803
8183
|
style: styles.trigger,
|
|
7804
8184
|
color: "tertiary",
|
|
7805
8185
|
variant: "text",
|
|
7806
8186
|
size: "medium",
|
|
7807
8187
|
...getReferenceProps(),
|
|
7808
8188
|
children: [
|
|
7809
|
-
/* @__PURE__ */
|
|
8189
|
+
/* @__PURE__ */ jsx76(
|
|
7810
8190
|
Avatar,
|
|
7811
8191
|
{
|
|
7812
8192
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -7815,11 +8195,11 @@ var BaseUserDropdown = ({
|
|
|
7815
8195
|
alt: `${getDisplayName()}'s avatar`
|
|
7816
8196
|
}
|
|
7817
8197
|
),
|
|
7818
|
-
showTriggerLabel && /* @__PURE__ */
|
|
8198
|
+
showTriggerLabel && /* @__PURE__ */ jsx76(
|
|
7819
8199
|
Typography_default,
|
|
7820
8200
|
{
|
|
7821
8201
|
variant: "body2",
|
|
7822
|
-
className:
|
|
8202
|
+
className: withVendorCSSClassPrefix20("user-dropdown__trigger-label"),
|
|
7823
8203
|
style: styles.userName,
|
|
7824
8204
|
children: getDisplayName()
|
|
7825
8205
|
}
|
|
@@ -7827,16 +8207,16 @@ var BaseUserDropdown = ({
|
|
|
7827
8207
|
]
|
|
7828
8208
|
}
|
|
7829
8209
|
),
|
|
7830
|
-
isOpen && /* @__PURE__ */
|
|
8210
|
+
isOpen && /* @__PURE__ */ jsx76(FloatingPortal2, { id: portalId, children: /* @__PURE__ */ jsx76(FloatingFocusManager2, { context, modal: false, children: /* @__PURE__ */ jsxs37(
|
|
7831
8211
|
"div",
|
|
7832
8212
|
{
|
|
7833
8213
|
ref: refs.setFloating,
|
|
7834
|
-
className:
|
|
8214
|
+
className: withVendorCSSClassPrefix20("user-dropdown__content"),
|
|
7835
8215
|
style: { ...floatingStyles, ...styles.dropdownContent },
|
|
7836
8216
|
...getFloatingProps(),
|
|
7837
8217
|
children: [
|
|
7838
|
-
/* @__PURE__ */
|
|
7839
|
-
/* @__PURE__ */
|
|
8218
|
+
/* @__PURE__ */ jsxs37("div", { className: withVendorCSSClassPrefix20("user-dropdown__header"), style: styles.dropdownHeader, children: [
|
|
8219
|
+
/* @__PURE__ */ jsx76(
|
|
7840
8220
|
Avatar,
|
|
7841
8221
|
{
|
|
7842
8222
|
imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, user),
|
|
@@ -7845,22 +8225,22 @@ var BaseUserDropdown = ({
|
|
|
7845
8225
|
alt: `${getDisplayName()}'s avatar`
|
|
7846
8226
|
}
|
|
7847
8227
|
),
|
|
7848
|
-
/* @__PURE__ */
|
|
7849
|
-
/* @__PURE__ */
|
|
8228
|
+
/* @__PURE__ */ jsxs37("div", { className: withVendorCSSClassPrefix20("user-dropdown__header-info"), style: styles.headerInfo, children: [
|
|
8229
|
+
/* @__PURE__ */ jsx76(
|
|
7850
8230
|
Typography_default,
|
|
7851
8231
|
{
|
|
7852
8232
|
noWrap: true,
|
|
7853
|
-
className:
|
|
8233
|
+
className: withVendorCSSClassPrefix20("user-dropdown__header-name"),
|
|
7854
8234
|
variant: "body1",
|
|
7855
8235
|
fontWeight: "medium",
|
|
7856
8236
|
children: getDisplayName()
|
|
7857
8237
|
}
|
|
7858
8238
|
),
|
|
7859
|
-
/* @__PURE__ */
|
|
8239
|
+
/* @__PURE__ */ jsx76(
|
|
7860
8240
|
Typography_default,
|
|
7861
8241
|
{
|
|
7862
8242
|
noWrap: true,
|
|
7863
|
-
className:
|
|
8243
|
+
className: withVendorCSSClassPrefix20("user-dropdown__header-email"),
|
|
7864
8244
|
variant: "caption",
|
|
7865
8245
|
color: "secondary",
|
|
7866
8246
|
children: getMappedUserProfileValue_default("username", mergedMappings, user) || getMappedUserProfileValue_default("email", mergedMappings, user)
|
|
@@ -7868,10 +8248,10 @@ var BaseUserDropdown = ({
|
|
|
7868
8248
|
)
|
|
7869
8249
|
] })
|
|
7870
8250
|
] }),
|
|
7871
|
-
/* @__PURE__ */
|
|
8251
|
+
/* @__PURE__ */ jsx76("div", { className: withVendorCSSClassPrefix20("user-dropdown__menu"), style: styles.dropdownMenu, children: allMenuItems.map((item, index) => /* @__PURE__ */ jsx76("div", { children: item.label === "" ? (
|
|
7872
8252
|
// Render divider for empty label placeholder
|
|
7873
|
-
/* @__PURE__ */
|
|
7874
|
-
) : item.href ? /* @__PURE__ */
|
|
8253
|
+
/* @__PURE__ */ jsx76("div", { className: withVendorCSSClassPrefix20("user-dropdown__menu-divider"), style: styles.divider })
|
|
8254
|
+
) : item.href ? /* @__PURE__ */ jsxs37(
|
|
7875
8255
|
"a",
|
|
7876
8256
|
{
|
|
7877
8257
|
href: item.href,
|
|
@@ -7879,17 +8259,17 @@ var BaseUserDropdown = ({
|
|
|
7879
8259
|
...styles.menuItemAnchor,
|
|
7880
8260
|
backgroundColor: hoveredItemIndex === index ? hoverBackgroundColor : "transparent"
|
|
7881
8261
|
},
|
|
7882
|
-
className:
|
|
8262
|
+
className: withVendorCSSClassPrefix20("user-dropdown__menu-item"),
|
|
7883
8263
|
onMouseEnter: () => setHoveredItemIndex(index),
|
|
7884
8264
|
onMouseLeave: () => setHoveredItemIndex(null),
|
|
7885
8265
|
onFocus: () => setHoveredItemIndex(index),
|
|
7886
8266
|
onBlur: () => setHoveredItemIndex(null),
|
|
7887
8267
|
children: [
|
|
7888
8268
|
item.icon,
|
|
7889
|
-
/* @__PURE__ */
|
|
8269
|
+
/* @__PURE__ */ jsx76("span", { children: item.label })
|
|
7890
8270
|
]
|
|
7891
8271
|
}
|
|
7892
|
-
) : /* @__PURE__ */
|
|
8272
|
+
) : /* @__PURE__ */ jsx76(
|
|
7893
8273
|
Button_default,
|
|
7894
8274
|
{
|
|
7895
8275
|
onClick: () => handleMenuItemClick(item),
|
|
@@ -7897,7 +8277,7 @@ var BaseUserDropdown = ({
|
|
|
7897
8277
|
...styles.menuItem,
|
|
7898
8278
|
backgroundColor: hoveredItemIndex === index ? hoverBackgroundColor : "transparent"
|
|
7899
8279
|
},
|
|
7900
|
-
className:
|
|
8280
|
+
className: withVendorCSSClassPrefix20("user-dropdown__menu-item"),
|
|
7901
8281
|
color: "tertiary",
|
|
7902
8282
|
variant: "text",
|
|
7903
8283
|
size: "small",
|
|
@@ -7915,8 +8295,8 @@ var BaseUserDropdown = ({
|
|
|
7915
8295
|
var BaseUserDropdown_default = BaseUserDropdown;
|
|
7916
8296
|
|
|
7917
8297
|
// src/components/presentation/UserDropdown/UserDropdown.tsx
|
|
7918
|
-
import { useState as
|
|
7919
|
-
import { Fragment as Fragment17, jsx as
|
|
8298
|
+
import { useState as useState18 } from "react";
|
|
8299
|
+
import { Fragment as Fragment17, jsx as jsx77, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
7920
8300
|
var UserDropdown = ({
|
|
7921
8301
|
children,
|
|
7922
8302
|
renderTrigger,
|
|
@@ -7925,7 +8305,7 @@ var UserDropdown = ({
|
|
|
7925
8305
|
...rest
|
|
7926
8306
|
}) => {
|
|
7927
8307
|
const { user, isLoading, signOut } = useAsgardeo_default();
|
|
7928
|
-
const [isProfileOpen, setIsProfileOpen] =
|
|
8308
|
+
const [isProfileOpen, setIsProfileOpen] = useState18(false);
|
|
7929
8309
|
const handleManageProfile = () => {
|
|
7930
8310
|
setIsProfileOpen(true);
|
|
7931
8311
|
};
|
|
@@ -7945,14 +8325,14 @@ var UserDropdown = ({
|
|
|
7945
8325
|
closeProfile
|
|
7946
8326
|
};
|
|
7947
8327
|
if (children) {
|
|
7948
|
-
return /* @__PURE__ */
|
|
8328
|
+
return /* @__PURE__ */ jsxs38(Fragment17, { children: [
|
|
7949
8329
|
children(renderProps),
|
|
7950
|
-
/* @__PURE__ */
|
|
8330
|
+
/* @__PURE__ */ jsx77(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
7951
8331
|
] });
|
|
7952
8332
|
}
|
|
7953
8333
|
if (renderTrigger || renderDropdown) {
|
|
7954
|
-
return /* @__PURE__ */
|
|
7955
|
-
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */
|
|
8334
|
+
return /* @__PURE__ */ jsxs38(Fragment17, { children: [
|
|
8335
|
+
renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */ jsx77(
|
|
7956
8336
|
BaseUserDropdown_default,
|
|
7957
8337
|
{
|
|
7958
8338
|
user,
|
|
@@ -7962,11 +8342,11 @@ var UserDropdown = ({
|
|
|
7962
8342
|
...rest
|
|
7963
8343
|
}
|
|
7964
8344
|
),
|
|
7965
|
-
/* @__PURE__ */
|
|
8345
|
+
/* @__PURE__ */ jsx77(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
7966
8346
|
] });
|
|
7967
8347
|
}
|
|
7968
|
-
return /* @__PURE__ */
|
|
7969
|
-
/* @__PURE__ */
|
|
8348
|
+
return /* @__PURE__ */ jsxs38(Fragment17, { children: [
|
|
8349
|
+
/* @__PURE__ */ jsx77(
|
|
7970
8350
|
BaseUserDropdown_default,
|
|
7971
8351
|
{
|
|
7972
8352
|
user,
|
|
@@ -7976,13 +8356,13 @@ var UserDropdown = ({
|
|
|
7976
8356
|
...rest
|
|
7977
8357
|
}
|
|
7978
8358
|
),
|
|
7979
|
-
isProfileOpen && /* @__PURE__ */
|
|
8359
|
+
isProfileOpen && /* @__PURE__ */ jsx77(UserProfile_default, { mode: "popup", open: isProfileOpen, onOpenChange: setIsProfileOpen })
|
|
7980
8360
|
] });
|
|
7981
8361
|
};
|
|
7982
8362
|
var UserDropdown_default = UserDropdown;
|
|
7983
8363
|
|
|
7984
8364
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx
|
|
7985
|
-
import { withVendorCSSClassPrefix as
|
|
8365
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix21 } from "@asgardeo/browser";
|
|
7986
8366
|
import {
|
|
7987
8367
|
useFloating as useFloating3,
|
|
7988
8368
|
autoUpdate as autoUpdate3,
|
|
@@ -7996,13 +8376,13 @@ import {
|
|
|
7996
8376
|
FloatingFocusManager as FloatingFocusManager3,
|
|
7997
8377
|
FloatingPortal as FloatingPortal3
|
|
7998
8378
|
} from "@floating-ui/react";
|
|
7999
|
-
import
|
|
8000
|
-
import { useMemo as
|
|
8379
|
+
import clsx22 from "clsx";
|
|
8380
|
+
import { useMemo as useMemo17, useState as useState19 } from "react";
|
|
8001
8381
|
|
|
8002
8382
|
// src/components/primitives/Icons/Building.tsx
|
|
8003
|
-
import { jsx as
|
|
8004
|
-
var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */
|
|
8005
|
-
/* @__PURE__ */
|
|
8383
|
+
import { jsx as jsx78, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
8384
|
+
var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ jsxs39("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
8385
|
+
/* @__PURE__ */ jsx78(
|
|
8006
8386
|
"path",
|
|
8007
8387
|
{
|
|
8008
8388
|
d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",
|
|
@@ -8012,33 +8392,33 @@ var Building = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PU
|
|
|
8012
8392
|
strokeLinejoin: "round"
|
|
8013
8393
|
}
|
|
8014
8394
|
),
|
|
8015
|
-
/* @__PURE__ */
|
|
8016
|
-
/* @__PURE__ */
|
|
8017
|
-
/* @__PURE__ */
|
|
8018
|
-
/* @__PURE__ */
|
|
8019
|
-
/* @__PURE__ */
|
|
8020
|
-
/* @__PURE__ */
|
|
8395
|
+
/* @__PURE__ */ jsx78("path", { d: "M6 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
8396
|
+
/* @__PURE__ */ jsx78("path", { d: "M6 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
8397
|
+
/* @__PURE__ */ jsx78("path", { d: "M14 8h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
8398
|
+
/* @__PURE__ */ jsx78("path", { d: "M14 12h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
8399
|
+
/* @__PURE__ */ jsx78("path", { d: "M6 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
8400
|
+
/* @__PURE__ */ jsx78("path", { d: "M14 18h4", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
8021
8401
|
] });
|
|
8022
8402
|
Building.displayName = "Building";
|
|
8023
8403
|
var Building_default = Building;
|
|
8024
8404
|
|
|
8025
8405
|
// src/components/primitives/Icons/Check.tsx
|
|
8026
|
-
import { jsx as
|
|
8027
|
-
var Check = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */
|
|
8406
|
+
import { jsx as jsx79 } from "react/jsx-runtime";
|
|
8407
|
+
var Check = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ jsx79("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx79("path", { d: "M20 6 9 17l-5-5", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
8028
8408
|
Check.displayName = "Check";
|
|
8029
8409
|
var Check_default = Check;
|
|
8030
8410
|
|
|
8031
8411
|
// src/components/primitives/Icons/ChevronDown.tsx
|
|
8032
|
-
import { jsx as
|
|
8033
|
-
var ChevronDown = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */
|
|
8412
|
+
import { jsx as jsx80 } from "react/jsx-runtime";
|
|
8413
|
+
var ChevronDown = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ jsx80("svg", { width, height, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx80("path", { d: "m6 9 6 6 6-6", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
8034
8414
|
ChevronDown.displayName = "ChevronDown";
|
|
8035
8415
|
var ChevronDown_default = ChevronDown;
|
|
8036
8416
|
|
|
8037
8417
|
// src/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.tsx
|
|
8038
|
-
import { Fragment as Fragment18, jsx as
|
|
8039
|
-
var
|
|
8418
|
+
import { Fragment as Fragment18, jsx as jsx81, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
8419
|
+
var useStyles7 = () => {
|
|
8040
8420
|
const { theme, colorScheme } = useTheme_default();
|
|
8041
|
-
return
|
|
8421
|
+
return useMemo17(
|
|
8042
8422
|
() => ({
|
|
8043
8423
|
trigger: {
|
|
8044
8424
|
display: "inline-flex",
|
|
@@ -8194,9 +8574,9 @@ var BaseOrganizationSwitcher = ({
|
|
|
8194
8574
|
avatarSize = 24,
|
|
8195
8575
|
fallback = null
|
|
8196
8576
|
}) => {
|
|
8197
|
-
const styles =
|
|
8198
|
-
const [isOpen, setIsOpen] =
|
|
8199
|
-
const [hoveredItemIndex, setHoveredItemIndex] =
|
|
8577
|
+
const styles = useStyles7();
|
|
8578
|
+
const [isOpen, setIsOpen] = useState19(false);
|
|
8579
|
+
const [hoveredItemIndex, setHoveredItemIndex] = useState19(null);
|
|
8200
8580
|
const { theme, colorScheme } = useTheme_default();
|
|
8201
8581
|
const { t } = useTranslation_default();
|
|
8202
8582
|
const hoverBackgroundColor = colorScheme === "dark" ? "rgba(255, 255, 255, 0.08)" : "rgba(0, 0, 0, 0.04)";
|
|
@@ -8227,8 +8607,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
8227
8607
|
const switchableOrganizations = organizations.filter(
|
|
8228
8608
|
(org) => org.id !== currentOrganization?.id
|
|
8229
8609
|
);
|
|
8230
|
-
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */
|
|
8231
|
-
/* @__PURE__ */
|
|
8610
|
+
const defaultRenderOrganization2 = (organization, isSelected) => /* @__PURE__ */ jsxs40(Fragment18, { children: [
|
|
8611
|
+
/* @__PURE__ */ jsx81(
|
|
8232
8612
|
Avatar,
|
|
8233
8613
|
{
|
|
8234
8614
|
variant: "square",
|
|
@@ -8238,36 +8618,36 @@ var BaseOrganizationSwitcher = ({
|
|
|
8238
8618
|
alt: `${organization.name} avatar`
|
|
8239
8619
|
}
|
|
8240
8620
|
),
|
|
8241
|
-
/* @__PURE__ */
|
|
8242
|
-
/* @__PURE__ */
|
|
8243
|
-
/* @__PURE__ */
|
|
8244
|
-
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */
|
|
8621
|
+
/* @__PURE__ */ jsxs40("div", { style: styles.organizationInfo, children: [
|
|
8622
|
+
/* @__PURE__ */ jsx81(Typography_default, { variant: "body2", fontWeight: "medium", style: styles.organizationName, children: organization.name }),
|
|
8623
|
+
/* @__PURE__ */ jsxs40("div", { style: styles.organizationMeta, children: [
|
|
8624
|
+
showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ jsxs40("span", { children: [
|
|
8245
8625
|
organization.memberCount,
|
|
8246
8626
|
" ",
|
|
8247
8627
|
organization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members")
|
|
8248
8628
|
] }),
|
|
8249
|
-
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */
|
|
8250
|
-
showRole && organization.role && /* @__PURE__ */
|
|
8629
|
+
showRole && organization.role && showMemberCount && organization.memberCount !== void 0 && /* @__PURE__ */ jsx81("span", { children: " \u2022 " }),
|
|
8630
|
+
showRole && organization.role && /* @__PURE__ */ jsx81("span", { style: styles.roleCapitalized, children: organization.role })
|
|
8251
8631
|
] })
|
|
8252
8632
|
] }),
|
|
8253
|
-
isSelected && /* @__PURE__ */
|
|
8633
|
+
isSelected && /* @__PURE__ */ jsx81(Check_default, { width: "16", height: "16", color: theme.colors.text.primary })
|
|
8254
8634
|
] });
|
|
8255
|
-
const defaultRenderLoading2 = () => /* @__PURE__ */
|
|
8256
|
-
const defaultRenderError2 = (errorMessage) => /* @__PURE__ */
|
|
8257
|
-
return /* @__PURE__ */
|
|
8258
|
-
/* @__PURE__ */
|
|
8635
|
+
const defaultRenderLoading2 = () => /* @__PURE__ */ jsx81("div", { style: styles.loadingContainer, children: /* @__PURE__ */ jsx81(Typography_default, { variant: "caption", style: styles.loadingText, children: t("organization.switcher.loading.organizations") }) });
|
|
8636
|
+
const defaultRenderError2 = (errorMessage) => /* @__PURE__ */ jsx81("div", { style: styles.errorContainer, children: /* @__PURE__ */ jsx81(Typography_default, { variant: "caption", style: styles.errorText, children: errorMessage }) });
|
|
8637
|
+
return /* @__PURE__ */ jsxs40("div", { className: clsx22(withVendorCSSClassPrefix21("organization-switcher"), className), style, children: [
|
|
8638
|
+
/* @__PURE__ */ jsxs40(
|
|
8259
8639
|
Button_default,
|
|
8260
8640
|
{
|
|
8261
8641
|
ref: refs.setReference,
|
|
8262
|
-
className:
|
|
8642
|
+
className: withVendorCSSClassPrefix21("organization-switcher__trigger"),
|
|
8263
8643
|
style: styles.trigger,
|
|
8264
8644
|
color: "tertiary",
|
|
8265
8645
|
variant: "outline",
|
|
8266
8646
|
size: "medium",
|
|
8267
8647
|
...getReferenceProps(),
|
|
8268
8648
|
children: [
|
|
8269
|
-
currentOrganization ? /* @__PURE__ */
|
|
8270
|
-
/* @__PURE__ */
|
|
8649
|
+
currentOrganization ? /* @__PURE__ */ jsxs40(Fragment18, { children: [
|
|
8650
|
+
/* @__PURE__ */ jsx81(
|
|
8271
8651
|
Avatar,
|
|
8272
8652
|
{
|
|
8273
8653
|
variant: "square",
|
|
@@ -8277,46 +8657,46 @@ var BaseOrganizationSwitcher = ({
|
|
|
8277
8657
|
alt: `${currentOrganization.name} avatar`
|
|
8278
8658
|
}
|
|
8279
8659
|
),
|
|
8280
|
-
showTriggerLabel && /* @__PURE__ */
|
|
8660
|
+
showTriggerLabel && /* @__PURE__ */ jsx81(
|
|
8281
8661
|
Typography_default,
|
|
8282
8662
|
{
|
|
8283
8663
|
variant: "body2",
|
|
8284
|
-
className:
|
|
8664
|
+
className: withVendorCSSClassPrefix21("organization-switcher__trigger-label"),
|
|
8285
8665
|
style: styles.orgName,
|
|
8286
8666
|
children: currentOrganization.name
|
|
8287
8667
|
}
|
|
8288
8668
|
)
|
|
8289
|
-
] }) : /* @__PURE__ */
|
|
8290
|
-
/* @__PURE__ */
|
|
8291
|
-
showTriggerLabel && /* @__PURE__ */
|
|
8669
|
+
] }) : /* @__PURE__ */ jsxs40(Fragment18, { children: [
|
|
8670
|
+
/* @__PURE__ */ jsx81(Building_default, { width: avatarSize, height: avatarSize }),
|
|
8671
|
+
showTriggerLabel && /* @__PURE__ */ jsx81(
|
|
8292
8672
|
Typography_default,
|
|
8293
8673
|
{
|
|
8294
8674
|
variant: "body2",
|
|
8295
|
-
className:
|
|
8675
|
+
className: withVendorCSSClassPrefix21("organization-switcher__trigger-label"),
|
|
8296
8676
|
style: styles.orgName,
|
|
8297
8677
|
children: t("organization.switcher.select.organization")
|
|
8298
8678
|
}
|
|
8299
8679
|
)
|
|
8300
8680
|
] }),
|
|
8301
|
-
/* @__PURE__ */
|
|
8681
|
+
/* @__PURE__ */ jsx81(ChevronDown_default, { width: "16", height: "16" })
|
|
8302
8682
|
]
|
|
8303
8683
|
}
|
|
8304
8684
|
),
|
|
8305
|
-
isOpen && /* @__PURE__ */
|
|
8685
|
+
isOpen && /* @__PURE__ */ jsx81(FloatingPortal3, { id: portalId, children: /* @__PURE__ */ jsx81(FloatingFocusManager3, { context, modal: false, children: /* @__PURE__ */ jsxs40(
|
|
8306
8686
|
"div",
|
|
8307
8687
|
{
|
|
8308
8688
|
ref: refs.setFloating,
|
|
8309
|
-
className:
|
|
8689
|
+
className: withVendorCSSClassPrefix21("organization-switcher__content"),
|
|
8310
8690
|
style: { ...floatingStyles, ...styles.dropdownContent },
|
|
8311
8691
|
...getFloatingProps(),
|
|
8312
8692
|
children: [
|
|
8313
|
-
currentOrganization && /* @__PURE__ */
|
|
8693
|
+
currentOrganization && /* @__PURE__ */ jsxs40(
|
|
8314
8694
|
"div",
|
|
8315
8695
|
{
|
|
8316
|
-
className:
|
|
8696
|
+
className: withVendorCSSClassPrefix21("organization-switcher__header"),
|
|
8317
8697
|
style: styles.dropdownHeader,
|
|
8318
8698
|
children: [
|
|
8319
|
-
/* @__PURE__ */
|
|
8699
|
+
/* @__PURE__ */ jsx81(
|
|
8320
8700
|
Avatar,
|
|
8321
8701
|
{
|
|
8322
8702
|
variant: "square",
|
|
@@ -8326,47 +8706,47 @@ var BaseOrganizationSwitcher = ({
|
|
|
8326
8706
|
alt: `${currentOrganization.name} avatar`
|
|
8327
8707
|
}
|
|
8328
8708
|
),
|
|
8329
|
-
/* @__PURE__ */
|
|
8709
|
+
/* @__PURE__ */ jsxs40(
|
|
8330
8710
|
"div",
|
|
8331
8711
|
{
|
|
8332
|
-
className:
|
|
8712
|
+
className: withVendorCSSClassPrefix21("organization-switcher__header-info"),
|
|
8333
8713
|
style: styles.organizationInfo,
|
|
8334
8714
|
children: [
|
|
8335
|
-
/* @__PURE__ */
|
|
8715
|
+
/* @__PURE__ */ jsx81(
|
|
8336
8716
|
Typography_default,
|
|
8337
8717
|
{
|
|
8338
8718
|
noWrap: true,
|
|
8339
|
-
className:
|
|
8719
|
+
className: withVendorCSSClassPrefix21("organization-switcher__header-name"),
|
|
8340
8720
|
variant: "body1",
|
|
8341
8721
|
fontWeight: "medium",
|
|
8342
8722
|
style: styles.organizationName,
|
|
8343
8723
|
children: currentOrganization.name
|
|
8344
8724
|
}
|
|
8345
8725
|
),
|
|
8346
|
-
/* @__PURE__ */
|
|
8347
|
-
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */
|
|
8726
|
+
/* @__PURE__ */ jsxs40("div", { style: styles.organizationMeta, children: [
|
|
8727
|
+
showMemberCount && currentOrganization.memberCount !== void 0 && /* @__PURE__ */ jsxs40(
|
|
8348
8728
|
Typography_default,
|
|
8349
8729
|
{
|
|
8350
8730
|
noWrap: true,
|
|
8351
|
-
className:
|
|
8731
|
+
className: withVendorCSSClassPrefix21("organization-switcher__header-meta"),
|
|
8352
8732
|
variant: "caption",
|
|
8353
8733
|
color: "secondary",
|
|
8354
8734
|
children: [
|
|
8355
8735
|
currentOrganization.memberCount,
|
|
8356
8736
|
" ",
|
|
8357
8737
|
currentOrganization.memberCount === 1 ? t("organization.switcher.member") : t("organization.switcher.members"),
|
|
8358
|
-
showRole && currentOrganization.role && /* @__PURE__ */
|
|
8738
|
+
showRole && currentOrganization.role && /* @__PURE__ */ jsxs40("span", { children: [
|
|
8359
8739
|
" \u2022 ",
|
|
8360
8740
|
currentOrganization.role
|
|
8361
8741
|
] })
|
|
8362
8742
|
]
|
|
8363
8743
|
}
|
|
8364
8744
|
),
|
|
8365
|
-
showRole && currentOrganization.role && (!showMemberCount || currentOrganization.memberCount === void 0) && /* @__PURE__ */
|
|
8745
|
+
showRole && currentOrganization.role && (!showMemberCount || currentOrganization.memberCount === void 0) && /* @__PURE__ */ jsx81(
|
|
8366
8746
|
Typography_default,
|
|
8367
8747
|
{
|
|
8368
8748
|
noWrap: true,
|
|
8369
|
-
className:
|
|
8749
|
+
className: withVendorCSSClassPrefix21("organization-switcher__header-role"),
|
|
8370
8750
|
variant: "caption",
|
|
8371
8751
|
color: "secondary",
|
|
8372
8752
|
style: styles.roleCapitalized,
|
|
@@ -8377,7 +8757,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
8377
8757
|
]
|
|
8378
8758
|
}
|
|
8379
8759
|
),
|
|
8380
|
-
onManageProfile && /* @__PURE__ */
|
|
8760
|
+
onManageProfile && /* @__PURE__ */ jsx81(
|
|
8381
8761
|
Button_default,
|
|
8382
8762
|
{
|
|
8383
8763
|
onClick: onManageProfile,
|
|
@@ -8386,7 +8766,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
8386
8766
|
size: "small",
|
|
8387
8767
|
"aria-label": "Manage Organization Profile",
|
|
8388
8768
|
style: styles.manageButton,
|
|
8389
|
-
endIcon: /* @__PURE__ */
|
|
8769
|
+
endIcon: /* @__PURE__ */ jsxs40(
|
|
8390
8770
|
"svg",
|
|
8391
8771
|
{
|
|
8392
8772
|
width: "16",
|
|
@@ -8398,8 +8778,8 @@ var BaseOrganizationSwitcher = ({
|
|
|
8398
8778
|
strokeLinecap: "round",
|
|
8399
8779
|
strokeLinejoin: "round",
|
|
8400
8780
|
children: [
|
|
8401
|
-
/* @__PURE__ */
|
|
8402
|
-
/* @__PURE__ */
|
|
8781
|
+
/* @__PURE__ */ jsx81("circle", { cx: "12", cy: "12", r: "3" }),
|
|
8782
|
+
/* @__PURE__ */ jsx81("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" })
|
|
8403
8783
|
]
|
|
8404
8784
|
}
|
|
8405
8785
|
),
|
|
@@ -8409,7 +8789,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
8409
8789
|
]
|
|
8410
8790
|
}
|
|
8411
8791
|
),
|
|
8412
|
-
organizations.length > 1 && /* @__PURE__ */
|
|
8792
|
+
organizations.length > 1 && /* @__PURE__ */ jsx81(
|
|
8413
8793
|
"div",
|
|
8414
8794
|
{
|
|
8415
8795
|
style: {
|
|
@@ -8417,17 +8797,17 @@ var BaseOrganizationSwitcher = ({
|
|
|
8417
8797
|
...styles.sectionHeaderContainer,
|
|
8418
8798
|
borderTop: currentOrganization ? `1px solid ${theme.colors.border}` : "none"
|
|
8419
8799
|
},
|
|
8420
|
-
children: /* @__PURE__ */
|
|
8800
|
+
children: /* @__PURE__ */ jsx81(Typography_default, { variant: "caption", fontWeight: 600, style: styles.sectionHeader, children: t("organization.switcher.switch.organization") })
|
|
8421
8801
|
}
|
|
8422
8802
|
),
|
|
8423
|
-
/* @__PURE__ */
|
|
8803
|
+
/* @__PURE__ */ jsx81("div", { className: withVendorCSSClassPrefix21("organization-switcher__menu"), style: styles.dropdownMenu, children: loading ? renderLoading ? renderLoading() : defaultRenderLoading2() : error ? renderError ? renderError(error) : defaultRenderError2(error) : /* @__PURE__ */ jsxs40(Fragment18, { children: [
|
|
8424
8804
|
switchableOrganizations.map((organization) => {
|
|
8425
8805
|
const isSelected = false;
|
|
8426
|
-
return /* @__PURE__ */
|
|
8806
|
+
return /* @__PURE__ */ jsx81(
|
|
8427
8807
|
Button_default,
|
|
8428
8808
|
{
|
|
8429
8809
|
onClick: () => handleOrganizationSwitch(organization),
|
|
8430
|
-
className:
|
|
8810
|
+
className: withVendorCSSClassPrefix21("organization-switcher__menu-item"),
|
|
8431
8811
|
color: "tertiary",
|
|
8432
8812
|
variant: "text",
|
|
8433
8813
|
size: "small",
|
|
@@ -8442,16 +8822,16 @@ var BaseOrganizationSwitcher = ({
|
|
|
8442
8822
|
organization.id
|
|
8443
8823
|
);
|
|
8444
8824
|
}),
|
|
8445
|
-
menuItems.length > 0 && /* @__PURE__ */
|
|
8446
|
-
/* @__PURE__ */
|
|
8825
|
+
menuItems.length > 0 && /* @__PURE__ */ jsxs40(Fragment18, { children: [
|
|
8826
|
+
/* @__PURE__ */ jsx81(
|
|
8447
8827
|
"div",
|
|
8448
8828
|
{
|
|
8449
|
-
className:
|
|
8829
|
+
className: withVendorCSSClassPrefix21("organization-switcher__menu-divider"),
|
|
8450
8830
|
style: styles.divider
|
|
8451
8831
|
}
|
|
8452
8832
|
),
|
|
8453
8833
|
menuItems.map(
|
|
8454
|
-
(item, index) => /* @__PURE__ */
|
|
8834
|
+
(item, index) => /* @__PURE__ */ jsx81("div", { children: item.href ? /* @__PURE__ */ jsxs40(
|
|
8455
8835
|
"a",
|
|
8456
8836
|
{
|
|
8457
8837
|
href: item.href,
|
|
@@ -8459,17 +8839,17 @@ var BaseOrganizationSwitcher = ({
|
|
|
8459
8839
|
...styles.menuItem,
|
|
8460
8840
|
backgroundColor: hoveredItemIndex === switchableOrganizations.length + index ? hoverBackgroundColor : "transparent"
|
|
8461
8841
|
},
|
|
8462
|
-
className:
|
|
8842
|
+
className: withVendorCSSClassPrefix21("organization-switcher__menu-item"),
|
|
8463
8843
|
onMouseEnter: () => setHoveredItemIndex(switchableOrganizations.length + index),
|
|
8464
8844
|
onMouseLeave: () => setHoveredItemIndex(null),
|
|
8465
8845
|
onFocus: () => setHoveredItemIndex(switchableOrganizations.length + index),
|
|
8466
8846
|
onBlur: () => setHoveredItemIndex(null),
|
|
8467
8847
|
children: [
|
|
8468
8848
|
item.icon,
|
|
8469
|
-
/* @__PURE__ */
|
|
8849
|
+
/* @__PURE__ */ jsx81("span", { children: item.label })
|
|
8470
8850
|
]
|
|
8471
8851
|
}
|
|
8472
|
-
) : /* @__PURE__ */
|
|
8852
|
+
) : /* @__PURE__ */ jsx81(
|
|
8473
8853
|
Button_default,
|
|
8474
8854
|
{
|
|
8475
8855
|
onClick: () => handleMenuItemClick(item),
|
|
@@ -8477,7 +8857,7 @@ var BaseOrganizationSwitcher = ({
|
|
|
8477
8857
|
...styles.menuItem,
|
|
8478
8858
|
backgroundColor: hoveredItemIndex === switchableOrganizations.length + index ? hoverBackgroundColor : "transparent"
|
|
8479
8859
|
},
|
|
8480
|
-
className:
|
|
8860
|
+
className: withVendorCSSClassPrefix21("organization-switcher__menu-item"),
|
|
8481
8861
|
color: "tertiary",
|
|
8482
8862
|
variant: "text",
|
|
8483
8863
|
size: "small",
|
|
@@ -8498,19 +8878,19 @@ var BaseOrganizationSwitcher = ({
|
|
|
8498
8878
|
var BaseOrganizationSwitcher_default = BaseOrganizationSwitcher;
|
|
8499
8879
|
|
|
8500
8880
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
8501
|
-
import { useState as
|
|
8881
|
+
import { useState as useState25 } from "react";
|
|
8502
8882
|
|
|
8503
8883
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
8504
|
-
import { useState as
|
|
8884
|
+
import { useState as useState21 } from "react";
|
|
8505
8885
|
|
|
8506
8886
|
// src/components/presentation/CreateOrganization/BaseCreateOrganization.tsx
|
|
8507
|
-
import { withVendorCSSClassPrefix as
|
|
8508
|
-
import
|
|
8509
|
-
import { useMemo as
|
|
8510
|
-
import { jsx as
|
|
8511
|
-
var
|
|
8887
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix22 } from "@asgardeo/browser";
|
|
8888
|
+
import clsx23 from "clsx";
|
|
8889
|
+
import { useMemo as useMemo18, useState as useState20 } from "react";
|
|
8890
|
+
import { jsx as jsx82, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
8891
|
+
var useStyles8 = () => {
|
|
8512
8892
|
const { theme, colorScheme } = useTheme_default();
|
|
8513
|
-
return
|
|
8893
|
+
return useMemo18(
|
|
8514
8894
|
() => ({
|
|
8515
8895
|
root: {
|
|
8516
8896
|
padding: `${theme.spacing.unit * 4}px`,
|
|
@@ -8619,16 +8999,16 @@ var BaseCreateOrganization = ({
|
|
|
8619
8999
|
style,
|
|
8620
9000
|
title = "Create Organization"
|
|
8621
9001
|
}) => {
|
|
8622
|
-
const styles =
|
|
9002
|
+
const styles = useStyles8();
|
|
8623
9003
|
const { theme } = useTheme_default();
|
|
8624
9004
|
const { t } = useTranslation_default();
|
|
8625
|
-
const [formData, setFormData] =
|
|
9005
|
+
const [formData, setFormData] = useState20({
|
|
8626
9006
|
description: "",
|
|
8627
9007
|
handle: "",
|
|
8628
9008
|
name: "",
|
|
8629
9009
|
...initialValues
|
|
8630
9010
|
});
|
|
8631
|
-
const [formErrors, setFormErrors] =
|
|
9011
|
+
const [formErrors, setFormErrors] = useState20({});
|
|
8632
9012
|
const validateForm = () => {
|
|
8633
9013
|
const errors = {};
|
|
8634
9014
|
if (!formData.name.trim()) {
|
|
@@ -8692,21 +9072,21 @@ var BaseCreateOrganization = ({
|
|
|
8692
9072
|
...styles.root,
|
|
8693
9073
|
...cardLayout ? styles.card : {}
|
|
8694
9074
|
};
|
|
8695
|
-
const createOrganizationContent = /* @__PURE__ */
|
|
9075
|
+
const createOrganizationContent = /* @__PURE__ */ jsx82(
|
|
8696
9076
|
"div",
|
|
8697
9077
|
{
|
|
8698
|
-
className:
|
|
9078
|
+
className: clsx23(withVendorCSSClassPrefix22("create-organization"), className),
|
|
8699
9079
|
style: { ...containerStyle, ...style },
|
|
8700
|
-
children: /* @__PURE__ */
|
|
8701
|
-
/* @__PURE__ */
|
|
9080
|
+
children: /* @__PURE__ */ jsxs41("div", { className: withVendorCSSClassPrefix22("create-organization__content"), style: styles.content, children: [
|
|
9081
|
+
/* @__PURE__ */ jsxs41(
|
|
8702
9082
|
"form",
|
|
8703
9083
|
{
|
|
8704
9084
|
id: "create-organization-form",
|
|
8705
|
-
className:
|
|
9085
|
+
className: withVendorCSSClassPrefix22("create-organization__form"),
|
|
8706
9086
|
style: styles.form,
|
|
8707
9087
|
onSubmit: handleSubmit,
|
|
8708
9088
|
children: [
|
|
8709
|
-
/* @__PURE__ */
|
|
9089
|
+
/* @__PURE__ */ jsx82("div", { className: withVendorCSSClassPrefix22("create-organization__field-group"), children: /* @__PURE__ */ jsx82(
|
|
8710
9090
|
TextField_default,
|
|
8711
9091
|
{
|
|
8712
9092
|
label: `${t("organization.create.name.label")}`,
|
|
@@ -8716,10 +9096,10 @@ var BaseCreateOrganization = ({
|
|
|
8716
9096
|
disabled: loading,
|
|
8717
9097
|
required: true,
|
|
8718
9098
|
error: formErrors.name,
|
|
8719
|
-
className:
|
|
9099
|
+
className: withVendorCSSClassPrefix22("create-organization__input")
|
|
8720
9100
|
}
|
|
8721
9101
|
) }),
|
|
8722
|
-
/* @__PURE__ */
|
|
9102
|
+
/* @__PURE__ */ jsx82("div", { className: withVendorCSSClassPrefix22("create-organization__field-group"), children: /* @__PURE__ */ jsx82(
|
|
8723
9103
|
TextField_default,
|
|
8724
9104
|
{
|
|
8725
9105
|
label: `${t("organization.create.handle.label") || "Organization Handle"}`,
|
|
@@ -8730,15 +9110,15 @@ var BaseCreateOrganization = ({
|
|
|
8730
9110
|
required: true,
|
|
8731
9111
|
error: formErrors.handle,
|
|
8732
9112
|
helperText: "This will be your organization's unique identifier. Only lowercase letters, numbers, and hyphens are allowed.",
|
|
8733
|
-
className:
|
|
9113
|
+
className: withVendorCSSClassPrefix22("create-organization__input")
|
|
8734
9114
|
}
|
|
8735
9115
|
) }),
|
|
8736
|
-
/* @__PURE__ */
|
|
8737
|
-
/* @__PURE__ */
|
|
8738
|
-
/* @__PURE__ */
|
|
9116
|
+
/* @__PURE__ */ jsx82("div", { className: withVendorCSSClassPrefix22("create-organization__field-group"), children: /* @__PURE__ */ jsxs41(FormControl_default, { error: formErrors.description, children: [
|
|
9117
|
+
/* @__PURE__ */ jsx82(InputLabel_default, { required: true, children: t("organization.create.description.label") }),
|
|
9118
|
+
/* @__PURE__ */ jsx82(
|
|
8739
9119
|
"textarea",
|
|
8740
9120
|
{
|
|
8741
|
-
className:
|
|
9121
|
+
className: withVendorCSSClassPrefix22("create-organization__textarea"),
|
|
8742
9122
|
style: {
|
|
8743
9123
|
...styles.textarea,
|
|
8744
9124
|
borderColor: formErrors.description ? theme.colors.error.main : theme.colors.border
|
|
@@ -8752,21 +9132,21 @@ var BaseCreateOrganization = ({
|
|
|
8752
9132
|
)
|
|
8753
9133
|
] }) }),
|
|
8754
9134
|
renderAdditionalFields && renderAdditionalFields(),
|
|
8755
|
-
error && /* @__PURE__ */
|
|
9135
|
+
error && /* @__PURE__ */ jsx82(Typography_default, { variant: "body2", style: { color: theme.colors.error.main, fontSize: "0.875rem" }, children: error })
|
|
8756
9136
|
]
|
|
8757
9137
|
}
|
|
8758
9138
|
),
|
|
8759
|
-
/* @__PURE__ */
|
|
8760
|
-
onCancel && /* @__PURE__ */
|
|
8761
|
-
/* @__PURE__ */
|
|
9139
|
+
/* @__PURE__ */ jsxs41("div", { className: withVendorCSSClassPrefix22("create-organization__actions"), style: styles.actions, children: [
|
|
9140
|
+
onCancel && /* @__PURE__ */ jsx82(Button_default, { type: "button", variant: "outline", onClick: onCancel, disabled: loading, children: t("organization.create.cancel") }),
|
|
9141
|
+
/* @__PURE__ */ jsx82(Button_default, { type: "submit", variant: "solid", color: "primary", disabled: loading, form: "create-organization-form", children: loading ? t("organization.create.creating") : t("organization.create.button") })
|
|
8762
9142
|
] })
|
|
8763
9143
|
] })
|
|
8764
9144
|
}
|
|
8765
9145
|
);
|
|
8766
9146
|
if (mode === "popup") {
|
|
8767
|
-
return /* @__PURE__ */
|
|
8768
|
-
/* @__PURE__ */
|
|
8769
|
-
/* @__PURE__ */
|
|
9147
|
+
return /* @__PURE__ */ jsx82(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs41(DialogContent, { children: [
|
|
9148
|
+
/* @__PURE__ */ jsx82(DialogHeading, { children: title }),
|
|
9149
|
+
/* @__PURE__ */ jsx82("div", { style: { padding: "1rem" }, children: createOrganizationContent })
|
|
8770
9150
|
] }) });
|
|
8771
9151
|
}
|
|
8772
9152
|
return createOrganizationContent;
|
|
@@ -8802,7 +9182,7 @@ var createOrganization = async ({ fetcher, ...requestConfig }) => {
|
|
|
8802
9182
|
var createOrganization_default = createOrganization;
|
|
8803
9183
|
|
|
8804
9184
|
// src/components/presentation/CreateOrganization/CreateOrganization.tsx
|
|
8805
|
-
import { Fragment as Fragment19, jsx as
|
|
9185
|
+
import { Fragment as Fragment19, jsx as jsx83 } from "react/jsx-runtime";
|
|
8806
9186
|
var CreateOrganization = ({
|
|
8807
9187
|
onCreateOrganization,
|
|
8808
9188
|
fallback = null,
|
|
@@ -8812,13 +9192,13 @@ var CreateOrganization = ({
|
|
|
8812
9192
|
}) => {
|
|
8813
9193
|
const { isSignedIn, baseUrl } = useAsgardeo_default();
|
|
8814
9194
|
const { currentOrganization, revalidateOrganizations } = useOrganization_default();
|
|
8815
|
-
const [loading, setLoading] =
|
|
8816
|
-
const [error, setError] =
|
|
9195
|
+
const [loading, setLoading] = useState21(false);
|
|
9196
|
+
const [error, setError] = useState21(null);
|
|
8817
9197
|
if (!isSignedIn && fallback) {
|
|
8818
9198
|
return fallback;
|
|
8819
9199
|
}
|
|
8820
9200
|
if (!isSignedIn) {
|
|
8821
|
-
return /* @__PURE__ */
|
|
9201
|
+
return /* @__PURE__ */ jsx83(Fragment19, {});
|
|
8822
9202
|
}
|
|
8823
9203
|
const parentId = defaultParentId || currentOrganization?.id || "";
|
|
8824
9204
|
const handleSubmit = async (payload) => {
|
|
@@ -8852,7 +9232,7 @@ var CreateOrganization = ({
|
|
|
8852
9232
|
setLoading(false);
|
|
8853
9233
|
}
|
|
8854
9234
|
};
|
|
8855
|
-
return /* @__PURE__ */
|
|
9235
|
+
return /* @__PURE__ */ jsx83(
|
|
8856
9236
|
BaseCreateOrganization,
|
|
8857
9237
|
{
|
|
8858
9238
|
onSubmit: handleSubmit,
|
|
@@ -8866,18 +9246,18 @@ var CreateOrganization = ({
|
|
|
8866
9246
|
};
|
|
8867
9247
|
|
|
8868
9248
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
8869
|
-
import { useEffect as useEffect14, useState as
|
|
9249
|
+
import { useEffect as useEffect14, useState as useState24 } from "react";
|
|
8870
9250
|
|
|
8871
9251
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
8872
|
-
import { withVendorCSSClassPrefix as
|
|
8873
|
-
import
|
|
8874
|
-
import { useMemo as
|
|
9252
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix24 } from "@asgardeo/browser";
|
|
9253
|
+
import clsx25 from "clsx";
|
|
9254
|
+
import { useMemo as useMemo19, useState as useState23, useCallback as useCallback12, useRef as useRef7 } from "react";
|
|
8875
9255
|
|
|
8876
9256
|
// src/components/primitives/KeyValueInput/KeyValueInput.tsx
|
|
8877
|
-
import { withVendorCSSClassPrefix as
|
|
8878
|
-
import
|
|
8879
|
-
import { useState as
|
|
8880
|
-
import { jsx as
|
|
9257
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix23 } from "@asgardeo/browser";
|
|
9258
|
+
import clsx24 from "clsx";
|
|
9259
|
+
import { useState as useState22, useCallback as useCallback11 } from "react";
|
|
9260
|
+
import { jsx as jsx84, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
8881
9261
|
var KeyValueInput = ({
|
|
8882
9262
|
className = "",
|
|
8883
9263
|
disabled = false,
|
|
@@ -8899,10 +9279,10 @@ var KeyValueInput = ({
|
|
|
8899
9279
|
}) => {
|
|
8900
9280
|
const { theme } = useTheme_default();
|
|
8901
9281
|
const initialPairs = Array.isArray(value) ? value : Object.entries(value).map(([key, val]) => ({ key, value: String(val) }));
|
|
8902
|
-
const [pairs, setPairs] =
|
|
8903
|
-
const [newKey, setNewKey] =
|
|
8904
|
-
const [newValue, setNewValue] =
|
|
8905
|
-
const handleAddPair =
|
|
9282
|
+
const [pairs, setPairs] = useState22(initialPairs);
|
|
9283
|
+
const [newKey, setNewKey] = useState22("");
|
|
9284
|
+
const [newValue, setNewValue] = useState22("");
|
|
9285
|
+
const handleAddPair = useCallback11(() => {
|
|
8906
9286
|
if (!newKey.trim() || !newValue.trim()) return;
|
|
8907
9287
|
if (maxPairs && pairs.length >= maxPairs) return;
|
|
8908
9288
|
const newPair = {
|
|
@@ -8920,7 +9300,7 @@ var KeyValueInput = ({
|
|
|
8920
9300
|
onAdd(newPair);
|
|
8921
9301
|
}
|
|
8922
9302
|
}, [newKey, newValue, pairs, maxPairs, onChange, onAdd]);
|
|
8923
|
-
const handleRemovePair =
|
|
9303
|
+
const handleRemovePair = useCallback11(
|
|
8924
9304
|
(index) => {
|
|
8925
9305
|
const pairToRemove = pairs[index];
|
|
8926
9306
|
const updatedPairs = pairs.filter((_, i) => i !== index);
|
|
@@ -8934,7 +9314,7 @@ var KeyValueInput = ({
|
|
|
8934
9314
|
},
|
|
8935
9315
|
[pairs, onChange, onRemove]
|
|
8936
9316
|
);
|
|
8937
|
-
const handleUpdatePair =
|
|
9317
|
+
const handleUpdatePair = useCallback11(
|
|
8938
9318
|
(index, field, newVal) => {
|
|
8939
9319
|
const updatedPairs = pairs.map((pair, i) => {
|
|
8940
9320
|
if (i === index) {
|
|
@@ -9061,20 +9441,20 @@ var KeyValueInput = ({
|
|
|
9061
9441
|
flex: 1
|
|
9062
9442
|
}
|
|
9063
9443
|
};
|
|
9064
|
-
return /* @__PURE__ */
|
|
9065
|
-
label && /* @__PURE__ */
|
|
9444
|
+
return /* @__PURE__ */ jsxs42("div", { className: clsx24(withVendorCSSClassPrefix23("key-value-input"), className), style: styles.container, children: [
|
|
9445
|
+
label && /* @__PURE__ */ jsxs42("label", { style: styles.label, children: [
|
|
9066
9446
|
label,
|
|
9067
|
-
required && /* @__PURE__ */
|
|
9447
|
+
required && /* @__PURE__ */ jsx84("span", { style: { color: theme.colors.error.main }, children: " *" })
|
|
9068
9448
|
] }),
|
|
9069
|
-
/* @__PURE__ */
|
|
9070
|
-
pairs.length === 0 && readOnly ? /* @__PURE__ */
|
|
9071
|
-
/* @__PURE__ */
|
|
9449
|
+
/* @__PURE__ */ jsxs42("div", { style: styles.pairsList, children: [
|
|
9450
|
+
pairs.length === 0 && readOnly ? /* @__PURE__ */ jsx84("div", { style: styles.emptyState, children: "No attributes defined" }) : readOnly ? pairs.map((pair, index) => /* @__PURE__ */ jsxs42("div", { style: styles.readOnlyPair, children: [
|
|
9451
|
+
/* @__PURE__ */ jsxs42("span", { style: styles.readOnlyKey, children: [
|
|
9072
9452
|
pair.key,
|
|
9073
9453
|
":"
|
|
9074
9454
|
] }),
|
|
9075
|
-
/* @__PURE__ */
|
|
9076
|
-
] }, `${pair.key}-${index}`)) : pairs.map((pair, index) => /* @__PURE__ */
|
|
9077
|
-
/* @__PURE__ */
|
|
9455
|
+
/* @__PURE__ */ jsx84("span", { style: styles.readOnlyValue, children: pair.value })
|
|
9456
|
+
] }, `${pair.key}-${index}`)) : pairs.map((pair, index) => /* @__PURE__ */ jsxs42("div", { style: styles.pairRow, children: [
|
|
9457
|
+
/* @__PURE__ */ jsx84(
|
|
9078
9458
|
TextField_default,
|
|
9079
9459
|
{
|
|
9080
9460
|
placeholder: keyPlaceholder,
|
|
@@ -9085,7 +9465,7 @@ var KeyValueInput = ({
|
|
|
9085
9465
|
"aria-label": `${keyLabel} ${index + 1}`
|
|
9086
9466
|
}
|
|
9087
9467
|
),
|
|
9088
|
-
/* @__PURE__ */
|
|
9468
|
+
/* @__PURE__ */ jsx84(
|
|
9089
9469
|
TextField_default,
|
|
9090
9470
|
{
|
|
9091
9471
|
placeholder: valuePlaceholder,
|
|
@@ -9096,7 +9476,7 @@ var KeyValueInput = ({
|
|
|
9096
9476
|
"aria-label": `${valueLabel} ${index + 1}`
|
|
9097
9477
|
}
|
|
9098
9478
|
),
|
|
9099
|
-
!readOnly && /* @__PURE__ */
|
|
9479
|
+
!readOnly && /* @__PURE__ */ jsx84(
|
|
9100
9480
|
Button_default,
|
|
9101
9481
|
{
|
|
9102
9482
|
variant: "outline",
|
|
@@ -9105,12 +9485,12 @@ var KeyValueInput = ({
|
|
|
9105
9485
|
disabled,
|
|
9106
9486
|
style: styles.removeButton,
|
|
9107
9487
|
"aria-label": `${removeButtonText} ${pair.key}`,
|
|
9108
|
-
children: /* @__PURE__ */
|
|
9488
|
+
children: /* @__PURE__ */ jsx84(X_default, { width: 16, height: 16 })
|
|
9109
9489
|
}
|
|
9110
9490
|
)
|
|
9111
9491
|
] }, `${pair.key}-${index}`)),
|
|
9112
|
-
!readOnly && /* @__PURE__ */
|
|
9113
|
-
/* @__PURE__ */
|
|
9492
|
+
!readOnly && /* @__PURE__ */ jsxs42("div", { style: styles.addRow, children: [
|
|
9493
|
+
/* @__PURE__ */ jsx84(
|
|
9114
9494
|
TextField_default,
|
|
9115
9495
|
{
|
|
9116
9496
|
placeholder: keyPlaceholder,
|
|
@@ -9121,7 +9501,7 @@ var KeyValueInput = ({
|
|
|
9121
9501
|
"aria-label": "New key"
|
|
9122
9502
|
}
|
|
9123
9503
|
),
|
|
9124
|
-
/* @__PURE__ */
|
|
9504
|
+
/* @__PURE__ */ jsx84(
|
|
9125
9505
|
TextField_default,
|
|
9126
9506
|
{
|
|
9127
9507
|
placeholder: valuePlaceholder,
|
|
@@ -9137,7 +9517,7 @@ var KeyValueInput = ({
|
|
|
9137
9517
|
}
|
|
9138
9518
|
}
|
|
9139
9519
|
),
|
|
9140
|
-
/* @__PURE__ */
|
|
9520
|
+
/* @__PURE__ */ jsx84(
|
|
9141
9521
|
Button_default,
|
|
9142
9522
|
{
|
|
9143
9523
|
variant: "solid",
|
|
@@ -9146,13 +9526,13 @@ var KeyValueInput = ({
|
|
|
9146
9526
|
disabled: isAddDisabled,
|
|
9147
9527
|
style: styles.addButton,
|
|
9148
9528
|
"aria-label": "Add new key-value pair",
|
|
9149
|
-
children: /* @__PURE__ */
|
|
9529
|
+
children: /* @__PURE__ */ jsx84(Plus_default, { width: 16, height: 16 })
|
|
9150
9530
|
}
|
|
9151
9531
|
)
|
|
9152
9532
|
] })
|
|
9153
9533
|
] }),
|
|
9154
|
-
(helperText || error) && /* @__PURE__ */
|
|
9155
|
-
maxPairs && /* @__PURE__ */
|
|
9534
|
+
(helperText || error) && /* @__PURE__ */ jsx84("div", { style: styles.helperText, children: error || helperText }),
|
|
9535
|
+
maxPairs && /* @__PURE__ */ jsxs42("div", { style: styles.helperText, children: [
|
|
9156
9536
|
pairs.length,
|
|
9157
9537
|
" of ",
|
|
9158
9538
|
maxPairs,
|
|
@@ -9163,7 +9543,7 @@ var KeyValueInput = ({
|
|
|
9163
9543
|
var KeyValueInput_default = KeyValueInput;
|
|
9164
9544
|
|
|
9165
9545
|
// src/components/presentation/OrganizationProfile/BaseOrganizationProfile.tsx
|
|
9166
|
-
import { Fragment as Fragment20, jsx as
|
|
9546
|
+
import { Fragment as Fragment20, jsx as jsx85, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
9167
9547
|
var formatDate = (dateString) => {
|
|
9168
9548
|
if (!dateString) return "-";
|
|
9169
9549
|
try {
|
|
@@ -9223,10 +9603,10 @@ var BaseOrganizationProfile = ({
|
|
|
9223
9603
|
]
|
|
9224
9604
|
}) => {
|
|
9225
9605
|
const { theme } = useTheme_default();
|
|
9226
|
-
const [editedOrganization, setEditedOrganization] =
|
|
9227
|
-
const [editingFields, setEditingFields] =
|
|
9606
|
+
const [editedOrganization, setEditedOrganization] = useState23(organization);
|
|
9607
|
+
const [editingFields, setEditingFields] = useState23({});
|
|
9228
9608
|
const triggerRef = useRef7(null);
|
|
9229
|
-
const PencilIcon = () => /* @__PURE__ */
|
|
9609
|
+
const PencilIcon = () => /* @__PURE__ */ jsx85(
|
|
9230
9610
|
"svg",
|
|
9231
9611
|
{
|
|
9232
9612
|
width: "16",
|
|
@@ -9237,16 +9617,16 @@ var BaseOrganizationProfile = ({
|
|
|
9237
9617
|
strokeWidth: "2",
|
|
9238
9618
|
strokeLinecap: "round",
|
|
9239
9619
|
strokeLinejoin: "round",
|
|
9240
|
-
children: /* @__PURE__ */
|
|
9620
|
+
children: /* @__PURE__ */ jsx85("path", { d: "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" })
|
|
9241
9621
|
}
|
|
9242
9622
|
);
|
|
9243
|
-
const toggleFieldEdit =
|
|
9623
|
+
const toggleFieldEdit = useCallback12((fieldName) => {
|
|
9244
9624
|
setEditingFields((prev) => ({
|
|
9245
9625
|
...prev,
|
|
9246
9626
|
[fieldName]: !prev[fieldName]
|
|
9247
9627
|
}));
|
|
9248
9628
|
}, []);
|
|
9249
|
-
const getFieldPlaceholder =
|
|
9629
|
+
const getFieldPlaceholder = useCallback12((fieldKey) => {
|
|
9250
9630
|
const fieldLabels = {
|
|
9251
9631
|
name: "organization name",
|
|
9252
9632
|
description: "organization description",
|
|
@@ -9257,7 +9637,7 @@ var BaseOrganizationProfile = ({
|
|
|
9257
9637
|
const fieldLabel = fieldLabels[fieldKey] || fieldKey.toLowerCase();
|
|
9258
9638
|
return `Enter ${fieldLabel}`;
|
|
9259
9639
|
}, []);
|
|
9260
|
-
const handleFieldSave =
|
|
9640
|
+
const handleFieldSave = useCallback12(
|
|
9261
9641
|
(fieldKey) => {
|
|
9262
9642
|
if (!onUpdate || !fieldKey) return;
|
|
9263
9643
|
const fieldValue = editedOrganization && fieldKey && editedOrganization[fieldKey] !== void 0 ? editedOrganization[fieldKey] : organization && organization[fieldKey] !== void 0 ? organization[fieldKey] : "";
|
|
@@ -9269,7 +9649,7 @@ var BaseOrganizationProfile = ({
|
|
|
9269
9649
|
},
|
|
9270
9650
|
[editedOrganization, organization, onUpdate, toggleFieldEdit]
|
|
9271
9651
|
);
|
|
9272
|
-
const handleFieldCancel =
|
|
9652
|
+
const handleFieldCancel = useCallback12(
|
|
9273
9653
|
(fieldKey) => {
|
|
9274
9654
|
setEditedOrganization((prev) => ({
|
|
9275
9655
|
...prev,
|
|
@@ -9296,8 +9676,8 @@ var BaseOrganizationProfile = ({
|
|
|
9296
9676
|
if (!name) return "ORG";
|
|
9297
9677
|
return name.split(" ").map((word) => word.charAt(0)).join("").toUpperCase().slice(0, 2);
|
|
9298
9678
|
};
|
|
9299
|
-
const styles =
|
|
9300
|
-
const buttonStyle =
|
|
9679
|
+
const styles = useStyles9();
|
|
9680
|
+
const buttonStyle = useMemo19(
|
|
9301
9681
|
() => ({
|
|
9302
9682
|
padding: `${theme.spacing.unit}px ${theme.spacing.unit * 2}px`,
|
|
9303
9683
|
margin: `${theme.spacing.unit}px`,
|
|
@@ -9309,7 +9689,7 @@ var BaseOrganizationProfile = ({
|
|
|
9309
9689
|
}),
|
|
9310
9690
|
[theme]
|
|
9311
9691
|
);
|
|
9312
|
-
const saveButtonStyle =
|
|
9692
|
+
const saveButtonStyle = useMemo19(
|
|
9313
9693
|
() => ({
|
|
9314
9694
|
...buttonStyle,
|
|
9315
9695
|
backgroundColor: theme.colors.primary.main,
|
|
@@ -9317,7 +9697,7 @@ var BaseOrganizationProfile = ({
|
|
|
9317
9697
|
}),
|
|
9318
9698
|
[theme, buttonStyle]
|
|
9319
9699
|
);
|
|
9320
|
-
const cancelButtonStyle =
|
|
9700
|
+
const cancelButtonStyle = useMemo19(
|
|
9321
9701
|
() => ({
|
|
9322
9702
|
...buttonStyle,
|
|
9323
9703
|
backgroundColor: theme.colors.secondary.main,
|
|
@@ -9344,7 +9724,7 @@ var BaseOrganizationProfile = ({
|
|
|
9344
9724
|
let fieldInput;
|
|
9345
9725
|
if (key === "attributes") {
|
|
9346
9726
|
const attributesValue = typeof fieldValue === "object" && fieldValue !== null ? fieldValue : {};
|
|
9347
|
-
fieldInput = /* @__PURE__ */
|
|
9727
|
+
fieldInput = /* @__PURE__ */ jsx85(
|
|
9348
9728
|
KeyValueInput_default,
|
|
9349
9729
|
{
|
|
9350
9730
|
value: attributesValue,
|
|
@@ -9382,26 +9762,26 @@ var BaseOrganizationProfile = ({
|
|
|
9382
9762
|
}
|
|
9383
9763
|
);
|
|
9384
9764
|
} else {
|
|
9385
|
-
fieldInput = /* @__PURE__ */
|
|
9765
|
+
fieldInput = /* @__PURE__ */ jsx85(TextField_default, { ...commonProps });
|
|
9386
9766
|
}
|
|
9387
|
-
return /* @__PURE__ */
|
|
9388
|
-
/* @__PURE__ */
|
|
9389
|
-
/* @__PURE__ */
|
|
9767
|
+
return /* @__PURE__ */ jsxs43(Fragment20, { children: [
|
|
9768
|
+
/* @__PURE__ */ jsx85("span", { style: styles.label, children: label }),
|
|
9769
|
+
/* @__PURE__ */ jsx85("div", { style: styles.value, children: fieldInput })
|
|
9390
9770
|
] });
|
|
9391
9771
|
}
|
|
9392
9772
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
9393
9773
|
const isFieldEditable = editable && fieldEditable;
|
|
9394
9774
|
let displayValue;
|
|
9395
9775
|
if (hasValue) {
|
|
9396
|
-
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */
|
|
9776
|
+
displayValue = key === "attributes" && typeof value === "object" && value !== null ? /* @__PURE__ */ jsx85(KeyValueInput_default, { value, readOnly: true, label: "" }) : String(renderedValue);
|
|
9397
9777
|
} else if (isFieldEditable) {
|
|
9398
9778
|
displayValue = getFieldPlaceholder(key);
|
|
9399
9779
|
} else {
|
|
9400
9780
|
displayValue = "-";
|
|
9401
9781
|
}
|
|
9402
|
-
return /* @__PURE__ */
|
|
9403
|
-
/* @__PURE__ */
|
|
9404
|
-
/* @__PURE__ */
|
|
9782
|
+
return /* @__PURE__ */ jsxs43(Fragment20, { children: [
|
|
9783
|
+
/* @__PURE__ */ jsx85("span", { style: styles.label, children: label }),
|
|
9784
|
+
/* @__PURE__ */ jsx85(
|
|
9405
9785
|
"div",
|
|
9406
9786
|
{
|
|
9407
9787
|
style: {
|
|
@@ -9409,7 +9789,7 @@ var BaseOrganizationProfile = ({
|
|
|
9409
9789
|
fontStyle: hasValue ? "normal" : "italic",
|
|
9410
9790
|
opacity: hasValue ? 1 : 0.7
|
|
9411
9791
|
},
|
|
9412
|
-
children: !hasValue && isFieldEditable && onStartEdit ? /* @__PURE__ */
|
|
9792
|
+
children: !hasValue && isFieldEditable && onStartEdit ? /* @__PURE__ */ jsx85(
|
|
9413
9793
|
"button",
|
|
9414
9794
|
{
|
|
9415
9795
|
onClick: onStartEdit,
|
|
@@ -9447,8 +9827,8 @@ var BaseOrganizationProfile = ({
|
|
|
9447
9827
|
alignItems: "center",
|
|
9448
9828
|
gap: `${theme.spacing.unit}px`
|
|
9449
9829
|
};
|
|
9450
|
-
return /* @__PURE__ */
|
|
9451
|
-
/* @__PURE__ */
|
|
9830
|
+
return /* @__PURE__ */ jsxs43("div", { style: fieldStyle, children: [
|
|
9831
|
+
/* @__PURE__ */ jsx85("div", { style: { flex: 1, display: "flex", alignItems: "center", gap: `${theme.spacing.unit}px` }, children: renderField(
|
|
9452
9832
|
field,
|
|
9453
9833
|
isFieldEditing,
|
|
9454
9834
|
(value) => {
|
|
@@ -9458,12 +9838,12 @@ var BaseOrganizationProfile = ({
|
|
|
9458
9838
|
},
|
|
9459
9839
|
() => toggleFieldEdit(field.key)
|
|
9460
9840
|
) }),
|
|
9461
|
-
isFieldEditable && /* @__PURE__ */
|
|
9462
|
-
/* @__PURE__ */
|
|
9463
|
-
/* @__PURE__ */
|
|
9841
|
+
isFieldEditable && /* @__PURE__ */ jsx85("div", { style: { display: "flex", alignItems: "center", gap: `${theme.spacing.unit / 2}px` }, children: isFieldEditing ? /* @__PURE__ */ jsxs43(Fragment20, { children: [
|
|
9842
|
+
/* @__PURE__ */ jsx85("button", { onClick: () => handleFieldSave(field.key), style: saveButtonStyle, title: "Save changes", children: saveButtonText }),
|
|
9843
|
+
/* @__PURE__ */ jsx85("button", { onClick: () => handleFieldCancel(field.key), style: cancelButtonStyle, title: "Cancel editing", children: cancelButtonText })
|
|
9464
9844
|
] }) : (
|
|
9465
9845
|
// Only show pencil icon when there's a value
|
|
9466
|
-
hasValue && /* @__PURE__ */
|
|
9846
|
+
hasValue && /* @__PURE__ */ jsx85(
|
|
9467
9847
|
"button",
|
|
9468
9848
|
{
|
|
9469
9849
|
onClick: () => toggleFieldEdit(field.key),
|
|
@@ -9479,7 +9859,7 @@ var BaseOrganizationProfile = ({
|
|
|
9479
9859
|
color: theme.colors.text.secondary
|
|
9480
9860
|
},
|
|
9481
9861
|
title: "Edit field",
|
|
9482
|
-
children: /* @__PURE__ */
|
|
9862
|
+
children: /* @__PURE__ */ jsx85(PencilIcon, {})
|
|
9483
9863
|
}
|
|
9484
9864
|
)
|
|
9485
9865
|
) })
|
|
@@ -9492,30 +9872,30 @@ var BaseOrganizationProfile = ({
|
|
|
9492
9872
|
...styles.root,
|
|
9493
9873
|
...cardLayout ? styles.card : {}
|
|
9494
9874
|
};
|
|
9495
|
-
const profileContent = /* @__PURE__ */
|
|
9496
|
-
/* @__PURE__ */
|
|
9497
|
-
/* @__PURE__ */
|
|
9498
|
-
/* @__PURE__ */
|
|
9499
|
-
/* @__PURE__ */
|
|
9500
|
-
organization.orgHandle && /* @__PURE__ */
|
|
9875
|
+
const profileContent = /* @__PURE__ */ jsxs43(Card_default, { style: containerStyle, className: clsx25(withVendorCSSClassPrefix24("organization-profile"), className), children: [
|
|
9876
|
+
/* @__PURE__ */ jsxs43("div", { style: styles.header, children: [
|
|
9877
|
+
/* @__PURE__ */ jsx85(Avatar, { name: getOrgInitials(organization.name), size: 80, alt: `${organization.name} logo` }),
|
|
9878
|
+
/* @__PURE__ */ jsxs43("div", { style: styles.orgInfo, children: [
|
|
9879
|
+
/* @__PURE__ */ jsx85("h2", { style: styles.name, children: organization.name }),
|
|
9880
|
+
organization.orgHandle && /* @__PURE__ */ jsxs43("p", { style: styles.handle, children: [
|
|
9501
9881
|
"@",
|
|
9502
9882
|
organization.orgHandle
|
|
9503
9883
|
] })
|
|
9504
9884
|
] })
|
|
9505
9885
|
] }),
|
|
9506
|
-
/* @__PURE__ */
|
|
9886
|
+
/* @__PURE__ */ jsx85("div", { style: styles.infoContainer, children: fields.map((field, index) => renderOrganizationField(field)) })
|
|
9507
9887
|
] });
|
|
9508
9888
|
if (mode === "popup") {
|
|
9509
|
-
return /* @__PURE__ */
|
|
9510
|
-
/* @__PURE__ */
|
|
9511
|
-
/* @__PURE__ */
|
|
9889
|
+
return /* @__PURE__ */ jsx85(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs43(DialogContent, { children: [
|
|
9890
|
+
/* @__PURE__ */ jsx85(DialogHeading, { children: title }),
|
|
9891
|
+
/* @__PURE__ */ jsx85("div", { style: { padding: "1rem" }, children: profileContent })
|
|
9512
9892
|
] }) });
|
|
9513
9893
|
}
|
|
9514
9894
|
return profileContent;
|
|
9515
9895
|
};
|
|
9516
|
-
var
|
|
9896
|
+
var useStyles9 = () => {
|
|
9517
9897
|
const { theme, colorScheme } = useTheme_default();
|
|
9518
|
-
return
|
|
9898
|
+
return useMemo19(
|
|
9519
9899
|
() => ({
|
|
9520
9900
|
root: {
|
|
9521
9901
|
padding: `${theme.spacing.unit * 4}px`,
|
|
@@ -9696,7 +10076,7 @@ var updateOrganization = async ({
|
|
|
9696
10076
|
var updateOrganization_default = updateOrganization;
|
|
9697
10077
|
|
|
9698
10078
|
// src/components/presentation/OrganizationProfile/OrganizationProfile.tsx
|
|
9699
|
-
import { jsx as
|
|
10079
|
+
import { jsx as jsx86 } from "react/jsx-runtime";
|
|
9700
10080
|
var OrganizationProfile = ({
|
|
9701
10081
|
organizationId,
|
|
9702
10082
|
mode = "default",
|
|
@@ -9704,15 +10084,15 @@ var OrganizationProfile = ({
|
|
|
9704
10084
|
onOpenChange,
|
|
9705
10085
|
onUpdate,
|
|
9706
10086
|
popupTitle,
|
|
9707
|
-
loadingFallback = /* @__PURE__ */
|
|
9708
|
-
errorFallback = /* @__PURE__ */
|
|
10087
|
+
loadingFallback = /* @__PURE__ */ jsx86("div", { children: "Loading organization..." }),
|
|
10088
|
+
errorFallback = /* @__PURE__ */ jsx86("div", { children: "Failed to load organization data" }),
|
|
9709
10089
|
...rest
|
|
9710
10090
|
}) => {
|
|
9711
10091
|
const { baseUrl } = useAsgardeo_default();
|
|
9712
10092
|
const { t } = useTranslation_default();
|
|
9713
|
-
const [organization, setOrganization] =
|
|
9714
|
-
const [loading, setLoading] =
|
|
9715
|
-
const [error, setError] =
|
|
10093
|
+
const [organization, setOrganization] = useState24(null);
|
|
10094
|
+
const [loading, setLoading] = useState24(true);
|
|
10095
|
+
const [error, setError] = useState24(false);
|
|
9716
10096
|
const fetchOrganization = async () => {
|
|
9717
10097
|
if (!baseUrl || !organizationId) {
|
|
9718
10098
|
setLoading(false);
|
|
@@ -9756,19 +10136,7 @@ var OrganizationProfile = ({
|
|
|
9756
10136
|
throw err;
|
|
9757
10137
|
}
|
|
9758
10138
|
};
|
|
9759
|
-
|
|
9760
|
-
return mode === "popup" ? /* @__PURE__ */ jsx85(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs43(DialogContent, { children: [
|
|
9761
|
-
/* @__PURE__ */ jsx85(DialogHeading, { children: popupTitle || t("organization.profile.title") }),
|
|
9762
|
-
/* @__PURE__ */ jsx85("div", { style: { padding: "1rem" }, children: loadingFallback })
|
|
9763
|
-
] }) }) : loadingFallback;
|
|
9764
|
-
}
|
|
9765
|
-
if (error) {
|
|
9766
|
-
return mode === "popup" ? /* @__PURE__ */ jsx85(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs43(DialogContent, { children: [
|
|
9767
|
-
/* @__PURE__ */ jsx85(DialogHeading, { children: popupTitle || t("organization.profile.title") }),
|
|
9768
|
-
/* @__PURE__ */ jsx85("div", { style: { padding: "1rem" }, children: errorFallback })
|
|
9769
|
-
] }) }) : errorFallback;
|
|
9770
|
-
}
|
|
9771
|
-
const profileContent = /* @__PURE__ */ jsx85(
|
|
10139
|
+
return /* @__PURE__ */ jsx86(
|
|
9772
10140
|
BaseOrganizationProfile_default,
|
|
9773
10141
|
{
|
|
9774
10142
|
organization,
|
|
@@ -9780,7 +10148,6 @@ var OrganizationProfile = ({
|
|
|
9780
10148
|
...rest
|
|
9781
10149
|
}
|
|
9782
10150
|
);
|
|
9783
|
-
return profileContent;
|
|
9784
10151
|
};
|
|
9785
10152
|
var OrganizationProfile_default = OrganizationProfile;
|
|
9786
10153
|
|
|
@@ -9788,10 +10155,10 @@ var OrganizationProfile_default = OrganizationProfile;
|
|
|
9788
10155
|
import { useEffect as useEffect15 } from "react";
|
|
9789
10156
|
|
|
9790
10157
|
// src/components/presentation/OrganizationList/BaseOrganizationList.tsx
|
|
9791
|
-
import { withVendorCSSClassPrefix as
|
|
9792
|
-
import
|
|
9793
|
-
import { useMemo as
|
|
9794
|
-
import { jsx as
|
|
10158
|
+
import { withVendorCSSClassPrefix as withVendorCSSClassPrefix25 } from "@asgardeo/browser";
|
|
10159
|
+
import clsx26 from "clsx";
|
|
10160
|
+
import { useMemo as useMemo20 } from "react";
|
|
10161
|
+
import { jsx as jsx87, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
9795
10162
|
var defaultRenderOrganization = (organization, styles) => {
|
|
9796
10163
|
const getOrgInitials = (name) => {
|
|
9797
10164
|
if (!name) return "ORG";
|
|
@@ -9799,9 +10166,9 @@ var defaultRenderOrganization = (organization, styles) => {
|
|
|
9799
10166
|
};
|
|
9800
10167
|
return /* @__PURE__ */ jsxs44("div", { style: styles.organizationItem, children: [
|
|
9801
10168
|
/* @__PURE__ */ jsxs44("div", { style: styles.organizationContent, children: [
|
|
9802
|
-
/* @__PURE__ */
|
|
10169
|
+
/* @__PURE__ */ jsx87(Avatar, { name: getOrgInitials(organization.name), size: 48, alt: `${organization.name} logo` }),
|
|
9803
10170
|
/* @__PURE__ */ jsxs44("div", { style: styles.organizationInfo, children: [
|
|
9804
|
-
/* @__PURE__ */
|
|
10171
|
+
/* @__PURE__ */ jsx87("h3", { style: styles.organizationName, children: organization.name }),
|
|
9805
10172
|
/* @__PURE__ */ jsxs44("p", { style: styles.organizationHandle, children: [
|
|
9806
10173
|
"@",
|
|
9807
10174
|
organization.orgHandle
|
|
@@ -9809,7 +10176,7 @@ var defaultRenderOrganization = (organization, styles) => {
|
|
|
9809
10176
|
/* @__PURE__ */ jsxs44("p", { style: styles.organizationStatus, children: [
|
|
9810
10177
|
"Status:",
|
|
9811
10178
|
" ",
|
|
9812
|
-
/* @__PURE__ */
|
|
10179
|
+
/* @__PURE__ */ jsx87(
|
|
9813
10180
|
"span",
|
|
9814
10181
|
{
|
|
9815
10182
|
style: {
|
|
@@ -9822,16 +10189,16 @@ var defaultRenderOrganization = (organization, styles) => {
|
|
|
9822
10189
|
] })
|
|
9823
10190
|
] })
|
|
9824
10191
|
] }),
|
|
9825
|
-
/* @__PURE__ */
|
|
10192
|
+
/* @__PURE__ */ jsx87("div", { style: styles.organizationActions, children: organization.canSwitch ? /* @__PURE__ */ jsx87("span", { style: { ...styles.badge, ...styles.successBadge }, children: "Can Switch" }) : /* @__PURE__ */ jsx87("span", { style: { ...styles.badge, ...styles.errorBadge }, children: "No Access" }) })
|
|
9826
10193
|
] }, organization.id);
|
|
9827
10194
|
};
|
|
9828
|
-
var defaultRenderLoading = (styles) => /* @__PURE__ */
|
|
10195
|
+
var defaultRenderLoading = (styles) => /* @__PURE__ */ jsx87("div", { style: styles.loadingContainer, children: /* @__PURE__ */ jsx87("div", { style: styles.loadingText, children: "Loading organizations..." }) });
|
|
9829
10196
|
var defaultRenderError = (error, styles) => /* @__PURE__ */ jsxs44("div", { style: styles.errorContainer, children: [
|
|
9830
|
-
/* @__PURE__ */
|
|
10197
|
+
/* @__PURE__ */ jsx87("strong", { children: "Error:" }),
|
|
9831
10198
|
" ",
|
|
9832
10199
|
error
|
|
9833
10200
|
] });
|
|
9834
|
-
var defaultRenderLoadMore = (onLoadMore, isLoading, styles) => /* @__PURE__ */
|
|
10201
|
+
var defaultRenderLoadMore = (onLoadMore, isLoading, styles) => /* @__PURE__ */ jsx87(
|
|
9835
10202
|
"button",
|
|
9836
10203
|
{
|
|
9837
10204
|
onClick: onLoadMore,
|
|
@@ -9844,7 +10211,7 @@ var defaultRenderLoadMore = (onLoadMore, isLoading, styles) => /* @__PURE__ */ j
|
|
|
9844
10211
|
children: isLoading ? "Loading..." : "Load More Organizations"
|
|
9845
10212
|
}
|
|
9846
10213
|
);
|
|
9847
|
-
var defaultRenderEmpty = (styles) => /* @__PURE__ */
|
|
10214
|
+
var defaultRenderEmpty = (styles) => /* @__PURE__ */ jsx87("div", { style: styles.emptyContainer, children: /* @__PURE__ */ jsx87("div", { style: styles.emptyText, children: "No organizations found" }) });
|
|
9848
10215
|
var BaseOrganizationList = ({
|
|
9849
10216
|
className = "",
|
|
9850
10217
|
data,
|
|
@@ -9866,67 +10233,67 @@ var BaseOrganizationList = ({
|
|
|
9866
10233
|
title = "Organizations",
|
|
9867
10234
|
totalCount
|
|
9868
10235
|
}) => {
|
|
9869
|
-
const styles =
|
|
10236
|
+
const styles = useStyles10();
|
|
9870
10237
|
const renderLoadingWithStyles = renderLoading || (() => defaultRenderLoading(styles));
|
|
9871
10238
|
const renderErrorWithStyles = renderError || ((error2) => defaultRenderError(error2, styles));
|
|
9872
10239
|
const renderEmptyWithStyles = renderEmpty || (() => defaultRenderEmpty(styles));
|
|
9873
10240
|
const renderLoadMoreWithStyles = renderLoadMore || ((onLoadMore, isLoading2) => defaultRenderLoadMore(onLoadMore, isLoading2, styles));
|
|
9874
10241
|
const renderOrganizationWithStyles = renderOrganization || ((org) => defaultRenderOrganization(org, styles));
|
|
9875
10242
|
if (isLoading && data.length === 0) {
|
|
9876
|
-
const loadingContent = /* @__PURE__ */
|
|
10243
|
+
const loadingContent = /* @__PURE__ */ jsx87(
|
|
9877
10244
|
"div",
|
|
9878
10245
|
{
|
|
9879
|
-
className:
|
|
10246
|
+
className: clsx26(withVendorCSSClassPrefix25("organization-list"), className),
|
|
9880
10247
|
style: { ...styles.root, ...style },
|
|
9881
10248
|
children: renderLoadingWithStyles()
|
|
9882
10249
|
}
|
|
9883
10250
|
);
|
|
9884
10251
|
if (mode === "popup") {
|
|
9885
|
-
return /* @__PURE__ */
|
|
9886
|
-
/* @__PURE__ */
|
|
9887
|
-
/* @__PURE__ */
|
|
10252
|
+
return /* @__PURE__ */ jsx87(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs44(DialogContent, { children: [
|
|
10253
|
+
/* @__PURE__ */ jsx87(DialogHeading, { children: title }),
|
|
10254
|
+
/* @__PURE__ */ jsx87("div", { style: styles.popupContent, children: loadingContent })
|
|
9888
10255
|
] }) });
|
|
9889
10256
|
}
|
|
9890
10257
|
return loadingContent;
|
|
9891
10258
|
}
|
|
9892
10259
|
if (error && data.length === 0) {
|
|
9893
|
-
const errorContent = /* @__PURE__ */
|
|
10260
|
+
const errorContent = /* @__PURE__ */ jsx87(
|
|
9894
10261
|
"div",
|
|
9895
10262
|
{
|
|
9896
|
-
className:
|
|
10263
|
+
className: clsx26(withVendorCSSClassPrefix25("organization-list"), className),
|
|
9897
10264
|
style: { ...styles.root, ...style },
|
|
9898
10265
|
children: renderErrorWithStyles(error)
|
|
9899
10266
|
}
|
|
9900
10267
|
);
|
|
9901
10268
|
if (mode === "popup") {
|
|
9902
|
-
return /* @__PURE__ */
|
|
9903
|
-
/* @__PURE__ */
|
|
9904
|
-
/* @__PURE__ */
|
|
10269
|
+
return /* @__PURE__ */ jsx87(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs44(DialogContent, { children: [
|
|
10270
|
+
/* @__PURE__ */ jsx87(DialogHeading, { children: title }),
|
|
10271
|
+
/* @__PURE__ */ jsx87("div", { style: styles.popupContent, children: errorContent })
|
|
9905
10272
|
] }) });
|
|
9906
10273
|
}
|
|
9907
10274
|
return errorContent;
|
|
9908
10275
|
}
|
|
9909
10276
|
if (!isLoading && data.length === 0) {
|
|
9910
|
-
const emptyContent = /* @__PURE__ */
|
|
10277
|
+
const emptyContent = /* @__PURE__ */ jsx87(
|
|
9911
10278
|
"div",
|
|
9912
10279
|
{
|
|
9913
|
-
className:
|
|
10280
|
+
className: clsx26(withVendorCSSClassPrefix25("organization-list"), className),
|
|
9914
10281
|
style: { ...styles.root, ...style },
|
|
9915
10282
|
children: renderEmptyWithStyles()
|
|
9916
10283
|
}
|
|
9917
10284
|
);
|
|
9918
10285
|
if (mode === "popup") {
|
|
9919
|
-
return /* @__PURE__ */
|
|
9920
|
-
/* @__PURE__ */
|
|
9921
|
-
/* @__PURE__ */
|
|
10286
|
+
return /* @__PURE__ */ jsx87(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs44(DialogContent, { children: [
|
|
10287
|
+
/* @__PURE__ */ jsx87(DialogHeading, { children: title }),
|
|
10288
|
+
/* @__PURE__ */ jsx87("div", { style: styles.popupContent, children: emptyContent })
|
|
9922
10289
|
] }) });
|
|
9923
10290
|
}
|
|
9924
10291
|
return emptyContent;
|
|
9925
10292
|
}
|
|
9926
|
-
const organizationListContent = /* @__PURE__ */ jsxs44("div", { className:
|
|
10293
|
+
const organizationListContent = /* @__PURE__ */ jsxs44("div", { className: clsx26(withVendorCSSClassPrefix25("organization-list"), className), style: { ...styles.root, ...style }, children: [
|
|
9927
10294
|
/* @__PURE__ */ jsxs44("div", { style: styles.header, children: [
|
|
9928
10295
|
/* @__PURE__ */ jsxs44("div", { style: styles.headerInfo, children: [
|
|
9929
|
-
/* @__PURE__ */
|
|
10296
|
+
/* @__PURE__ */ jsx87("h2", { style: styles.title, children: "Organizations" }),
|
|
9930
10297
|
totalCount !== void 0 && /* @__PURE__ */ jsxs44("p", { style: styles.subtitle, children: [
|
|
9931
10298
|
"Showing ",
|
|
9932
10299
|
data.length,
|
|
@@ -9935,25 +10302,25 @@ var BaseOrganizationList = ({
|
|
|
9935
10302
|
" organizations"
|
|
9936
10303
|
] })
|
|
9937
10304
|
] }),
|
|
9938
|
-
onRefresh && /* @__PURE__ */
|
|
10305
|
+
onRefresh && /* @__PURE__ */ jsx87("button", { onClick: onRefresh, style: styles.refreshButton, type: "button", children: "Refresh" })
|
|
9939
10306
|
] }),
|
|
9940
|
-
/* @__PURE__ */
|
|
10307
|
+
/* @__PURE__ */ jsx87("div", { style: styles.listContainer, children: data.map(
|
|
9941
10308
|
(organization, index) => renderOrganizationWithStyles(organization, index)
|
|
9942
10309
|
) }),
|
|
9943
|
-
error && data.length > 0 && /* @__PURE__ */
|
|
9944
|
-
hasMore && fetchMore && /* @__PURE__ */
|
|
10310
|
+
error && data.length > 0 && /* @__PURE__ */ jsx87("div", { style: styles.errorMargin, children: renderErrorWithStyles(error) }),
|
|
10311
|
+
hasMore && fetchMore && /* @__PURE__ */ jsx87("div", { style: styles.loadMoreMargin, children: renderLoadMoreWithStyles(fetchMore, isLoadingMore) })
|
|
9945
10312
|
] });
|
|
9946
10313
|
if (mode === "popup") {
|
|
9947
|
-
return /* @__PURE__ */
|
|
9948
|
-
/* @__PURE__ */
|
|
9949
|
-
/* @__PURE__ */
|
|
10314
|
+
return /* @__PURE__ */ jsx87(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs44(DialogContent, { children: [
|
|
10315
|
+
/* @__PURE__ */ jsx87(DialogHeading, { children: title }),
|
|
10316
|
+
/* @__PURE__ */ jsx87("div", { style: styles.popupContent, children: organizationListContent })
|
|
9950
10317
|
] }) });
|
|
9951
10318
|
}
|
|
9952
10319
|
return organizationListContent;
|
|
9953
10320
|
};
|
|
9954
|
-
var
|
|
10321
|
+
var useStyles10 = () => {
|
|
9955
10322
|
const { theme, colorScheme } = useTheme_default();
|
|
9956
|
-
return
|
|
10323
|
+
return useMemo20(
|
|
9957
10324
|
() => ({
|
|
9958
10325
|
root: {
|
|
9959
10326
|
padding: `${theme.spacing.unit * 4}px`,
|
|
@@ -10117,7 +10484,7 @@ var useStyles9 = () => {
|
|
|
10117
10484
|
var BaseOrganizationList_default = BaseOrganizationList;
|
|
10118
10485
|
|
|
10119
10486
|
// src/components/presentation/OrganizationList/OrganizationList.tsx
|
|
10120
|
-
import { jsx as
|
|
10487
|
+
import { jsx as jsx88, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
10121
10488
|
var OrganizationList = ({
|
|
10122
10489
|
autoFetch = true,
|
|
10123
10490
|
filter = "",
|
|
@@ -10169,7 +10536,7 @@ var OrganizationList = ({
|
|
|
10169
10536
|
},
|
|
10170
10537
|
children: [
|
|
10171
10538
|
/* @__PURE__ */ jsxs45("div", { children: [
|
|
10172
|
-
/* @__PURE__ */
|
|
10539
|
+
/* @__PURE__ */ jsx88("h3", { style: { fontSize: "18px", fontWeight: "bold", margin: "0 0 8px 0" }, children: organization.name }),
|
|
10173
10540
|
/* @__PURE__ */ jsxs45("p", { style: { color: "#6b7280", fontSize: "14px", margin: "0" }, children: [
|
|
10174
10541
|
"Handle: ",
|
|
10175
10542
|
organization.orgHandle
|
|
@@ -10177,10 +10544,10 @@ var OrganizationList = ({
|
|
|
10177
10544
|
/* @__PURE__ */ jsxs45("p", { style: { color: "#6b7280", fontSize: "14px", margin: "4px 0 0 0" }, children: [
|
|
10178
10545
|
"Status:",
|
|
10179
10546
|
" ",
|
|
10180
|
-
/* @__PURE__ */
|
|
10547
|
+
/* @__PURE__ */ jsx88("span", { style: { color: organization.status === "ACTIVE" ? "#10b981" : "#ef4444" }, children: organization.status })
|
|
10181
10548
|
] })
|
|
10182
10549
|
] }),
|
|
10183
|
-
/* @__PURE__ */
|
|
10550
|
+
/* @__PURE__ */ jsx88("div", { style: { alignItems: "center", display: "flex" }, children: organization.canSwitch ? /* @__PURE__ */ jsx88(
|
|
10184
10551
|
"span",
|
|
10185
10552
|
{
|
|
10186
10553
|
style: {
|
|
@@ -10193,7 +10560,7 @@ var OrganizationList = ({
|
|
|
10193
10560
|
},
|
|
10194
10561
|
children: "Can Switch"
|
|
10195
10562
|
}
|
|
10196
|
-
) : /* @__PURE__ */
|
|
10563
|
+
) : /* @__PURE__ */ jsx88(
|
|
10197
10564
|
"span",
|
|
10198
10565
|
{
|
|
10199
10566
|
style: {
|
|
@@ -10219,7 +10586,7 @@ var OrganizationList = ({
|
|
|
10219
10586
|
reset: true
|
|
10220
10587
|
});
|
|
10221
10588
|
};
|
|
10222
|
-
return /* @__PURE__ */
|
|
10589
|
+
return /* @__PURE__ */ jsx88(
|
|
10223
10590
|
BaseOrganizationList_default,
|
|
10224
10591
|
{
|
|
10225
10592
|
data: paginatedOrganizations,
|
|
@@ -10238,7 +10605,7 @@ var OrganizationList = ({
|
|
|
10238
10605
|
var OrganizationList_default = OrganizationList;
|
|
10239
10606
|
|
|
10240
10607
|
// src/components/primitives/Icons/BuildingAlt.tsx
|
|
10241
|
-
import { jsx as
|
|
10608
|
+
import { jsx as jsx89, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
10242
10609
|
var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @__PURE__ */ jsxs46(
|
|
10243
10610
|
"svg",
|
|
10244
10611
|
{
|
|
@@ -10252,13 +10619,13 @@ var BuildingAlt = ({ color = "currentColor", height = 24, width = 24 }) => /* @_
|
|
|
10252
10619
|
"stroke-linecap": "round",
|
|
10253
10620
|
"stroke-linejoin": "round",
|
|
10254
10621
|
children: [
|
|
10255
|
-
/* @__PURE__ */
|
|
10256
|
-
/* @__PURE__ */
|
|
10257
|
-
/* @__PURE__ */
|
|
10258
|
-
/* @__PURE__ */
|
|
10259
|
-
/* @__PURE__ */
|
|
10260
|
-
/* @__PURE__ */
|
|
10261
|
-
/* @__PURE__ */
|
|
10622
|
+
/* @__PURE__ */ jsx89("path", { d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" }),
|
|
10623
|
+
/* @__PURE__ */ jsx89("path", { d: "M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" }),
|
|
10624
|
+
/* @__PURE__ */ jsx89("path", { d: "M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2" }),
|
|
10625
|
+
/* @__PURE__ */ jsx89("path", { d: "M10 6h4" }),
|
|
10626
|
+
/* @__PURE__ */ jsx89("path", { d: "M10 10h4" }),
|
|
10627
|
+
/* @__PURE__ */ jsx89("path", { d: "M10 14h4" }),
|
|
10628
|
+
/* @__PURE__ */ jsx89("path", { d: "M10 18h4" })
|
|
10262
10629
|
]
|
|
10263
10630
|
}
|
|
10264
10631
|
);
|
|
@@ -10266,7 +10633,7 @@ BuildingAlt.displayName = "BuildingAlt";
|
|
|
10266
10633
|
var BuildingAlt_default = BuildingAlt;
|
|
10267
10634
|
|
|
10268
10635
|
// src/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
|
|
10269
|
-
import { Fragment as Fragment21, jsx as
|
|
10636
|
+
import { Fragment as Fragment21, jsx as jsx90, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
10270
10637
|
var OrganizationSwitcher = ({
|
|
10271
10638
|
currentOrganization: propCurrentOrganization,
|
|
10272
10639
|
fallback = null,
|
|
@@ -10282,15 +10649,15 @@ var OrganizationSwitcher = ({
|
|
|
10282
10649
|
isLoading,
|
|
10283
10650
|
error
|
|
10284
10651
|
} = useOrganization_default();
|
|
10285
|
-
const [isCreateOrgOpen, setIsCreateOrgOpen] =
|
|
10286
|
-
const [isProfileOpen, setIsProfileOpen] =
|
|
10287
|
-
const [isOrganizationListOpen, setIsOrganizationListOpen] =
|
|
10652
|
+
const [isCreateOrgOpen, setIsCreateOrgOpen] = useState25(false);
|
|
10653
|
+
const [isProfileOpen, setIsProfileOpen] = useState25(false);
|
|
10654
|
+
const [isOrganizationListOpen, setIsOrganizationListOpen] = useState25(false);
|
|
10288
10655
|
const { t } = useTranslation_default();
|
|
10289
10656
|
if (!isSignedIn && fallback) {
|
|
10290
10657
|
return fallback;
|
|
10291
10658
|
}
|
|
10292
10659
|
if (!isSignedIn) {
|
|
10293
|
-
return /* @__PURE__ */
|
|
10660
|
+
return /* @__PURE__ */ jsx90(Fragment21, {});
|
|
10294
10661
|
}
|
|
10295
10662
|
const organizations = propOrganizations || contextOrganizations || [];
|
|
10296
10663
|
const currentOrganization = propCurrentOrganization || contextCurrentOrganization;
|
|
@@ -10304,19 +10671,19 @@ var OrganizationSwitcher = ({
|
|
|
10304
10671
|
const defaultMenuItems = [];
|
|
10305
10672
|
if (currentOrganization) {
|
|
10306
10673
|
defaultMenuItems.push({
|
|
10307
|
-
icon: /* @__PURE__ */
|
|
10674
|
+
icon: /* @__PURE__ */ jsx90(BuildingAlt_default, {}),
|
|
10308
10675
|
label: t("organization.switcher.manage.organizations"),
|
|
10309
10676
|
onClick: handleManageOrganizations
|
|
10310
10677
|
});
|
|
10311
10678
|
}
|
|
10312
10679
|
defaultMenuItems.push({
|
|
10313
|
-
icon: /* @__PURE__ */
|
|
10680
|
+
icon: /* @__PURE__ */ jsx90("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx90("path", { d: "M12 5v14m-7-7h14" }) }),
|
|
10314
10681
|
label: t("organization.switcher.create.organization"),
|
|
10315
10682
|
onClick: () => setIsCreateOrgOpen(true)
|
|
10316
10683
|
});
|
|
10317
10684
|
const menuItems = props.menuItems ? [...defaultMenuItems, ...props.menuItems] : defaultMenuItems;
|
|
10318
10685
|
return /* @__PURE__ */ jsxs47(Fragment21, { children: [
|
|
10319
|
-
/* @__PURE__ */
|
|
10686
|
+
/* @__PURE__ */ jsx90(
|
|
10320
10687
|
BaseOrganizationSwitcher_default,
|
|
10321
10688
|
{
|
|
10322
10689
|
organizations,
|
|
@@ -10329,7 +10696,7 @@ var OrganizationSwitcher = ({
|
|
|
10329
10696
|
...props
|
|
10330
10697
|
}
|
|
10331
10698
|
),
|
|
10332
|
-
/* @__PURE__ */
|
|
10699
|
+
/* @__PURE__ */ jsx90(
|
|
10333
10700
|
CreateOrganization,
|
|
10334
10701
|
{
|
|
10335
10702
|
mode: "popup",
|
|
@@ -10343,7 +10710,7 @@ var OrganizationSwitcher = ({
|
|
|
10343
10710
|
}
|
|
10344
10711
|
}
|
|
10345
10712
|
),
|
|
10346
|
-
currentOrganization && /* @__PURE__ */
|
|
10713
|
+
currentOrganization && /* @__PURE__ */ jsx90(
|
|
10347
10714
|
OrganizationProfile_default,
|
|
10348
10715
|
{
|
|
10349
10716
|
organizationId: currentOrganization.id,
|
|
@@ -10351,11 +10718,11 @@ var OrganizationSwitcher = ({
|
|
|
10351
10718
|
open: isProfileOpen,
|
|
10352
10719
|
onOpenChange: setIsProfileOpen,
|
|
10353
10720
|
cardLayout: true,
|
|
10354
|
-
loadingFallback: /* @__PURE__ */
|
|
10355
|
-
errorFallback: /* @__PURE__ */
|
|
10721
|
+
loadingFallback: /* @__PURE__ */ jsx90("div", { children: t("organization.profile.loading") }),
|
|
10722
|
+
errorFallback: /* @__PURE__ */ jsx90("div", { children: t("organization.profile.error") })
|
|
10356
10723
|
}
|
|
10357
10724
|
),
|
|
10358
|
-
/* @__PURE__ */
|
|
10725
|
+
/* @__PURE__ */ jsx90(
|
|
10359
10726
|
OrganizationList_default,
|
|
10360
10727
|
{
|
|
10361
10728
|
mode: "popup",
|
|
@@ -10393,6 +10760,7 @@ export {
|
|
|
10393
10760
|
BaseUser_default as BaseUser,
|
|
10394
10761
|
BaseUserDropdown_default as BaseUserDropdown,
|
|
10395
10762
|
BaseUserProfile_default as BaseUserProfile,
|
|
10763
|
+
BuildingAlt_default as BuildingAlt,
|
|
10396
10764
|
Button_default as Button,
|
|
10397
10765
|
Card_default as Card,
|
|
10398
10766
|
CardAction,
|
|
@@ -10426,6 +10794,7 @@ export {
|
|
|
10426
10794
|
LinkedInButton_default as LinkedInButton,
|
|
10427
10795
|
LogOut_default as LogOut,
|
|
10428
10796
|
MicrosoftButton_default as MicrosoftButton,
|
|
10797
|
+
MultiInput_default as MultiInput,
|
|
10429
10798
|
MultiOptionButton_default as MultiOptionButton,
|
|
10430
10799
|
Organization_default as Organization,
|
|
10431
10800
|
OrganizationContext_default as OrganizationContext,
|