wsuite-notification
Version:
Toast notification for angular 2,4,5,6,7,8+ version.
464 lines (428 loc) • 29.1 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/platform-browser'), require('@angular/animations'), require('@angular/common')) :
typeof define === 'function' && define.amd ? define('wsuite-notification', ['exports', '@angular/core', 'rxjs', '@angular/platform-browser', '@angular/animations', '@angular/common'], factory) :
(global = global || self, factory(global['wsuite-notification'] = {}, global.ng.core, global.rxjs, global.ng.platformBrowser, global.ng.animations, global.ng.common));
}(this, (function (exports, core, rxjs, platformBrowser, animations, common) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __createBinding(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}
function __exportStar(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result.default = mod;
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
}
function __classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
}
var Notification = /** @class */ (function () {
function Notification(id, type, title, message, timeout) {
this.id = id;
this.type = type;
this.title = title;
this.message = message;
this.timeout = timeout;
}
return Notification;
}());
var NotificationType;
(function (NotificationType) {
NotificationType[NotificationType["success"] = 0] = "success";
NotificationType[NotificationType["warning"] = 1] = "warning";
NotificationType[NotificationType["error"] = 2] = "error";
NotificationType[NotificationType["info"] = 3] = "info";
NotificationType[NotificationType["darkgray"] = 4] = "darkgray";
NotificationType[NotificationType["blue"] = 5] = "blue";
})(NotificationType || (NotificationType = {}));
var WsuiteNotificationConfig = /** @class */ (function () {
function WsuiteNotificationConfig(timeout) {
if (timeout === void 0) { timeout = 3000; }
this.timeout = timeout;
}
return WsuiteNotificationConfig;
}());
var NotificationService = /** @class */ (function () {
function NotificationService(config) {
this.notificationSubject = new rxjs.Subject();
this.nidx = 0;
this.timeout = 3000;
if (config !== undefined) {
this.timeout = config.timeout !== undefined ? config.timeout : 3000;
}
}
NotificationService.prototype.getObservable = function () {
return this.notificationSubject.asObservable();
};
NotificationService.prototype.info = function (title, message, timeout) {
if (timeout === void 0) { timeout = this.timeout; }
this.notificationSubject.next(new Notification(this.nidx++, NotificationType.info, title, message, timeout));
};
NotificationService.prototype.success = function (title, message, timeout) {
if (timeout === void 0) { timeout = this.timeout; }
this.notificationSubject.next(new Notification(this.nidx++, NotificationType.success, title, message, timeout));
};
NotificationService.prototype.warning = function (title, message, timeout) {
if (timeout === void 0) { timeout = this.timeout; }
this.notificationSubject.next(new Notification(this.nidx++, NotificationType.warning, title, message, timeout));
};
NotificationService.prototype.error = function (title, message, timeout) {
if (timeout === void 0) { timeout = this.timeout; }
this.notificationSubject.next(new Notification(this.nidx++, NotificationType.error, title, message, timeout));
};
NotificationService.prototype.darkgray = function (title, message, timeout) {
if (timeout === void 0) { timeout = this.timeout; }
this.notificationSubject.next(new Notification(this.nidx++, NotificationType.darkgray, title, message, timeout));
};
NotificationService.prototype.blue = function (title, message, timeout) {
if (timeout === void 0) { timeout = this.timeout; }
this.notificationSubject.next(new Notification(this.nidx++, NotificationType.blue, title, message, timeout));
};
NotificationService.ctorParameters = function () { return [
{ type: WsuiteNotificationConfig, decorators: [{ type: core.Optional }] }
]; };
NotificationService.ɵprov = core.ɵɵdefineInjectable({ factory: function NotificationService_Factory() { return new NotificationService(core.ɵɵinject(WsuiteNotificationConfig, 8)); }, token: NotificationService, providedIn: "root" });
NotificationService = __decorate([
core.Injectable({
providedIn: "root",
}),
__param(0, core.Optional())
], NotificationService);
return NotificationService;
}());
var NotificationComponent = /** @class */ (function () {
function NotificationComponent(notificationSvc, domSanitizer) {
this.notificationSvc = notificationSvc;
this.domSanitizer = domSanitizer;
this.notifications = [];
}
NotificationComponent.prototype._addNotification = function (notification) {
var _this = this;
this.notifications.push(notification);
if (notification.timeout !== 0) {
setTimeout(function () { return _this.close(notification); }, notification.timeout);
}
};
NotificationComponent.prototype.ngOnInit = function () {
var _this = this;
this.subscription = this.notificationSvc.getObservable().subscribe(function (notification) { return _this._addNotification(notification); });
};
NotificationComponent.prototype.ngOnDestroy = function () {
this.subscription.unsubscribe();
};
NotificationComponent.prototype.close = function (notification) {
this.notifications = this.notifications.filter(function (notif) { return notif.id !== notification.id; });
};
NotificationComponent.prototype.className = function (notification) {
var style;
switch (notification.type) {
case NotificationType.success:
style = 'wsuite-alert-success';
break;
case NotificationType.warning:
style = 'wsuite-alert-warning';
break;
case NotificationType.error:
style = 'wsuite-alert-error';
break;
case NotificationType.darkgray:
style = 'wsuite-alert-darkgray';
break;
case NotificationType.blue:
style = 'wsuite-alert-blue';
break;
default:
style = 'info';
break;
}
return style;
};
NotificationComponent.prototype.setIcon = function (notification) {
var icon;
switch (notification.type) {
case NotificationType.success:
icon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMC43NjkiIHZpZXdCb3g9IjAgMCAxNCAxMC43NjkiPjxkZWZzPjxzdHlsZT4uYXtmaWxsOiNmZmY7fTwvc3R5bGU+PC9kZWZzPjxwYXRoIGNsYXNzPSJhIiBkPSJNLjE2Miw4LjkyM2EuNTIxLjUyMSwwLDAsMSwwLS43NTRsLjc1NC0uNzU0YS41MjEuNTIxLDAsMCwxLC43NTQsMGwuMDU0LjA1NCwyLjk2MiwzLjE3N2EuMjYuMjYsMCwwLDAsLjM3NywwbDcuMjE1LTcuNDg1aC4wNTRhLjUyMS41MjEsMCwwLDEsLjc1NCwwbC43NTQuNzU0YS41MjEuNTIxLDAsMCwxLDAsLjc1NGgwTDUuMjIzLDEzLjYwOGEuNTIxLjUyMSwwLDAsMS0uNzU0LDBMLjI2OSw5LjA4NS4xNjIsOC45MjNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIC0zKSIvPjwvc3ZnPg==';
break;
case NotificationType.warning:
icon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOCIgaGVpZ2h0PSIxNS40NzkiIHZpZXdCb3g9IjAgMCAxOCAxNS40NzkiPjxkZWZzPjxzdHlsZT4uYXtmaWxsOiNmZmY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DUuNzczLjc3MywwLDAsMCwwLTEuNTQ1WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTIzMi42NTEgLTM1My4zMDYpIi8+PC9nPjwvZz48L3N2Zz4=';
break;
case NotificationType.error:
icon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNC44MjgiIGhlaWdodD0iMTQuODI4IiB2aWV3Qm94PSIwIDAgMTQuODI4IDE0LjgyOCI+PGRlZnM+PHN0eWxlPi5he2ZpbGw6bm9uZTtzdHJva2U6I2ZmZjtzdHJva2UtbGluZWNhcDpyb3VuZDtzdHJva2Utd2lkdGg6MnB4O308L3N0eWxlPjwvZGVmcz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTMyNS4yMDUgLTExLjIwNSkiPjxsaW5lIGNsYXNzPSJhIiB4Mj0iMTIiIHkyPSIxMiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTMyNi42MTkgMTIuNjE5KSIvPjxsaW5lIGNsYXNzPSJhIiB4MT0iMTIiIHkyPSIxMiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTMyNi42MTkgMTIuNjE5KSIvPjwvZz48L3N2Zz4=';
break;
case NotificationType.darkgray:
icon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2LjQzOSIgaGVpZ2h0PSIxNCIgdmlld0JveD0iMCAwIDYuNDM5IDE0Ij48ZGVmcz48c3R5bGU+LmF7ZmlsbDojZmZmO308L3N0eWxlPjwvZGVmcz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjcpIj48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNykiPjxwYXRoIGNsYXNzPSJhIiBkPSJNMzEuOTIzLDBhMS4zMDksMS4zMDksMCwwLDEsMS40MDYsMS4zNywxLjg0MSwxLjg0MSwwLDA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OWEzLjgxMywzLjgxMywwLDAsMCwxLjY2NS0uODQ2bC40Mi41NzFBNy43LDcuNywwLDAsMSwyOS4wMzYsMTRaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjcpIi8+PC9nPjwvZz48L3N2Zz4=';
break;
}
return this.domSanitizer.bypassSecurityTrustResourceUrl(icon);
};
NotificationComponent.ctorParameters = function () { return [
{ type: NotificationService },
{ type: platformBrowser.DomSanitizer }
]; };
NotificationComponent = __decorate([
core.Component({
selector: 'wsuite-notification',
template: "<div class=\"wsuite-notifications\">\n <div class=\"wsuite-alert wsuite-alert-dismissible w-350\" [ngClass]=\"className(notification)\"\n *ngFor=\"let notification of notifications\" role=\"wsuite-alert\" @fade>\n <span class=\"info\"> <img [src]=\"setIcon(notification)\" alt=\"\"> </span>\n <div class=\"wsuite-alert-body\">\n <p class=\"n1\">{{notification.title}}</p>\n <small [innerHtml]=\"notification.message | wsuiteSafeHtml\"></small>\n </div>\n <button type=\"button\" class=\"close\" (click)=\"close(notification)\" aria-label=\"Close\"> <span\n aria-hidden=\"true\">×</span>\n </button>\n </div>\n</div>",
animations: [
animations.trigger('fade', [
animations.transition('void => *', [
animations.style({ opacity: 0 }),
animations.animate(500, animations.style({ opacity: 1 }))
]),
animations.transition('* => void', [
animations.style({ opacity: 1 }),
animations.animate(500, animations.style({ opacity: 0 }))
])
])
],
styles: [".wsuite-notifications{position:fixed;top:60px;right:0;z-index:99999999;left:50%;margin-left:-175px}.wsuite-alert .info{width:39px;display:flex;align-items:center;justify-content:center}.wsuite-alert-body{padding:4px 34px 4px 13px;flex:1;display:flex;flex-direction:column;justify-content:center}.wsuite-alert-body p{line-height:17px}.wsuite-alert-body small{font-size:10px;color:#868686;line-height:14px;display:block}.wsuite-alert{display:flex;align-items:stretch;box-shadow:0 3px 6px rgba(0,0,0,.16);margin:5px;left:50%;background-color:#fff;border-radius:.25rem;min-height:40px}.wsuite-alert .close{align-self:flex-start;margin-right:5px}.wsuite-alert-darkgray{border:1px solid #404040;padding:0}.wsuite-alert-darkgray .info{background-color:#404040}.wsuite-alert-blue{border:1px solid #41a3f3;padding:0}.wsuite-alert-blue .info{background-color:#41a3f3}.wsuite-alert-warning{border:1px solid #f5b829;padding:0}.wsuite-alert-warning .info{background-color:#f5b829}.wsuite-alert-error{border:1px solid #ff5c5c;padding:0}.wsuite-alert-error .info{background-color:#ff5c5c}.wsuite-alert-success{border:1px solid #5abe2b;padding:0}.wsuite-alert-success .info{background-color:#5abe2b}.w-250{max-width:250px}.w-350{max-width:350px}.wsuite-alert-example .wsuite-alert{margin-bottom:38px}"]
})
], NotificationComponent);
return NotificationComponent;
}());
var WsuiteSafeHtmlPipe = /** @class */ (function () {
function WsuiteSafeHtmlPipe(sanitized) {
this.sanitized = sanitized;
}
WsuiteSafeHtmlPipe.prototype.transform = function (value) {
// var byPassStyle = this.sanitized.bypassSecurityTrustStyle(value);
// console.log(this.sanitized.bypassSecurityTrustHtml(byPassStyle))
return this.sanitized.bypassSecurityTrustHtml(value);
};
WsuiteSafeHtmlPipe.ctorParameters = function () { return [
{ type: platformBrowser.DomSanitizer }
]; };
WsuiteSafeHtmlPipe = __decorate([
core.Pipe({ name: 'wsuiteSafeHtml' })
], WsuiteSafeHtmlPipe);
return WsuiteSafeHtmlPipe;
}());
var WsuiteNotificationModule = /** @class */ (function () {
function WsuiteNotificationModule() {
}
WsuiteNotificationModule_1 = WsuiteNotificationModule;
WsuiteNotificationModule.forRoot = function (config) {
return {
ngModule: WsuiteNotificationModule_1,
providers: [
{
provide: WsuiteNotificationConfig,
useValue: config
}
]
};
};
var WsuiteNotificationModule_1;
WsuiteNotificationModule = WsuiteNotificationModule_1 = __decorate([
core.NgModule({
declarations: [
NotificationComponent,
WsuiteSafeHtmlPipe
],
imports: [
common.CommonModule
],
providers: [
NotificationService
],
exports: [
NotificationComponent,
WsuiteSafeHtmlPipe
]
})
], WsuiteNotificationModule);
return WsuiteNotificationModule;
}());
exports.NotificationComponent = NotificationComponent;
exports.NotificationService = NotificationService;
exports.WsuiteNotificationModule = WsuiteNotificationModule;
exports.ɵa = WsuiteNotificationConfig;
exports.ɵb = WsuiteSafeHtmlPipe;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=wsuite-notification.umd.js.map