@things-factory/notification 9.0.0-beta.8 → 9.0.0
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-client/actions/notification-fcm.js +1 -2
- package/dist-client/actions/notification-fcm.js.map +1 -1
- package/dist-client/bootstrap.js +4 -1
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/pages/notification/notification-list-page.js +35 -28
- package/dist-client/pages/notification/notification-list-page.js.map +1 -1
- package/dist-client/pages/notification-rule/notification-rule-importer.js +16 -17
- package/dist-client/pages/notification-rule/notification-rule-importer.js.map +1 -1
- package/dist-client/pages/notification-rule/notification-rule-list-page.js +35 -28
- package/dist-client/pages/notification-rule/notification-rule-list-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/viewparts/notification-badge.js +10 -10
- package/dist-client/viewparts/notification-badge.js.map +1 -1
- package/dist-client/viewparts/notification-item.js +78 -79
- package/dist-client/viewparts/notification-item.js.map +1 -1
- package/dist-client/viewparts/notification-list.js +57 -54
- package/dist-client/viewparts/notification-list.js.map +1 -1
- package/dist-client/viewparts/notification-sender.js +55 -56
- package/dist-client/viewparts/notification-sender.js.map +1 -1
- package/dist-client/viewparts/notification-setting-let.js +53 -53
- package/dist-client/viewparts/notification-setting-let.js.map +1 -1
- package/dist-server/controllers/fcm.js +4 -1
- package/dist-server/controllers/fcm.js.map +1 -1
- package/dist-server/routers/notification-router.js +5 -2
- package/dist-server/routers/notification-router.js.map +1 -1
- package/dist-server/service/index.js +6 -2
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/notification/directive-notification.js +1 -2
- package/dist-server/service/notification/directive-notification.js.map +1 -1
- package/dist-server/service/notification/notification-mutation.js +24 -6
- package/dist-server/service/notification/notification-mutation.js.map +1 -1
- package/dist-server/service/notification/notification-subscription.js +2 -2
- package/dist-server/service/notification/notification-subscription.js.map +1 -1
- package/dist-server/service/notification-rule/notification-rule-mutation.js +25 -7
- package/dist-server/service/notification-rule/notification-rule-mutation.js.map +1 -1
- package/dist-server/service/notification-rule/notification-rule-query.js +1 -1
- package/dist-server/service/notification-rule/notification-rule-query.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
|
@@ -5,15 +5,8 @@ import { customElement, property } from 'lit/decorators.js';
|
|
|
5
5
|
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
6
6
|
import { store } from '@operato/shell';
|
|
7
7
|
let NotificationBadge = class NotificationBadge extends connect(store)(LitElement) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
stateChanged(state) {
|
|
12
|
-
this.badge = state.notification.badge || 0;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
NotificationBadge.styles = [
|
|
16
|
-
css `
|
|
8
|
+
static { this.styles = [
|
|
9
|
+
css `
|
|
17
10
|
:host {
|
|
18
11
|
font-size: 2em;
|
|
19
12
|
position: relative;
|
|
@@ -44,7 +37,14 @@ NotificationBadge.styles = [
|
|
|
44
37
|
display: none;
|
|
45
38
|
}
|
|
46
39
|
`
|
|
47
|
-
];
|
|
40
|
+
]; }
|
|
41
|
+
render() {
|
|
42
|
+
return html ` <md-icon>notifications_none</md-icon> `;
|
|
43
|
+
}
|
|
44
|
+
stateChanged(state) {
|
|
45
|
+
this.badge = state.notification.badge || 0;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
48
|
__decorate([
|
|
49
49
|
property({ type: Number, attribute: 'data-badge', reflect: true }),
|
|
50
50
|
__metadata("design:type", Number)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-badge.js","sourceRoot":"","sources":["../../client/viewparts/notification-badge.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAG/B,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"notification-badge.js","sourceRoot":"","sources":["../../client/viewparts/notification-badge.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAG/B,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;aACxD,WAAM,GAAG;QACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BF;KACF,AAhCY,CAgCZ;IAID,MAAM;QACJ,OAAO,IAAI,CAAA,yCAAyC,CAAA;IACtD,CAAC;IAED,YAAY,CAAC,KAAK;QAChB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC,CAAA;IAC5C,CAAC;;AARmE;IAAnE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;gDAAe;AAnCvE,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CA4C7B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { connect } from 'pwa-helpers/connect-mixin.js'\nimport { store } from '@operato/shell'\n\n@customElement('notification-badge')\nexport class NotificationBadge extends connect(store)(LitElement) {\n static styles = [\n css`\n :host {\n font-size: 2em;\n position: relative;\n }\n\n md-icon {\n display: block;\n }\n\n :host::after {\n content: attr(data-badge);\n position: absolute;\n top: 0px;\n right: -6px;\n font-family: var(--theme-font);\n font-size: 0.3em;\n background: var(--md-sys-color-error, rgb(186 26 26));\n color: var(--md-sys-color-on-primary);\n width: 14px;\n height: 14px;\n text-align: center;\n line-height: 14px;\n border-radius: 50%;\n box-shadow: var(--box-shadow);\n }\n\n :host([data-badge='0'])::after {\n display: none;\n }\n `\n ]\n\n @property({ type: Number, attribute: 'data-badge', reflect: true }) badge?: number\n\n render() {\n return html` <md-icon>notifications_none</md-icon> `\n }\n\n stateChanged(state) {\n this.badge = state.notification.badge || 0\n }\n}\n"]}
|
|
@@ -26,84 +26,8 @@ function isOriginSameAsLocation(url) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
let NotificationItem = class NotificationItem extends LitElement {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const target = this.target;
|
|
32
|
-
const detail = this.detail;
|
|
33
|
-
const type = this.type;
|
|
34
|
-
return html `
|
|
35
|
-
<div titler>
|
|
36
|
-
<span></span>
|
|
37
|
-
${url
|
|
38
|
-
? target
|
|
39
|
-
? html `<a href=${url} target=${target}>${title}</a>`
|
|
40
|
-
: html `<a href=${url}>${title}</a>`
|
|
41
|
-
: title}
|
|
42
|
-
</div>
|
|
43
|
-
<md-icon close @click=${e => this.dispatchEvent(new CustomEvent('close'))}>close</md-icon>
|
|
44
|
-
|
|
45
|
-
${image
|
|
46
|
-
? url
|
|
47
|
-
? target
|
|
48
|
-
? html `<a href=${url} target=${target}><img src=${image} /></a>`
|
|
49
|
-
: html `<a href=${url}><img src=${image} /></a>`
|
|
50
|
-
: html `<img src=${image} />`
|
|
51
|
-
: html ``}
|
|
52
|
-
<div message>${body}</div>
|
|
53
|
-
${type == 'ERROR'
|
|
54
|
-
? html `<div
|
|
55
|
-
@click=${() => {
|
|
56
|
-
this.decipherErrorCode();
|
|
57
|
-
}}
|
|
58
|
-
>
|
|
59
|
-
<span class="more"><md-icon>expand_circle_down</md-icon> more</span>
|
|
60
|
-
</div>`
|
|
61
|
-
: html ``}
|
|
62
|
-
${detail ? html `<div detail>${detail.message}</div>` : html ``}
|
|
63
|
-
|
|
64
|
-
<div timestamp>${new Date(Number(timestamp)).toLocaleString()}</div>
|
|
65
|
-
`;
|
|
66
|
-
}
|
|
67
|
-
updated(changed) {
|
|
68
|
-
var _a, _b;
|
|
69
|
-
if (!((_a = this.notification) === null || _a === void 0 ? void 0 : _a.confirmed)) {
|
|
70
|
-
this.setAttribute('newbie', '');
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.removeAttribute('newbie');
|
|
74
|
-
}
|
|
75
|
-
const url = (_b = this.notification) === null || _b === void 0 ? void 0 : _b.url;
|
|
76
|
-
this.target = url && !isOriginSameAsLocation(url) && '_blank';
|
|
77
|
-
}
|
|
78
|
-
async decipherErrorCode() {
|
|
79
|
-
if (this.type != 'ERROR' || !this.notification) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const { title, body } = this.notification;
|
|
83
|
-
var code = `${title}`;
|
|
84
|
-
if (body) {
|
|
85
|
-
code += `: ${body}`;
|
|
86
|
-
}
|
|
87
|
-
const response = await client.query({
|
|
88
|
-
query: gql `
|
|
89
|
-
query ($input: CodeDecipherInput!) {
|
|
90
|
-
decipherErrorCode(input: $input) {
|
|
91
|
-
message
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
`,
|
|
95
|
-
variables: {
|
|
96
|
-
input: {
|
|
97
|
-
code,
|
|
98
|
-
system: ''
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
this.detail = response.data.decipherErrorCode;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
NotificationItem.styles = [
|
|
106
|
-
css `
|
|
29
|
+
static { this.styles = [
|
|
30
|
+
css `
|
|
107
31
|
:host {
|
|
108
32
|
position: relative;
|
|
109
33
|
background-color: var(--md-sys-color-surface);
|
|
@@ -224,7 +148,82 @@ NotificationItem.styles = [
|
|
|
224
148
|
color: var(--md-sys-color-on-surface-variant);
|
|
225
149
|
}
|
|
226
150
|
`
|
|
227
|
-
];
|
|
151
|
+
]; }
|
|
152
|
+
render() {
|
|
153
|
+
const { title, url, image, timestamp, body } = this.notification;
|
|
154
|
+
const target = this.target;
|
|
155
|
+
const detail = this.detail;
|
|
156
|
+
const type = this.type;
|
|
157
|
+
return html `
|
|
158
|
+
<div titler>
|
|
159
|
+
<span></span>
|
|
160
|
+
${url
|
|
161
|
+
? target
|
|
162
|
+
? html `<a href=${url} target=${target}>${title}</a>`
|
|
163
|
+
: html `<a href=${url}>${title}</a>`
|
|
164
|
+
: title}
|
|
165
|
+
</div>
|
|
166
|
+
<md-icon close @click=${e => this.dispatchEvent(new CustomEvent('close'))}>close</md-icon>
|
|
167
|
+
|
|
168
|
+
${image
|
|
169
|
+
? url
|
|
170
|
+
? target
|
|
171
|
+
? html `<a href=${url} target=${target}><img src=${image} /></a>`
|
|
172
|
+
: html `<a href=${url}><img src=${image} /></a>`
|
|
173
|
+
: html `<img src=${image} />`
|
|
174
|
+
: html ``}
|
|
175
|
+
<div message>${body}</div>
|
|
176
|
+
${type == 'ERROR'
|
|
177
|
+
? html `<div
|
|
178
|
+
@click=${() => {
|
|
179
|
+
this.decipherErrorCode();
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
182
|
+
<span class="more"><md-icon>expand_circle_down</md-icon> more</span>
|
|
183
|
+
</div>`
|
|
184
|
+
: html ``}
|
|
185
|
+
${detail ? html `<div detail>${detail.message}</div>` : html ``}
|
|
186
|
+
|
|
187
|
+
<div timestamp>${new Date(Number(timestamp)).toLocaleString()}</div>
|
|
188
|
+
`;
|
|
189
|
+
}
|
|
190
|
+
updated(changed) {
|
|
191
|
+
if (!this.notification?.confirmed) {
|
|
192
|
+
this.setAttribute('newbie', '');
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
this.removeAttribute('newbie');
|
|
196
|
+
}
|
|
197
|
+
const url = this.notification?.url;
|
|
198
|
+
this.target = url && !isOriginSameAsLocation(url) && '_blank';
|
|
199
|
+
}
|
|
200
|
+
async decipherErrorCode() {
|
|
201
|
+
if (this.type != 'ERROR' || !this.notification) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const { title, body } = this.notification;
|
|
205
|
+
var code = `${title}`;
|
|
206
|
+
if (body) {
|
|
207
|
+
code += `: ${body}`;
|
|
208
|
+
}
|
|
209
|
+
const response = await client.query({
|
|
210
|
+
query: gql `
|
|
211
|
+
query ($input: CodeDecipherInput!) {
|
|
212
|
+
decipherErrorCode(input: $input) {
|
|
213
|
+
message
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
`,
|
|
217
|
+
variables: {
|
|
218
|
+
input: {
|
|
219
|
+
code,
|
|
220
|
+
system: ''
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
this.detail = response.data.decipherErrorCode;
|
|
225
|
+
}
|
|
226
|
+
};
|
|
228
227
|
__decorate([
|
|
229
228
|
property({ type: String, reflect: true }),
|
|
230
229
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-item.js","sourceRoot":"","sources":["../../client/viewparts/notification-item.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,SAAS,sBAAsB,CAAC,GAAG;IACj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AAC/C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;gDAAiB;AAjIlC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAmN5B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport gql from 'graphql-tag'\nimport { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\n\nfunction isOriginSameAsLocation(url) {\n function defaultPort(protocol) {\n return { 'http:': 80, 'https:': 443 }[protocol]\n }\n\n function portOf(location) {\n return location.port || defaultPort(location.protocol || pageLocation.protocol)\n }\n\n try {\n var pageLocation = window.location\n var urlparts = new URL(url, pageLocation.href)\n\n return !!(\n urlparts.protocol &&\n urlparts.protocol == pageLocation.protocol &&\n urlparts.host &&\n urlparts.host == pageLocation.host &&\n urlparts.host &&\n portOf(urlparts) == portOf(pageLocation)\n )\n } catch (err) {\n console.warn(err, url)\n }\n}\n\n@customElement('notification-item')\nexport class NotificationItem extends LitElement {\n static styles = [\n css`\n :host {\n position: relative;\n background-color: var(--md-sys-color-surface);\n padding: var(--spacing-medium);\n border-left: 0 solid transparent;\n border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;\n transition:\n border-left 200ms ease-in-out,\n padding-left 200ms ease-in-out;\n color: var(--md-sys-color-on-surface);\n\n --type-dot-size: 9px;\n }\n\n :host([newbie]) {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n :host(:hover) {\n padding-left: 0.5rem;\n border-left: 0.2rem solid var(--status-info-color);\n }\n\n [titler] {\n white-space: normal;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: var(--fontsize-large);\n font-weight: bold;\n color: var(--md-sys-color-secondary);\n }\n\n [titler] span {\n display: inline-block;\n width: var(--type-dot-size);\n height: var(--type-dot-size);\n border-radius: 50%;\n margin-right: var(--spacing-small);\n margin-bottom: var(--spacing-tiny);\n }\n [titler] * {\n vertical-align: middle;\n }\n\n [close] {\n position: absolute;\n top: 13px;\n right: 0;\n font-size: var(--fontsize-large);\n opacity: 0.5;\n cursor: pointer;\n }\n [close]:hover {\n opacity: 1;\n }\n [detail] {\n padding: var(--spacing-small) var(--spacing-medium);\n border-radius: var(--border-radius);\n font-size: 0.85em;\n }\n span.more {\n margin-left: 16px;\n float: right;\n padding: 0px var(--spacing-small) 2px var(--spacing-small);\n border-radius: var(--border-radius);\n font-size: 0.8em;\n color: var(--md-sys-color-on-primary);\n --md-icon-size: 14px;\n }\n span.more * {\n vertical-align: middle;\n }\n\n :host([type='ERROR']) span {\n background-color: var(--status-danger-color);\n }\n :host([type='ERROR']) {\n border-color: var(--status-danger-color);\n }\n :host([type='ERROR']) [detail] {\n border: 1px solid rgba(241, 53, 63, 0.5);\n background-color: rgba(241, 53, 63, 0.1);\n }\n :host([type='WARN']) span {\n background-color: var(--status-warning-color);\n }\n :host([type='WARN']) {\n border-color: var(--status-warning-color);\n }\n :host([type='SUCCESS']) span {\n background-color: var(--status-success-color);\n }\n :host([type='SUCCESS']) {\n border-color: var(--status-success-color);\n }\n :host([type='INFO']) span,\n :host span {\n background-color: var(--status-info-color);\n }\n :host([type='INFO']) {\n border-color: var(--status-info-color);\n }\n\n img {\n display: block;\n max-width: 100%;\n margin: auto;\n }\n\n [message] {\n font-size: var(--fontsize-default);\n color: var(--md-sys-color-secondary);\n }\n\n [timestamp] {\n white-space: nowrap;\n font-size: var(--fontsize-small);\n color: var(--md-sys-color-on-surface-variant);\n }\n `\n ]\n\n @property({ type: String, reflect: true }) type?: string\n @property({ type: Object }) notification: any\n @property({ type: String }) target?: string\n @property({ type: Object }) detail?: { message: string; [key: string]: any }\n @property({ type: Boolean }) newbie?: boolean\n\n render() {\n const { title, url, image, timestamp, body } = this.notification\n const target = this.target\n const detail = this.detail\n const type = this.type\n\n return html`\n <div titler>\n <span></span>\n ${url\n ? target\n ? html`<a href=${url} target=${target}>${title}</a>`\n : html`<a href=${url}>${title}</a>`\n : title}\n </div>\n <md-icon close @click=${e => this.dispatchEvent(new CustomEvent('close'))}>close</md-icon>\n\n ${image\n ? url\n ? target\n ? html`<a href=${url} target=${target}><img src=${image} /></a>`\n : html`<a href=${url}><img src=${image} /></a>`\n : html`<img src=${image} />`\n : html``}\n <div message>${body}</div>\n ${type == 'ERROR'\n ? html`<div\n @click=${() => {\n this.decipherErrorCode()\n }}\n >\n <span class=\"more\"><md-icon>expand_circle_down</md-icon> more</span>\n </div>`\n : html``}\n ${detail ? html`<div detail>${detail.message}</div>` : html``}\n\n <div timestamp>${new Date(Number(timestamp)).toLocaleString()}</div>\n `\n }\n\n updated(changed) {\n if (!this.notification?.confirmed) {\n this.setAttribute('newbie', '')\n } else {\n this.removeAttribute('newbie')\n }\n\n const url = this.notification?.url\n this.target = url && !isOriginSameAsLocation(url) && '_blank'\n }\n\n async decipherErrorCode() {\n if (this.type != 'ERROR' || !this.notification) {\n return\n }\n\n const { title, body } = this.notification\n var code = `${title}`\n if (body) {\n code += `: ${body}`\n }\n\n const response = await client.query({\n query: gql`\n query ($input: CodeDecipherInput!) {\n decipherErrorCode(input: $input) {\n message\n }\n }\n `,\n variables: {\n input: {\n code,\n system: ''\n }\n }\n })\n\n this.detail = response.data.decipherErrorCode\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"notification-item.js","sourceRoot":"","sources":["../../client/viewparts/notification-item.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,SAAS,sBAAsB,CAAC,GAAG;IACjC,SAAS,WAAW,CAAC,QAAQ;QAC3B,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG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C;GACtB,gBAAgB,CAmN5B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport gql from 'graphql-tag'\nimport { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\n\nfunction isOriginSameAsLocation(url) {\n function defaultPort(protocol) {\n return { 'http:': 80, 'https:': 443 }[protocol]\n }\n\n function portOf(location) {\n return location.port || defaultPort(location.protocol || pageLocation.protocol)\n }\n\n try {\n var pageLocation = window.location\n var urlparts = new URL(url, pageLocation.href)\n\n return !!(\n urlparts.protocol &&\n urlparts.protocol == pageLocation.protocol &&\n urlparts.host &&\n urlparts.host == pageLocation.host &&\n urlparts.host &&\n portOf(urlparts) == portOf(pageLocation)\n )\n } catch (err) {\n console.warn(err, url)\n }\n}\n\n@customElement('notification-item')\nexport class NotificationItem extends LitElement {\n static styles = [\n css`\n :host {\n position: relative;\n background-color: var(--md-sys-color-surface);\n padding: var(--spacing-medium);\n border-left: 0 solid transparent;\n border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;\n transition:\n border-left 200ms ease-in-out,\n padding-left 200ms ease-in-out;\n color: var(--md-sys-color-on-surface);\n\n --type-dot-size: 9px;\n }\n\n :host([newbie]) {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n :host(:hover) {\n padding-left: 0.5rem;\n border-left: 0.2rem solid var(--status-info-color);\n }\n\n [titler] {\n white-space: normal;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: var(--fontsize-large);\n font-weight: bold;\n color: var(--md-sys-color-secondary);\n }\n\n [titler] span {\n display: inline-block;\n width: var(--type-dot-size);\n height: var(--type-dot-size);\n border-radius: 50%;\n margin-right: var(--spacing-small);\n margin-bottom: var(--spacing-tiny);\n }\n [titler] * {\n vertical-align: middle;\n }\n\n [close] {\n position: absolute;\n top: 13px;\n right: 0;\n font-size: var(--fontsize-large);\n opacity: 0.5;\n cursor: pointer;\n }\n [close]:hover {\n opacity: 1;\n }\n [detail] {\n padding: var(--spacing-small) var(--spacing-medium);\n border-radius: var(--border-radius);\n font-size: 0.85em;\n }\n span.more {\n margin-left: 16px;\n float: right;\n padding: 0px var(--spacing-small) 2px var(--spacing-small);\n border-radius: var(--border-radius);\n font-size: 0.8em;\n color: var(--md-sys-color-on-primary);\n --md-icon-size: 14px;\n }\n span.more * {\n vertical-align: middle;\n }\n\n :host([type='ERROR']) span {\n background-color: var(--status-danger-color);\n }\n :host([type='ERROR']) {\n border-color: var(--status-danger-color);\n }\n :host([type='ERROR']) [detail] {\n border: 1px solid rgba(241, 53, 63, 0.5);\n background-color: rgba(241, 53, 63, 0.1);\n }\n :host([type='WARN']) span {\n background-color: var(--status-warning-color);\n }\n :host([type='WARN']) {\n border-color: var(--status-warning-color);\n }\n :host([type='SUCCESS']) span {\n background-color: var(--status-success-color);\n }\n :host([type='SUCCESS']) {\n border-color: var(--status-success-color);\n }\n :host([type='INFO']) span,\n :host span {\n background-color: var(--status-info-color);\n }\n :host([type='INFO']) {\n border-color: var(--status-info-color);\n }\n\n img {\n display: block;\n max-width: 100%;\n margin: auto;\n }\n\n [message] {\n font-size: var(--fontsize-default);\n color: var(--md-sys-color-secondary);\n }\n\n [timestamp] {\n white-space: nowrap;\n font-size: var(--fontsize-small);\n color: var(--md-sys-color-on-surface-variant);\n }\n `\n ]\n\n @property({ type: String, reflect: true }) type?: string\n @property({ type: Object }) notification: any\n @property({ type: String }) target?: string\n @property({ type: Object }) detail?: { message: string; [key: string]: any }\n @property({ type: Boolean }) newbie?: boolean\n\n render() {\n const { title, url, image, timestamp, body } = this.notification\n const target = this.target\n const detail = this.detail\n const type = this.type\n\n return html`\n <div titler>\n <span></span>\n ${url\n ? target\n ? html`<a href=${url} target=${target}>${title}</a>`\n : html`<a href=${url}>${title}</a>`\n : title}\n </div>\n <md-icon close @click=${e => this.dispatchEvent(new CustomEvent('close'))}>close</md-icon>\n\n ${image\n ? url\n ? target\n ? html`<a href=${url} target=${target}><img src=${image} /></a>`\n : html`<a href=${url}><img src=${image} /></a>`\n : html`<img src=${image} />`\n : html``}\n <div message>${body}</div>\n ${type == 'ERROR'\n ? html`<div\n @click=${() => {\n this.decipherErrorCode()\n }}\n >\n <span class=\"more\"><md-icon>expand_circle_down</md-icon> more</span>\n </div>`\n : html``}\n ${detail ? html`<div detail>${detail.message}</div>` : html``}\n\n <div timestamp>${new Date(Number(timestamp)).toLocaleString()}</div>\n `\n }\n\n updated(changed) {\n if (!this.notification?.confirmed) {\n this.setAttribute('newbie', '')\n } else {\n this.removeAttribute('newbie')\n }\n\n const url = this.notification?.url\n this.target = url && !isOriginSameAsLocation(url) && '_blank'\n }\n\n async decipherErrorCode() {\n if (this.type != 'ERROR' || !this.notification) {\n return\n }\n\n const { title, body } = this.notification\n var code = `${title}`\n if (body) {\n code += `: ${body}`\n }\n\n const response = await client.query({\n query: gql`\n query ($input: CodeDecipherInput!) {\n decipherErrorCode(input: $input) {\n message\n }\n }\n `,\n variables: {\n input: {\n code,\n system: ''\n }\n }\n })\n\n this.detail = response.data.decipherErrorCode\n }\n}\n"]}
|
|
@@ -13,6 +13,59 @@ let NotificationList = class NotificationList extends connect(store)(localize(i1
|
|
|
13
13
|
super(...arguments);
|
|
14
14
|
this.history = [];
|
|
15
15
|
}
|
|
16
|
+
static { this.styles = [
|
|
17
|
+
css `
|
|
18
|
+
:host {
|
|
19
|
+
display: block;
|
|
20
|
+
background-color: var(--md-sys-color-surface);
|
|
21
|
+
box-shadow: var(--box-shadow);
|
|
22
|
+
margin-right: var(--spacing-large);
|
|
23
|
+
padding: var(--spacing-medium);
|
|
24
|
+
max-height: 100%;
|
|
25
|
+
overflow-x: hidden;
|
|
26
|
+
overflow-y: auto;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[notifications-wrap] {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
justify-content: flex-start;
|
|
33
|
+
}
|
|
34
|
+
[notifications-wrap] div {
|
|
35
|
+
align-items: stretch;
|
|
36
|
+
border-bottom: 1px solid var(--md-sys-color-primary);
|
|
37
|
+
}
|
|
38
|
+
[notifications-wrap] strong {
|
|
39
|
+
color: var(--md-sys-color-primary);
|
|
40
|
+
text-transform: capitalize;
|
|
41
|
+
line-height: 2;
|
|
42
|
+
}
|
|
43
|
+
[notifications-wrap] md-elevated-button {
|
|
44
|
+
--md-elevated-button-container-height: 24px;
|
|
45
|
+
float: right;
|
|
46
|
+
padding-inline-start: 6px;
|
|
47
|
+
padding-inline-end: 12px;
|
|
48
|
+
}
|
|
49
|
+
[no-notifications] {
|
|
50
|
+
margin: 0;
|
|
51
|
+
padding: var(--spacing-large);
|
|
52
|
+
text-align: center;
|
|
53
|
+
font-size: var(--fontsize-default);
|
|
54
|
+
font-weight: bold;
|
|
55
|
+
color: var(--md-sys-color-secondary);
|
|
56
|
+
}
|
|
57
|
+
div md-icon {
|
|
58
|
+
display: block;
|
|
59
|
+
opacity: 0.3;
|
|
60
|
+
}
|
|
61
|
+
@media screen and (max-width: 480px) {
|
|
62
|
+
:host {
|
|
63
|
+
height: 100%;
|
|
64
|
+
width: 100vw;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`
|
|
68
|
+
]; }
|
|
16
69
|
render() {
|
|
17
70
|
var history = this.history.reverse();
|
|
18
71
|
return history.length > 0
|
|
@@ -72,7 +125,10 @@ let NotificationList = class NotificationList extends connect(store)(localize(i1
|
|
|
72
125
|
await Promise.all(this.history
|
|
73
126
|
.filter(notification => !notification.confirmed)
|
|
74
127
|
.map(async (notification) => {
|
|
75
|
-
return await notificationStore.put(
|
|
128
|
+
return await notificationStore.put({
|
|
129
|
+
...notification,
|
|
130
|
+
confirmed: true
|
|
131
|
+
});
|
|
76
132
|
}));
|
|
77
133
|
store.dispatch((async (dispatch) => {
|
|
78
134
|
const history = await notificationStore.getAll();
|
|
@@ -83,59 +139,6 @@ let NotificationList = class NotificationList extends connect(store)(localize(i1
|
|
|
83
139
|
}));
|
|
84
140
|
}
|
|
85
141
|
};
|
|
86
|
-
NotificationList.styles = [
|
|
87
|
-
css `
|
|
88
|
-
:host {
|
|
89
|
-
display: block;
|
|
90
|
-
background-color: var(--md-sys-color-surface);
|
|
91
|
-
box-shadow: var(--box-shadow);
|
|
92
|
-
margin-right: var(--spacing-large);
|
|
93
|
-
padding: var(--spacing-medium);
|
|
94
|
-
max-height: 100%;
|
|
95
|
-
overflow-x: hidden;
|
|
96
|
-
overflow-y: auto;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
[notifications-wrap] {
|
|
100
|
-
display: flex;
|
|
101
|
-
flex-direction: column;
|
|
102
|
-
justify-content: flex-start;
|
|
103
|
-
}
|
|
104
|
-
[notifications-wrap] div {
|
|
105
|
-
align-items: stretch;
|
|
106
|
-
border-bottom: 1px solid var(--md-sys-color-primary);
|
|
107
|
-
}
|
|
108
|
-
[notifications-wrap] strong {
|
|
109
|
-
color: var(--md-sys-color-primary);
|
|
110
|
-
text-transform: capitalize;
|
|
111
|
-
line-height: 2;
|
|
112
|
-
}
|
|
113
|
-
[notifications-wrap] md-elevated-button {
|
|
114
|
-
--md-elevated-button-container-height: 24px;
|
|
115
|
-
float: right;
|
|
116
|
-
padding-inline-start: 6px;
|
|
117
|
-
padding-inline-end: 12px;
|
|
118
|
-
}
|
|
119
|
-
[no-notifications] {
|
|
120
|
-
margin: 0;
|
|
121
|
-
padding: var(--spacing-large);
|
|
122
|
-
text-align: center;
|
|
123
|
-
font-size: var(--fontsize-default);
|
|
124
|
-
font-weight: bold;
|
|
125
|
-
color: var(--md-sys-color-secondary);
|
|
126
|
-
}
|
|
127
|
-
div md-icon {
|
|
128
|
-
display: block;
|
|
129
|
-
opacity: 0.3;
|
|
130
|
-
}
|
|
131
|
-
@media screen and (max-width: 480px) {
|
|
132
|
-
:host {
|
|
133
|
-
height: 100%;
|
|
134
|
-
width: 100vw;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
`
|
|
138
|
-
];
|
|
139
142
|
__decorate([
|
|
140
143
|
property({ type: Array }),
|
|
141
144
|
__metadata("design:type", Array)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-list.js","sourceRoot":"","sources":["../../client/viewparts/notification-list.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAG1D,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC;IAA5E;;QAuDsB,YAAO,GAAU,EAAE,CAAA;IA4FhD,CAAC;
|
|
1
|
+
{"version":3,"file":"notification-list.js","sourceRoot":"","sources":["../../client/viewparts/notification-list.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,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M,EAAE,CAAA;YAEhD,QAAQ,CAAC;gBACP,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;aACtB,CAAC,CAAA;QACJ,CAAC,CAAQ,CAAC,CAAA;IACZ,CAAC;;AA3F0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;iDAAoB;AAvDnC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAmJ5B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/button/elevated-button.js'\nimport './notification-item'\n\nimport { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers'\nimport { store, notificationStore } from '@operato/shell'\nimport { i18next, localize } from '@operato/i18n'\nimport { UPDATE_NOTIFICATION } from '../actions/notification-fcm'\n\n@customElement('notification-list')\nexport class NotificationList extends connect(store)(localize(i18next)(LitElement)) {\n static styles = [\n css`\n :host {\n display: block;\n background-color: var(--md-sys-color-surface);\n box-shadow: var(--box-shadow);\n margin-right: var(--spacing-large);\n padding: var(--spacing-medium);\n max-height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n [notifications-wrap] {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n }\n [notifications-wrap] div {\n align-items: stretch;\n border-bottom: 1px solid var(--md-sys-color-primary);\n }\n [notifications-wrap] strong {\n color: var(--md-sys-color-primary);\n text-transform: capitalize;\n line-height: 2;\n }\n [notifications-wrap] md-elevated-button {\n --md-elevated-button-container-height: 24px;\n float: right;\n padding-inline-start: 6px;\n padding-inline-end: 12px;\n }\n [no-notifications] {\n margin: 0;\n padding: var(--spacing-large);\n text-align: center;\n font-size: var(--fontsize-default);\n font-weight: bold;\n color: var(--md-sys-color-secondary);\n }\n div md-icon {\n display: block;\n opacity: 0.3;\n }\n @media screen and (max-width: 480px) {\n :host {\n height: 100%;\n width: 100vw;\n }\n }\n `\n ]\n\n @property({ type: Array }) history: any[] = []\n\n render() {\n var history = this.history.reverse()\n\n return history.length > 0\n ? html`\n <div notifications-wrap>\n <div>\n <strong>${i18next.t('label.notification list')}</strong>\n <md-elevated-button outlined dense @click=${e => this.onclearall()}\n ><md-icon slot=\"icon\">delete_outline</md-icon>${String(\n i18next.t('label.clear all')\n )}</md-elevated-button\n >\n </div>\n ${history.map(\n notification => html`\n <notification-item\n @close=${e => {\n this.onClose(notification)\n }}\n .type=${notification.type}\n .notification=${notification}\n ></notification-item>\n `\n )}\n </div>\n `\n : html`\n <div no-notifications @click=${e => window.history.back()}>\n <md-icon>notifications_off</md-icon>${i18next.t('text.no notification available')}\n </div>\n `\n }\n\n onClose(notification) {\n const { id } = notification\n\n store.dispatch((async dispatch => {\n if (notification) {\n await notificationStore.delete(id)\n }\n\n const history = await notificationStore.getAll()\n\n dispatch({\n type: UPDATE_NOTIFICATION,\n history: [...history]\n })\n }) as any)\n }\n\n onclearall() {\n store.dispatch((async dispatch => {\n await notificationStore.clear()\n const history = await notificationStore.getAll()\n\n dispatch({\n type: UPDATE_NOTIFICATION,\n history: [...history]\n })\n }) as any)\n }\n\n stateChanged(state) {\n this.history = state.notification.history\n }\n\n async disconnectedCallback() {\n super.disconnectedCallback()\n\n await Promise.all(\n this.history\n .filter(notification => !notification.confirmed)\n .map(async notification => {\n return await notificationStore.put({\n ...notification,\n confirmed: true\n })\n })\n )\n\n store.dispatch((async dispatch => {\n const history = await notificationStore.getAll()\n\n dispatch({\n type: UPDATE_NOTIFICATION,\n history: [...history]\n })\n }) as any)\n }\n}\n"]}
|
|
@@ -10,8 +10,61 @@ import { i18next, localize } from '@operato/i18n';
|
|
|
10
10
|
import { ScrollbarStyles } from '@operato/styles';
|
|
11
11
|
import { notify as webpushNotify } from '../actions/notification-fcm';
|
|
12
12
|
let NotificationSender = class NotificationSender extends localize(i18next)(LitElement) {
|
|
13
|
+
static { this.styles = [
|
|
14
|
+
ScrollbarStyles,
|
|
15
|
+
css `
|
|
16
|
+
:host {
|
|
17
|
+
display: flex;
|
|
18
|
+
padding: var(--spacing-large);
|
|
19
|
+
background-color: var(--md-sys-color-background);
|
|
20
|
+
color: var(--md-sys-color-on-background);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
form {
|
|
24
|
+
flex: 1;
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[content] > * {
|
|
30
|
+
margin: var(--spacing-medium);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[content] {
|
|
34
|
+
flex: 1;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
display: flex;
|
|
37
|
+
overflow: auto;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
[buttons] {
|
|
41
|
+
margin-top: auto;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: row-reverse;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[name='body'] {
|
|
47
|
+
resize: vertical;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
md-elevated-button {
|
|
51
|
+
margin-left: var(--spacing-medium);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
label {
|
|
55
|
+
display: flex;
|
|
56
|
+
gap: var(--spacing-medium);
|
|
57
|
+
align-items: center;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media screen and (max-width: 480px) {
|
|
61
|
+
:host {
|
|
62
|
+
padding: var(--spacing-medium);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`
|
|
66
|
+
]; }
|
|
13
67
|
render() {
|
|
14
|
-
var _a;
|
|
15
68
|
return html `
|
|
16
69
|
<form>
|
|
17
70
|
<div content>
|
|
@@ -19,7 +72,7 @@ let NotificationSender = class NotificationSender extends localize(i18next)(LitE
|
|
|
19
72
|
type="text"
|
|
20
73
|
name="receivers"
|
|
21
74
|
label=${String(i18next.t('field.receivers'))}
|
|
22
|
-
placeholder=${
|
|
75
|
+
placeholder=${auth.credential?.email}
|
|
23
76
|
required
|
|
24
77
|
><md-icon slot="leading-icon">account_circle</md-icon></md-filled-text-field
|
|
25
78
|
>
|
|
@@ -76,60 +129,6 @@ let NotificationSender = class NotificationSender extends localize(i18next)(LitE
|
|
|
76
129
|
this.renderRoot.querySelector(`[name="inappmsg"]`).checked = false;
|
|
77
130
|
}
|
|
78
131
|
};
|
|
79
|
-
NotificationSender.styles = [
|
|
80
|
-
ScrollbarStyles,
|
|
81
|
-
css `
|
|
82
|
-
:host {
|
|
83
|
-
display: flex;
|
|
84
|
-
padding: var(--spacing-large);
|
|
85
|
-
background-color: var(--md-sys-color-background);
|
|
86
|
-
color: var(--md-sys-color-on-background);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
form {
|
|
90
|
-
flex: 1;
|
|
91
|
-
display: flex;
|
|
92
|
-
flex-direction: column;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
[content] > * {
|
|
96
|
-
margin: var(--spacing-medium);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
[content] {
|
|
100
|
-
flex: 1;
|
|
101
|
-
flex-direction: column;
|
|
102
|
-
display: flex;
|
|
103
|
-
overflow: auto;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
[buttons] {
|
|
107
|
-
margin-top: auto;
|
|
108
|
-
display: flex;
|
|
109
|
-
flex-direction: row-reverse;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
[name='body'] {
|
|
113
|
-
resize: vertical;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
md-elevated-button {
|
|
117
|
-
margin-left: var(--spacing-medium);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
label {
|
|
121
|
-
display: flex;
|
|
122
|
-
gap: var(--spacing-medium);
|
|
123
|
-
align-items: center;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@media screen and (max-width: 480px) {
|
|
127
|
-
:host {
|
|
128
|
-
padding: var(--spacing-medium);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
`
|
|
132
|
-
];
|
|
133
132
|
NotificationSender = __decorate([
|
|
134
133
|
customElement('notification-sender')
|
|
135
134
|
], NotificationSender);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-sender.js","sourceRoot":"","sources":["../../client/viewparts/notification-sender.ts"],"names":[],"mappings":";AAAA,OAAO,yCAAyC,CAAA;AAChD,OAAO,oCAAoC,CAAA;AAC3C,OAAO,8CAA8C,CAAA;AACrD,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,+CAA+C,CAAA;AAEpE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAG9D,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"notification-sender.js","sourceRoot":"","sources":["../../client/viewparts/notification-sender.ts"],"names":[],"mappings":";AAAA,OAAO,yCAAyC,CAAA;AAChD,OAAO,oCAAoC,CAAA;AAC3C,OAAO,8CAA8C,CAAA;AACrD,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,+CAA+C,CAAA;AAEpE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OA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aAAa,CAAC,mBAAmB,CAAU,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAA;QAE1G,aAAa,CAAC;YACZ,SAAS;YACT,KAAK;YACL,IAAI;YACJ,KAAK;YACL,IAAI;YACJ,GAAG;SACJ,CAAC,CAAA;IACJ,CAAC;IAED,OAAO;QACL,CAAC;QAAA,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,GAAG,CACjD,GAAG,CAAC,EAAE,CAAC,CAAE,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,UAAU,GAAG,IAAI,CAAU,CAAC,KAAK,GAAG,EAAE,CAAC,CAC/E,CACA;QAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,mBAAmB,CAAU,CAAC,OAAO,GAAG,KAAK,CAAA;IAC/E,CAAC;;AA7HU,kBAAkB;IAD9B,aAAa,CAAC,qBAAqB,CAAC;GACxB,kBAAkB,CA8H9B","sourcesContent":["import '@material/web/button/elevated-button.js'\nimport '@material/web/checkbox/checkbox.js'\nimport '@material/web/textfield/filled-text-field.js'\nimport '@operato/i18n/ox-i18n.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport { auth } from '@things-factory/auth-base/dist-client/auth.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport { notify as webpushNotify } from '../actions/notification-fcm'\n\n@customElement('notification-sender')\nexport class NotificationSender extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n padding: var(--spacing-large);\n background-color: var(--md-sys-color-background);\n color: var(--md-sys-color-on-background);\n }\n\n form {\n flex: 1;\n display: flex;\n flex-direction: column;\n }\n\n [content] > * {\n margin: var(--spacing-medium);\n }\n\n [content] {\n flex: 1;\n flex-direction: column;\n display: flex;\n overflow: auto;\n }\n\n [buttons] {\n margin-top: auto;\n display: flex;\n flex-direction: row-reverse;\n }\n\n [name='body'] {\n resize: vertical;\n }\n\n md-elevated-button {\n margin-left: var(--spacing-medium);\n }\n\n label {\n display: flex;\n gap: var(--spacing-medium);\n align-items: center;\n }\n\n @media screen and (max-width: 480px) {\n :host {\n padding: var(--spacing-medium);\n }\n }\n `\n ]\n\n render() {\n return html`\n <form>\n <div content>\n <md-filled-text-field\n type=\"text\"\n name=\"receivers\"\n label=${String(i18next.t('field.receivers'))}\n placeholder=${auth.credential?.email}\n required\n ><md-icon slot=\"leading-icon\">account_circle</md-icon></md-filled-text-field\n >\n <md-filled-text-field type=\"text\" name=\"title\" label=${String(i18next.t('field.title'))} required\n ><md-icon slot=\"leading-icon\">notifications_none</md-icon></md-filled-text-field\n >\n\n <md-filled-text-field type=\"text\" name=\"image\" label=${String(i18next.t('field.image'))}\n ><md-icon slot=\"leading-icon\">insert_photo</md-icon></md-filled-text-field\n >\n <md-filled-text-field type=\"text\" name=\"url\" label=${String(i18next.t('field.url'))}\n ><md-icon slot=\"leading-icon\">link</md-icon></md-filled-text-field\n >\n <md-filled-text-field\n type=\"textarea\"\n name=\"body\"\n label=${String(i18next.t('field.body'))}\n required\n rows=\"5\"\n ></md-filled-text-field>\n <label>\n <md-checkbox name=\"inappmsg\"></md-checkbox>\n In-App Message\n </label>\n </div>\n\n <div buttons>\n <md-elevated-button raised icon=\"send\" @click=${e => this.ontest()}>\n <ox-i18n msgid=\"button.notification-send\"> </ox-i18n>\n </md-elevated-button>\n\n <md-elevated-button type=\"reset\" outlined @click=${e => this.onReset()}>\n <ox-i18n msgid=\"button.reset\"> </ox-i18n>\n </md-elevated-button>\n </div>\n </form>\n `\n }\n\n ontest() {\n const [receivers, title, body, image, url] = ['receivers', 'title', 'body', 'image', 'url'].map(\n key => (this.renderRoot.querySelector(`[name=\"${key}\"]`)! as any).value\n )\n const mode = (this.renderRoot.querySelector(`[name=\"inappmsg\"]`)! as any).checked ? 'inapp' : 'background'\n\n webpushNotify({\n receivers,\n title,\n body,\n image,\n mode,\n url\n })\n }\n\n onReset() {\n ;['receivers', 'title', 'body', 'image', 'url'].map(\n key => ((this.renderRoot.querySelector(`[name=\"${key}\"]`)! as any).value = '')\n )\n ;(this.renderRoot.querySelector(`[name=\"inappmsg\"]`)! as any).checked = false\n }\n}\n"]}
|