@everymatrix/nuts-inbox-widget 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/cjs/{index-8aa58524.js → index-84dbe58e.js} +3 -0
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/nuts-inbox-widget.cjs.js +2 -2
  4. package/dist/cjs/nuts-inbox-widget_3.cjs.entry.js +204 -37
  5. package/dist/collection/components/nuts-inbox-widget/nuts-inbox-widget.js +50 -7
  6. package/dist/collection/components/nuts-notification/nuts-notification.css +16 -10
  7. package/dist/collection/components/nuts-notification/nuts-notification.js +80 -19
  8. package/dist/collection/components/nuts-popover/nuts-popover.css +9 -10
  9. package/dist/collection/components/nuts-popover/nuts-popover.js +50 -11
  10. package/dist/collection/utils/locale.utils.js +24 -2
  11. package/dist/components/nuts-inbox-widget.js +32 -9
  12. package/dist/components/nuts-notification2.js +154 -27
  13. package/dist/components/nuts-popover2.js +24 -4
  14. package/dist/esm/{index-5bd134e8.js → index-722b5754.js} +3 -0
  15. package/dist/esm/loader.js +2 -2
  16. package/dist/esm/nuts-inbox-widget.js +2 -2
  17. package/dist/esm/nuts-inbox-widget_3.entry.js +204 -37
  18. package/dist/nuts-inbox-widget/nuts-inbox-widget.esm.js +1 -1
  19. package/dist/nuts-inbox-widget/p-11f92a64.js +1 -0
  20. package/dist/nuts-inbox-widget/p-acc1b8ac.entry.js +1 -0
  21. package/dist/types/components/nuts-inbox-widget/nuts-inbox-widget.d.ts +6 -0
  22. package/dist/types/components/nuts-notification/nuts-notification.d.ts +54 -0
  23. package/dist/types/components/nuts-popover/nuts-popover.d.ts +33 -0
  24. package/dist/types/components.d.ts +174 -0
  25. package/dist/types/utils/locale.utils.d.ts +2 -1
  26. package/package.json +1 -1
  27. package/dist/nuts-inbox-widget/p-1aaf84db.js +0 -1
  28. package/dist/nuts-inbox-widget/p-9266db23.entry.js +0 -1
@@ -704,6 +704,9 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
704
704
  hostRef.$queuedListeners$ = null;
705
705
  }
706
706
  }
707
+ {
708
+ promise = safeCall(instance, 'componentWillLoad');
709
+ }
707
710
  }
708
711
  endSchedule();
709
712
  return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-8aa58524.js');
