@everymatrix/nuts-inbox-widget 0.0.1
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 +1349 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/nuts-inbox-widget.cjs.js +19 -0
- package/dist/cjs/nuts-inbox-widget_3.cjs.entry.js +39985 -0
- package/dist/collection/collection-manifest.json +14 -0
- package/dist/collection/components/nuts-inbox-widget/nuts-inbox-widget.css +15 -0
- package/dist/collection/components/nuts-inbox-widget/nuts-inbox-widget.js +450 -0
- package/dist/collection/components/nuts-notification/nuts-notification.css +147 -0
- package/dist/collection/components/nuts-notification/nuts-notification.js +426 -0
- package/dist/collection/components/nuts-popover/nuts-popover.css +75 -0
- package/dist/collection/components/nuts-popover/nuts-popover.js +265 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/types/nuts-inbox-widget.types.js +47 -0
- package/dist/collection/utils/utils.js +0 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/components/nuts-inbox-widget.d.ts +11 -0
- package/dist/components/nuts-inbox-widget.js +4216 -0
- package/dist/components/nuts-notification.d.ts +11 -0
- package/dist/components/nuts-notification.js +6 -0
- package/dist/components/nuts-notification2.js +35762 -0
- package/dist/components/nuts-popover.d.ts +11 -0
- package/dist/components/nuts-popover.js +6 -0
- package/dist/components/nuts-popover2.js +119 -0
- package/dist/esm/index-4e49d940.js +1322 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/nuts-inbox-widget.js +17 -0
- package/dist/esm/nuts-inbox-widget_3.entry.js +39979 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/nuts-inbox-widget/index.esm.js +0 -0
- package/dist/nuts-inbox-widget/nuts-inbox-widget.esm.js +1 -0
- package/dist/nuts-inbox-widget/p-2f19681b.entry.js +1 -0
- package/dist/nuts-inbox-widget/p-d5a07a94.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-stencil/packages/nuts-inbox-widget/.stencil/packages/nuts-inbox-widget/stencil.config.d.ts +2 -0
- package/dist/types/components/nuts-inbox-widget/nuts-inbox-widget.d.ts +70 -0
- package/dist/types/components/nuts-notification/nuts-notification.d.ts +38 -0
- package/dist/types/components/nuts-popover/nuts-popover.d.ts +29 -0
- package/dist/types/components.d.ts +225 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/types/nuts-inbox-widget.types.d.ts +98 -0
- package/dist/types/utils/utils.d.ts +0 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +19 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { Component, h, Listen, Event, Prop, State } from '@stencil/core';
|
|
2
|
+
export class NutsPopover {
|
|
3
|
+
constructor() {
|
|
4
|
+
/**
|
|
5
|
+
* Client custom styling via inline styles
|
|
6
|
+
*/
|
|
7
|
+
this.clientStyling = '';
|
|
8
|
+
this.isLoading = true;
|
|
9
|
+
this.setClientStyling = () => {
|
|
10
|
+
let sheet = document.createElement('style');
|
|
11
|
+
sheet.innerHTML = this.clientStyling;
|
|
12
|
+
this.stylingContainer.prepend(sheet);
|
|
13
|
+
};
|
|
14
|
+
this.setClientStylingURL = () => {
|
|
15
|
+
let url = new URL(this.clientStylingUrl);
|
|
16
|
+
let cssFile = document.createElement('style');
|
|
17
|
+
fetch(url.href)
|
|
18
|
+
.then((res) => res.text())
|
|
19
|
+
.then((data) => {
|
|
20
|
+
cssFile.innerHTML = data;
|
|
21
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
22
|
+
})
|
|
23
|
+
.catch((err) => {
|
|
24
|
+
console.log('error ', err);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
messageDeteledHandler(event) {
|
|
29
|
+
this.notifications = this.notifications.filter((item) => {
|
|
30
|
+
return item._id != event.detail;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
newNotificationHandler(event) {
|
|
34
|
+
this.notifications = [event.detail, ...this.notifications];
|
|
35
|
+
}
|
|
36
|
+
getNotifications() {
|
|
37
|
+
let url = new URL(`${this.backendUrl}/v1/widgets/notifications/feed`);
|
|
38
|
+
const headers = new Headers();
|
|
39
|
+
headers.append('Authorization', `Bearer ${this.token || ''}`);
|
|
40
|
+
headers.append('Content-Type', 'application/json');
|
|
41
|
+
url.searchParams.append('page', '0');
|
|
42
|
+
const options = {
|
|
43
|
+
method: 'GET',
|
|
44
|
+
headers,
|
|
45
|
+
};
|
|
46
|
+
fetch(url.href, options)
|
|
47
|
+
.then((res) => res.json())
|
|
48
|
+
.then((response) => {
|
|
49
|
+
this.isLoading = false;
|
|
50
|
+
this.notifications = response.data;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
markAllAsRead() {
|
|
54
|
+
let url = new URL(`${this.backendUrl}/v1/widgets/messages/read`);
|
|
55
|
+
const headers = new Headers();
|
|
56
|
+
headers.append('Authorization', `Bearer ${this.token || ''}`);
|
|
57
|
+
const options = {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
body: JSON.stringify({}),
|
|
60
|
+
headers,
|
|
61
|
+
};
|
|
62
|
+
fetch(url.href, options)
|
|
63
|
+
.then((res) => res.json())
|
|
64
|
+
.then(() => {
|
|
65
|
+
this.allNotificationsRead.emit();
|
|
66
|
+
})
|
|
67
|
+
.catch((err) => {
|
|
68
|
+
console.error('err', err);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
connectedCallback() {
|
|
72
|
+
this.getNotifications();
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
return (h("div", { class: "Popover", ref: el => this.stylingContainer = el },
|
|
76
|
+
h("div", { class: "Header" },
|
|
77
|
+
h("div", { class: "Title" },
|
|
78
|
+
"Notifications",
|
|
79
|
+
this.unseenCount > 0 ? h("div", { class: "UnseenCounter" }, this.unseenCount) : ''),
|
|
80
|
+
h("div", { class: "MarkAsRead", onClick: () => this.markAllAsRead() }, "Mark all as read")),
|
|
81
|
+
h("div", { class: "NotificationList" }, !this.isLoading && this.notifications.map((item) => {
|
|
82
|
+
var _a;
|
|
83
|
+
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 }));
|
|
84
|
+
}))));
|
|
85
|
+
}
|
|
86
|
+
static get is() { return "nuts-popover"; }
|
|
87
|
+
static get originalStyleUrls() { return {
|
|
88
|
+
"$": ["nuts-popover.scss"]
|
|
89
|
+
}; }
|
|
90
|
+
static get styleUrls() { return {
|
|
91
|
+
"$": ["nuts-popover.css"]
|
|
92
|
+
}; }
|
|
93
|
+
static get properties() { return {
|
|
94
|
+
"language": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"mutable": false,
|
|
97
|
+
"complexType": {
|
|
98
|
+
"original": "string",
|
|
99
|
+
"resolved": "string",
|
|
100
|
+
"references": {}
|
|
101
|
+
},
|
|
102
|
+
"required": false,
|
|
103
|
+
"optional": false,
|
|
104
|
+
"docs": {
|
|
105
|
+
"tags": [],
|
|
106
|
+
"text": ""
|
|
107
|
+
},
|
|
108
|
+
"attribute": "language",
|
|
109
|
+
"reflect": true
|
|
110
|
+
},
|
|
111
|
+
"userId": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"mutable": false,
|
|
114
|
+
"complexType": {
|
|
115
|
+
"original": "string",
|
|
116
|
+
"resolved": "string",
|
|
117
|
+
"references": {}
|
|
118
|
+
},
|
|
119
|
+
"required": false,
|
|
120
|
+
"optional": false,
|
|
121
|
+
"docs": {
|
|
122
|
+
"tags": [],
|
|
123
|
+
"text": ""
|
|
124
|
+
},
|
|
125
|
+
"attribute": "user-id",
|
|
126
|
+
"reflect": true
|
|
127
|
+
},
|
|
128
|
+
"operatorId": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"mutable": false,
|
|
131
|
+
"complexType": {
|
|
132
|
+
"original": "string",
|
|
133
|
+
"resolved": "string",
|
|
134
|
+
"references": {}
|
|
135
|
+
},
|
|
136
|
+
"required": false,
|
|
137
|
+
"optional": false,
|
|
138
|
+
"docs": {
|
|
139
|
+
"tags": [],
|
|
140
|
+
"text": ""
|
|
141
|
+
},
|
|
142
|
+
"attribute": "operator-id",
|
|
143
|
+
"reflect": true
|
|
144
|
+
},
|
|
145
|
+
"token": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"mutable": false,
|
|
148
|
+
"complexType": {
|
|
149
|
+
"original": "string",
|
|
150
|
+
"resolved": "string",
|
|
151
|
+
"references": {}
|
|
152
|
+
},
|
|
153
|
+
"required": false,
|
|
154
|
+
"optional": false,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [],
|
|
157
|
+
"text": ""
|
|
158
|
+
},
|
|
159
|
+
"attribute": "token",
|
|
160
|
+
"reflect": true
|
|
161
|
+
},
|
|
162
|
+
"backendUrl": {
|
|
163
|
+
"type": "string",
|
|
164
|
+
"mutable": false,
|
|
165
|
+
"complexType": {
|
|
166
|
+
"original": "string",
|
|
167
|
+
"resolved": "string",
|
|
168
|
+
"references": {}
|
|
169
|
+
},
|
|
170
|
+
"required": false,
|
|
171
|
+
"optional": false,
|
|
172
|
+
"docs": {
|
|
173
|
+
"tags": [],
|
|
174
|
+
"text": ""
|
|
175
|
+
},
|
|
176
|
+
"attribute": "backend-url",
|
|
177
|
+
"reflect": true
|
|
178
|
+
},
|
|
179
|
+
"unseenCount": {
|
|
180
|
+
"type": "number",
|
|
181
|
+
"mutable": false,
|
|
182
|
+
"complexType": {
|
|
183
|
+
"original": "number",
|
|
184
|
+
"resolved": "number",
|
|
185
|
+
"references": {}
|
|
186
|
+
},
|
|
187
|
+
"required": false,
|
|
188
|
+
"optional": false,
|
|
189
|
+
"docs": {
|
|
190
|
+
"tags": [],
|
|
191
|
+
"text": ""
|
|
192
|
+
},
|
|
193
|
+
"attribute": "unseen-count",
|
|
194
|
+
"reflect": true
|
|
195
|
+
},
|
|
196
|
+
"clientStyling": {
|
|
197
|
+
"type": "string",
|
|
198
|
+
"mutable": true,
|
|
199
|
+
"complexType": {
|
|
200
|
+
"original": "string",
|
|
201
|
+
"resolved": "string",
|
|
202
|
+
"references": {}
|
|
203
|
+
},
|
|
204
|
+
"required": false,
|
|
205
|
+
"optional": false,
|
|
206
|
+
"docs": {
|
|
207
|
+
"tags": [],
|
|
208
|
+
"text": "Client custom styling via inline styles"
|
|
209
|
+
},
|
|
210
|
+
"attribute": "client-styling",
|
|
211
|
+
"reflect": true,
|
|
212
|
+
"defaultValue": "''"
|
|
213
|
+
},
|
|
214
|
+
"clientStylingUrl": {
|
|
215
|
+
"type": "string",
|
|
216
|
+
"mutable": false,
|
|
217
|
+
"complexType": {
|
|
218
|
+
"original": "string",
|
|
219
|
+
"resolved": "string",
|
|
220
|
+
"references": {}
|
|
221
|
+
},
|
|
222
|
+
"required": false,
|
|
223
|
+
"optional": false,
|
|
224
|
+
"docs": {
|
|
225
|
+
"tags": [],
|
|
226
|
+
"text": "Custom styling url for the novu iFrame, formatted as a JSON object according to the documentation: https://docs.novu.co/notification-center/custom-styling/"
|
|
227
|
+
},
|
|
228
|
+
"attribute": "client-styling-url",
|
|
229
|
+
"reflect": true
|
|
230
|
+
}
|
|
231
|
+
}; }
|
|
232
|
+
static get states() { return {
|
|
233
|
+
"notifications": {},
|
|
234
|
+
"isLoading": {}
|
|
235
|
+
}; }
|
|
236
|
+
static get events() { return [{
|
|
237
|
+
"method": "allNotificationsRead",
|
|
238
|
+
"name": "allNotificationsRead",
|
|
239
|
+
"bubbles": true,
|
|
240
|
+
"cancelable": true,
|
|
241
|
+
"composed": true,
|
|
242
|
+
"docs": {
|
|
243
|
+
"tags": [],
|
|
244
|
+
"text": ""
|
|
245
|
+
},
|
|
246
|
+
"complexType": {
|
|
247
|
+
"original": "any",
|
|
248
|
+
"resolved": "any",
|
|
249
|
+
"references": {}
|
|
250
|
+
}
|
|
251
|
+
}]; }
|
|
252
|
+
static get listeners() { return [{
|
|
253
|
+
"name": "messageDeleted",
|
|
254
|
+
"method": "messageDeteledHandler",
|
|
255
|
+
"target": "window",
|
|
256
|
+
"capture": false,
|
|
257
|
+
"passive": false
|
|
258
|
+
}, {
|
|
259
|
+
"name": "newNotification",
|
|
260
|
+
"method": "newNotificationHandler",
|
|
261
|
+
"target": "window",
|
|
262
|
+
"capture": false,
|
|
263
|
+
"passive": false
|
|
264
|
+
}]; }
|
|
265
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
;
|
|
2
|
+
export var StepTypeEnum;
|
|
3
|
+
(function (StepTypeEnum) {
|
|
4
|
+
StepTypeEnum["IN_APP"] = "in_app";
|
|
5
|
+
StepTypeEnum["EMAIL"] = "email";
|
|
6
|
+
StepTypeEnum["SMS"] = "sms";
|
|
7
|
+
StepTypeEnum["CHAT"] = "chat";
|
|
8
|
+
StepTypeEnum["PUSH"] = "push";
|
|
9
|
+
StepTypeEnum["DIGEST"] = "digest";
|
|
10
|
+
StepTypeEnum["TRIGGER"] = "trigger";
|
|
11
|
+
StepTypeEnum["DELAY"] = "delay";
|
|
12
|
+
})(StepTypeEnum || (StepTypeEnum = {}));
|
|
13
|
+
;
|
|
14
|
+
export var EmailBlockTypeEnum;
|
|
15
|
+
(function (EmailBlockTypeEnum) {
|
|
16
|
+
EmailBlockTypeEnum["BUTTON"] = "button";
|
|
17
|
+
EmailBlockTypeEnum["TEXT"] = "text";
|
|
18
|
+
})(EmailBlockTypeEnum || (EmailBlockTypeEnum = {}));
|
|
19
|
+
;
|
|
20
|
+
export var TextAlignEnum;
|
|
21
|
+
(function (TextAlignEnum) {
|
|
22
|
+
TextAlignEnum["CENTER"] = "center";
|
|
23
|
+
TextAlignEnum["LEFT"] = "left";
|
|
24
|
+
TextAlignEnum["RIGHT"] = "right";
|
|
25
|
+
})(TextAlignEnum || (TextAlignEnum = {}));
|
|
26
|
+
;
|
|
27
|
+
;
|
|
28
|
+
export var TemplateVariableTypeEnum;
|
|
29
|
+
(function (TemplateVariableTypeEnum) {
|
|
30
|
+
TemplateVariableTypeEnum["STRING"] = "String";
|
|
31
|
+
TemplateVariableTypeEnum["ARRAY"] = "Array";
|
|
32
|
+
TemplateVariableTypeEnum["BOOLEAN"] = "Boolean";
|
|
33
|
+
})(TemplateVariableTypeEnum || (TemplateVariableTypeEnum = {}));
|
|
34
|
+
;
|
|
35
|
+
export var ChannelCTATypeEnum;
|
|
36
|
+
(function (ChannelCTATypeEnum) {
|
|
37
|
+
ChannelCTATypeEnum["REDIRECT"] = "redirect";
|
|
38
|
+
})(ChannelCTATypeEnum || (ChannelCTATypeEnum = {}));
|
|
39
|
+
;
|
|
40
|
+
export var ActorTypeEnum;
|
|
41
|
+
(function (ActorTypeEnum) {
|
|
42
|
+
ActorTypeEnum["NONE"] = "none";
|
|
43
|
+
ActorTypeEnum["USER"] = "user";
|
|
44
|
+
ActorTypeEnum["SYSTEM_ICON"] = "system_icon";
|
|
45
|
+
ActorTypeEnum["SYSTEM_CUSTOM"] = "system_custom";
|
|
46
|
+
})(ActorTypeEnum || (ActorTypeEnum = {}));
|
|
47
|
+
;
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* NutsInboxWidget custom elements */
|
|
2
|
+
|
|
3
|
+
import type { Components, JSX } from "../types/components";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Used to manually set the base path where assets can be found.
|
|
7
|
+
* If the script is used as "module", it's recommended to use "import.meta.url",
|
|
8
|
+
* such as "setAssetPath(import.meta.url)". Other options include
|
|
9
|
+
* "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
|
|
10
|
+
* dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
|
|
11
|
+
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
12
|
+
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
13
|
+
* will have to ensure the static assets are copied to its build directory.
|
|
14
|
+
*/
|
|
15
|
+
export declare const setAssetPath: (path: string) => void;
|
|
16
|
+
|
|
17
|
+
export interface SetPlatformOptions {
|
|
18
|
+
raf?: (c: FrameRequestCallback) => number;
|
|
19
|
+
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
20
|
+
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
|
|
23
|
+
|
|
24
|
+
export type { Components, JSX };
|
|
25
|
+
|
|
26
|
+
export * from '../types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface NutsInboxWidget extends Components.NutsInboxWidget, HTMLElement {}
|
|
4
|
+
export const NutsInboxWidget: {
|
|
5
|
+
prototype: NutsInboxWidget;
|
|
6
|
+
new (): NutsInboxWidget;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|