@genesislcap/foundation-fdc3 14.200.1-alpha-599cb19.0 → 14.201.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/dts/fdc3-channel-event.d.ts.map +1 -1
- package/dist/dts/fdc3.d.ts +57 -1
- package/dist/dts/fdc3.d.ts.map +1 -1
- package/dist/dts/index.d.ts +6 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/notifications/interop-notifications-listener.d.ts.map +1 -1
- package/dist/dts/util/fdc3-context-listener.d.ts +8 -338
- package/dist/dts/util/fdc3-context-listener.d.ts.map +1 -1
- package/dist/dts/util/{fdc3-listener.d.ts → fdc3-intent-listener.d.ts} +9 -17
- package/dist/dts/util/fdc3-intent-listener.d.ts.map +1 -0
- package/dist/dts/util/fdc3-system-channel-listener.d.ts +353 -0
- package/dist/dts/util/fdc3-system-channel-listener.d.ts.map +1 -0
- package/dist/dts/util/index.d.ts +3 -1
- package/dist/dts/util/index.d.ts.map +1 -1
- package/dist/esm/fdc3-channel-event.js +6 -1
- package/dist/esm/fdc3.js +99 -16
- package/dist/esm/index.js +1 -0
- package/dist/esm/util/fdc3-context-listener.js +10 -30
- package/dist/esm/util/fdc3-intent-listener.js +53 -0
- package/dist/esm/util/fdc3-system-channel-listener.js +60 -0
- package/dist/esm/util/index.js +3 -1
- package/dist/foundation-fdc3.api.json +384 -0
- package/dist/foundation-fdc3.d.ts +437 -19
- package/docs/api/foundation-fdc3.fdc3.addsystemchannellistener.md +25 -0
- package/docs/api/foundation-fdc3.fdc3.broadcastoncurrentchannel.md +25 -0
- package/docs/api/foundation-fdc3.fdc3.currentchannel_.md +13 -0
- package/docs/api/foundation-fdc3.fdc3.handlechannelcurrentcontext.md +26 -0
- package/docs/api/foundation-fdc3.fdc3.isinteropfdc3.md +13 -0
- package/docs/api/foundation-fdc3.fdc3.isready_.md +13 -0
- package/docs/api/foundation-fdc3.fdc3.md +7 -0
- package/docs/api/foundation-fdc3.fdc3.raiseintentforcontext.md +26 -0
- package/docs/api-report.md +65 -15
- package/package.json +17 -15
- package/test/fdc3.mock.ts +13 -9
- package/dist/dts/util/fdc3-listener.d.ts.map +0 -1
- package/dist/esm/util/fdc3-listener.js +0 -55
@@ -16,7 +16,10 @@ export interface FDC3
|
|
16
16
|
|
17
17
|
| Property | Modifiers | Type | Description |
|
18
18
|
| --- | --- | --- | --- |
|
19
|
+
| [currentChannel$](./foundation-fdc3.fdc3.currentchannel_.md) | | Observable<[FDC3Channel](./foundation-fdc3.fdc3channel.md)<!-- -->> | Observable which emits the current channel When a new channel is joined a new value is emitted |
|
20
|
+
| [isInteropFdc3](./foundation-fdc3.fdc3.isinteropfdc3.md) | | () => boolean | Check if the interop global is available. |
|
19
21
|
| [isReady](./foundation-fdc3.fdc3.isready.md) | | boolean | Whether the FDC3 API is ready. |
|
22
|
+
| [isReady$](./foundation-fdc3.fdc3.isready_.md) | | Observable<true> | Observable indicating the FDC3 API is ready. |
|
20
23
|
|
21
24
|
## Methods
|
22
25
|
|
@@ -24,12 +27,16 @@ export interface FDC3
|
|
24
27
|
| --- | --- |
|
25
28
|
| [addChannelListener(channelName, channelType, callback)](./foundation-fdc3.fdc3.addchannellistener.md) | Helper function to add a context listener on a channel with a handler for channel messages |
|
26
29
|
| [addIntentListeners(listeners)](./foundation-fdc3.fdc3.addintentlisteners.md) | Adds intent listeners for the specified intents. |
|
30
|
+
| [addSystemChannelListener(channelType, callback)](./foundation-fdc3.fdc3.addsystemchannellistener.md) | Helper function to add a context listener on to the system, aka 'color', channel with a handler for channel messages |
|
27
31
|
| [broadcastOnChannel(channelName, type, payload)](./foundation-fdc3.fdc3.broadcastonchannel.md) | Broadcasts a message on a given channel with a given type |
|
28
32
|
| [broadcastOnChannelEventHandler(channelName, type)](./foundation-fdc3.fdc3.broadcastonchanneleventhandler.md) | Helper function to broadcast message on channel in response to dispatched event |
|
33
|
+
| [broadcastOnCurrentChannel(payload, type)](./foundation-fdc3.fdc3.broadcastoncurrentchannel.md) | Broadcasts a message on the current app channel |
|
29
34
|
| [findIntent(intent, context)](./foundation-fdc3.fdc3.findintent.md) | Finds an app that supports the specified intent. |
|
30
35
|
| [findIntentsByContext(context)](./foundation-fdc3.fdc3.findintentsbycontext.md) | Finds all the intents supported by the specified context. |
|
31
36
|
| [getCurrentChannel()](./foundation-fdc3.fdc3.getcurrentchannel.md) | Helper function to get the current channel of the application |
|
32
37
|
| [getOrCreateChannel(channelId)](./foundation-fdc3.fdc3.getorcreatechannel.md) | Gets or creates the specified channel. |
|
38
|
+
| [handleChannelCurrentContext(channel, contextType, listenerCallback)](./foundation-fdc3.fdc3.handlechannelcurrentcontext.md) | Helper function to add a context listener on a channel with a handler for channel messages |
|
33
39
|
| [joinChannel(channelId)](./foundation-fdc3.fdc3.joinchannel.md) | Joins the specified channel. |
|
34
40
|
| [raiseIntent(context, intent)](./foundation-fdc3.fdc3.raiseintent.md) | Raises the specified intent with the specified context. |
|
41
|
+
| [raiseIntentForContext(context)](./foundation-fdc3.fdc3.raiseintentforcontext.md) | Raises an intent against an application based purely on the context data. |
|
35
42
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-fdc3](./foundation-fdc3.md) > [FDC3](./foundation-fdc3.fdc3.md) > [raiseIntentForContext](./foundation-fdc3.fdc3.raiseintentforcontext.md)
|
4
|
+
|
5
|
+
## FDC3.raiseIntentForContext() method
|
6
|
+
|
7
|
+
Raises an intent against an application based purely on the context data.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
raiseIntentForContext(context: FDC3Context): Promise<FDC3IntentResolution>;
|
13
|
+
```
|
14
|
+
|
15
|
+
## Parameters
|
16
|
+
|
17
|
+
| Parameter | Type | Description |
|
18
|
+
| --- | --- | --- |
|
19
|
+
| context | [FDC3Context](./foundation-fdc3.fdc3context.md) | The context to use. |
|
20
|
+
|
21
|
+
**Returns:**
|
22
|
+
|
23
|
+
Promise<[FDC3IntentResolution](./foundation-fdc3.fdc3intentresolution.md)<!-- -->>
|
24
|
+
|
25
|
+
A promise that resolves with the result of the intent resolution.
|
26
|
+
|
package/docs/api-report.md
CHANGED
@@ -20,17 +20,14 @@ import { IOConnectDesktop } from '@interopio/desktop';
|
|
20
20
|
import { LayoutCacheContainer } from '@genesislcap/foundation-utils';
|
21
21
|
import { NotificationDataRow } from '@genesislcap/foundation-notifications';
|
22
22
|
import { NotificationListener } from '@genesislcap/foundation-ui';
|
23
|
+
import { Observable } from 'rxjs';
|
23
24
|
import { OverrideFoundationElementDefinition } from '@microsoft/fast-foundation';
|
24
25
|
import { ViewTemplate } from '@microsoft/fast-element';
|
25
26
|
|
26
27
|
// @alpha
|
27
|
-
export interface
|
28
|
-
// (undocumented)
|
29
|
-
callback: (any: any) => void;
|
28
|
+
export interface AppChannelListenerConfig extends SystemChannelListenerConfig {
|
30
29
|
// (undocumented)
|
31
30
|
channelName: string;
|
32
|
-
// (undocumented)
|
33
|
-
channelType: string;
|
34
31
|
}
|
35
32
|
|
36
33
|
// Warning: (ae-internal-missing-underscore) The name "DefaultFDC3" should be prefixed with an underscore because the declaration is marked as @internal
|
@@ -43,10 +40,16 @@ export class DefaultFDC3 implements FDC3 {
|
|
43
40
|
// (undocumented)
|
44
41
|
addIntentListeners(listeners: Map<FDC3Intents, FDC3ContextHandler>): void;
|
45
42
|
// (undocumented)
|
43
|
+
addSystemChannelListener(channelType: string, callback: (any: any) => void): Promise<void>;
|
44
|
+
// (undocumented)
|
46
45
|
broadcastOnChannel(channelName: string, type: string, payload: any): Promise<void>;
|
47
46
|
// (undocumented)
|
48
47
|
broadcastOnChannelEventHandler(channelName: string, type: string): Promise<(e: any) => Promise<void>>;
|
49
48
|
// (undocumented)
|
49
|
+
broadcastOnCurrentChannel(payload: any, type?: string): Promise<void>;
|
50
|
+
// (undocumented)
|
51
|
+
currentChannel$: Observable<Channel>;
|
52
|
+
// (undocumented)
|
50
53
|
findIntent(intent: FDC3Intents, context?: FDC3Context): Promise<FDC3AppIntent>;
|
51
54
|
// (undocumented)
|
52
55
|
findIntentsByContext(context: FDC3Context): Promise<FDC3AppIntent[]>;
|
@@ -55,11 +58,19 @@ export class DefaultFDC3 implements FDC3 {
|
|
55
58
|
// (undocumented)
|
56
59
|
getOrCreateChannel(channelId: string): Promise<FDC3Channel>;
|
57
60
|
// (undocumented)
|
61
|
+
handleChannelCurrentContext(channel: Channel | FDC3Channel, contextType: string, listenerCallback: (FDC3Context: any) => any): Promise<void>;
|
62
|
+
// (undocumented)
|
63
|
+
isInteropFdc3: () => boolean;
|
64
|
+
// (undocumented)
|
65
|
+
isReady$: Observable<true>;
|
66
|
+
// (undocumented)
|
58
67
|
isReady: boolean;
|
59
68
|
// (undocumented)
|
60
69
|
joinChannel(channelId: string): Promise<void>;
|
61
70
|
// (undocumented)
|
62
71
|
raiseIntent(context: FDC3Context, intent?: FDC3Intents): Promise<FDC3IntentResolution>;
|
72
|
+
// (undocumented)
|
73
|
+
raiseIntentForContext(context: FDC3Context): Promise<FDC3IntentResolution>;
|
63
74
|
}
|
64
75
|
|
65
76
|
// Warning: (ae-internal-mixed-release-tag) Mixed release tags are not allowed for "FDC3" because one of its declarations is marked as @internal
|
@@ -68,15 +79,22 @@ export class DefaultFDC3 implements FDC3 {
|
|
68
79
|
export interface FDC3 {
|
69
80
|
addChannelListener(channelName: string, channelType: string, callback: (any: any) => void): Promise<Channel>;
|
70
81
|
addIntentListeners(listeners: Map<FDC3Intents, FDC3ContextHandler>): void;
|
82
|
+
addSystemChannelListener(channelType: string, callback: (any: any) => void): Promise<void>;
|
71
83
|
broadcastOnChannel(channelName: string, type: string, payload: any): Promise<void>;
|
72
84
|
broadcastOnChannelEventHandler(channelName: string, type: string): Promise<(e: any) => Promise<void>>;
|
85
|
+
broadcastOnCurrentChannel(payload: any, type?: string): Promise<void>;
|
86
|
+
currentChannel$: Observable<FDC3Channel>;
|
73
87
|
findIntent(intent: FDC3Intents, context?: FDC3Context): Promise<FDC3AppIntent>;
|
74
88
|
findIntentsByContext(context: FDC3Context): Promise<FDC3AppIntent[]>;
|
75
89
|
getCurrentChannel(): Promise<Channel>;
|
76
90
|
getOrCreateChannel(channelId: string): Promise<FDC3Channel>;
|
91
|
+
handleChannelCurrentContext(channel: Channel | FDC3Channel, contextType: string, listenerCallback: (FDC3Context: any) => any): Promise<void>;
|
92
|
+
isInteropFdc3: () => boolean;
|
93
|
+
isReady$: Observable<true>;
|
77
94
|
isReady: boolean;
|
78
95
|
joinChannel(channelId: string): Promise<void>;
|
79
96
|
raiseIntent(context: FDC3Context, intent?: FDC3Intents): Promise<FDC3IntentResolution>;
|
97
|
+
raiseIntentForContext(context: FDC3Context): Promise<FDC3IntentResolution>;
|
80
98
|
}
|
81
99
|
|
82
100
|
// @internal
|
@@ -120,19 +138,18 @@ export interface FDC3Context extends Context {
|
|
120
138
|
// @public (undocumented)
|
121
139
|
export type FDC3ContextHandler = ContextHandler;
|
122
140
|
|
123
|
-
// @
|
124
|
-
export
|
141
|
+
// @alpha
|
142
|
+
export class Fdc3ContextListener extends Fdc3SystemChannelListener {
|
143
|
+
// (undocumented)
|
144
|
+
protected addChannelListeners(): void;
|
145
|
+
// (undocumented)
|
146
|
+
config: AppChannelListenerConfig[];
|
125
147
|
}
|
126
148
|
|
127
|
-
//
|
128
|
-
export type FDC3Intents = Intents;
|
129
|
-
|
130
|
-
// Warning: (ae-forgotten-export) The symbol "Fdc3Listener_base" needs to be exported by the entry point index.d.ts
|
149
|
+
// Warning: (ae-forgotten-export) The symbol "Fdc3IntentListener_base" needs to be exported by the entry point index.d.ts
|
131
150
|
//
|
132
151
|
// @alpha
|
133
|
-
export class
|
134
|
-
// (undocumented)
|
135
|
-
channelConfig: ChannelConfig[];
|
152
|
+
export class Fdc3IntentListener extends Fdc3IntentListener_base {
|
136
153
|
// (undocumented)
|
137
154
|
connectedCallback(): void;
|
138
155
|
// (undocumented)
|
@@ -143,6 +160,13 @@ export class Fdc3Listener extends Fdc3Listener_base {
|
|
143
160
|
intentConfig: IntentConfig[];
|
144
161
|
}
|
145
162
|
|
163
|
+
// @public (undocumented)
|
164
|
+
export interface FDC3IntentResolution extends IntentResolution {
|
165
|
+
}
|
166
|
+
|
167
|
+
// @public (undocumented)
|
168
|
+
export type FDC3Intents = Intents;
|
169
|
+
|
146
170
|
// Warning: (ae-forgotten-export) The symbol "Fdc3RaiseIntent_base" needs to be exported by the entry point index.d.ts
|
147
171
|
//
|
148
172
|
// @alpha
|
@@ -165,10 +189,28 @@ export class Fdc3RaiseIntent extends Fdc3RaiseIntent_base {
|
|
165
189
|
mappingFunction: (any: any) => any;
|
166
190
|
}
|
167
191
|
|
192
|
+
// Warning: (ae-forgotten-export) The symbol "Fdc3SystemChannelListener_base" needs to be exported by the entry point index.d.ts
|
193
|
+
//
|
194
|
+
// @alpha
|
195
|
+
export class Fdc3SystemChannelListener extends Fdc3SystemChannelListener_base {
|
196
|
+
// (undocumented)
|
197
|
+
protected addChannelListeners(): void;
|
198
|
+
// (undocumented)
|
199
|
+
config: SystemChannelListenerConfig[];
|
200
|
+
// (undocumented)
|
201
|
+
connectedCallback(): void;
|
202
|
+
// (undocumented)
|
203
|
+
deepClone(): Node;
|
204
|
+
// (undocumented)
|
205
|
+
disconnectedCallback(): void;
|
206
|
+
// (undocumented)
|
207
|
+
fdc3: FDC3;
|
208
|
+
}
|
209
|
+
|
168
210
|
// @alpha
|
169
211
|
export interface IntentConfig {
|
170
212
|
// (undocumented)
|
171
|
-
callback: (
|
213
|
+
callback: (FDC3Context: any) => void;
|
172
214
|
// (undocumented)
|
173
215
|
intent: string;
|
174
216
|
}
|
@@ -192,6 +234,14 @@ export class InteropNotificationsListener extends NotificationListener {
|
|
192
234
|
protected showNotificationToast(row: NotificationDataRow): void;
|
193
235
|
}
|
194
236
|
|
237
|
+
// @alpha
|
238
|
+
export interface SystemChannelListenerConfig {
|
239
|
+
// (undocumented)
|
240
|
+
callback: (any: any) => void;
|
241
|
+
// (undocumented)
|
242
|
+
channelType: string;
|
243
|
+
}
|
244
|
+
|
195
245
|
// (No @packageDocumentation comment for this package)
|
196
246
|
|
197
247
|
```
|
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.
|
4
|
+
"version": "14.201.0",
|
5
5
|
"sideEffects": false,
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
7
7
|
"main": "dist/esm/index.js",
|
@@ -59,25 +59,27 @@
|
|
59
59
|
}
|
60
60
|
},
|
61
61
|
"devDependencies": {
|
62
|
-
"@genesislcap/foundation-testing": "14.
|
63
|
-
"@genesislcap/genx": "14.
|
64
|
-
"@genesislcap/rollup-builder": "14.
|
65
|
-
"@genesislcap/ts-builder": "14.
|
66
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
67
|
-
"@genesislcap/vite-builder": "14.
|
68
|
-
"@genesislcap/webpack-builder": "14.
|
69
|
-
"rimraf": "^5.0.0"
|
62
|
+
"@genesislcap/foundation-testing": "14.201.0",
|
63
|
+
"@genesislcap/genx": "14.201.0",
|
64
|
+
"@genesislcap/rollup-builder": "14.201.0",
|
65
|
+
"@genesislcap/ts-builder": "14.201.0",
|
66
|
+
"@genesislcap/uvu-playwright-builder": "14.201.0",
|
67
|
+
"@genesislcap/vite-builder": "14.201.0",
|
68
|
+
"@genesislcap/webpack-builder": "14.201.0",
|
69
|
+
"rimraf": "^5.0.0",
|
70
|
+
"sinon": "^17.0.1"
|
70
71
|
},
|
71
72
|
"dependencies": {
|
72
73
|
"@finos/fdc3": "^1.2.0",
|
73
|
-
"@genesislcap/foundation-logger": "14.
|
74
|
-
"@genesislcap/foundation-notifications": "14.
|
75
|
-
"@genesislcap/foundation-ui": "14.
|
76
|
-
"@genesislcap/foundation-utils": "14.
|
77
|
-
"@genesislcap/web-core": "14.
|
74
|
+
"@genesislcap/foundation-logger": "14.201.0",
|
75
|
+
"@genesislcap/foundation-notifications": "14.201.0",
|
76
|
+
"@genesislcap/foundation-ui": "14.201.0",
|
77
|
+
"@genesislcap/foundation-utils": "14.201.0",
|
78
|
+
"@genesislcap/web-core": "14.201.0",
|
78
79
|
"@interopio/desktop": "^6.3.1",
|
79
80
|
"@microsoft/fast-element": "^1.12.0",
|
80
81
|
"@microsoft/fast-foundation": "^2.49.4",
|
82
|
+
"rxjs": "^7.5.4",
|
81
83
|
"tslib": "^2.3.1"
|
82
84
|
},
|
83
85
|
"repository": {
|
@@ -88,5 +90,5 @@
|
|
88
90
|
"publishConfig": {
|
89
91
|
"access": "public"
|
90
92
|
},
|
91
|
-
"gitHead": "
|
93
|
+
"gitHead": "d9585bb0f774fe0193ae3b7306e3b73a69e09f56"
|
92
94
|
}
|
package/test/fdc3.mock.ts
CHANGED
@@ -4,21 +4,25 @@ export const mockFdc3 = () => {
|
|
4
4
|
if (!('fdc3' in window)) {
|
5
5
|
const broadcast = sinon.stub();
|
6
6
|
const addContextListener = sinon.stub();
|
7
|
+
const channel = {
|
8
|
+
getCurrentContext: async () => ({}),
|
9
|
+
broadcast,
|
10
|
+
addContextListener,
|
11
|
+
};
|
12
|
+
|
7
13
|
window.fdc3 = {
|
8
14
|
broadcast,
|
15
|
+
channel,
|
9
16
|
addContextListener,
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}),
|
17
|
+
findIntent: sinon.spy(),
|
18
|
+
findIntentsByContext: sinon.spy(),
|
19
|
+
getOrCreateChannel: sinon.stub().returns(channel),
|
14
20
|
getInfo: () => ({ fdc3Version: '2.1', provider: 'FINOS' }),
|
21
|
+
joinChannel: sinon.spy(),
|
15
22
|
raiseIntent: sinon.stub(),
|
16
23
|
raiseIntentForContext: sinon.stub(),
|
17
|
-
addIntentListener: (
|
18
|
-
|
19
|
-
fireIntent: (value) => callback(value),
|
20
|
-
});
|
21
|
-
},
|
24
|
+
addIntentListener: sinon.spy(),
|
25
|
+
getCurrentChannel: sinon.stub().returns(channel),
|
22
26
|
};
|
23
27
|
}
|
24
28
|
};
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"fdc3-listener.d.ts","sourceRoot":"","sources":["../../../src/util/fdc3-listener.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,GAAG,KAAA,KAAK,IAAI,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,GAAG,KAAA,KAAK,IAAI,CAAC;CACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED;;;GAGG;AACH,qBAGa,YAAa,SAAQ,iBAAiC;IAC3D,IAAI,EAAE,IAAI,CAAC;IAEjB,YAAY,EAAE,YAAY,EAAE,CAAM;IAElC,aAAa,EAAE,aAAa,EAAE,CAAM;IAE3B,SAAS,IAAI,IAAI;IA0B1B,iBAAiB;CAYlB"}
|
@@ -1,55 +0,0 @@
|
|
1
|
-
import { __decorate } from "tslib";
|
2
|
-
import { LifecycleMixin } from '@genesislcap/foundation-utils';
|
3
|
-
import { customElement, FoundationElement } from '@genesislcap/web-core';
|
4
|
-
import { FDC3 } from '../fdc3';
|
5
|
-
/**
|
6
|
-
* fdc3-listener
|
7
|
-
* @alpha
|
8
|
-
*/
|
9
|
-
let Fdc3Listener = class Fdc3Listener extends LifecycleMixin(FoundationElement) {
|
10
|
-
constructor() {
|
11
|
-
super(...arguments);
|
12
|
-
this.intentConfig = [];
|
13
|
-
this.channelConfig = [];
|
14
|
-
}
|
15
|
-
deepClone() {
|
16
|
-
const copy = super.deepClone();
|
17
|
-
if (this.intentConfig) {
|
18
|
-
copy.intentConfig = this.intentConfig.map((c) => {
|
19
|
-
const copyConfig = Object.assign({}, c);
|
20
|
-
if (c.callback) {
|
21
|
-
copyConfig.callback = c.callback.bind(this);
|
22
|
-
}
|
23
|
-
return copyConfig;
|
24
|
-
});
|
25
|
-
}
|
26
|
-
if (this.channelConfig) {
|
27
|
-
copy.channelConfig = this.channelConfig.map((c) => {
|
28
|
-
const copyConfig = Object.assign({}, c);
|
29
|
-
if (c.callback) {
|
30
|
-
copyConfig.callback = c.callback.bind(this);
|
31
|
-
}
|
32
|
-
return copyConfig;
|
33
|
-
});
|
34
|
-
}
|
35
|
-
return copy;
|
36
|
-
}
|
37
|
-
connectedCallback() {
|
38
|
-
super.connectedCallback();
|
39
|
-
if (window.fdc3) {
|
40
|
-
const listeners = new Map();
|
41
|
-
this.intentConfig.forEach((intent) => listeners.set(intent.intent, intent.callback));
|
42
|
-
this.fdc3.addIntentListeners(listeners);
|
43
|
-
this.channelConfig.forEach((c) => this.fdc3.addChannelListener(c.channelName, c.channelType, c.callback));
|
44
|
-
}
|
45
|
-
}
|
46
|
-
};
|
47
|
-
__decorate([
|
48
|
-
FDC3
|
49
|
-
], Fdc3Listener.prototype, "fdc3", void 0);
|
50
|
-
Fdc3Listener = __decorate([
|
51
|
-
customElement({
|
52
|
-
name: 'fdc3-listener',
|
53
|
-
})
|
54
|
-
], Fdc3Listener);
|
55
|
-
export { Fdc3Listener };
|