@janiscommerce/ui-web 0.27.1 → 0.28.0

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/CHANGELOG.md CHANGED
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.28.0] - 2025-02-12
11
+
12
+ ### Added
13
+
14
+ - nvm file
15
+ - script to check installation command to avoid npm install
16
+ - Map component
17
+
10
18
  ## [0.27.1] - 2024-12-04
11
19
 
12
20
  ### Fixed
package/README.md CHANGED
@@ -6,6 +6,14 @@ A package for use generic components from Janis
6
6
 
7
7
  `npm install @janiscommerce/ui-web`
8
8
 
9
+ > **Important:** When developing or contributing to this library, please make sure to use `yarn` to install dependencies. Do **not** use `npm` as it might cause issues.
10
+
11
+ To install dependencies while developing the library:
12
+
13
+ ```bash
14
+ yarn install
15
+ ```
16
+
9
17
  ### Usage
10
18
 
11
19
  ```js
package/dist/README.md CHANGED
@@ -6,6 +6,14 @@ A package for use generic components from Janis
6
6
 
7
7
  `npm install @janiscommerce/ui-web`
8
8
 
9
+ > **Important:** When developing or contributing to this library, please make sure to use `yarn` to install dependencies. Do **not** use `npm` as it might cause issues.
10
+
11
+ To install dependencies while developing the library:
12
+
13
+ ```bash
14
+ yarn install
15
+ ```
16
+
9
17
  ### Usage
10
18
 
11
19
  ```js
package/dist/index.esm.js CHANGED
@@ -4436,7 +4436,17 @@ var Frame$1 = Frame$2.Frame = function (_Component) {
4436
4436
  };
4437
4437
 
4438
4438
  _this.handleLoad = function () {
4439
- _this.setState({ iframeLoaded: true });
4439
+ clearInterval(_this.loadCheck);
4440
+ // Bail update as some browsers will trigger on both DOMContentLoaded & onLoad ala firefox
4441
+ if (!_this.state.iframeLoaded) {
4442
+ _this.setState({ iframeLoaded: true });
4443
+ }
4444
+ };
4445
+
4446
+ _this.loadCheck = function () {
4447
+ return setInterval(function () {
4448
+ _this.handleLoad();
4449
+ }, 500);
4440
4450
  };
4441
4451
 
4442
4452
  _this._isMounted = false;
@@ -4451,10 +4461,9 @@ var Frame$1 = Frame$2.Frame = function (_Component) {
4451
4461
  this._isMounted = true;
4452
4462
 
4453
4463
  var doc = this.getDoc();
4454
- if (doc && doc.readyState === 'complete') {
4455
- this.forceUpdate();
4456
- } else {
4457
- this.nodeRef.current.addEventListener('load', this.handleLoad);
4464
+
4465
+ if (doc) {
4466
+ this.nodeRef.current.contentWindow.addEventListener('DOMContentLoaded', this.handleLoad);
4458
4467
  }
4459
4468
  }
4460
4469
  }, {
@@ -4462,7 +4471,7 @@ var Frame$1 = Frame$2.Frame = function (_Component) {
4462
4471
  value: function componentWillUnmount() {
4463
4472
  this._isMounted = false;
4464
4473
 
4465
- this.nodeRef.current.removeEventListener('load', this.handleLoad);
4474
+ this.nodeRef.current.removeEventListener('DOMContentLoaded', this.handleLoad);
4466
4475
  }
4467
4476
  }, {
4468
4477
  key: 'getDoc',
@@ -4478,6 +4487,10 @@ var Frame$1 = Frame$2.Frame = function (_Component) {
4478
4487
  }
4479
4488
  return doc.body.children[0];
4480
4489
  }
4490
+
4491
+ // In certain situations on a cold cache DOMContentLoaded never gets called
4492
+ // fallback to an interval to check if that's the case
4493
+
4481
4494
  }, {
4482
4495
  key: 'renderFrameContents',
4483
4496
  value: function renderFrameContents() {
@@ -4514,6 +4527,10 @@ var Frame$1 = Frame$2.Frame = function (_Component) {
4514
4527
 
4515
4528
  var mountTarget = this.getMountTarget();
4516
4529
 
4530
+ if (!mountTarget) {
4531
+ return null;
4532
+ }
4533
+
4517
4534
  return [_reactDom2.default.createPortal(this.props.head, this.getDoc().head), _reactDom2.default.createPortal(contents, mountTarget)];
4518
4535
  }
4519
4536
  }, {
@@ -4529,6 +4546,7 @@ var Frame$1 = Frame$2.Frame = function (_Component) {
4529
4546
  delete props.contentDidMount;
4530
4547
  delete props.contentDidUpdate;
4531
4548
  delete props.forwardedRef;
4549
+
4532
4550
  return _react2.default.createElement(
4533
4551
  'iframe',
4534
4552
  _extends({}, props, { ref: this.setRef, onLoad: this.handleLoad }),