@genesislcap/foundation-fdc3 14.214.0 → 14.214.1-openfin-notifications.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,4 +9,5 @@ export * from './fdc3-channel-event';
9
9
  export * from './util';
10
10
  export * from './utils';
11
11
  export * from './notifications/interop-notifications-listener';
12
+ export * from './notifications/openfin-notifications-listener';
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,EAAE,EAAE,gBAAgB,CAAC,GAAG,CAAC;KAC1B;CACF;AAGD,cAAc,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,gDAAgD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,EAAE,EAAE,gBAAgB,CAAC,GAAG,CAAC;KAC1B;CACF;AAGD,cAAc,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gDAAgD,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { NotificationDataRow } from '@genesislcap/foundation-notifications';
2
+ import { NotificationListener } from '@genesislcap/foundation-ui';
3
+ /**
4
+ * @tagname openfin-notification-listener
5
+ * @public
6
+ * @remarks
7
+ * This component extends the notification listener class and overrides the logic for showing the toast message to instead dispatch the event to the openfin notifications bus.
8
+ */
9
+ export declare class OpenfinNotifications extends NotificationListener {
10
+ toast: string;
11
+ connectedCallback(): Promise<void>;
12
+ protected showNotificationToast(row: NotificationDataRow): Promise<void>;
13
+ private mapToastButtons;
14
+ }
15
+ //# sourceMappingURL=openfin-notifications-listener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openfin-notifications-listener.d.ts","sourceRoot":"","sources":["../../../src/notifications/openfin-notifications-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAe,MAAM,uCAAuC,CAAC;AAGzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAsDlE;;;;;GAKG;AACH,qBAQa,oBAAqB,SAAQ,oBAAoB;IACtD,KAAK,EAAE,MAAM,CAAe;IAE5B,iBAAiB;cAoBP,qBAAqB,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8B9E,OAAO,CAAC,eAAe;CAoBxB"}
package/dist/esm/index.js CHANGED
@@ -4,3 +4,4 @@ export * from './fdc3-channel-event';
4
4
  export * from './util';
5
5
  export * from './utils';
6
6
  export * from './notifications/interop-notifications-listener';
