mattermost-redux
Version:
Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client
60 lines (59 loc) • 2.08 kB
JavaScript
;
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCloudLimits = getCloudLimits;
exports.getCloudSubscription = getCloudSubscription;
exports.getCloudCustomer = getCloudCustomer;
exports.getCloudProducts = getCloudProducts;
exports.getCloudLimitsLoaded = getCloudLimitsLoaded;
exports.getCloudErrors = getCloudErrors;
exports.getCloudInvoices = getCloudInvoices;
exports.getSubscriptionProduct = getSubscriptionProduct;
exports.getSubscriptionProductName = getSubscriptionProductName;
exports.checkHadPriorTrial = checkHadPriorTrial;
exports.isCurrentLicenseCloud = isCurrentLicenseCloud;
const general_1 = require("./general");
function getCloudLimits(state) {
return state.entities.cloud.limits.limits;
}
function getCloudSubscription(state) {
return state.entities.cloud.subscription;
}
function getCloudCustomer(state) {
return state.entities.cloud.customer;
}
function getCloudProducts(state) {
return state.entities.cloud.products;
}
function getCloudLimitsLoaded(state) {
return state.entities.cloud.limits.limitsLoaded;
}
function getCloudErrors(state) {
return state.entities.cloud.errors;
}
function getCloudInvoices(state) {
return state.entities.cloud.invoices;
}
function getSubscriptionProduct(state) {
const subscription = getCloudSubscription(state);
if (!subscription) {
return undefined;
}
const products = getCloudProducts(state);
if (!products) {
return undefined;
}
return products[subscription.product_id];
}
function getSubscriptionProductName(state) {
return getSubscriptionProduct(state)?.name || '';
}
function checkHadPriorTrial(state) {
const subscription = getCloudSubscription(state);
return Boolean(subscription?.is_free_trial === 'false' && subscription?.trial_end_at > 0);
}
function isCurrentLicenseCloud(state) {
const license = (0, general_1.getLicense)(state);
return license?.Cloud === 'true';
}