@open-pioneer/notifier 0.1.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/CHANGELOG.md +12 -0
- package/LICENSE +202 -0
- package/NotificationServiceImpl.d.ts +36 -0
- package/NotificationServiceImpl.js +90 -0
- package/NotificationServiceImpl.js.map +1 -0
- package/Notifier.d.ts +30 -0
- package/Notifier.js +45 -0
- package/Notifier.js.map +1 -0
- package/README.md +96 -0
- package/_virtual/_virtual-pioneer-module_react-hooks.js +7 -0
- package/_virtual/_virtual-pioneer-module_react-hooks.js.map +1 -0
- package/api.d.ts +49 -0
- package/index.d.ts +2 -0
- package/index.js +3 -0
- package/index.js.map +1 -0
- package/package.json +54 -0
- package/services.d.ts +1 -0
- package/services.js +2 -0
- package/services.js.map +1 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { NotificationLevel, NotificationOptions, NotificationService } from "./api";
|
|
2
|
+
import { Resource } from "@open-pioneer/core";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
export interface Notification {
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
message: ReactNode;
|
|
7
|
+
level: NotificationLevel;
|
|
8
|
+
displayDuration: number | undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The notification handler is implemented by the UI in order to receive events.
|
|
12
|
+
* There can only be one handler at a time.
|
|
13
|
+
*
|
|
14
|
+
* Calls to the handler may be buffered to allow for notifications before the UI has become ready.
|
|
15
|
+
*/
|
|
16
|
+
export interface NotificationHandler {
|
|
17
|
+
/** Called by the service to emit the notification. */
|
|
18
|
+
showNotification(notification: Notification): void;
|
|
19
|
+
/** Removes all active notifications. */
|
|
20
|
+
closeAll(): void;
|
|
21
|
+
}
|
|
22
|
+
export interface InternalNotificationAPI extends NotificationService {
|
|
23
|
+
/**
|
|
24
|
+
* Registers the notification handler.
|
|
25
|
+
* The returned resource can be used to unregister it again.
|
|
26
|
+
*/
|
|
27
|
+
registerHandler(handler: NotificationHandler): Resource;
|
|
28
|
+
}
|
|
29
|
+
export declare class NotificationServiceImpl implements InternalNotificationAPI {
|
|
30
|
+
#private;
|
|
31
|
+
constructor();
|
|
32
|
+
destroy(): void;
|
|
33
|
+
notify(options: NotificationOptions): void;
|
|
34
|
+
closeAll(): void;
|
|
35
|
+
registerHandler(handler: NotificationHandler): Resource;
|
|
36
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { createLogger } from '@open-pioneer/core';
|
|
2
|
+
|
|
3
|
+
const LOG = createLogger("notifier:NotificationService");
|
|
4
|
+
class NotificationServiceImpl {
|
|
5
|
+
#handler;
|
|
6
|
+
#buffered;
|
|
7
|
+
#checkTimeoutId;
|
|
8
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
9
|
+
constructor() {
|
|
10
|
+
if (import.meta.env.DEV) {
|
|
11
|
+
this.#checkTimeoutId = setTimeout(() => {
|
|
12
|
+
this.#checkHandlerRegistration();
|
|
13
|
+
this.#checkTimeoutId = void 0;
|
|
14
|
+
}, 5e3);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
destroy() {
|
|
18
|
+
clearTimeout(this.#checkTimeoutId);
|
|
19
|
+
this.#checkTimeoutId = void 0;
|
|
20
|
+
}
|
|
21
|
+
notify(options) {
|
|
22
|
+
this.#dispatchHandlerMethod("showNotification", {
|
|
23
|
+
title: options.title ?? void 0,
|
|
24
|
+
message: options.message ?? void 0,
|
|
25
|
+
level: options.level ?? "info",
|
|
26
|
+
displayDuration: options.displayDuration
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
closeAll() {
|
|
30
|
+
this.#dispatchHandlerMethod("closeAll");
|
|
31
|
+
}
|
|
32
|
+
registerHandler(handler) {
|
|
33
|
+
if (this.#handler) {
|
|
34
|
+
LOG.warn(
|
|
35
|
+
"A notification handler has already been registered; this new handler will be ignored.\nThe <Notifier /> component has likely been used twice in your application."
|
|
36
|
+
);
|
|
37
|
+
return {
|
|
38
|
+
destroy() {
|
|
39
|
+
return void 0;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
this.#handler = handler;
|
|
44
|
+
const buffered = this.#buffered;
|
|
45
|
+
this.#buffered = void 0;
|
|
46
|
+
if (buffered) {
|
|
47
|
+
for (const [name, ...args] of buffered) {
|
|
48
|
+
handler[name](...args);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
let destroyed = false;
|
|
52
|
+
return {
|
|
53
|
+
destroy: () => {
|
|
54
|
+
if (destroyed) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
destroyed = true;
|
|
58
|
+
if (this.#handler === handler) {
|
|
59
|
+
this.#handler = void 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
#dispatchHandlerMethod(method, ...args) {
|
|
65
|
+
if (this.#handler) {
|
|
66
|
+
this.#handler[method](...args);
|
|
67
|
+
} else {
|
|
68
|
+
const buffered = this.#buffered ??= [];
|
|
69
|
+
if (buffered.length >= 1024) {
|
|
70
|
+
LOG.error(
|
|
71
|
+
"Internal notification buffer overflow: this event will be dropped to prevent a memory leak.\nMake sure that the UI is configured to display notifications (use <Notifier />).",
|
|
72
|
+
{ method, args }
|
|
73
|
+
);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
buffered.push([method, ...args]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
#checkHandlerRegistration() {
|
|
80
|
+
if (!this.#handler) {
|
|
81
|
+
LOG.warn(
|
|
82
|
+
`No notification handler has been registered: notifications will not be visible.
|
|
83
|
+
Make sure that your app contains the <Notifier /> component.`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { NotificationServiceImpl };
|
|
90
|
+
//# sourceMappingURL=NotificationServiceImpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationServiceImpl.js","sources":["NotificationServiceImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport type { NotificationLevel, NotificationOptions, NotificationService } from \"./api\";\nimport { Resource, createLogger } from \"@open-pioneer/core\";\nimport type { ReactNode } from \"react\";\nconst LOG = createLogger(\"notifier:NotificationService\");\n\nexport interface Notification {\n title: ReactNode;\n message: ReactNode;\n level: NotificationLevel;\n displayDuration: number | undefined;\n}\n\n/**\n * The notification handler is implemented by the UI in order to receive events.\n * There can only be one handler at a time.\n *\n * Calls to the handler may be buffered to allow for notifications before the UI has become ready.\n */\nexport interface NotificationHandler {\n /** Called by the service to emit the notification. */\n showNotification(notification: Notification): void;\n\n /** Removes all active notifications. */\n closeAll(): void;\n}\n\nexport interface InternalNotificationAPI extends NotificationService {\n /**\n * Registers the notification handler.\n * The returned resource can be used to unregister it again.\n */\n registerHandler(handler: NotificationHandler): Resource;\n}\n\nexport class NotificationServiceImpl implements InternalNotificationAPI {\n #handler: NotificationHandler | undefined;\n #buffered: [keyof NotificationHandler, ...unknown[]][] | undefined;\n #checkTimeoutId: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n constructor() {\n if (import.meta.env.DEV) {\n this.#checkTimeoutId = setTimeout(() => {\n this.#checkHandlerRegistration();\n this.#checkTimeoutId = undefined;\n }, 5000);\n }\n }\n\n destroy() {\n clearTimeout(this.#checkTimeoutId);\n this.#checkTimeoutId = undefined;\n }\n\n notify(options: NotificationOptions): void {\n this.#dispatchHandlerMethod(\"showNotification\", {\n title: options.title ?? undefined,\n message: options.message ?? undefined,\n level: options.level ?? \"info\",\n displayDuration: options.displayDuration\n });\n }\n\n closeAll(): void {\n this.#dispatchHandlerMethod(\"closeAll\");\n }\n\n registerHandler(handler: NotificationHandler): Resource {\n // We only support exactly one handler.\n if (this.#handler) {\n LOG.warn(\n \"A notification handler has already been registered; this new handler will be ignored.\\n\" +\n \"The <Notifier /> component has likely been used twice in your application.\"\n );\n return {\n destroy() {\n return undefined;\n }\n };\n }\n\n // Dispatch buffered calls (if any).\n // These happened during the time no handler was registered.\n this.#handler = handler;\n const buffered = this.#buffered;\n this.#buffered = undefined;\n if (buffered) {\n for (const [name, ...args] of buffered) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (handler[name] as any)(...args);\n }\n }\n\n // Return a resource to undo the registration\n let destroyed = false;\n return {\n destroy: () => {\n if (destroyed) {\n return;\n }\n\n destroyed = true;\n if (this.#handler === handler) {\n this.#handler = undefined;\n }\n }\n };\n }\n\n /**\n * Calls a method on the handler (if present) or buffers the method call for later once the handler\n * has arrived.\n */\n #dispatchHandlerMethod<Method extends keyof NotificationHandler>(\n method: Method,\n ...args: Parameters<NotificationHandler[Method]>\n ): void;\n #dispatchHandlerMethod(method: keyof NotificationHandler, ...args: unknown[]): void {\n if (this.#handler) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this.#handler[method] as any)(...args);\n } else {\n const buffered = (this.#buffered ??= []);\n if (buffered.length >= 1024) {\n LOG.error(\n \"Internal notification buffer overflow: this event will be dropped to prevent a memory leak.\\n\" +\n \"Make sure that the UI is configured to display notifications (use <Notifier />).\",\n { method, args }\n );\n return;\n }\n buffered.push([method, ...args]);\n }\n }\n\n #checkHandlerRegistration() {\n if (!this.#handler) {\n LOG.warn(\n `No notification handler has been registered: notifications will not be visible.\\n` +\n `Make sure that your app contains the <Notifier /> component.`\n );\n }\n }\n}\n"],"names":[],"mappings":";;AAKA,MAAM,GAAA,GAAM,aAAa,8BAA8B,CAAA,CAAA;AA+BhD,MAAM,uBAA2D,CAAA;AAAA,EACpE,QAAA,CAAA;AAAA,EACA,SAAA,CAAA;AAAA,EACA,eAAA,CAAA;AAAA;AAAA,EAEA,WAAc,GAAA;AACV,IAAI,IAAA,MAAA,CAAA,IAAA,CAAY,IAAI,GAAK,EAAA;AACrB,MAAK,IAAA,CAAA,eAAA,GAAkB,WAAW,MAAM;AACpC,QAAA,IAAA,CAAK,yBAA0B,EAAA,CAAA;AAC/B,QAAA,IAAA,CAAK,eAAkB,GAAA,KAAA,CAAA,CAAA;AAAA,SACxB,GAAI,CAAA,CAAA;AAAA,KACX;AAAA,GACJ;AAAA,EAEA,OAAU,GAAA;AACN,IAAA,YAAA,CAAa,KAAK,eAAe,CAAA,CAAA;AACjC,IAAA,IAAA,CAAK,eAAkB,GAAA,KAAA,CAAA,CAAA;AAAA,GAC3B;AAAA,EAEA,OAAO,OAAoC,EAAA;AACvC,IAAA,IAAA,CAAK,uBAAuB,kBAAoB,EAAA;AAAA,MAC5C,KAAA,EAAO,QAAQ,KAAS,IAAA,KAAA,CAAA;AAAA,MACxB,OAAA,EAAS,QAAQ,OAAW,IAAA,KAAA,CAAA;AAAA,MAC5B,KAAA,EAAO,QAAQ,KAAS,IAAA,MAAA;AAAA,MACxB,iBAAiB,OAAQ,CAAA,eAAA;AAAA,KAC5B,CAAA,CAAA;AAAA,GACL;AAAA,EAEA,QAAiB,GAAA;AACb,IAAA,IAAA,CAAK,uBAAuB,UAAU,CAAA,CAAA;AAAA,GAC1C;AAAA,EAEA,gBAAgB,OAAwC,EAAA;AAEpD,IAAA,IAAI,KAAK,QAAU,EAAA;AACf,MAAI,GAAA,CAAA,IAAA;AAAA,QACA,mKAAA;AAAA,OAEJ,CAAA;AACA,MAAO,OAAA;AAAA,QACH,OAAU,GAAA;AACN,UAAO,OAAA,KAAA,CAAA,CAAA;AAAA,SACX;AAAA,OACJ,CAAA;AAAA,KACJ;AAIA,IAAA,IAAA,CAAK,QAAW,GAAA,OAAA,CAAA;AAChB,IAAA,MAAM,WAAW,IAAK,CAAA,SAAA,CAAA;AACtB,IAAA,IAAA,CAAK,SAAY,GAAA,KAAA,CAAA,CAAA;AACjB,IAAA,IAAI,QAAU,EAAA;AACV,MAAA,KAAA,MAAW,CAAC,IAAA,EAAM,GAAG,IAAI,KAAK,QAAU,EAAA;AAEpC,QAAC,OAAQ,CAAA,IAAI,CAAU,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,OAClC;AAAA,KACJ;AAGA,IAAA,IAAI,SAAY,GAAA,KAAA,CAAA;AAChB,IAAO,OAAA;AAAA,MACH,SAAS,MAAM;AACX,QAAA,IAAI,SAAW,EAAA;AACX,UAAA,OAAA;AAAA,SACJ;AAEA,QAAY,SAAA,GAAA,IAAA,CAAA;AACZ,QAAI,IAAA,IAAA,CAAK,aAAa,OAAS,EAAA;AAC3B,UAAA,IAAA,CAAK,QAAW,GAAA,KAAA,CAAA,CAAA;AAAA,SACpB;AAAA,OACJ;AAAA,KACJ,CAAA;AAAA,GACJ;AAAA,EAUA,sBAAA,CAAuB,WAAsC,IAAuB,EAAA;AAChF,IAAA,IAAI,KAAK,QAAU,EAAA;AAEf,MAAC,IAAK,CAAA,QAAA,CAAS,MAAM,CAAA,CAAU,GAAG,IAAI,CAAA,CAAA;AAAA,KACnC,MAAA;AACH,MAAM,MAAA,QAAA,GAAY,IAAK,CAAA,SAAA,KAAc,EAAC,CAAA;AACtC,MAAI,IAAA,QAAA,CAAS,UAAU,IAAM,EAAA;AACzB,QAAI,GAAA,CAAA,KAAA;AAAA,UACA,+KAAA;AAAA,UAEA,EAAE,QAAQ,IAAK,EAAA;AAAA,SACnB,CAAA;AACA,QAAA,OAAA;AAAA,OACJ;AACA,MAAA,QAAA,CAAS,IAAK,CAAA,CAAC,MAAQ,EAAA,GAAG,IAAI,CAAC,CAAA,CAAA;AAAA,KACnC;AAAA,GACJ;AAAA,EAEA,yBAA4B,GAAA;AACxB,IAAI,IAAA,CAAC,KAAK,QAAU,EAAA;AAChB,MAAI,GAAA,CAAA,IAAA;AAAA,QACA,CAAA;AAAA,4DAAA,CAAA;AAAA,OAEJ,CAAA;AAAA,KACJ;AAAA,GACJ;AACJ;;;;"}
|
package/Notifier.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
/** Props supported by the {@link Notifier} component. */
|
|
3
|
+
export interface NotifierProps {
|
|
4
|
+
/**
|
|
5
|
+
* The position for new notifications.
|
|
6
|
+
*
|
|
7
|
+
* @default "top-right"
|
|
8
|
+
*/
|
|
9
|
+
position?: "top" | "top-left" | "top-right" | "bottom" | "bottom-left" | "bottom-right";
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Shows notifications sent via the `NotificationService`.
|
|
13
|
+
*
|
|
14
|
+
* Only one instance of `<Notifier />` should be present in the application.
|
|
15
|
+
* It currently does not matter where the Notifier is located in the react tree.
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { Notifier } from "@open-pioneer/notifier";
|
|
19
|
+
*
|
|
20
|
+
* export function AppUI() {
|
|
21
|
+
* return (
|
|
22
|
+
* <>
|
|
23
|
+
* <Notifier position="top-right" />
|
|
24
|
+
* <h1>Your application</h1>
|
|
25
|
+
* </>
|
|
26
|
+
* );
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function Notifier(props: NotifierProps): ReactElement;
|
package/Notifier.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useToast } from '@open-pioneer/chakra-integration';
|
|
3
|
+
import { useEvent } from '@open-pioneer/react-utils';
|
|
4
|
+
import { useService } from './_virtual/_virtual-pioneer-module_react-hooks.js';
|
|
5
|
+
import { useState, useEffect } from 'react';
|
|
6
|
+
import { WarningTwoIcon } from '@chakra-ui/icons';
|
|
7
|
+
|
|
8
|
+
const isDev = import.meta.env.DEV;
|
|
9
|
+
function Notifier(props) {
|
|
10
|
+
const { position = "top-right" } = props;
|
|
11
|
+
const toast = useToast();
|
|
12
|
+
const notifications = useService("notifier.NotificationService");
|
|
13
|
+
const [ready, setReady] = useState(!isDev);
|
|
14
|
+
const showNotification = useEvent((notification) => {
|
|
15
|
+
const icon = notification.level === "error" ? /* @__PURE__ */ jsx(WarningTwoIcon, { h: "100%", w: "100%" }) : void 0;
|
|
16
|
+
toast({
|
|
17
|
+
position,
|
|
18
|
+
title: notification.title,
|
|
19
|
+
description: notification.message || null,
|
|
20
|
+
status: notification.level,
|
|
21
|
+
isClosable: true,
|
|
22
|
+
duration: notification.displayDuration ?? null,
|
|
23
|
+
// Null: does not auto-close
|
|
24
|
+
icon
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
const closeAll = useEvent(() => {
|
|
28
|
+
toast.closeAll();
|
|
29
|
+
});
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (isDev && !ready) {
|
|
32
|
+
const id = setTimeout(() => setReady(true), 100);
|
|
33
|
+
return () => clearTimeout(id);
|
|
34
|
+
}
|
|
35
|
+
const handle = notifications.registerHandler({
|
|
36
|
+
showNotification,
|
|
37
|
+
closeAll
|
|
38
|
+
});
|
|
39
|
+
return () => handle.destroy();
|
|
40
|
+
}, [ready, notifications, showNotification, closeAll]);
|
|
41
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { Notifier };
|
|
45
|
+
//# sourceMappingURL=Notifier.js.map
|
package/Notifier.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notifier.js","sources":["Notifier.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { useToast } from \"@open-pioneer/chakra-integration\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useService } from \"open-pioneer:react-hooks\";\nimport { ReactElement, useEffect, useState } from \"react\";\nimport { InternalNotificationAPI, Notification } from \"./NotificationServiceImpl\";\nimport { WarningTwoIcon } from \"@chakra-ui/icons\";\n\n/** Props supported by the {@link Notifier} component. */\nexport interface NotifierProps {\n /**\n * The position for new notifications.\n *\n * @default \"top-right\"\n */\n position?: \"top\" | \"top-left\" | \"top-right\" | \"bottom\" | \"bottom-left\" | \"bottom-right\";\n}\n\nconst isDev = import.meta.env.DEV;\n\n/**\n * Shows notifications sent via the `NotificationService`.\n *\n * Only one instance of `<Notifier />` should be present in the application.\n * It currently does not matter where the Notifier is located in the react tree.\n *\n * ```ts\n * import { Notifier } from \"@open-pioneer/notifier\";\n *\n * export function AppUI() {\n * return (\n * <>\n * <Notifier position=\"top-right\" />\n * <h1>Your application</h1>\n * </>\n * );\n * }\n * ```\n */\nexport function Notifier(props: NotifierProps): ReactElement {\n const { position = \"top-right\" } = props;\n const toast = useToast();\n const notifications = useService(\"notifier.NotificationService\") as InternalNotificationAPI;\n const [ready, setReady] = useState(!isDev);\n\n const showNotification = useEvent((notification: Notification) => {\n // use different icons for warning and error\n const icon =\n notification.level === \"error\" ? <WarningTwoIcon h=\"100%\" w=\"100%\" /> : undefined;\n toast({\n position,\n title: notification.title,\n description: notification.message || null,\n status: notification.level,\n isClosable: true,\n duration: notification.displayDuration ?? null, // Null: does not auto-close\n icon\n });\n });\n const closeAll = useEvent(() => {\n toast.closeAll();\n });\n\n useEffect(() => {\n /*\n * Delay registering the notification handler a bit during development.\n * Chakra's toast implementation clears its store when it gets unmounted.\n * During development, that may also happen during initialization because of React's\n * StrictMode (https://react.dev/reference/react/StrictMode).\n *\n * Unfortunately, that means that toasts that were emitted very early (such as in service constructors)\n * will be deleted. Waiting for a few milliseconds prevents this issue and has no effect on production.\n */\n if (isDev && !ready) {\n const id = setTimeout(() => setReady(true), 100);\n return () => clearTimeout(id);\n }\n\n const handle = notifications.registerHandler({\n showNotification,\n closeAll\n });\n return () => handle.destroy();\n }, [ready, notifications, showNotification, closeAll]);\n\n // No actual UI representation right now\n return <></>;\n}\n"],"names":[],"mappings":";;;;;;;AAmBA,MAAM,KAAA,GAAQ,YAAY,GAAI,CAAA,GAAA,CAAA;AAqBvB,SAAS,SAAS,KAAoC,EAAA;AACzD,EAAM,MAAA,EAAE,QAAW,GAAA,WAAA,EAAgB,GAAA,KAAA,CAAA;AACnC,EAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AACvB,EAAM,MAAA,aAAA,GAAgB,WAAW,8BAA8B,CAAA,CAAA;AAC/D,EAAA,MAAM,CAAC,KAAO,EAAA,QAAQ,CAAI,GAAA,QAAA,CAAS,CAAC,KAAK,CAAA,CAAA;AAEzC,EAAM,MAAA,gBAAA,GAAmB,QAAS,CAAA,CAAC,YAA+B,KAAA;AAE9D,IAAM,MAAA,IAAA,GACF,YAAa,CAAA,KAAA,KAAU,OAAU,mBAAA,GAAA,CAAC,kBAAe,CAAE,EAAA,MAAA,EAAO,CAAE,EAAA,MAAA,EAAO,CAAK,GAAA,KAAA,CAAA,CAAA;AAC5E,IAAM,KAAA,CAAA;AAAA,MACF,QAAA;AAAA,MACA,OAAO,YAAa,CAAA,KAAA;AAAA,MACpB,WAAA,EAAa,aAAa,OAAW,IAAA,IAAA;AAAA,MACrC,QAAQ,YAAa,CAAA,KAAA;AAAA,MACrB,UAAY,EAAA,IAAA;AAAA,MACZ,QAAA,EAAU,aAAa,eAAmB,IAAA,IAAA;AAAA;AAAA,MAC1C,IAAA;AAAA,KACH,CAAA,CAAA;AAAA,GACJ,CAAA,CAAA;AACD,EAAM,MAAA,QAAA,GAAW,SAAS,MAAM;AAC5B,IAAA,KAAA,CAAM,QAAS,EAAA,CAAA;AAAA,GAClB,CAAA,CAAA;AAED,EAAA,SAAA,CAAU,MAAM;AAUZ,IAAI,IAAA,KAAA,IAAS,CAAC,KAAO,EAAA;AACjB,MAAA,MAAM,KAAK,UAAW,CAAA,MAAM,QAAS,CAAA,IAAI,GAAG,GAAG,CAAA,CAAA;AAC/C,MAAO,OAAA,MAAM,aAAa,EAAE,CAAA,CAAA;AAAA,KAChC;AAEA,IAAM,MAAA,MAAA,GAAS,cAAc,eAAgB,CAAA;AAAA,MACzC,gBAAA;AAAA,MACA,QAAA;AAAA,KACH,CAAA,CAAA;AACD,IAAO,OAAA,MAAM,OAAO,OAAQ,EAAA,CAAA;AAAA,KAC7B,CAAC,KAAA,EAAO,aAAe,EAAA,gBAAA,EAAkB,QAAQ,CAAC,CAAA,CAAA;AAGrD,EAAA,uBAAS,GAAA,CAAA,QAAA,EAAA,EAAA,CAAA,CAAA;AACb;;;;"}
|
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @open-pioneer/notifier
|
|
2
|
+
|
|
3
|
+
This package allows a developer to emit global notifications from any application component and provides a component to display the notifications.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
### Displaying notifications in an application
|
|
8
|
+
|
|
9
|
+
The `<Notifier />` must be used in your app's UI , otherwise notifications from application components will not be shown. It should be present exactly once.
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
import { Notifier } from "@open-pioneer/notifier";
|
|
13
|
+
|
|
14
|
+
export function AppUI() {
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<Notifier position="top-right" />
|
|
18
|
+
{/* The rest of your application */}
|
|
19
|
+
</>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
> Note: In most cases the notifier should be located at or near the root of your app's UI.
|
|
25
|
+
|
|
26
|
+
The following properties are supported by the Notifier:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
export interface NotifierProps {
|
|
30
|
+
/**
|
|
31
|
+
* The position for new notifications.
|
|
32
|
+
*
|
|
33
|
+
* @default "top-right"
|
|
34
|
+
*/
|
|
35
|
+
position?: "top" | "top-left" | "top-right" | "bottom" | "bottom-left" | "bottom-right";
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The implementation of `<Notifier />` is currently based on [Chakra's Toast](https://chakra-ui.com/docs/components/toast).
|
|
40
|
+
|
|
41
|
+
### Emitting notifications
|
|
42
|
+
|
|
43
|
+
Reference the interface name `notifier.NotificationService` to inject an instance of `NotificationService`.
|
|
44
|
+
That service can be used to emit events from any service or UI component in the application:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
const notificationService = ...; // injected
|
|
48
|
+
notificationService.notify({
|
|
49
|
+
level: "info",
|
|
50
|
+
title: "Job complete",
|
|
51
|
+
message: "Optional additional message ..."
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
All options in `notify` are optional, but at least the `title` or `message` should be specified.
|
|
56
|
+
|
|
57
|
+
The following options are supported by the service:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
export type NotificationLevel = "success" | "info" | "warning" | "error";
|
|
61
|
+
|
|
62
|
+
export interface NotificationOptions {
|
|
63
|
+
/** The title of the notification. */
|
|
64
|
+
title?: string | ReactNode | undefined;
|
|
65
|
+
|
|
66
|
+
/** An optional message, shown below the title. */
|
|
67
|
+
message?: string | ReactNode | undefined;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The level of this notification.
|
|
71
|
+
* @default "info"
|
|
72
|
+
*/
|
|
73
|
+
level?: NotificationLevel | undefined;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The duration (in milliseconds) how long the notification is displayed.
|
|
77
|
+
* By default, notifications are displayed until they are explicitly closed by the user.
|
|
78
|
+
*
|
|
79
|
+
* Note that important messages should not be hidden automatically for a11y reasons.
|
|
80
|
+
*/
|
|
81
|
+
displayDuration?: number | undefined;
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Closing all notifications
|
|
86
|
+
|
|
87
|
+
All currently displayed notifications can be closed by calling the `closeAll` method on the `NotificationService`:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const notificationService = ...; // injected
|
|
91
|
+
notificationService.closeAll();
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
Apache-2.0 (see `LICENSE` file)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useServiceInternal } from '@open-pioneer/runtime/react-integration';
|
|
2
|
+
|
|
3
|
+
const PACKAGE_NAME = "@open-pioneer/notifier";
|
|
4
|
+
const useService = /*@__PURE__*/ useServiceInternal.bind(undefined, PACKAGE_NAME);
|
|
5
|
+
|
|
6
|
+
export { useService };
|
|
7
|
+
//# sourceMappingURL=_virtual-pioneer-module_react-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_virtual-pioneer-module_react-hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/api.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** Represents the severity or kind of a notification. */
|
|
3
|
+
export type NotificationLevel = "success" | "info" | "warning" | "error";
|
|
4
|
+
/**
|
|
5
|
+
* Options used when emitting a new notification via {@link NotificationService.notify}.
|
|
6
|
+
*/
|
|
7
|
+
export interface NotificationOptions {
|
|
8
|
+
/** The title of the notification. */
|
|
9
|
+
title?: string | ReactNode | undefined;
|
|
10
|
+
/** An optional message, shown below the title. */
|
|
11
|
+
message?: string | ReactNode | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The level of this notification.
|
|
14
|
+
* @default "info"
|
|
15
|
+
*/
|
|
16
|
+
level?: NotificationLevel | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The duration (in milliseconds) how long the notification is displayed.
|
|
19
|
+
* By default, notifications are displayed until they are explicitly closed by the user.
|
|
20
|
+
*
|
|
21
|
+
* Note that important messages should not be hidden automatically for a11y reasons.
|
|
22
|
+
*/
|
|
23
|
+
displayDuration?: number | undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The `NotificationService` allows any part of the application to emit
|
|
27
|
+
* notifications to the user.
|
|
28
|
+
*
|
|
29
|
+
* You can inject an instance of this service by referencing the interface name `notifier.NotificationService`.
|
|
30
|
+
*/
|
|
31
|
+
export interface NotificationService {
|
|
32
|
+
/**
|
|
33
|
+
* Emits a new notification.
|
|
34
|
+
*
|
|
35
|
+
* Notifications are shown by the `<Notifier />` component,
|
|
36
|
+
* which must be present in your application.
|
|
37
|
+
*
|
|
38
|
+
* @param options Options for the new notification.
|
|
39
|
+
*/
|
|
40
|
+
notify(options: NotificationOptions): void;
|
|
41
|
+
/** Closes all active notifications. */
|
|
42
|
+
closeAll(): void;
|
|
43
|
+
}
|
|
44
|
+
import "@open-pioneer/runtime";
|
|
45
|
+
declare module "@open-pioneer/runtime" {
|
|
46
|
+
interface ServiceRegistry {
|
|
47
|
+
"notifier.NotificationService": NotificationService;
|
|
48
|
+
}
|
|
49
|
+
}
|
package/index.d.ts
ADDED
package/index.js
ADDED
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"name": "@open-pioneer/notifier",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Provides support for application-wide notifications",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"dependencies": {},
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"@open-pioneer/core": "^1.1.0",
|
|
10
|
+
"@open-pioneer/chakra-integration": "^1.1.0",
|
|
11
|
+
"@chakra-ui/icons": "^2.1.0",
|
|
12
|
+
"@open-pioneer/runtime": "^1.1.0",
|
|
13
|
+
"react": "^18.2.0",
|
|
14
|
+
"@open-pioneer/react-utils": "^0.1.0"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
"./package.json": "./package.json",
|
|
18
|
+
".": {
|
|
19
|
+
"import": "./index.js",
|
|
20
|
+
"types": "./index.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./services": {
|
|
23
|
+
"import": "./services.js",
|
|
24
|
+
"types": "./services.d.ts"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"openPioneerFramework": {
|
|
28
|
+
"services": [
|
|
29
|
+
{
|
|
30
|
+
"serviceName": "NotificationServiceImpl",
|
|
31
|
+
"provides": [
|
|
32
|
+
{
|
|
33
|
+
"interfaceName": "notifier.NotificationService"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"references": []
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"servicesModule": "./services",
|
|
40
|
+
"i18n": {
|
|
41
|
+
"languages": []
|
|
42
|
+
},
|
|
43
|
+
"ui": {
|
|
44
|
+
"references": [
|
|
45
|
+
{
|
|
46
|
+
"type": "unique",
|
|
47
|
+
"interfaceName": "notifier.NotificationService"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"properties": [],
|
|
52
|
+
"packageFormatVersion": "1.0.0"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/services.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NotificationServiceImpl } from "./NotificationServiceImpl";
|
package/services.js
ADDED
package/services.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|