7
+ export * from './notifications/openfin-notifications-listener';
@@ -0,0 +1,149 @@
1
+ import { __awaiter, __decorate } from "tslib";
2
+ import { NotificationListener } from '@genesislcap/foundation-ui';
3
+ import { attr } from '@genesislcap/web-core';
4
+ import { customElement, html, ref } from '@microsoft/fast-element';
5
+ import * as Notifications from '@openfin/workspace/notifications';
6
+ import { IndicatorColor } from '@openfin/workspace/notifications';
7
+ import { init } from '@openfin/workspace-platform';
8
+ const PLATFORM_ID = 'use-notifications';
9
+ const PLATFORM_ICON = 'http://localhost:8080/images/icon-dot.png';
10
+ const PLATFORM_TITLE = 'Use Notifications';
11
+ const OpenfinGensisPriorityMap = {
12
+ Information: 1,
13
+ Warning: 2,
14
+ Serious: 3,
15
+ Critical: 4,
16
+ };
17
+ const OpenfinGensisColorMap = {
18
+ Information: 'blue',
19
+ Warning: 'yellow',
20
+ Serious: 'red',
21
+ Critical: 'red',
22
+ };
23
+ function initializeWorkspacePlatform() {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ yield init({
26
+ browser: {
27
+ defaultWindowOptions: {
28
+ icon: PLATFORM_ICON,
29
+ workspacePlatform: {
30
+ pages: [],
31
+ favicon: PLATFORM_ICON,
32
+ },
33
+ },
34
+ },
35
+ });
36
+ });
37
+ }
38
+ function initializeNotifications() {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ console.log('initialise notifications');
41
+ yield Notifications.register({
42
+ notificationsPlatformOptions: {
43
+ id: PLATFORM_ID,
44
+ icon: PLATFORM_ICON,
45
+ title: PLATFORM_TITLE,
46
+ },
47
+ });
48
+ yield Notifications.addEventListener('notification-action', (event) => {
49
+ console.log(event, 'notification-action button clicked');
50
+ });
51
+ });
52
+ }
53
+ /**
54
+ * @tagname openfin-notification-listener
55
+ * @public
56
+ * @remarks
57
+ * This component extends the notification listener class and overrides the logic for showing the toast message to instead dispatch the event to the openfin notifications bus.
58
+ */
59
+ let OpenfinNotifications = class OpenfinNotifications extends NotificationListener {
60
+ constructor() {
61
+ super(...arguments);
62
+ this.toast = 'transient';
63
+ }
64
+ connectedCallback() {
65
+ const _super = Object.create(null, {
66
+ connectedCallback: { get: () => super.connectedCallback }
67
+ });
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ yield _super.connectedCallback.call(this);
70
+ yield initializeWorkspacePlatform();
71
+ yield initializeNotifications();
72
+ const notification = {
73
+ title: 'Simple Notification',
74
+ body: 'This is a simple notification',
75
+ toast: 'transient',
76
+ category: 'default',
77
+ template: 'markdown',
78
+ id: `${Math.random()}`,
79
+ soundOptions: {
80
+ mode: 'silent',
81
+ },
82
+ platform: PLATFORM_ID,
83
+ };
84
+ yield Notifications.create(notification);
85
+ });
86
+ }
87
+ showNotificationToast(row) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ const { HEADER: title, MESSAGE: body, NOTIFY_SEVERITY: type } = row;
90
+ const notification = {
91
+ title,
92
+ body,
93
+ priority: OpenfinGensisPriorityMap[type],
94
+ toast: this.toast || 'transient',
95
+ category: type,
96
+ template: 'markdown',
97
+ id: `${Math.random()}`,
98
+ soundOptions: {
99
+ mode: 'silent',
100
+ },
101
+ indicator: {
102
+ text: title,
103
+ color: OpenfinGensisColorMap[type],
104
+ fallback: IndicatorColor.BLUE,
105
+ },
106
+ buttons: this.mapToastButtons(this.toastButtons),
107
+ platform: PLATFORM_ID,
108
+ };
109
+ try {
110
+ yield Notifications.create(notification);
111
+ }
112
+ catch (e) {
113
+ console.error('Openfin notifications error', e);
114
+ }
115
+ });
116
+ }
117
+ mapToastButtons(toastButtons) {
118
+ if (!toastButtons) {
119
+ return null;
120
+ }
121
+ return toastButtons.map((t) => {
122
+ return {
123
+ title: t.placeholder,
124
+ type: 'button',
125
+ onClick: {
126
+ cta: true,
127
+ task: 'acknowledge-task',
128
+ customData: {
129
+ message: 'Notification button clicked',
130
+ },
131
+ },
132
+ };
133
+ });
134
+ }
135
+ };
136
+ __decorate([
137
+ attr
138
+ ], OpenfinNotifications.prototype, "toast", void 0);
139
+ OpenfinNotifications = __decorate([
140
+ customElement({
141
+ name: 'openfin-notification-listener',
142
+ template: html `
143
+ <template ${ref('notificationListener')}>
144
+ <slot></slot>
145
+ </template>
146
+ `,
147
+ })
148
+ ], OpenfinNotifications);
149
+ export { OpenfinNotifications };
@@ -1715,6 +1715,158 @@
1715
1715
  "startIndex": 1,
1716
1716
  "endIndex": 3
1717
1717
  }
