@interopio/workspaces-api 3.4.2 → 3.4.3

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.
@@ -1841,6 +1841,16 @@
1841
1841
  });
1842
1842
  };
1843
1843
 
1844
+ const isDesktop = () => {
1845
+ return typeof window === "undefined" ?
1846
+ true :
1847
+ window.glue42gd || window.iodesktop;
1848
+ };
1849
+ const browserGlobal = () => {
1850
+ return typeof window === "undefined" ? null :
1851
+ window.glue42core || window.iobrowser;
1852
+ };
1853
+
1844
1854
  class InteropTransport {
1845
1855
  agm;
1846
1856
  registry;
@@ -1852,8 +1862,7 @@
1852
1862
  this.registry = registry;
1853
1863
  }
1854
1864
  async initiate(actualWindowId) {
1855
- const desktopGlobal = window.glue42gd || window.iodesktop;
1856
- if (desktopGlobal) {
1865
+ if (isDesktop()) {
1857
1866
  await Promise.all(Object.values(OUTGOING_METHODS).map((method) => {
1858
1867
  return this.verifyMethodLive(method.name);
1859
1868
  }));
@@ -1862,8 +1871,7 @@
1862
1871
  }));
1863
1872
  return;
1864
1873
  }
1865
- const browserGlobal = window.glue42core || window.iobrowser;
1866
- const systemId = browserGlobal.communicationId;
1874
+ const systemId = browserGlobal().communicationId;
1867
1875
  await Promise.all([
1868
1876
  this.verifyMethodLive(webPlatformMethodName, systemId),
1869
1877
  this.verifyMethodLive(webPlatformWspStreamName, systemId)
@@ -1878,8 +1886,7 @@
1878
1886
  }
1879
1887
  subscribePlatform(eventCallback) {
1880
1888
  this.coreEventMethodInitiated = true;
1881
- const browserGlobal = window.glue42core || window.iobrowser;
1882
- const systemId = browserGlobal.communicationId;
1889
+ const systemId = browserGlobal().communicationId;
1883
1890
  this.corePlatformSubPromise = this.agm.subscribe(webPlatformWspStreamName, systemId ? { target: { instance: systemId } } : undefined);
1884
1891
  this.corePlatformSubPromise
1885
1892
  .then((sub) => {
@@ -1902,11 +1909,9 @@
1902
1909
  return subscription;
1903
1910
  }
1904
1911
  async transmitControl(operation, operationArguments) {
1905
- const desktopGlobal = window.glue42gd || window.iodesktop;
1906
- const browserGlobal = window.glue42core || window.iobrowser;
1907
- const invocationArguments = desktopGlobal ? { operation, operationArguments } : { operation, domain: "workspaces", data: operationArguments };
1908
- const methodName = desktopGlobal ? OUTGOING_METHODS.control.name : webPlatformMethodName;
1909
- const platformTarget = desktopGlobal ? undefined : browserGlobal.communicationId;
1912
+ const invocationArguments = isDesktop() ? { operation, operationArguments } : { operation, domain: "workspaces", data: operationArguments };
1913
+ const methodName = isDesktop() ? OUTGOING_METHODS.control.name : webPlatformMethodName;
1914
+ const platformTarget = isDesktop() ? undefined : browserGlobal().communicationId;
1910
1915
  let invocationResult;
1911
1916
  const baseErrorMessage = `Internal Workspaces Communication Error. Attempted operation: ${JSON.stringify(invocationArguments)}. `;
1912
1917
  try {
@@ -2892,15 +2897,13 @@
2892
2897
  await this.refreshReference();
2893
2898
  }
2894
2899
  async showLoadingAnimation() {
2895
- const desktopGlobal = window.glue42gd || window.iodesktop;
2896
- if (!desktopGlobal) {
2900
+ if (!isDesktop()) {
2897
2901
  throw new Error("Not supported in IO Connect Browser");
2898
2902
  }
2899
2903
  await getData$3(this).controller.showWorkspaceLoadingAnimation(this.id);
2900
2904
  }
2901
2905
  async hideLoadingAnimation() {
2902
- const desktopGlobal = window.glue42gd || window.iodesktop;
2903
- if (!desktopGlobal) {
2906
+ if (!isDesktop()) {
2904
2907
  throw new Error("Not supported in IO Connect Browser");
2905
2908
  }
2906
2909
  await getData$3(this).controller.hideWorkspaceLoadingAnimation(this.id);
@@ -3378,32 +3381,28 @@
3378
3381
  return getData$1(this).controller.focusItem(myId);
3379
3382
  }
3380
3383
  async state() {
3381
- const desktopGlobal = window.glue42gd || window.iodesktop;
3382
- if (!desktopGlobal) {
3384
+ if (!isDesktop()) {
3383
3385
  throw new Error("State operations are not supported in IO Connect Browser");
3384
3386
  }
3385
3387
  const myId = getData$1(this).summary.id;
3386
3388
  return getData$1(this).controller.getFrameState(myId);
3387
3389
  }
3388
3390
  async minimize() {
3389
- const desktopGlobal = window.glue42gd || window.iodesktop;
3390
- if (!desktopGlobal) {
3391
+ if (!isDesktop()) {
3391
3392
  throw new Error("State operations are not supported in IO Connect Browser");
3392
3393
  }
3393
3394
  const myId = getData$1(this).summary.id;
3394
3395
  return getData$1(this).controller.changeFrameState(myId, "minimized");
3395
3396
  }
3396
3397
  async maximize() {
3397
- const desktopGlobal = window.glue42gd || window.iodesktop;
3398
- if (!desktopGlobal) {
3398
+ if (!isDesktop()) {
3399
3399
  throw new Error("State operations are not supported in IO Connect Browser");
3400
3400
  }
3401
3401
  const myId = getData$1(this).summary.id;
3402
3402
  return getData$1(this).controller.changeFrameState(myId, "maximized");
3403
3403
  }
3404
3404
  async restore() {
3405
- const desktopGlobal = window.glue42gd || window.iodesktop;
3406
- if (!desktopGlobal) {
3405
+ if (!isDesktop()) {
3407
3406
  throw new Error("State operations are not supported in IO Connect Browser");
3408
3407
  }
3409
3408
  const myId = getData$1(this).summary.id;
@@ -4336,8 +4335,7 @@
4336
4335
  }
4337
4336
  }
4338
4337
  async isOperationSupported(operation) {
4339
- const desktopGlobal = window.glue42gd || window.iodesktop;
4340
- if (desktopGlobal) {
4338
+ if (isDesktop()) {
4341
4339
  return { isSupported: true };
4342
4340
  }
4343
4341
  return await this.bridge.send(OPERATIONS.operationCheck.name, { operation });
@@ -4389,14 +4387,12 @@
4389
4387
  return await this.base.add(type, parentId, parentType, definition);
4390
4388
  }
4391
4389
  processLocalSubscription(config, levelId) {
4392
- const desktopGlobal = window.glue42gd || window.iodesktop;
4393
- return desktopGlobal ?
4390
+ return isDesktop() ?
4394
4391
  this.handleEnterpriseLocalSubscription(config, levelId) :
4395
4392
  this.handleCoreLocalSubscription(config, levelId);
4396
4393
  }
4397
4394
  processGlobalSubscription(callback, eventType, action) {
4398
- const desktopGlobal = window.glue42gd || window.iodesktop;
4399
- return desktopGlobal ?
4395
+ return isDesktop() ?
4400
4396
  this.handleEnterpriseGlobalSubscription(callback, eventType, action) :
4401
4397
  this.handleCoreGlobalSubscription(callback, eventType, action);
4402
4398
  }
@@ -4417,8 +4413,7 @@
4417
4413
  return this.base.fetchWorkspace(workspaceId);
4418
4414
  }
4419
4415
  async getWorkspaceByWindowId(itemId) {
4420
- const desktopGlobal = window.glue42gd || window.iodesktop;
4421
- if (!desktopGlobal) {
4416
+ if (!isDesktop()) {
4422
4417
  return (await this.getWorkspaces((wsp) => !!wsp.getWindow((w) => w.id === itemId)))[0];
4423
4418
  }
4424
4419
  return this.base.fetchWorkspace(itemId);
@@ -4499,8 +4494,7 @@
4499
4494
  return await this.bridge.send(OPERATIONS.saveLayout.name, config);
4500
4495
  }
4501
4496
  async importLayouts(layouts, mode) {
4502
- const desktopGlobal = window.glue42gd || window.iodesktop;
4503
- if (desktopGlobal) {
4497
+ if (isDesktop()) {
4504
4498
  try {
4505
4499
  await this.bridge.send(OPERATIONS.importLayouts.name, { layouts, mode });
4506
4500
  }
@@ -4914,7 +4908,7 @@
4914
4908
  }
4915
4909
  }
4916
4910
 
4917
- var version = "3.4.2";
4911
+ var version = "3.4.3";
4918
4912
 
4919
4913
  const composeAPI = (glue, ioc) => {
4920
4914
  const controller = ioc.controller;