@applicaster/zapp-react-native-utils 14.0.0-alpha.5621117258 → 14.0.0-alpha.6240202185

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 (78) hide show
  1. package/actionsExecutor/ActionExecutorContext.tsx +1 -1
  2. package/analyticsUtils/AnalyticsEvents/helper.ts +81 -0
  3. package/analyticsUtils/AnalyticsEvents/sendHeaderClickEvent.ts +1 -1
  4. package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +2 -1
  5. package/analyticsUtils/AnalyticsEvents/sendOnClickEvent.ts +14 -4
  6. package/analyticsUtils/__tests__/analyticsUtils.test.js +14 -0
  7. package/analyticsUtils/events.ts +8 -0
  8. package/analyticsUtils/index.tsx +3 -4
  9. package/analyticsUtils/manager.ts +1 -1
  10. package/appUtils/HooksManager/Hook.ts +4 -4
  11. package/appUtils/HooksManager/index.ts +11 -1
  12. package/appUtils/accessibilityManager/index.ts +7 -4
  13. package/appUtils/focusManager/treeDataStructure/Tree/index.js +1 -1
  14. package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +0 -15
  15. package/appUtils/playerManager/useChapterMarker.tsx +0 -1
  16. package/appUtils/playerManager/usePlayerControllerSetup.tsx +16 -0
  17. package/arrayUtils/__tests__/isEmptyArray.test.ts +63 -0
  18. package/arrayUtils/__tests__/isFilledArray.test.ts +1 -1
  19. package/arrayUtils/index.ts +8 -3
  20. package/audioPlayerUtils/__tests__/getArtworkImage.test.ts +144 -0
  21. package/audioPlayerUtils/__tests__/getBackgroundImage.test.ts +72 -0
  22. package/audioPlayerUtils/__tests__/getImageFromEntry.test.ts +110 -0
  23. package/audioPlayerUtils/assets/index.ts +2 -0
  24. package/audioPlayerUtils/index.ts +242 -0
  25. package/componentsUtils/__tests__/isTabsScreen.test.ts +38 -0
  26. package/componentsUtils/index.ts +4 -1
  27. package/conf/player/__tests__/selectors.test.ts +34 -0
  28. package/conf/player/selectors.ts +10 -0
  29. package/configurationUtils/__tests__/configurationUtils.test.js +0 -31
  30. package/configurationUtils/__tests__/getMediaItems.test.ts +65 -0
  31. package/configurationUtils/__tests__/imageSrcFromMediaItem.test.ts +34 -0
  32. package/configurationUtils/__tests__/manifestKeyParser.test.ts +547 -0
  33. package/configurationUtils/index.ts +63 -34
  34. package/configurationUtils/manifestKeyParser.ts +57 -32
  35. package/focusManager/FocusManager.ts +26 -16
  36. package/focusManager/Tree.ts +25 -21
  37. package/focusManager/__tests__/FocusManager.test.ts +50 -8
  38. package/index.d.ts +0 -9
  39. package/manifestUtils/_internals/getDefaultConfiguration.js +28 -0
  40. package/manifestUtils/{_internals.js → _internals/index.js} +2 -25
  41. package/manifestUtils/createConfig.js +4 -1
  42. package/manifestUtils/defaultManifestConfigurations/player.js +1239 -200
  43. package/manifestUtils/progressBar/__tests__/mobileProgressBar.test.js +0 -30
  44. package/navigationUtils/__tests__/mapContentTypesToRivers.test.ts +130 -0
  45. package/navigationUtils/index.ts +6 -4
  46. package/package.json +2 -3
  47. package/playerUtils/__tests__/configurationUtils.test.ts +1 -65
  48. package/playerUtils/__tests__/getPlayerActionButtons.test.ts +54 -0
  49. package/playerUtils/_internals/__tests__/utils.test.ts +71 -0
  50. package/playerUtils/_internals/index.ts +1 -0
  51. package/playerUtils/_internals/utils.ts +31 -0
  52. package/playerUtils/configurationUtils.ts +0 -44
  53. package/playerUtils/getPlayerActionButtons.ts +17 -0
  54. package/playerUtils/index.ts +2 -0
  55. package/playerUtils/useValidatePlayerConfig.tsx +22 -19
  56. package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +15 -14
  57. package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +39 -88
  58. package/reactHooks/feed/useBatchLoading.ts +11 -9
  59. package/reactHooks/feed/useFeedLoader.tsx +12 -8
  60. package/reactHooks/feed/usePipesCacheReset.ts +3 -3
  61. package/reactHooks/flatList/useSequentialRenderItem.tsx +3 -3
  62. package/reactHooks/layout/__tests__/index.test.tsx +3 -1
  63. package/reactHooks/layout/isTablet/index.ts +12 -5
  64. package/reactHooks/layout/useDimensions/__tests__/useDimensions.test.ts +34 -36
  65. package/reactHooks/layout/useDimensions/useDimensions.ts +2 -3
  66. package/reactHooks/layout/useLayoutVersion.ts +5 -5
  67. package/reactHooks/navigation/index.ts +7 -5
  68. package/reactHooks/navigation/useIsScreenActive.ts +9 -5
  69. package/reactHooks/resolvers/__tests__/useCellResolver.test.tsx +4 -0
  70. package/reactHooks/screen/useScreenContext.ts +1 -1
  71. package/reactHooks/state/__tests__/ZStoreProvider.test.tsx +2 -1
  72. package/reactHooks/state/useRivers.ts +7 -8
  73. package/riverComponetsMeasurementProvider/index.tsx +1 -1
  74. package/services/js2native.ts +1 -0
  75. package/testUtils/index.tsx +7 -8
  76. package/time/BackgroundTimer.ts +6 -4
  77. package/utils/index.ts +17 -1
  78. package/playerUtils/configurationGenerator.ts +0 -2572
