@applicaster/zapp-react-dom-app 14.0.23 → 14.0.24-alpha.5957182363

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.
@@ -59,7 +59,7 @@ import { withBackToTopActionHOC, BackToTopAction } from "./hoc";
59
59
  const { withXray } = getXray();
60
60
  const globalAny: any = global;
61
61
 
62
- const { log_debug, log_warning, log_info } = createLogger({
62
+ const { log_warning } = createLogger({
63
63
  category: "InteractionManager",
64
64
  subsystem: "zapp-react-dom-app",
65
65
  });
@@ -164,7 +164,7 @@ class InteractionManagerClass extends React.Component<Props, State> {
164
164
  }
165
165
 
166
166
  componentDidMount() {
167
- window.addEventListener("keydown", this.onKeyDownListener, true);
167
+ window.addEventListener("keydown", this.onKeyDownListener, false); // Let events bubble
168
168
  window.addEventListener("keyup", this.onKeyUp);
169
169
  window.addEventListener("mousemove", this.onMouseMoveListener);
170
170
 
@@ -406,13 +406,6 @@ class InteractionManagerClass extends React.Component<Props, State> {
406
406
  const { isDialogVisible } = confirmationDialogStore.getState();
407
407
  const { isKeyboardVisible } = this.state;
408
408
 
409
- log_debug("onBackPress", {
410
- eventCode: event.code,
411
- displayState,
412
- isDialogVisible,
413
- isKeyboardVisible,
414
- });
415
-
416
409
  if (isKeyboardVisible && shouldUseOnScreenKeyboard()) {
417
410
  this.handleKeyboardDismiss();
418
411
  event.preventDefault();
@@ -426,44 +419,32 @@ class InteractionManagerClass extends React.Component<Props, State> {
426
419
  switch (displayState) {
427
420
  case DISPLAY_STATES.DEFAULT:
428
421
  if (action === "PLATFORM_BACK") {
429
- log_info(action);
430
-
431
422
  this.platformBack();
432
423
  }
433
424
 
434
425
  if (action === "GO_HOME") {
435
- log_info(action);
436
-
437
426
  this.goToHome();
438
427
  }
439
428
 
440
429
  if (action === "FOCUS_ON_SELECTED_TOP_MENU_ITEM") {
441
- log_info(action);
442
-
443
430
  // we don't have enough context at this point to set focus properly on selected top-menu-item, just emit event about it.
444
431
  // TopMenu component is supposed to handle this event.
445
432
  emitFocusOnSelectedTopMenuItem();
446
433
  }
447
434
 
448
435
  if (action === "FOCUS_ON_SELECTED_TAB_ITEM") {
449
- log_info(action);
450
-
451
436
  // we don't have enough context at this point to set focus properly on selected tab-menu-item, just emit event about it
452
437
  // Tabs component is supposed to handle this event.
453
438
  emitFocusOnSelectedTab();
454
439
  }
455
440
 
456
441
  if (action === "GO_BACK") {
457
- log_info(action);
458
-
459
442
  if (navigator.canGoBack()) {
460
443
  navigator.goBack();
461
444
  }
462
445
  }
463
446
 
464
447
  if (action === "FORCE_GO_BACK") {
465
- log_info(action);
466
-
467
448
  const fallbackToHome = false;
468
449
  const fromHook = true;
469
450
 
@@ -501,8 +482,13 @@ class InteractionManagerClass extends React.Component<Props, State> {
501
482
 
502
483
  break;
503
484
  case DISPLAY_STATES.HUD:
504
- // IF transport controls are open, close them instead of closing player
505
- setDisplayState(DISPLAY_STATES.PLAYER);
485
+ if (action === "GO_BACK" && navigator.canGoBack()) {
486
+ navigator.goBack();
487
+ } else {
488
+ // IF transport controls are open, close them instead of closing player
489
+ setDisplayState(DISPLAY_STATES.PLAYER);
490
+ }
491
+
506
492
  break;
507
493
  default:
508
494
  setDisplayState(DISPLAY_STATES.PLAYER);
@@ -563,6 +549,39 @@ class InteractionManagerClass extends React.Component<Props, State> {
563
549
  displayState === DISPLAY_STATES.PLAYER ||
564
550
  displayState === DISPLAY_STATES.HUD
565
551
  ) {
552
+ // TODO: find alternative, using this logic to allow events to be passed to player controls
553
+ // Still handle other keys (back, play/pause, etc.) through InteractionManager
554
+ const player = window?.applicaster?.player;
555
+ const videoElement = player?.getVideoElement();
556
+
557
+ const isNavigationKey =
558
+ keyCode(event).matchesAny(...ARROW_KEYS) ||
559
+ keyCode(event).matches(KEYS.Enter) ||
560
+ (__DEV__ && keyCode(event).matches(KEYS.X));
561
+
562
+ const isBrightcoveControlFocused = () => {
563
+ const activeElement = document.activeElement;
564
+ if (!activeElement || !videoElement) return false;
565
+
566
+ const playerContainer = videoElement.closest(".video-js");
567
+
568
+ return playerContainer?.contains(activeElement) ?? false;
569
+ };
570
+
571
+ const brightcoveControlHasFocus = isBrightcoveControlFocused();
572
+
573
+ if (videoElement && isNavigationKey) {
574
+ if (brightcoveControlHasFocus) {
575
+ return;
576
+ }
577
+
578
+ if (displayState === DISPLAY_STATES.PLAYER) {
579
+ setDisplayState(DISPLAY_STATES.HUD);
580
+ }
581
+
582
+ return;
583
+ }
584
+
566
585
  /**
567
586
  registering native keys for playback
568
587
  */
@@ -625,7 +644,10 @@ class InteractionManagerClass extends React.Component<Props, State> {
625
644
 
626
645
  focusManager.recoverFocus();
627
646
  this.resetHudTimeout();
628
- } else {
647
+ } else if (
648
+ displayState !== DISPLAY_STATES.PLAYER &&
649
+ displayState !== DISPLAY_STATES.HUD
650
+ ) {
629
651
  focusManager.pressIn();
630
652
  focusManager.press();
631
653
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-dom-app",
3
- "version": "14.0.23",
3
+ "version": "14.0.24-alpha.5957182363",
4
4
  "description": "Zapp App Component for Applicaster's Quick Brick React Native App",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "homepage": "https://github.com/applicaster/zapp-react-dom-app#readme",
24
24
  "dependencies": {
25
- "@applicaster/zapp-react-dom-ui-components": "14.0.23",
26
- "@applicaster/zapp-react-native-bridge": "14.0.23",
27
- "@applicaster/zapp-react-native-redux": "14.0.23",
28
- "@applicaster/zapp-react-native-ui-components": "14.0.23",
29
- "@applicaster/zapp-react-native-utils": "14.0.23",
25
+ "@applicaster/zapp-react-dom-ui-components": "14.0.24-alpha.5957182363",
26
+ "@applicaster/zapp-react-native-bridge": "14.0.24-alpha.5957182363",
27
+ "@applicaster/zapp-react-native-redux": "14.0.24-alpha.5957182363",
28
+ "@applicaster/zapp-react-native-ui-components": "14.0.24-alpha.5957182363",
29
+ "@applicaster/zapp-react-native-utils": "14.0.24-alpha.5957182363",
30
30
  "abortcontroller-polyfill": "^1.7.5",
31
31
  "typeface-montserrat": "^0.0.54",
32
32
  "video.js": "7.14.3",