@openfin/core 32.75.8 → 32.75.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "32.75.8",
3
+ "version": "32.75.9",
4
4
  "license": "SEE LICENSE IN LICENSE.MD",
5
5
  "main": "./src/mock.js",
6
6
  "types": "./src/mock.d.ts",
package/src/OpenFin.d.ts CHANGED
@@ -1923,6 +1923,7 @@ export type Margins = {
1923
1923
  * Options for printing a webpage in OpenFin.
1924
1924
  */
1925
1925
  export type PrintOptions = {
1926
+ content?: 'self';
1926
1927
  /**
1927
1928
  * Disables prompting the user for print settings.
1928
1929
  */
@@ -1966,7 +1967,7 @@ export type PrintOptions = {
1966
1967
  /**
1967
1968
  * Page range to print.
1968
1969
  */
1969
- pageRanges?: Record<'from' | 'to', number>;
1970
+ pageRanges?: Array<Record<'from' | 'to', number>>;
1970
1971
  /**
1971
1972
  * Duplex mode of the printed webpage.
1972
1973
  */
@@ -1976,6 +1977,14 @@ export type PrintOptions = {
1976
1977
  */
1977
1978
  dpi?: Dpi;
1978
1979
  };
1980
+ export type ScreenshotPrintOptions = {
1981
+ content: 'screenshot';
1982
+ };
1983
+ export type WindowViewsPrintOptions = {
1984
+ content: 'views';
1985
+ includeSelf?: boolean;
1986
+ };
1987
+ export type WindowPrintOptions = PrintOptions | ScreenshotPrintOptions | WindowViewsPrintOptions;
1979
1988
  /**
1980
1989
  * A request to write data to the clipboard.
1981
1990
  */
@@ -3,6 +3,7 @@ import { EmitterBase } from '../base';
3
3
  import { Transport } from '../../transport/transport';
4
4
  import { BaseEvent } from '../events/base';
5
5
  export declare class WebContents<T extends BaseEvent> extends EmitterBase<T> {
6
+ identity: OpenFin.Identity;
6
7
  entityType: string;
7
8
  constructor(wire: Transport, identity: OpenFin.Identity, entityType: string);
8
9
  capturePage(options?: OpenFin.CapturePageOptions): Promise<string>;
@@ -5,6 +5,7 @@ const base_1 = require("../base");
5
5
  class WebContents extends base_1.EmitterBase {
6
6
  constructor(wire, identity, entityType) {
7
7
  super(wire, entityType, identity.uuid, identity.name);
8
+ this.identity = identity;
8
9
  this.entityType = entityType;
9
10
  }
10
11
  capturePage(options) {
@@ -41,7 +42,7 @@ class WebContents extends base_1.EmitterBase {
41
42
  })
42
43
  .then(() => undefined);
43
44
  }
44
- print(options) {
45
+ print(options = {}) {
45
46
  return this.wire.sendAction('print', { ...this.identity, options }).then(() => undefined);
46
47
  }
47
48
  findInPage(searchTerm, options) {
@@ -1074,4 +1074,11 @@ export declare class _Window extends WebContents<OpenFin.WindowEvent> {
1074
1074
  * @tutorial Window.dispatchPopupResult
1075
1075
  */
1076
1076
  dispatchPopupResult(data: any): Promise<void>;
1077
+ /**
1078
+ * Prints the contents of the window.
1079
+ *
1080
+ * @param options Configuration for the print task.
1081
+ * @tutorial Window.print
1082
+ */
1083
+ print(options?: OpenFin.WindowPrintOptions): Promise<void>;
1077
1084
  }
@@ -1320,5 +1320,24 @@ class _Window extends main_1.WebContents {
1320
1320
  });
1321
1321
  await this.wire.sendAction('dispatch-popup-result', { data, ...this.identity });
1322
1322
  }
1323
+ /**
1324
+ * Prints the contents of the window.
1325
+ *
1326
+ * @param options Configuration for the print task.
1327
+ * @tutorial Window.print
1328
+ */
1329
+ async print(options = { content: 'self' }) {
1330
+ switch (options.content) {
1331
+ case undefined:
1332
+ case 'self':
1333
+ return super.print(options);
1334
+ case 'screenshot':
1335
+ return this.wire.sendAction('print-screenshot', this.identity).then(() => undefined);
1336
+ case 'views':
1337
+ return this.wire.sendAction('print-views', { ...this.identity, options }).then(() => undefined);
1338
+ default:
1339
+ return undefined;
1340
+ }
1341
+ }
1323
1342
  }
1324
1343
  exports._Window = _Window;
@@ -37,6 +37,22 @@ export interface ProtocolMap extends ProtocolMapBase {
37
37
  }>;
38
38
  'trigger-before-unload': IdentityCall<{}, boolean>;
39
39
  'window-get-views': IdentityCall<{}, OpenFin.Identity[]>;
40
+ 'print': {
41
+ request: OpenFin.Identity & {
42
+ options: OpenFin.PrintOptions;
43
+ };
44
+ response: void;
45
+ };
46
+ 'print-screenshot': {
47
+ request: OpenFin.Identity;
48
+ response: void;
49
+ };
50
+ 'print-views': {
51
+ request: OpenFin.Identity & {
52
+ options: OpenFin.WindowViewsPrintOptions;
53
+ };
54
+ response: void;
55
+ };
40
56
  'launch-manifest': {
41
57
  request: {
42
58
  manifestUrl: string;