@genesislcap/foundation-openfin 14.214.1-FUI-2233.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MODULE_FEDERATION.md +11 -0
- package/README.md +59 -0
- package/dist/dts/index.d.ts +8 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/notifications/openfin-notifications-listener.d.ts +125 -0
- package/dist/dts/notifications/openfin-notifications-listener.d.ts.map +1 -0
- package/dist/dts/tsdoc-metadata.json +11 -0
- package/dist/dts/utils.d.ts +7 -0
- package/dist/dts/utils.d.ts.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/notifications/openfin-notifications-listener.js +148 -0
- package/dist/esm/utils.js +6 -0
- package/dist/foundation-openfin.api.json +574 -0
- package/dist/foundation-openfin.d.ts +136 -0
- package/docs/.gitattributes +2 -0
- package/docs/api/foundation-openfin.isopenfin.md +16 -0
- package/docs/api/foundation-openfin.md +24 -0
- package/docs/api/foundation-openfin.openfinnotifications.connectedcallback.md +15 -0
- package/docs/api/foundation-openfin.openfinnotifications.md +33 -0
- package/docs/api/foundation-openfin.openfinnotifications.mode.md +19 -0
- package/docs/api/foundation-openfin.openfinnotifications.notificationsplatform.md +40 -0
- package/docs/api/foundation-openfin.openfinnotifications.shownotificationtoast.md +22 -0
- package/docs/api/foundation-openfin.openfinnotifications.toast.md +19 -0
- package/docs/api/foundation-openfin.openfinnotifications.toastbuttons.md +71 -0
- package/docs/api/foundation-openfin.openfintoastbutton.cta.md +11 -0
- package/docs/api/foundation-openfin.openfintoastbutton.md +25 -0
- package/docs/api/foundation-openfin.openfintoastbutton.message.md +11 -0
- package/docs/api/foundation-openfin.openfintoastbutton.task.md +11 -0
- package/docs/api/index.md +12 -0
- package/docs/api-report.md +42 -0
- package/license.txt +46 -0
- package/package.json +96 -0
- package/tsdoc.json +20 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Genesis Foundation FDC3
|
|
2
|
+
|
|
3
|
+
## [Module Federation](https://webpack.js.org/concepts/module-federation)
|
|
4
|
+
|
|
5
|
+
This package is federated locally during development by running the webpack part of the build.
|
|
6
|
+
|
|
7
|
+
| Remote Name | Port |
|
|
8
|
+
|-----------------| ----- |
|
|
9
|
+
| foundationFdc3 | 4000 |
|
|
10
|
+
|
|
11
|
+
Default production enablement remains dependent on [pending architectural decisions](https://bit.ly/3LLHUhK).
|
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Genesis Foundation Openfin
|
|
2
|
+
|
|
3
|
+
This provides a robust implementation of the Openfin workspace container
|
|
4
|
+
|
|
5
|
+
## API Documentation
|
|
6
|
+
|
|
7
|
+
For more detailed information on API and configurations, please refer to the [API documentation](docs/api/index.md) in the `docs/api` directory.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
To include `@genesislcap/foundation-openfin` in your project, add it as a dependency in your `package.json` file and follow your project's routine for dependency installation.
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@genesislcap/foundation-openfin": "latest"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Key Features
|
|
22
|
+
|
|
23
|
+
- **Openfin Notifications:** Implements a component to create openfin notifications
|
|
24
|
+
|
|
25
|
+
## Usage Examples
|
|
26
|
+
|
|
27
|
+
### Adding Intent Listeners
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<openfin-notifications
|
|
31
|
+
resource-name="ALL_NOTIFY_ALERT_RECORDS"
|
|
32
|
+
data-pbc-asset-id="interop-notification-listener"
|
|
33
|
+
:notificationsPlatform="${() => ({
|
|
34
|
+
id: PLATFORM_ID,
|
|
35
|
+
icon: PLATFORM_ICON,
|
|
36
|
+
title: PLATFORM_TITLE
|
|
37
|
+
})}"
|
|
38
|
+
:toastButtons="${x => [
|
|
39
|
+
{
|
|
40
|
+
condition: ({details}) => details.HEADER === 'Trade added',
|
|
41
|
+
action: ({details, buttonElement }) => {
|
|
42
|
+
Route.path.push('/trades')
|
|
43
|
+
if (buttonElement) {
|
|
44
|
+
buttonElement.$emit(STORE_EVENTS_ENUM.TRADE_SELECTED, details.TABLE_ENTITY_ID);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
placeholder: 'View Trade',
|
|
48
|
+
task: 'view-trade'
|
|
49
|
+
}
|
|
50
|
+
]}"
|
|
51
|
+
></openfin-notifications>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact [Genesis Global](https://genesis.global/contact-us/) for more details.
|
|
57
|
+
|
|
58
|
+
### Licensed components
|
|
59
|
+
Genesis low-code platform
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,GAAG,EAAE,GAAG,CAAC;KACV;CACF;AAGD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { NotificationDataRow, ToastButton } from '@genesislcap/foundation-notifications';
|
|
2
|
+
import { NotificationListener } from '@genesislcap/foundation-ui';
|
|
3
|
+
import { NotificationsPlatform } from '@openfin/workspace/notifications';
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
* @remarks
|
|
7
|
+
* OpenfinToastButton interface which extends ToastButton.
|
|
8
|
+
* Adds the task property which is used in mapping button actions to their corresponding callbacks
|
|
9
|
+
*/
|
|
10
|
+
export interface OpenfinToastButton extends ToastButton {
|
|
11
|
+
task: string;
|
|
12
|
+
cta?: boolean;
|
|
13
|
+
message?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
* @remarks
|
|
18
|
+
* Openfin Notifications custom element
|
|
19
|
+
*/
|
|
20
|
+
export declare class OpenfinNotifications extends NotificationListener {
|
|
21
|
+
/**
|
|
22
|
+
* @beta
|
|
23
|
+
* @remarks
|
|
24
|
+
* Config for registering a workspace with the Openfin notifications component
|
|
25
|
+
* @example
|
|
26
|
+
* Create your notifications platform constant
|
|
27
|
+
* ```ts
|
|
28
|
+
* const notificationsPlatform: NotificationsPlatform = {
|
|
29
|
+
* id: 'platform-id', // the id of your openfin workspace
|
|
30
|
+
* icon: 'https://localhost:8080/path/to/icon.svg', // the url to the icon for your workspace
|
|
31
|
+
* title: 'Platform title' // the platform title which will appear in notifications
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
* Setting the property in an html view template
|
|
35
|
+
* ```html
|
|
36
|
+
* <openfin-notifications-listener
|
|
37
|
+
* ...
|
|
38
|
+
* :notificationsPlatform="${() => notificationsPlatform}"
|
|
39
|
+
* >
|
|
40
|
+
* </openfin-notifications-listener>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
notificationsPlatform: NotificationsPlatform;
|
|
44
|
+
/**
|
|
45
|
+
* @beta
|
|
46
|
+
* @remarks
|
|
47
|
+
* The notification type of toast messages
|
|
48
|
+
*/
|
|
49
|
+
toast: 'transient' | 'sticky' | 'none';
|
|
50
|
+
/**
|
|
51
|
+
* @beta
|
|
52
|
+
* @remarks
|
|
53
|
+
* The notification sound mode
|
|
54
|
+
*/
|
|
55
|
+
mode: 'default' | 'silent';
|
|
56
|
+
/**
|
|
57
|
+
* Array of button configs for openfin notification toasts
|
|
58
|
+
* @public
|
|
59
|
+
* @example
|
|
60
|
+
* In these examples you could
|
|
61
|
+
* 1. View a trade, this is done by routing to the corresponding route. Dispatching the highlighted record id to the store and retrieving it in the view from the store.
|
|
62
|
+
* 2. Call an endpoint to approve a trade
|
|
63
|
+
* 3. Call an endpoint to reject a trade
|
|
64
|
+
* ```html
|
|
65
|
+
* <openfin-notifications-listener
|
|
66
|
+
* ...
|
|
67
|
+
* :toastButtons="${x => [
|
|
68
|
+
* {
|
|
69
|
+
* {
|
|
70
|
+
* condition: ({details}) => details.HEADER === 'Trade added',
|
|
71
|
+
* action: ({details, buttonElement }) => {
|
|
72
|
+
* Route.path.push('/some-route') // redirect to a route
|
|
73
|
+
* buttonElement.$emit('some-store-event', details.TABLE_ENTITY_ID); //emit the entity id to the store
|
|
74
|
+
* }
|
|
75
|
+
* },
|
|
76
|
+
* placeholder: 'View Trade',
|
|
77
|
+
* task: 'view-trade'
|
|
78
|
+
* },
|
|
79
|
+
* {
|
|
80
|
+
* {
|
|
81
|
+
* condition: ({details}) => details.HEADER === 'Trade added',
|
|
82
|
+
* action: ({details, buttonElement }) => {
|
|
83
|
+
* const connect = getConnect();
|
|
84
|
+
* connect.commitEvent('approve-trade', {
|
|
85
|
+
* DETAILS: {
|
|
86
|
+
* TRADE_ID: details.TABLE_ENTITY_ID,
|
|
87
|
+
* APPROVED: true
|
|
88
|
+
* }
|
|
89
|
+
* })
|
|
90
|
+
* }
|
|
91
|
+
* },
|
|
92
|
+
* placeholder: 'Approve Trade',
|
|
93
|
+
* task: 'approve-trade'
|
|
94
|
+
* },
|
|
95
|
+
* {
|
|
96
|
+
* {
|
|
97
|
+
* condition: ({details}) => details.HEADER === 'Trade added',
|
|
98
|
+
* action: ({details, buttonElement }) => {
|
|
99
|
+
* const connect = getConnect();
|
|
100
|
+
* connect.commitEvent('approve-trade', {
|
|
101
|
+
* DETAILS: {
|
|
102
|
+
* TRADE_ID: details.TABLE_ENTITY_ID,
|
|
103
|
+
* APPROVED: false
|
|
104
|
+
* }
|
|
105
|
+
* })
|
|
106
|
+
* }
|
|
107
|
+
* },
|
|
108
|
+
* placeholder: 'Reject Trade',
|
|
109
|
+
* task: 'reject-trade'
|
|
110
|
+
* },
|
|
111
|
+
*
|
|
112
|
+
* ]
|
|
113
|
+
* >
|
|
114
|
+
* </openfin-notifications-listener>
|
|
115
|
+
* ```
|
|
116
|
+
|
|
117
|
+
*
|
|
118
|
+
*/
|
|
119
|
+
toastButtons: OpenfinToastButton[];
|
|
120
|
+
connectedCallback(): Promise<void>;
|
|
121
|
+
private addButtonListeners;
|
|
122
|
+
protected showNotificationToast(row: NotificationDataRow): Promise<void>;
|
|
123
|
+
private mapToastButtons;
|
|
124
|
+
}
|
|
125
|
+
//# 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,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAOL,qBAAqB,EAEtB,MAAM,kCAAkC,CAAC;AAiB1C;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAUD;;;;GAIG;AACH,qBAQa,oBAAqB,SAAQ,oBAAoB;IAC5D;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,qBAAqB,EAAE,qBAAqB,CAAC;IAE7C;;;;OAIG;IACG,KAAK,EAAE,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAe;IAE3D;;;;OAIG;IACG,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAY;IAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8DG;IACH,YAAY,EAAE,kBAAkB,EAAE,CAAC;IAE7B,iBAAiB;YAMT,kBAAkB;cAiBhB,qBAAqB,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8B9E,OAAO,CAAC,eAAe;CA+BxB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.34.9"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,SAAS,QAAO,OAAuB,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
|
+
import { NotificationListener } from '@genesislcap/foundation-ui';
|
|
3
|
+
import { attr, customElement, html, ref } from '@genesislcap/web-core';
|
|
4
|
+
import { register, addEventListener, create, IndicatorColor, } from '@openfin/workspace/notifications';
|
|
5
|
+
import { logger } from '@genesislcap/foundation-utils';
|
|
6
|
+
const OpenfinGenesisPriorityMap = {
|
|
7
|
+
Information: 1,
|
|
8
|
+
Warning: 2,
|
|
9
|
+
Serious: 3,
|
|
10
|
+
Critical: 4,
|
|
11
|
+
};
|
|
12
|
+
const OpenfinGenesisColorMap = {
|
|
13
|
+
Information: IndicatorColor.BLUE,
|
|
14
|
+
Warning: IndicatorColor.YELLOW,
|
|
15
|
+
Serious: IndicatorColor.MAGENTA,
|
|
16
|
+
Critical: IndicatorColor.RED,
|
|
17
|
+
};
|
|
18
|
+
function initializeNotifications(notificationsPlatformOptions) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
yield register({
|
|
21
|
+
notificationsPlatformOptions,
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @public
|
|
27
|
+
* @remarks
|
|
28
|
+
* Openfin Notifications custom element
|
|
29
|
+
*/
|
|
30
|
+
let OpenfinNotifications = class OpenfinNotifications extends NotificationListener {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
/**
|
|
34
|
+
* @beta
|
|
35
|
+
* @remarks
|
|
36
|
+
* The notification type of toast messages
|
|
37
|
+
*/
|
|
38
|
+
this.toast = 'transient';
|
|
39
|
+
/**
|
|
40
|
+
* @beta
|
|
41
|
+
* @remarks
|
|
42
|
+
* The notification sound mode
|
|
43
|
+
*/
|
|
44
|
+
this.mode = 'silent';
|
|
45
|
+
}
|
|
46
|
+
connectedCallback() {
|
|
47
|
+
const _super = Object.create(null, {
|
|
48
|
+
connectedCallback: { get: () => super.connectedCallback }
|
|
49
|
+
});
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
yield _super.connectedCallback.call(this);
|
|
52
|
+
yield initializeNotifications(this.notificationsPlatform);
|
|
53
|
+
yield this.addButtonListeners();
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
addButtonListeners() {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
try {
|
|
59
|
+
yield addEventListener('notification-action', (event) => {
|
|
60
|
+
var _a;
|
|
61
|
+
const button = (_a = this.toastButtons) === null || _a === void 0 ? void 0 : _a.find((t) => t.task === event.result.task);
|
|
62
|
+
if (!button) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
button.action({ details: event.result.customData.details, buttonElement: this });
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
console.log(e);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
showNotificationToast(row) {
|
|
74
|
+
var _a;
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const { HEADER: title, MESSAGE: body, NOTIFY_SEVERITY: type, ALERT_ID } = row;
|
|
77
|
+
const notification = {
|
|
78
|
+
title,
|
|
79
|
+
body,
|
|
80
|
+
priority: OpenfinGenesisPriorityMap[type],
|
|
81
|
+
toast: this.toast || 'transient',
|
|
82
|
+
category: type,
|
|
83
|
+
template: 'markdown',
|
|
84
|
+
id: ALERT_ID,
|
|
85
|
+
soundOptions: {
|
|
86
|
+
mode: this.mode,
|
|
87
|
+
},
|
|
88
|
+
indicator: {
|
|
89
|
+
text: title,
|
|
90
|
+
color: OpenfinGenesisColorMap[type],
|
|
91
|
+
fallback: OpenfinGenesisColorMap[type],
|
|
92
|
+
},
|
|
93
|
+
buttons: this.mapToastButtons(this.toastButtons, row),
|
|
94
|
+
platform: (_a = this.notificationsPlatform) === null || _a === void 0 ? void 0 : _a.id,
|
|
95
|
+
};
|
|
96
|
+
try {
|
|
97
|
+
yield create(notification);
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
console.error('Openfin notifications error', e);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
mapToastButtons(toastButtons, row) {
|
|
105
|
+
if (!toastButtons) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
return toastButtons
|
|
109
|
+
.filter((t) => {
|
|
110
|
+
if (!t.task) {
|
|
111
|
+
logger.warn('Interop Toast button config has no task specified');
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
return !!t.condition({ details: row });
|
|
115
|
+
})
|
|
116
|
+
.map((t) => {
|
|
117
|
+
return {
|
|
118
|
+
title: t.placeholder,
|
|
119
|
+
type: 'button',
|
|
120
|
+
cta: t.cta,
|
|
121
|
+
onClick: {
|
|
122
|
+
task: t.task,
|
|
123
|
+
customData: {
|
|
124
|
+
message: t.message,
|
|
125
|
+
details: row,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
__decorate([
|
|
133
|
+
attr
|
|
134
|
+
], OpenfinNotifications.prototype, "toast", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
attr
|
|
137
|
+
], OpenfinNotifications.prototype, "mode", void 0);
|
|
138
|
+
OpenfinNotifications = __decorate([
|
|
139
|
+
customElement({
|
|
140
|
+
name: 'openfin-notifications',
|
|
141
|
+
template: html `
|
|
142
|
+
<template ${ref('notificationListener')}>
|
|
143
|
+
<slot></slot>
|
|
144
|
+
</template>
|
|
145
|
+
`,
|
|
146
|
+
})
|
|
147
|
+
], OpenfinNotifications);
|
|
148
|
+
export { OpenfinNotifications };
|