@applicaster/zapp-react-native-utils 15.0.0-alpha.4153840309 → 15.0.0-alpha.4200413542

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 (125) hide show
  1. package/actionsExecutor/ActionExecutorContext.tsx +3 -6
  2. package/actionsExecutor/feedDecorator.ts +6 -6
  3. package/adsUtils/__tests__/createVMAP.test.ts +419 -0
  4. package/adsUtils/index.ts +2 -2
  5. package/analyticsUtils/README.md +1 -1
  6. package/analyticsUtils/analyticsMapper.ts +10 -2
  7. package/appDataUtils/__tests__/urlScheme.test.ts +678 -0
  8. package/appUtils/HooksManager/__tests__/__snapshots__/hooksManager.test.js.snap +0 -188
  9. package/appUtils/HooksManager/__tests__/hooksManager.test.js +16 -2
  10. package/appUtils/HooksManager/index.ts +10 -10
  11. package/appUtils/RiverFocusManager/{index.js → index.ts} +25 -18
  12. package/appUtils/accessibilityManager/__tests__/utils.test.ts +360 -0
  13. package/appUtils/accessibilityManager/const.ts +4 -0
  14. package/appUtils/accessibilityManager/utils.ts +25 -5
  15. package/appUtils/contextKeysManager/__tests__/getKeys/failure.test.ts +7 -2
  16. package/appUtils/contextKeysManager/__tests__/getKeys/success.test.ts +48 -0
  17. package/appUtils/contextKeysManager/contextResolver.ts +51 -22
  18. package/appUtils/contextKeysManager/index.ts +65 -10
  19. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +3 -0
  20. package/appUtils/focusManager/index.ios.ts +43 -4
  21. package/appUtils/focusManagerAux/utils/index.ios.ts +122 -0
  22. package/appUtils/focusManagerAux/utils/index.ts +1 -1
  23. package/appUtils/focusManagerAux/utils/utils.ios.ts +199 -3
  24. package/appUtils/keyCodes/keys/keys.web.ts +1 -4
  25. package/appUtils/orientationHelper.ts +2 -4
  26. package/appUtils/platform/platformUtils.ts +1 -1
  27. package/appUtils/playerManager/player.ts +4 -0
  28. package/appUtils/playerManager/playerNative.ts +29 -16
  29. package/appUtils/playerManager/usePlayerState.tsx +14 -2
  30. package/cloudEventsUtils/__tests__/index.test.ts +529 -0
  31. package/cloudEventsUtils/index.ts +65 -1
  32. package/configurationUtils/__tests__/imageSrcFromMediaItem.test.ts +38 -0
  33. package/configurationUtils/__tests__/manifestKeyParser.test.ts +26 -26
  34. package/configurationUtils/index.ts +17 -11
  35. package/dateUtils/__tests__/dayjs.test.ts +330 -0
  36. package/enumUtils/__tests__/getEnumKeyByEnumValue.test.ts +207 -0
  37. package/errorUtils/__tests__/GeneralError.test.ts +97 -0
  38. package/errorUtils/__tests__/HttpStatusCode.test.ts +344 -0
  39. package/errorUtils/__tests__/MissingPluginError.test.ts +113 -0
  40. package/errorUtils/__tests__/NetworkError.test.ts +202 -0
  41. package/errorUtils/__tests__/getParsedResponse.test.ts +188 -0
  42. package/errorUtils/__tests__/invariant.test.ts +112 -0
  43. package/focusManager/aux/index.ts +1 -1
  44. package/headersUtils/__tests__/headersUtils.test.js +11 -1
  45. package/headersUtils/index.ts +2 -1
  46. package/manifestUtils/defaultManifestConfigurations/player.js +125 -11
  47. package/manifestUtils/platformIsTV.js +13 -0
  48. package/manifestUtils/tvAction/container/index.js +1 -1
  49. package/navigationUtils/index.ts +15 -5
  50. package/numberUtils/__tests__/toNumber.test.ts +12 -0
  51. package/numberUtils/__tests__/toPositiveNumber.test.ts +165 -0
  52. package/numberUtils/index.ts +19 -1
  53. package/package.json +4 -4
  54. package/pluginUtils/index.ts +4 -0
  55. package/reactHooks/advertising/index.ts +2 -2
  56. package/reactHooks/analytics/__tests__/useSendAnalyticsOnPress.test.ts +537 -0
  57. package/reactHooks/app/__tests__/useAppState.test.ts +1 -1
  58. package/reactHooks/autoscrolling/__tests__/useTrackCurrentAutoScrollingElement.test.ts +1 -1
  59. package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +1 -2
  60. package/reactHooks/cell-click/__tests__/index.test.js +1 -3
  61. package/reactHooks/configuration/__tests__/index.test.tsx +1 -1
  62. package/reactHooks/connection/__tests__/index.test.js +1 -1
  63. package/reactHooks/debugging/__tests__/index.test.js +4 -4
  64. package/reactHooks/dev/__tests__/useReRenderLog.test.ts +188 -0
  65. package/reactHooks/device/useIsTablet.tsx +14 -19
  66. package/reactHooks/device/useMemoizedIsTablet.ts +3 -3
  67. package/reactHooks/events/index.ts +20 -0
  68. package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +32 -23
  69. package/reactHooks/feed/__tests__/useBuildPipesUrl.test.tsx +19 -19
  70. package/reactHooks/feed/__tests__/useEntryScreenId.test.tsx +4 -1
  71. package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +42 -30
  72. package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +1 -1
  73. package/reactHooks/feed/__tests__/{useInflatedUrl.test.ts → useInflatedUrl.test.tsx} +62 -7
  74. package/reactHooks/feed/useEntryScreenId.ts +2 -2
  75. package/reactHooks/feed/useInflatedUrl.ts +43 -17
  76. package/reactHooks/flatList/useLoadNextPageIfNeeded.ts +13 -16
  77. package/reactHooks/hookModal/hooks/useHookModalScreenData.ts +12 -8
  78. package/reactHooks/index.ts +2 -0
  79. package/reactHooks/layout/__tests__/index.test.tsx +1 -1
  80. package/reactHooks/layout/__tests__/useLayoutVersion.test.tsx +1 -1
  81. package/reactHooks/layout/useDimensions/__tests__/{useDimensions.test.ts → useDimensions.test.tsx} +105 -25
  82. package/reactHooks/layout/useDimensions/useDimensions.ts +2 -2
  83. package/reactHooks/navigation/__tests__/index.test.tsx +40 -9
  84. package/reactHooks/navigation/index.ts +27 -11
  85. package/reactHooks/navigation/useRoute.ts +11 -7
  86. package/reactHooks/player/TVSeekControlller/TVSeekController.ts +27 -10
  87. package/reactHooks/player/__tests__/useAutoSeek._test.tsx +1 -1
  88. package/reactHooks/player/__tests__/useTapSeek._test.ts +1 -1
  89. package/reactHooks/resolvers/__tests__/useCellResolver.test.tsx +1 -1
  90. package/reactHooks/resolvers/__tests__/useComponentResolver.test.tsx +1 -1
  91. package/reactHooks/resolvers/useCellResolver.ts +6 -2
  92. package/reactHooks/resolvers/useComponentResolver.ts +8 -2
  93. package/reactHooks/screen/__tests__/useCurrentScreenData.test.tsx +2 -2
  94. package/reactHooks/screen/__tests__/useScreenBackgroundColor.test.tsx +1 -1
  95. package/reactHooks/screen/__tests__/useScreenData.test.tsx +1 -1
  96. package/reactHooks/screen/__tests__/useTargetScreenData.test.tsx +12 -4
  97. package/reactHooks/screen/useTargetScreenData.ts +4 -2
  98. package/reactHooks/state/useRefWithInitialValue.ts +10 -0
  99. package/reactHooks/state/useRivers.ts +1 -1
  100. package/reactHooks/ui/__tests__/useFadeOutWhenBlurred.test.ts +580 -0
  101. package/reactHooks/usePluginConfiguration.ts +2 -2
  102. package/reactHooks/utils/__tests__/index.test.js +1 -1
  103. package/rectUtils/__tests__/index.test.ts +549 -0
  104. package/rectUtils/index.ts +2 -2
  105. package/screenPickerUtils/__tests__/index.test.ts +333 -0
  106. package/screenState/__tests__/index.test.ts +1 -1
  107. package/searchUtils/const.ts +7 -0
  108. package/searchUtils/index.ts +3 -0
  109. package/services/storageServiceSync.web.ts +1 -1
  110. package/stringUtils/index.ts +1 -1
  111. package/testUtils/index.tsx +30 -21
  112. package/time/__tests__/BackgroundTimer.test.ts +156 -0
  113. package/time/__tests__/Timer.test.ts +236 -0
  114. package/typeGuards/__tests__/isString.test.ts +21 -0
  115. package/typeGuards/index.ts +4 -0
  116. package/utils/__tests__/mergeRight.test.ts +48 -0
  117. package/utils/__tests__/selectors.test.ts +124 -0
  118. package/utils/index.ts +13 -0
  119. package/utils/mergeRight.ts +5 -0
  120. package/utils/path.ts +6 -3
  121. package/utils/pathOr.ts +5 -1
  122. package/utils/selectors.ts +46 -0
  123. package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +34 -11
  124. package/zappFrameworkUtils/HookCallback/hookCallbackManifestExtensions.config.js +1 -1
  125. package/reactHooks/componentsMap/index.ts +0 -55
