@kodiak-finance/orderly-ui-scaffold 2.8.19 → 2.8.20

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/dist/index.mjs CHANGED
@@ -3637,6 +3637,19 @@ var ScaffoldContext = createContext(
3637
3637
  var useScaffoldContext = () => {
3638
3638
  return useContext(ScaffoldContext);
3639
3639
  };
3640
+
3641
+ // src/utils/link.ts
3642
+ var isExternalUrl = (href) => {
3643
+ try {
3644
+ const origin = typeof window !== "undefined" && window.location?.origin ? window.location.origin : void 0;
3645
+ const target = new URL(href, origin ?? "http://localhost");
3646
+ if (!origin)
3647
+ return false;
3648
+ return target.origin !== origin;
3649
+ } catch {
3650
+ return false;
3651
+ }
3652
+ };
3640
3653
  var NotificationUI = (props) => {
3641
3654
  const { dataSource, showAnnouncement } = props;
3642
3655
  const { routerAdapter } = useScaffoldContext();
@@ -3646,7 +3659,7 @@ var NotificationUI = (props) => {
3646
3659
  routerAdapter?.onRouteChange({
3647
3660
  href: url,
3648
3661
  name: url,
3649
- target: "_blank"
3662
+ target: isExternalUrl(url) ? "_blank" : void 0
3650
3663
  });
3651
3664
  };
3652
3665
  const notificationRef = useRef(null);
@@ -5133,7 +5146,7 @@ var MessageCenter = (props) => {
5133
5146
  routerAdapter?.onRouteChange({
5134
5147
  href: url,
5135
5148
  name: url,
5136
- target: "_blank"
5149
+ target: isExternalUrl(url) ? "_blank" : void 0
5137
5150
  });
5138
5151
  };
5139
5152
  return /* @__PURE__ */ jsxs(Fragment, { children: [