UNPKG

@nu-art/bug-report

Version:
47 lines (46 loc) 2.17 kB
"use strict"; /* * Allow the user to file a bug report directly from your app * * Copyright (C) 2020 Adam van der Kruk aka TacB0sS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.ModuleFE_BugReport = exports.ModuleFE_BugReport_Class = exports.RequestKey_BugReportApi = void 0; const ts_common_1 = require("@nu-art/ts-common"); const frontend_1 = require("@nu-art/thunderstorm/frontend"); const api_1 = require("../../shared/api"); exports.RequestKey_BugReportApi = 'BugReport'; class ModuleFE_BugReport_Class extends ts_common_1.Module { constructor() { super(); this.reports = []; this.sendBugReportCallback = async (response) => { // const jiraTicket = response.find(ticket => ticket.platform === Platform_Jira); // if(jiraTicket) // Dialog_JiraOpened.show(jiraTicket.issueId) }; (0, ts_common_1.addItemToArray)(this.reports, new ts_common_1.LogClient_MemBuffer('default')); (0, ts_common_1.addItemToArray)(this.reports, new ts_common_1.LogClient_MemBuffer('info') .setFilter(level => ts_common_1.LogLevelOrdinal.indexOf(level) >= ts_common_1.LogLevelOrdinal.indexOf(ts_common_1.LogLevel.Info))); this.v1 = { sendBugReport: (0, frontend_1.apiWithBody)(api_1.ApiDef_BugReport.v1.sendBugReport, this.sendBugReportCallback), }; } init() { this.reports.forEach(report => ts_common_1.BeLogged.addClient(report)); } } exports.ModuleFE_BugReport_Class = ModuleFE_BugReport_Class; exports.ModuleFE_BugReport = new ModuleFE_BugReport_Class();