@interopio/widget 1.0.3 → 1.0.4-next.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.
@@ -792,7 +792,8 @@ const modeDecoder = oneOf(constant("default"), constant("compact"));
792
792
  const configDecoder = object({
793
793
  channelSelector: optional(channelSelectorDecoder),
794
794
  position: optional(positionDecoder),
795
- mode: optional(modeDecoder)
795
+ mode: optional(modeDecoder),
796
+ displayInWorkspace: optional(boolean())
796
797
  });
797
798
 
798
799
  const defaultConfig = {
@@ -801,7 +802,8 @@ const defaultConfig = {
801
802
  type: "default"
802
803
  },
803
804
  position: "bottom",
804
- mode: "default"
805
+ mode: "default",
806
+ displayInWorkspace: false
805
807
  };
806
808
 
807
809
  const browserPlatformMethodName = "T42.Web.Platform.Control";
@@ -1204,6 +1206,9 @@ const ChannelSelectorWrapper = ({ mode }) => {
1204
1206
  }));
1205
1207
  setChannelsInfo(channelsInfo);
1206
1208
  }, [glueController]);
1209
+ useEffect(() => {
1210
+ getChannels();
1211
+ }, [getChannels]);
1207
1212
  useEffect(() => {
1208
1213
  const subscribeForChannelChanged = () => {
1209
1214
  glueController.io.channels.onChanged(async (name) => {
@@ -1235,7 +1240,7 @@ const ChannelSelectorWrapper = ({ mode }) => {
1235
1240
  handleBtnBackgroundChange();
1236
1241
  }, [channelsInfo]);
1237
1242
  return (React.createElement(L, { onClick: getChannels },
1238
- 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 })),
1243
+ 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 })),
1239
1244
  React.createElement(L.Content, null,
1240
1245
  React.createElement(ChannelSelector, { className: "io-list-channels", variant: type, channels: channelsInfo, onChannelSelect: type === "single" ? handleSingleChannelSelect : handleDirectionalChannelSelect, variantToggle: variantToggle, onVariantChange: onTypeChange }))));
1241
1246
  };
@@ -1275,9 +1280,9 @@ const CompactWidget = ({ position, positionClickHandler, mode, modeClickHandler,
1275
1280
  return (React.createElement(L, null,
1276
1281
  React.createElement(L.ButtonIcon, { className: "io-btn-icon", iconSize: "16", size: "32", variant: "circle" }),
1277
1282
  React.createElement(L.Content, null,
1278
- React.createElement(L.ItemSection, null, "Application"),
1283
+ React.createElement(L.ItemSection, null, "App"),
1279
1284
  React.createElement(L.List, null,
1280
- showBringBackToWspBtn ? (React.createElement(L.Item, { onClick: handleBringBackToWspClick, prepend: React.createElement(y, { variant: "pop-in-widget" }) }, "Pop in")) : null,
1285
+ showBringBackToWspBtn ? (React.createElement(L.Item, { onClick: handleBringBackToWspClick, prepend: React.createElement(y, { variant: "pop-in-widget" }) }, "Pop In")) : null,
1281
1286
  showChannelSelectorBtn ? React.createElement(ChannelSelectorWrapper, { mode: mode }) : null),
1282
1287
  React.createElement(PositionDropdown, { position: position, positionClickHandler: positionClickHandler }),
1283
1288
  React.createElement(ModeDropdown, { mode: mode, modeClickHandler: modeClickHandler }))));
@@ -1396,6 +1401,9 @@ class GlueController {
1396
1401
  }
1397
1402
  async checkShowWidget() {
1398
1403
  const errorMsg = `Current window is in workspace`;
1404
+ if (window.iobrowser?.isPlatformFrame) {
1405
+ return { show: false, reason: `Current window is a Platform in a Workspaces Frame` };
1406
+ }
1399
1407
  if (this.io.workspaces && await this.io.workspaces.inWorkspace()) {
1400
1408
  return { show: false, reason: errorMsg };
1401
1409
  }
@@ -1498,10 +1506,12 @@ const IOBrowserWidgetFactory = async (io, config) => {
1498
1506
  return;
1499
1507
  }
1500
1508
  logger.trace(`Bridge initiated successfully`);
1501
- const showWidgetRes = await ioc.glueController.checkShowWidget();
1502
- if (!showWidgetRes.show) {
1503
- logger.error(`${baseErrorMessage} ${showWidgetRes.reason}`);
1504
- return;
1509
+ if (!widgetConfig.displayInWorkspace) {
1510
+ const showWidgetRes = await ioc.glueController.checkShowWidget();
1511
+ if (!showWidgetRes.show) {
1512
+ logger.error(`${baseErrorMessage} ${showWidgetRes.reason}`);
1513
+ return;
1514
+ }
1505
1515
  }
1506
1516
  logger.trace(`Widget will be attached to DOM`);
1507
1517
  await ioc.domController.attachWidget();