import { __decorate, __metadata } from "tslib";
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Product } from '../../shared/product';
import { Addon } from '@vendasta/core/shared';
import { PriceDisplayMode } from '../editions-pricing/editions-pricing.component';
var ProductInfoComponent = /** @class */ (function () {
    function ProductInfoComponent() {
        this.showPricing = false;
        this.hasVerifiedContract = false;
        this.canAccessContractPricing = false;
        this.priceDisplayMode = PriceDisplayMode.Wholesale;
        this.addonSelected = new EventEmitter();
    }
    ProductInfoComponent.prototype.onAddonSelected = function (addonId) {
        this.addonSelected.emit(addonId);
    };
    ProductInfoComponent.prototype.getAddons = function () {
        if (!this.addons) {
            this.addons = this.product.addons.map(function (addon) { return Addon.fromApi(addon); });
        }
        return this.addons;
    };
    __decorate([
        Input(),
        __metadata("design:type", Product)
    ], ProductInfoComponent.prototype, "product", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], ProductInfoComponent.prototype, "showPricing", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], ProductInfoComponent.prototype, "hasVerifiedContract", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], ProductInfoComponent.prototype, "canAccessContractPricing", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], ProductInfoComponent.prototype, "productPricing", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], ProductInfoComponent.prototype, "businessCountryCode", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Array)
    ], ProductInfoComponent.prototype, "editionsPricing", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Number)
    ], ProductInfoComponent.prototype, "priceDisplayMode", void 0);
    __decorate([
        Output(),
        __metadata("design:type", Object)
    ], ProductInfoComponent.prototype, "addonSelected", void 0);
    ProductInfoComponent = __decorate([
        Component({
            selector: 'va-product-info',
            template: "<div class=\"product-content\">\n\t<div class=\"left-column\">\n\n\t\t<section *ngIf=\"product.description || product.keySellingPoints\">\n\t\t\t<mat-card>\n\t\t\t\t<va-selling-info\n\t\t\t\t\t[description]=\"product.description\"\n\t\t\t\t\t[keySellingPoints]=\"product.keySellingPoints\">\n\t\t\t\t</va-selling-info>\n\t\t\t</mat-card>\n\t\t</section>\n\n\t\t<section *ngIf=\"product.addons?.length > 0\">\n\t\t\t<mat-card>\n\t\t\t\t<h2 class=\"va-component-title\">{{ 'FRONTEND.STORE.ADD_ONS' | translate }}</h2>\n\t\t\t\t<va-addon-list\n\t\t\t\t\t(addonSelected)=\"onAddonSelected($event)\"\n\t\t\t\t\t[addons]=\"getAddons()\"\n\t\t\t\t\t[showPricing]=\"showPricing\"\n\t\t\t\t\t[hasVerifiedContract]=\"hasVerifiedContract\"\n\t\t\t\t\t[canAccessContractPricing]=\"canAccessContractPricing\"\n\t\t\t\t\t[partnerID]=\"product.partnerId\">\n\t\t\t\t</va-addon-list>\n\t\t\t</mat-card>\n\t\t</section>\n\n\t\t<section *ngIf=\"product.faqs?.length > 0\">\n\t\t\t<mat-card>\n\t\t\t\t<h2 class=\"va-component-title\">{{ 'FRONTEND.STORE.FAQS' | translate }}</h2>\n\t\t\t\t<va-faqs\n\t\t\t\t\t[faqs]=\"product.faqs\">\n\t\t\t\t</va-faqs>\n\t\t\t</mat-card>\n\t\t</section>\n\t</div>\n\n\t<div class=\"right-column\">\n\t\t<section *ngIf=\"!!productPricing\">\n\t\t\t<va-editions-pricing\n\t\t\t\t[product]=\"product\"\n\t\t\t\t[productPricing]=\"productPricing\"\n\t\t\t\t[editionsPricing]=\"editionsPricing\"\n\t\t\t\t[priceDisplayMode]=\"priceDisplayMode\"\n\t\t\t></va-editions-pricing>\n\t\t</section>\n\n\t\t<section >\n\t\t\t<mat-card>\n\t\t\t\t<h2 class=\"va-component-title\">{{ 'FRONTEND.STORE.AVAILABLE_IN' | translate }}</h2>\n\t\t\t\t<supported-countries-v2\n\t\t\t\t    [businessCountryCode] = \"businessCountryCode\"\n\t\t\t\t\t[countryCodes]=\"product.restrictions.country.whitelist\">\n\t\t\t\t</supported-countries-v2>\n\t\t\t</mat-card>\n\t\t</section>\n\n\t\t<section *ngIf=\"product.needHelp\">\n            <mat-card>\n                <h2 class=\"va-component-title\">{{ 'FRONTEND.STORE.NEED_HELP' | translate }}?</h2>\n                <need-help\n                    [needHelp]=\"product.needHelp\">\n                </need-help>\n            </mat-card>\n        </section>\n\t</div>\n</div>\n",
            styles: [":host{display:block;font-size:14px;line-height:1.4}:host *{box-sizing:border-box}section{padding:12px}.left-column{width:66%}@media screen and (max-width:600px){section{padding:8px 0 0}.left-column{width:100%}}.right-column{width:34%}.product-content{display:flex}@media screen and (max-width:600px){.right-column{width:100%}.product-content{flex-direction:column}}:host ::ng-deep .product-content img{width:100%;-o-object-fit:contain;object-fit:contain}.va-component-title{font-size:16px;font-weight:300;margin-top:0}"]
        })
    ], ProductInfoComponent);
    return ProductInfoComponent;
}());
export { ProductInfoComponent };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZHVjdC1pbmZvLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0B2ZW5kYXN0YS9zdG9yZS8iLCJzb3VyY2VzIjpbImxpYi9wcm9kdWN0LWRldGFpbHMtdjIvcHJvZHVjdC1pbmZvL3Byb2R1Y3QtaW5mby5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsWUFBWSxFQUFFLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDdkUsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQy9DLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUU5QyxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxnREFBZ0QsQ0FBQztBQU9sRjtJQUFBO1FBRVcsZ0JBQVcsR0FBRyxLQUFLLENBQUM7UUFDcEIsd0JB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