UNPKG

4.91 kBJavaScriptView Raw
1import { Component, EventEmitter, Input, Output } from '@angular/core';
2import { Addon } from '@vendasta/core/marketplace-apps';
3var VaProductDetailsComponent = (function () {
4 function VaProductDetailsComponent() {
5 this.showActionButton = false;
6 this.showPricing = false;
7 this.enableClicked = new EventEmitter();
8 this.addonSelected = new EventEmitter();
9 }
10 VaProductDetailsComponent.prototype.emitEnableButtonClicked = function () {
11 this.enableClicked.emit();
12 };
13 Object.defineProperty(VaProductDetailsComponent.prototype, "addons", {
14 get: function () {
15 return this.product.addons.map(function (addon) { return Addon.fromApi(addon); });
16 },
17 enumerable: true,
18 configurable: true
19 });
20 VaProductDetailsComponent.prototype.getActionLabel = function () {
21 if (this.product.isArchived) {
22 return 'Enable';
23 }
24 return 'Enabled';
25 };
26 Object.defineProperty(VaProductDetailsComponent.prototype, "price", {
27 get: function () {
28 // NOTE: wholesalePrice = 0 means free, wholesalePrice = null means "contact sales"
29 var prices = [];
30 if (this.product.wholesalePrice != null) {
31 prices = [{
32 price: this.product.wholesalePrice,
33 frequency: this.product.billingFrequency
34 }];
35 }
36 return {
37 currency: this.product.currency,
38 prices: prices
39 };
40 },
41 enumerable: true,
42 configurable: true
43 });
44 VaProductDetailsComponent.prototype.onAddonSelected = function (addonId) {
45 this.addonSelected.emit(addonId);
46 };
47 VaProductDetailsComponent.decorators = [
48 { type: Component, args: [{
49 selector: 'va-product-details',
50 template: "<div class=\"page\"> <va-header-container [iconUrl]=\"product.iconUrl\" [title]=\"product.name\" [tagline]=\"product.tagline\" [chipLabels]=\"product.getLmiCategoryNames()\" [pricing]=\"price\" [pricingLabel]=\"'Wholesale Price'\" [actionLabel]=\"getActionLabel()\" [actionEnabled]=\"product.isArchived\" [showAction]=\"showActionButton\" [showPricing]=\"showPricing\" (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\"></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> ",
51 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; } } "]
52 },] },
53 ];
54 /** @nocollapse */
55 VaProductDetailsComponent.ctorParameters = function () { return []; };
56 VaProductDetailsComponent.propDecorators = {
57 'product': [{ type: Input },],
58 'showActionButton': [{ type: Input },],
59 'showPricing': [{ type: Input },],
60 'enableClicked': [{ type: Output },],
61 'addonSelected': [{ type: Output },],
62 };
63 return VaProductDetailsComponent;
64}());
65export { VaProductDetailsComponent };