1718
+ },
1719
+ {
1720
+ "kind": "Class",
1721
+ "canonicalReference": "@genesislcap/foundation-fdc3!OpenfinNotifications:class",
1722
+ "docComment": "/**\n * @remarks\n *\n * This component extends the notification listener class and overrides the logic for showing the toast message to instead dispatch the event to the openfin notifications bus.\n *\n * @tagname\n *\n * openfin-notification-listener\n *\n * @public\n */\n",
1723
+ "excerptTokens": [
1724
+ {
1725
+ "kind": "Content",
1726
+ "text": "export declare class OpenfinNotifications extends "
1727
+ },
1728
+ {
1729
+ "kind": "Reference",
1730
+ "text": "NotificationListener",
1731
+ "canonicalReference": "@genesislcap/foundation-ui!NotificationListener:class"
1732
+ },
1733
+ {
1734
+ "kind": "Content",
1735
+ "text": " "
1736
+ }
1737
+ ],
1738
+ "fileUrlPath": "src/notifications/openfin-notifications-listener.ts",
1739
+ "releaseTag": "Public",
1740
+ "isAbstract": false,
1741
+ "name": "OpenfinNotifications",
1742
+ "preserveMemberOrder": false,
1743
+ "members": [
1744
+ {
1745
+ "kind": "Method",
1746
+ "canonicalReference": "@genesislcap/foundation-fdc3!OpenfinNotifications#connectedCallback:member(1)",
1747
+ "docComment": "",
1748
+ "excerptTokens": [
1749
+ {
1750
+ "kind": "Content",
1751
+ "text": "connectedCallback(): "
1752
+ },
1753
+ {
1754
+ "kind": "Reference",
1755
+ "text": "Promise",
1756
+ "canonicalReference": "!Promise:interface"
1757
+ },
1758
+ {
1759
+ "kind": "Content",
1760
+ "text": "<void>"
1761
+ },
1762
+ {
1763
+ "kind": "Content",
1764
+ "text": ";"
1765
+ }
1766
+ ],
1767
+ "isStatic": false,
1768
+ "returnTypeTokenRange": {
1769
+ "startIndex": 1,
1770
+ "endIndex": 3
1771
+ },
1772
+ "releaseTag": "Public",
1773
+ "isProtected": false,
1774
+ "overloadIndex": 1,
1775
+ "parameters": [],
1776
+ "isOptional": false,
1777
+ "isAbstract": false,
1778
+ "name": "connectedCallback"
1779
+ },
1780
+ {
1781
+ "kind": "Method",
1782
+ "canonicalReference": "@genesislcap/foundation-fdc3!OpenfinNotifications#showNotificationToast:member(1)",
1783
+ "docComment": "",
1784
+ "excerptTokens": [
1785
+ {
1786
+ "kind": "Content",
1787
+ "text": "protected showNotificationToast(row: "
1788
+ },
1789
+ {
1790
+ "kind": "Reference",
1791
+ "text": "NotificationDataRow",
1792
+ "canonicalReference": "@genesislcap/foundation-notifications!NotificationDataRow:interface"
1793
+ },
1794
+ {
1795
+ "kind": "Content",
1796
+ "text": "): "
1797
+ },
1798
+ {
1799
+ "kind": "Reference",
1800
+ "text": "Promise",
1801
+ "canonicalReference": "!Promise:interface"
1802
+ },
1803
+ {
1804
+ "kind": "Content",
1805
+ "text": "<void>"
1806
+ },
1807
+ {
1808
+ "kind": "Content",
1809
+ "text": ";"
1810
+ }
1811
+ ],
1812
+ "isStatic": false,
1813
+ "returnTypeTokenRange": {
1814
+ "startIndex": 3,
1815
+ "endIndex": 5
1816
+ },
1817
+ "releaseTag": "Public",
1818
+ "isProtected": true,
1819
+ "overloadIndex": 1,
1820
+ "parameters": [
1821
+ {
1822
+ "parameterName": "row",
1823
+ "parameterTypeTokenRange": {
1824
+ "startIndex": 1,
1825
+ "endIndex": 2
1826
+ },
1827
+ "isOptional": false
1828
+ }
1829
+ ],
1830
+ "isOptional": false,
1831
+ "isAbstract": false,
1832
+ "name": "showNotificationToast"
1833
+ },
1834
+ {
1835
+ "kind": "Property",
1836
+ "canonicalReference": "@genesislcap/foundation-fdc3!OpenfinNotifications#toast:member",
1837
+ "docComment": "",
1838
+ "excerptTokens": [
1839
+ {
1840
+ "kind": "Content",
1841
+ "text": "toast: "
1842
+ },
1843
+ {
1844
+ "kind": "Content",
1845
+ "text": "string"
1846
+ },
1847
+ {
1848
+ "kind": "Content",
1849
+ "text": ";"
1850
+ }
1851
+ ],
1852
+ "isReadonly": false,
1853
+ "isOptional": false,
1854
+ "releaseTag": "Public",
1855
+ "name": "toast",
1856
+ "propertyTypeTokenRange": {
1857
+ "startIndex": 1,
1858
+ "endIndex": 2
1859
+ },
1860
+ "isStatic": false,
1861
+ "isProtected": false,
1862
+ "isAbstract": false
1863
+ }
1864
+ ],
1865
+ "extendsTokenRange": {
1866
+ "startIndex": 1,
1867
+ "endIndex": 2
1868
+ },
1869
+ "implementsTokenRanges": []
1718
1870
  }
