@genesislcap/foundation-fdc3 14.192.2-fdc3-enhancements.7 → 14.192.2-fdc3-enhancements.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ import { FDC3 } from '../fdc3';
6
6
  */
7
7
  export interface IntentConfig {
8
8
  intent: string;
9
- callback: (any: any) => void;
9
+ callback: (FDC3Context: any) => void;
10
10
  }
11
11
  /**
12
12
  * fdc3-listener listen channel config
@@ -15,7 +15,7 @@ export interface IntentConfig {
15
15
  export interface ChannelConfig {
16
16
  channelName?: string;
17
17
  channelType: string;
18
- callback: (any: any) => void;
18
+ callback: (FDC3Context: any) => void;
19
19
  }
20
20
  declare const Fdc3Listener_base: (new (...args: any[]) => {
21
21
  "__#1@#_container": import("@genesislcap/foundation-utils").FoundationLayoutContainer | import("@genesislcap/foundation-utils").LayoutCacheContainer | import("@genesislcap/foundation-utils").DOMContainer;
@@ -354,6 +354,7 @@ export declare class Fdc3Listener extends Fdc3Listener_base {
354
354
  deepClone(): Node;
355
355
  connectedCallback(): void;
356
356
  disconnectedCallback(): void;
357
+ private handleChanelCurrentContext;
357
358
  }
358
359
  export {};
359
360
  //# sourceMappingURL=fdc3-listener.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fdc3-listener.d.ts","sourceRoot":"","sources":["../../../src/util/fdc3-listener.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAEzE,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,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,GAAG,KAAA,KAAK,IAAI,CAAC;CACzB;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED;;;GAGG;AACH,qBAGa,YAAa,SAAQ,iBAAiC;IAC3D,IAAI,EAAE,IAAI,CAAC;IAEjB,YAAY,EAAE,YAAY,EAAE,CAAM;IAElC,aAAa,EAAE,aAAa,EAAE,CAAM;IAEpC,OAAO,CAAC,mBAAmB,CAAsB;IAExC,SAAS,IAAI,IAAI;IA0B1B,iBAAiB;IAwBjB,oBAAoB;YAKN,0BAA0B;CAUzC"}
@@ -1,5 +1,4 @@
1
1
  import { __awaiter, __decorate } from "tslib";
2
- import { getOrCreateChannel } from '@finos/fdc3';
3
2
  import { LifecycleMixin } from '@genesislcap/foundation-utils';
4
3
  import { customElement, FoundationElement } from '@genesislcap/web-core';
5
4
  import { Subscription } from 'rxjs';
@@ -45,11 +44,13 @@ let Fdc3Listener = class Fdc3Listener extends LifecycleMixin(FoundationElement)
45
44
  this.fdc3.addIntentListeners(listeners);
46
45
  this.channelConfig.forEach((c) => __awaiter(this, void 0, void 0, function* () {
47
46
  if (c.channelName) {
48
- const channel = yield getOrCreateChannel(c.channelName);
47
+ const channel = yield this.fdc3.getOrCreateChannel(c.channelName);
48
+ this.handleChanelCurrentContext(channel, c.channelType, c.callback);
49
49
  this.fdc3.addChannelListener(channel, c.channelType, c.callback);
50
50
  }
51
51
  else {
52
52
  this.channelSubscription.add(this.fdc3.currentChannelObs.subscribe((channel) => {
53
+ this.handleChanelCurrentContext(channel, c.channelType, c.callback);
53
54
  this.fdc3.addChannelListener(channel, c.channelType, c.callback);
54
55
  }));
55
56
  }
@@ -60,6 +61,14 @@ let Fdc3Listener = class Fdc3Listener extends LifecycleMixin(FoundationElement)
60
61
  this.channelSubscription.unsubscribe();
61
62
  super.disconnectedCallback();
62
63
  }
64
+ handleChanelCurrentContext(channel, contextType, listenerCallback) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ const currentContextValue = yield channel.getCurrentContext(contextType);
67
+ if (currentContextValue) {
68
+ listenerCallback(currentContextValue);
69
+ }
70
+ });
71
+ }
63
72
  };
64
73
  __decorate([
65
74
  FDC3
@@ -25,7 +25,7 @@ import { ViewTemplate } from '@microsoft/fast-element';
25
25
  export declare interface ChannelConfig {
26
26
  channelName?: string;
27
27
  channelType: string;
28
- callback: (any: any) => void;
28
+ callback: (FDC3Context: any) => void;
29
29
  }
30
30
 
31
31
  /**
@@ -544,6 +544,7 @@ export declare class Fdc3Listener extends Fdc3Listener_base {
544
544
  deepClone(): Node;
545
545
  connectedCallback(): void;
546
546
  disconnectedCallback(): void;
547
+ private handleChanelCurrentContext;
547
548
  }
548
549
 
549
550
  declare const Fdc3Listener_base: (new (...args: any[]) => {
@@ -1220,7 +1221,7 @@ declare const Fdc3RaiseIntent_base: (new (...args: any[]) => {
1220
1221
  */
