@applicaster/zapp-react-native-utils 12.0.0-alpha.4534459584 → 12.0.0-alpha.5053228432

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 (54) hide show
  1. package/actionsExecutor/ActionExecutorContext.tsx +16 -8
  2. package/analyticsUtils/__tests__/analyticsManager.test.js +75 -73
  3. package/analyticsUtils/helpers/hooks.ts +1 -1
  4. package/appUtils/focusManager/treeDataStructure/Utils/index.js +12 -3
  5. package/appUtils/keyCodes/__tests__/__snapshots__/keyCodes.test.js.snap +1 -1
  6. package/appUtils/keyCodes/__tests__/keyCodes.test.js +80 -85
  7. package/appUtils/keyCodes/keys.web.js +1 -0
  8. package/appUtils/orientationHelper.ts +1 -1
  9. package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +53 -0
  10. package/appUtils/playerManager/conts.ts +5 -0
  11. package/appUtils/playerManager/player.ts +45 -5
  12. package/appUtils/playerManager/playerFactory.ts +13 -1
  13. package/appUtils/playerManager/playerNative.ts +30 -0
  14. package/appUtils/playerManager/usePlayerState.tsx +13 -1
  15. package/appUtils/playerManager/usePlayerTitleSummaryOverlay.tsx +50 -0
  16. package/cellUtils/__tests__/cellUtils.test.ts +59 -0
  17. package/cellUtils/__tests__/fixtures.ts +13 -0
  18. package/cellUtils/index.ts +44 -2
  19. package/focusManager/index.ts +1 -1
  20. package/functionUtils/__tests__/__snapshots__/functionUtils.test.js.snap +2 -2
  21. package/functionUtils/__tests__/functionUtils.test.js +244 -248
  22. package/localizationUtils/__tests__/localizationUtils.test.ts +17 -13
  23. package/localizationUtils/index.ts +6 -3
  24. package/logger/index.ts +1 -1
  25. package/manifestUtils/defaultManifestConfigurations/player.js +8 -0
  26. package/modalState/index.ts +57 -0
  27. package/navigationUtils/index.ts +52 -7
  28. package/package.json +3 -2
  29. package/playerUtils/configurationGenerator.ts +8 -0
  30. package/pluginUtils/index.ts +11 -7
  31. package/reactHooks/cell-click/__tests__/index.test.js +6 -2
  32. package/reactHooks/cell-click/index.ts +2 -2
  33. package/reactHooks/device/index.ts +0 -1
  34. package/reactHooks/device/useIsTablet.tsx +28 -3
  35. package/reactHooks/device/useMemoizedIsTablet.ts +1 -1
  36. package/reactHooks/device/useOrientation.tsx +3 -1
  37. package/reactHooks/flatList/useLoadNextPageIfNeeded.ts +16 -9
  38. package/reactHooks/index.ts +2 -0
  39. package/reactHooks/layout/__tests__/index.test.js +22 -30
  40. package/reactHooks/layout/index.ts +2 -1
  41. package/reactHooks/layout/useDimensions/helpers/__tests__/getInitialDimensions.native.test.js +11 -16
  42. package/reactHooks/layout/useDimensions/helpers/__tests__/getInitialDimensions.test.js +12 -14
  43. package/reactHooks/navigation/__tests__/index.test.tsx +216 -75
  44. package/reactHooks/navigation/index.ts +201 -85
  45. package/reactHooks/screen/index.ts +2 -0
  46. package/reactHooks/screen/useScreenData.ts +1 -1
  47. package/reactHooks/screen/useTargetScreenData.ts +7 -0
  48. package/reactHooks/state/useRivers.ts +3 -1
  49. package/reactHooks/videoModal/hooks/useVideoModalScreenData.tsx +10 -9
  50. package/riverComponetsMeasurementProvider/index.tsx +2 -2
  51. package/screenState/index.ts +8 -0
  52. package/reactHooks/device/useIsTablet.android.tsx +0 -14
  53. package/reactHooks/device/useIsTablet.ios.tsx +0 -7
  54. package/reactHooks/device/useIsTablet.web.tsx +0 -3
@@ -2,6 +2,8 @@ export { useCurrentScreenData } from "./useCurrentScreenData";
2
2
 
3
3
  export { useTargetScreenData } from "./useTargetScreenData";
4
4
 
