@everymatrix/nuts-inbox-widget 0.0.4 → 0.0.6
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.
- package/dist/cjs/{index-305bcf58.js → index-8aa58524.js} +4 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/nuts-inbox-widget.cjs.js +2 -2
- package/dist/cjs/nuts-inbox-widget_3.cjs.entry.js +41 -8
- package/dist/collection/components/nuts-inbox-widget/nuts-inbox-widget.css +2 -1
- package/dist/collection/components/nuts-inbox-widget/nuts-inbox-widget.js +61 -5
- package/dist/collection/components/nuts-notification/nuts-notification.css +24 -24
- package/dist/collection/components/nuts-notification/nuts-notification.js +72 -25
- package/dist/collection/components/nuts-popover/nuts-popover.js +25 -8
- package/dist/components/nuts-inbox-widget.js +26 -4
- package/dist/components/nuts-notification2.js +18 -3
- package/dist/components/nuts-popover2.js +3 -2
- package/dist/esm/{index-4e49d940.js → index-5bd134e8.js} +4 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/nuts-inbox-widget.js +2 -2
- package/dist/esm/nuts-inbox-widget_3.entry.js +41 -8
- package/dist/nuts-inbox-widget/nuts-inbox-widget.esm.js +1 -1
- package/dist/nuts-inbox-widget/p-1aaf84db.js +1 -0
- package/dist/nuts-inbox-widget/p-3ef240d4.entry.js +1 -0
- package/dist/types/components/nuts-inbox-widget/nuts-inbox-widget.d.ts +12 -1
- package/dist/types/components/nuts-notification/nuts-notification.d.ts +6 -1
- package/dist/types/components/nuts-popover/nuts-popover.d.ts +2 -1
- package/dist/types/components.d.ts +22 -0
- package/package.json +1 -1
- package/dist/nuts-inbox-widget/p-ae61c868.entry.js +0 -1
- package/dist/nuts-inbox-widget/p-d5a07a94.js +0 -1
|
@@ -772,7 +772,11 @@ const postUpdateComponent = (hostRef) => {
|
|
|
772
772
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
773
773
|
const elm = hostRef.$hostElement$;
|
|
774
774
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
775
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
775
776
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
777
|
+
{
|
|
778
|
+
safeCall(instance, 'componentDidRender');
|
|
779
|
+
}
|
|
776
780
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
777
781
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
778
782
|
{
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-8aa58524.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"],"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"],"
|
|
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);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-8aa58524.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"],"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"],"
|
|
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);
|
|
19
19
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-8aa58524.js');
|
|
6
6
|
|
|
7
7
|
/******************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -3983,7 +3983,7 @@ function isExcluded(target, excudedNodes) {
|
|
|
3983
3983
|
return false;
|
|
3984
3984
|
}
|
|
3985
3985
|
|
|
3986
|
-
const nutsInboxWidgetCss = ":host{display:block;font-family:\"Roboto\", \"Arial\", sans-serif}.BellIconWrapper{width:40px;
|
|
3986
|
+
const nutsInboxWidgetCss = ":host{display:block;font-family:\"Roboto\", \"Arial\", sans-serif}.BellIconWrapper{width:100%;height:40px;display:flex}.BellIcon{width:40px;height:40px;display:flex}";
|
|
3987
3987
|
|
|
3988
3988
|
const NutsInboxWidget = class {
|
|
3989
3989
|
constructor(hostRef) {
|
|
@@ -4002,9 +4002,17 @@ const NutsInboxWidget = class {
|
|
|
4002
4002
|
* Client custom styling via inline styles
|
|
4003
4003
|
*/
|
|
4004
4004
|
this.clientStyling = '';
|
|
4005
|
+
/**
|
|
4006
|
+
* Position of the widget (possible values: `left` and `right`) - this changes the `justify-content` property of the `.BellIconWrapper` class
|
|
4007
|
+
*/
|
|
4008
|
+
this.bellIconPosition = 'left';
|
|
4009
|
+
/**
|
|
4010
|
+
* 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
|
+
*/
|
|
4012
|
+
this.notificationAction = 'default';
|
|
4005
4013
|
this.isLoading = true;
|
|
4006
4014
|
this.popoverVisible = false;
|
|
4007
|
-
this.
|
|
4015
|
+
this.ssEndpoint = 'http://localhost:3000';
|
|
4008
4016
|
this.token = null;
|
|
4009
4017
|
this.setClientStyling = () => {
|
|
4010
4018
|
let sheet = document.createElement('style');
|
|
@@ -4042,9 +4050,18 @@ const NutsInboxWidget = class {
|
|
|
4042
4050
|
}
|
|
4043
4051
|
clickOutsideHandle() {
|
|
4044
4052
|
this.popoverVisible = false;
|
|
4053
|
+
window.postMessage({ type: 'nuts-popover-isVisible', value: this.popoverVisible }, window.location.href);
|
|
4054
|
+
}
|
|
4055
|
+
positionIcon() {
|
|
4056
|
+
if (this.bellIconPosition == 'left') {
|
|
4057
|
+
this.bellIconRef.style.justifyContent = 'flex-start';
|
|
4058
|
+
}
|
|
4059
|
+
if (this.bellIconPosition == 'right') {
|
|
4060
|
+
this.bellIconRef.style.justifyContent = 'flex-end';
|
|
4061
|
+
}
|
|
4045
4062
|
}
|
|
4046
4063
|
callSS() {
|
|
4047
|
-
const url = new URL(`${this.
|
|
4064
|
+
const url = new URL(`${this.ssEndpoint}/v1/${this.operatorId}/subscribers/${this.userId}`);
|
|
4048
4065
|
if (this.deviceId) {
|
|
4049
4066
|
url.searchParams.append('deviceToken', this.deviceId);
|
|
4050
4067
|
}
|
|
@@ -4147,11 +4164,14 @@ const NutsInboxWidget = class {
|
|
|
4147
4164
|
this.setClientStylingURL();
|
|
4148
4165
|
}
|
|
4149
4166
|
}
|
|
4167
|
+
componentDidRender() {
|
|
4168
|
+
this.positionIcon();
|
|
4169
|
+
}
|
|
4150
4170
|
renderBellIcon() {
|
|
4151
4171
|
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" })))) : ''));
|
|
4152
4172
|
}
|
|
4153
4173
|
render() {
|
|
4154
|
-
return (index.h("div", { class: "
|
|
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 })));
|
|
4155
4175
|
}
|
|
4156
4176
|
static get watchers() { return {
|
|
4157
4177
|
"userId": ["paramChangeHandler", "initializeHandler"],
|
|
@@ -39812,7 +39832,7 @@ const dateFnsLocales = /*#__PURE__*/Object.freeze({
|
|
|
39812
39832
|
zhTW: locale
|
|
39813
39833
|
});
|
|
39814
39834
|
|
|
39815
|
-
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 .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;
|
|
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}";
|
|
39816
39836
|
|
|
39817
39837
|
const dateFnsLocale = (lang) => {
|
|
39818
39838
|
return lang in dateFnsLocales ? dateFnsLocales[lang] : locale$1s;
|
|
@@ -39907,11 +39927,24 @@ const NutsNotification = class {
|
|
|
39907
39927
|
toggleSettingsModal() {
|
|
39908
39928
|
this.showSettingsModal = !this.showSettingsModal;
|
|
39909
39929
|
if (this.showSettingsModal) {
|
|
39930
|
+
let rect = this.settingsButtonRef.getBoundingClientRect();
|
|
39931
|
+
this.settingsModalRef.style.left = `${rect.left}px`;
|
|
39932
|
+
this.settingsModalRef.style.top = `${rect.top}px`;
|
|
39910
39933
|
this.settingsOpened.emit(this.messageId);
|
|
39911
39934
|
}
|
|
39912
39935
|
}
|
|
39936
|
+
notificationActionHandler() {
|
|
39937
|
+
if (this.notificationAction == 'default' || !this.notificationAction) {
|
|
39938
|
+
if (this.redirectUrl.length > 0) {
|
|
39939
|
+
window.location.href = this.redirectUrl;
|
|
39940
|
+
}
|
|
39941
|
+
}
|
|
39942
|
+
if (this.notificationAction == 'postMessage') {
|
|
39943
|
+
window.postMessage({ type: 'NotificationRedirect', url: this.redirectUrl }, window.location.href);
|
|
39944
|
+
}
|
|
39945
|
+
}
|
|
39913
39946
|
render() {
|
|
39914
|
-
return (index.h("div", { class: 'NotificationContainer' + (this.messageSeen ? '' : ' Unseen'), ref: el => this.stylingContainer = el }, 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: () => this.toggleSettingsModal() }, 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.showSettingsModal ? index.h("div", { class: "SettingsDropdown" }, 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))) : ''
|
|
39947
|
+
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: () => this.toggleSettingsModal(), 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))) : ''));
|
|
39915
39948
|
}
|
|
39916
39949
|
};
|
|
39917
39950
|
NutsNotification.style = nutsNotificationCss;
|
|
@@ -40005,7 +40038,7 @@ const NutsPopover = class {
|
|
|
40005
40038
|
render() {
|
|
40006
40039
|
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) => {
|
|
40007
40040
|
var _a;
|
|
40008
|
-
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, token: this.token, "backend-url": this.backendUrl }));
|
|
40041
|
+
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 }));
|
|
40009
40042
|
}) : 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)))))));
|
|
40010
40043
|
}
|
|
40011
40044
|
static get watchers() { return {
|
|
@@ -16,9 +16,17 @@ export class NutsInboxWidget {
|
|
|
16
16
|
* Client custom styling via inline styles
|
|
17
17
|
*/
|
|
18
18
|
this.clientStyling = '';
|
|
19
|
+
/**
|
|
20
|
+
* Position of the widget (possible values: `left` and `right`) - this changes the `justify-content` property of the `.BellIconWrapper` class
|
|
21
|
+
*/
|
|
22
|
+
this.bellIconPosition = 'left';
|
|
23
|
+
/**
|
|
24
|
+
* 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
|
+
this.notificationAction = 'default';
|
|
19
27
|
this.isLoading = true;
|
|
20
28
|
this.popoverVisible = false;
|
|
21
|
-
this.
|
|
29
|
+
this.ssEndpoint = 'http://localhost:3000';
|
|
22
30
|
this.token = null;
|
|
23
31
|
this.setClientStyling = () => {
|
|
24
32
|
let sheet = document.createElement('style');
|
|
@@ -56,9 +64,18 @@ export class NutsInboxWidget {
|
|
|
56
64
|
}
|
|
57
65
|
clickOutsideHandle() {
|
|
58
66
|
this.popoverVisible = false;
|
|
67
|
+
window.postMessage({ type: 'nuts-popover-isVisible', value: this.popoverVisible }, window.location.href);
|
|
68
|
+
}
|
|
69
|
+
positionIcon() {
|
|
70
|
+
if (this.bellIconPosition == 'left') {
|
|
71
|
+
this.bellIconRef.style.justifyContent = 'flex-start';
|
|
72
|
+
}
|
|
73
|
+
if (this.bellIconPosition == 'right') {
|
|
74
|
+
this.bellIconRef.style.justifyContent = 'flex-end';
|
|
75
|
+
}
|
|
59
76
|
}
|
|
60
77
|
callSS() {
|
|
61
|
-
const url = new URL(`${this.
|
|
78
|
+
const url = new URL(`${this.ssEndpoint}/v1/${this.operatorId}/subscribers/${this.userId}`);
|
|
62
79
|
if (this.deviceId) {
|
|
63
80
|
url.searchParams.append('deviceToken', this.deviceId);
|
|
64
81
|
}
|
|
@@ -161,6 +178,9 @@ export class NutsInboxWidget {
|
|
|
161
178
|
this.setClientStylingURL();
|
|
162
179
|
}
|
|
163
180
|
}
|
|
181
|
+
componentDidRender() {
|
|
182
|
+
this.positionIcon();
|
|
183
|
+
}
|
|
164
184
|
renderBellIcon() {
|
|
165
185
|
return (h("div", { onClick: () => this.togglePopover(), class: "BellIcon" },
|
|
166
186
|
h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "32", height: "32", fill: "currentColor", class: "bi bi-bell", viewBox: "0 0 16 16" },
|
|
@@ -175,9 +195,9 @@ export class NutsInboxWidget {
|
|
|
175
195
|
h("stop", { offset: "1", "stop-color": "#DD2476" })))) : ''));
|
|
176
196
|
}
|
|
177
197
|
render() {
|
|
178
|
-
return (h("div", {
|
|
179
|
-
!this.isLoading && this.renderBellIcon(),
|
|
180
|
-
this.popoverVisible && h("nuts-popover", { "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 })));
|
|
198
|
+
return (h("div", { ref: el => this.stylingContainer = el, class: "Wrapper" },
|
|
199
|
+
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 })));
|
|
181
201
|
}
|
|
182
202
|
static get is() { return "nuts-inbox-widget"; }
|
|
183
203
|
static get encapsulation() { return "shadow"; }
|
|
@@ -377,6 +397,42 @@ export class NutsInboxWidget {
|
|
|
377
397
|
},
|
|
378
398
|
"attribute": "client-styling-url",
|
|
379
399
|
"reflect": true
|
|
400
|
+
},
|
|
401
|
+
"bellIconPosition": {
|
|
402
|
+
"type": "string",
|
|
403
|
+
"mutable": false,
|
|
404
|
+
"complexType": {
|
|
405
|
+
"original": "string",
|
|
406
|
+
"resolved": "string",
|
|
407
|
+
"references": {}
|
|
408
|
+
},
|
|
409
|
+
"required": false,
|
|
410
|
+
"optional": false,
|
|
411
|
+
"docs": {
|
|
412
|
+
"tags": [],
|
|
413
|
+
"text": "Position of the widget (possible values: `left` and `right`) - this changes the `justify-content` property of the `.BellIconWrapper` class"
|
|
414
|
+
},
|
|
415
|
+
"attribute": "bell-icon-position",
|
|
416
|
+
"reflect": true,
|
|
417
|
+
"defaultValue": "'left'"
|
|
418
|
+
},
|
|
419
|
+
"notificationAction": {
|
|
420
|
+
"type": "string",
|
|
421
|
+
"mutable": false,
|
|
422
|
+
"complexType": {
|
|
423
|
+
"original": "string",
|
|
424
|
+
"resolved": "string",
|
|
425
|
+
"references": {}
|
|
426
|
+
},
|
|
427
|
+
"required": false,
|
|
428
|
+
"optional": false,
|
|
429
|
+
"docs": {
|
|
430
|
+
"tags": [],
|
|
431
|
+
"text": "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"
|
|
432
|
+
},
|
|
433
|
+
"attribute": "notification-action",
|
|
434
|
+
"reflect": true,
|
|
435
|
+
"defaultValue": "'default'"
|
|
380
436
|
}
|
|
381
437
|
}; }
|
|
382
438
|
static get states() { return {
|
|
@@ -84,7 +84,25 @@ p {
|
|
|
84
84
|
margin-left: auto;
|
|
85
85
|
cursor: pointer;
|
|
86
86
|
}
|
|
87
|
-
.NotificationContainer .
|
|
87
|
+
.NotificationContainer:hover .Settings {
|
|
88
|
+
opacity: 0.5;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.Unseen::before {
|
|
92
|
+
content: "";
|
|
93
|
+
position: absolute;
|
|
94
|
+
inset: 0px;
|
|
95
|
+
width: 5px;
|
|
96
|
+
border-radius: 7px 0px 0px 7px;
|
|
97
|
+
background: linear-gradient(0deg, #ff512f 0%, #dd2476 100%);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.Unseen:hover .UnseenButton {
|
|
101
|
+
opacity: 0;
|
|
102
|
+
width: 0px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.SettingsDropdown {
|
|
88
106
|
z-index: 999;
|
|
89
107
|
position: absolute;
|
|
90
108
|
background: #292933;
|
|
@@ -92,21 +110,20 @@ p {
|
|
|
92
110
|
border-radius: 7px;
|
|
93
111
|
padding: 4px;
|
|
94
112
|
border: none;
|
|
95
|
-
left: 190px;
|
|
96
|
-
top: 40px;
|
|
97
113
|
transition-property: opacity;
|
|
98
114
|
transition-duration: 150ms;
|
|
99
115
|
transition-timing-function: ease;
|
|
100
116
|
opacity: 1;
|
|
101
|
-
z-index: 300;
|
|
102
117
|
width: max-content;
|
|
103
118
|
display: flex;
|
|
104
119
|
flex-direction: column;
|
|
120
|
+
margin-left: 195px;
|
|
121
|
+
margin-top: -30px;
|
|
105
122
|
}
|
|
106
|
-
.
|
|
123
|
+
.SettingsDropdown svg {
|
|
107
124
|
margin-right: 10px;
|
|
108
125
|
}
|
|
109
|
-
.
|
|
126
|
+
.SettingsDropdown button {
|
|
110
127
|
font-family: inherit;
|
|
111
128
|
border: 0px;
|
|
112
129
|
background-color: transparent;
|
|
@@ -124,24 +141,7 @@ p {
|
|
|
124
141
|
font-weight: 400;
|
|
125
142
|
font-size: 14px;
|
|
126
143
|
}
|
|
127
|
-
.
|
|
144
|
+
.SettingsDropdown button:hover {
|
|
128
145
|
background: #3d3d4d;
|
|
129
146
|
transition: 300ms;
|
|
130
|
-
}
|
|
131
|
-
.NotificationContainer:hover .Settings {
|
|
132
|
-
opacity: 0.5;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.Unseen::before {
|
|
136
|
-
content: "";
|
|
137
|
-
position: absolute;
|
|
138
|
-
inset: 0px;
|
|
139
|
-
width: 5px;
|
|
140
|
-
border-radius: 7px 0px 0px 7px;
|
|
141
|
-
background: linear-gradient(0deg, #ff512f 0%, #dd2476 100%);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.Unseen:hover .UnseenButton {
|
|
145
|
-
opacity: 0;
|
|
146
|
-
width: 0px;
|
|
147
147
|
}
|
|
@@ -91,23 +91,43 @@ export class NutsNotification {
|
|
|
91
91
|
}
|
|
92
92
|
toggleSettingsModal() {
|
|
93
93
|
this.showSettingsModal = !this.showSettingsModal;
|
|
94
|
-
;
|
|
95
94
|
if (this.showSettingsModal) {
|
|
95
|
+
let rect = this.settingsButtonRef.getBoundingClientRect();
|
|
96
|
+
this.settingsModalRef.style.left = `${rect.left}px`;
|
|
97
|
+
this.settingsModalRef.style.top = `${rect.top}px`;
|
|
96
98
|
this.settingsOpened.emit(this.messageId);
|
|
97
99
|
}
|
|
98
100
|
}
|
|
101
|
+
notificationActionHandler() {
|
|
102
|
+
if (this.notificationAction == 'default' || !this.notificationAction) {
|
|
103
|
+
if (this.redirectUrl.length > 0) {
|
|
104
|
+
window.location.href = this.redirectUrl;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (this.notificationAction == 'postMessage') {
|
|
108
|
+
window.postMessage({ type: 'NotificationRedirect', url: this.redirectUrl }, window.location.href);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
99
111
|
render() {
|
|
100
|
-
return (h("div",
|
|
101
|
-
|
|
102
|
-
h("div", { class: "
|
|
103
|
-
h("
|
|
104
|
-
|
|
105
|
-
h("
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
h("
|
|
109
|
-
h("
|
|
110
|
-
|
|
112
|
+
return (h("div", null,
|
|
113
|
+
h("div", { class: 'NotificationContainer' + (this.messageSeen ? '' : ' Unseen'), ref: el => this.stylingContainer = el, onClick: () => this.notificationActionHandler() },
|
|
114
|
+
this.badge ? h("div", { class: "AvatarContainer" },
|
|
115
|
+
h("div", { class: "Avatar" },
|
|
116
|
+
h("img", { class: "AvatarImage", src: this.badge }))) : '',
|
|
117
|
+
h("div", { class: "ContentContainer" },
|
|
118
|
+
h("p", null, this.content),
|
|
119
|
+
h("p", { class: "Date" }, formatDistanceToNow(new Date(this.date), { addSuffix: true, locale: dateFnsLocale(this.language) }))),
|
|
120
|
+
h("div", { class: "Settings", onClick: () => this.toggleSettingsModal(), ref: el => this.settingsButtonRef = el },
|
|
121
|
+
h("svg", { width: "30", height: "30", viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
122
|
+
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" }))),
|
|
123
|
+
this.messageSeen ? '' : h("div", { class: "UnseenButton" },
|
|
124
|
+
h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "10px", height: "10px", viewBox: "0 0 16 16", fill: "none" },
|
|
125
|
+
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" }),
|
|
126
|
+
h("defs", null,
|
|
127
|
+
h("linearGradient", { id: "paint0_linear_1722_2699", x1: "8", y1: "13", x2: "8", y2: "3", gradientUnits: "userSpaceOnUse" },
|
|
128
|
+
h("stop", { "stop-color": "#FF512F" }),
|
|
129
|
+
h("stop", { offset: "1", "stop-color": "#DD2476" })))))),
|
|
130
|
+
this.showSettingsModal ? h("div", { class: "SettingsDropdown", ref: el => this.settingsModalRef = el },
|
|
111
131
|
h("button", { onClick: () => this.markAsRead(this.messageId) },
|
|
112
132
|
h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
113
133
|
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" })),
|
|
@@ -115,14 +135,7 @@ export class NutsNotification {
|
|
|
115
135
|
h("button", { onClick: () => this.deleteMessage(this.messageId) },
|
|
116
136
|
h("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
117
137
|
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" })),
|
|
118
|
-
translate('removeMessage', this.language))) : ''
|
|
119
|
-
this.messageSeen ? '' : h("div", { class: "UnseenButton" },
|
|
120
|
-
h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "10px", height: "10px", viewBox: "0 0 16 16", fill: "none" },
|
|
121
|
-
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" }),
|
|
122
|
-
h("defs", null,
|
|
123
|
-
h("linearGradient", { id: "paint0_linear_1722_2699", x1: "8", y1: "13", x2: "8", y2: "3", gradientUnits: "userSpaceOnUse" },
|
|
124
|
-
h("stop", { "stop-color": "#FF512F" }),
|
|
125
|
-
h("stop", { offset: "1", "stop-color": "#DD2476" })))))));
|
|
138
|
+
translate('removeMessage', this.language))) : ''));
|
|
126
139
|
}
|
|
127
140
|
static get is() { return "nuts-notification"; }
|
|
128
141
|
static get originalStyleUrls() { return {
|
|
@@ -336,9 +349,9 @@ export class NutsNotification {
|
|
|
336
349
|
"attribute": "backend-url",
|
|
337
350
|
"reflect": true
|
|
338
351
|
},
|
|
339
|
-
"
|
|
352
|
+
"redirectUrl": {
|
|
340
353
|
"type": "string",
|
|
341
|
-
"mutable":
|
|
354
|
+
"mutable": false,
|
|
342
355
|
"complexType": {
|
|
343
356
|
"original": "string",
|
|
344
357
|
"resolved": "string",
|
|
@@ -350,9 +363,25 @@ export class NutsNotification {
|
|
|
350
363
|
"tags": [],
|
|
351
364
|
"text": ""
|
|
352
365
|
},
|
|
353
|
-
"attribute": "
|
|
354
|
-
"reflect": true
|
|
355
|
-
|
|
366
|
+
"attribute": "redirect-url",
|
|
367
|
+
"reflect": true
|
|
368
|
+
},
|
|
369
|
+
"notificationAction": {
|
|
370
|
+
"type": "string",
|
|
371
|
+
"mutable": false,
|
|
372
|
+
"complexType": {
|
|
373
|
+
"original": "string",
|
|
374
|
+
"resolved": "string",
|
|
375
|
+
"references": {}
|
|
376
|
+
},
|
|
377
|
+
"required": false,
|
|
378
|
+
"optional": false,
|
|
379
|
+
"docs": {
|
|
380
|
+
"tags": [],
|
|
381
|
+
"text": ""
|
|
382
|
+
},
|
|
383
|
+
"attribute": "notification-action",
|
|
384
|
+
"reflect": true
|
|
356
385
|
},
|
|
357
386
|
"clientStylingUrl": {
|
|
358
387
|
"type": "string",
|
|
@@ -370,6 +399,24 @@ export class NutsNotification {
|
|
|
370
399
|
},
|
|
371
400
|
"attribute": "client-styling-url",
|
|
372
401
|
"reflect": true
|
|
402
|
+
},
|
|
403
|
+
"clientStyling": {
|
|
404
|
+
"type": "string",
|
|
405
|
+
"mutable": true,
|
|
406
|
+
"complexType": {
|
|
407
|
+
"original": "string",
|
|
408
|
+
"resolved": "string",
|
|
409
|
+
"references": {}
|
|
410
|
+
},
|
|
411
|
+
"required": false,
|
|
412
|
+
"optional": false,
|
|
413
|
+
"docs": {
|
|
414
|
+
"tags": [],
|
|
415
|
+
"text": ""
|
|
416
|
+
},
|
|
417
|
+
"attribute": "client-styling",
|
|
418
|
+
"reflect": true,
|
|
419
|
+
"defaultValue": "''"
|
|
373
420
|
}
|
|
374
421
|
}; }
|
|
375
422
|
static get states() { return {
|
|
@@ -91,7 +91,7 @@ export class NutsPopover {
|
|
|
91
91
|
this.showMarkAll ? h("div", { class: "MarkAsRead", onClick: () => this.markAllAsRead() }, translate('markAllAsRead', this.language)) : ''),
|
|
92
92
|
h("div", { class: "NotificationList" }, !this.isLoading && (this.notifications.length > 0 ? this.notifications.map((item) => {
|
|
93
93
|
var _a;
|
|
94
|
-
return (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, token: this.token, "backend-url": this.backendUrl }));
|
|
94
|
+
return (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 }));
|
|
95
95
|
}) : h("div", { class: "NoMessages" },
|
|
96
96
|
h("svg", { width: "120", height: "108", viewBox: "0 0 120 108", fill: "none" },
|
|
97
97
|
h("circle", { cx: "11.3191", cy: "30.7872", r: "6.31915", stroke: "#3D3D4D", "stroke-width": "3.5", "stroke-linecap": "round", "stroke-linejoin": "round" }),
|
|
@@ -218,9 +218,9 @@ export class NutsPopover {
|
|
|
218
218
|
"attribute": "unseen-count",
|
|
219
219
|
"reflect": true
|
|
220
220
|
},
|
|
221
|
-
"
|
|
221
|
+
"clientStylingUrl": {
|
|
222
222
|
"type": "string",
|
|
223
|
-
"mutable":
|
|
223
|
+
"mutable": false,
|
|
224
224
|
"complexType": {
|
|
225
225
|
"original": "string",
|
|
226
226
|
"resolved": "string",
|
|
@@ -232,11 +232,10 @@ export class NutsPopover {
|
|
|
232
232
|
"tags": [],
|
|
233
233
|
"text": ""
|
|
234
234
|
},
|
|
235
|
-
"attribute": "client-styling",
|
|
236
|
-
"reflect": true
|
|
237
|
-
"defaultValue": "''"
|
|
235
|
+
"attribute": "client-styling-url",
|
|
236
|
+
"reflect": true
|
|
238
237
|
},
|
|
239
|
-
"
|
|
238
|
+
"notificationAction": {
|
|
240
239
|
"type": "string",
|
|
241
240
|
"mutable": false,
|
|
242
241
|
"complexType": {
|
|
@@ -250,8 +249,26 @@ export class NutsPopover {
|
|
|
250
249
|
"tags": [],
|
|
251
250
|
"text": ""
|
|
252
251
|
},
|
|
253
|
-
"attribute": "
|
|
252
|
+
"attribute": "notification-action",
|
|
254
253
|
"reflect": true
|
|
254
|
+
},
|
|
255
|
+
"clientStyling": {
|
|
256
|
+
"type": "string",
|
|
257
|
+
"mutable": true,
|
|
258
|
+
"complexType": {
|
|
259
|
+
"original": "string",
|
|
260
|
+
"resolved": "string",
|
|
261
|
+
"references": {}
|
|
262
|
+
},
|
|
263
|
+
"required": false,
|
|
264
|
+
"optional": false,
|
|
265
|
+
"docs": {
|
|
266
|
+
"tags": [],
|
|
267
|
+
"text": ""
|
|
268
|
+
},
|
|
269
|
+
"attribute": "client-styling",
|
|
270
|
+
"reflect": true,
|
|
271
|
+
"defaultValue": "''"
|
|
255
272
|
}
|
|
256
273
|
}; }
|
|
257
274
|
static get states() { return {
|