@royaloperahouse/chord 1.18.1-dev-chord-development → 1.18.2-b-chord-development

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/dist/chord.esm.js CHANGED
@@ -3503,6 +3503,31 @@ var VolumeControlsWrapper = /*#__PURE__*/styled.div(_templateObject7$1 || (_temp
3503
3503
  return volumeHidden ? '40px' : '100px';
3504
3504
  }, trackStyles, trackStyles, trackStyles, trackStyles, trackStyles, thumbStyes, thumbStyes, thumbStyes);
3505
3505
 
3506
+ var isIOS = function isIOS() {
3507
+ try {
3508
+ console.warn('Do not use this on server side rendering, it may throw an error.');
3509
+ if (typeof navigator === undefined) return false;
3510
+ return ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform) || // iPad on iOS 13 detection
3511
+ navigator.userAgent.includes('Mac') && 'ontouchend' in document;
3512
+ } catch (e) {
3513
+ console.warn('Error checking if device is iOS.');
3514
+ return false;
3515
+ }
3516
+ }; // React hook version of isIOS
3517
+
3518
+
3519
+ var useIOS = function useIOS() {
3520
+ var _useState = useState(false),
3521
+ IOS = _useState[0],
3522
+ setIOS = _useState[1];
3523
+
3524
+ useEffect(function () {
3525
+ if (typeof navigator === undefined) return;
3526
+ setIOS(isIOS());
3527
+ }, []);
3528
+ return IOS;
3529
+ };
3530
+
3506
3531
  var VideoControls = function VideoControls(_ref) {
3507
3532
  var videoElementId = _ref.videoElementId,
3508
3533
  _ref$defaultMuted = _ref.defaultMuted,
@@ -3522,6 +3547,8 @@ var VideoControls = function VideoControls(_ref) {
3522
3547
  volume = _React$useState3[0],
3523
3548
  setVolume = _React$useState3[1];
3524
3549
 
3550
+ var isIOS = useIOS();
3551
+
3525
3552
  var getVideoElement = function getVideoElement() {
3526
3553
  return document.querySelector("#" + videoElementId);
3527
3554
  };
@@ -3577,7 +3604,9 @@ var VideoControls = function VideoControls(_ref) {
3577
3604
  "aria-label": !playing ? 'Play' : 'Pause'
3578
3605
  }, /*#__PURE__*/React__default.createElement(Icon, {
3579
3606
  iconName: !playing ? 'Play' : 'Pause'
3580
- })), /*#__PURE__*/React__default.createElement(VolumeControlsWrapper, null, /*#__PURE__*/React__default.createElement(VideoMute, {
3607
+ })), /*#__PURE__*/React__default.createElement(VolumeControlsWrapper, {
3608
+ volumeHidden: isIOS
3609
+ }, /*#__PURE__*/React__default.createElement(VideoMute, {
3581
3610
  id: "mute",
3582
3611
  className: "video-mute-button",
3583
3612
  "data-testid": "video-mute-button",
@@ -3587,7 +3616,7 @@ var VideoControls = function VideoControls(_ref) {
3587
3616
  "data-testid": "mute-icon",
3588
3617
  iconName: muted ? 'Muted' : 'Volume',
3589
3618
  color: "white"
3590
- })), /*#__PURE__*/React__default.createElement(VideoVolume, {
3619
+ })), !isIOS && /*#__PURE__*/React__default.createElement(VideoVolume, {
3591
3620
  id: "vol-control",
3592
3621
  type: "range",
3593
3622
  min: "0",
@@ -3684,24 +3713,6 @@ var SvgContainer = /*#__PURE__*/styled.div(_templateObject2$f || (_templateObjec
3684
3713
  var NumContainer = /*#__PURE__*/styled.div(_templateObject3$9 || (_templateObject3$9 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n width: 12px;\n height: 12px;\n position: absolute;\n top: 8px;\n margin-left: 6px;\n\n & .basket-num {\n color: white;\n font-size: 10px;\n font-family: var(--font-family-navigation);\n }\n"])));
3685
3714
  var BasketText = /*#__PURE__*/styled.a(_templateObject4$5 || (_templateObject4$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: var(--font-size-navigation);\n font-family: var(--font-family-navigation);\n color: var(--base-color-black);\n margin-left: 6px;\n text-decoration: none;\n"])));
3686
3715
 
3687
- var checkTimeRed = function checkTimeRed(seconds) {
3688
- if (seconds <= 0) {
3689
- return false;
3690
- }
3691
-
3692
- return seconds / 60 <= 5;
3693
- };
3694
- var formatTime = function formatTime(seconds) {
3695
- if (seconds > 60) {
3696
- return Math.ceil(seconds / 60) + " mins";
3697
- }
3698
-
3699
- return seconds + " sec" + (seconds === 1 ? '' : 's');
3700
- };
3701
- var initSeconds = function initSeconds(expiryDate) {
3702
- return expiryDate ? Math.ceil((new Date(expiryDate).getTime() - new Date().getTime()) / 1000) : 0;
3703
- };
3704
-
3705
3716
  var Basket$1 = function Basket(_ref) {
3706
3717
  var text = _ref.text,
3707
3718
  link = _ref.link,
@@ -3712,27 +3723,7 @@ var Basket$1 = function Basket(_ref) {
3712
3723
  onClick = _ref.onClick,
3713
3724
  _ref$colorPrimary = _ref.colorPrimary,
3714
3725
  colorPrimary = _ref$colorPrimary === void 0 ? 'primary' : _ref$colorPrimary,
3715
- expiryDate = _ref.expiryDate;
3716
-
3717
- var _useState = useState(numItems),
3718
- basketItems = _useState[0],
3719
- setBasketItems = _useState[1];
3720
-
3721
- var _useState2 = useState(initSeconds(expiryDate)),
3722
- seconds = _useState2[0],
3723
- setSeconds = _useState2[1];
3724
-
3725
- var _useState3 = useState(formatTime(seconds)),
3726
- countdownText = _useState3[0],
3727
- setCountdownText = _useState3[1];
3728
-
3729
- var _useState4 = useState(),
3730
- timer = _useState4[0],
3731
- setTimer = _useState4[1];
3732
-
3733
- var _useState5 = useState(checkTimeRed(seconds)),
3734
- isActive = _useState5[0],
3735
- setIsActive = _useState5[1];
3726
+ isActive = _ref.isActive;
3736
3727
 
3737
3728
  var onClickHandler = function onClickHandler() {
3738
3729
  if (onClick) {
@@ -3746,36 +3737,7 @@ var Basket$1 = function Basket(_ref) {
3746
3737
  }
3747
3738
  };
3748
3739
 
3749
- useEffect(function () {
3750
- if (timer) {
3751
- clearInterval(timer); // clears the old timer before setting a new one
3752
- }
3753
-
3754
- if (!expiryDate || !numItems) return;
3755
- var interval = setInterval(function () {
3756
- setSeconds(function (prev) {
3757
- return prev - 1;
3758
- });
3759
- }, 1000);
3760
- setTimer(interval);
3761
- return function () {
3762
- return clearInterval(interval);
3763
- };
3764
- }, [expiryDate]);
3765
- useEffect(function () {
3766
- if (!timer) return;
3767
-
3768
- if (seconds > 0) {
3769
- setCountdownText(formatTime(seconds));
3770
- setIsActive(checkTimeRed(seconds));
3771
- } else {
3772
- clearInterval(timer);
3773
- setBasketItems(0);
3774
- setCountdownText('');
3775
- setIsActive(false);
3776
- }
3777
- }, [seconds, timer]);
3778
- var empty = basketItems <= 0;
3740
+ var empty = numItems <= 0;
3779
3741
  return /*#__PURE__*/React__default.createElement(BasketContainer, {
3780
3742
  selected: selected,
3781
3743
  onClick: onClickHandler,
@@ -3789,9 +3751,9 @@ var Basket$1 = function Basket(_ref) {
3789
3751
  iconName: "BasketFull"
3790
3752
  }), /*#__PURE__*/React__default.createElement(NumContainer, null, /*#__PURE__*/React__default.createElement("span", {
3791
3753
  className: "basket-num"
3792
- }, basketItems)))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(BasketText, {
3754
+ }, numItems)))), /*#__PURE__*/React__default.createElement("div", null, !empty ? /*#__PURE__*/React__default.createElement(BasketText, {
3793
3755
  "data-testid": "baskettext"
3794
- }, expiryDate ? countdownText : text)));
3756
+ }, text) : ''));
3795
3757
  };
3796
3758
 
3797
3759
  var _templateObject$v, _templateObject2$g;
@@ -4057,6 +4019,7 @@ var NavTop = function NavTop(_ref) {
4057
4019
  basketText = _ref.basketText,
4058
4020
  basketLink = _ref.basketLink,
4059
4021
  basketNumItems = _ref.basketNumItems,
4022
+ basketIsActive = _ref.basketIsActive,
4060
4023
  onClickSearch = _ref.onClickSearch,
4061
4024
  _ref$isShowSearch = _ref.isShowSearch,
4062
4025
  isShowSearch = _ref$isShowSearch === void 0 ? false : _ref$isShowSearch,
@@ -4070,6 +4033,7 @@ var NavTop = function NavTop(_ref) {
4070
4033
  link: basketLink,
4071
4034
  text: basketText,
4072
4035
  numItems: basketNumItems,
4036
+ isActive: basketIsActive,
4073
4037
  onClick: onLink,
4074
4038
  colorPrimary: colorPrimary
4075
4039
  }), /*#__PURE__*/React__default.createElement(Account, {
@@ -4427,6 +4391,7 @@ var Navigation = function Navigation(_ref) {
4427
4391
  basketText: navTopData.basketText,
4428
4392
  basketLink: navTopData.basketLink,
4429
4393
  basketNumItems: navTopData.basketNumItems,
4394
+ basketIsActive: navTopData.basketIsActive,
4430
4395
  onClickSearch: onClickSearchHandler,
4431
4396
  onLink: onLinkHandler,
4432
4397
  isShowSearch: showSearch,