diff --git a/src/lib/services/iqser-user-preference.service.ts b/src/lib/services/iqser-user-preference.service.ts index 1e1083a..2c818ee 100644 --- a/src/lib/services/iqser-user-preference.service.ts +++ b/src/lib/services/iqser-user-preference.service.ts @@ -15,6 +15,11 @@ export abstract class IqserUserPreferenceService extends GenericService; readonly actions?: ToasterActions[]; + readonly useRaw?: boolean; } export interface ErrorToasterOptions extends ToasterOptions { @@ -35,10 +37,19 @@ export interface ErrorToasterOptions extends ToasterOptions { readonly error?: HttpErrorResponse; } +const defaultDevToastOptions: Partial = { + timeOut: 10000, + easing: 'ease-in-out', + easeTime: 500, + useRaw: true, +}; + @Injectable({ providedIn: 'root', }) export class Toaster { + readonly #isIqserDevMode = isIqserDevMode(); + constructor( private readonly _toastr: ToastrService, private readonly _router: Router, @@ -66,6 +77,14 @@ export class Toaster { return this._toastr.error(message, undefined, config); } + devInfo(message: string): ActiveToast | undefined { + if (!this.#isIqserDevMode) { + return; + } + + return this.info(message, defaultDevToastOptions); + } + info(message: string, options?: Partial): ActiveToast { return this._showToastNotification(message, NotificationType.INFO, options); }