@micromag/screen-urbania-article 0.3.307 → 0.3.310

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/es/index.js CHANGED
@@ -5,7 +5,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
5
5
  import { getJSON } from '@folklore/fetch';
6
6
  import PropTypes from 'prop-types';
7
7
  import React, { useMemo, useState, useEffect } from 'react';
8
- import { isTextFilled, getStyleFromColor } from '@micromag/core/utils';
8
+ import { isTextFilled, getStyleFromColor, isValidUrl } from '@micromag/core/utils';
9
9
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
10
10
  import classNames from 'classnames';
11
11
  import { PropTypes as PropTypes$1 } from '@micromag/core';
@@ -471,14 +471,14 @@ var UrbaniaLoader = function UrbaniaLoader(_ref) {
471
471
  setArticle = _useState2[1];
472
472
 
473
473
  var hostname = useMemo(function () {
474
- var _ref2 = url !== null ? new URL(url) : {},
474
+ var _ref2 = url !== null && isValidUrl(url) ? new URL(url) : {},
475
475
  _ref2$hostname = _ref2.hostname,
476
476
  urlHostname = _ref2$hostname === void 0 ? null : _ref2$hostname;
477
477
 
478
478
  return urlHostname;
479
479
  }, [url]);
480
480
  useEffect(function () {
481
- if (url !== null) {
481
+ if (url !== null && isValidUrl(url)) {
482
482
  getJSON("".concat(url, ".json"), {
483
483
  mode: 'cors'
484
484
  }).then(function (art) {
package/lib/index.js CHANGED
@@ -492,14 +492,14 @@ var UrbaniaLoader = function UrbaniaLoader(_ref) {
492
492
  setArticle = _useState2[1];
493
493
 
494
494
  var hostname = React.useMemo(function () {
495
- var _ref2 = url !== null ? new URL(url) : {},
495
+ var _ref2 = url !== null && utils.isValidUrl(url) ? new URL(url) : {},
496
496
  _ref2$hostname = _ref2.hostname,
497
497
  urlHostname = _ref2$hostname === void 0 ? null : _ref2$hostname;
498
498
 
499
499
  return urlHostname;
500
500
  }, [url]);
501
501
  React.useEffect(function () {
502
- if (url !== null) {
502
+ if (url !== null && utils.isValidUrl(url)) {
503
503
  fetch.getJSON("".concat(url, ".json"), {
504
504
  mode: 'cors'
505
505
  }).then(function (art) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-urbania-article",
3
- "version": "0.3.307",
3
+ "version": "0.3.310",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -53,14 +53,14 @@
53
53
  "@folklore/size": "^0.1.20",
54
54
  "@micromag/core": "^0.3.307",
55
55
  "@micromag/element-background": "^0.3.307",
56
- "@micromag/element-call-to-action": "^0.3.307",
56
+ "@micromag/element-call-to-action": "^0.3.310",
57
57
  "@micromag/element-closed-captions": "^0.3.307",
58
58
  "@micromag/element-container": "^0.3.307",
59
59
  "@micromag/element-heading": "^0.3.307",
60
60
  "@micromag/element-image": "^0.3.307",
61
61
  "@micromag/element-media-controls": "^0.3.307",
62
62
  "@micromag/element-text": "^0.3.307",
63
- "@micromag/element-urbania-author": "^0.3.307",
63
+ "@micromag/element-urbania-author": "^0.3.310",
64
64
  "@micromag/element-video": "^0.3.307",
65
65
  "@micromag/element-visual": "^0.3.307",
66
66
  "@micromag/transforms": "^0.3.307",
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "cdc815b7aebe1b9ae8741e1956e21780def64caf"
76
+ "gitHead": "c2f4fbfcf0f643737a77f99dccf4d353f7856c2c"
77
77
  }