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G,EAAkC,OAAO,EAC7C,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAkBE,OAAQD,IAAK,CAClD,MAAME,EAAeH,EAAkBC,GAEvC,GAAI/B,EAAWkC,YACd,IAAK,IAAIC,EAAI,EAAGA,EAAInC,EAAWkC,YAAYE,MAAMJ,OAAQG,IAGxD,GAAIF,IAFgBjC,EAAWkC,YAAYE,MAAMD,GAGjD,OAAO,C,CAIV,OAAO,CACR,CAEQ,4BAAOf,CAAsBpB,EAA8BkB,EAA+CjB,GACjH,OAA4E,GAAxEH,EAAmBkB,aAAahB,EAAYkB,IACzCjB,EAAiByB,SAAW,IAAYG,QAChD,CAEA,4BAAOP,CAAsBtB,EAA+BkB,EAA+ChB,GAC1G,OAA4E,GAAxEJ,EAAmBkB,aAAahB,EAAYkB,IACzChB,EAAaE,SAAW,IAAQiC,QACxC,CAEQ,6BAAOb,CAAuBxB,EAA8BkB,EAA+ChB,GAClH,OAA4E,GAAxEJ,EAAmBkB,aAAahB,EAAYkB,IACzChB,EAAaE,SAAW,IAAQqB,SACxC,E","sources":["webpack://client-app/./src/app/services/AWJClient.ts","webpack://client-app/./src/app/services/AoxRequestBuilder.ts","webpack://client-app/./src/app/services/AzFuncsClient.ts","webpack://client-app/./src/app/services/BimClient.ts","webpack://client-app/./src/app/services/RequestExecution.ts","webpack://client-app/./src/app/services/RequestErrorHandling.ts","webpack://client-app/./src/app/services/RequestMethod.ts","webpack://client-app/./src/app/services/ViewerThreeDServiceIF.ts","webpack://client-app/./src/app/services/access-level-service.ts"],"sourcesContent":["import { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { ErrorService } from './error-service';\r\nimport { ModalService } from './modal-service';\r\nimport { I18N } from 'aurelia-i18n';\r\nimport * as environment from '../../../config/environment.json';\r\nimport { ProjectTokenService } from './project-token-service';\r\nimport { OrgTokenService } from './org-token-service';\r\nimport { AppContextService } from './app-context-service';\r\nimport { ApiClient } from './api-client';\r\n\r\n\r\nexport class AWJClient extends ApiClient {\r\n\t// how do we configure in api?\r\n\tconstructor(modal: ModalService, errorService: ErrorService, events: EventAggregator,\r\n\t\ti18n: I18N, public projectTokenService: ProjectTokenService,\r\n\t\tpublic orgTokenService: OrgTokenService //, public appContext: AppContextService\r\n\t) {\r\n\t\tsuper(modal, errorService, events, i18n, projectTokenService, orgTokenService); //, appContext);\r\n\t}\r\n\r\n\tpublic async initialize(): Promise<void> {\r\n\t\t// JG: I wonder if it works by having multiple ClientApp\\config\\environment.json?\r\n\t\t//let prodBecauseHTTPS: boolean = this.isProd();\r\n\t\t// https://bg-worker-wa.azurewebsites.net, TODO: must be split into named test and prod!\r\n\t\tlet AWJ_BaseUrl = environment.azureWebJobsUrl;\r\n\t\tif (!AWJ_BaseUrl) { throw 'environment.azureWebJobsUrl setting is missing.'; }\r\n\r\n\t\tthis.set_apiUrl(AWJ_BaseUrl);\r\n\t\tconsole.log('AWJ-Client!', AWJ_BaseUrl);\r\n\t\tthis.version = 'no-bim-client-version';\r\n\t\tthis.build = 'no-bim-client-build';\r\n\t}\r\n}\r\n","import { HttpClient, HttpResponseMessage, RequestBuilder } from \"aurelia-http-client\";\r\n\r\nexport class AoxRequestBuilder {\r\n\theaders: object = {};\r\n\tmethod: string = \"\";\r\n\tcontent?: any;\r\n\tnoGui: boolean = false;\r\n\r\n\t//private route: string = \"\";\r\n\tpublic route: string = \"\"; // let us inspect for error handling.\r\n\r\n\r\n\tconstructor(apiUrl: string) {\r\n\t\tthis.addRouteSection(apiUrl);\r\n\t}\r\n\r\n\tpublic addRouteSection(section: string): void {\r\n\t\tthis.route += section;\r\n\t}\r\n\tasync sendXhrCall(responseType?: string, fn?:(a:any)=>void): Promise<HttpResponseMessage> {\r\n\t\tlet client = new HttpClient();\r\n\t\tlet builder: RequestBuilder = client.createRequest(this.route); // RequestBuilder.withProgressCallback\r\n\r\n\t\tif (fn) { builder.withProgressCallback( fn ); }\r\n\r\n\t\tif (this.method == 'GET') {\r\n\t\t\tbuilder = builder.asGet();\r\n\t\t} else if (this.method == 'POST') {\r\n\t\t\tbuilder = builder.asPost().withContent(this.content);\r\n\t\t}\r\n\r\n\t\tif (responseType) {\r\n\t\t\tbuilder = builder.withResponseType(responseType);\r\n\t\t}\r\n\r\n\t\tObject.keys(this.headers).forEach(x => builder = builder.withHeader(x, (<any>this.headers)[x]));\r\n\t\treturn builder.send();\r\n\t}\r\n}\r\n","import { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { ErrorService } from './error-service';\r\nimport { ModalService } from './modal-service';\r\nimport { I18N } from 'aurelia-i18n';\r\nimport * as environment from '../../../config/environment.json';\r\nimport { ProjectTokenService } from './project-token-service';\r\nimport { OrgTokenService } from './org-token-service';\r\nimport { AppContextService } from './app-context-service';\r\nimport { ApiClient } from './api-client';\r\n\r\n\r\nexport class AzFuncsClient extends ApiClient {\r\n\tconstructor(modal: ModalService, errorService: ErrorService, events: EventAggregator,\r\n\t\ti18n: I18N, public projectTokenService: ProjectTokenService,\r\n\t\tpublic orgTokenService: OrgTokenService //, public appContext: AppContextService\r\n\t) {\r\n\t\tsuper(modal, errorService, events, i18n, projectTokenService, orgTokenService); //, appContext);\r\n\t}\r\n\r\n\tpublic async initialize(): Promise<void> {\r\n\t\t// JG: I wonder if it works by having multiple ClientApp\\config\\environment.json?\r\n\t\t//let prodBecauseHTTPS: boolean = this.isProd();\r\n\t\tlet AzFunc_BaseUrl = environment.azureFunctionsUrl;\r\n\t\tif (!AzFunc_BaseUrl) { throw 'environment.azureFunctionsUrl setting is missing.'; }\r\n\r\n\t\tthis.set_apiUrl(AzFunc_BaseUrl);\r\n\t\tconsole.log('AzF-Client', AzFunc_BaseUrl);\r\n\t\tthis.version = 'no-bim-client-version';\r\n\t\tthis.build = 'no-bim-client-build';\r\n\t}\r\n}\r\n","import { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { ErrorService } from './error-service';\r\nimport { ModalService } from './modal-service';\r\nimport { I18N } from 'aurelia-i18n';\r\nimport * as environment from '../../../config/environment.json';\r\nimport { ProjectTokenService } from './project-token-service';\r\nimport { OrgTokenService } from './org-token-service';\r\nimport { AppContextService } from './app-context-service';\r\nimport { ApiClient } from './api-client';\r\n\r\n\r\nexport class BimClient extends ApiClient {\r\n\tconstructor(modal: ModalService, errorService: ErrorService, events: EventAggregator,\r\n\t\ti18n: I18N, public projectTokenService: ProjectTokenService,\r\n\t\tpublic orgTokenService: OrgTokenService // , public appContext: AppContextService\r\n\t) {\r\n\t\tsuper(modal, errorService, events, i18n, projectTokenService, orgTokenService); //, appContext);\r\n\t}\r\n\r\n\tpublic async initialize(): Promise<void> {\r\n\t\tlet bimViewerBaseUrl = environment.bimviewerUrl;\r\n\t\tif (!bimViewerBaseUrl) { throw 'environment.bimviewerUrl setting is missing.'; }\r\n\r\n\t\tthis.set_apiUrl(bimViewerBaseUrl); //BimClient.initialize. \r\n\t\tconsole.log('BimClient!', bimViewerBaseUrl);\r\n\t\tthis.version = 'no-bim-client-version';\r\n\t\tthis.build = 'no-bim-client-build';\r\n\t}\r\n}\r\n","import { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { HttpResponseMessage } from \"aurelia-http-client\";\r\nimport * as downloadjs from \"downloadjs\";\r\nimport { AoxRequestBuilder } from './AoxRequestBuilder';\r\n\r\n\r\nexport class RequestExecution {\r\n\tprotected errorHandler: Function = async() => { console.warn('empty-errorHandler'); }; // det ville ha vaeret rart med nogen TYPER paa den funktion - at den tager reason-any-Response som arg, og hvad den maaske kunne returnere..\r\n\tconstructor(\r\n\t\tpublic request: AoxRequestBuilder, // was: protected \r\n\t\tprotected events: EventAggregator\r\n\t) { }\r\n\r\n\tpublic async noResponse(): Promise<void> {\r\n\t\tthis.events.publish('is-loading', true);\r\n\t\treturn await this.request.sendXhrCall() // noResponse\r\n\t\t\t.catch(async (reason) => this.errorHandler(reason))//noResponse\r\n\t\t\t.finally(() => {\r\n\t\t\t\tthis.events.publish('is-loading', false);\r\n\t\t\t});\r\n\t}\r\n\r\n\t// JG: This was broken - it's not fetch Response, it's HttpResponseMessage!\r\n\tpublic async response(): Promise<HttpResponseMessage> {\r\n\t\tthis.events.publish('is-loading', true);\r\n\t\ttry {\r\n\t\t\tlet rsp: HttpResponseMessage = await this.request.sendXhrCall(); //response\r\n\t\t\treturn rsp;\r\n\t\t\t//Type 'HttpResponseMessage' is missing the following properties from type 'Response': ok, redirected, status, type, and 9 more.\r\n\t\t} catch (reason) { //HttpResponseMessage) {\r\n\t\t\t// It turns out, the exception-argument is actually STILL the HttpResponseMessage,\r\n\t\t\t// so let us pass it unto the caller.\r\n\t\t\t// (either we should rethrow the exception, OR give them the error.\r\n\t\t\t//  We should NOT hide the error from them.)\r\n\t\t\t// Thus: we UI-warn the user, then allow the code to proceed with the error.\r\n\t\t\tlet really: HttpResponseMessage = <HttpResponseMessage>reason;\r\n\t\t\t//console.log('reason:', reason);\r\n\t\t\tawait this.errorHandler(reason);//response\r\n\t\t\treturn really;\r\n\t\t} finally {\r\n\t\t\tthis.events.publish('is-loading', false);\r\n\t\t}\r\n\t}\r\n\r\n\t//Used for calls to the api that should not be \"waited\" on with a spinning icon.\r\n\t// JG: This was broken - it's not fetch Response, it's HttpResponseMessage!\r\n\tpublic async responseNoLoadingIcon(): Promise<HttpResponseMessage> {\r\n\t\ttry {\r\n\t\t\tlet rsp: HttpResponseMessage = await this.request.sendXhrCall(); //responseNoLoadingIcon\r\n\t\t\treturn rsp;\r\n\t\t\t//Type 'HttpResponseMessage' is missing the following properties from type 'Response': ok, redirected, status, type, and 9 more.\r\n\t\t} catch (reason) { //HttpResponseMessage) {\r\n\t\t\t// It turns out, the exception-argument is actually STILL the HttpResponseMessage,\r\n\t\t\t// so let us pass it unto the caller.\r\n\t\t\t// (either we should rethrow the exception, OR give them the error.\r\n\t\t\t//  We should NOT hide the error from them.)\r\n\t\t\t// Thus: we UI-warn the user, then allow the code to proceed with the error.\r\n\t\t\tlet really: HttpResponseMessage = <HttpResponseMessage>reason;\r\n\t\t\t//console.log('reason:', reason);\r\n\t\t\tawait this.errorHandler(reason);//responseNoLoadingIcon\r\n\t\t\treturn really;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic async downloadFile(fileName: string): Promise<void> {\r\n\t\treturn await this.request.sendXhrCall(\"arraybuffer\") // in downloadFile.\r\n\t\t\t.then(response => downloadjs(response.response, fileName, 'application/octet-stream'))\r\n\t\t\t.catch(async (reason) => this.errorHandler(reason));//downloadFile\r\n\t}\r\n\r\n\tpublic async objectResult<T>(typeInstance?: T): Promise<T> {\r\n\t\t// (JG: This is basicaly the same as jsonResult(), it just includes the Object.assign thing.)\r\n\t\tthis.events.publish('is-loading', true); // (Should be outside try-catch.)\r\n\t\ttry {\r\n\t\t\tlet response = await this.request.sendXhrCall(); //objectResult\r\n\t\t\tif (Boolean(typeInstance)) {\r\n\t\t\t\t// Do this when the dto has methods\r\n\t\t\t\tlet x = await response.content;\r\n\t\t\t\treturn Object.assign(<any>typeInstance, x);\r\n\t\t\t} else { // Do this when the dto is an interface or only has properties\r\n\t\t\t\treturn await response.content;\r\n\t\t\t}\r\n\t\t} catch (reason) {\r\n\t\t\tconsole.trace('RequestExecution.objectResult');\r\n\t\t\tthis.errorHandler(reason);//objectResult\r\n\t\t\treturn <any>typeInstance; //Not sure if this is a good solution. fixed due to strict mode.\r\n\t\t} finally {\r\n\t\t\tthis.events.publish('is-loading', false);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic async jsonResult(lookBusy: boolean = true, fn?:(a:any)=>void): Promise<any> {\r\n\t\tif (lookBusy) { this.events.publish('is-loading', true); }\r\n        \r\n\t\treturn await this.request.sendXhrCall(undefined,fn) // jsonResult\r\n\t\t\t.then(async (response) => {\r\n\t\t\t\tlet awaitedContent = await response.content;\r\n\t\t\t\treturn awaitedContent;\r\n\t\t\t})\r\n\t\t\t.catch(async (reason) => {\r\n\r\n\t\t\t\t// This is CRAP - we don't get any error indication back??\r\n\t\t\t\tlet dlgPromise:Promise<any> = this.errorHandler(reason);//jsonResult\r\n\t\t\t\tconsole.log('jsonResult,dlg:', dlgPromise);\r\n\r\n\t\t\t\tlet done = await dlgPromise; // Note below.\r\n\t\t\t\tconsole.log('jsonResult,done:', done); // this became UNDEFINED - why?\r\n\t\t\t\t// but still, we are not returning anything to anyone, and not throwing any exception or other indication that the operation failed, WTF.\r\n\t\t\t})\r\n\t\t\t.finally(() => {\r\n\t\t\t\tif (lookBusy) { this.events.publish('is-loading', false); }\r\n\t\t\t});\r\n\t}\r\n\r\n\t//Used for calls to the api that should not be \"waited\" on with a spinning icon.\r\n\tpublic async jsonResultNoLoadingIcon(): Promise<any> {\r\n\t\treturn await this.request.sendXhrCall() // in jsonResultNoLoadingIcon. \r\n\t\t\t.then(async (response) => {\r\n\t\t\t\tlet awaitedContent = await response.content;\r\n\t\t\t\treturn awaitedContent;\r\n\t\t\t})\r\n\t\t\t.catch(async (reason) => {\r\n\t\t\t\tlet dlg = this.errorHandler(reason);//jsonResultNoLoadingIcon\r\n\t\t\t\tlet done = await dlg; // Note below. // what note??\r\n\t\t\t});\r\n\t}\r\n\r\n\tpublic async stringResult(): Promise<string> {\r\n\t\ttry {\r\n\t\t\tthis.events.publish('is-loading', true);\r\n\t\t\tconst httpResponseMsg = await this.request.sendXhrCall(); // in stringResult.\r\n\t\t\tconst contentString = httpResponseMsg.content;\r\n\t\t\treturn contentString;\r\n\t\t} catch (reason) {\r\n\t\t\tconsole.log('awaiting error handler..');\r\n\t\t\tconst myAny = await this.errorHandler(reason);//stringResult\r\n\t\t\tconsole.log('Done awaiting error handler..', myAny);\r\n\t\t\treturn myAny;\r\n\t\t} finally {\r\n\t\t\tthis.events.publish('is-loading', false);\r\n\t\t}\r\n\t}\r\n\r\n}\r\n","import { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { ErrorService } from './error-service';\r\nimport { ModalService } from './modal-service';\r\nimport { HttpResponseMessage, RequestMessage } from \"aurelia-http-client\";\r\nimport { I18N } from 'aurelia-i18n';\r\nimport { ModalMessage } from 'app/components/dialog/modal-message';\r\nimport { DialogCancellableOpenResult, DialogCloseResult, DialogOpenPromise } from 'aurelia-dialog';\r\nimport { AoxRequestBuilder } from './AoxRequestBuilder';\r\nimport { RequestExecution } from './RequestExecution';\r\n\r\n\r\nexport class RequestErrorHandling extends RequestExecution {\r\n\r\n\tasync error403(): Promise<any> {\r\n\t\tconsole.log('inside 403');\r\n\t\tlet dlg: Promise<void> = this.modal.OpenMessage('Forbidden',\r\n\t\t\t\"The user does not have permission to perform this action.\",\r\n\t\t\ttrue // ie showReset.\r\n\t\t)\r\n\t\t\t.whenClosed(x => { });\r\n\t\t//let done = await dlg;\r\n\t\treturn dlg;\r\n\t}\r\n\terror404() { console.log('inside 404'); } //if (reason.statusCode === 404) {}\r\n\tasync error409(reason: any) {\r\n\t\treturn this.modal.OpenMessage('Conflict', reason.response, true);\r\n\t}\r\n\t/* Consider the remaining errors may require the same.\r\n\tHOWEVER, 401 is special, because it suggests me might need a reset/fresh-login. 403,404,409 etc does NOT necessarily require the same.\r\n\t*/\r\n\terror400(responseMsg: HttpResponseMessage) {\r\n\t\tconsole.error('inside 400', responseMsg);\r\n\t\tconsole.trace('Bad request');\r\n\t} \r\n\tasync error401(responseMsg: HttpResponseMessage): Promise<DialogCancellableOpenResult> {\r\n\t\t// We must make sure an exception is propagated, if the user clicked 'Reset'(to log in again.)\r\n\t\tconsole.trace('inside 401', responseMsg.response); //, responseMsg); //response: \"invalid_tokenThe token expired at '05/24/2024 09:32:45'\"\r\n\t\tconst content:string = responseMsg.response;\r\n\t\tconst loginExpired = content.includes('Expired');\r\n\t\tif (loginExpired) {\r\n\t\t\tconsole.warn('we decided loginExpired, because response looked like this:', content);\r\n\t\t}\r\n\r\n\t\tlet dlg0:DialogOpenPromise<DialogCancellableOpenResult> = this.modal.OpenMessage('Unauthorized', \r\n\t\tloginExpired\r\n\t\t? \"User session appears to have expired. \\n You must log in again. \\n Click 'Reset' to do so.\"\r\n\t\t: `An unauthorized action was invoked.\\n\\n${responseMsg.requestMessage.url}`,\r\n\t\t\ttrue // ie showReset.\r\n\t\t);\r\n\r\n\t\t// Don't do this unconditionally: (https://jira.eg.dk/browse/AJC-3802)\r\n\t\t//dlg0.whenClosed(x => this.events.publish(\"user unauthorized\"));\r\n\t\tlet dlg:DialogCancellableOpenResult = await dlg0;\r\n\t\tawait this.throwIfResetWasPressed(dlg);\r\n\t\treturn dlg;\r\n\t}\r\n\r\n\tconstructor(request: AoxRequestBuilder, events: EventAggregator, private modal: ModalService, private errorService: ErrorService, private i18n: I18N) {\r\n\t\tsuper(request, events);\r\n\r\n\t\tthis.errorHandler = async(reason: HttpResponseMessage):Promise<any> => {//constructor\r\n\t\t\t// I hate the broken error-handling for XMLHttpRequest \r\n\t\t\t//console.trace('(MAY be NET::ERR_CONNECTION_REFUSED, ie server-not-started/available.)');\r\n\t\t\tconsole.log('EH, code:', reason.statusCode, reason.requestMessage.url);\r\n\t\t\tswitch (reason.statusCode) {\r\n\t\t\t\tcase 400: return this.error400(reason);\r\n\t\t\t\tcase 401: return this.error401(reason);\r\n\t\t\t\tcase 403: return this.error403();\r\n\t\t\t\tcase 404: return this.error404();\r\n\t\t\t\tcase 409: return this.error409(reason); // conflict.\r\n\t\t\t} // report common cases without lengthy trace().\r\n\r\n\t\t\tconsole.trace('(MAY be NET::ERR_CONNECTION_REFUSED, ie server-not-started/available.)');\r\n\t\t\tif (this.request.noGui) {\r\n\t\t\t\tthis.logErrorInstead(reason);\r\n\t\t\t} else { // IE WITH-gui.\r\n\t\t\t\tconst reqMsg:RequestMessage = reason.requestMessage;\r\n\t\t\t\tconst url_ = reqMsg.url;\r\n\t\t\t\tthis.alsoLogResponseWITH_gui(reason);\r\n\t\t\t\tconst dialogCancellableOpenResult:DialogCancellableOpenResult = await this.modal.OpenMessage('An error occurred:' + url_, `${reason}`, true);\r\n\t\t\t\tawait this.throwIfResetWasPressed(dialogCancellableOpenResult);\r\n\t\t\t}\r\n\t\t};\r\n\t}\r\n\r\n\talsoLogResponseWITH_gui(reason: any) {\r\n\t\tthis.logErrorInstead(reason);\r\n\t} // In fact, we ALWAYS want the log.\r\n\r\n\tlogErrorInstead(message: any): RequestErrorHandling {\r\n\t\tlet extra: string = '';\r\n\t\tif (message.hasOwnProperty('requestMessage')) {\r\n\t\t\tlet messageUrl = message.requestMessage.url;\r\n\t\t\tif (Boolean(messageUrl)) {\r\n\t\t\t\textra = messageUrl;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (message.hasOwnProperty('response')) {\r\n\t\t\tlet response = message.response;\r\n\t\t\tconsole.trace('response:', response);\r\n\t\t\tif (response instanceof ArrayBuffer) {\r\n\t\t\t\tconsole.log('it is arraybuffer.');\r\n\t\t\t\tlet ab: ArrayBuffer = response;\r\n\t\t\t\tlet str = new TextDecoder().decode(ab);\r\n\t\t\t\t//var buf = new ArrayBuffer(ab.byteLength);\r\n\t\t\t\t//var int8view = new Uint8Array(buf);\r\n\t\t\t\tconsole.log('ab contents:', str); //int8view)\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconsole.log('extra:', extra);\r\n\t\tconsole.log('message:', message);\r\n\t\treturn this;\r\n\t}\r\n\r\n\thandleErrorWithErrorService(errorHandler2: (service: ErrorService, reason: any) => Promise<void>): RequestExecution {\r\n\t\tthis.errorHandler = async(reason: any) => await errorHandler2(this.errorService, reason);//handleErrorWithErrorService\r\n\t\treturn this;\r\n\t}\r\n\r\n\thandleError(title: string, message: string): RequestExecution {\r\n\t\t//console.trace('who called handleError?');\r\n\t\tthis.errorHandler = async(reason: any) => {//handleError\r\n\t\t\tconsole.log('endpoint:', this.request.route);\r\n\t\t\tconsole.log('reason:', reason);\r\n\t\t\tthis.logResponse(reason);\r\n\t\t\t//await this.modal.OpenMessage(this.i18n.tr(title), this.i18n.tr(message), true);\r\n\t\t\tconst dlgPromise: DialogOpenPromise<DialogCancellableOpenResult> = this.modal.OpenModal(\r\n\t\t\t\tModalMessage,\r\n\t\t\t\t{ title, message: this.i18n.tr(message), showReset: true }\r\n\t\t\t\t//true\r\n\t\t\t);\r\n\t\t\tconst dialogCancellableOpenResult:DialogCancellableOpenResult = await dlgPromise;\r\n\t\t\tawait this.throwIfResetWasPressed(dialogCancellableOpenResult);\r\n\t\t\t//const dlgCloseResult = await dlgPromise.whenClosed();\r\n\t\t\t//const output = dlgCloseResult.output;\r\n\t\t\t//console.log('dlgCloseResult:', dlgCloseResult);\r\n\t\t\treturn null; //undefined; //reason;\r\n\t\t\t// ( - we don't really know what people expect to get returned from errorHandler.)\r\n\t\t};\r\n\t\treturn this;\r\n\t}\r\n\r\n\tlogResponse(rspMsg: HttpResponseMessage) {\r\n\t\tconsole.log('response:', rspMsg.response);\r\n\t\tif (typeof rspMsg.content == 'string') { // JG: 'normal case'.\r\n\t\t\tconsole.log('response.content:', rspMsg.content);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// (Special case, e.g. when attempt to download puts us into arrayBuffer mode..?)\r\n\t\tif (rspMsg.responseType == 'arraybuffer' || rspMsg.responseType == 'txt') {\r\n\t\t\tlet str: string = new TextDecoder().decode(rspMsg.response);\r\n\t\t\tconsole.log('arraybuf says:', str);\r\n\t\t\t// (JG: we attempted to download a file, but because an error happened, our 'file contents' is really the server's error response.)\r\n\t\t} else { // We have no idea what happened in that case..\r\n\t\t\tconsole.log('responseType is:', rspMsg.responseType);\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t// what alternative DOM types do we have, for request-response?\r\n\t//let xx:Response; // = await fetch('someurl'); // response comes from Lib.Dom.\r\n\t//let xhr:XMLHttpRequest; xhr.response; // response, responseText,responseXML \r\n\r\n\t// JG: I'm pretty sure the errorHandler 'reason' arg will, most of the time, be of type HttpResponseMessage..\r\n\t// HttpResponseMessage belongs to aurealia.\r\n\r\n\thandleErrorUsingReason(title: string): RequestExecution {\r\n\t\tthis.errorHandler = async(reason: HttpResponseMessage) => {//handleErrorUsingReason\r\n\t\t\tconsole.trace('HRUR'); // 'who is doing this'.\r\n\t\t\tconsole.log('HRUR', reason, reason.response);\r\n\t\t\tconst errInf = `\\n(${reason.statusCode}: ${reason.statusText})`;\r\n\t\t\t\r\n\t\t\tconst dlgAnswer:DialogCancellableOpenResult = \r\n\t\t\t  await this.modal.OpenMessage(\r\n\t\t\t\tthis.i18n.tr(title), \r\n\t\t\t\tthis.i18n.tr(reason.response)+errInf, \r\n\t\t\t\ttrue\r\n\t\t\t  );\r\n\r\n\t\t\tawait this.throwIfResetWasPressed(dlgAnswer);\r\n\t\t};\r\n\t\treturn this;\r\n\t}\r\n\r\n\thandleErrorMsgUsingReason(title: string, message: string): RequestExecution {\r\n\t\tlet newLine = ' ' + ('\\u1680').repeat(75);\r\n\t\tthis.errorHandler = async(reason: any) => {//handleErrorMsgUsingReason\r\n\t\t\tconsole.log(reason.response); // Let us see/inspect any 'object ProgressEvent', to see what it's about.\r\n\t\t\tawait this.throwIfResetWasPressed(await this.modal.OpenMessage(this.i18n.tr(title), this.i18n.tr(message) + newLine + this.i18n.tr(reason.response), true));\r\n\t\t};\r\n\t\treturn this;\r\n\t}\r\n\r\n\tasync throwIfResetWasPressed(r: DialogCancellableOpenResult):Promise<void> {\r\n\t\t/* The original exception, by this point,\r\n\t\thas become an ordinary 'returned result' from a shown dialog \r\n\t\t- that is, it is not an exception anymore.\r\n\t\tSo we will have to rethrow an exception, to 'make it feel like an exception again'\r\n\t\t(to those guys who ended up in a UI error handler messagebox,\r\n\t\twhen the backend async method they tried to call, failed on them).\r\n\t\t */\r\n\t\tif (r.wasCancelled) { return; }\r\n\r\n\t\tconst dcr:DialogCloseResult = await r.closeResult;\r\n\t\tif (!dcr) { console.error('missing dcr?', dcr); return; }\r\n\r\n\t\tconst data = dcr.output;\r\n\t\tif (!data) { console.error('missing DialogCloseResult.output?', data); return; } // only positive presence of data.errorReset causes us to act/throw exception.\r\n\r\n\t\tif (data.errorReset) {// den her blev sur - 'data is undefined'.\t\t\t\r\n\t\t\tconsole.warn('RequestErrorHandling.act, errorReset:', data.errorReset);\r\n\r\n\t\t\tthis.events.publish(\"user unauthorized\");\r\n\t\t\t// we do this, to stop aurelia from continuing to build the view:\t\r\n\t\t\tthrow data.errorReset; // JG: If we didn't log these decisions, it would be hard to figure out how we ended up where we do.\r\n\t\t} else {\r\n\t\t\tconsole.log('(no errorReset in act)');\r\n\t\t}\r\n\t}\r\n\r\n}\r\n","import { EventAggregator } from 'aurelia-event-aggregator';\r\nimport { ErrorService } from './error-service';\r\nimport { ModalService } from './modal-service';\r\nimport { json } from \"aurelia-fetch-client\";\r\nimport { I18N } from 'aurelia-i18n';\r\nimport { AoxRequestBuilder } from './AoxRequestBuilder';\r\nimport { RequestErrorHandling } from './RequestErrorHandling';\r\n\r\n\r\nexport class RequestMethod {\r\n\tconstructor(\r\n\t\tpublic request: AoxRequestBuilder, // egentlig config..\r\n\t\tprivate events: EventAggregator,\r\n\t\tprivate modal: ModalService,\r\n\t\tprivate errorService: ErrorService,\r\n\t\tprivate i18n: I18N) {\r\n\t}\r\n\r\n\tpublic get(action: string, noGui: boolean = false): RequestErrorHandling {\r\n\t\tthis.request.method = 'GET';\r\n\t\tthis.request.noGui = noGui;\r\n\t\tthis.request.addRouteSection(action);\r\n\t\treturn this.next();\r\n\t}\r\n\tpublic postJson(action: string, content: any): RequestErrorHandling {\r\n\t\t(<any>this.request.headers)[\"Content-Type\"] = \"application/json\";\r\n\t\tthis.request.method = 'POST';\r\n\t\tthis.request.content = json(content);\r\n\t\tthis.request.addRouteSection(action);\r\n\t\treturn this.next();\r\n\t}\r\n\tpublic postText(action: string, content: string): RequestErrorHandling {\r\n\t\tthis.request.method = 'POST';\r\n\t\tthis.request.content = content;\r\n\t\tthis.request.addRouteSection(action);\r\n\t\treturn this.next();\r\n\t}\r\n\tpublic postForm(action: string, content: FormData): RequestErrorHandling {\r\n\t\t//this.request.headers[\"Content-Type\"] = contentType;\r\n\t\tthis.request.method = 'POST';\r\n\t\tthis.request.content = content;\r\n\t\tthis.request.addRouteSection(action);\r\n\t\treturn this.next();\r\n\t}\r\n\tprivate next(): RequestErrorHandling {\r\n\t\treturn new RequestErrorHandling(this.request, this.events, this.modal, this.errorService, this.i18n);\r\n\t}\r\n}\r\n","import {ObjectIDsIF} from \"../project/ifc-fun/openbim-container\";\r\nimport {InstanceColorData, InstanceColorDataCollection} from \"../models/color-legend-dto\";\r\n\r\nexport interface ViewerThreeDServiceIF {\r\n\tchangeSelectedTool(tool: ToolEnum): Promise<void>;\r\n\thideAllObjects(): Promise<void>;\r\n\ttransluteAllObjects(): Promise<void>;\r\n\tshowAllObjects(): Promise<void>;\r\n\thandleSpaces(shouldShowSpaces: boolean): Promise<void>;\r\n\r\n\ttransluteOthers(selectedObjectIds: ObjectIDsIF): Promise<void>\r\n\thideOthers(objectIds: ObjectIDsIF): Promise<void>;\r\n\tlookAtObjects(objectIds: ObjectIDsIF): Promise<void>;\r\n\tselectObjects(objectIds: ObjectIDsIF): Promise<void>;\r\n\ttransluteObjects(objectIds: ObjectIDsIF): Promise<void>;\r\n\tshowObjects(objectIds: ObjectIDsIF): Promise<void>;\r\n\thideObjects(objectIds: ObjectIDsIF): Promise<void>;\r\n\t\r\n\tcolorInstances(colorData: InstanceColorDataCollection): Promise<void>;\r\n\tresetColorInstances(): Promise<void>;\r\n\tshowColorGroup(groupName: string): Promise<void>;\r\n\ttransluteColorGroup(groupName: string): Promise<void>;\r\n\thideColorGroup(groupName: string): Promise<void>;\r\n}\r\n\r\nexport enum ToolEnum {\r\n\tObjectSelection,\r\n\tLengthMeasure,\r\n\tAreaMeasure,\r\n\tCropTool,\r\n}\r\n","import { IRouteConfig_Child, MenuAccessLevel, RouteConfig_Root } from \"app/aox/RouteTypings_Ajour\";\r\nimport { OrgRole } from \"app/models/org-role\";\r\nimport { OrgTokenInfo } from \"app/models/org-token-info\";\r\nimport { ProjectRole } from \"app/models/project-role\";\r\nimport { ProjectTokenInfo } from \"app/models/project-token-info\";\r\nimport { AppContextService } from \"./app-context-service\";\r\n\r\nexport class AccessLevelService {\r\n    \r\n    public static hasAccess(appContext:AppContextService, route:IRouteConfig_Child | RouteConfig_Root, projectTokenInfo: ProjectTokenInfo, orgTokenInfo: OrgTokenInfo, show:boolean): boolean {\r\n\t\tif (projectTokenInfo.orgRole < 0) {\r\n\t\t\t// This happens when you don't have a current ORG selected from the dropdown.\r\n\t\t\t// Or, rather: the info missing here, is NOT missing - is set - whenever user selects an Org.\r\n\t\t\t// So, a different way of describing the problem,\r\n\t\t\t// is that user's current-org-selection does not survive a reload of URL/current page.\r\n\t\t\t//   It may even make sense, given that the current-page-URL does not contain hints of user-ORG, only user's current PRJ selection.\r\n\t\t\t// We might solve it, by storing last-selected-org in local-storage,\r\n\t\t\t// AND then acting on that available data when reloading the current view/page.\r\n\t\t\t// (beware, that we should only try to 'fix it' in the relevant situations, so we don't suddenly change org-selection relative to what user intended/defaulted.)\r\n\t\t\tconst TMI = false; // Too Much Info..\r\n\t\t\tif (TMI) { console.log(`hasAccess sees a bad projectTokenInfo for orgRole, orgRole is:${projectTokenInfo.orgRole}/prjRole: ${projectTokenInfo.prjRole}`); }\r\n\r\n\t\t\t// ProjectRole.VeryUnknown = -2 // to see if we fail to init.\r\n\t\t\t//     OrgRole.Unknown = -1\r\n\t\t\t// Navigation.ProjectTokenInfo.\r\n\t\t\t// It is Navigation.createAndUpdatePrjToken which inits it, ..triggered by event \"navigation:update-prj-token\"\r\n\t\t}\r\n\r\n        let access:boolean=false;\r\n        switch (route?.menuAccessLevel) {\r\n\t\t\tcase MenuAccessLevel.PrjUser:            access = this.hasPrjUserAccess(projectTokenInfo); break;\r\n\t\t\tcase MenuAccessLevel.PrjSettings:        access = this.hasPrjSettingAccess(projectTokenInfo);  break;\r\n\t\t\tcase MenuAccessLevel.PrjAdmin:           access = this.hasPrjAdminAccess(projectTokenInfo);  break;\r\n\t\t\tcase MenuAccessLevel.OrgAdmin:           access = this.hasOrgAdminAccess(orgTokenInfo);  break;\r\n\t\t\tcase MenuAccessLevel.AOCRoles:           access = this.hasAOCAccess(appContext,route?.settings?.sectionUserRolesAllowed);  break;\r\n\t\t\tcase MenuAccessLevel.AOCRolesOrPrjUser:  access = this.hasPrjUserOrAOCAccess(appContext,route?.settings?.sectionUserRolesAllowed, projectTokenInfo);  break;\r\n\t\t\tcase MenuAccessLevel.AOCRolesOrOrgUser:  access = this.hasOrgUserOrAOCAccess(appContext,route?.settings?.sectionUserRolesAllowed, orgTokenInfo);  break;\r\n\t\t\tcase MenuAccessLevel.AOCRolesOrOrgAdmin: access = this.hasOrgAdminOrAOCAccess(appContext,route?.settings?.sectionUserRolesAllowed,orgTokenInfo);  break;\r\n\r\n            default:\r\n\t\t\t\t// JG: these should really be investigated:\r\n                //console.warn('ALS.hasAccess did not find a menuAccessLevel for', route);\r\n                if (show) { \r\n\t\t\t\t\t//console.warn('B hasAccess, menuAccessLevel?', route?.menuAccessLevel, 'route:', route); \r\n\t\t\t\t}\r\n                return false;\r\n        \r\n\t\t}\r\n\r\n        // right now we are mostly interested if it FAILS.\r\n\t\tif (show && !access) { \r\n\t\t\t//console.warn('A hasAccess, menuAccessLevel?', route?.menuAccessLevel, 'route:', route,'prjToken:', projectTokenInfo); \r\n\t\t}\r\n        return access;\r\n    }\r\n\t\r\n    private static hasOrgAdminAccess(orgTokenInfo: OrgTokenInfo): boolean {\r\n\t\treturn orgTokenInfo.orgRole >= OrgRole.Org_Admin;\r\n\t}\r\n\tprivate static hasPrjAdminAccess(projectTokenInfo: ProjectTokenInfo): boolean {\r\n\t\treturn projectTokenInfo.prjRole >= ProjectRole.Prj_Admin || projectTokenInfo.orgRole >= OrgRole.Org_Admin;\r\n\t}\r\n\tprivate static hasPrjSettingAccess(projectTokenInfo: ProjectTokenInfo): boolean {\r\n\t\treturn projectTokenInfo.prjRole >= ProjectRole.Prj_Setting_User;\r\n\t}\r\n\tprivate static hasPrjUserAccess(projectTokenInfo: ProjectTokenInfo): boolean {\r\n\t\treturn projectTokenInfo.prjRole >= ProjectRole.Prj_User;\r\n\t}\r\n\r\n\tprivate static hasAOCAccess(appContext: AppContextService, routeRolesAllowed: any): boolean {\r\n\t\tif (routeRolesAllowed == undefined) { return false; }\r\n\t\tfor (let i = 0; i < routeRolesAllowed.length; i++) {\r\n\t\t\tconst routeElement = routeRolesAllowed[i];\r\n\r\n\t\t\tif (appContext.currentUser) {\r\n\t\t\t\tfor (let j = 0; j < appContext.currentUser.roles.length; j++) {\r\n\t\t\t\t\tconst userElement = appContext.currentUser.roles[j];\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (routeElement === userElement)\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tprivate static hasPrjUserOrAOCAccess(appContext:AppContextService, sectionUserRolesAllowed: string[] | undefined, projectTokenInfo: ProjectTokenInfo): boolean {\r\n\t\tif (AccessLevelService.hasAOCAccess(appContext, sectionUserRolesAllowed) == true) { return true; }\r\n\t\treturn projectTokenInfo.prjRole >= ProjectRole.Prj_User;\r\n\t}\r\n\r\n\tstatic hasOrgUserOrAOCAccess(appContext: AppContextService, sectionUserRolesAllowed: string[] | undefined, orgTokenInfo: OrgTokenInfo): boolean {\r\n\t\tif (AccessLevelService.hasAOCAccess(appContext, sectionUserRolesAllowed) == true) { return true; }\r\n\t\treturn orgTokenInfo.orgRole >= OrgRole.Org_User;\r\n\t}\r\n\r\n\tprivate static hasOrgAdminOrAOCAccess(appContext:AppContextService, sectionUserRolesAllowed: string[] | undefined, orgTokenInfo: OrgTokenInfo): boolean {\r\n\t\tif (AccessLevelService.hasAOCAccess(appContext, sectionUserRolesAllowed) == true) { return true; }\r\n\t\treturn orgTokenInfo.orgRole >= OrgRole.Org_Admin;\r\n\t}\r\n}\r\n"],"names":["AWJClient","constructor","modal","errorService","events","i18n","projectTokenService","orgTokenService","super","initialize","AWJ_BaseUrl","this","set_apiUrl","console","log","version","build","AoxRequestBuilder","apiUrl","headers","method","noGui","route","addRouteSection","section","sendXhrCall","responseType","fn","builder","createRequest","withProgressCallback","asGet","asPost","withContent","content","withResponseType","Object","keys","forEach","x","withHeader","send","AzFuncsClient","AzFunc_BaseUrl","BimClient","bimViewerBaseUrl","RequestExecution","request","errorHandler","async","warn","noResponse","publish","catch","reason","finally","response","really","responseNoLoadingIcon","downloadFile","fileName","then","download","objectResult","typeInstance","Boolean","assign","trace","jsonResult","lookBusy","undefined","dlgPromise","done","jsonResultNoLoadingIcon","dlg","stringResult","myAny","RequestErrorHandling","error403","OpenMessage","whenClosed","error404","error409","error400","responseMsg","error","error401","loginExpired","includes","dlg0","requestMessage","url","throwIfResetWasPressed","statusCode","logErrorInstead","url_","alsoLogResponseWITH_gui","dialogCancellableOpenResult","message","extra","hasOwnProperty","messageUrl","ArrayBuffer","ab","str","TextDecoder","decode","handleErrorWithErrorService","errorHandler2","handleError","title","logResponse","OpenModal","tr","showReset","rspMsg","handleErrorUsingReason","errInf","statusText","dlgAnswer","handleErrorMsgUsingReason","newLine","repeat","r","wasCancelled","dcr","closeResult","data","output","errorReset","RequestMethod","get","action","next","postJson","postText","postForm","ToolEnum","AccessLevelService","hasAccess","appContext","projectTokenInfo","orgTokenInfo","show","orgRole","access","menuAccessLevel","PrjUser","hasPrjUserAccess","PrjSettings","hasPrjSettingAccess","PrjAdmin","hasPrjAdminAccess","OrgAdmin","hasOrgAdminAccess","AOCRoles","hasAOCAccess","settings","sectionUserRolesAllowed","AOCRolesOrPrjUser","hasPrjUserOrAOCAccess","AOCRolesOrOrgUser","hasOrgUserOrAOCAccess","AOCRolesOrOrgAdmin","hasOrgAdminOrAOCAccess","Org_Admin","prjRole","Prj_Admin","Prj_Setting_User","Prj_User","routeRolesAllowed","i","length","routeElement","currentUser","j","roles","Org_User"],"sourceRoot":""}