@railzai/railz-visualizations
Version:
Railz.ai Visualizations
105 lines (99 loc) • 4.97 kB
JavaScript
/*!
* Accounting Data as a Service™ is the solution that makes sense of your business customers' financial data.
* Built with Stencil
* Copyright (c) FIS.
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const index = require('./index-7829b74b.js');
const chart_utils = require('./chart.utils-652dfce2.js');
const financialRatios = require('./financial-ratios-8bba8608.js');
const isEqual = require('./isEqual-d0f95783.js');
require('./en-4ea7a4ad.js');
require('./_commonjsHelpers-7cfde13a.js');
require('./isEmpty-a87fbcad.js');
require('./colors-c18d54d3.js');
require('./fonts-877d8e4b.js');
require('./endpoints-d1a2add3.js');
const coreCss = "@font-face{font-family:Inter;src:url(\"../assets/fonts/Inter-italic-var.woff2\");font-family:Inter;src:url(\"../assets/fonts/Inter-upright-var.woff2\")}body,div[class^=railz-],div[class*=\" railz-\"]{font-family:Inter, Roboto, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}.rv-container{display:flex;padding:16px;position:relative;border:1px solid #eee;border-radius:7px;flex-direction:column;height:202px;overflow:auto;line-height:21px;box-sizing:border-box}.rv-container *{font-family:Inter, Roboto, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}";
const Core = class {
constructor(hostRef) {
index.registerInstance(this, hostRef);
this.propsUpdated = () => {
this.validateParams(this.configuration, this.filter);
};
/**
* Validates if configuration was passed correctly before setting filter
* @param configuration - Config for authentication
* @param filter - filter to decide chart type to show
*/
this.validateParams = (configuration, filter) => {
this._configuration = chart_utils.getConfiguration(configuration);
if (this._configuration) {
chart_utils.ConfigurationInstance.configuration = this._configuration;
this._filter = chart_utils.getFilter(filter);
if (!this._filter) {
this.errorStatusCode = 204;
}
}
else {
this.errorStatusCode = 0;
}
};
}
watchFilter(newValue, oldValue) {
if (newValue && oldValue && !isEqual.isEqual(oldValue, newValue)) {
this.validateParams(this.configuration, newValue);
}
}
watchConfiguration(newValue, oldValue) {
if (newValue && oldValue && !isEqual.isEqual(oldValue, newValue)) {
this.validateParams(newValue, this.filter);
}
}
componentDidLoad() {
this.propsUpdated && this.propsUpdated();
}
render() {
var _a;
if (this.errorStatusCode === 0) {
return null;
}
if (this.errorStatusCode !== undefined) {
return (index.h("div", { class: "rv-container" }, index.h("railz-error-image", { statusCode: this.errorStatusCode || 500 })));
}
const reportType = (_a = this._filter) === null || _a === void 0 ? void 0 : _a.reportType;
if (financialRatios.RVReportTypes.BANK_RECONCILIATION === reportType) {
return (index.h("railz-bank-reconciliation", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (financialRatios.RVReportTypes.BUSINESS_VALUATIONS === reportType) {
return (index.h("railz-business-valuations", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (financialRatios.RVReportTypes.BANK_ACCOUNT === reportType) {
return (index.h("railz-bank-accounts", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (financialRatios.RVReportTypes.FINANCIAL_RATIO === reportType) {
return (index.h("railz-financial-ratios", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (chart_utils.isCreditScore(reportType)) {
return (index.h("railz-credit-score", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (chart_utils.isIncomeStatements(reportType)) {
return (index.h("railz-income-statements", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (chart_utils.isStatements(reportType)) {
return (index.h("railz-statements-chart", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (chart_utils.isTransactions(reportType)) {
return (index.h("railz-transactions-control", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
return index.h("span", null);
}
static get watchers() { return {
"filter": ["watchFilter"],
"configuration": ["watchConfiguration"]
}; }
};
Core.style = coreCss;
exports.railz_visualizations = Core;
//# sourceMappingURL=railz-visualizations.cjs.entry.js.map