mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 04:13:30 +03:00
38b51fe192
refs https://github.com/TryGhost/Team/issues/1252 - on stripe disconnect, the prices on tiers are deleted, which causes the archive/unarchive on them to fail in admin - this change removes the archive/activate option for such tiers, which will get properly cleaned up once we start removing tiers on stripe disconnect
54 lines
1.4 KiB
JavaScript
54 lines
1.4 KiB
JavaScript
import Component from '@glimmer/component';
|
|
import {action} from '@ember/object';
|
|
import {getSymbol} from 'ghost-admin/utils/currency';
|
|
import {inject as service} from '@ember/service';
|
|
import {tracked} from '@glimmer/tracking';
|
|
|
|
export default class extends Component {
|
|
@service membersUtils;
|
|
@service ghostPaths;
|
|
@service ajax;
|
|
@service store;
|
|
@service config;
|
|
|
|
@tracked showProductModal = false;
|
|
@tracked productModel = null;
|
|
|
|
get product() {
|
|
return this.args.product;
|
|
}
|
|
|
|
get showArchiveOption() {
|
|
return this.product.type === 'paid' && !!this.product.monthlyPrice;
|
|
}
|
|
|
|
get productCurrency() {
|
|
if (this.isFreeProduct) {
|
|
const firstPaidProduct = this.args.products.find((product) => {
|
|
return product.type === 'paid';
|
|
});
|
|
return firstPaidProduct?.monthlyPrice?.currency || 'usd';
|
|
} else {
|
|
return this.product?.monthlyPrice?.currency;
|
|
}
|
|
}
|
|
|
|
get isPaidProduct() {
|
|
return this.product.type === 'paid';
|
|
}
|
|
|
|
get hasCurrencySymbol() {
|
|
const currencySymbol = getSymbol(this.product?.monthlyPrice?.currency);
|
|
return currencySymbol?.length !== 3;
|
|
}
|
|
|
|
get isFreeProduct() {
|
|
return this.product.type === 'free';
|
|
}
|
|
|
|
@action
|
|
async openEditProduct(product) {
|
|
this.args.openEditProduct(product);
|
|
}
|
|
}
|