@everymatrix/nuts-inbox-widget 1.44.0 → 1.45.5

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 (63) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-ae4a5047.js +1329 -0
  3. package/dist/cjs/loader.cjs.js +7 -13
  4. package/dist/cjs/nuts-inbox-widget.cjs.js +17 -11
  5. package/dist/cjs/nuts-inbox-widget_3.cjs.entry.js +2276 -1736
  6. package/dist/collection/api/methods/index.js +120 -120
  7. package/dist/collection/collection-manifest.json +5 -5
  8. package/dist/collection/components/nuts-inbox-widget/nuts-inbox-widget.js +511 -515
  9. package/dist/collection/components/nuts-notification/nuts-notification.css +8 -8
  10. package/dist/collection/components/nuts-notification/nuts-notification.js +585 -579
  11. package/dist/collection/components/nuts-popover/nuts-popover.css +8 -8
  12. package/dist/collection/components/nuts-popover/nuts-popover.js +392 -404
  13. package/dist/collection/types/nuts-inbox-widget.types.js +21 -21
  14. package/dist/collection/utils/locale.utils.js +42 -42
  15. package/dist/collection/utils/utils.js +12 -12
  16. package/dist/esm/app-globals-0f993ce5.js +3 -0
  17. package/dist/esm/index-64960aae.js +1301 -0
  18. package/dist/esm/loader.js +7 -13
  19. package/dist/esm/nuts-inbox-widget.js +14 -11
  20. package/dist/esm/nuts-inbox-widget_3.entry.js +2276 -1736
  21. package/dist/nuts-inbox-widget/nuts-inbox-widget.esm.js +1 -1
  22. package/dist/nuts-inbox-widget/p-707e3b6f.entry.js +1 -0
  23. package/dist/nuts-inbox-widget/p-80fb2012.js +2 -0
  24. package/dist/nuts-inbox-widget/p-e1255160.js +1 -0
  25. package/dist/stencil.config.dev.js +14 -0
  26. package/dist/stencil.config.js +14 -19
  27. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/nuts-inbox-widget/.stencil/packages/stencil/nuts-inbox-widget/stencil.config.d.ts +2 -0
  28. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/nuts-inbox-widget/.stencil/packages/stencil/nuts-inbox-widget/stencil.config.dev.d.ts +2 -0
  29. package/dist/types/api/methods/types.d.ts +33 -33
  30. package/dist/types/components/nuts-inbox-widget/nuts-inbox-widget.d.ts +92 -92
  31. package/dist/types/components/nuts-notification/nuts-notification.d.ts +100 -100
  32. package/dist/types/components/nuts-popover/nuts-popover.d.ts +70 -70
  33. package/dist/types/components.d.ts +53 -5
  34. package/dist/types/stencil-public-runtime.d.ts +142 -33
  35. package/dist/types/types/nuts-inbox-widget.types.d.ts +74 -74
  36. package/loader/cdn.js +1 -3
  37. package/loader/index.cjs.js +1 -3
  38. package/loader/index.d.ts +13 -1
  39. package/loader/index.es2017.js +1 -3
  40. package/loader/index.js +1 -3
  41. package/loader/package.json +1 -0
  42. package/package.json +9 -5
  43. package/dist/cjs/index-84dbe58e.js +0 -1356
  44. package/dist/components/index.d.ts +0 -26
  45. package/dist/components/index.js +0 -1
  46. package/dist/components/nuts-inbox-widget.d.ts +0 -11
  47. package/dist/components/nuts-inbox-widget.js +0 -4082
  48. package/dist/components/nuts-notification.d.ts +0 -11
  49. package/dist/components/nuts-notification.js +0 -6
  50. package/dist/components/nuts-notification2.js +0 -36119
  51. package/dist/components/nuts-popover.d.ts +0 -11
  52. package/dist/components/nuts-popover.js +0 -6
  53. package/dist/components/nuts-popover2.js +0 -170
  54. package/dist/esm/index-722b5754.js +0 -1329
  55. package/dist/esm/polyfills/core-js.js +0 -11
  56. package/dist/esm/polyfills/css-shim.js +0 -1
  57. package/dist/esm/polyfills/dom.js +0 -79
  58. package/dist/esm/polyfills/es5-html-element.js +0 -1
  59. package/dist/esm/polyfills/index.js +0 -34
  60. package/dist/esm/polyfills/system.js +0 -6
  61. package/dist/nuts-inbox-widget/p-11f92a64.js +0 -1
  62. package/dist/nuts-inbox-widget/p-d0db9d2d.entry.js +0 -1
  63. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/nuts-inbox-widget/.stencil/packages/nuts-inbox-widget/stencil.config.d.ts +0 -2