@@ -1,3 +1,4 @@
1
+ import { ROUTE_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/routeTypes";
1
2
  import { useNavigation } from "./useNavigation";
2
3
  import { usePathname } from "./usePathname";
3
4
 
@@ -6,11 +7,14 @@ export const useIsScreenActive = () => {
6
7
  const pathname = usePathname();
7
8
  const { currentRoute, videoModalState } = useNavigation();
8
9
 
9
- if (
10
- videoModalState.visible &&
11
- ["FULLSCREEN", "MAXIMIZED", "PIP"].includes(videoModalState.mode)
12
- ) {
13
- return false;
10
+ if (videoModalState.visible) {
11
+ if (pathname.includes(ROUTE_TYPES.VIDEO_MODAL)) {
12
+ return true;
13
+ }
14
+
15
+ if (["FULLSCREEN", "MAXIMIZED", "PIP"].includes(videoModalState.mode)) {
16
+ return false;
17
+ }
14
18
  }
15
19
 
16
20
  return pathname === currentRoute;
@@ -14,6 +14,10 @@ jest.mock("@applicaster/zapp-react-native-utils/localizationUtils", () => ({
14
14
 
15
15
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation");
16
16
 
17
+ jest.mock(
18
+ "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation"
19
+ );
20
+
17
21
  const { useCellResolver } = require("../useCellResolver");
18
22
 
19
23
  describe("cellResolver", () => {
@@ -2,7 +2,7 @@ import { useContext, useMemo } from "react";
2
2
 
3
3
  import { useModalNavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ModalNavigationContext";
4
4
  import { useNestedNavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/NestedNavigationContext";
5
- import { useNavigation } from "../navigation/useNavigation";
5
+ import { useNavigation } from "../navigation";
6
6
 
7
7
  import { ScreenContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenContext";
8
8
  import { ScreenDataContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenDataContext";
@@ -1,7 +1,8 @@
1
+ /* eslint-disable no-console */
1
2
  import React from "react";
2
3
  import { render, screen } from "@testing-library/react-native";
3
4
  import { Text } from "react-native";
4
- import { ZStoreProvider, useZStore } from "../ZStoreProvider";
5
+ import { useZStore, ZStoreProvider } from "../ZStoreProvider";
5
6
  import { useStore } from "zustand";
6
7
 
7
8
  interface TestState {
@@ -1,9 +1,8 @@
1
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
1
+ import {
2
+ useAppSelector,
3
+ selectRivers,
4
+ } from "@applicaster/zapp-react-native-redux";
2
5
 
3
- const riversSelector = ["rivers"];
4
-
5
- export const useRivers = () => {
6
- const { rivers } = usePickFromState(riversSelector as any);
7
-
8
- return rivers;
9
- };
6
+ export function useRivers(): Record<string, ZappRiver> {
7
+ return useAppSelector(selectRivers);
8
+ }
@@ -3,7 +3,7 @@ import { NativeModules, StyleSheet, View } from "react-native";
3
3
  import { getXray } from "@applicaster/zapp-react-native-utils/logger";
4
4
 
5
5
  import { isApplePlatform, isWeb } from "../reactUtils";
6
- import { useRivers } from "../reactHooks/state";
6
+ import { useRivers } from "../reactHooks";
7
7
 
8
8
  const layoutReducer = (state, { payload }) => {
9
9
  return state.map((item, index, _state) => ({
@@ -496,6 +496,7 @@ async function removeStorageListenerHandler(payload: { listenerId?: string }) {
496
496
  function log({ level, messages }) {
497
497
  try {
498
498
  const parsedMessages = parseJsonIfNeeded(messages);
499
+ // eslint-disable-next-line no-console
499
500
  const logFn = console[level] || console.log;
500
501
 
501
502
  if (Array.isArray(parsedMessages)) {
@@ -1,17 +1,16 @@
1
- import * as R from "ramda";
2
-
1
+ import { SafeAreaProvider } from "react-native-safe-area-context";
2
+ import { render } from "@testing-library/react-native";
3
3
  import React, { PropsWithChildren } from "react";
4
- import { View } from "react-native";
5
-
4
+ import configureStore from "redux-mock-store";
6
5
  import { Provider } from "react-redux";
6
+ import { View } from "react-native";
7
7
  import thunk from "redux-thunk";
8
- import configureStore from "redux-mock-store";
9
- import { SafeAreaProvider } from "react-native-safe-area-context";
8
+ import * as R from "ramda";
9
+
10
10
  import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
11
11
 
12
- import { render } from "@testing-library/react-native";
13
- import { AnalyticsProvider } from "../analyticsUtils";
14
12
  import { ThemeContext } from "../theme";
13
+ import { AnalyticsProvider } from "../analyticsUtils";
15
14
 
16
15
  export { getByTestId } from "./getByTestId";
17
16
 
@@ -11,15 +11,17 @@ class BackgroundTimer {
11
11
  this.uniqueId = 0;
12
12
  this.callbacks = {};
13
13
 
14
- const EventEmitter = platformSelect({
14
+ const EventEmitter: typeof DeviceEventEmitter | undefined = platformSelect({
15
15
  android: DeviceEventEmitter,
16
- ios: undefined,
16
+ android_tv: DeviceEventEmitter,
17
+ amazon: DeviceEventEmitter, // probably does not exist and uses android_tv
17
18
  default: undefined,
18
19
  });
19
20
 
20
21
  EventEmitter?.addListener("BackgroundTimer.timer.fired", (id: number) => {
21
- if (this.callbacks[id]) {
22
- const callback = this.callbacks[id];
22
+ const callback = this.callbacks[id];
23
+
24
+ if (callback) {
23
25
  delete this.callbacks[id];
24
26
  callback();
25
27
  }
package/utils/index.ts CHANGED
@@ -2,4 +2,20 @@ export { chunk } from "./chunk";
2
2
 
3
3
  export { times } from "./times";
4
4
 
5
- export { cloneDeep as clone, flatten, drop, size, isNil } from "lodash";
5
+ export {
6
+ cloneDeep as clone,
7
+ flatten,
8
+ drop,
9
+ size,
10
+ isNil,
11
+ isEmpty,
12
+ get,
13
+ has,
14
+ flatMap,
15
+ difference,
16
+ take,
17
+ pick,
18
+ map,
19
+ trim,
20
+ toString,
21
+ } from "lodash";