5
+ export { useScreenData } from "./useScreenData";
6
+
5
7
  export {
6
8
  useScreenContext,
7
9
  useLegacyScreenData,
@@ -4,7 +4,7 @@ import { useRivers } from "../state";
4
4
 
5
5
  const logger = utilsLogger.addSubsystem("useScreenData");
6
6
 
7
- export const useScreenData = (screenId?: string): ZappRiver => {
7
+ export const useScreenData = (screenId: string): ZappRiver => {
8
8
  const rivers = useRivers();
9
9
 
10
10
  React.useEffect(() => {
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
3
3
  import * as R from "ramda";
4
+ import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
4
5
 
5
6
  export function getTargetScreenData(
6
7
  entry: ZappEntry,
@@ -35,6 +36,12 @@ export function getTargetScreenData(
35
36
  return rivers?.[screenId];
36
37
  }
37
38
 
39
+ export function getTargetScreenDataFromEntry(entry: ZappEntry): ZappRiver {
40
+ const { rivers, contentTypes } = appStore.get(["rivers", "contentTypes"]);
41
+
42
+ return getTargetScreenData(entry, rivers, contentTypes);
43
+ }
44
+
38
45
  export const useTargetScreenData = (entry: ZappEntry) => {
39
46
  const { rivers, contentTypes } = usePickFromState(["rivers", "contentTypes"]);
40
47
 
@@ -1,7 +1,9 @@
1
1
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
2
2
 
3
+ const riversSelector = ["rivers"];
4
+
3
5
  export const useRivers = () => {
4
- const { rivers } = usePickFromState(["rivers"]);
6
+ const { rivers } = usePickFromState(riversSelector as any);
5
7
 
6
8
  return rivers;
7
9
  };
@@ -1,8 +1,7 @@
1
- import {
2
- useContentTypes,
3
- usePickFromState,
4
- } from "@applicaster/zapp-react-native-redux/hooks";
1
+ import React from "react";
2
+ import { useContentTypes } from "@applicaster/zapp-react-native-redux/hooks";
5
3
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
4
+ import { useRivers } from "../../state";
6
5
 
7
6
  export const useVideoModalScreenData = ():
8
7
  | (ZappEntry & { targetScreen: any }) // TODO: fix ZappEntry type ( was ZappRiver but conflict )
@@ -12,11 +11,13 @@ export const useVideoModalScreenData = ():
12
11
  } = useNavigation();
13
12
 
14
13
  const contentTypes = useContentTypes();
15
- const { rivers } = usePickFromState(["rivers"]);
14
+ const rivers = useRivers();
16
15
 
17
- if (item?.type?.value) {
18
- const screenId = contentTypes[item?.type?.value].screen_id;
16
+ return React.useMemo(() => {
17
+ if (item?.type?.value) {
18
+ const screenId = contentTypes[item?.type?.value].screen_id;
19
19
 
20
- return { ...item, targetScreen: rivers?.[screenId] };
21
- }
20
+ return { ...item, targetScreen: rivers?.[screenId] };
21
+ }
22
+ }, [item]);
22
23
  };
@@ -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 { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
6
+ import { useRivers } from "../reactHooks/state";
7
7
 
8
8
  const layoutReducer = (state, { payload }) => {
9
9
  return state.map((item, index, _state) => ({
@@ -58,7 +58,7 @@ export const ScreenLoadingMeasurements = ({
58
58
  numberOfComponents,
59
59
  riverId,
60
60
  }: Props) => {
61
- const { rivers } = usePickFromState(["rivers"]);
61
+ const rivers = useRivers();
62
62
  const screenData = rivers?.[riverId];
63
63
 
64
64
  const [itemsLayout, dispatchItemLayout] = React.useReducer(
@@ -49,3 +49,11 @@ export function useScreenState(
49
49
  setSelectedEntry: (entryId) => setSelectedEntry(screenId, entryId),
50
50
  };
51
51
  }
52
+
53
+ export const useScreenScrollStore = create<{
54
+ scrollPosition: number;
55
+ scrollingVelocity: number;
56
+ }>(() => ({
57
+ scrollPosition: 0,
58
+ scrollingVelocity: 0,
59
+ }));
@@ -1,14 +0,0 @@
1
- import { useWindowDimensions } from "react-native";
2
- import { useOrientation } from "./useOrientation";
3
- import { isTablet } from "../layout";
4
-
5
- /**
6
- * Determines weather the given device is a tablet based on dimensions, orientation, and platform
7
- * @returns {Boolean} isTablet - returns whether the given device is a tablet
8
- */
9
- export const useIsTablet = (): boolean => {
10
- const dimensions = useWindowDimensions();
11
- const orientation = useOrientation();
12
-
13
- return isTablet(dimensions, orientation);
14
- };
@@ -1,7 +0,0 @@
1
- import { Platform, PlatformIOSStatic } from "react-native";
2
-
3
- export const useIsTablet = (): boolean => {
4
- const { isPad } = Platform as PlatformIOSStatic;
5
-
6
- return isPad;
7
- };
@@ -1,3 +0,0 @@
1
- export const useIsTablet = (): boolean => {
2
- return false;
3
- };