@@ -1,527 +1,523 @@
1
- import { getTranslations } from '../../utils/locale.utils';
2
- import { Component, h, Prop, State, Watch, Event, Listen, Element, } from '@stencil/core';
3
- import { io } from 'socket.io-client';
4
- import { initializeSession } from '../../api/methods';
5
- import { createAuthHeaders } from '../../utils/utils';
1
+ import { getTranslations } from "../../utils/locale.utils";
2
+ import { h, } from "@stencil/core";
3
+ import { io } from "socket.io-client";
4
+ import { initializeSession } from "../../api/methods";
5
+ import { createAuthHeaders } from "../../utils/utils";
6
6
  export class NutsInboxWidget {
7
- constructor() {
8
- /**
9
- * Language of the widget
10
- */
11
- this.language = 'en';
12
- /**
13
- * Environment on which the widget is used (possible values: `stage`, `prod`)
14
- */
15
- this.environment = 'stage';
16
- /**
17
- * Client custom styling via inline styles
18
- */
19
- this.clientStyling = '';
20
- /**
21
- * Position of the widget (possible values: `left` and `right`) - this changes the `justify-content` property of the `.BellIconWrapper` class
22
- */
23
- this.bellIconPosition = 'left';
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
26
- */
27
- this.notificationAction = 'default';
28
- /**
29
- * Translations via URL
30
- */
31
- this.translationUrl = '';
32
- this.isLoading = false;
33
- this.popoverVisible = false;
34
- this.token = null;
35
- this.baseUrl = `${this.backendUrl}/v1/${this.operatorId}`;
36
- this.initializeSessionBody = {
37
- applicationIdentifier: this.applicationIdentifier,
38
- subscriberId: this.subscriberId || `${this.operatorId}-${this.userId}`,
39
- hmacHash: null,
40
- };
41
- this.defaultHeaders = createAuthHeaders(this.token, this.sessionId, this.admin);
42
- this.togglePopover = () => {
43
- this.popoverVisible = !this.popoverVisible;
44
- window.postMessage({ type: 'nuts-popover-isVisible', value: this.popoverVisible }, window.location.href);
45
- };
46
- this.setClientStyling = () => {
47
- let sheet = document.createElement('style');
48
- sheet.innerHTML = this.clientStyling;
49
- this.stylingContainer.prepend(sheet);
50
- };
51
- this.setClientStylingURL = () => {
52
- let url = new URL(this.clientStylingUrl);
53
- let cssFile = document.createElement('style');
54
- fetch(url.href)
55
- .then((res) => res.text())
56
- .then((data) => {
57
- cssFile.innerHTML = data;
58
- this.clientStyling = data;
59
- setTimeout(() => {
60
- this.stylingContainer.prepend(cssFile);
61
- }, 1);
62
- })
63
- .catch((err) => {
64
- console.log('error ', err);
65
- });
66
- };
67
- this.assignRefToStylingContainer = (ref) => {
68
- this.stylingContainer = ref;
69
- };
70
- this.assignRefToBell = (ref) => {
71
- this.bellIconRef = ref;
72
- };
73
- }
74
- initializeHandler(newValue, oldValue) {
75
- if (newValue != oldValue) {
76
- if (this.userId && this.operatorId && this.applicationIdentifier) {
77
- initializeSession({
78
- baseUrl: this.baseUrl,
79
- body: this.initializeSessionBody,
80
- headers: this.defaultHeaders,
81
- }).then((initializeSessionResult) => {
82
- this.token = initializeSessionResult.token;
83
- this.unseenCount = initializeSessionResult.unseenCounter;
84
- this.setupSocket();
7
+ constructor() {
8
+ this.token = null;
9
+ this.baseUrl = `${this.backendUrl}/v1/${this.operatorId}`;
10
+ this.initializeSessionBody = {
11
+ applicationIdentifier: this.applicationIdentifier,
12
+ subscriberId: this.subscriberId || `${this.operatorId}-${this.userId}`,
13
+ hmacHash: null,
14
+ };
15
+ this.defaultHeaders = createAuthHeaders(this.token, this.sessionId, this.admin);
16
+ this.togglePopover = () => {
17
+ this.popoverVisible = !this.popoverVisible;
18
+ window.postMessage({ type: 'nuts-popover-isVisible', value: this.popoverVisible }, window.location.href);
19
+ };
20
+ this.setClientStyling = () => {
21
+ let sheet = document.createElement('style');
22
+ sheet.innerHTML = this.clientStyling;
23
+ this.stylingContainer.prepend(sheet);
24
+ };
25
+ this.setClientStylingURL = () => {
26
+ let url = new URL(this.clientStylingUrl);
27
+ let cssFile = document.createElement('style');
28
+ fetch(url.href)
29
+ .then((res) => res.text())
30
+ .then((data) => {
31
+ cssFile.innerHTML = data;
32
+ this.clientStyling = data;
33
+ setTimeout(() => {
34
+ this.stylingContainer.prepend(cssFile);
35
+ }, 1);
36
+ })
37
+ .catch((err) => {
38
+ console.log('error ', err);
39
+ });
40
+ };
41
+ this.assignRefToStylingContainer = (ref) => {
42
+ this.stylingContainer = ref;
43
+ };
44
+ this.assignRefToBell = (ref) => {
45
+ this.bellIconRef = ref;
46
+ };
47
+ this.backendUrl = undefined;
48
+ this.socketUrl = undefined;
49
+ this.userId = undefined;
50
+ this.sessionId = undefined;
51
+ this.admin = undefined;
52
+ this.operatorId = undefined;
53
+ this.subscriberId = undefined;
54
+ this.deviceId = undefined;
55
+ this.language = 'en';
56
+ this.environment = 'stage';
57
+ this.applicationIdentifier = undefined;
58
+ this.clientStyling = '';
59
+ this.clientStylingUrl = undefined;
60
+ this.bellIconPosition = 'left';
61
+ this.notificationAction = 'default';
62
+ this.translationUrl = '';
63
+ this.isLoading = false;
64
+ this.popoverVisible = false;
65
+ this.unseenCount = undefined;
66
+ }
67
+ initializeHandler(newValue, oldValue) {
68
+ if (newValue != oldValue) {
69
+ if (this.userId && this.operatorId && this.applicationIdentifier) {
70
+ initializeSession({
71
+ baseUrl: this.baseUrl,
72
+ body: this.initializeSessionBody,
73
+ headers: this.defaultHeaders,
74
+ }).then((initializeSessionResult) => {
75
+ this.token = initializeSessionResult.token;
76
+ this.unseenCount = initializeSessionResult.unseenCounter;
77
+ this.setupSocket();
78
+ });
79
+ }
80
+ }
81
+ }
82
+ clickOutsideHandle(ev) {
83
+ if (ev.composedPath().some((elem) => this.el === elem)) {
84
+ return;
85
+ }
86
+ this.popoverVisible = false;
87
+ window.postMessage({ type: 'nuts-popover-isVisible', value: this.popoverVisible }, window.location.href);
88
+ }
89
+ positionIcon() {
90
+ if (this.bellIconPosition == 'left') {
91
+ this.bellIconRef.style.justifyContent = 'flex-start';
92
+ }
93
+ if (this.bellIconPosition == 'right') {
94
+ this.bellIconRef.style.justifyContent = 'flex-end';
95
+ }
96
+ }
97
+ setupSocket() {
98
+ if (this.token) {
99
+ this.socketRef = io(this.socketUrl, {
100
+ reconnection: true,
101
+ reconnectionDelayMax: 10000,
102
+ transports: ['websocket'],
103
+ auth: {
104
+ token: `${this.token}`,
105
+ },
106
+ });
107
+ this.socketRef.on('connect_error', (error) => {
108
+ console.error('WebSocket error', error);
109
+ });
110
+ this.socketRef.on('reconnect_attempt', (attemptNumber) => {
111
+ console.log('Reconnect attempt', attemptNumber);
112
+ });
113
+ this.socketRef.on('notification_received', (data) => {
114
+ this.newNotification.emit(data.message);
115
+ });
116
+ this.socketRef.on('unseen_count_changed', (data) => {
117
+ this.unseenCount = data.unseenCount;
118
+ this.unseenCount > 0 &&
119
+ window.postMessage({ type: 'nuts-new-notifications', value: this.unseenCount }, window.location.href);
120
+ });
121
+ }
122
+ }
123
+ async connectedCallback() {
124
+ if (this.userId && this.operatorId && this.applicationIdentifier) {
125
+ const initializeSessionResult = await initializeSession({
126
+ baseUrl: this.baseUrl,
127
+ headers: this.defaultHeaders,
128
+ body: this.initializeSessionBody,
129
+ });
130
+ this.token = initializeSessionResult.token;
131
+ this.unseenCount = initializeSessionResult.unseenCounter;
132
+ this.setupSocket();
133
+ }
134
+ if (this.clientStylingUrl) {
135
+ this.setClientStylingURL();
136
+ }
137
+ }
138
+ handleNewTranslations() {
139
+ this.isLoading = true;
140
+ getTranslations(this.translationUrl).then(() => {
141
+ this.isLoading = false;
85
142
  });
86
- }
87
143
  }
88
- }
89
- clickOutsideHandle(ev) {
90
- if (ev.composedPath().some((elem) => this.el === elem)) {
91
- return;
144
+ async componentWillLoad() {
145
+ if (this.translationUrl.length > 2) {
146
+ await getTranslations(this.translationUrl);
147
+ }
92
148
  }
93
- this.popoverVisible = false;
94
- window.postMessage({ type: 'nuts-popover-isVisible', value: this.popoverVisible }, window.location.href);
95
- }
96
- positionIcon() {
97
- if (this.bellIconPosition == 'left') {
98
- this.bellIconRef.style.justifyContent = 'flex-start';
149
+ componentDidRender() {
150
+ this.positionIcon();
99
151
  }
100
- if (this.bellIconPosition == 'right') {
101
- this.bellIconRef.style.justifyContent = 'flex-end';
152
+ renderBellIcon() {
153
+ 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" }))))) : ('')));
102
154
  }
103
- }
104
- setupSocket() {
105
- if (this.token) {
106
- this.socketRef = io(this.socketUrl, {
107
- reconnection: true,
108
- reconnectionDelayMax: 10000,
109
- transports: ['websocket'],
110
- auth: {
111
- token: `${this.token}`,
112
- },
113
- });
114
- this.socketRef.on('connect_error', (error) => {
115
- console.error('WebSocket error', error);
116
- });
117
- this.socketRef.on('reconnect_attempt', (attemptNumber) => {
118
- console.log('Reconnect attempt', attemptNumber);
119
- });
120
- this.socketRef.on('notification_received', (data) => {
121
- this.newNotification.emit(data.message);
122
- });
123
- this.socketRef.on('unseen_count_changed', (data) => {
124
- this.unseenCount = data.unseenCount;
125
- this.unseenCount > 0 &&
126
- window.postMessage({ type: 'nuts-new-notifications', value: this.unseenCount }, window.location.href);
127
- });
155
+ render() {
156
+ return (h("div", { key: '8aaf695a90d66cdfe70898bdd4719146eb068040', ref: this.assignRefToStylingContainer, class: "Wrapper" }, h("div", { key: 'cf368ca584705447a2e996a2ae9eddf8a6b49d1a', ref: this.assignRefToBell, class: "BellIconWrapper" }, !this.isLoading && this.renderBellIcon()), this.popoverVisible && (h("nuts-popover", { key: '23c169106c9bb0760b0018d0d316a2ca8a4f6d86', "notification-action": this.notificationAction, sessionId: this.sessionId, admin: this.admin, "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 }))));
128
157
  }
129
- }
130
- async connectedCallback() {
131
- if (this.userId && this.operatorId && this.applicationIdentifier) {
132
- const initializeSessionResult = await initializeSession({
133
- baseUrl: this.baseUrl,
134
- headers: this.defaultHeaders,
135
- body: this.initializeSessionBody,
136
- });
137
- this.token = initializeSessionResult.token;
138
- this.unseenCount = initializeSessionResult.unseenCounter;
139
- this.setupSocket();
158
+ static get is() { return "nuts-inbox-widget"; }
159
+ static get encapsulation() { return "shadow"; }
160
+ static get originalStyleUrls() {
161
+ return {
162
+ "$": ["nuts-inbox-widget.scss"]
163
+ };
140
164
  }
141
- if (this.clientStylingUrl) {
142
- this.setClientStylingURL();
165
+ static get styleUrls() {
166
+ return {
167
+ "$": ["nuts-inbox-widget.css"]
168
+ };
143
169
  }
144
- }
145
- handleNewTranslations() {
146
- this.isLoading = true;
147
- getTranslations(this.translationUrl).then(() => {
148
- this.isLoading = false;
149
- });
150
- }
151
- async componentWillLoad() {
152
- if (this.translationUrl.length > 2) {
153
- await getTranslations(this.translationUrl);
170
+ static get properties() {
171
+ return {
172
+ "backendUrl": {
173
+ "type": "string",
174
+ "mutable": false,
175
+ "complexType": {
176
+ "original": "string",
177
+ "resolved": "string",
178
+ "references": {}
179
+ },
180
+ "required": true,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": "HTTP Endpoint URL for NuTS"
185
+ },
186
+ "attribute": "backend-url",
187
+ "reflect": true
188
+ },
189
+ "socketUrl": {
190
+ "type": "string",
191
+ "mutable": false,
192
+ "complexType": {
193
+ "original": "string",
194
+ "resolved": "string",
195
+ "references": {}
196
+ },
197
+ "required": true,
198
+ "optional": false,
199
+ "docs": {
200
+ "tags": [],
201
+ "text": "Socket Endpoint URL for NuTS"
202
+ },
203
+ "attribute": "socket-url",
204
+ "reflect": true
205
+ },
206
+ "userId": {
207
+ "type": "string",
208
+ "mutable": false,
209
+ "complexType": {
210
+ "original": "string",
211
+ "resolved": "string",
212
+ "references": {}
213
+ },
214
+ "required": true,
215
+ "optional": false,
216
+ "docs": {
217
+ "tags": [],
218
+ "text": "The ID of the user"
219
+ },
220
+ "attribute": "user-id",
221
+ "reflect": true
222
+ },
223
+ "sessionId": {
224
+ "type": "string",
225
+ "mutable": false,
226
+ "complexType": {
227
+ "original": "string",
228
+ "resolved": "string",
229
+ "references": {}
230
+ },
231
+ "required": true,
232
+ "optional": false,
233
+ "docs": {
234
+ "tags": [],
235
+ "text": "The sessionID of the user"
236
+ },
237
+ "attribute": "session-id",
238
+ "reflect": true
239
+ },
240
+ "admin": {
241
+ "type": "boolean",
242
+ "mutable": false,
243
+ "complexType": {
244
+ "original": "boolean",
245
+ "resolved": "boolean",
246
+ "references": {}
247
+ },
248
+ "required": false,
249
+ "optional": true,
250
+ "docs": {
251
+ "tags": [],
252
+ "text": "Indicates if the associated sessionId is an admin or a player sessionId"
253
+ },
254
+ "attribute": "admin",
255
+ "reflect": true
256
+ },
257
+ "operatorId": {
258
+ "type": "string",
259
+ "mutable": false,
260
+ "complexType": {
261
+ "original": "string",
262
+ "resolved": "string",
263
+ "references": {}
264
+ },
265
+ "required": true,
266
+ "optional": false,
267
+ "docs": {
268
+ "tags": [],
269
+ "text": "The operatorID on which we can find the user"
270
+ },
271
+ "attribute": "operator-id",
272
+ "reflect": true
273
+ },
274
+ "subscriberId": {
275
+ "type": "string",
276
+ "mutable": false,
277
+ "complexType": {
278
+ "original": "string",
279
+ "resolved": "string",
280
+ "references": {}
281
+ },
282
+ "required": false,
283
+ "optional": true,
284
+ "docs": {
285
+ "tags": [],
286
+ "text": "The subscriberID"
287
+ },
288
+ "attribute": "subscriber-id",
289
+ "reflect": true
290
+ },
291
+ "deviceId": {
292
+ "type": "string",
293
+ "mutable": false,
294
+ "complexType": {
295
+ "original": "string",
296
+ "resolved": "string",
297
+ "references": {}
298
+ },
299
+ "required": false,
300
+ "optional": true,
301
+ "docs": {
302
+ "tags": [],
303
+ "text": "The deviceID from which the user access the website"
304
+ },
305
+ "attribute": "device-id",
306
+ "reflect": true
307
+ },
308
+ "language": {
309
+ "type": "string",
310
+ "mutable": false,
311
+ "complexType": {
312
+ "original": "string",
313
+ "resolved": "string",
314
+ "references": {}
315
+ },
316
+ "required": false,
317
+ "optional": false,
318
+ "docs": {
319
+ "tags": [],
320
+ "text": "Language of the widget"
321
+ },
322
+ "attribute": "language",
323
+ "reflect": true,
324
+ "defaultValue": "'en'"
325
+ },
326
+ "environment": {
327
+ "type": "string",
328
+ "mutable": false,
329
+ "complexType": {
330
+ "original": "string",
331
+ "resolved": "string",
332
+ "references": {}
333
+ },
334
+ "required": false,
335
+ "optional": false,
336
+ "docs": {
337
+ "tags": [],
338
+ "text": "Environment on which the widget is used (possible values: `stage`, `prod`)"
339
+ },
340
+ "attribute": "environment",
341
+ "reflect": true,
342
+ "defaultValue": "'stage'"
343
+ },
344
+ "applicationIdentifier": {
345
+ "type": "string",
346
+ "mutable": false,
347
+ "complexType": {
348
+ "original": "string",
349
+ "resolved": "string",
350
+ "references": {}
351
+ },
352
+ "required": true,
353
+ "optional": false,
354
+ "docs": {
355
+ "tags": [],
356
+ "text": "Novu application identifier"
357
+ },
358
+ "attribute": "application-identifier",
359
+ "reflect": true
360
+ },
361
+ "clientStyling": {
362
+ "type": "string",
363
+ "mutable": true,
364
+ "complexType": {
365
+ "original": "string",
366
+ "resolved": "string",
367
+ "references": {}
368
+ },
369
+ "required": false,
370
+ "optional": false,
371
+ "docs": {
372
+ "tags": [],
373
+ "text": "Client custom styling via inline styles"
374
+ },
375
+ "attribute": "client-styling",
376
+ "reflect": true,
377
+ "defaultValue": "''"
378
+ },
379
+ "clientStylingUrl": {
380
+ "type": "string",
381
+ "mutable": false,
382
+ "complexType": {
383
+ "original": "string",
384
+ "resolved": "string",
385
+ "references": {}
386
+ },
387
+ "required": false,
388
+ "optional": false,
389
+ "docs": {
390
+ "tags": [],
391
+ "text": "Client styling url for a css file"
392
+ },
393
+ "attribute": "client-styling-url",
394
+ "reflect": true
395
+ },
396
+ "bellIconPosition": {
397
+ "type": "string",
398
+ "mutable": false,
399
+ "complexType": {
400
+ "original": "string",
401
+ "resolved": "string",
402
+ "references": {}
403
+ },
404
+ "required": false,
405
+ "optional": false,
406
+ "docs": {
407
+ "tags": [],
408
+ "text": "Position of the widget (possible values: `left` and `right`) - this changes the `justify-content` property of the `.BellIconWrapper` class"
409
+ },
410
+ "attribute": "bell-icon-position",
411
+ "reflect": true,
412
+ "defaultValue": "'left'"
413
+ },
414
+ "notificationAction": {
415
+ "type": "string",
416
+ "mutable": false,
417
+ "complexType": {
418
+ "original": "string",
419
+ "resolved": "string",
420
+ "references": {}
421
+ },
422
+ "required": false,
423
+ "optional": false,
424
+ "docs": {
425
+ "tags": [],
426
+ "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"
427
+ },
428
+ "attribute": "notification-action",
429
+ "reflect": true,
430
+ "defaultValue": "'default'"
431
+ },
432
+ "translationUrl": {
433
+ "type": "string",
434
+ "mutable": false,
435
+ "complexType": {
436
+ "original": "string",
437
+ "resolved": "string",
438
+ "references": {}
439
+ },
440
+ "required": false,
441
+ "optional": false,
442
+ "docs": {
443
+ "tags": [],
444
+ "text": "Translations via URL"
445
+ },
446
+ "attribute": "translation-url",
447
+ "reflect": true,
448
+ "defaultValue": "''"
449
+ }
450
+ };
154
451
  }
155
- }
156
- componentDidRender() {
157
- this.positionIcon();
158
- }
159
- renderBellIcon() {
160
- return (h("div", { onClick: this.togglePopover, class: "BellIcon" },
161
- h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "32", height: "32", fill: "currentColor", class: "bi bi-bell", viewBox: "0 0 16 16" },
162
- ' ',
163
- 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" }),
164
- ' '),
165
- 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" },
166
- 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" }),
167
- h("defs", null,
168
- h("linearGradient", { id: "paint0_linear_1722_2699", x1: "8", y1: "13", x2: "8", y2: "3", gradientUnits: "userSpaceOnUse" },
169
- h("stop", { "stop-color": "#FF512F" }),
170
- h("stop", { offset: "1", "stop-color": "#DD2476" }))))) : ('')));
171
- }
172
- render() {
173
- return (h("div", { ref: this.assignRefToStylingContainer, class: "Wrapper" },
174
- h("div", { ref: this.assignRefToBell, class: "BellIconWrapper" }, !this.isLoading && this.renderBellIcon()),
175
- this.popoverVisible && (h("nuts-popover", { "notification-action": this.notificationAction, sessionId: this.sessionId, admin: this.admin, "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 }))));
176
- }
177
- static get is() { return "nuts-inbox-widget"; }
178
- static get encapsulation() { return "shadow"; }
179
- static get originalStyleUrls() { return {
180
- "$": ["nuts-inbox-widget.scss"]
181
- }; }
182
- static get styleUrls() { return {
183
- "$": ["nuts-inbox-widget.css"]
184
- }; }
185
- static get properties() { return {
186
- "backendUrl": {
187
- "type": "string",
188
- "mutable": false,
189
- "complexType": {
190
- "original": "string",
191
- "resolved": "string",
192
- "references": {}
193
- },
194
- "required": true,
195
- "optional": false,
196
- "docs": {
197
- "tags": [],
198
- "text": "HTTP Endpoint URL for NuTS"
199
- },
200
- "attribute": "backend-url",
201
- "reflect": true
202
- },
203
- "socketUrl": {
204
- "type": "string",
205
- "mutable": false,
206
- "complexType": {
207
- "original": "string",
208
- "resolved": "string",
209
- "references": {}
210
- },
211
- "required": true,
212
- "optional": false,
213
- "docs": {
214
- "tags": [],
215
- "text": "Socket Endpoint URL for NuTS"
216
- },
217
- "attribute": "socket-url",
218
- "reflect": true
219
- },
220
- "userId": {
221
- "type": "string",
222
- "mutable": false,
223
- "complexType": {
224
- "original": "string",
225
- "resolved": "string",
226
- "references": {}
227
- },
228
- "required": true,
229
- "optional": false,
230
- "docs": {
231
- "tags": [],
232
- "text": "The ID of the user"
233
- },
234
- "attribute": "user-id",
235
- "reflect": true
236
- },
237
- "sessionId": {
238
- "type": "string",
239
- "mutable": false,
240
- "complexType": {
241
- "original": "string",
242
- "resolved": "string",
243
- "references": {}
244
- },
245
- "required": true,
246
- "optional": false,
247
- "docs": {
248
- "tags": [],
249
- "text": "The sessionID of the user"
250
- },
251
- "attribute": "session-id",
252
- "reflect": true
253
- },
254
- "admin": {
255
- "type": "boolean",
256
- "mutable": false,
257
- "complexType": {
258
- "original": "boolean",
259
- "resolved": "boolean",
260
- "references": {}
261
- },
262
- "required": false,
263
- "optional": true,
264
- "docs": {
265
- "tags": [],
266
- "text": "Indicates if the associated sessionId is an admin or a player sessionId"
267
- },
268
- "attribute": "admin",
269
- "reflect": true
270
- },
271
- "operatorId": {
272
- "type": "string",
273
- "mutable": false,
274
- "complexType": {
275
- "original": "string",
276
- "resolved": "string",
277
- "references": {}
278
- },
279
- "required": true,
280
- "optional": false,
281
- "docs": {
282
- "tags": [],
283
- "text": "The operatorID on which we can find the user"
284
- },
285
- "attribute": "operator-id",
286
- "reflect": true
287
- },
288
- "subscriberId": {
289
- "type": "string",
290
- "mutable": false,
291
- "complexType": {
292
- "original": "string",
293
- "resolved": "string",
294
- "references": {}
295
- },
296
- "required": false,
297
- "optional": true,
298
- "docs": {
299
- "tags": [],
300
- "text": "The subscriberID"
301
- },
302
- "attribute": "subscriber-id",
303
- "reflect": true
304
- },
305
- "deviceId": {
306
- "type": "string",
307
- "mutable": false,
308
- "complexType": {
309
- "original": "string",
310
- "resolved": "string",
311
- "references": {}
312
- },
313
- "required": false,
314
- "optional": true,
315
- "docs": {
316
- "tags": [],
317
- "text": "The deviceID from which the user access the website"
318
- },
319
- "attribute": "device-id",
320
- "reflect": true
321
- },
322
- "language": {
323
- "type": "string",
324
- "mutable": false,
325
- "complexType": {
326
- "original": "string",
327
- "resolved": "string",
328
- "references": {}
329
- },
330
- "required": false,
331
- "optional": false,
332
- "docs": {
333
- "tags": [],
334
- "text": "Language of the widget"
335
- },
336
- "attribute": "language",
337
- "reflect": true,
338
- "defaultValue": "'en'"
339
- },
340
- "environment": {
341
- "type": "string",
342
- "mutable": false,
343
- "complexType": {
344
- "original": "string",
345
- "resolved": "string",
346
- "references": {}
347
- },
348
- "required": false,
349
- "optional": false,
350
- "docs": {
351
- "tags": [],
352
- "text": "Environment on which the widget is used (possible values: `stage`, `prod`)"
353
- },
354
- "attribute": "environment",
355
- "reflect": true,
356
- "defaultValue": "'stage'"
357
- },
358
- "applicationIdentifier": {
359
- "type": "string",
360
- "mutable": false,
361
- "complexType": {
362
- "original": "string",
363
- "resolved": "string",
364
- "references": {}
365
- },
366
- "required": true,
367
- "optional": false,
368
- "docs": {
369
- "tags": [],
370
- "text": "Novu application identifier"
371
- },
372
- "attribute": "application-identifier",
373
- "reflect": true
374
- },
375
- "clientStyling": {
376
- "type": "string",
377
- "mutable": true,
378
- "complexType": {
379
- "original": "string",
380
- "resolved": "string",
381
- "references": {}
382
- },
383
- "required": false,
384
- "optional": false,
385
- "docs": {
386
- "tags": [],
387
- "text": "Client custom styling via inline styles"
388
- },
389
- "attribute": "client-styling",
390
- "reflect": true,
391
- "defaultValue": "''"
392
- },
393
- "clientStylingUrl": {
394
- "type": "string",
395
- "mutable": false,
396
- "complexType": {
397
- "original": "string",
398
- "resolved": "string",
399
- "references": {}
400
- },
401
- "required": false,
402
- "optional": false,
403
- "docs": {
404
- "tags": [],
405
- "text": "Client styling url for a css file"
406
- },
407
- "attribute": "client-styling-url",
408
- "reflect": true
409
- },
410
- "bellIconPosition": {
411
- "type": "string",
412
- "mutable": false,
413
- "complexType": {
414
- "original": "string",
415
- "resolved": "string",
416
- "references": {}
417
- },
418
- "required": false,
419
- "optional": false,
420
- "docs": {
421
- "tags": [],
422
- "text": "Position of the widget (possible values: `left` and `right`) - this changes the `justify-content` property of the `.BellIconWrapper` class"
423
- },
424
- "attribute": "bell-icon-position",
425
- "reflect": true,
426
- "defaultValue": "'left'"
427
- },
428
- "notificationAction": {
429
- "type": "string",
430
- "mutable": false,
431
- "complexType": {
432
- "original": "string",
433
- "resolved": "string",
434
- "references": {}
435
- },
436
- "required": false,
437
- "optional": false,
438
- "docs": {
439
- "tags": [],
440
- "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"
441
- },
442
- "attribute": "notification-action",
443
- "reflect": true,
444
- "defaultValue": "'default'"
445
- },
446
- "translationUrl": {
447
- "type": "string",
448
- "mutable": false,
449
- "complexType": {
450
- "original": "string",
451
- "resolved": "string",
452
- "references": {}
453
- },
454
- "required": false,
455
- "optional": false,
456
- "docs": {
457
- "tags": [],
458
- "text": "Translations via URL"
459
- },
460
- "attribute": "translation-url",
461
- "reflect": true,
462
- "defaultValue": "''"
452
+ static get states() {
453
+ return {
454
+ "isLoading": {},
455
+ "popoverVisible": {},
456
+ "unseenCount": {}
457
+ };
458
+ }
459
+ static get events() {
460
+ return [{
461
+ "method": "notificationFeed",
462
+ "name": "notificationFeed",
463
+ "bubbles": true,
464
+ "cancelable": true,
465
+ "composed": true,
466
+ "docs": {
467
+ "tags": [],
468
+ "text": ""
469
+ },
470
+ "complexType": {
471
+ "original": "Notification[]",
472
+ "resolved": "Notification[]",
473
+ "references": {
474
+ "Notification": {
475
+ "location": "import",
476
+ "path": "../../types/nuts-inbox-widget.types",
477
+ "id": "../../../../packages/stencil/nuts-inbox-widget/src/types/nuts-inbox-widget.types.ts::Notification"
478
+ }
479
+ }
480
+ }
481
+ }, {
482
+ "method": "newNotification",
483
+ "name": "newNotification",
484
+ "bubbles": true,
485
+ "cancelable": true,
486
+ "composed": true,
487
+ "docs": {
488
+ "tags": [],
489
+ "text": ""
490
+ },
491
+ "complexType": {
492
+ "original": "any",
493
+ "resolved": "any",
494
+ "references": {}
495
+ }
496
+ }];
497
+ }
498
+ static get elementRef() { return "el"; }
499
+ static get watchers() {
500
+ return [{
501
+ "propName": "userId",
502
+ "methodName": "initializeHandler"
503
+ }, {
504
+ "propName": "operatorId",
505
+ "methodName": "initializeHandler"
506
+ }, {
507
+ "propName": "applicationIdentifier",
508
+ "methodName": "initializeHandler"
509
+ }, {
510
+ "propName": "translationUrl",
511
+ "methodName": "handleNewTranslations"
512
+ }];
513
+ }
514
+ static get listeners() {
515
+ return [{
516
+ "name": "click",
517
+ "method": "clickOutsideHandle",
518
+ "target": "window",
519
+ "capture": false,
520
+ "passive": false
521
+ }];
463
522
  }
464
- }; }
465
- static get states() { return {
466
- "isLoading": {},
467
- "popoverVisible": {},
468
- "unseenCount": {}
469
- }; }
470
- static get events() { return [{
471
- "method": "notificationFeed",
472
- "name": "notificationFeed",
473
- "bubbles": true,
474
- "cancelable": true,
475
- "composed": true,
476
- "docs": {
477
- "tags": [],
478
- "text": ""
479
- },
480
- "complexType": {
481
- "original": "Notification[]",
482
- "resolved": "Notification[]",
483
- "references": {
484
- "Notification": {
485
- "location": "import",
486
- "path": "../../types/nuts-inbox-widget.types"
487
- }
488
- }
489
- }
490
- }, {
491
- "method": "newNotification",
492
- "name": "newNotification",
493
- "bubbles": true,
494
- "cancelable": true,
495
- "composed": true,
496
- "docs": {
497
- "tags": [],
498
- "text": ""
499
- },
500
- "complexType": {
501
- "original": "any",
502
- "resolved": "any",
503
- "references": {}
504
- }
505
- }]; }
506
- static get elementRef() { return "el"; }
507
- static get watchers() { return [{
508
- "propName": "userId",
509
- "methodName": "initializeHandler"
510
- }, {
511
- "propName": "operatorId",
512
- "methodName": "initializeHandler"
513
- }, {
514
- "propName": "applicationIdentifier",
515
- "methodName": "initializeHandler"
516
- }, {
517
- "propName": "translationUrl",
518
- "methodName": "handleNewTranslations"
519
- }]; }
520
- static get listeners() { return [{
521
- "name": "click",
522
- "method": "clickOutsideHandle",
523
- "target": "window",
524
- "capture": false,
525
- "passive": false
526
- }]; }
527
523
  }