@@ -1,55 +0,0 @@
1
- import * as React from "react";
2
-
3
- const layoutReducer = (state, { payload }) => {
4
- return state.map((item, index, _state) => ({
5
- height: index === payload.index ? payload.height : item.height,
6
- y:
7
- index > 0
8
- ? _state.slice(0, index).reduce((acc, value) => acc + value.height, 0)
9
- : 0,
10
- }));
11
- };
12
-
13
- export const useComponentsLayout = (count, onFinishLoadingVisible) => {
14
- const [itemsLayout, dispatchItemLayout] = React.useReducer(
15
- layoutReducer,
16
- Array.from({ length: count }, () => ({ height: 0, y: 0 }))
17
- );
18
-
19
- const notified = React.useRef(false);
20
- const [listHeight, setListHeight] = React.useState<number>(0);
21
-
22
- const onItemLayout = React.useCallback(
23
- (index) => (event) => {
24
- const { height } = event.nativeEvent.layout;
25
- dispatchItemLayout({ payload: { index, height } });
26
- },
27
- []
28
- );
29
-
30
- const onListLayout = React.useCallback((event) => {
31
- const { height } = event.nativeEvent.layout;
32
- setListHeight(height);
33
- }, []);
34
-
35
- React.useEffect(() => {
36
- if (!notified.current) {
37
- const finishLoadingVisible = !!itemsLayout.find(
38
- (item) => item.y > listHeight
39
- );
40
-
41
- if (finishLoadingVisible) {
42
- notified.current = true;
43
- onFinishLoadingVisible?.();
44
- }
45
- }
46
- }, [itemsLayout, listHeight]);
47
-
48
- return React.useMemo(
49
- () => ({
50
- onItemLayout,
51
- onListLayout,
52
- }),
53
- []
54
- );
55
- };