@ixon-cdk/iframe-adapter 1.2.0-next.4 → 1.2.0-next.6

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.
Files changed (3) hide show
  1. package/index.d.ts +9 -0
  2. package/index.js +12 -8
  3. package/package.json +4 -3
package/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { ComponentContext, ComponentContextOptions } from '@ixon-cdk/types';
2
+
3
+ declare module '@ixon-cdk/iframe-adapter' {
4
+ function connect(options: { iframe: HTMLIFrameElement; context: ComponentContext }): {
5
+ destroy(): void;
6
+ };
7
+
8
+ function getComponentContext(options?: ComponentContextOptions): Promise<ComponentContext>;
9
+ }
package/index.js CHANGED
@@ -315,18 +315,22 @@ export function connect({ iframe, context }) {
315
315
 
316
316
  // Broadcasts time range changes to connected iframe
317
317
  context.ontimerangechange = (...args) => {
318
- iframe.contentWindow.postMessage({
319
- type: EVENTS.TimeRangeChange,
320
- payload: args,
321
- });
318
+ if (iframe.contentWindow) {
319
+ iframe.contentWindow.postMessage({
320
+ type: EVENTS.TimeRangeChange,
321
+ payload: args,
322
+ });
323
+ }
322
324
  };
323
325
 
324
326
  // Broadcasts VPN Client status changes to connected iframe
325
327
  context.onvpnclientstatuschange = (...args) => {
326
- iframe.contentWindow.postMessage({
327
- type: EVENTS.VpnClientStatusChange,
328
- payload: args,
329
- });
328
+ if (iframe.contentWindow) {
329
+ iframe.contentWindow.postMessage({
330
+ type: EVENTS.VpnClientStatusChange,
331
+ payload: args,
332
+ });
333
+ }
330
334
  };
331
335
 
332
336
  return {
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@ixon-cdk/iframe-adapter",
3
- "version": "1.2.0-next.4",
3
+ "version": "1.2.0-next.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "",
7
7
  "license": "ISC",
8
8
  "files": [
9
- "!index.spec.js"
9
+ "index.js",
10
+ "index.d.ts"
10
11
  ],
11
12
  "peerDependencies": {
12
- "@ixon-cdk/types": "^1.2.0-next.4"
13
+ "@ixon-cdk/types": "^1.2.0-next.6"
13
14
  }
14
15
  }