openfin-notifications 1.10.2 → 1.10.3-alpha-755
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/index.d.ts +26 -0
- package/dist/client/internal.d.ts +9 -1
- package/dist/client/main-bundle.js +62 -5
- package/dist/client/main-bundle.js.map +1 -1
- package/dist/client/openfin-notifications.js +1 -1
- package/dist/client/openfin-notifications.js.map +1 -1
- package/dist/client/provider.d.ts +7 -0
- package/dist/client/templates/index.d.ts +1 -0
- package/dist/client/templates/templates.d.ts +187 -2
- package/dist/client/templates/updatableNotificationTemplates.d.ts +49 -0
- package/package.json +3 -3
package/dist/client/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import * as provider from './provider';
|
|
|
14
14
|
import { NotificationSource } from './source';
|
|
15
15
|
import { NotificationIndicator, IndicatorType, IndicatorColor } from './indicator';
|
|
16
16
|
import { NotificationOptions } from './templates/templates';
|
|
17
|
+
import { UpdatableNotificationOptions } from './templates/updatableNotificationTemplates';
|
|
17
18
|
export * from './actions';
|
|
18
19
|
export * from './controls';
|
|
19
20
|
export * from './source';
|
|
@@ -44,6 +45,9 @@ export declare type CustomData = Record<string, any>;
|
|
|
44
45
|
export declare type Notification<T extends NotificationOptions = NotificationOptions> = Readonly<Required<DistributiveOmit<T, 'buttons'>> & {
|
|
45
46
|
readonly buttons: ReadonlyArray<Required<ButtonOptions>>;
|
|
46
47
|
}>;
|
|
48
|
+
export declare type UpdatableNotification<T extends UpdatableNotificationOptions = UpdatableNotificationOptions> = Readonly<DistributiveOmit<T, 'buttons'> & {
|
|
49
|
+
readonly buttons?: ReadonlyArray<Required<ButtonOptions>>;
|
|
50
|
+
}>;
|
|
47
51
|
/**
|
|
48
52
|
* Event fired when an action is raised for a notification due to a specified trigger. It is important to note that
|
|
49
53
|
* applications will only receive these events if they indicate to the service that they want to receive these events.
|
|
@@ -202,6 +206,28 @@ export declare function removeEventListener(eventType: 'notifications-count-chan
|
|
|
202
206
|
* @param options Notification configuration options.
|
|
203
207
|
*/
|
|
204
208
|
export declare function create<T extends NotificationOptions>(options: T): Promise<Notification<T>>;
|
|
209
|
+
/**
|
|
210
|
+
* Updates an existing notification. Requires id of original Notification and one of:
|
|
211
|
+
* - buttons
|
|
212
|
+
* - customData
|
|
213
|
+
* - Template
|
|
214
|
+
*
|
|
215
|
+
* The updated Notification will then show in Notification Centre and in the Toast stack if not expired.
|
|
216
|
+
*
|
|
217
|
+
* Example:
|
|
218
|
+
* ```ts
|
|
219
|
+
* import {update} from 'openfin-notifications';
|
|
220
|
+
*
|
|
221
|
+
* update({
|
|
222
|
+
id: uniqueNotificationId,
|
|
223
|
+
body: 'i am an update! - ' + Date.now().toString(),
|
|
224
|
+
template: 'markdown',
|
|
225
|
+
});
|
|
226
|
+
* ```
|
|
227
|
+
* @param options
|
|
228
|
+
* @returns
|
|
229
|
+
*/
|
|
230
|
+
export declare function update<T extends UpdatableNotificationOptions>(options: T): Promise<Notification>;
|
|
205
231
|
/**
|
|
206
232
|
* Clears a specific notification from the Notification Center.
|
|
207
233
|
*
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
import { NotificationActionResult, ActionTrigger } from './actions';
|
|
11
11
|
import { ProviderStatus } from './provider';
|
|
12
12
|
import { NotificationSource } from './source';
|
|
13
|
-
import { NotificationOptions, Notification, NotificationActionEvent, NotificationClosedEvent, NotificationCreatedEvent, NotificationsCountChanged, NotificationFormSubmittedEvent } from './index';
|
|
13
|
+
import { NotificationOptions, Notification, NotificationActionEvent, NotificationClosedEvent, NotificationCreatedEvent, NotificationsCountChanged, NotificationFormSubmittedEvent, UpdatableNotification } from './index';
|
|
14
|
+
import { UpdatableNotificationOptions } from './templates/updatableNotificationTemplates';
|
|
14
15
|
/**
|
|
15
16
|
* The identity of the main application window of the service provider
|
|
16
17
|
*/
|
|
@@ -24,6 +25,7 @@ export declare const SERVICE_IDENTITY: {
|
|
|
24
25
|
export declare const SERVICE_CHANNEL = "of-notifications-service-v1";
|
|
25
26
|
export declare const enum APITopic {
|
|
26
27
|
CREATE_NOTIFICATION = "create-notification",
|
|
28
|
+
UPDATE_NOTIFICATION = "update-notification",
|
|
27
29
|
CLEAR_NOTIFICATION = "clear-notification",
|
|
28
30
|
GET_APP_NOTIFICATIONS = "fetch-app-notifications",
|
|
29
31
|
CLEAR_APP_NOTIFICATIONS = "clear-app-notifications",
|
|
@@ -35,6 +37,7 @@ export declare const enum APITopic {
|
|
|
35
37
|
}
|
|
36
38
|
export interface API {
|
|
37
39
|
[APITopic.CREATE_NOTIFICATION]: [CreatePayload, NotificationInternal];
|
|
40
|
+
[APITopic.UPDATE_NOTIFICATION]: [UpdatePayload, NotificationInternal];
|
|
38
41
|
[APITopic.CLEAR_NOTIFICATION]: [ClearPayload, boolean];
|
|
39
42
|
[APITopic.CLEAR_APP_NOTIFICATIONS]: [undefined, number];
|
|
40
43
|
[APITopic.GET_APP_NOTIFICATIONS]: [undefined, NotificationInternal[]];
|
|
@@ -51,10 +54,15 @@ export declare type CreatePayload<T extends NotificationOptions = NotificationOp
|
|
|
51
54
|
date?: number;
|
|
52
55
|
expires?: number | null;
|
|
53
56
|
};
|
|
57
|
+
export declare type UpdatePayload<T extends UpdatableNotificationOptions = UpdatableNotificationOptions> = T;
|
|
54
58
|
export declare type NotificationInternal<T extends NotificationOptions = NotificationOptions> = DistributiveOmit<Notification<T>, 'date' | 'expires'> & {
|
|
55
59
|
date: number;
|
|
56
60
|
expires: number | null;
|
|
57
61
|
};
|
|
62
|
+
export declare type UpdatableNotificationInternal<T extends UpdatableNotificationOptions = UpdatableNotificationOptions> = UpdatableNotification<T> & {
|
|
63
|
+
bodyText?: string;
|
|
64
|
+
body?: string;
|
|
65
|
+
};
|
|
58
66
|
export interface ClearPayload {
|
|
59
67
|
id: string;
|
|
60
68
|
}
|
|
@@ -119,6 +119,7 @@ exports.SERVICE_CHANNEL = 'of-notifications-service-v1';
|
|
|
119
119
|
var APITopic;
|
|
120
120
|
(function (APITopic) {
|
|
121
121
|
APITopic["CREATE_NOTIFICATION"] = "create-notification";
|
|
122
|
+
APITopic["UPDATE_NOTIFICATION"] = "update-notification";
|
|
122
123
|
APITopic["CLEAR_NOTIFICATION"] = "clear-notification";
|
|
123
124
|
APITopic["GET_APP_NOTIFICATIONS"] = "fetch-app-notifications";
|
|
124
125
|
APITopic["CLEAR_APP_NOTIFICATIONS"] = "clear-app-notifications";
|
|
@@ -391,7 +392,7 @@ async function getServicePromise() {
|
|
|
391
392
|
}, 5000);
|
|
392
393
|
channelPromise = fin.InterApplicationBus.Channel.connect(internal_1.SERVICE_CHANNEL, {
|
|
393
394
|
wait: true,
|
|
394
|
-
payload: { version: '1.10.
|
|
395
|
+
payload: { version: '1.10.3-alpha-755' },
|
|
395
396
|
}).then((channel) => {
|
|
396
397
|
window.clearTimeout(timeoutHandle);
|
|
397
398
|
const eventRouter = getEventRouter();
|
|
@@ -495,16 +496,26 @@ exports.DeferredPromise = DeferredPromise;
|
|
|
495
496
|
"use strict";
|
|
496
497
|
|
|
497
498
|
/**
|
|
498
|
-
*
|
|
499
|
+
* OpenFin Notification Templates API Version 1
|
|
499
500
|
*
|
|
500
501
|
* @module Templates
|
|
501
502
|
*/
|
|
502
503
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
503
|
-
exports.TemplateNames = void 0;
|
|
504
|
+
exports.TemplateFragmentNames = exports.PresentationTemplateFragmentNames = exports.ContainerTemplateFragmentNames = exports.TemplateNames = void 0;
|
|
504
505
|
exports.TemplateNames = {
|
|
505
506
|
markdown: 'markdown',
|
|
506
507
|
list: 'list',
|
|
508
|
+
custom: 'custom',
|
|
507
509
|
};
|
|
510
|
+
exports.ContainerTemplateFragmentNames = {
|
|
511
|
+
container: 'container',
|
|
512
|
+
};
|
|
513
|
+
exports.PresentationTemplateFragmentNames = {
|
|
514
|
+
text: 'text',
|
|
515
|
+
image: 'image',
|
|
516
|
+
list: 'list',
|
|
517
|
+
};
|
|
518
|
+
exports.TemplateFragmentNames = Object.assign(Object.assign({}, exports.ContainerTemplateFragmentNames), exports.PresentationTemplateFragmentNames);
|
|
508
519
|
|
|
509
520
|
|
|
510
521
|
/***/ }),
|
|
@@ -548,7 +559,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
548
559
|
return t;
|
|
549
560
|
};
|
|
550
561
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
551
|
-
exports.getNotificationsCount = exports.toggleNotificationCenter = exports.clearAll = exports.getAll = exports.clear = exports.create = exports.removeEventListener = exports.addEventListener = exports.VERSION = exports.NotificationIndicatorType = exports.IndicatorColor = exports.NotificationIndicator = exports.NotificationOptions = exports.provider = void 0;
|
|
562
|
+
exports.getNotificationsCount = exports.toggleNotificationCenter = exports.clearAll = exports.getAll = exports.clear = exports.update = exports.create = exports.removeEventListener = exports.addEventListener = exports.VERSION = exports.NotificationIndicatorType = exports.IndicatorColor = exports.NotificationIndicator = exports.NotificationOptions = exports.provider = void 0;
|
|
552
563
|
/**
|
|
553
564
|
* @module NotificationCenter
|
|
554
565
|
*/
|
|
@@ -581,7 +592,7 @@ __exportStar(__webpack_require__(20), exports);
|
|
|
581
592
|
*
|
|
582
593
|
* This is the version which you are currently using.
|
|
583
594
|
*/
|
|
584
|
-
exports.VERSION = '1.10.
|
|
595
|
+
exports.VERSION = '1.10.3-alpha-755';
|
|
585
596
|
const eventHandler = connection_1.getEventRouter();
|
|
586
597
|
function parseEventWithNotification(event) {
|
|
587
598
|
const { notification } = event;
|
|
@@ -681,6 +692,38 @@ async function create(options) {
|
|
|
681
692
|
return Object.assign(Object.assign({}, response), { date: new Date(response.date), expires: response.expires !== null ? new Date(response.expires) : null });
|
|
682
693
|
}
|
|
683
694
|
exports.create = create;
|
|
695
|
+
/**
|
|
696
|
+
* Updates an existing notification. Requires id of original Notification and one of:
|
|
697
|
+
* - buttons
|
|
698
|
+
* - customData
|
|
699
|
+
* - Template
|
|
700
|
+
*
|
|
701
|
+
* The updated Notification will then show in Notification Centre and in the Toast stack if not expired.
|
|
702
|
+
*
|
|
703
|
+
* Example:
|
|
704
|
+
* ```ts
|
|
705
|
+
* import {update} from 'openfin-notifications';
|
|
706
|
+
*
|
|
707
|
+
* update({
|
|
708
|
+
id: uniqueNotificationId,
|
|
709
|
+
body: 'i am an update! - ' + Date.now().toString(),
|
|
710
|
+
template: 'markdown',
|
|
711
|
+
});
|
|
712
|
+
* ```
|
|
713
|
+
* @param options
|
|
714
|
+
* @returns
|
|
715
|
+
*/
|
|
716
|
+
async function update(options) {
|
|
717
|
+
if (typeof options !== 'object' || options === null) {
|
|
718
|
+
throw new Error('Invalid argument passed to create: argument must be an object and must not be null');
|
|
719
|
+
}
|
|
720
|
+
if (!options.id) {
|
|
721
|
+
throw new Error('Invalid argument passed to create: "id" must be Id of previously created Notification');
|
|
722
|
+
}
|
|
723
|
+
const response = await connection_1.tryServiceDispatch(internal_1.APITopic.UPDATE_NOTIFICATION, Object.assign({}, options));
|
|
724
|
+
return Object.assign({}, response);
|
|
725
|
+
}
|
|
726
|
+
exports.update = update;
|
|
684
727
|
/**
|
|
685
728
|
* Clears a specific notification from the Notification Center.
|
|
686
729
|
*
|
|
@@ -1507,6 +1550,9 @@ const internal_1 = __webpack_require__(0);
|
|
|
1507
1550
|
* versions, this API will indicate that the provider is disconnected.
|
|
1508
1551
|
*
|
|
1509
1552
|
* @since 0.11.2
|
|
1553
|
+
*
|
|
1554
|
+
* Note: Template API version is only available when the connected provider is verison 1.10.2 or later.
|
|
1555
|
+
*
|
|
1510
1556
|
*/
|
|
1511
1557
|
function getStatus() {
|
|
1512
1558
|
// We need to race a timeout here as we never reject if the provider is not connected.
|
|
@@ -1514,6 +1560,7 @@ function getStatus() {
|
|
|
1514
1560
|
return {
|
|
1515
1561
|
connected: false,
|
|
1516
1562
|
version: null,
|
|
1563
|
+
templateAPIVersion: null,
|
|
1517
1564
|
};
|
|
1518
1565
|
});
|
|
1519
1566
|
}
|
|
@@ -1812,6 +1859,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
1812
1859
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1813
1860
|
__exportStar(__webpack_require__(21), exports);
|
|
1814
1861
|
__exportStar(__webpack_require__(5), exports);
|
|
1862
|
+
__exportStar(__webpack_require__(22), exports);
|
|
1815
1863
|
|
|
1816
1864
|
|
|
1817
1865
|
/***/ }),
|
|
@@ -1828,6 +1876,15 @@ __exportStar(__webpack_require__(5), exports);
|
|
|
1828
1876
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1829
1877
|
|
|
1830
1878
|
|
|
1879
|
+
/***/ }),
|
|
1880
|
+
/* 22 */
|
|
1881
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1882
|
+
|
|
1883
|
+
"use strict";
|
|
1884
|
+
|
|
1885
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1886
|
+
|
|
1887
|
+
|
|
1831
1888
|
/***/ })
|
|
1832
1889
|
/******/ ]);
|
|
1833
1890
|
});
|