@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 +8 -0
- package/README.md +8 -0
- package/dist/README.md +8 -0
- package/dist/index.esm.js +24 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +24 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +6 -2
- package/package.json +8 -2
package/dist/index.umd.js
CHANGED
|
@@ -4444,7 +4444,17 @@
|
|
|
4444
4444
|
};
|
|
4445
4445
|
|
|
4446
4446
|
_this.handleLoad = function () {
|
|
4447
|
-
_this.
|
|
4447
|
+
clearInterval(_this.loadCheck);
|
|
4448
|
+
// Bail update as some browsers will trigger on both DOMContentLoaded & onLoad ala firefox
|
|
4449
|
+
if (!_this.state.iframeLoaded) {
|
|
4450
|
+
_this.setState({ iframeLoaded: true });
|
|
4451
|
+
}
|
|
4452
|
+
};
|
|
4453
|
+
|
|
4454
|
+
_this.loadCheck = function () {
|
|
4455
|
+
return setInterval(function () {
|
|
4456
|
+
_this.handleLoad();
|
|
4457
|
+
}, 500);
|
|
4448
4458
|
};
|
|
4449
4459
|
|
|
4450
4460
|
_this._isMounted = false;
|
|
@@ -4459,10 +4469,9 @@
|
|
|
4459
4469
|
this._isMounted = true;
|
|
4460
4470
|
|
|
4461
4471
|
var doc = this.getDoc();
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
this.nodeRef.current.addEventListener('load', this.handleLoad);
|
|
4472
|
+
|
|
4473
|
+
if (doc) {
|
|
4474
|
+
this.nodeRef.current.contentWindow.addEventListener('DOMContentLoaded', this.handleLoad);
|
|
4466
4475
|
}
|
|
4467
4476
|
}
|
|
4468
4477
|
}, {
|
|
@@ -4470,7 +4479,7 @@
|
|
|
4470
4479
|
value: function componentWillUnmount() {
|
|
4471
4480
|
this._isMounted = false;
|
|
4472
4481
|
|
|
4473
|
-
this.nodeRef.current.removeEventListener('
|
|
4482
|
+
this.nodeRef.current.removeEventListener('DOMContentLoaded', this.handleLoad);
|
|
4474
4483
|
}
|
|
4475
4484
|
}, {
|
|
4476
4485
|
key: 'getDoc',
|
|
@@ -4486,6 +4495,10 @@
|
|
|
4486
4495
|
}
|
|
4487
4496
|
return doc.body.children[0];
|
|
4488
4497
|
}
|
|
4498
|
+
|
|
4499
|
+
// In certain situations on a cold cache DOMContentLoaded never gets called
|
|
4500
|
+
// fallback to an interval to check if that's the case
|
|
4501
|
+
|
|
4489
4502
|
}, {
|
|
4490
4503
|
key: 'renderFrameContents',
|
|
4491
4504
|
value: function renderFrameContents() {
|
|
@@ -4522,6 +4535,10 @@
|
|
|
4522
4535
|
|
|
4523
4536
|
var mountTarget = this.getMountTarget();
|
|
4524
4537
|
|
|
4538
|
+
if (!mountTarget) {
|
|
4539
|
+
return null;
|
|
4540
|
+
}
|
|
4541
|
+
|
|
4525
4542
|
return [_reactDom2.default.createPortal(this.props.head, this.getDoc().head), _reactDom2.default.createPortal(contents, mountTarget)];
|
|
4526
4543
|
}
|
|
4527
4544
|
}, {
|
|
@@ -4537,6 +4554,7 @@
|
|
|
4537
4554
|
delete props.contentDidMount;
|
|
4538
4555
|
delete props.contentDidUpdate;
|
|
4539
4556
|
delete props.forwardedRef;
|
|
4557
|
+
|
|
4540
4558
|
return _react2.default.createElement(
|
|
4541
4559
|
'iframe',
|
|
4542
4560
|
_extends({}, props, { ref: this.setRef, onLoad: this.handleLoad }),
|