1221
1222
  export declare interface IntentConfig {
1222
1223
  intent: string;
1223
- callback: (any: any) => void;
1224
+ callback: (FDC3Context: any) => void;
1224
1225
  }
1225
1226
 
1226
1227
  /**
@@ -27,7 +27,7 @@ import { ViewTemplate } from '@microsoft/fast-element';
27
27
  // @alpha
28
28
  export interface ChannelConfig {
29
29
  // (undocumented)
30
- callback: (any: any) => void;
30
+ callback: (FDC3Context: any) => void;
31
31
  // (undocumented)
32
32
  channelName?: string;
33
33
  // (undocumented)
@@ -180,7 +180,7 @@ export class Fdc3RaiseIntent extends Fdc3RaiseIntent_base {
180
180
  // @alpha
181
181
  export interface IntentConfig {
182
182
  // (undocumented)
183
- callback: (any: any) => void;
183
+ callback: (FDC3Context: any) => void;
184
184
  // (undocumented)
185
185
  intent: string;
186
186
  }
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.192.2-fdc3-enhancements.7",
4
+ "version": "14.192.2-fdc3-enhancements.9",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -59,22 +59,22 @@
59
59
  }
60
60
  },
61
61
  "devDependencies": {
62
- "@genesislcap/foundation-testing": "14.192.2-fdc3-enhancements.7",
63
- "@genesislcap/genx": "14.192.2-fdc3-enhancements.7",
64
- "@genesislcap/rollup-builder": "14.192.2-fdc3-enhancements.7",
65
- "@genesislcap/ts-builder": "14.192.2-fdc3-enhancements.7",
66
- "@genesislcap/uvu-playwright-builder": "14.192.2-fdc3-enhancements.7",
67
- "@genesislcap/vite-builder": "14.192.2-fdc3-enhancements.7",
68
- "@genesislcap/webpack-builder": "14.192.2-fdc3-enhancements.7",
62
+ "@genesislcap/foundation-testing": "14.192.2-fdc3-enhancements.9",
63
+ "@genesislcap/genx": "14.192.2-fdc3-enhancements.9",
64
+ "@genesislcap/rollup-builder": "14.192.2-fdc3-enhancements.9",
65
+ "@genesislcap/ts-builder": "14.192.2-fdc3-enhancements.9",
66
+ "@genesislcap/uvu-playwright-builder": "14.192.2-fdc3-enhancements.9",
67
+ "@genesislcap/vite-builder": "14.192.2-fdc3-enhancements.9",
68
+ "@genesislcap/webpack-builder": "14.192.2-fdc3-enhancements.9",
69
69
  "rimraf": "^5.0.0"
70
70
  },
71
71
  "dependencies": {
72
72
  "@finos/fdc3": "^1.2.0",
73
- "@genesislcap/foundation-logger": "14.192.2-fdc3-enhancements.7",
74
- "@genesislcap/foundation-notifications": "14.192.2-fdc3-enhancements.7",
75
- "@genesislcap/foundation-ui": "14.192.2-fdc3-enhancements.7",
76
- "@genesislcap/foundation-utils": "14.192.2-fdc3-enhancements.7",
77
- "@genesislcap/web-core": "14.192.2-fdc3-enhancements.7",
73
+ "@genesislcap/foundation-logger": "14.192.2-fdc3-enhancements.9",
74
+ "@genesislcap/foundation-notifications": "14.192.2-fdc3-enhancements.9",
75
+ "@genesislcap/foundation-ui": "14.192.2-fdc3-enhancements.9",
76
+ "@genesislcap/foundation-utils": "14.192.2-fdc3-enhancements.9",
77
+ "@genesislcap/web-core": "14.192.2-fdc3-enhancements.9",
78
78
  "@interopio/desktop": "^6.3.1",
79
79
  "@microsoft/fast-element": "^1.12.0",
80
80
  "@microsoft/fast-foundation": "^2.49.4",
@@ -89,5 +89,5 @@
89
89
  "publishConfig": {
90
90
  "access": "public"
91
91
  },
92
- "gitHead": "c898c9b35e54f75abf6a6ca474a0a006f563a5cb"
92
+ "gitHead": "7a5b010b3245fcdb843590c2eafecc5ae3d311e2"
93
93
  }
package/test/fdc3.mock.ts CHANGED
@@ -4,12 +4,18 @@ export const mockFdc3 = () => {
4
4
  if (!('fdc3' in window)) {
5
5
  const broadcast = sinon.stub();
6
6
  const addContextListener = sinon.stub();
7
- const channel = sinon.stub();
7
+ const getCurrentContext = sinon.stub();
8
+ const channel = sinon.stub().returns({
9
+ getCurrentContext: async () => ({}),
10
+ broadcast,
11
+ addContextListener,
12
+ });
8
13
  window.fdc3 = {
9
14
  broadcast,
10
15
  channel,
11
16
  addContextListener,
12
17
  getOrCreateChannel: sinon.stub().returns({
18
+ getCurrentContext,
13
19
  broadcast,
14
20
  addContextListener,
15
21
  }),