import { __decorate, __metadata } from "tslib";
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { BillingModel } from '@vendasta/billing';
import { of } from 'rxjs';
import { TranslateService } from '@ngx-translate/core';
var VaHeaderContainerComponent = /** @class */ (function () {
    function VaHeaderContainerComponent(translateService) {
        this.translateService = translateService;
        this.loaded = true;
        this.showEnableAddon = false;
        this.prerequisiteSelected = new EventEmitter();
        this.actionSelected = new EventEmitter();
        this.primaryPricingActionSelected = new EventEmitter();
        this.pricingActionSelected = new EventEmitter();
    }
    VaHeaderContainerComponent.prototype.onActionSelected = function () {
        this.actionSelected.emit();
    };
    VaHeaderContainerComponent.prototype.onPrerequisiteSelected = function () {
        this.prerequisiteSelected.emit();
    };
    VaHeaderContainerComponent.prototype.showPricingModel = function (billedProduct) {
        return billedProduct && [BillingModel.Tiered, BillingModel.Stairstep].includes(billedProduct.billingModel);
    };
    VaHeaderContainerComponent.prototype.getPricingModelTooltips = function (billingModel) {
        switch (billingModel) {
            case BillingModel.Stairstep:
                return this.translateService.stream('FRONTEND.STORE.PRICE_APPLIES_PER_UNIT');
            case BillingModel.Tiered:
                return this.translateService.stream('FRONTEND.STORE.PRICE_APPLIES_TO_ALL_UNITS');
            default:
                return of('');
        }
    };
    VaHeaderContainerComponent.ctorParameters = function () { return [
        { type: TranslateService }
    ]; };
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], VaHeaderContainerComponent.prototype, "iconUrl", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], VaHeaderContainerComponent.prototype, "title", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], VaHeaderContainerComponent.prototype, "tagline", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], VaHeaderContainerComponent.prototype, "prerequisite", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Array)
    ], VaHeaderContainerComponent.prototype, "chipLabels", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], VaHeaderContainerComponent.prototype, "pricing", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], VaHeaderContainerComponent.prototype, "billedProduct", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], VaHeaderContainerComponent.prototype, "loaded", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], VaHeaderContainerComponent.prototype, "hasVerifiedContract", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], VaHeaderContainerComponent.prototype, "pricingLabel", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], VaHeaderContainerComponent.prototype, "primaryPricingActionLabel", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], VaHeaderContainerComponent.prototype, "pricingActionLabel", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], VaHeaderContainerComponent.prototype, "pricingActionEnabled", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], VaHeaderContainerComponent.prototype, "actionEnabled", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], VaHeaderContainerComponent.prototype, "actionLabel", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], VaHeaderContainerComponent.prototype, "showAction", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], VaHeaderContainerComponent.prototype, "showPricing", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], VaHeaderContainerComponent.prototype, "showEnableAddon", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], VaHeaderContainerComponent.prototype, "prerequisiteLabel", void 0);
    __decorate([
        Output(),
        __metadata("design:type", Object)
    ], VaHeaderContainerComponent.prototype, "prerequisiteSelected", void 0);
    __decorate([
        Output(),
        __metadata("design:type", Object)
    ], VaHeaderContainerComponent.prototype, "actionSelected", void 0);
    __decorate([
        Output(),
        __metadata("design:type", Object)
    ], VaHeaderContainerComponent.prototype, "primaryPricingActionSelected", void 0);
    __decorate([
        Output(),
        __metadata("design:type", Object)
    ], VaHeaderContainerComponent.prototype, "pricingActionSelected", void 0);
    VaHeaderContainerComponent = __decorate([
        Component({
            selector: 'va-header-container',
            template: "<div class=\"header-container\">\n    <div class=\"product-overview\">\n      <div class=\"product-id\">\n\n        <va-icon [iconUrl]=\"iconUrl\" [name]=\"title\" [diameter]=\"120\"></va-icon>\n\n        <div class=\"product-id-text\">\n\n          <h1 [ngClass]=\"{'stencil-title stencil-shimmer': !title, 'product-title': title}\">\n            {{ title }}\n          </h1>\n\n          <span [ngClass]=\"{'stencil-tagline stencil-shimmer': !title && !tagline, 'tagline': tagline}\">\n            {{ tagline }}\n          </span>\n\n          <div *ngIf=\"prerequisite\" class=\"prerequisite\">\n            <span class=\"requires-text\">{{ 'FRONTEND.STORE.REQUIRES' | translate }}</span>\n            <span>{{ prerequisite }}</span>\n          </div>\n\n          <mat-chip-list>\n            <mat-chip *ngFor=\"let chip of chipLabels\">{{ chip }}</mat-chip>\n          </mat-chip-list>\n\n        </div>\n      </div>\n\n      <div class=\"pricing\">\n\n        <button *ngIf=\"showAction && !showEnableAddon\" mat-raised-button class=\"app-enable-button\" [disabled]=\"!actionEnabled\" (click)=\"onActionSelected()\">\n          {{ actionLabel }}\n        </button>\n\n        <button *ngIf=\"showEnableAddon && !showAction\" mat-raised-button class=\"app-enable-button\" [disabled]=\"!showEnableAddon\" (click)=\"onActionSelected()\">\n          {{ actionLabel }}\n        </button>\n\n        <div *ngIf=\"prerequisiteLabel && !showEnableAddon\" class=\"addon-enable\" (click)=\"onPrerequisiteSelected()\">\n          {{ 'FRONTEND.STORE.ENABLED_WITH_PREREQUISITE' | translate: {prerequisite: prerequisiteLabel } }}\n        </div>\n\n        <div *ngIf=\"showPricing\" class=\"price-box\">\n          <div *ngIf=\"pricing?.prices?.length\" class=\"wholesale-price\">{{ pricingLabel }}\n              <div *ngIf=\"showPricingModel(billedProduct) && hasVerifiedContract\"\n                   class=\"pricing-model\"\n                   [matTooltip]=\"getPricingModelTooltips(billedProduct.billingModel) | async\">({{ billedProduct.billingModel }})\n              </div>\n          </div>\n          <va-pricing [pricing]=\"pricing\"\n                      [billedProduct]=\"billedProduct\"\n                      [hasVerifiedContract]=\"hasVerifiedContract\"\n                      [loaded]=\"loaded\"></va-pricing>\n        </div>\n\n        <p *ngIf=\"pricingActionEnabled\" class=\"pricing-action-container\">\n          <a (click)=\"primaryPricingActionSelected.emit()\">{{ primaryPricingActionLabel }}</a>\n          <a (click)=\"pricingActionSelected.emit()\">{{ pricingActionLabel }}</a>\n        </p>\n\n      </div>\n\n    </div>\n</div>\n",
            styles: [":host{font-size:16px}.product-title{font-size:24px}.product-overview{display:flex;flex-wrap:wrap;border-bottom:1px solid #e0e0e0}.product-overview h1{margin:0;font-weight:400;line-height:1.2}.product-overview mat-chip{margin-bottom:3px}.product-id{display:flex;width:100%;padding:24px;flex-grow:1}.product-id va-icon{margin-right:20px}@media screen and (max-width:600px){.product-id va-icon ::ng-deep .va-icon-container{width:40px!important;height:40px!important}.product-id va-icon ::ng-deep .va-icon-container span{line-height:40px!important;font-size:15px!important}}.product-id .product-id-text{display:flex;flex-direction:column;justify-content:center}.product-id span{overflow:hidden}.product-id .tagline{color:#616161;margin:.5em 0 1em;font-size:16px}@media screen and (min-width:600px){.product-title{font-size:32px}.product-id .tagline{font-size:20px}.product-id{width:66%;padding-right:20px}}.product-id .prerequisite{margin:.5em 0 1em;font-size:14px}.product-id .requires-text{color:#9e9e9e}.inline-link{display:inline-flex!important;color:#1e88e5;cursor:pointer;padding-top:5px}.pricing{display:flex;flex-direction:column;width:100%;padding:0 24px 24px;color:#616161}@media screen and (min-width:600px){.pricing{width:34%;padding-top:24px;padding-left:20px}}.pricing span{display:block}.pricing span:nth-child(2){margin:.5em 0 1em}.pricing .price{font-size:24px;font-weight:700;line-height:1;color:#4caf50}.pricing .price-box{padding-top:10px}.pricing .pricing-action-container{display:flex;flex-direction:column;margin:8px 0}.pricing .pricing-action-container mat-icon{vertical-align:middle;margin-right:6px}.pricing .pricing-action-container a{cursor:pointer;margin:5px 0}.pricing .pricing-model{display:inline-block;font-size:.8rem;color:#9e9e9e;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.app-enable-button{height:inherit;color:#fff;background-color:#4caf50;font-size:20px;padding:14px 16px;line-height:1}.addon-enable{height:inherit;background-color:#e0e0e0;font-size:14px;padding:14px 16px;line-height:1;color:#1e88e5;cursor:pointer;text-align:center}.wholesale-price{margin-top:0;padding-bottom:8px;margin-bottom:4px;border-bottom:1px solid #e0e0e0}.stencil-title{height:32px;width:200px;margin-bottom:5px!important}.stencil-tagline{height:32px;width:250px}"]
        }),
        __metadata("design:paramtypes", [TranslateService])
    ], VaHeaderContainerComponent);
    return VaHeaderContainerComponent;
}());
export { VaHeaderContainerComponent };
//# sourceMappingURL=data:application/json;base64, 