@railzai/railz-visualizations
Version:
Railz.ai Visualizations
101 lines (97 loc) • 4.8 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.
*/
import { r as registerInstance, h } from './index-673cf901.js';
import { g as getConfiguration, C as ConfigurationInstance, a as getFilter, l as isCreditScore, m as isIncomeStatements, n as isStatements, o as isTransactions } from './chart.utils-54aac0f1.js';
import { e as RVReportTypes } from './financial-ratios-4924cc13.js';
import { i as isEqual } from './isEqual-127c312e.js';
import './en-6fceb495.js';
import './_commonjsHelpers-bac520b0.js';
import './isEmpty-c9bbdb38.js';
import './colors-0a66ae87.js';
import './fonts-0519869d.js';
import './endpoints-cd54c46c.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) {
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 = getConfiguration(configuration);
if (this._configuration) {
ConfigurationInstance.configuration = this._configuration;
this._filter = getFilter(filter);
if (!this._filter) {
this.errorStatusCode = 204;
}
}
else {
this.errorStatusCode = 0;
}
};
}
watchFilter(newValue, oldValue) {
if (newValue && oldValue && !isEqual(oldValue, newValue)) {
this.validateParams(this.configuration, newValue);
}
}
watchConfiguration(newValue, oldValue) {
if (newValue && oldValue && !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 (h("div", { class: "rv-container" }, h("railz-error-image", { statusCode: this.errorStatusCode || 500 })));
}
const reportType = (_a = this._filter) === null || _a === void 0 ? void 0 : _a.reportType;
if (RVReportTypes.BANK_RECONCILIATION === reportType) {
return (h("railz-bank-reconciliation", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (RVReportTypes.BUSINESS_VALUATIONS === reportType) {
return (h("railz-business-valuations", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (RVReportTypes.BANK_ACCOUNT === reportType) {
return (h("railz-bank-accounts", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (RVReportTypes.FINANCIAL_RATIO === reportType) {
return (h("railz-financial-ratios", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (isCreditScore(reportType)) {
return (h("railz-credit-score", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (isIncomeStatements(reportType)) {
return (h("railz-income-statements", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (isStatements(reportType)) {
return (h("railz-statements-chart", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (isTransactions(reportType)) {
return (h("railz-transactions-control", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
return h("span", null);
}
static get watchers() { return {
"filter": ["watchFilter"],
"configuration": ["watchConfiguration"]
}; }
};
Core.style = coreCss;
export { Core as railz_visualizations };
//# sourceMappingURL=railz-visualizations.entry.js.map