@powerportalspro/react 6.0.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +43 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -1
- package/dist/index.d.ts +55 -1
- package/dist/index.js +44 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1059,6 +1059,24 @@ function PowerPortalsProProvider({
|
|
|
1059
1059
|
}
|
|
1060
1060
|
return response;
|
|
1061
1061
|
}, [auth, refreshAuth]);
|
|
1062
|
+
const impersonate = react.useCallback(async (targetUserId) => {
|
|
1063
|
+
const response = await auth.impersonateAsync(targetUserId);
|
|
1064
|
+
if (response.result === core.ImpersonateResult.Started) {
|
|
1065
|
+
await refreshAuth();
|
|
1066
|
+
}
|
|
1067
|
+
return response;
|
|
1068
|
+
}, [auth, refreshAuth]);
|
|
1069
|
+
const stopImpersonation = react.useCallback(async () => {
|
|
1070
|
+
const response = await auth.stopImpersonationAsync();
|
|
1071
|
+
if (response.result === core.StopImpersonationResult.Stopped || response.result === core.StopImpersonationResult.ImpersonatorNotFound) {
|
|
1072
|
+
await refreshAuth();
|
|
1073
|
+
}
|
|
1074
|
+
return response;
|
|
1075
|
+
}, [auth, refreshAuth]);
|
|
1076
|
+
const searchImpersonationTargets = react.useCallback(
|
|
1077
|
+
(query) => auth.searchImpersonationTargetsAsync(query),
|
|
1078
|
+
[auth]
|
|
1079
|
+
);
|
|
1062
1080
|
react.useEffect(() => {
|
|
1063
1081
|
refreshAuth();
|
|
1064
1082
|
}, [refreshAuth]);
|
|
@@ -1075,7 +1093,10 @@ function PowerPortalsProProvider({
|
|
|
1075
1093
|
refreshAuth,
|
|
1076
1094
|
login,
|
|
1077
1095
|
logout,
|
|
1078
|
-
switchIdentity
|
|
1096
|
+
switchIdentity,
|
|
1097
|
+
impersonate,
|
|
1098
|
+
stopImpersonation,
|
|
1099
|
+
searchImpersonationTargets
|
|
1079
1100
|
}),
|
|
1080
1101
|
[
|
|
1081
1102
|
transportInstance,
|
|
@@ -1089,7 +1110,10 @@ function PowerPortalsProProvider({
|
|
|
1089
1110
|
refreshAuth,
|
|
1090
1111
|
login,
|
|
1091
1112
|
logout,
|
|
1092
|
-
switchIdentity
|
|
1113
|
+
switchIdentity,
|
|
1114
|
+
impersonate,
|
|
1115
|
+
stopImpersonation,
|
|
1116
|
+
searchImpersonationTargets
|
|
1093
1117
|
]
|
|
1094
1118
|
);
|
|
1095
1119
|
let localizationContent;
|
|
@@ -1143,13 +1167,25 @@ function CacheLocaleSync() {
|
|
|
1143
1167
|
|
|
1144
1168
|
// src/use-auth.ts
|
|
1145
1169
|
function useAuth() {
|
|
1146
|
-
const {
|
|
1170
|
+
const {
|
|
1171
|
+
authState,
|
|
1172
|
+
refreshAuth,
|
|
1173
|
+
login,
|
|
1174
|
+
logout,
|
|
1175
|
+
switchIdentity,
|
|
1176
|
+
impersonate,
|
|
1177
|
+
stopImpersonation,
|
|
1178
|
+
searchImpersonationTargets
|
|
1179
|
+
} = usePowerPortalsPro();
|
|
1147
1180
|
return {
|
|
1148
1181
|
...authState,
|
|
1149
1182
|
refresh: refreshAuth,
|
|
1150
1183
|
login,
|
|
1151
1184
|
logout,
|
|
1152
|
-
switchIdentity
|
|
1185
|
+
switchIdentity,
|
|
1186
|
+
impersonate,
|
|
1187
|
+
stopImpersonation,
|
|
1188
|
+
searchImpersonationTargets
|
|
1153
1189
|
};
|
|
1154
1190
|
}
|
|
1155
1191
|
function AuthorizedView({ children, roles, fallback = null }) {
|
|
@@ -1403,6 +1439,7 @@ function useViewDataSource(options) {
|
|
|
1403
1439
|
const rows = data?.tableRecords ?? EMPTY_RECORDS;
|
|
1404
1440
|
const columns = data?.columns ?? EMPTY_COLUMNS;
|
|
1405
1441
|
const totalCount = data?.pagingInfo?.totalRecordCount;
|
|
1442
|
+
const moreRecords = data?.pagingInfo?.moreRecords;
|
|
1406
1443
|
const tablePermissions = data?.tablePermissions;
|
|
1407
1444
|
const aggregations = options.aggregations ?? EMPTY_AGGREGATION_SPEC;
|
|
1408
1445
|
const isFetchingAggregations = query.isFetching && debouncedRequest.aggregations !== void 0 && debouncedRequest.aggregations !== null && debouncedRequest.aggregations.length > 0;
|
|
@@ -1428,6 +1465,7 @@ function useViewDataSource(options) {
|
|
|
1428
1465
|
status: query.status,
|
|
1429
1466
|
rows,
|
|
1430
1467
|
totalCount,
|
|
1468
|
+
moreRecords,
|
|
1431
1469
|
columns,
|
|
1432
1470
|
tablePermissions,
|
|
1433
1471
|
aggregationResults,
|
|
@@ -1453,6 +1491,7 @@ function useViewDataSource(options) {
|
|
|
1453
1491
|
query.status,
|
|
1454
1492
|
rows,
|
|
1455
1493
|
totalCount,
|
|
1494
|
+
moreRecords,
|
|
1456
1495
|
columns,
|
|
1457
1496
|
tablePermissions,
|
|
1458
1497
|
aggregationResults,
|