5
+ const index = require('./index-84dbe58e.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["nuts-inbox-widget_3.cjs",[[1,"nuts-inbox-widget",{"backendUrl":[513,"backend-url"],"socketUrl":[513,"socket-url"],"userId":[513,"user-id"],"sessionId":[513,"session-id"],"operatorId":[513,"operator-id"],"deviceId":[513,"device-id"],"language":[513],"environment":[513],"applicationIdentifier":[513,"application-identifier"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"bellIconPosition":[513,"bell-icon-position"],"notificationAction":[513,"notification-action"],"isLoading":[32],"popoverVisible":[32],"unseenCount":[32]}],[0,"nuts-popover",{"language":[513],"userId":[513,"user-id"],"operatorId":[513,"operator-id"],"token":[513],"backendUrl":[513,"backend-url"],"unseenCount":[514,"unseen-count"],"clientStylingUrl":[513,"client-styling-url"],"notificationAction":[513,"notification-action"],"clientStyling":[1537,"client-styling"],"notifications":[32],"isLoading":[32],"showMarkAll":[32]},[[8,"messageDeleted","messageDeteledHandler"],[8,"newNotification","newNotificationHandler"]]],[0,"nuts-notification",{"badge":[513],"content":[513],"date":[513],"showSettings":[516,"show-settings"],"read":[516],"seen":[516],"language":[513],"userId":[513,"user-id"],"messageId":[513,"message-id"],"operatorId":[513,"operator-id"],"token":[513],"backendUrl":[513,"backend-url"],"redirectUrl":[513,"redirect-url"],"notificationAction":[513,"notification-action"],"clientStylingUrl":[513,"client-styling-url"],"clientStyling":[1537,"client-styling"],"showSettingsModal":[32],"messageSeen":[32],"messageRead":[32]},[[8,"allNotificationsRead","allNotificationsReadHandler"],[8,"settingsOpened","settingsOpenedHandler"]]]]]], options);
17
+ return index.bootstrapLazy([["nuts-inbox-widget_3.cjs",[[1,"nuts-inbox-widget",{"backendUrl":[513,"backend-url"],"socketUrl":[513,"socket-url"],"userId":[513,"user-id"],"sessionId":[513,"session-id"],"operatorId":[513,"operator-id"],"deviceId":[513,"device-id"],"language":[513],"environment":[513],"applicationIdentifier":[513,"application-identifier"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"bellIconPosition":[513,"bell-icon-position"],"notificationAction":[513,"notification-action"],"translationUrl":[513,"translation-url"],"isLoading":[32],"popoverVisible":[32],"unseenCount":[32]}],[0,"nuts-popover",{"language":[513],"userId":[513,"user-id"],"operatorId":[513,"operator-id"],"token":[513],"backendUrl":[513,"backend-url"],"unseenCount":[514,"unseen-count"],"clientStylingUrl":[513,"client-styling-url"],"notificationAction":[513,"notification-action"],"clientStyling":[1537,"client-styling"],"translationUrl":[513,"translation-url"],"notifications":[32],"isLoading":[32],"showMarkAll":[32]},[[8,"messageDeleted","messageDeteledHandler"],[8,"newNotification","newNotificationHandler"]]],[0,"nuts-notification",{"badge":[513],"content":[513],"date":[513],"showSettings":[516,"show-settings"],"read":[516],"seen":[516],"language":[513],"userId":[513,"user-id"],"messageId":[513,"message-id"],"operatorId":[513,"operator-id"],"token":[513],"backendUrl":[513,"backend-url"],"redirectUrl":[513,"redirect-url"],"notificationAction":[513,"notification-action"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"showSettingsModal":[32],"messageSeen":[32],"messageRead":[32]},[[8,"allNotificationsRead","allNotificationsReadHandler"],[8,"settingsOpened","settingsOpenedHandler"]]]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-8aa58524.js');
3
+ const index = require('./index-84dbe58e.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["nuts-inbox-widget_3.cjs",[[1,"nuts-inbox-widget",{"backendUrl":[513,"backend-url"],"socketUrl":[513,"socket-url"],"userId":[513,"user-id"],"sessionId":[513,"session-id"],"operatorId":[513,"operator-id"],"deviceId":[513,"device-id"],"language":[513],"environment":[513],"applicationIdentifier":[513,"application-identifier"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"bellIconPosition":[513,"bell-icon-position"],"notificationAction":[513,"notification-action"],"isLoading":[32],"popoverVisible":[32],"unseenCount":[32]}],[0,"nuts-popover",{"language":[513],"userId":[513,"user-id"],"operatorId":[513,"operator-id"],"token":[513],"backendUrl":[513,"backend-url"],"unseenCount":[514,"unseen-count"],"clientStylingUrl":[513,"client-styling-url"],"notificationAction":[513,"notification-action"],"clientStyling":[1537,"client-styling"],"notifications":[32],"isLoading":[32],"showMarkAll":[32]},[[8,"messageDeleted","messageDeteledHandler"],[8,"newNotification","newNotificationHandler"]]],[0,"nuts-notification",{"badge":[513],"content":[513],"date":[513],"showSettings":[516,"show-settings"],"read":[516],"seen":[516],"language":[513],"userId":[513,"user-id"],"messageId":[513,"message-id"],"operatorId":[513,"operator-id"],"token":[513],"backendUrl":[513,"backend-url"],"redirectUrl":[513,"redirect-url"],"notificationAction":[513,"notification-action"],"clientStylingUrl":[513,"client-styling-url"],"clientStyling":[1537,"client-styling"],"showSettingsModal":[32],"messageSeen":[32],"messageRead":[32]},[[8,"allNotificationsRead","allNotificationsReadHandler"],[8,"settingsOpened","settingsOpenedHandler"]]]]]], options);
18
+ return index.bootstrapLazy([["nuts-inbox-widget_3.cjs",[[1,"nuts-inbox-widget",{"backendUrl":[513,"backend-url"],"socketUrl":[513,"socket-url"],"userId":[513,"user-id"],"sessionId":[513,"session-id"],"operatorId":[513,"operator-id"],"deviceId":[513,"device-id"],"language":[513],"environment":[513],"applicationIdentifier":[513,"application-identifier"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"bellIconPosition":[513,"bell-icon-position"],"notificationAction":[513,"notification-action"],"translationUrl":[513,"translation-url"],"isLoading":[32],"popoverVisible":[32],"unseenCount":[32]}],[0,"nuts-popover",{"language":[513],"userId":[513,"user-id"],"operatorId":[513,"operator-id"],"token":[513],"backendUrl":[513,"backend-url"],"unseenCount":[514,"unseen-count"],"clientStylingUrl":[513,"client-styling-url"],"notificationAction":[513,"notification-action"],"clientStyling":[1537,"client-styling"],"translationUrl":[513,"translation-url"],"notifications":[32],"isLoading":[32],"showMarkAll":[32]},[[8,"messageDeleted","messageDeteledHandler"],[8,"newNotification","newNotificationHandler"]]],[0,"nuts-notification",{"badge":[513],"content":[513],"date":[513],"showSettings":[516,"show-settings"],"read":[516],"seen":[516],"language":[513],"userId":[513,"user-id"],"messageId":[513,"message-id"],"operatorId":[513,"operator-id"],"token":[513],"backendUrl":[513,"backend-url"],"redirectUrl":[513,"redirect-url"],"notificationAction":[513,"notification-action"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"showSettingsModal":[32],"messageSeen":[32],"messageRead":[32]},[[8,"allNotificationsRead","allNotificationsReadHandler"],[8,"settingsOpened","settingsOpenedHandler"]]]]]], options);
19
19
  });
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-8aa58524.js');
5
+ const index = require('./index-84dbe58e.js');
6
6
 
7
7
  /******************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -35,6 +35,51 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
35
35
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
36
36
  };
37
37
 
38
+ const DEFAULT_LANGUAGE = 'en';
39
+ const SUPPORTED_LANGUAGES = ['hu', 'en'];
40
+ const TRANSLATIONS = {
41
+ en: {
42
+ notifications: 'Notifications',
43
+ noMessages: 'Nothing new to see here yet',
44
+ markAllAsRead: 'Mark all as read',
45
+ markAsRead: 'Mark as read',
46
+ removeMessage: 'Remove the message'
47
+ },
48
+ hu: {
49
+ notifications: 'értesítéseket',
50
+ noMessages: 'Itt még semmi újat nem látni',
51
+ markAllAsRead: 'összes megjelölése olvasottként',
52
+ markAsRead: 'Jelöld olvasottként',
53
+ removeMessage: 'Távolítsa el az üzenetet'
54
+ }
55
+ };
56
+ const translate$1 = (key, customLang, values) => {
57
+ const lang = customLang;
58
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
59
+ if (values !== undefined) {
60
+ for (const [key, value] of Object.entries(values.values)) {
61
+ const regex = new RegExp(`{${key}}`, 'g');
62
+ translation = translation.replace(regex, value);
63
+ }
64
+ }
65
+ return translation;
66
+ };
67
+ const getTranslations = (url) => {
68
+ // fetch url, get the data, replace the TRANSLATIONS content
69
+ return new Promise((resolve) => {
70
+ fetch(url)
71
+ .then((res) => res.json())
72
+ .then((data) => {
73
+ Object.keys(data).forEach((item) => {
74
+ for (let key in data[item]) {
75
+ TRANSLATIONS[item][key] = data[item][key];
76
+ }
77
+ });
78
+ resolve(true);
79
+ });
80
+ });
81
+ };
82
+
38
83
  const PACKET_TYPES = Object.create(null); // no Map = no polyfill
39
84
  PACKET_TYPES["open"] = "0";
40
85
  PACKET_TYPES["close"] = "1";
@@ -4010,6 +4055,10 @@ const NutsInboxWidget = class {
4010
4055
  * Clicking on the notification will automatically redirect you to the redirectURL attached to the notification (`default` behaviour). It can be changed to `postMessage` and instead of the redirect it will emit a postMessage with the redirectURL and the parent website can take actions
4011
4056
  */
4012
4057
  this.notificationAction = 'default';
4058
+ /**
4059
+ * Translations via URL
4060
+ */
4061
+ this.translationUrl = '';
4013
4062
  this.isLoading = true;
4014
4063
  this.popoverVisible = false;
4015
4064
  this.ssEndpoint = 'https://nts.everymatrix.com/ss';
@@ -4061,17 +4110,18 @@ const NutsInboxWidget = class {
4061
4110
  }
4062
4111
  }
4063
4112
  callSS() {
4064
- const url = new URL(`${this.ssEndpoint}/v1/${this.operatorId}/subscribers/${this.userId}`);
4065
- if (this.deviceId) {
4066
- url.searchParams.append('deviceToken', this.deviceId);
4067
- }
4068
- url.searchParams.append('language', this.language);
4113
+ const url = new URL(`${this.ssEndpoint}/v1/${this.operatorId}/subscribers/${this.userId}/initialize`);
4069
4114
  const headers = new Headers();
4070
4115
  headers.append('authorization', this.sessionId);
4071
4116
  headers.append('Content-Type', 'application/json');
4117
+ const body = {
4118
+ deviceId: this.deviceId,
4119
+ language: this.language
4120
+ };
4072
4121
  const options = {
4073
- method: 'GET',
4122
+ method: 'POST',
4074
4123
  headers,
4124
+ body: JSON.stringify(body)
4075
4125
  };
4076
4126
  fetch(url.href, options)
4077
4127
  .then((res) => {
@@ -4089,6 +4139,7 @@ const NutsInboxWidget = class {
4089
4139
  setupSocket() {
4090
4140
  if (this.token) {
4091
4141
  this.socketRef = lookup(this.socketUrl, {
4142
+ reconnection: true,
4092
4143
  reconnectionDelayMax: 10000,
4093
4144
  transports: ['websocket'],
4094
4145
  auth: {
@@ -4098,11 +4149,15 @@ const NutsInboxWidget = class {
4098
4149
  this.socketRef.on('connect_error', (error) => {
4099
4150
  console.error('WebSocket error', error);
4100
4151
  });
4152
+ this.socketRef.on('reconnect_attempt', (attemptNumber) => {
4153
+ console.log('Reconnect attempt', attemptNumber);
4154
+ });
4101
4155
  this.socketRef.on('notification_received', (data) => {
4102
4156
  this.newNotification.emit(data.message);
4103
4157
  });
4104
4158
  this.socketRef.on('unseen_count_changed', (data) => {
4105
4159
  this.unseenCount = data.unseenCount;
4160
+ this.unseenCount > 0 && window.postMessage({ type: 'nuts-new-notifications', value: this.unseenCount }, window.location.href);
4106
4161
  });
4107
4162
  }
4108
4163
  }
@@ -4164,6 +4219,17 @@ const NutsInboxWidget = class {
4164
4219
  this.setClientStylingURL();
4165
4220
  }
4166
4221
  }
4222
+ handleNewTranslations() {
4223
+ this.isLoading = true;
4224
+ getTranslations(this.translationUrl).then(() => {
4225
+ this.isLoading = false;
4226
+ });
4227
+ }
4228
+ async componentWillLoad() {
4229
+ if (this.translationUrl.length > 2) {
4230
+ await getTranslations(this.translationUrl);
4231
+ }
4232
+ }
4167
4233
  componentDidRender() {
4168
4234
  this.positionIcon();
4169
4235
  }
@@ -4171,14 +4237,15 @@ const NutsInboxWidget = class {
4171
4237
  return (index.h("div", { onClick: () => this.togglePopover(), class: "BellIcon" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "32", height: "32", fill: "currentColor", class: "bi bi-bell", viewBox: "0 0 16 16" }, " ", index.h("path", { d: "M8 16a2 2 0 0 0 2-2H6a2 2 0 0 0 2 2zM8 1.918l-.797.161A4.002 4.002 0 0 0 4 6c0 .628-.134 2.197-.459 3.742-.16.767-.376 1.566-.663 2.258h10.244c-.287-.692-.502-1.49-.663-2.258C12.134 8.197 12 6.628 12 6a4.002 4.002 0 0 0-3.203-3.92L8 1.917zM14.22 12c.223.447.481.801.78 1H1c.299-.199.557-.553.78-1C2.68 10.2 3 6.88 3 6c0-2.42 1.72-4.44 4.005-4.901a1 1 0 1 1 1.99 0A5.002 5.002 0 0 1 13 6c0 .88.32 4.2 1.22 6z" }), " "), this.unseenCount > 0 ? index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", class: "nc-bell-button-dot css-0 css-1eg2znq" }, index.h("rect", { x: "1.5", y: "1.5", width: "13", height: "13", rx: "6.5", fill: "url(#paint0_linear_1722_2699)", stroke: "#1E1E26", "stroke-width": "3" }), index.h("defs", null, index.h("linearGradient", { id: "paint0_linear_1722_2699", x1: "8", y1: "13", x2: "8", y2: "3", gradientUnits: "userSpaceOnUse" }, index.h("stop", { "stop-color": "#FF512F" }), index.h("stop", { offset: "1", "stop-color": "#DD2476" })))) : ''));
4172
4238
  }
4173
4239
  render() {
4174
- return (index.h("div", { ref: el => this.stylingContainer = el, class: "Wrapper" }, index.h("div", { ref: el => this.bellIconRef = el, class: "BellIconWrapper" }, !this.isLoading && this.renderBellIcon()), this.popoverVisible && index.h("nuts-popover", { "notification-action": this.notificationAction, "unseen-count": this.unseenCount, token: this.token, "backend-url": this.backendUrl, "operator-id": this.operatorId, "user-id": this.userId, language: this.language, "client-styling": this.clientStyling })));
4240
+ return (index.h("div", { ref: el => this.stylingContainer = el, class: "Wrapper" }, index.h("div", { ref: el => this.bellIconRef = el, class: "BellIconWrapper" }, !this.isLoading && this.renderBellIcon()), this.popoverVisible && index.h("nuts-popover", { "notification-action": this.notificationAction, "unseen-count": this.unseenCount, token: this.token, "backend-url": this.backendUrl, "operator-id": this.operatorId, "user-id": this.userId, language: this.language, "client-styling": this.clientStyling, "translation-url": this.translationUrl })));
4175
4241
  }
4176
4242
  static get watchers() { return {
4177
4243
  "userId": ["paramChangeHandler", "initializeHandler"],
4178
4244
  "sessionId": ["paramChangeHandler"],
4179
4245
  "operatorId": ["paramChangeHandler", "initializeHandler"],
4180
4246
  "deviceId": ["paramChangeHandler"],
4181
- "applicationIdentifier": ["initializeHandler"]
4247
+ "applicationIdentifier": ["initializeHandler"],
4248
+ "translationUrl": ["handleNewTranslations"]
4182
4249
  }; }
4183
4250
  };
4184
4251
  __decorate([
@@ -5361,29 +5428,6 @@ function formatDistanceToNow(dirtyDate, options) {
5361
5428
  return formatDistance$1i(dirtyDate, Date.now(), options);
5362
5429
  }
5363
5430
 
5364
- const DEFAULT_LANGUAGE = 'en';
5365
- const SUPPORTED_LANGUAGES = ['hu', 'en'];
5366
- const TRANSLATIONS = {
5367
- en: {
5368
- notifications: 'Notifications',
5369
- noMessages: 'Nothing new to see here yet',
5370
- markAllAsRead: 'Mark all as read',
5371
- markAsRead: 'Mark as read',
5372
- removeMessage: 'Remove the message'
5373
- },
5374
- hu: {
5375
- notifications: 'értesítéseket',
5376
- noMessages: 'Itt még semmi újat nem látni',
5377
- markAllAsRead: 'összes megjelölése olvasottként',
5378
- markAsRead: 'Jelöld olvasottként',
5379
- removeMessage: 'Távolítsa el az üzenetet'
5380
- }
5381
- };
5382
- const translate$1 = (key, customLang) => {
5383
- const lang = customLang;
5384
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
5385
- };
5386
-
5387
5431
  var formatDistanceLocale$1g = {
5388
5432
  lessThanXSeconds: {
5389
5433
  one: "minder as 'n sekonde",
@@ -39832,8 +39876,91 @@ const dateFnsLocales = /*#__PURE__*/Object.freeze({
39832
39876
  zhTW: locale
39833
39877
  });
39834
39878
 
39835
- const nutsNotificationCss = ":host{display:block}p{display:block;margin-block-start:0em;margin-block-end:0em;margin-inline-start:0px;margin-inline-end:0px}.NotificationContainer{animation:show 600ms 100ms cubic-bezier(0.38, 0.97, 0.56, 0.76) forwards;opacity:0;transform-origin:top center;padding:15px;position:relative;display:flex;line-height:20px;justify-content:flex-start;align-items:center;border-radius:7px;margin:10px 15px;color:white;background:#23232b;font-weight:400;font-size:14px}@keyframes show{100%{opacity:1;transform:none}}.NotificationContainer .AvatarContainer{margin-right:10px;width:40px;min-width:40px;height:40px;border-radius:50%;display:flex;justify-content:center;align-items:center;font-size:40px;border:1px solid #525266;overflow:hidden}.NotificationContainer .AvatarContainer .Avatar{box-sizing:border-box;position:relative;display:block;user-select:none;overflow:hidden;width:38px;min-width:38px;height:38px;border-radius:32px;text-decoration:none;border:0px;background-color:transparent;padding:0px}.NotificationContainer .AvatarContainer .Avatar .AvatarImage{object-fit:cover;width:100%;height:100%;display:block}.NotificationContainer .ContentContainer{display:flex;flex-direction:column}.NotificationContainer .Date{min-width:55px;font-size:12px;font-weight:400;opacity:0.5;line-height:14.4px;color:#525266}.NotificationContainer .Settings{opacity:0;margin-left:auto;cursor:pointer}.NotificationContainer:hover .Settings{opacity:0.5}.Unseen::before{content:\"\";position:absolute;inset:0px;width:5px;border-radius:7px 0px 0px 7px;background:linear-gradient(0deg, #ff512f 0%, #dd2476 100%)}.Unseen:hover .UnseenButton{opacity:0;width:0px}.SettingsDropdown{z-index:999;position:absolute;background:#292933;box-shadow:rgba(0, 0, 0, 0.2) 0px 5px 20px;border-radius:7px;padding:4px;border:none;transition-property:opacity;transition-duration:150ms;transition-timing-function:ease;opacity:1;width:max-content;display:flex;flex-direction:column;margin-left:195px;margin-top:-30px}.SettingsDropdown svg{margin-right:10px}.SettingsDropdown button{font-family:inherit;border:0px;background-color:transparent;outline:0px;width:100%;text-align:left;text-decoration:none;box-sizing:border-box;padding:10px 12px;cursor:pointer;border-radius:7px;display:flex;align-items:center;color:white;font-weight:400;font-size:14px}.SettingsDropdown button:hover{background:#3d3d4d;transition:300ms}";
39879
+ // This icon file is generated automatically.
39880
+ var CheckCircleFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" } }] }, "name": "check-circle", "theme": "filled" };
39881
+
39882
+ // This icon file is generated automatically.
39883
+ var CloseCircleFilled = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z" } }] }, "name": "close-circle", "theme": "filled" };
39884
+
39885
+ // This icon file is generated automatically.
39886
+ var InfoCircleFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, "name": "info-circle", "theme": "filled" };
39887
+
39888
+ // This icon file is generated automatically.
39889
+ var QuestionCircleFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 708c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm62.9-219.5a48.3 48.3 0 00-30.9 44.8V620c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-21.5c0-23.1 6.7-45.9 19.9-64.9 12.9-18.6 30.9-32.8 52.1-40.9 34-13.1 56-41.6 56-72.7 0-44.1-43.1-80-96-80s-96 35.9-96 80v7.6c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V420c0-39.3 17.2-76 48.4-103.3C430.4 290.4 470 276 512 276s81.6 14.5 111.6 40.7C654.8 344 672 380.7 672 420c0 57.8-38.1 109.8-97.1 132.5z" } }] }, "name": "question-circle", "theme": "filled" };
39890
+
39891
+ // This icon file is generated automatically.
39892
+ var UpCircleFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm178 555h-46.9c-10.2 0-19.9-4.9-25.9-13.2L512 460.4 406.8 605.8c-6 8.3-15.6 13.2-25.9 13.2H334c-6.5 0-10.3-7.4-6.5-12.7l178-246c3.2-4.4 9.7-4.4 12.9 0l178 246c3.9 5.3.1 12.7-6.4 12.7z" } }] }, "name": "up-circle", "theme": "filled" };
39893
+
39894
+ // This icon file is generated automatically.
39895
+ var WarningFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, "name": "warning", "theme": "filled" };
39896
+
39897
+ var __assign = (undefined && undefined.__assign) || function () {
39898
+ __assign = Object.assign || function(t) {
39899
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
39900
+ s = arguments[i];
39901
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
39902
+ t[p] = s[p];
39903
+ }
39904
+ return t;
39905
+ };
39906
+ return __assign.apply(this, arguments);
39907
+ };
39908
+ var defaultColors = {
39909
+ primaryColor: '#333',
39910
+ secondaryColor: '#E6E6E6'
39911
+ };
39912
+ function renderIconDefinitionToSVGElement(icond, options) {
39913
+ if (options === void 0) { options = {}; }
39914
+ if (typeof icond.icon === 'function') {
39915
+ // two-tone
39916
+ var placeholders = options.placeholders || defaultColors;
39917
+ return renderAbstractNodeToSVGElement(icond.icon(placeholders.primaryColor, placeholders.secondaryColor), options);
39918
+ }
39919
+ // fill, outline
39920
+ return renderAbstractNodeToSVGElement(icond.icon, options);
39921
+ }
39922
+ function renderAbstractNodeToSVGElement(node, options) {
39923
+ var targetAttrs = node.tag === 'svg'
39924
+ ? __assign(__assign({}, node.attrs), (options.extraSVGAttrs || {})) : node.attrs;
39925
+ var attrs = Object.keys(targetAttrs).reduce(function (acc, nextKey) {
39926
+ var key = nextKey;
39927
+ var value = targetAttrs[key];
39928
+ var token = "".concat(key, "=\"").concat(value, "\"");
39929
+ acc.push(token);
39930
+ return acc;
39931
+ }, []);
39932
+ var attrsToken = attrs.length ? ' ' + attrs.join(' ') : '';
39933
+ var children = (node.children || [])
39934
+ .map(function (child) { return renderAbstractNodeToSVGElement(child, options); })
39935
+ .join('');
39936
+ if (children && children.length) {
39937
+ return "<".concat(node.tag).concat(attrsToken, ">").concat(children, "</").concat(node.tag, ">");
39938
+ }
39939
+ return "<".concat(node.tag).concat(attrsToken, " />");
39940
+ }
39941
+
39942
+ const nutsNotificationCss = ":host{display:block}p{display:block;margin-block-start:0em;margin-block-end:0em;margin-inline-start:0px;margin-inline-end:0px}.NotificationContainer{animation:show 600ms 100ms cubic-bezier(0.38, 0.97, 0.56, 0.76) forwards;opacity:0;transform-origin:top center;padding:15px;position:relative;display:flex;line-height:20px;justify-content:flex-start;align-items:center;border-radius:7px;margin:10px 15px;color:var(--emfe-w-color-white, white);background:var(--emfe-w-color-gray-400, #23232b);font-weight:400;font-size:14px}@keyframes show{100%{opacity:1;transform:none}}.NotificationContainer .AvatarContainer{margin-right:10px;width:40px;min-width:40px;height:40px;border-radius:50%;display:flex;justify-content:center;align-items:center;font-size:40px;border:1px solid var(--emfe-w-color-gray-200, #525266);overflow:hidden}.NotificationContainer .AvatarContainer .Avatar{box-sizing:border-box;position:relative;display:flex;user-select:none;overflow:hidden;width:38px;min-width:38px;height:38px;border-radius:32px;text-decoration:none;border:0px;background-color:transparent;padding:0px;justify-content:center;align-items:center}.NotificationContainer .AvatarContainer .Avatar .AvatarImage{object-fit:cover;width:100%;height:100%;display:block}.NotificationContainer .AvatarContainer .Avatar svg{object-fit:cover;display:block}.NotificationContainer .ContentContainer{display:flex;flex-direction:column}.NotificationContainer .Date{min-width:55px;font-size:12px;font-weight:400;opacity:0.5;line-height:14.4px;color:var(--emfe-w-color-gray-200, #525266)}.NotificationContainer .Settings{opacity:0;margin-left:auto;cursor:pointer}.NotificationContainer:hover .Settings{opacity:0.5}.Unseen::before{content:\"\";position:absolute;inset:0px;width:5px;border-radius:7px 0px 0px 7px;background:linear-gradient(0deg, var(--emfe-w-color-secondary-20, #ff512f) 0%, var(--emfe-w-color-secondary, #dd2476) 100%)}.Unseen:hover .UnseenButton{opacity:0;width:0px}.SettingsDropdown{z-index:999;position:absolute;background:var(--emfe-w-color-gray-400, #292933);box-shadow:var(--emfe-w-color-gray-20, rgba(0, 0, 0, 0.2)) 0px 5px 20px;border-radius:7px;padding:4px;border:none;transition-property:opacity;transition-duration:150ms;transition-timing-function:ease;opacity:1;width:max-content;display:flex;flex-direction:column;margin-left:195px;margin-top:-30px}.SettingsDropdown svg{margin-right:10px}.SettingsDropdown button{font-family:inherit;border:0px;background-color:transparent;outline:0px;width:100%;text-align:left;text-decoration:none;box-sizing:border-box;padding:10px 12px;cursor:pointer;border-radius:7px;display:flex;align-items:center;color:var(--emfe-w-color-white, white);font-weight:400;font-size:14px}.SettingsDropdown button:hover{background:var(--emfe-w-color-gray-300, #3d3d4d);transition:300ms}";
39836
39943
 
39944
+ const systemIcons = {
39945
+ warning: {
39946
+ icon: renderIconDefinitionToSVGElement(WarningFilled, { extraSVGAttrs: { width: '20px', height: '20px', fill: '#FFF000' } }),
39947
+ },
39948
+ info: {
39949
+ icon: renderIconDefinitionToSVGElement(InfoCircleFilled, { extraSVGAttrs: { width: '20px', height: '20px', fill: '#0000FF' } }),
39950
+ },
39951
+ up: {
39952
+ icon: renderIconDefinitionToSVGElement(UpCircleFilled, { extraSVGAttrs: { width: '20px', height: '20px', fill: '#A1A1B2' } }),
39953
+ },
39954
+ question: {
39955
+ icon: renderIconDefinitionToSVGElement(QuestionCircleFilled, { extraSVGAttrs: { width: '20px', height: '20px', fill: '#A1A1B2' } }),
39956
+ },
39957
+ success: {
39958
+ icon: renderIconDefinitionToSVGElement(CheckCircleFilled, { extraSVGAttrs: { width: '20px', height: '20px', fill: '#4D9980' } }),
39959
+ },
39960
+ error: {
39961
+ icon: renderIconDefinitionToSVGElement(CloseCircleFilled, { extraSVGAttrs: { width: '20px', height: '20px', fill: '#E54545' } }),
39962
+ },
39963
+ };
39837
39964
  const dateFnsLocale = (lang) => {
39838
39965
  return lang in dateFnsLocales ? dateFnsLocales[lang] : locale$1s;
39839
39966
  };
@@ -39842,6 +39969,13 @@ const NutsNotification = class {
39842
39969
  index.registerInstance(this, hostRef);
39843
39970
  this.messageDeteled = index.createEvent(this, "messageDeleted", 7);
39844
39971
  this.settingsOpened = index.createEvent(this, "settingsOpened", 7);
39972
+ /**
39973
+ * Translations via URL
39974
+ */
39975
+ this.translationUrl = '';
39976
+ /**
39977
+ * Clienty styling passed as a string
39978
+ */
39845
39979
  this.clientStyling = '';
39846
39980
  this.showSettingsModal = false;
39847
39981
  this.messageSeen = false;
@@ -39874,6 +40008,14 @@ const NutsNotification = class {
39874
40008
  this.showSettingsModal = false;
39875
40009
  }
39876
40010
  }
40011
+ handleNewTranslations() {
40012
+ getTranslations(this.translationUrl);
40013
+ }
40014
+ async componentWillLoad() {
40015
+ if (this.translationUrl.length > 2) {
40016
+ await getTranslations(this.translationUrl);
40017
+ }
40018
+ }
39877
40019
  connectedCallback() {
39878
40020
  this.messageSeen = this.seen;
39879
40021
  this.messageRead = this.read;
@@ -39945,18 +40087,31 @@ const NutsNotification = class {
39945
40087
  }
39946
40088
  }
39947
40089
  render() {
39948
- return (index.h("div", null, index.h("div", { class: 'NotificationContainer' + (this.messageSeen ? '' : ' Unseen'), ref: el => this.stylingContainer = el, onClick: () => this.notificationActionHandler() }, this.badge ? index.h("div", { class: "AvatarContainer" }, index.h("div", { class: "Avatar" }, index.h("img", { class: "AvatarImage", src: this.badge }))) : '', index.h("div", { class: "ContentContainer" }, index.h("p", null, this.content), index.h("p", { class: "Date" }, formatDistanceToNow(new Date(this.date), { addSuffix: true, locale: dateFnsLocale(this.language) }))), index.h("div", { class: "Settings", onClick: (e) => this.toggleSettingsModal(e), ref: el => this.settingsButtonRef = el }, index.h("svg", { width: "30", height: "30", viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M20.625 15.5C20.625 16.5547 21.4453 17.375 22.5 17.375C23.5156 17.375 24.375 16.5547 24.375 15.5C24.375 14.4844 23.5156 13.625 22.5 13.625C21.4453 13.625 20.625 14.4844 20.625 15.5ZM9.375 15.5C9.375 14.4844 8.51562 13.625 7.5 13.625C6.44531 13.625 5.625 14.4844 5.625 15.5C5.625 16.5547 6.44531 17.375 7.5 17.375C8.51562 17.375 9.375 16.5547 9.375 15.5ZM16.875 15.5C16.875 14.4844 16.0156 13.625 15 13.625C13.9453 13.625 13.125 14.4844 13.125 15.5C13.125 16.5547 13.9453 17.375 15 17.375C16.0156 17.375 16.875 16.5547 16.875 15.5Z", fill: "currentColor" }))), this.messageSeen ? '' : index.h("div", { class: "UnseenButton" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "10px", height: "10px", viewBox: "0 0 16 16", fill: "none" }, index.h("rect", { x: "1.5", y: "1.5", width: "13", height: "13", rx: "6.5", fill: "url(#paint0_linear_1722_2699)", stroke: "#1E1E26", "stroke-width": "3" }), index.h("defs", null, index.h("linearGradient", { id: "paint0_linear_1722_2699", x1: "8", y1: "13", x2: "8", y2: "3", gradientUnits: "userSpaceOnUse" }, index.h("stop", { "stop-color": "#FF512F" }), index.h("stop", { offset: "1", "stop-color": "#DD2476" })))))), this.showSettingsModal ? index.h("div", { class: "SettingsDropdown", ref: el => this.settingsModalRef = el }, index.h("button", { onClick: () => this.markAsRead(this.messageId) }, index.h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M14.9434 5.17969C14.2109 4.59375 13.625 4.125 10.1387 1.60547C9.64062 1.25391 8.67383 0.375 8 0.375V0.404297C7.9707 0.404297 7.9707 0.375 7.9707 0.375C7.29688 0.375 6.33008 1.25391 5.83203 1.60547C2.3457 4.125 1.75977 4.59375 1.02734 5.17969C0.675781 5.44336 0.5 5.85352 0.5 6.26367V13.9688C0.5 14.7598 1.11523 15.375 1.90625 15.375H14.0938C14.8555 15.375 15.5 14.7598 15.5 13.9688V6.26367C15.5 5.85352 15.2949 5.44336 14.9434 5.17969ZM9.37695 11.1562C8.9668 11.4785 8.46875 11.6543 8 11.6543C7.50195 11.6543 7.00391 11.4785 6.59375 11.1562L2.375 7.8457V6.49805C2.99023 6 3.72266 5.44336 6.94531 3.12891C7.0332 3.04102 7.15039 2.95312 7.26758 2.86523C7.41406 2.74805 7.73633 2.48438 8 2.33789C8.23438 2.48438 8.55664 2.74805 8.70312 2.86523C8.82031 2.95312 8.9375 3.04102 9.02539 3.12891C12.2188 5.44336 12.9805 6 13.625 6.49805V7.8457L9.37695 11.1562Z", fill: "currentColor" })), translate$1('markAsRead', this.language)), index.h("button", { onClick: () => this.deleteMessage(this.messageId) }, index.h("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M4.375 15.4375C4.375 16.1758 4.94922 16.75 5.6875 16.75H13.5625C14.2734 16.75 14.875 16.1758 14.875 15.4375V6.25H4.375V15.4375ZM11.8125 8.4375C11.8125 8.21875 12.0039 8 12.25 8C12.4688 8 12.6875 8.21875 12.6875 8.4375V14.5625C12.6875 14.8086 12.4688 15 12.25 15C12.0039 15 11.8125 14.8086 11.8125 14.5625V8.4375ZM9.1875 8.4375C9.1875 8.21875 9.37891 8 9.625 8C9.84375 8 10.0625 8.21875 10.0625 8.4375V14.5625C10.0625 14.8086 9.84375 15 9.625 15C9.37891 15 9.1875 14.8086 9.1875 14.5625V8.4375ZM6.5625 8.4375C6.5625 8.21875 6.75391 8 7 8C7.21875 8 7.4375 8.21875 7.4375 8.4375V14.5625C7.4375 14.8086 7.21875 15 7 15C6.75391 15 6.5625 14.8086 6.5625 14.5625V8.4375ZM15.3125 3.625H12.25L11.9219 2.99609C11.8398 2.85938 11.7031 2.75 11.5391 2.75H7.68359C7.51953 2.75 7.38281 2.85938 7.30078 2.99609L7 3.625H3.9375C3.69141 3.625 3.5 3.84375 3.5 4.0625V4.9375C3.5 5.18359 3.69141 5.375 3.9375 5.375H15.3125C15.5312 5.375 15.75 5.18359 15.75 4.9375V4.0625C15.75 3.84375 15.5312 3.625 15.3125 3.625Z", fill: "currentColor" })), translate$1('removeMessage', this.language))) : ''));
40090
+ var _a;
40091
+ return (index.h("div", null, index.h("div", { class: 'NotificationContainer' + (this.messageSeen ? '' : ' Unseen'), ref: el => this.stylingContainer = el, onClick: () => this.notificationActionHandler() }, this.badge ? index.h("div", { class: "AvatarContainer" }, index.h("div", { class: "Avatar" }, ((_a = systemIcons[this.badge]) === null || _a === void 0 ? void 0 : _a.icon) ?
40092
+ index.h("div", { innerHTML: systemIcons['warning'].icon }) :
40093
+ index.h("img", { class: "AvatarImage", src: this.badge }))) : '', index.h("div", { class: "ContentContainer" }, index.h("p", null, this.content), index.h("p", { class: "Date" }, formatDistanceToNow(new Date(this.date), { addSuffix: true, locale: dateFnsLocale(this.language) }))), index.h("div", { class: "Settings", onClick: (e) => this.toggleSettingsModal(e), ref: el => this.settingsButtonRef = el }, index.h("svg", { width: "30", height: "30", viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M20.625 15.5C20.625 16.5547 21.4453 17.375 22.5 17.375C23.5156 17.375 24.375 16.5547 24.375 15.5C24.375 14.4844 23.5156 13.625 22.5 13.625C21.4453 13.625 20.625 14.4844 20.625 15.5ZM9.375 15.5C9.375 14.4844 8.51562 13.625 7.5 13.625C6.44531 13.625 5.625 14.4844 5.625 15.5C5.625 16.5547 6.44531 17.375 7.5 17.375C8.51562 17.375 9.375 16.5547 9.375 15.5ZM16.875 15.5C16.875 14.4844 16.0156 13.625 15 13.625C13.9453 13.625 13.125 14.4844 13.125 15.5C13.125 16.5547 13.9453 17.375 15 17.375C16.0156 17.375 16.875 16.5547 16.875 15.5Z", fill: "currentColor" }))), this.messageSeen ? '' : index.h("div", { class: "UnseenButton" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "10px", height: "10px", viewBox: "0 0 16 16", fill: "none" }, index.h("rect", { x: "1.5", y: "1.5", width: "13", height: "13", rx: "6.5", fill: "url(#paint0_linear_1722_2699)", stroke: "#1E1E26", "stroke-width": "3" }), index.h("defs", null, index.h("linearGradient", { id: "paint0_linear_1722_2699", x1: "8", y1: "13", x2: "8", y2: "3", gradientUnits: "userSpaceOnUse" }, index.h("stop", { "stop-color": "#FF512F" }), index.h("stop", { offset: "1", "stop-color": "#DD2476" })))))), this.showSettingsModal ? index.h("div", { class: "SettingsDropdown", ref: el => this.settingsModalRef = el }, index.h("button", { onClick: () => this.markAsRead(this.messageId) }, index.h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M14.9434 5.17969C14.2109 4.59375 13.625 4.125 10.1387 1.60547C9.64062 1.25391 8.67383 0.375 8 0.375V0.404297C7.9707 0.404297 7.9707 0.375 7.9707 0.375C7.29688 0.375 6.33008 1.25391 5.83203 1.60547C2.3457 4.125 1.75977 4.59375 1.02734 5.17969C0.675781 5.44336 0.5 5.85352 0.5 6.26367V13.9688C0.5 14.7598 1.11523 15.375 1.90625 15.375H14.0938C14.8555 15.375 15.5 14.7598 15.5 13.9688V6.26367C15.5 5.85352 15.2949 5.44336 14.9434 5.17969ZM9.37695 11.1562C8.9668 11.4785 8.46875 11.6543 8 11.6543C7.50195 11.6543 7.00391 11.4785 6.59375 11.1562L2.375 7.8457V6.49805C2.99023 6 3.72266 5.44336 6.94531 3.12891C7.0332 3.04102 7.15039 2.95312 7.26758 2.86523C7.41406 2.74805 7.73633 2.48438 8 2.33789C8.23438 2.48438 8.55664 2.74805 8.70312 2.86523C8.82031 2.95312 8.9375 3.04102 9.02539 3.12891C12.2188 5.44336 12.9805 6 13.625 6.49805V7.8457L9.37695 11.1562Z", fill: "currentColor" })), translate$1('markAsRead', this.language)), index.h("button", { onClick: () => this.deleteMessage(this.messageId) }, index.h("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M4.375 15.4375C4.375 16.1758 4.94922 16.75 5.6875 16.75H13.5625C14.2734 16.75 14.875 16.1758 14.875 15.4375V6.25H4.375V15.4375ZM11.8125 8.4375C11.8125 8.21875 12.0039 8 12.25 8C12.4688 8 12.6875 8.21875 12.6875 8.4375V14.5625C12.6875 14.8086 12.4688 15 12.25 15C12.0039 15 11.8125 14.8086 11.8125 14.5625V8.4375ZM9.1875 8.4375C9.1875 8.21875 9.37891 8 9.625 8C9.84375 8 10.0625 8.21875 10.0625 8.4375V14.5625C10.0625 14.8086 9.84375 15 9.625 15C9.37891 15 9.1875 14.8086 9.1875 14.5625V8.4375ZM6.5625 8.4375C6.5625 8.21875 6.75391 8 7 8C7.21875 8 7.4375 8.21875 7.4375 8.4375V14.5625C7.4375 14.8086 7.21875 15 7 15C6.75391 15 6.5625 14.8086 6.5625 14.5625V8.4375ZM15.3125 3.625H12.25L11.9219 2.99609C11.8398 2.85938 11.7031 2.75 11.5391 2.75H7.68359C7.51953 2.75 7.38281 2.85938 7.30078 2.99609L7 3.625H3.9375C3.69141 3.625 3.5 3.84375 3.5 4.0625V4.9375C3.5 5.18359 3.69141 5.375 3.9375 5.375H15.3125C15.5312 5.375 15.75 5.18359 15.75 4.9375V4.0625C15.75 3.84375 15.5312 3.625 15.3125 3.625Z", fill: "currentColor" })), translate$1('removeMessage', this.language))) : ''));
39949
40094
  }
40095
+ static get watchers() { return {
40096
+ "translationUrl": ["handleNewTranslations"]
40097
+ }; }
39950
40098
  };
39951
40099
  NutsNotification.style = nutsNotificationCss;
39952
40100
 
39953
- const nutsPopoverCss = ":host{display:block}.Popover{padding:15px 0px;height:auto;border-radius:7px;box-shadow:rgba(0, 0, 0, 0.2) 0px 5px 20px;background:#1e1e26;margin:0px;font-family:inherit;color:#333737;direction:ltr;width:420px;z-index:999}.Popover .Header{display:flex;justify-content:space-between;padding:0 20px 10px 20px;box-shadow:0px 5px 5px -5px rgba(0, 0, 0, 0.55)}.Popover .Header .Title{color:white;font-size:20px;font-style:normal;font-weight:700;line-height:24px;text-align:center;padding-left:10px}.Popover .Header .Title .UnseenCounter{text-decoration:none;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;text-transform:uppercase;border-radius:10px;letter-spacing:0.25px;text-overflow:ellipsis;overflow:hidden;padding:0px;margin-left:10px;width:25px;height:20px;pointer-events:none;border:none;background:linear-gradient(0deg, #ff512f 0%, #dd2476 100%);font-family:inherit;line-height:14px;color:white;font-weight:bold;font-size:12px}.Popover .Header .MarkAsRead{margin-top:5px;margin-right:10px;font-size:14px;font-style:normal;font-weight:400;line-height:17px;color:#828299;cursor:pointer;pointer-events:auto;opacity:0.5}.Popover .Header .MarkAsRead:hover{opacity:0.7;transition:250ms}.Popover .NotificationList{height:400px;overflow:auto}.Popover .NotificationList .NoMessages{display:flex;justify-content:center;flex-direction:column;align-items:center;height:100%}.Popover .NotificationList .NoMessages p{color:white;opacity:0.7}";
40101
+ const nutsPopoverCss = ":host{display:block}.Popover{padding:15px 0px;border-radius:7px;box-shadow:var(--emfe-w-color-gray-400, rgba(0, 0, 0, 0.2)) 0px 5px 20px;background:var(--emfe-w-color-gray-300, #1e1e26);margin:0px;font-family:inherit;color:var(--emfe-w-color-gray-200, #333737);direction:ltr;width:420px;z-index:999}.Popover .Header{display:flex;justify-content:space-between;padding:0 20px 10px 20px;box-shadow:var(--emfe-w-color-gray-20, rgba(0, 0, 0, 0.2)) 0px 5px 5px -5px}.Popover .Header .Title{color:var(--emfe-w-color-white, white);font-size:20px;font-style:normal;font-weight:700;line-height:24px;text-align:center;padding-left:10px}.Popover .Header .Title .UnseenCounter{text-decoration:none;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;text-transform:uppercase;border-radius:10px;letter-spacing:0.25px;text-overflow:ellipsis;overflow:hidden;padding:0px;margin-left:10px;width:25px;height:20px;pointer-events:none;border:none;background:linear-gradient(0deg, var(--emfe-w-color-secondary-20, #ff512f) 0%, var(--emfe-w-color-secondary, #dd2476) 100%);font-family:inherit;line-height:14px;color:var(--emfe-w-color-white, white);font-weight:bold;font-size:12px}.Popover .Header .MarkAsRead{margin-top:5px;margin-right:10px;font-size:14px;font-style:normal;font-weight:400;line-height:17px;color:var(--emfe-w-color-gray-150, #828299);cursor:pointer;pointer-events:auto;opacity:0.5}.Popover .Header .MarkAsRead:hover{opacity:0.7;transition:250ms}.Popover .NotificationList{height:400px;overflow:auto}.Popover .NotificationList .NoMessages{display:flex;justify-content:center;flex-direction:column;align-items:center;height:100%}.Popover .NotificationList .NoMessages p{color:var(--emfe-w-color-white, #fff);opacity:0.7}";
39954
40102
 
39955
40103
  const NutsPopover = class {
39956
40104
  constructor(hostRef) {
39957
40105
  index.registerInstance(this, hostRef);
39958
40106
  this.allNotificationsRead = index.createEvent(this, "allNotificationsRead", 7);
40107
+ /**
40108
+ * Custom styling string
40109
+ */
39959
40110
  this.clientStyling = '';
40111
+ /**
40112
+ * Translations via URL
40113
+ */
40114
+ this.translationUrl = '';
39960
40115
  this.isLoading = true;
39961
40116
  this.showMarkAll = false;
39962
40117
  this.setClientStyling = () => {
@@ -39995,6 +40150,17 @@ const NutsPopover = class {
39995
40150
  this.showMarkAll = true;
39996
40151
  }
39997
40152
  }
40153
+ handleNewTranslations() {
40154
+ this.isLoading = true;
40155
+ getTranslations(this.translationUrl).then(() => {
40156
+ this.isLoading = false;
40157
+ });
40158
+ }
40159
+ async componentWillLoad() {
40160
+ if (this.translationUrl.length > 2) {
40161
+ await getTranslations(this.translationUrl);
40162
+ }
40163
+ }
39998
40164
  getNotifications() {
39999
40165
  let url = new URL(`${this.backendUrl}/v1/widgets/notifications/feed`);
40000
40166
  const headers = new Headers();
@@ -40039,11 +40205,12 @@ const NutsPopover = class {
40039
40205
  render() {
40040
40206
  return (index.h("div", { class: "Popover", ref: el => this.stylingContainer = el }, index.h("div", { class: "Header" }, index.h("div", { class: "Title" }, translate$1('notifications', this.language), this.unseenCount > 0 ? index.h("div", { class: "UnseenCounter" }, this.unseenCount) : ''), this.showMarkAll ? index.h("div", { class: "MarkAsRead", onClick: () => this.markAllAsRead() }, translate$1('markAllAsRead', this.language)) : ''), index.h("div", { class: "NotificationList" }, !this.isLoading && (this.notifications.length > 0 ? this.notifications.map((item) => {
40041
40207
  var _a;
40042
- return (index.h("nuts-notification", { "client-styling": this.clientStyling, key: item.id, "user-id": this.userId, "operator-id": this.operatorId, content: item.content, "message-id": item.id, badge: ((_a = item.actor) === null || _a === void 0 ? void 0 : _a.data) || '', date: item.createdAt, read: item.read, seen: item.seen, language: this.language, "notification-action": this.notificationAction, token: this.token, "backend-url": this.backendUrl, "redirect-url": item.cta.data.url }));
40208
+ return (index.h("nuts-notification", { "client-styling": this.clientStyling, key: item.id, "user-id": this.userId, "operator-id": this.operatorId, content: item.content, "message-id": item.id, badge: ((_a = item.actor) === null || _a === void 0 ? void 0 : _a.data) || '', date: item.createdAt, read: item.read, seen: item.seen, language: this.language, "notification-action": this.notificationAction, token: this.token, "backend-url": this.backendUrl, "redirect-url": item.cta.data.url, "translation-url": this.translationUrl }));
40043
40209
  }) : index.h("div", { class: "NoMessages" }, index.h("svg", { width: "120", height: "108", viewBox: "0 0 120 108", fill: "none" }, index.h("circle", { cx: "11.3191", cy: "30.7872", r: "6.31915", stroke: "#3D3D4D", "stroke-width": "3.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("ellipse", { cx: "60.117", cy: "27.9787", rx: "5.96809", ry: "5.61702", stroke: "#828299", "stroke-width": "3.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("path", { d: "M79.5424 49.4934C79.5424 44.1598 77.6437 39.0446 74.2641 35.2732C70.8844 31.5017 66.3006 29.3829 61.5211 29.3829C56.7415 29.3829 52.1578 31.5017 48.7781 35.2732C45.3985 39.0446 43.4998 44.1598 43.4998 49.4934C43.4998 72.9557 34.4892 79.6592 34.4892 79.6592H88.553C88.553 79.6592 79.5424 72.9557 79.5424 49.4934Z", fill: "#292933" }), index.h("path", { d: "M68.8995 81.7552C68.1496 83.551 67.0731 85.0417 65.778 86.0779C64.4828 87.1141 63.0144 87.6595 61.5198 87.6595C60.0252 87.6595 58.5568 87.1141 57.2617 86.0779C55.9665 85.0417 54.8901 83.551 54.1401 81.7552", fill: "#292933" }), index.h("path", { d: "M81.2976 50.2203C81.2976 68.2545 87.2222 76.7327 90.2814 79.9083C90.7671 80.4126 90.3802 81.4764 89.68 81.4764C88.0927 81.4764 86.5488 81.4764 85.0422 81.4764M68.5814 82.946C67.6854 84.8068 66.3993 86.3513 64.8518 87.425C63.3044 88.4987 61.5499 89.0638 59.7641 89.0638C57.9783 89.0638 56.2239 88.4987 54.6765 87.425C53.129 86.3513 51.8429 84.8068 50.9468 82.946M79.712 42.3723C78.6394 39.8192 77.0439 37.4727 74.991 35.4861C70.953 31.5783 65.4763 29.3829 59.7656 29.3829C54.055 29.3829 48.5783 31.5783 44.5403 35.4861C43.3681 36.6205 42.345 37.8722 41.4832 39.2127C40.4958 40.7487 39.7202 42.4013 39.1747 44.1276C38.5563 46.0847 38.2337 48.1364 38.2337 50.2203C38.2337 53.2503 38.0665 56.0106 37.7737 58.5212M34.8401 70.7608C32.9874 75.4551 30.7688 78.331 29.2526 79.9055C28.767 80.4099 29.155 81.4764 29.8551 81.4764C47.1962 81.4764 59.3571 81.4764 74.1593 81.4764", stroke: "#828299", "stroke-width": "3.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("path", { d: "M55.6345 59.0737C55.1665 59.7144 54.4949 60.2462 53.6868 60.6159C52.8787 60.9855 51.9625 61.1801 51.0299 61.1801C50.0973 61.1801 49.1811 60.9855 48.373 60.6159C47.5649 60.2462 46.8933 59.7144 46.4254 59.0737", stroke: "#828299", "stroke-width": "3.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("path", { d: "M73.1877 59.0737C72.7197 59.7144 72.0481 60.2462 71.24 60.6159C70.4319 60.9855 69.5157 61.1801 68.5831 61.1801C67.6506 61.1801 66.7344 60.9855 65.9263 60.6159C65.1182 60.2462 64.4465 59.7144 63.9786 59.0737", stroke: "#828299", "stroke-width": "3.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("circle", { cx: "107.511", cy: "56.0638", r: "7.02128", stroke: "#3D3D4D", "stroke-width": "3.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("circle", { cx: "16.4252", cy: "58.1703", r: "4.21277", fill: "#3D3D4D" }), index.h("ellipse", { cx: "59.9573", cy: "104.511", rx: "25.2766", ry: "2.80851", fill: "#3D3D4D" }), index.h("path", { d: "M81.5317 18.1489H88.553L81.5317 25.1702H88.553", stroke: "#828299", "stroke-width": "3.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("path", { d: "M96.6807 2H106.51L96.6807 11.8298H106.51", stroke: "#828299", "stroke-width": "3.5", "stroke-linecap": "round", "stroke-linejoin": "round" })), index.h("p", null, translate$1('noMessages', this.language)))))));
40044
40210
  }
40045
40211
  static get watchers() { return {
40046
- "unseenCount": ["unseenCountHandler"]
40212
+ "unseenCount": ["unseenCountHandler"],
40213
+ "translationUrl": ["handleNewTranslations"]
40047
40214
  }; }
40048
40215
  };
40049
40216
  NutsPopover.style = nutsPopoverCss;
@@ -1,4 +1,5 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
+ import { getTranslations } from '../../utils/locale.utils';
2
3
  import { Component, h, Prop, State, Watch, Event } from '@stencil/core';
3
4
  import { io } from 'socket.io-client';
4
5
  import { ClickOutside } from "stencil-click-outside";
@@ -24,6 +25,10 @@ export class NutsInboxWidget {
24
25
  * Clicking on the notification will automatically redirect you to the redirectURL attached to the notification (`default` behaviour). It can be changed to `postMessage` and instead of the redirect it will emit a postMessage with the redirectURL and the parent website can take actions
25
26
  */
26
27
  this.notificationAction = 'default';
28
+ /**
29
+ * Translations via URL
30
+ */
31
+ this.translationUrl = '';
27
32
  this.isLoading = true;
28
33
  this.popoverVisible = false;
29
34
  this.ssEndpoint = 'https://nts.everymatrix.com/ss';
@@ -75,17 +80,18 @@ export class NutsInboxWidget {
75
80
  }
76
81
  }
77
82
  callSS() {
78
- const url = new URL(`${this.ssEndpoint}/v1/${this.operatorId}/subscribers/${this.userId}`);
79
- if (this.deviceId) {
80
- url.searchParams.append('deviceToken', this.deviceId);
81
- }
82
- url.searchParams.append('language', this.language);
83
+ const url = new URL(`${this.ssEndpoint}/v1/${this.operatorId}/subscribers/${this.userId}/initialize`);
83
84
  const headers = new Headers();
84
85
  headers.append('authorization', this.sessionId);
85
86
  headers.append('Content-Type', 'application/json');
87
+ const body = {
88
+ deviceId: this.deviceId,
89
+ language: this.language
90
+ };
86
91
  const options = {
87
- method: 'GET',
92
+ method: 'POST',
88
93
  headers,
94
+ body: JSON.stringify(body)
89
95
  };
90
96
  fetch(url.href, options)
91
97
  .then((res) => {
@@ -103,6 +109,7 @@ export class NutsInboxWidget {
103
109
  setupSocket() {
104
110
  if (this.token) {
105
111
  this.socketRef = io(this.socketUrl, {
112
+ reconnection: true,
106
113
  reconnectionDelayMax: 10000,
107
114
  transports: ['websocket'],
108
115
  auth: {
@@ -112,11 +119,15 @@ export class NutsInboxWidget {
112
119
  this.socketRef.on('connect_error', (error) => {
113
120
  console.error('WebSocket error', error);
114
121
  });
122
+ this.socketRef.on('reconnect_attempt', (attemptNumber) => {
123
+ console.log('Reconnect attempt', attemptNumber);
124
+ });
115
125
  this.socketRef.on('notification_received', (data) => {
116
126
  this.newNotification.emit(data.message);
117
127
  });
118
128
  this.socketRef.on('unseen_count_changed', (data) => {
119
129
  this.unseenCount = data.unseenCount;
130
+ this.unseenCount > 0 && window.postMessage({ type: 'nuts-new-notifications', value: this.unseenCount }, window.location.href);
120
131
  });
121
132
  }
122
133
  }
@@ -178,6 +189,17 @@ export class NutsInboxWidget {
178
189
  this.setClientStylingURL();
179
190
  }
180
191
  }
192
+ handleNewTranslations() {
193
+ this.isLoading = true;
194
+ getTranslations(this.translationUrl).then(() => {
195
+ this.isLoading = false;
196
+ });
197
+ }
198
+ async componentWillLoad() {
199
+ if (this.translationUrl.length > 2) {
200
+ await getTranslations(this.translationUrl);
201
+ }
202
+ }
181
203
  componentDidRender() {
182
204
  this.positionIcon();
183
205
  }
@@ -197,7 +219,7 @@ export class NutsInboxWidget {
197
219
  render() {
198
220
  return (h("div", { ref: el => this.stylingContainer = el, class: "Wrapper" },
199
221
  h("div", { ref: el => this.bellIconRef = el, class: "BellIconWrapper" }, !this.isLoading && this.renderBellIcon()),
200
- this.popoverVisible && h("nuts-popover", { "notification-action": this.notificationAction, "unseen-count": this.unseenCount, token: this.token, "backend-url": this.backendUrl, "operator-id": this.operatorId, "user-id": this.userId, language: this.language, "client-styling": this.clientStyling })));
222
+ this.popoverVisible && h("nuts-popover", { "notification-action": this.notificationAction, "unseen-count": this.unseenCount, token: this.token, "backend-url": this.backendUrl, "operator-id": this.operatorId, "user-id": this.userId, language: this.language, "client-styling": this.clientStyling, "translation-url": this.translationUrl })));
201
223
  }
202
224
  static get is() { return "nuts-inbox-widget"; }
203
225
  static get encapsulation() { return "shadow"; }
@@ -433,6 +455,24 @@ export class NutsInboxWidget {
433
455
  "attribute": "notification-action",
434
456
  "reflect": true,
435
457
  "defaultValue": "'default'"
458
+ },
459
+ "translationUrl": {
460
+ "type": "string",
461
+ "mutable": false,
462
+ "complexType": {
463
+ "original": "string",
464
+ "resolved": "string",
465
+ "references": {}
466
+ },
467
+ "required": false,
468
+ "optional": false,
469
+ "docs": {
470
+ "tags": [],
471
+ "text": "Translations via URL"
472
+ },
473
+ "attribute": "translation-url",
474
+ "reflect": true,
475
+ "defaultValue": "''"
436
476
  }
437
477
  }; }
438
478
  static get states() { return {
@@ -497,6 +537,9 @@ export class NutsInboxWidget {
497
537
  }, {
498
538
  "propName": "applicationIdentifier",
499
539
  "methodName": "initializeHandler"
540
+ }, {
541
+ "propName": "translationUrl",
542
+ "methodName": "handleNewTranslations"
500
543
  }]; }
501
544
  }
502
545
  __decorate([