Ghost/ghost/admin/app/components/gh-product-card.js
Rishabh Garg 86b55b0f81 Added new free tier card with custom description/benefits (#2203)
refs https://github.com/TryGhost/Team/issues/1037

Adds new free tier card with option to add custom description and benefits for free tier, behind the tiers beta flag. Also:

- updates formatting of tier prices
- changes "Free" section to "Default"
- updates price formatting of membership tiers in admin
- updates currency code handling for product card
- updates default paid product handling

Co-authored-by: Djordje Vlaisavljevic <dzvlais@gmail.com>
Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
2022-01-18 00:23:43 +05:30

38 lines
937 B
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 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);
}
}