// Copyright (c) Laserfiche.
// Licensed under the MIT License. See LICENSE in the project root for license information.
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { LfMessageToastTypes } from '@laserfiche/lf-ui-components/internal-shared';
import * as i0 from "@angular/core";
import * as i1 from "@laserfiche/lf-ui-components/internal-shared";
import * as i2 from "@angular/forms";
import * as i3 from "@angular/material/checkbox";
import * as i4 from "../feedback-image-upload/feedback-image-upload.component";
import * as i5 from "@angular/common";
/** @internal */
export class FeedbackSubmissionComponent {
    constructor(localizationService) {
        this.localizationService = localizationService;
        this.feedbackTextChanged = new EventEmitter();
        this.toastMessages = [];
        this.maxFeedbackLength = 2048;
        this.feedbackLength = 0;
        this.feedbackEmailCheckbox = false;
        this.localizedStrings = {
            FOUND_SOMETHING_LIKE_DISLIKE_LET_US_KNOW: this.localizationService.getStringComponentsObservable('FOUND_SOMETHING_LIKE_DISLIKE_LET_US_KNOW'),
            DO_YOU_HAVE_IDEA_NEW_FEATURE_IMPROVEMENT_LOOK_FORWARD_TO_HEARING: this.localizationService.getStringComponentsObservable('DO_YOU_HAVE_IDEA_NEW_FEATURE_IMPROVEMENT_LOOK_FORWARD_TO_HEARING'),
            TELL_US_ABOUT_EXPERIENCE: this.localizationService.getStringComponentsObservable('TELL_US_ABOUT_EXPERIENCE'),
            PLEASE_DO_NOT_INCLUDE_CONFIDENTIAL_OR_PERSONAL_INFO_IN_FEEDBACK: this.localizationService.getStringComponentsObservable('PLEASE_DO_NOT_INCLUDE_CONFIDENTIAL_OR_PERSONAL_INFO_IN_FEEDBACK'),
            YOU_MAY_CONTACT_ME_ABOUT_FEEDBACK: this.localizationService.getStringComponentsObservable('YOU_MAY_CONTACT_ME_ABOUT_FEEDBACK'),
            TELL_US_ABOUT_IDEA: this.localizationService.getStringComponentsObservable('TELL_US_ABOUT_IDEA'),
            REQUIRED: this.localizationService.getStringLaserficheObservable('REQUIRED'),
        };
    }
    onFeedbackImageBase64(imageBase64) {
        this.feedbackImageBase64 = imageBase64;
    }
    feedbackTextBoxChange(event) {
        const feedbackText = event.target.value;
        this.feedbackLength = feedbackText.length;
        this.feedbackTextChanged.emit(feedbackText);
    }
    onImageUploadError(errMsg) {
        const errorToastMsg = {
            message: errMsg,
            type: LfMessageToastTypes.Warning,
            noIcon: false,
            hideMessage: false,
        };
        this.toastMessages = [errorToastMsg];
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FeedbackSubmissionComponent, deps: [{ token: i1.AppLocalizationService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: FeedbackSubmissionComponent, selector: "lf-feedback-submission", inputs: { isFeedback: "isFeedback" }, outputs: { feedbackTextChanged: "feedbackTextChanged" }, ngImport: i0, template: "<!--Copyright (c) Laserfiche.\r\nLicensed under the MIT License. See LICENSE in the project root for license information.-->\r\n\r\n<div class=\"user-feedback-content-container lf-dialog-content\">\r\n  <lf-toast-message id=\"messages\" [messages]=\"toastMessages\"></lf-toast-message>\r\n  <div class=\"lf-text-body lf-user-feedback-description\">\r\n    {{\r\n      isFeedback\r\n        ? (localizedStrings.FOUND_SOMETHING_LIKE_DISLIKE_LET_US_KNOW | async)\r\n        : (localizedStrings.DO_YOU_HAVE_IDEA_NEW_FEATURE_IMPROVEMENT_LOOK_FORWARD_TO_HEARING | async)\r\n    }}\r\n  </div>\r\n  <label for=\"feedback-suggestion-textbox\" class=\"lf-text-label\"\r\n    >{{\r\n      isFeedback ? (localizedStrings.TELL_US_ABOUT_EXPERIENCE | async) : (localizedStrings.TELL_US_ABOUT_IDEA | async)\r\n    }}\r\n    ({{ localizedStrings.REQUIRED | async }})</label\r\n  >\r\n  <textarea\r\n    id=\"feedback-suggestion-textbox\"\r\n    rows=\"10\"\r\n    [attr.maxlength]=\"maxFeedbackLength\"\r\n    (input)=\"feedbackTextBoxChange($event)\"\r\n    class=\"lf-textarea lf-text-placeholder lf-text-body feedback-suggestion-textbox\"\r\n    [placeholder]=\"localizedStrings.PLEASE_DO_NOT_INCLUDE_CONFIDENTIAL_OR_PERSONAL_INFO_IN_FEEDBACK | async\"\r\n  ></textarea>\r\n  <div class=\"lf-text-body character-count\">\r\n    <span>{{ feedbackLength }}</span>\r\n    <span> / </span>\r\n    <span>{{ maxFeedbackLength }}</span>\r\n  </div>\r\n  <lf-feedback-image-upload\r\n    id=\"image-upload-block\"\r\n    (feedbackImageBase64)=\"onFeedbackImageBase64($event)\"\r\n    (imageUploadError)=\"onImageUploadError($event)\"\r\n  ></lf-feedback-image-upload>\r\n  <div class=\"email-checkbox-container\">\r\n    <mat-checkbox\r\n      color=\"primary\"\r\n      class=\"lf-user-feedback-checkbox lf-checkbox\"\r\n      [disableRipple]=\"true\"\r\n      ngDefaultControl\r\n      [(ngModel)]=\"feedbackEmailCheckbox\"\r\n    >\r\n      {{ localizedStrings.YOU_MAY_CONTACT_ME_ABOUT_FEEDBACK | async }}\r\n    </mat-checkbox>\r\n  </div>\r\n</div>\r\n", styles: ["#image-upload-block{height:160px}\n", ".lf-close-button{cursor:pointer;display:flex;height:24px;width:24px;align-items:center;border:none;background:inherit;justify-content:center;color:#646464}.lf-textarea{width:100%;display:block;border:1px solid #aaaaaa;border-radius:2px;padding:7px 10px 8px;box-sizing:border-box}.lf-textarea::-webkit-scrollbar{width:8px}.lf-textarea::-webkit-scrollbar-track{margin:1px}.lf-textarea::-webkit-scrollbar-thumb{background:#6d6d6d;border-radius:10px}.dialog-button{margin-left:10px}.character-count{width:100%;text-align:right;font-size:12px;margin-top:2px}.feedback-suggestion-textbox{resize:none}.lf-user-feedback-description{margin-bottom:10px}.feedback-suggestion-button{margin-left:auto;margin-right:auto;font-weight:600;cursor:pointer;display:block;width:80%;height:60px;background-color:inherit;border:1px solid #cfcfcf;border-radius:4px;line-height:16px}#lf-user-feedback-suggestion-mode-button{margin-top:5px}.feedback-suggestion-button:hover{background-color:#e0e0e0}.email-checkbox-container{margin-top:20px;display:flex;justify-content:flex-start}::ng-deep .lf-user-feedback-panel .mat-mdc-dialog-container{padding:0}.dialog-content{position:relative}#messages{top:-15px}.lf-text-label{display:block;padding-bottom:5px}::ng-deep .lf-user-feedback-checkbox.mat-mdc-checkbox .mdc-checkbox{margin-right:4px;padding:0}::ng-deep .lf-user-feedback-checkbox.mat-mdc-checkbox .mdc-checkbox .mat-mdc-checkbox-touch-target{width:20px;height:20px}::ng-deep .lf-user-feedback-checkbox.mat-mdc-checkbox .mdc-checkbox .mdc-checkbox__native-control{width:18px;height:18px}::ng-deep .lf-user-feedback-checkbox.mat-mdc-checkbox .mdc-checkbox .mdc-checkbox__background{left:0;top:0}\n"], dependencies: [{ kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: i1.LfToastMessageComponent, selector: "lf-toast-message", inputs: ["messages"] }, { kind: "component", type: i4.FeedbackImageUploadComponent, selector: "lf-feedback-image-upload", outputs: ["imageUploadError", "feedbackImageBase64"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FeedbackSubmissionComponent, decorators: [{
            type: Component,
            args: [{ selector: 'lf-feedback-submission', template: "<!--Copyright (c) Laserfiche.\r\nLicensed under the MIT License. See LICENSE in the project root for license information.-->\r\n\r\n<div class=\"user-feedback-content-container lf-dialog-content\">\r\n  <lf-toast-message id=\"messages\" [messages]=\"toastMessages\"></lf-toast-message>\r\n  <div class=\"lf-text-body lf-user-feedback-description\">\r\n    {{\r\n      isFeedback\r\n        ? (localizedStrings.FOUND_SOMETHING_LIKE_DISLIKE_LET_US_KNOW | async)\r\n        : (localizedStrings.DO_YOU_HAVE_IDEA_NEW_FEATURE_IMPROVEMENT_LOOK_FORWARD_TO_HEARING | async)\r\n    }}\r\n  </div>\r\n  <label for=\"feedback-suggestion-textbox\" class=\"lf-text-label\"\r\n    >{{\r\n      isFeedback ? (localizedStrings.TELL_US_ABOUT_EXPERIENCE | async) : (localizedStrings.TELL_US_ABOUT_IDEA | async)\r\n    }}\r\n    ({{ localizedStrings.REQUIRED | async }})</label\r\n  >\r\n  <textarea\r\n    id=\"feedback-suggestion-textbox\"\r\n    rows=\"10\"\r\n    [attr.maxlength]=\"maxFeedbackLength\"\r\n    (input)=\"feedbackTextBoxChange($event)\"\r\n    class=\"lf-textarea lf-text-placeholder lf-text-body feedback-suggestion-textbox\"\r\n    [placeholder]=\"localizedStrings.PLEASE_DO_NOT_INCLUDE_CONFIDENTIAL_OR_PERSONAL_INFO_IN_FEEDBACK | async\"\r\n  ></textarea>\r\n  <div class=\"lf-text-body character-count\">\r\n    <span>{{ feedbackLength }}</span>\r\n    <span> / </span>\r\n    <span>{{ maxFeedbackLength }}</span>\r\n  </div>\r\n  <lf-feedback-image-upload\r\n    id=\"image-upload-block\"\r\n    (feedbackImageBase64)=\"onFeedbackImageBase64($event)\"\r\n    (imageUploadError)=\"onImageUploadError($event)\"\r\n  ></lf-feedback-image-upload>\r\n  <div class=\"email-checkbox-container\">\r\n    <mat-checkbox\r\n      color=\"primary\"\r\n      class=\"lf-user-feedback-checkbox lf-checkbox\"\r\n      [disableRipple]=\"true\"\r\n      ngDefaultControl\r\n      [(ngModel)]=\"feedbackEmailCheckbox\"\r\n    >\r\n      {{ localizedStrings.YOU_MAY_CONTACT_ME_ABOUT_FEEDBACK | async }}\r\n    </mat-checkbox>\r\n  </div>\r\n</div>\r\n", styles: ["#image-upload-block{height:160px}\n", ".lf-close-button{cursor:pointer;display:flex;height:24px;width:24px;align-items:center;border:none;background:inherit;justify-content:center;color:#646464}.lf-textarea{width:100%;display:block;border:1px solid #aaaaaa;border-radius:2px;padding:7px 10px 8px;box-sizing:border-box}.lf-textarea::-webkit-scrollbar{width:8px}.lf-textarea::-webkit-scrollbar-track{margin:1px}.lf-textarea::-webkit-scrollbar-thumb{background:#6d6d6d;border-radius:10px}.dialog-button{margin-left:10px}.character-count{width:100%;text-align:right;font-size:12px;margin-top:2px}.feedback-suggestion-textbox{resize:none}.lf-user-feedback-description{margin-bottom:10px}.feedback-suggestion-button{margin-left:auto;margin-right:auto;font-weight:600;cursor:pointer;display:block;width:80%;height:60px;background-color:inherit;border:1px solid #cfcfcf;border-radius:4px;line-height:16px}#lf-user-feedback-suggestion-mode-button{margin-top:5px}.feedback-suggestion-button:hover{background-color:#e0e0e0}.email-checkbox-container{margin-top:20px;display:flex;justify-content:flex-start}::ng-deep .lf-user-feedback-panel .mat-mdc-dialog-container{padding:0}.dialog-content{position:relative}#messages{top:-15px}.lf-text-label{display:block;padding-bottom:5px}::ng-deep .lf-user-feedback-checkbox.mat-mdc-checkbox .mdc-checkbox{margin-right:4px;padding:0}::ng-deep .lf-user-feedback-checkbox.mat-mdc-checkbox .mdc-checkbox .mat-mdc-checkbox-touch-target{width:20px;height:20px}::ng-deep .lf-user-feedback-checkbox.mat-mdc-checkbox .mdc-checkbox .mdc-checkbox__native-control{width:18px;height:18px}::ng-deep .lf-user-feedback-checkbox.mat-mdc-checkbox .mdc-checkbox .mdc-checkbox__background{left:0;top:0}\n"] }]
        }], ctorParameters: () => [{ type: i1.AppLocalizationService }], propDecorators: { isFeedback: [{
                type: Input
            }], feedbackTextChanged: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 