feat: update keycloak theme

This commit is contained in:
Jonas Juselius
2024-02-22 09:47:34 +01:00
parent d6fde78f8d
commit f9e012da95
9813 changed files with 611335 additions and 162181 deletions
@@ -1,3 +1,3 @@
import * as React from "../../../common/keycloak/web_modules/react.js";
import * as React from "../../keycloak.v2/web_modules/react.js";
export const AccountServiceContext = React.createContext(undefined);
//# sourceMappingURL=AccountServiceContext.js.map
@@ -1 +1 @@
{"version":3,"sources":["../../src/app/account-service/AccountServiceContext.tsx"],"names":["React","AccountServiceContext","createContext","undefined"],"mappings":"AAAA,OAAO,KAAKA,KAAZ;AAGA,OAAO,MAAMC,qBAAqB,GAAGD,KAAK,CAACE,aAAN,CAAsDC,SAAtD,CAA9B","sourcesContent":["import * as React from 'react';\nimport { AccountServiceClient } from './account.service';\n\nexport const AccountServiceContext = React.createContext<AccountServiceClient | undefined>(undefined);"],"file":"AccountServiceContext.js"}
{"version":3,"file":"AccountServiceContext.js","names":["React","AccountServiceContext","createContext","undefined"],"sources":["../../src/app/account-service/AccountServiceContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { AccountServiceClient } from './account.service';\n\nexport const AccountServiceContext = React.createContext<AccountServiceClient | undefined>(undefined);"],"mappings":"AAAA,OAAO,KAAKA,KAAK;AAGjB,OAAO,MAAMC,qBAAqB,GAAGD,KAAK,CAACE,aAAa,CAAmCC,SAAS,CAAC"}
@@ -1,5 +1,6 @@
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/*
* Copyright 2018 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @author tags. All rights reserved.
@@ -16,71 +17,64 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
* License for the specific language governing permissions and limitations under
* the License.
*/
import { ContentAlert } from "../content/ContentAlert.js";
export class AccountServiceError extends Error {
constructor(response) {
super(response.statusText);
this.response = response;
}
}
/**
*
* @author Stan Silvert ssilvert@redhat.com (C) 2018 Red Hat Inc.
*/
export class AccountServiceClient {
constructor(keycloakService) {
_defineProperty(this, "kcSvc", void 0);
_defineProperty(this, "accountUrl", void 0);
this.kcSvc = keycloakService;
this.accountUrl = this.kcSvc.authServerUrl() + 'realms/' + this.kcSvc.realm() + '/account';
}
async doGet(endpoint, config) {
return this.doRequest(endpoint, { ...config,
return this.doRequest(endpoint, {
...config,
method: 'get'
});
}
async doDelete(endpoint, config) {
return this.doRequest(endpoint, { ...config,
return this.doRequest(endpoint, {
...config,
method: 'delete'
});
}
async doPost(endpoint, body, config) {
return this.doRequest(endpoint, { ...config,
return this.doRequest(endpoint, {
...config,
body: JSON.stringify(body),
method: 'post'
});
}
async doPut(endpoint, body, config) {
return this.doRequest(endpoint, { ...config,
return this.doRequest(endpoint, {
...config,
body: JSON.stringify(body),
method: 'put'
});
}
async doRequest(endpoint, config) {
const response = await fetch(this.makeUrl(endpoint, config).toString(), await this.makeConfig(config));
try {
response.data = await response.json();
} catch (e) {} // ignore. Might be empty
if (!response.ok) {
this.handleError(response);
throw new AccountServiceError(response);
}
return response;
}
handleError(response) {
if (response !== null && response.status === 401) {
if (this.kcSvc.authenticated() && !this.kcSvc.audiencePresent()) {
@@ -91,40 +85,36 @@ export class AccountServiceClient {
this.kcSvc.login();
}
}
if (response !== null && response.status === 403) {
window.location.href = baseUrl + '#/forbidden';
}
if (response !== null && response.data != null) {
if (response.data['errors'] != null) {
for (let err of response.data['errors']) ContentAlert.danger(err['errorMessage'], err['params']);
} else {
ContentAlert.danger(`${response.statusText}: ${response.data['errorMessage'] ? response.data['errorMessage'] : ''} ${response.data['error'] ? response.data['error'] : ''}`);
}
;
} else {
ContentAlert.danger(response.statusText);
}
}
makeUrl(endpoint, config) {
if (endpoint.startsWith('http')) return new URL(endpoint);
const url = new URL(this.accountUrl + endpoint); // add request params
const url = new URL(this.accountUrl + endpoint);
// add request params
if (config && config.hasOwnProperty('params')) {
const params = config.params || {};
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));
}
return url;
}
makeConfig(config = {}) {
return new Promise(resolve => {
this.kcSvc.getToken().then(token => {
resolve({ ...config,
resolve({
...config,
headers: {
'Content-Type': 'application/json',
...config.headers,
@@ -136,7 +126,6 @@ export class AccountServiceClient {
});
});
}
}
window.addEventListener("unhandledrejection", event => {
event.promise.catch(error => {
File diff suppressed because one or more lines are too long