@interopio/fdc3-web-bridge 1.4.0 → 1.5.0-beta.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.
@@ -1576,7 +1576,7 @@
1576
1576
  /** See `Decoder.succeed` */
1577
1577
  Decoder.succeed;
1578
1578
  /** See `Decoder.fail` */
1579
- Decoder.fail;
1579
+ var fail = Decoder.fail;
1580
1580
  /** See `Decoder.lazy` */
1581
1581
  Decoder.lazy;
1582
1582
 
@@ -1587,11 +1587,15 @@
1587
1587
  });
1588
1588
  const urlDecoder = nonEmptyStringDecoder$4.andThen((url) => {
1589
1589
  try {
1590
- new URL(url);
1590
+ const { protocol } = new URL(url);
1591
+ const disallowedProtocols = ["data:", "javascript:", "vbscript:"];
1592
+ if (disallowedProtocols.includes(protocol)) {
1593
+ return fail(`Expected a URL with a safe protocol, got: ${protocol} (disallowed protocols: ${disallowedProtocols.join(", ")})`);
1594
+ }
1591
1595
  return nonEmptyStringDecoder$4;
1592
1596
  }
1593
1597
  catch {
1594
- return fail("Should be a valid URL");
1598
+ return fail("Expected a valid URL");
1595
1599
  }
1596
1600
  });
1597
1601
 
@@ -1603,7 +1607,7 @@
1603
1607
  });
1604
1608
  const v2TypeDecoder = oneOf(constant("web"), constant("native"), constant("citrix"), constant("onlineNative"), constant("other"));
1605
1609
  const v2DetailsDecoder = object({
1606
- url: nonEmptyStringDecoder$4
1610
+ url: urlDecoder
1607
1611
  });
1608
1612
  const v2IconDecoder = object({
1609
1613
  src: nonEmptyStringDecoder$4,
@@ -1631,18 +1635,19 @@
1631
1635
  listensFor: optional(array(nonEmptyStringDecoder$4))
1632
1636
  });
1633
1637
  const v2AppChannelDecoder = object({
1634
- name: nonEmptyStringDecoder$4,
1638
+ name: optional(nonEmptyStringDecoder$4),
1639
+ id: optional(nonEmptyStringDecoder$4),
1635
1640
  description: optional(nonEmptyStringDecoder$4),
1636
1641
  broadcasts: optional(array(nonEmptyStringDecoder$4)),
1637
1642
  listensFor: optional(array(nonEmptyStringDecoder$4))
1638
- });
1643
+ }).where((appChannel) => Boolean(appChannel.name || appChannel.id), "Expected at least a name or an id property to be present in the app channel definition");
1639
1644
  const v2InteropDecoder = object({
1640
1645
  intents: optional(v2IntentsDecoder),
1641
1646
  userChannels: optional(v2UserChannelDecoder),
1642
1647
  appChannels: optional(array(v2AppChannelDecoder))
1643
1648
  });
1644
1649
  const glue42ApplicationDetailsDecoder = object({
1645
- url: optional(nonEmptyStringDecoder$4),
1650
+ url: optional(urlDecoder),
1646
1651
  top: optional(number()),
1647
1652
  left: optional(number()),
1648
1653
  width: optional(nonNegativeNumberDecoder),
@@ -2661,6 +2666,7 @@
2661
2666
  if (event.type !== "userChannelChanged") {
2662
2667
  return;
2663
2668
  }
2669
+ const currentChannelId = event.details.currentChannelId ?? null;
2664
2670
  const response = {
2665
2671
  type: "channelChangedEvent",
2666
2672
  meta: {
@@ -2668,7 +2674,8 @@
2668
2674
  timestamp: new Date()
2669
2675
  },
2670
2676
  payload: {
2671
- newChannelId: event.details.currentChannelId ?? null,
2677
+ currentChannelId,
2678
+ newChannelId: currentChannelId,
2672
2679
  }
2673
2680
  };
2674
2681
  this.logger?.info(`Sending 'channelChangedEvent' message: ${JSON.stringify(response)}`);
@@ -3719,7 +3726,7 @@
3719
3726
  }
3720
3727
  }
3721
3728
 
3722
- var version = "1.4.0";
3729
+ var version = "1.5.0-beta.0";
3723
3730
 
3724
3731
  window.fdc3WebBridgeInfo = {
3725
3732
  version