@stoplight/elements-dev-portal 2.4.2 → 2.4.3

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/index.esm.js CHANGED
@@ -51,7 +51,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
51
51
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
52
52
  PERFORMANCE OF THIS SOFTWARE.
53
53
  ***************************************************************************** */
54
- /* global Reflect, Promise, SuppressedError, Symbol */
54
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
55
55
 
56
56
 
57
57
  function __rest(s, e) {
@@ -125,8 +125,18 @@ const NodeLinkContext = React.createContext(undefined);
125
125
  const externalRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
126
126
  const LinkComponent = ({ children, href, title }) => {
127
127
  const ctx = React.useContext(NodeLinkContext);
128
- if (href && externalRegex.test(href)) {
129
- return (React.createElement("a", { href: href, target: "_blank", rel: "noreferrer", title: title ? title : undefined }, children));
128
+ try {
129
+ if (href && externalRegex.test(href)) {
130
+ const baseURL = window.location.host;
131
+ const hrefURL = new URL(href).host;
132
+ if (baseURL === hrefURL) {
133
+ return (React.createElement("a", { href: href, title: title ? title : undefined }, children));
134
+ }
135
+ return (React.createElement("a", { href: href, target: "_blank", rel: "noreferrer", title: title ? title : undefined }, children));
136
+ }
137
+ }
138
+ catch (error) {
139
+ console.error(error);
130
140
  }
131
141
  if (href && ctx) {
132
142
  const [node, Link] = ctx;
@@ -273,7 +283,7 @@ const UpgradeToStarter = () => (React__default.createElement(Flex, { as: "a", hr
273
283
  React__default.createElement(Icon, { icon: ['fas', 'exclamation-triangle'], size: "4x" }),
274
284
  React__default.createElement(Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
275
285
 
276
- const appVersion = '2.4.2';
286
+ const appVersion = '2.4.3';
277
287
 
278
288
  class ResponseError extends Error {
279
289
  constructor(message, responseCode) {
package/index.js CHANGED
@@ -71,7 +71,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
71
71
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
72
72
  PERFORMANCE OF THIS SOFTWARE.
73
73
  ***************************************************************************** */
74
- /* global Reflect, Promise, SuppressedError, Symbol */
74
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
75
75
 
76
76
 
77
77
  function __rest(s, e) {
@@ -145,8 +145,18 @@ const NodeLinkContext = React__namespace.createContext(undefined);
145
145
  const externalRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
146
146
  const LinkComponent = ({ children, href, title }) => {
147
147
  const ctx = React__namespace.useContext(NodeLinkContext);
148
- if (href && externalRegex.test(href)) {
149
- return (React__namespace.createElement("a", { href: href, target: "_blank", rel: "noreferrer", title: title ? title : undefined }, children));
148
+ try {
149
+ if (href && externalRegex.test(href)) {
150
+ const baseURL = window.location.host;
151
+ const hrefURL = new URL(href).host;
152
+ if (baseURL === hrefURL) {
153
+ return (React__namespace.createElement("a", { href: href, title: title ? title : undefined }, children));
154
+ }
155
+ return (React__namespace.createElement("a", { href: href, target: "_blank", rel: "noreferrer", title: title ? title : undefined }, children));
156
+ }
157
+ }
158
+ catch (error) {
159
+ console.error(error);
150
160
  }
151
161
  if (href && ctx) {
152
162
  const [node, Link] = ctx;
@@ -293,7 +303,7 @@ const UpgradeToStarter = () => (React.createElement(mosaic.Flex, { as: "a", href
293
303
  React.createElement(mosaic.Icon, { icon: ['fas', 'exclamation-triangle'], size: "4x" }),
294
304
  React.createElement(mosaic.Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
295
305
 
296
- const appVersion = '2.4.2';
306
+ const appVersion = '2.4.3';
297
307
 
298
308
  class ResponseError extends Error {
299
309
  constructor(message, responseCode) {
package/index.mjs CHANGED
@@ -51,7 +51,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
51
51
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
52
52
  PERFORMANCE OF THIS SOFTWARE.
53
53
  ***************************************************************************** */
54
- /* global Reflect, Promise, SuppressedError, Symbol */
54
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
55
55
 
56
56
 
57
57
  function __rest(s, e) {
@@ -125,8 +125,18 @@ const NodeLinkContext = React.createContext(undefined);
125
125
  const externalRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
126
126
  const LinkComponent = ({ children, href, title }) => {
127
127
  const ctx = React.useContext(NodeLinkContext);
128
- if (href && externalRegex.test(href)) {
129
- return (React.createElement("a", { href: href, target: "_blank", rel: "noreferrer", title: title ? title : undefined }, children));
128
+ try {
129
+ if (href && externalRegex.test(href)) {
130
+ const baseURL = window.location.host;
131
+ const hrefURL = new URL(href).host;
132
+ if (baseURL === hrefURL) {
133
+ return (React.createElement("a", { href: href, title: title ? title : undefined }, children));
134
+ }
135
+ return (React.createElement("a", { href: href, target: "_blank", rel: "noreferrer", title: title ? title : undefined }, children));
136
+ }
137
+ }
138
+ catch (error) {
139
+ console.error(error);
130
140
  }
131
141
  if (href && ctx) {
132
142
  const [node, Link] = ctx;
@@ -273,7 +283,7 @@ const UpgradeToStarter = () => (React__default.createElement(Flex, { as: "a", hr
273
283
  React__default.createElement(Icon, { icon: ['fas', 'exclamation-triangle'], size: "4x" }),
274
284
  React__default.createElement(Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
275
285
 
276
- const appVersion = '2.4.2';
286
+ const appVersion = '2.4.3';
277
287
 
278
288
  class ResponseError extends Error {
279
289
  constructor(message, responseCode) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements-dev-portal",
3
- "version": "2.4.2",
3
+ "version": "2.4.3",
4
4
  "description": "UI components for composing beautiful developer documentation.",
5
5
  "keywords": [],
6
6
  "main": "./index.js",