@everymatrix/nuts-inbox-widget 1.73.2 → 1.73.21
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/loader.cjs.js +1 -1
- package/dist/cjs/nuts-inbox-widget.cjs.js +1 -1
- package/dist/cjs/nuts-inbox-widget_3.cjs.entry.js +155 -65
- package/dist/collection/api/methods/index.js +31 -12
- package/dist/collection/components/nuts-inbox-widget/nuts-inbox-widget.js +17 -7
- package/dist/collection/components/nuts-notification/nuts-notification.css +2 -1
- package/dist/collection/components/nuts-notification/nuts-notification.js +39 -30
- package/dist/collection/components/nuts-popover/nuts-popover.css +87 -4
- package/dist/collection/components/nuts-popover/nuts-popover.js +106 -13
- package/dist/collection/utils/locale.utils.js +18 -7
- package/dist/esm/loader.js +1 -1
- package/dist/esm/nuts-inbox-widget.js +1 -1
- package/dist/esm/nuts-inbox-widget_3.entry.js +155 -65
- package/dist/nuts-inbox-widget/nuts-inbox-widget.esm.js +1 -1
- package/dist/nuts-inbox-widget/nuts-inbox-widget_3.entry.js +1 -1
- package/dist/types/api/methods/index.d.ts +8 -4
- package/dist/types/api/methods/types.d.ts +3 -1
- package/dist/types/components/nuts-inbox-widget/nuts-inbox-widget.d.ts +1 -0
- package/dist/types/components/nuts-notification/nuts-notification.d.ts +2 -0
- package/dist/types/components/nuts-popover/nuts-popover.d.ts +10 -0
- package/dist/types/components.d.ts +4 -0
- package/dist/types/types/nuts-inbox-widget.types.d.ts +1 -12
- package/package.json +1 -1
- /package/dist/types/Users/{adrian.pripon/Documents/Work → StefanO/Desktop/Proj}/widgets-monorepo/packages/stencil/nuts-inbox-widget/.stencil/libs/common/src/storybook/storybook-utils.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → StefanO/Desktop/Proj}/widgets-monorepo/packages/stencil/nuts-inbox-widget/.stencil/packages/stencil/nuts-inbox-widget/stencil.config.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → StefanO/Desktop/Proj}/widgets-monorepo/packages/stencil/nuts-inbox-widget/.stencil/packages/stencil/nuts-inbox-widget/stencil.config.dev.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → StefanO/Desktop/Proj}/widgets-monorepo/packages/stencil/nuts-inbox-widget/.stencil/packages/stencil/nuts-inbox-widget/storybook/main.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → StefanO/Desktop/Proj}/widgets-monorepo/packages/stencil/nuts-inbox-widget/.stencil/packages/stencil/nuts-inbox-widget/storybook/preview.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → StefanO/Desktop/Proj}/widgets-monorepo/packages/stencil/nuts-inbox-widget/.stencil/tools/plugins/index.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → StefanO/Desktop/Proj}/widgets-monorepo/packages/stencil/nuts-inbox-widget/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → StefanO/Desktop/Proj}/widgets-monorepo/packages/stencil/nuts-inbox-widget/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
- /package/dist/types/Users/{adrian.pripon/Documents/Work → StefanO/Desktop/Proj}/widgets-monorepo/packages/stencil/nuts-inbox-widget/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +0 -0
|
@@ -20,25 +20,25 @@ export const initializeSession = async ({ baseUrl, body, sessionId }) => {
|
|
|
20
20
|
});
|
|
21
21
|
return {
|
|
22
22
|
token: newToken,
|
|
23
|
-
unseenCounter
|
|
23
|
+
unseenCounter
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
catch (error) {
|
|
27
27
|
console.log(error);
|
|
28
28
|
return {
|
|
29
29
|
token: null,
|
|
30
|
-
unseenCounter: 0
|
|
30
|
+
unseenCounter: 0
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
export const getUnseenCount = async ({ baseUrl, token
|
|
34
|
+
export const getUnseenCount = async ({ baseUrl, token }) => {
|
|
35
35
|
var _a;
|
|
36
36
|
const url = new URL(`${baseUrl}/widgets/notifications/unseen?limit=100`);
|
|
37
37
|
const headers = new Headers();
|
|
38
38
|
headers.append('Widget-Authorization', `Bearer ${token}`);
|
|
39
39
|
const options = {
|
|
40
40
|
method: 'GET',
|
|
41
|
-
headers
|
|
41
|
+
headers
|
|
42
42
|
};
|
|
43
43
|
try {
|
|
44
44
|
const res = await fetch(url.href, options);
|
|
@@ -51,13 +51,13 @@ export const getUnseenCount = async ({ baseUrl, token, }) => {
|
|
|
51
51
|
return 0;
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
export const deleteMessage = async ({ baseUrl, token, messageId
|
|
54
|
+
export const deleteMessage = async ({ baseUrl, token, messageId }) => {
|
|
55
55
|
const url = new URL(`${baseUrl}/widgets/messages/${messageId}`);
|
|
56
56
|
const headers = new Headers();
|
|
57
57
|
headers.append('Widget-Authorization', `Bearer ${token}`);
|
|
58
58
|
const options = {
|
|
59
59
|
method: 'DELETE',
|
|
60
|
-
headers
|
|
60
|
+
headers
|
|
61
61
|
};
|
|
62
62
|
try {
|
|
63
63
|
await fetch(url.href, options);
|
|
@@ -68,7 +68,7 @@ export const deleteMessage = async ({ baseUrl, token, messageId, }) => {
|
|
|
68
68
|
return true;
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
export const markAsRead = async ({ baseUrl, body, token, unread
|
|
71
|
+
export const markAsRead = async ({ baseUrl, body, token, unread }) => {
|
|
72
72
|
const url = new URL(`${baseUrl}/widgets/messages/markAs`);
|
|
73
73
|
const headers = new Headers();
|
|
74
74
|
headers.append('Widget-Authorization', `Bearer ${token}`);
|
|
@@ -76,7 +76,7 @@ export const markAsRead = async ({ baseUrl, body, token, unread, }) => {
|
|
|
76
76
|
const options = {
|
|
77
77
|
method: 'POST',
|
|
78
78
|
headers,
|
|
79
|
-
body: JSON.stringify(body)
|
|
79
|
+
body: JSON.stringify(body)
|
|
80
80
|
};
|
|
81
81
|
try {
|
|
82
82
|
const res = await fetch(url.href, options);
|
|
@@ -84,7 +84,7 @@ export const markAsRead = async ({ baseUrl, body, token, unread, }) => {
|
|
|
84
84
|
return {
|
|
85
85
|
messageSeen: data.data[0].seen,
|
|
86
86
|
messageRead: data.data[0].read,
|
|
87
|
-
showSettingsModal: false
|
|
87
|
+
showSettingsModal: false
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
catch (err) {
|
|
@@ -92,7 +92,7 @@ export const markAsRead = async ({ baseUrl, body, token, unread, }) => {
|
|
|
92
92
|
return {
|
|
93
93
|
messageSeen: unread,
|
|
94
94
|
messageRead: unread,
|
|
95
|
-
showSettingsModal: true
|
|
95
|
+
showSettingsModal: true
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
};
|
|
@@ -103,7 +103,7 @@ export const getNotifications = async ({ baseUrl, page, token }) => {
|
|
|
103
103
|
headers.append('Widget-Authorization', `Bearer ${token}`);
|
|
104
104
|
const options = {
|
|
105
105
|
method: 'GET',
|
|
106
|
-
headers
|
|
106
|
+
headers
|
|
107
107
|
};
|
|
108
108
|
try {
|
|
109
109
|
const res = await fetch(url.href, options);
|
|
@@ -112,6 +112,7 @@ export const getNotifications = async ({ baseUrl, page, token }) => {
|
|
|
112
112
|
isLoading: false,
|
|
113
113
|
numberOfNotifications: data.totalCount,
|
|
114
114
|
notifications: data.data,
|
|
115
|
+
hasMore: data.hasMore
|
|
115
116
|
};
|
|
116
117
|
}
|
|
117
118
|
catch (error) {
|
|
@@ -120,10 +121,11 @@ export const getNotifications = async ({ baseUrl, page, token }) => {
|
|
|
120
121
|
isLoading: false,
|
|
121
122
|
numberOfNotifications: 0,
|
|
122
123
|
notifications: [],
|
|
124
|
+
hasMore: undefined
|
|
123
125
|
};
|
|
124
126
|
}
|
|
125
127
|
};
|
|
126
|
-
export const markAllAsRead = async ({ baseUrl, token
|
|
128
|
+
export const markAllAsRead = async ({ baseUrl, token }) => {
|
|
127
129
|
const url = new URL(`${baseUrl}/widgets/messages/read`);
|
|
128
130
|
const headers = new Headers();
|
|
129
131
|
headers.append('Widget-Authorization', `Bearer ${token}`);
|
|
@@ -142,3 +144,20 @@ export const markAllAsRead = async ({ baseUrl, token, }) => {
|
|
|
142
144
|
return false;
|
|
143
145
|
}
|
|
144
146
|
};
|
|
147
|
+
export const deleteAll = async ({ baseUrl, token }) => {
|
|
148
|
+
const url = new URL(`${baseUrl}/widgets/messages`);
|
|
149
|
+
const headers = new Headers();
|
|
150
|
+
headers.append('Widget-Authorization', `Bearer ${token}`);
|
|
151
|
+
const options = {
|
|
152
|
+
method: 'DELETE',
|
|
153
|
+
headers
|
|
154
|
+
};
|
|
155
|
+
try {
|
|
156
|
+
await fetch(url.href, options);
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
console.log(error);
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getTranslations } from "../../utils/locale.utils";
|
|
2
|
-
import { h
|
|
2
|
+
import { h } from "@stencil/core";
|
|
3
3
|
import { io } from "socket.io-client";
|
|
4
4
|
import { initializeSession } from "../../api/methods";
|
|
5
5
|
export class NutsInboxWidget {
|
|
@@ -70,10 +70,11 @@ export class NutsInboxWidget {
|
|
|
70
70
|
initializeSession({
|
|
71
71
|
baseUrl: this.baseUrl,
|
|
72
72
|
body: this.initializeSessionBody,
|
|
73
|
-
sessionId: this.sessionId
|
|
73
|
+
sessionId: this.sessionId
|
|
74
74
|
}).then((initializeSessionResult) => {
|
|
75
75
|
this.token = initializeSessionResult.token;
|
|
76
76
|
this.unseenCount = initializeSessionResult.unseenCounter;
|
|
77
|
+
window.postMessage({ type: 'nuts-new-notifications', value: this.unseenCount }, window.location.href);
|
|
77
78
|
this.setupSocket();
|
|
78
79
|
});
|
|
79
80
|
}
|
|
@@ -91,6 +92,9 @@ export class NutsInboxWidget {
|
|
|
91
92
|
this.unseenCount = 0;
|
|
92
93
|
window.postMessage({ type: 'all-notifications-read', value: true }, window.location.href);
|
|
93
94
|
}
|
|
95
|
+
closePopoverHandler() {
|
|
96
|
+
this.popoverVisible = false;
|
|
97
|
+
}
|
|
94
98
|
positionIcon() {
|
|
95
99
|
if (this.bellIconPosition == 'left') {
|
|
96
100
|
this.bellIconRef.style.justifyContent = 'flex-start';
|
|
@@ -107,8 +111,8 @@ export class NutsInboxWidget {
|
|
|
107
111
|
reconnectionAttempts: 10,
|
|
108
112
|
transports: ['websocket'],
|
|
109
113
|
auth: {
|
|
110
|
-
token: `${this.token}
|
|
111
|
-
}
|
|
114
|
+
token: `${this.token}`
|
|
115
|
+
}
|
|
112
116
|
});
|
|
113
117
|
this.socketRef.on('connect_error', (error) => {
|
|
114
118
|
console.error('WebSocket error', error);
|
|
@@ -121,8 +125,7 @@ export class NutsInboxWidget {
|
|
|
121
125
|
});
|
|
122
126
|
this.socketRef.on('unseen_count_changed', (data) => {
|
|
123
127
|
this.unseenCount = data.unseenCount;
|
|
124
|
-
this.unseenCount
|
|
125
|
-
window.postMessage({ type: 'nuts-new-notifications', value: this.unseenCount }, window.location.href);
|
|
128
|
+
window.postMessage({ type: 'nuts-new-notifications', value: this.unseenCount }, window.location.href);
|
|
126
129
|
});
|
|
127
130
|
}
|
|
128
131
|
}
|
|
@@ -135,6 +138,7 @@ export class NutsInboxWidget {
|
|
|
135
138
|
});
|
|
136
139
|
this.token = initializeSessionResult.token;
|
|
137
140
|
this.unseenCount = initializeSessionResult.unseenCounter;
|
|
141
|
+
window.postMessage({ type: 'nuts-new-notifications', value: this.unseenCount }, window.location.href);
|
|
138
142
|
this.setupSocket();
|
|
139
143
|
}
|
|
140
144
|
if (this.clientStylingUrl) {
|
|
@@ -176,7 +180,7 @@ export class NutsInboxWidget {
|
|
|
176
180
|
return (h("div", { onClick: this.togglePopover, class: "BellIcon" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "32", height: "32", fill: "currentColor", class: "bi bi-bell", viewBox: "0 0 16 16" }, ' ', 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 ? (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" }, 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" }), h("defs", null, h("linearGradient", { id: "paint0_linear_1722_2699", x1: "8", y1: "13", x2: "8", y2: "3", gradientUnits: "userSpaceOnUse" }, h("stop", { "stop-color": "#FF512F" }), h("stop", { offset: "1", "stop-color": "#DD2476" }))))) : ('')));
|
|
177
181
|
}
|
|
178
182
|
render() {
|
|
179
|
-
return (h("div", { key: '
|
|
183
|
+
return (h("div", { key: 'f660aad5bb8aef73e2db8c3fd8f61ef0f658427f', ref: this.assignRefToStylingContainer, class: "Wrapper" }, h("div", { key: '2f43938760a2deeaf8b753a68206675092fb6074', ref: this.assignRefToBell, class: "BellIconWrapper" }, !this.isLoading && this.renderBellIcon()), this.popoverVisible && (h("nuts-popover", { key: '89452813e0317939dde0196a043c9c86e7ac771d', "notification-action": this.notificationAction, sessionId: this.sessionId, "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, "client-styling-url": this.clientStylingUrl, "translation-url": this.translationUrl }))));
|
|
180
184
|
}
|
|
181
185
|
static get is() { return "nuts-inbox-widget"; }
|
|
182
186
|
static get encapsulation() { return "shadow"; }
|
|
@@ -540,6 +544,12 @@ export class NutsInboxWidget {
|
|
|
540
544
|
"target": undefined,
|
|
541
545
|
"capture": false,
|
|
542
546
|
"passive": false
|
|
547
|
+
}, {
|
|
548
|
+
"name": "closePopover",
|
|
549
|
+
"method": "closePopoverHandler",
|
|
550
|
+
"target": "window",
|
|
551
|
+
"capture": false,
|
|
552
|
+
"passive": false
|
|
543
553
|
}];
|
|
544
554
|
}
|
|
545
555
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { h
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
2
|
import { formatDistanceToNow } from "date-fns";
|
|
3
3
|
import { translate, getTranslations } from "../../utils/locale.utils";
|
|
4
4
|
import * as dateFnsLocales from "date-fns/locale";
|
|
5
5
|
import DOMPurify from "dompurify";
|
|
6
|
-
import { WarningFilled, InfoCircleFilled, CheckCircleFilled, CloseCircleFilled, UpCircleFilled, QuestionCircleFilled, DownOutlined
|
|
6
|
+
import { WarningFilled, InfoCircleFilled, CheckCircleFilled, CloseCircleFilled, UpCircleFilled, QuestionCircleFilled, DownOutlined } from "@ant-design/icons-svg";
|
|
7
7
|
import { renderIconDefinitionToSVGElement } from "@ant-design/icons-svg/es/helpers";
|
|
8
8
|
import { MAX_NOTIFICATION_TEXT_LENGTH } from "./constants";
|
|
9
9
|
import { truncate } from "../../utils/utils";
|
|
@@ -11,39 +11,39 @@ import { deleteMessage, markAsRead } from "../../api/methods";
|
|
|
11
11
|
const systemIcons = {
|
|
12
12
|
warning: {
|
|
13
13
|
icon: renderIconDefinitionToSVGElement(WarningFilled, {
|
|
14
|
-
extraSVGAttrs: { width: '20px', height: '20px', fill: '#FFF000' }
|
|
15
|
-
})
|
|
14
|
+
extraSVGAttrs: { width: '20px', height: '20px', fill: '#FFF000' }
|
|
15
|
+
})
|
|
16
16
|
},
|
|
17
17
|
info: {
|
|
18
18
|
icon: renderIconDefinitionToSVGElement(InfoCircleFilled, {
|
|
19
|
-
extraSVGAttrs: { width: '20px', height: '20px', fill: '#0000FF' }
|
|
20
|
-
})
|
|
19
|
+
extraSVGAttrs: { width: '20px', height: '20px', fill: '#0000FF' }
|
|
20
|
+
})
|
|
21
21
|
},
|
|
22
22
|
up: {
|
|
23
23
|
icon: renderIconDefinitionToSVGElement(UpCircleFilled, {
|
|
24
|
-
extraSVGAttrs: { width: '20px', height: '20px', fill: '#A1A1B2' }
|
|
25
|
-
})
|
|
24
|
+
extraSVGAttrs: { width: '20px', height: '20px', fill: '#A1A1B2' }
|
|
25
|
+
})
|
|
26
26
|
},
|
|
27
27
|
question: {
|
|
28
28
|
icon: renderIconDefinitionToSVGElement(QuestionCircleFilled, {
|
|
29
|
-
extraSVGAttrs: { width: '20px', height: '20px', fill: '#A1A1B2' }
|
|
30
|
-
})
|
|
29
|
+
extraSVGAttrs: { width: '20px', height: '20px', fill: '#A1A1B2' }
|
|
30
|
+
})
|
|
31
31
|
},
|
|
32
32
|
success: {
|
|
33
33
|
icon: renderIconDefinitionToSVGElement(CheckCircleFilled, {
|
|
34
|
-
extraSVGAttrs: { width: '20px', height: '20px', fill: '#4D9980' }
|
|
35
|
-
})
|
|
34
|
+
extraSVGAttrs: { width: '20px', height: '20px', fill: '#4D9980' }
|
|
35
|
+
})
|
|
36
36
|
},
|
|
37
37
|
error: {
|
|
38
38
|
icon: renderIconDefinitionToSVGElement(CloseCircleFilled, {
|
|
39
|
-
extraSVGAttrs: { width: '20px', height: '20px', fill: '#E54545' }
|
|
40
|
-
})
|
|
39
|
+
extraSVGAttrs: { width: '20px', height: '20px', fill: '#E54545' }
|
|
40
|
+
})
|
|
41
41
|
},
|
|
42
42
|
arrowDown: {
|
|
43
43
|
icon: renderIconDefinitionToSVGElement(DownOutlined, {
|
|
44
|
-
extraSVGAttrs: { width: '16px', height: '16px', fill: '#A1A1B2' }
|
|
45
|
-
})
|
|
46
|
-
}
|
|
44
|
+
extraSVGAttrs: { width: '16px', height: '16px', fill: '#A1A1B2' }
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
47
|
};
|
|
48
48
|
const dateFnsLocale = (lang) => {
|
|
49
49
|
return lang in dateFnsLocales ? dateFnsLocales[lang] : dateFnsLocales.enUS;
|
|
@@ -62,14 +62,14 @@ export class NutsNotification {
|
|
|
62
62
|
messageId: `${this.messageId}`,
|
|
63
63
|
mark: {
|
|
64
64
|
seen: !unread,
|
|
65
|
-
read: !unread
|
|
66
|
-
}
|
|
65
|
+
read: !unread
|
|
66
|
+
}
|
|
67
67
|
};
|
|
68
68
|
const notificationData = await markAsRead({
|
|
69
69
|
baseUrl: this.baseUrl,
|
|
70
70
|
body: markAsReadBody,
|
|
71
71
|
token: this.token,
|
|
72
|
-
unread
|
|
72
|
+
unread
|
|
73
73
|
});
|
|
74
74
|
this.messageRead = notificationData.messageRead;
|
|
75
75
|
this.messageSeen = notificationData.messageSeen;
|
|
@@ -79,7 +79,7 @@ export class NutsNotification {
|
|
|
79
79
|
const deleteMessageResponse = await deleteMessage({
|
|
80
80
|
baseUrl: this.baseUrl,
|
|
81
81
|
token: this.token,
|
|
82
|
-
messageId: this.messageId
|
|
82
|
+
messageId: this.messageId
|
|
83
83
|
});
|
|
84
84
|
this.showSettingsModal = deleteMessageResponse;
|
|
85
85
|
if (deleteMessageResponse) {
|
|
@@ -97,14 +97,10 @@ export class NutsNotification {
|
|
|
97
97
|
if (this.notificationAction == 'postMessage') {
|
|
98
98
|
window.postMessage({ type: 'NotificationRedirect', url: this.redirectUrl }, window.location.href);
|
|
99
99
|
}
|
|
100
|
-
if (!this.messageRead) {
|
|
101
|
-
this.toggleNotificationRead();
|
|
102
|
-
}
|
|
103
100
|
if (((_a = this.content) === null || _a === void 0 ? void 0 : _a.length) <= MAX_NOTIFICATION_TEXT_LENGTH) {
|
|
104
101
|
return;
|
|
105
102
|
}
|
|
106
|
-
if (((_b = this.displayedContent) === null || _b === void 0 ? void 0 : _b.length) !== ((_c = this.content) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
107
|
-
this.displayedContent !== this.content) {
|
|
103
|
+
if (((_b = this.displayedContent) === null || _b === void 0 ? void 0 : _b.length) !== ((_c = this.content) === null || _c === void 0 ? void 0 : _c.length) && this.displayedContent !== this.content) {
|
|
108
104
|
this.displayedContent = this.content;
|
|
109
105
|
this.dropdownArrowRef.classList.add('FlipX');
|
|
110
106
|
return;
|
|
@@ -172,6 +168,12 @@ export class NutsNotification {
|
|
|
172
168
|
this.showSettingsModal = false;
|
|
173
169
|
}
|
|
174
170
|
}
|
|
171
|
+
clickOutsideHandle(ev) {
|
|
172
|
+
if (ev.composedPath().some((elem) => this.el === elem)) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
this.showSettingsModal = false;
|
|
176
|
+
}
|
|
175
177
|
handleStylingChange(newValue, oldValue) {
|
|
176
178
|
if (newValue !== oldValue)
|
|
177
179
|
this.setClientStyling();
|
|
@@ -209,13 +211,13 @@ export class NutsNotification {
|
|
|
209
211
|
var _a, _b;
|
|
210
212
|
const sanitizedNotificationBody = DOMPurify.sanitize(this.displayedContent, {
|
|
211
213
|
ALLOW_UNKNOWN_PROTOCOLS: true,
|
|
212
|
-
ADD_ATTR: [
|
|
214
|
+
ADD_ATTR: ['target'],
|
|
213
215
|
ALLOWED_TAGS: ['b', 'u', 'i', 'br']
|
|
214
216
|
});
|
|
215
|
-
return (h("div", { key: '
|
|
217
|
+
return (h("div", { key: '4a70f3f0ca827894e98cc605cebb67efa5567918', class: "Wrapper" }, h("div", { key: 'd717cf730c9ecb478fab0db4c1186a9aa8095587', class: 'NotificationContainer' + (this.messageSeen ? '' : ' Unseen'), ref: this.assignRefToStylingContainer, onClick: this.notificationActionHandler }, this.badge ? (h("div", { class: "AvatarContainer" }, h("div", { class: "Avatar" }, ((_a = systemIcons[this.badge]) === null || _a === void 0 ? void 0 : _a.icon) ? (h("div", { innerHTML: systemIcons[this.badge].icon })) : (h("img", { class: "AvatarImage", src: this.badge }))))) : (''), h("div", { key: 'c73b0520101c69cbdea984aaa49d614cd2f083bf', class: "ContentContainer" }, h("div", { key: '7b5db1b999db6d4bcd4e6980ab9f25e0e7b39bf9', innerHTML: sanitizedNotificationBody }), h("p", { key: '623e6c65b1162529686b4b822695e290619baeb7', class: "Date" }, formatDistanceToNow(new Date(this.date), {
|
|
216
218
|
addSuffix: true,
|
|
217
|
-
locale: dateFnsLocale(this.language)
|
|
218
|
-
}))), h("div", { key: '
|
|
219
|
+
locale: dateFnsLocale(this.language)
|
|
220
|
+
}))), h("div", { key: 'b48ab6a8819672f2d15bd627c74574e1020d65d7', class: "RightActionsContainer" }, h("div", { key: 'd83c2390ba7905c4f619260a419ff80dddfd305d', class: "Settings", onClick: this.toggleSettingsModal }, h("svg", { key: '68a503334849a491f09f94dcc1d29062ee197191', width: "24", height: "24", viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: 'babb4b5377e4b95740d9239d3d9fb2b2827a4f71', 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" }))), ((_b = this.content) === null || _b === void 0 ? void 0 : _b.length) > MAX_NOTIFICATION_TEXT_LENGTH && (h("div", { key: '0b77f7441b8ab5e2288e266d2dfc9beda5b8fa3d', class: "AccordionArrow", innerHTML: systemIcons.arrowDown.icon, ref: this.assignRefToDropdownArrow })))), this.showSettingsModal ? (h("div", { class: "SettingsDropdown" }, h("button", { onClick: this.toggleNotificationRead }, h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, 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(this.messageRead ? 'markAsUnread' : 'markAsRead', this.language)), h("button", { onClick: this.deleteNotification }, h("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, 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('removeMessage', this.language)))) : ('')));
|
|
219
221
|
}
|
|
220
222
|
static get is() { return "nuts-notification"; }
|
|
221
223
|
static get originalStyleUrls() {
|
|
@@ -599,6 +601,7 @@ export class NutsNotification {
|
|
|
599
601
|
}
|
|
600
602
|
}];
|
|
601
603
|
}
|
|
604
|
+
static get elementRef() { return "el"; }
|
|
602
605
|
static get watchers() {
|
|
603
606
|
return [{
|
|
604
607
|
"propName": "clientStyling",
|
|
@@ -624,6 +627,12 @@ export class NutsNotification {
|
|
|
624
627
|
"target": "window",
|
|
625
628
|
"capture": false,
|
|
626
629
|
"passive": false
|
|
630
|
+
}, {
|
|
631
|
+
"name": "click",
|
|
632
|
+
"method": "clickOutsideHandle",
|
|
633
|
+
"target": "window",
|
|
634
|
+
"capture": false,
|
|
635
|
+
"passive": false
|
|
627
636
|
}];
|
|
628
637
|
}
|
|
629
638
|
}
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
}
|
|
19
19
|
.Popover .Header {
|
|
20
20
|
display: flex;
|
|
21
|
-
justify-content: space-between;
|
|
22
21
|
padding: 0 20px 10px 20px;
|
|
22
|
+
align-items: center;
|
|
23
23
|
box-shadow: var(--emw--color-gray-20, rgba(0, 0, 0, 0.2)) 0px 5px 5px -5px;
|
|
24
24
|
}
|
|
25
25
|
.Popover .Header .Title {
|
|
@@ -30,8 +30,15 @@
|
|
|
30
30
|
line-height: 24px;
|
|
31
31
|
text-align: center;
|
|
32
32
|
padding-left: 10px;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: 5px;
|
|
33
36
|
}
|
|
34
37
|
.Popover .Header .Title .UnseenCounter {
|
|
38
|
+
margin-right: 5px;
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
35
42
|
text-decoration: none;
|
|
36
43
|
box-sizing: border-box;
|
|
37
44
|
display: inline-flex;
|
|
@@ -43,7 +50,6 @@
|
|
|
43
50
|
text-overflow: ellipsis;
|
|
44
51
|
overflow: hidden;
|
|
45
52
|
padding: 0px;
|
|
46
|
-
margin-left: 10px;
|
|
47
53
|
width: 25px;
|
|
48
54
|
height: 20px;
|
|
49
55
|
pointer-events: none;
|
|
@@ -56,8 +62,6 @@
|
|
|
56
62
|
font-size: 12px;
|
|
57
63
|
}
|
|
58
64
|
.Popover .Header .MarkAsRead {
|
|
59
|
-
margin-top: 5px;
|
|
60
|
-
margin-right: 10px;
|
|
61
65
|
font-size: 14px;
|
|
62
66
|
font-style: normal;
|
|
63
67
|
font-weight: 400;
|
|
@@ -71,6 +75,85 @@
|
|
|
71
75
|
opacity: 0.7;
|
|
72
76
|
transition: 250ms;
|
|
73
77
|
}
|
|
78
|
+
.Popover .Header .DeleteAll,
|
|
79
|
+
.Popover .Header .Close {
|
|
80
|
+
font-style: normal;
|
|
81
|
+
border: none;
|
|
82
|
+
background: transparent;
|
|
83
|
+
font-weight: 400;
|
|
84
|
+
line-height: 17px;
|
|
85
|
+
color: var(--emw--color-gray-150, rgb(130, 130, 153));
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
pointer-events: auto;
|
|
88
|
+
opacity: 0.5;
|
|
89
|
+
}
|
|
90
|
+
.Popover .Header .DeleteAll svg,
|
|
91
|
+
.Popover .Header .Close svg {
|
|
92
|
+
width: 25px;
|
|
93
|
+
height: 25px;
|
|
94
|
+
}
|
|
95
|
+
.Popover .Header .DeleteAll:hover,
|
|
96
|
+
.Popover .Header .Close:hover {
|
|
97
|
+
opacity: 0.7;
|
|
98
|
+
transition: 250ms;
|
|
99
|
+
}
|
|
100
|
+
.Popover .Header .DeleteAll svg {
|
|
101
|
+
width: 30px;
|
|
102
|
+
height: 30px;
|
|
103
|
+
}
|
|
104
|
+
.Popover .Header .DeleteAll.Active {
|
|
105
|
+
opacity: 1;
|
|
106
|
+
}
|
|
107
|
+
.Popover .Header .DeleteAll:disabled {
|
|
108
|
+
opacity: 0.5;
|
|
109
|
+
cursor: not-allowed;
|
|
110
|
+
}
|
|
111
|
+
.Popover .Header .Close {
|
|
112
|
+
margin-left: auto;
|
|
113
|
+
}
|
|
114
|
+
.Popover .DeleteAllDropdown {
|
|
115
|
+
z-index: 999;
|
|
116
|
+
position: absolute;
|
|
117
|
+
background: var(--emw--color-gray-400, rgb(41, 41, 51));
|
|
118
|
+
box-shadow: var(--emw--color-gray-20, rgba(0, 0, 0, 0.2)) 0px 5px 20px;
|
|
119
|
+
border-radius: 7px;
|
|
120
|
+
padding: 4px;
|
|
121
|
+
border: none;
|
|
122
|
+
transition-property: opacity;
|
|
123
|
+
transition-duration: 150ms;
|
|
124
|
+
transition-timing-function: ease;
|
|
125
|
+
opacity: 1;
|
|
126
|
+
width: max-content;
|
|
127
|
+
display: flex;
|
|
128
|
+
flex-direction: column;
|
|
129
|
+
right: 100px;
|
|
130
|
+
top: 50px;
|
|
131
|
+
}
|
|
132
|
+
.Popover .DeleteAllDropdown svg {
|
|
133
|
+
margin-right: 10px;
|
|
134
|
+
}
|
|
135
|
+
.Popover .DeleteAllDropdown button {
|
|
136
|
+
font-family: inherit;
|
|
137
|
+
border: 0px;
|
|
138
|
+
background-color: transparent;
|
|
139
|
+
outline: 0px;
|
|
140
|
+
width: 100%;
|
|
141
|
+
text-align: left;
|
|
142
|
+
text-decoration: none;
|
|
143
|
+
box-sizing: border-box;
|
|
144
|
+
padding: 10px 12px;
|
|
145
|
+
cursor: pointer;
|
|
146
|
+
border-radius: 7px;
|
|
147
|
+
display: flex;
|
|
148
|
+
align-items: center;
|
|
149
|
+
color: var(--emw--color-white, rgb(255, 255, 255));
|
|
150
|
+
font-weight: 400;
|
|
151
|
+
font-size: 14px;
|
|
152
|
+
}
|
|
153
|
+
.Popover .DeleteAllDropdown button:hover {
|
|
154
|
+
background: var(--emw--color-gray-300, rgb(61, 61, 77));
|
|
155
|
+
transition: 300ms;
|
|
156
|
+
}
|
|
74
157
|
.Popover .NotificationList {
|
|
75
158
|
height: 400px;
|
|
76
159
|
overflow: auto;
|