@vendasta/store
Version:
Components and data for Store
74 lines (73 loc) • 5.48 kB
JavaScript
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Addon } from '@vendasta/core/marketplace-apps';
var VaProductDetailsComponent = /** @class */ (function () {
function VaProductDetailsComponent() {
this.showActionButton = false;
this.showPricing = false;
this.showPricingAction = false;
this.enableClicked = new EventEmitter();
this.addonSelected = new EventEmitter();
this.pricingActionSelected = new EventEmitter();
}
VaProductDetailsComponent.prototype.emitEnableButtonClicked = function () {
this.enableClicked.emit();
};
Object.defineProperty(VaProductDetailsComponent.prototype, "addons", {
get: function () {
return this.product.addons.map(function (addon) { return Addon.fromApi(addon); });
},
enumerable: true,
configurable: true
});
VaProductDetailsComponent.prototype.getActionLabel = function () {
if (this.product.isArchived) {
return 'Enable';
}
return 'Enabled';
};
Object.defineProperty(VaProductDetailsComponent.prototype, "price", {
get: function () {
// NOTE: wholesalePrice = 0 means free, wholesalePrice = null means "contact sales"
var prices = [];
if (this.product.wholesalePrice != null) {
prices = [{
price: this.product.wholesalePrice,
frequency: this.product.billingFrequency
}];
}
return {
currency: this.product.currency,
prices: prices
};
},
enumerable: true,
configurable: true
});
VaProductDetailsComponent.prototype.onAddonSelected = function (addonId) {
this.addonSelected.emit(addonId);
};
VaProductDetailsComponent.prototype.emitPricingActionSelected = function () {
this.pricingActionSelected.emit();
};
VaProductDetailsComponent.decorators = [
{ type: Component, args: [{
selector: 'va-product-details',
template: "<div class=\"page\"> <va-header-container [iconUrl]=\"product.iconUrl\" [title]=\"product.name\" [tagline]=\"product.tagline\" [chipLabels]=\"product.getLmiCategoryNames()\" [pricing]=\"price\" [pricingLabel]=\"'Wholesale Price'\" [pricingActionLabel]=\"pricingActionLabel\" [pricingActionEnabled]=\"showPricingAction\" [actionLabel]=\"getActionLabel()\" [actionEnabled]=\"product.isArchived\" [showAction]=\"showActionButton\" [showPricing]=\"showPricing\" (pricingActionSelected)=\"emitPricingActionSelected()\" (actionSelected)=\"emitEnableButtonClicked()\"> </va-header-container> <div class=\"product-details product-content\"> <div class=\"left-column\"> <ng-container *ngIf=\"product.description || product.keySellingPoints\"> <va-selling-info [description]=\"product.description\" [keySellingPoints]=\"product.keySellingPoints\"></va-selling-info> </ng-container> <section *ngIf=\"product.addons?.length > 0\"> <h2 class=\"va-component-title\">Add-Ons</h2> <va-addon-list (addonSelected)=\"onAddonSelected($event)\" [addons]=\"addons\" [product]=\"product\" [showPricing]=\"showPricing\"></va-addon-list> </section> <section *ngIf=\"product.faqs?.length > 0\"> <h2 class=\"va-component-title\">FAQs</h2> <va-faqs [faqs]=\"product.faqs\"></va-faqs> </section> </div> <div class=\"right-column\"> <section *ngIf=\"product.screenshotUrls?.length > 0\"> <h2 class=\"va-component-title\">Gallery</h2> <va-image-gallery [imageUrls]=\"product.screenshotUrls\"></va-image-gallery> </section> <section *ngIf=\"product.files?.length > 0\"> <h2 class=\"va-component-title\">Files</h2> <va-files [files]=\"product.files\"></va-files> </section> </div> </div> </div> ",
styles: [":host { display: block; font-size: 14px; line-height: 1.4; } :host * { box-sizing: border-box; } .va-component-title { font-size: 24px; font-weight: 300; margin-top: 0; } @media screen and (min-width: 600px) { .va-component-title { font-size: 32px; } } img { max-width: 100%; } va-icon { display: inline-block; } .sales-person-details { max-height: 430px; overflow: hidden; } .page { position: relative; margin: 0 auto 20px; background: #ffffff; box-shadow: 0 3px 10px rgba(33, 33, 33, 0.3); overflow: hidden; font-size: 16px; } .page .item-amount { color: #9e9e9e; font-size: 14px; text-align: right; margin: 0 24px 8px; } section { padding: 24px; } .left-column { width: 66%; } @media screen and (max-width: 600px) { .left-column { width: 100%; } } .right-column { width: 34%; } @media screen and (max-width: 600px) { .right-column { width: 100%; } } .product-content { display: flex; } @media screen and (max-width: 600px) { .product-content { flex-direction: column; } } "]
},] },
];
/** @nocollapse */
VaProductDetailsComponent.ctorParameters = function () { return []; };
VaProductDetailsComponent.propDecorators = {
'product': [{ type: Input },],
'showActionButton': [{ type: Input },],
'showPricing': [{ type: Input },],
'pricingActionLabel': [{ type: Input },],
'showPricingAction': [{ type: Input },],
'enableClicked': [{ type: Output },],
'addonSelected': [{ type: Output },],
'pricingActionSelected': [{ type: Output },],
};
return VaProductDetailsComponent;
}());
export { VaProductDetailsComponent };