1719
1871
  ]
1720
1872
  }
@@ -1677,6 +1677,19 @@ export { Listener }
1677
1677
  */
1678
1678
  export declare const logger: Logger;
1679
1679
 
1680
+ /**
1681
+ * @tagname openfin-notification-listener
1682
+ * @public
1683
+ * @remarks
1684
+ * This component extends the notification listener class and overrides the logic for showing the toast message to instead dispatch the event to the openfin notifications bus.
1685
+ */
1686
+ export declare class OpenfinNotifications extends NotificationListener {
1687
+ toast: string;
1688
+ connectedCallback(): Promise<void>;
1689
+ protected showNotificationToast(row: NotificationDataRow): Promise<void>;
1690
+ private mapToastButtons;
1691
+ }
1692
+
1680
1693
  export { PrivateChannel }
1681
1694
 
1682
1695
  export { StandardIntent }
@@ -9,6 +9,7 @@
9
9
  | Class | Description |
10
10
  | --- | --- |
11
11
  | [InteropNotificationsListener](./foundation-fdc3.interopnotificationslistener.md) | |
12
+ | [OpenfinNotifications](./foundation-fdc3.openfinnotifications.md) | |
12
13
 
13
14
  ## Interfaces
14
15
 
@@ -0,0 +1,15 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-fdc3](./foundation-fdc3.md) &gt; [OpenfinNotifications](./foundation-fdc3.openfinnotifications.md) &gt; [connectedCallback](./foundation-fdc3.openfinnotifications.connectedcallback.md)
4
+
5
+ ## OpenfinNotifications.connectedCallback() method
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ connectedCallback(): Promise<void>;
11
+ ```
12
+ **Returns:**
13
+
14
+ Promise&lt;void&gt;
15
+
@@ -0,0 +1,30 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-fdc3](./foundation-fdc3.md) &gt; [OpenfinNotifications](./foundation-fdc3.openfinnotifications.md)
4
+
5
+ ## OpenfinNotifications class
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ export declare class OpenfinNotifications extends NotificationListener
11
+ ```
12
+ **Extends:** NotificationListener
13
+
14
+ ## Remarks
15
+
16
+ This component extends the notification listener class and overrides the logic for showing the toast message to instead dispatch the event to the openfin notifications bus.
17
+
18
+ ## Properties
19
+
20
+ | Property | Modifiers | Type | Description |
21
+ | --- | --- | --- | --- |
22
+ | [toast](./foundation-fdc3.openfinnotifications.toast.md) | | string | |
23
+
24
+ ## Methods
25
+
26
+ | Method | Modifiers | Description |
27
+ | --- | --- | --- |
28
+ | [connectedCallback()](./foundation-fdc3.openfinnotifications.connectedcallback.md) | | |
29
+ | [showNotificationToast(row)](./foundation-fdc3.openfinnotifications.shownotificationtoast.md) | <code>protected</code> | |
30
+
@@ -0,0 +1,22 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-fdc3](./foundation-fdc3.md) &gt; [OpenfinNotifications](./foundation-fdc3.openfinnotifications.md) &gt; [showNotificationToast](./foundation-fdc3.openfinnotifications.shownotificationtoast.md)
4
+
5
+ ## OpenfinNotifications.showNotificationToast() method
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ protected showNotificationToast(row: NotificationDataRow): Promise<void>;
11
+ ```
12
+
13
+ ## Parameters
14
+
15
+ | Parameter | Type | Description |
16
+ | --- | --- | --- |
17
+ | row | NotificationDataRow | |
18
+
19
+ **Returns:**
20
+
21
+ Promise&lt;void&gt;
22
+
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-fdc3](./foundation-fdc3.md) &gt; [OpenfinNotifications](./foundation-fdc3.openfinnotifications.md) &gt; [toast](./foundation-fdc3.openfinnotifications.toast.md)
4
+
5
+ ## OpenfinNotifications.toast property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ toast: string;
11
+ ```
@@ -264,6 +264,16 @@ export { Listener }
264
264
  // @public
