@interopio/widget 1.0.4 → 1.1.0

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.
@@ -789,7 +789,8 @@ const modeDecoder = oneOf(constant("default"), constant("compact"));
789
789
  const configDecoder = object({
790
790
  channelSelector: optional(channelSelectorDecoder),
791
791
  position: optional(positionDecoder),
792
- mode: optional(modeDecoder)
792
+ mode: optional(modeDecoder),
793
+ displayInWorkspace: optional(boolean())
793
794
  });
794
795
 
795
796
  const defaultConfig = {
@@ -798,7 +799,8 @@ const defaultConfig = {
798
799
  type: "default"
799
800
  },
800
801
  position: "bottom",
801
- mode: "default"
802
+ mode: "default",
803
+ displayInWorkspace: false
802
804
  };
803
805
 
804
806
  const browserPlatformMethodName = "T42.Web.Platform.Control";
@@ -1626,6 +1628,9 @@ const ChannelSelectorWrapper = ({ mode }) => {
1626
1628
  }));
1627
1629
  setChannelsInfo(channelsInfo);
1628
1630
  }, [glueController]);
1631
+ reactExports.useEffect(() => {
1632
+ getChannels();
1633
+ }, [getChannels]);
1629
1634
  reactExports.useEffect(() => {
1630
1635
  const subscribeForChannelChanged = () => {
1631
1636
  glueController.io.channels.onChanged(async (name) => {
@@ -1657,7 +1662,7 @@ const ChannelSelectorWrapper = ({ mode }) => {
1657
1662
  handleBtnBackgroundChange();
1658
1663
  }, [channelsInfo]);
1659
1664
  return (React.createElement(L, { onClick: getChannels },
1660
- mode === "default" ? (React.createElement(L.ButtonIcon, { className: "io-btn-icon", icon: "link", iconSize: "16", size: "32", variant: "circle" })) : (React.createElement(L.Button, { icon: "link", text: "Select channel", iconRight: false })),
1665
+ mode === "default" ? (React.createElement(L.ButtonIcon, { className: "io-btn-icon", icon: "link", iconSize: "16", size: "32", variant: "circle" })) : (React.createElement(L.Button, { icon: "link", text: "Select Channel", iconRight: false })),
1661
1666
  React.createElement(L.Content, null,
1662
1667
  React.createElement(ChannelSelector, { className: "io-list-channels", variant: type, channels: channelsInfo, onChannelSelect: type === "single" ? handleSingleChannelSelect : handleDirectionalChannelSelect, variantToggle: variantToggle, onVariantChange: onTypeChange }))));
1663
1668
  };
@@ -1697,9 +1702,9 @@ const CompactWidget = ({ position, positionClickHandler, mode, modeClickHandler,
1697
1702
  return (React.createElement(L, null,
1698
1703
  React.createElement(L.ButtonIcon, { className: "io-btn-icon", iconSize: "16", size: "32", variant: "circle" }),
1699
1704
  React.createElement(L.Content, null,
1700
- React.createElement(L.ItemSection, null, "Application"),
1705
+ React.createElement(L.ItemSection, null, "App"),
1701
1706
  React.createElement(L.List, null,
1702
- showBringBackToWspBtn ? (React.createElement(L.Item, { onClick: handleBringBackToWspClick, prepend: React.createElement(y, { variant: "pop-in-widget" }) }, "Pop in")) : null,
1707
+ showBringBackToWspBtn ? (React.createElement(L.Item, { onClick: handleBringBackToWspClick, prepend: React.createElement(y, { variant: "pop-in-widget" }) }, "Pop In")) : null,
1703
1708
  showChannelSelectorBtn ? React.createElement(ChannelSelectorWrapper, { mode: mode }) : null),
1704
1709
  React.createElement(PositionDropdown, { position: position, positionClickHandler: positionClickHandler }),
1705
1710
  React.createElement(ModeDropdown, { mode: mode, modeClickHandler: modeClickHandler }))));
@@ -1818,6 +1823,9 @@ class GlueController {
1818
1823
  }
1819
1824
  async checkShowWidget() {
1820
1825
  const errorMsg = `Current window is in workspace`;
1826
+ if (window.iobrowser?.isPlatformFrame) {
1827
+ return { show: false, reason: `Current window is a Platform in a Workspaces Frame` };
1828
+ }
1821
1829
  if (this.io.workspaces && await this.io.workspaces.inWorkspace()) {
1822
1830
  return { show: false, reason: errorMsg };
1823
1831
  }
@@ -1920,10 +1928,12 @@ const IOBrowserWidgetFactory = async (io, config) => {
1920
1928
  return;
1921
1929
  }
1922
1930
  logger.trace(`Bridge initiated successfully`);
1923
- const showWidgetRes = await ioc.glueController.checkShowWidget();
1924
- if (!showWidgetRes.show) {
1925
- logger.error(`${baseErrorMessage} ${showWidgetRes.reason}`);
1926
- return;
1931
+ if (!widgetConfig.displayInWorkspace) {
1932
+ const showWidgetRes = await ioc.glueController.checkShowWidget();
1933
+ if (!showWidgetRes.show) {
1934
+ logger.error(`${baseErrorMessage} ${showWidgetRes.reason}`);
1935
+ return;
1936
+ }
1927
1937
  }
1928
1938
  logger.trace(`Widget will be attached to DOM`);
1929
1939
  await ioc.domController.attachWidget();