@micromag/screen-share 0.3.235 → 0.3.238

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.
Files changed (3) hide show
  1. package/es/index.js +11 -4
  2. package/lib/index.js +11 -4
  3. package/package.json +11 -11
package/es/index.js CHANGED
@@ -55,7 +55,7 @@ var defaultProps = {
55
55
  };
56
56
 
57
57
  var ShareScreen = function ShareScreen(_ref) {
58
- var _ref3;
58
+ var _ref4;
59
59
 
60
60
  var layout = _ref.layout,
61
61
  heading = _ref.heading,
@@ -104,8 +104,15 @@ var ShareScreen = function ShareScreen(_ref) {
104
104
  var backgroundShouldLoad = current || active;
105
105
  var hasCallToAction = callToAction !== null && callToAction.active === true;
106
106
  var currentUrl = useMemo(function () {
107
- var origin = typeof window !== 'undefined' ? window.location.origin.replace(/\/+$/, '') : '';
108
- return origin;
107
+ if (typeof window === 'undefined') return '';
108
+
109
+ var _ref2 = window.location || {},
110
+ _ref2$hostname = _ref2.hostname,
111
+ hostname = _ref2$hostname === void 0 ? null : _ref2$hostname,
112
+ _ref2$pathname = _ref2.pathname,
113
+ pathname = _ref2$pathname === void 0 ? null : _ref2$pathname;
114
+
115
+ return hostname + pathname;
109
116
  }, []);
110
117
  var finalShareURL = shareUrl || currentUrl;
111
118
  var defaultOptions = options !== null ? ['email', 'facebook', 'twitter', 'linkedin', 'whatsapp', 'facebookMessenger'] : [];
@@ -175,7 +182,7 @@ var ShareScreen = function ShareScreen(_ref) {
175
182
  return el !== null;
176
183
  });
177
184
  return /*#__PURE__*/React.createElement("div", {
178
- className: classNames([styles.container, (_ref3 = {}, _defineProperty(_ref3, className, className !== null), _defineProperty(_ref3, styles.isPlaceholder, isPlaceholder), _ref3)]),
185
+ className: classNames([styles.container, (_ref4 = {}, _defineProperty(_ref4, className, className !== null), _defineProperty(_ref4, styles.isPlaceholder, isPlaceholder), _ref4)]),
179
186
  "data-screen-ready": true
180
187
  }, /*#__PURE__*/React.createElement(Container, {
181
188
  width: width,
package/lib/index.js CHANGED
@@ -74,7 +74,7 @@ var defaultProps = {
74
74
  };
75
75
 
76
76
  var ShareScreen = function ShareScreen(_ref) {
77
- var _ref3;
77
+ var _ref4;
78
78
 
79
79
  var layout = _ref.layout,
80
80
  heading = _ref.heading,
@@ -123,8 +123,15 @@ var ShareScreen = function ShareScreen(_ref) {
123
123
  var backgroundShouldLoad = current || active;
124
124
  var hasCallToAction = callToAction !== null && callToAction.active === true;
125
125
  var currentUrl = React.useMemo(function () {
126
- var origin = typeof window !== 'undefined' ? window.location.origin.replace(/\/+$/, '') : '';
127
- return origin;
126
+ if (typeof window === 'undefined') return '';
127
+
128
+ var _ref2 = window.location || {},
129
+ _ref2$hostname = _ref2.hostname,
130
+ hostname = _ref2$hostname === void 0 ? null : _ref2$hostname,
131
+ _ref2$pathname = _ref2.pathname,
132
+ pathname = _ref2$pathname === void 0 ? null : _ref2$pathname;
133
+
134
+ return hostname + pathname;
128
135
  }, []);
129
136
  var finalShareURL = shareUrl || currentUrl;
130
137
  var defaultOptions = options !== null ? ['email', 'facebook', 'twitter', 'linkedin', 'whatsapp', 'facebookMessenger'] : [];
@@ -194,7 +201,7 @@ var ShareScreen = function ShareScreen(_ref) {
194
201
  return el !== null;
195
202
  });
196
203
  return /*#__PURE__*/React__default["default"].createElement("div", {
197
- className: classNames__default["default"]([styles.container, (_ref3 = {}, _defineProperty__default["default"](_ref3, className, className !== null), _defineProperty__default["default"](_ref3, styles.isPlaceholder, isPlaceholder), _ref3)]),
204
+ className: classNames__default["default"]([styles.container, (_ref4 = {}, _defineProperty__default["default"](_ref4, className, className !== null), _defineProperty__default["default"](_ref4, styles.isPlaceholder, isPlaceholder), _ref4)]),
198
205
  "data-screen-ready": true
199
206
  }, /*#__PURE__*/React__default["default"].createElement(Container__default["default"], {
200
207
  width: width,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-share",
3
- "version": "0.3.235",
3
+ "version": "0.3.238",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -53,15 +53,15 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@babel/runtime": "^7.13.10",
56
- "@micromag/core": "^0.3.235",
57
- "@micromag/element-background": "^0.3.235",
58
- "@micromag/element-call-to-action": "^0.3.235",
59
- "@micromag/element-container": "^0.3.235",
60
- "@micromag/element-heading": "^0.3.235",
61
- "@micromag/element-layout": "^0.3.235",
62
- "@micromag/element-share-options": "^0.3.235",
63
- "@micromag/element-text": "^0.3.235",
64
- "@micromag/transforms": "^0.3.235",
56
+ "@micromag/core": "^0.3.237",
57
+ "@micromag/element-background": "^0.3.237",
58
+ "@micromag/element-call-to-action": "^0.3.237",
59
+ "@micromag/element-container": "^0.3.237",
60
+ "@micromag/element-heading": "^0.3.237",
61
+ "@micromag/element-layout": "^0.3.237",
62
+ "@micromag/element-share-options": "^0.3.237",
63
+ "@micromag/element-text": "^0.3.237",
64
+ "@micromag/transforms": "^0.3.237",
65
65
  "classnames": "^2.2.6",
66
66
  "lodash": "^4.17.21",
67
67
  "prop-types": "^15.7.2",
@@ -71,5 +71,5 @@
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitHead": "e1f899344bb55abf06daa6247d9adbd7401a765b"
74
+ "gitHead": "4057899907d2c647840656e94b31271756c4a80a"
75
75
  }