265
265
  export const logger: Logger;
266
266
 
267
+ // @public (undocumented)
268
+ export class OpenfinNotifications extends NotificationListener {
269
+ // (undocumented)
270
+ connectedCallback(): Promise<void>;
271
+ // (undocumented)
272
+ protected showNotificationToast(row: NotificationDataRow): Promise<void>;
273
+ // (undocumented)
274
+ toast: string;
275
+ }
276
+
267
277
  export { PrivateChannel }
268
278
 
269
279
  export { StandardIntent }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-fdc3",
3
3
  "description": "Genesis Foundation FDC3",
4
- "version": "14.214.0",
4
+ "version": "14.214.1-openfin-notifications.1",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -59,26 +59,28 @@
59
59
  }
60
60
  },
61
61
  "devDependencies": {
62
- "@genesislcap/foundation-testing": "14.214.0",
63
- "@genesislcap/genx": "14.214.0",
64
- "@genesislcap/rollup-builder": "14.214.0",
65
- "@genesislcap/ts-builder": "14.214.0",
66
- "@genesislcap/uvu-playwright-builder": "14.214.0",
67
- "@genesislcap/vite-builder": "14.214.0",
68
- "@genesislcap/webpack-builder": "14.214.0",
62
+ "@genesislcap/foundation-testing": "14.211.5",
63
+ "@genesislcap/genx": "14.211.5",
64
+ "@genesislcap/rollup-builder": "14.211.5",
65
+ "@genesislcap/ts-builder": "14.211.5",
66
+ "@genesislcap/uvu-playwright-builder": "14.211.5",
67
+ "@genesislcap/vite-builder": "14.211.5",
68
+ "@genesislcap/webpack-builder": "14.211.5",
69
69
  "rimraf": "^5.0.0",
70
70
  "sinon": "^17.0.1"
71
71
  },
72
72
  "dependencies": {
73
73
  "@finos/fdc3": "2.1.1",
74
- "@genesislcap/foundation-logger": "14.214.0",
75
- "@genesislcap/foundation-notifications": "14.214.0",
76
- "@genesislcap/foundation-ui": "14.214.0",
77
- "@genesislcap/foundation-utils": "14.214.0",
78
- "@genesislcap/web-core": "14.214.0",
74
+ "@genesislcap/foundation-logger": "14.211.5",
75
+ "@genesislcap/foundation-notifications": "14.211.5",
76
+ "@genesislcap/foundation-ui": "14.211.5",
77
+ "@genesislcap/foundation-utils": "14.211.5",
78
+ "@genesislcap/web-core": "14.211.5",
79
79
  "@interopio/desktop": "^6.3.1",
80
80
  "@microsoft/fast-element": "^1.12.0",
81
81
  "@microsoft/fast-foundation": "^2.49.4",
82
+ "@openfin/workspace": "^19.1.23",
83
+ "@openfin/workspace-platform": "^19.1.23",
82
84
  "rxjs": "^7.5.4",
83
85
  "tslib": "^2.3.1"
84
86
  },
@@ -90,5 +92,5 @@
90
92
  "publishConfig": {
91
93
  "access": "public"
92
94
  },
93
- "gitHead": "12de0640c63d111cb448bd3204a9d2133afb9c49"
95
+ "gitHead": "d9d249f0436f4cc3d1491fe19b52caa78152982f"
94
96
  }