{"version":3,"file":"toolbox-notification.mjs","sources":["../../../projects/toolbox/notification/notification.service.ts","../../../projects/toolbox/notification/notification.module.ts","../../../projects/toolbox/notification/toolbox-notification.ts"],"sourcesContent":["import { Injectable } from \"@angular/core\";\r\nimport { ToastrService } from \"ngx-toastr\";\r\nimport { TbxNotificationType } from \"./notification-type\";\r\n\r\n/**\r\n * A service to display notifications (toasts) on the application.\r\n */\r\n@Injectable( { providedIn: \"root\" } )\r\nexport class TbxNotificationService\r\n{\r\n  public constructor( private readonly toastrService: ToastrService )\r\n  {\r\n  }\r\n\r\n  /**\r\n   * Displays a success notification.\r\n   * @param message The message to display in the notification.\r\n   * @param title The title of the notification.\r\n   * @returns The promise containing the toast.\r\n   */\r\n  public success( message: string, title?: string ): any\r\n  {\r\n    return this.notification( \"success\", message, title );\r\n  }\r\n\r\n  /**\r\n   * Displays an error notification.\r\n   * @param message The message to display in the notification.\r\n   * @param title The title of the notification.\r\n   * @returns The promise containing the toast.\r\n   */\r\n  public error( message: string, title?: string ): any\r\n  {\r\n    return this.notification( \"error\", message, title );\r\n  }\r\n\r\n  /**\r\n   * Displays an information notification.\r\n   * @param message The message to display in the notification.\r\n   * @param title The title of the notification.\r\n   * @returns The promise containing the toast.\r\n   */\r\n  public info( message: string, title?: string ): any\r\n  {\r\n    return this.notification( \"info\", message, title );\r\n  }\r\n\r\n  /**\r\n   * Displays a warning notification.\r\n   * @param message The message to display in the notification.\r\n   * @param title The title of the notification.\r\n   * @returns The promise containing the toast.\r\n   */\r\n  public warning( message: string, title?: string ): any\r\n  {\r\n    return this.notification( \"warning\", message, title );\r\n  }\r\n\r\n  /**\r\n   * Displays a notification.\r\n   * @param type The notification type.\r\n   * @param message The message to display in the notification.\r\n   * @param title The title of the notification.\r\n   * @returns The promise containing the toast.\r\n   */\r\n  public notification(\r\n    type: TbxNotificationType, message: string, title?: string ): any\r\n  {\r\n    const options =\r\n    {\r\n      closeButton: true,\r\n      progressBar: true,\r\n      enableHtml: true,\r\n      disableTimeOut: false,\r\n      timeOut: 5000\r\n    };\r\n\r\n    switch ( type )\r\n    {\r\n      case \"success\":\r\n        return this.toastrService.success( message, title, options );\r\n      case \"error\":\r\n        return this.toastrService.error( message, title, options );\r\n      case \"warning\":\r\n        return this.toastrService.warning( message, title, options );\r\n      default:\r\n        return this.toastrService.info( message, title, options );\r\n    }\r\n  }\r\n\r\n  /** Clears all notifications currently being displayed. */\r\n  public clearAllToasts(): void\r\n  {\r\n    this.toastrService.clear();\r\n  }\r\n}\r\n","import { NgModule } from \"@angular/core\";\r\nimport { ToastrModule } from \"ngx-toastr\";\r\n\r\n@NgModule( {\r\n  imports: [ToastrModule.forRoot( { timeOut: 10000 } )]\r\n} )\r\nexport class TbxNotificationModule\r\n{\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAIA;;AAEG;MAEU,sBAAsB,CAAA;AAEjC,IAAA,WAAA,CAAqC,aAA4B,EAAA;QAA5B,IAAA,CAAA,aAAa,GAAb,aAAa;;AAIlD;;;;;AAKG;IACI,OAAO,CAAE,OAAe,EAAE,KAAc,EAAA;QAE7C,OAAO,IAAI,CAAC,YAAY,CAAE,SAAS,EAAE,OAAO,EAAE,KAAK,CAAE;;AAGvD;;;;;AAKG;IACI,KAAK,CAAE,OAAe,EAAE,KAAc,EAAA;QAE3C,OAAO,IAAI,CAAC,YAAY,CAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAE;;AAGrD;;;;;AAKG;IACI,IAAI,CAAE,OAAe,EAAE,KAAc,EAAA;QAE1C,OAAO,IAAI,CAAC,YAAY,CAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAE;;AAGpD;;;;;AAKG;IACI,OAAO,CAAE,OAAe,EAAE,KAAc,EAAA;QAE7C,OAAO,IAAI,CAAC,YAAY,CAAE,SAAS,EAAE,OAAO,EAAE,KAAK,CAAE;;AAGvD;;;;;;AAMG;AACI,IAAA,YAAY,CACjB,IAAy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