Fixed build warnings
Some checks failed
armco-org/iam-client-sdk/pipeline/head There was a failure building this commit

This commit is contained in:
2025-12-28 19:20:52 +05:30
parent 7ccf50ffd4
commit 2d76a72910
5 changed files with 16 additions and 12 deletions

8
dist/react.js vendored
View File

@@ -643,16 +643,18 @@ function useHasRole(roles) {
function withAuth(WrappedComponent, options) {
return function AuthenticatedComponent(props) {
const { isAuthenticated, isLoading, user } = useAuth();
const LoadingComp = options?.LoadingComponent;
const UnauthorizedComp = options?.UnauthorizedComponent;
if (isLoading) {
return options?.LoadingComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(options.LoadingComponent, {}) : null;
return LoadingComp ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingComp, {}) : null;
}
if (!isAuthenticated) {
return options?.UnauthorizedComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(options.UnauthorizedComponent, {}) : null;
return UnauthorizedComp ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnauthorizedComp, {}) : null;
}
if (options?.roles && options.roles.length > 0) {
const hasRequiredRole = options.roles.some((role) => user?.roles?.includes(role));
if (!hasRequiredRole) {
return options?.UnauthorizedComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(options.UnauthorizedComponent, {}) : null;
return UnauthorizedComp ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnauthorizedComp, {}) : null;
}
}
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WrappedComponent, { ...props });

2
dist/react.js.map vendored

File diff suppressed because one or more lines are too long

8
dist/react.mjs vendored
View File

@@ -620,16 +620,18 @@ function useHasRole(roles) {
function withAuth(WrappedComponent, options) {
return function AuthenticatedComponent(props) {
const { isAuthenticated, isLoading, user } = useAuth();
const LoadingComp = options?.LoadingComponent;
const UnauthorizedComp = options?.UnauthorizedComponent;
if (isLoading) {
return options?.LoadingComponent ? /* @__PURE__ */ jsx(options.LoadingComponent, {}) : null;
return LoadingComp ? /* @__PURE__ */ jsx(LoadingComp, {}) : null;
}
if (!isAuthenticated) {
return options?.UnauthorizedComponent ? /* @__PURE__ */ jsx(options.UnauthorizedComponent, {}) : null;
return UnauthorizedComp ? /* @__PURE__ */ jsx(UnauthorizedComp, {}) : null;
}
if (options?.roles && options.roles.length > 0) {
const hasRequiredRole = options.roles.some((role) => user?.roles?.includes(role));
if (!hasRequiredRole) {
return options?.UnauthorizedComponent ? /* @__PURE__ */ jsx(options.UnauthorizedComponent, {}) : null;
return UnauthorizedComp ? /* @__PURE__ */ jsx(UnauthorizedComp, {}) : null;
}
}
return /* @__PURE__ */ jsx(WrappedComponent, { ...props });

2
dist/react.mjs.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -7,14 +7,14 @@
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
"require": "./dist/index.js"
},
"./react": {
"types": "./dist/react.d.ts",
"import": "./dist/react.mjs",
"require": "./dist/react.js",
"types": "./dist/react.d.ts"
"require": "./dist/react.js"
}
},
"files": [