@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.js CHANGED
@@ -3644,6 +3644,19 @@ var ScaffoldContext = React6.createContext(
3644
3644
  var useScaffoldContext = () => {
3645
3645
  return React6.useContext(ScaffoldContext);
3646
3646
  };
3647
+
3648
+ // src/utils/link.ts
3649
+ var isExternalUrl = (href) => {
3650
+ try {
3651
+ const origin = typeof window !== "undefined" && window.location?.origin ? window.location.origin : void 0;
3652
+ const target = new URL(href, origin ?? "http://localhost");
3653
+ if (!origin)
3654
+ return false;
3655
+ return target.origin !== origin;
3656
+ } catch {
3657
+ return false;
3658
+ }
3659
+ };
3647
3660
  var NotificationUI = (props) => {
3648
3661
  const { dataSource, showAnnouncement } = props;
3649
3662
  const { routerAdapter } = useScaffoldContext();
@@ -3653,7 +3666,7 @@ var NotificationUI = (props) => {
3653
3666
  routerAdapter?.onRouteChange({
3654
3667
  href: url,
3655
3668
  name: url,
3656
- target: "_blank"
3669
+ target: isExternalUrl(url) ? "_blank" : void 0
3657
3670
  });
3658
3671
  };
3659
3672
  const notificationRef = React6.useRef(null);
@@ -5140,7 +5153,7 @@ var MessageCenter = (props) => {
5140
5153
  routerAdapter?.onRouteChange({
5141
5154
  href: url,
5142
5155
  name: url,
5143
- target: "_blank"
5156
+ target: isExternalUrl(url) ? "_blank" : void 0
5144
5157
  });
5145
5158
  };
5146
5159
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [