@applicaster/zapp-react-native-utils 15.0.0-rc.99 → 16.0.0-rc.1

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 (63) hide show
  1. package/README.md +0 -6
  2. package/actionUtils/index.ts +7 -0
  3. package/actionsExecutor/ActionExecutorContext.tsx +83 -6
  4. package/appUtils/HooksManager/index.ts +35 -0
  5. package/appUtils/focusManager/treeDataStructure/Tree/__tests__/Tree.test.js +46 -0
  6. package/appUtils/focusManager/treeDataStructure/Tree/index.js +18 -18
  7. package/appUtils/focusManagerAux/utils/index.ts +12 -6
  8. package/appUtils/focusManagerAux/utils/utils.ios.ts +6 -3
  9. package/appUtils/localizationsHelper.ts +4 -0
  10. package/appUtils/playerManager/index.ts +9 -0
  11. package/appUtils/playerManager/player.ts +1 -1
  12. package/appUtils/playerManager/playerNative.ts +2 -1
  13. package/appUtils/playerManager/usePlayer.tsx +5 -3
  14. package/cellUtils/__tests__/cellUtils.test.ts +39 -0
  15. package/cellUtils/index.ts +11 -1
  16. package/componentsUtils/index.ts +8 -0
  17. package/dateUtils/__tests__/dayjs.test.ts +0 -3
  18. package/dateUtils/index.ts +2 -0
  19. package/manifestUtils/_internals/__tests__/index.test.js +41 -0
  20. package/manifestUtils/_internals/index.js +33 -0
  21. package/manifestUtils/defaultManifestConfigurations/player.js +6 -16
  22. package/manifestUtils/fieldUtils/__tests__/fieldUtils.test.js +49 -0
  23. package/manifestUtils/fieldUtils/index.js +54 -0
  24. package/manifestUtils/index.js +2 -0
  25. package/manifestUtils/keys.js +228 -0
  26. package/manifestUtils/mobileAction/button/__tests__/mobileActionButton.test.js +168 -0
  27. package/manifestUtils/mobileAction/button/index.js +140 -0
  28. package/manifestUtils/mobileAction/container/__tests__/mobileActionButtonsContainer.test.js +102 -0
  29. package/manifestUtils/mobileAction/container/index.js +73 -0
  30. package/manifestUtils/mobileAction/groups/__tests__/buildMobileActionButtonGroups.test.js +127 -0
  31. package/manifestUtils/mobileAction/groups/defaults.js +76 -0
  32. package/manifestUtils/mobileAction/groups/index.js +80 -0
  33. package/numberUtils/__tests__/toNumber.test.ts +27 -12
  34. package/numberUtils/__tests__/toPositiveNumber.test.ts +32 -4
  35. package/numberUtils/index.ts +5 -1
  36. package/package.json +3 -3
  37. package/pluginUtils/index.ts +4 -5
  38. package/reactHooks/casting/index.ts +1 -0
  39. package/reactHooks/casting/useIsCasting.tsx +57 -0
  40. package/reactHooks/cell-click/index.ts +2 -1
  41. package/reactHooks/feed/index.ts +0 -2
  42. package/reactHooks/feed/useInflatedUrl.ts +1 -1
  43. package/reactHooks/resolvers/useComponentResolver.ts +13 -3
  44. package/reactHooks/screen/__tests__/useCurrentScreenIsHook.test.ts +103 -0
  45. package/reactHooks/screen/__tests__/useCurrentScreenIsStartupHook.test.ts +94 -0
  46. package/reactHooks/screen/index.ts +4 -0
  47. package/reactHooks/screen/useCurrentScreenIsHook.ts +9 -0
  48. package/reactHooks/screen/useCurrentScreenIsStartupHook.ts +8 -0
  49. package/reactHooks/state/__tests__/useComponentScreenState.test.ts +246 -0
  50. package/reactHooks/state/index.ts +2 -0
  51. package/reactHooks/state/useComponentScreenState.ts +45 -0
  52. package/refreshUtils/RefreshCoordinator/__tests__/refreshCoordinator.test.ts +206 -0
  53. package/refreshUtils/RefreshCoordinator/index.ts +245 -0
  54. package/refreshUtils/RefreshCoordinator/utils/__tests__/getDataRefreshConfig.test.ts +104 -0
  55. package/refreshUtils/RefreshCoordinator/utils/index.ts +29 -0
  56. package/screenPickerUtils/index.ts +5 -0
  57. package/screenUtils/index.ts +3 -0
  58. package/utils/__tests__/clone.test.ts +158 -0
  59. package/utils/__tests__/path.test.ts +7 -0
  60. package/utils/clone.ts +7 -0
  61. package/utils/index.ts +2 -1
  62. package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +0 -75
  63. package/reactHooks/feed/useFeedRefresh.tsx +0 -65
@@ -1,65 +0,0 @@
1
- import * as React from "react";
2
- import { path, max } from "ramda";
3
- import { isTrue } from "@applicaster/zapp-react-native-utils/booleanUtils";
4
- import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
5
- import { useIsScreenActive } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
6
-
7
- import { reactHooksLogger } from "../logger";
8
- import { ReloadDataFunction } from "./useFeedLoader";
9
-
10
- export const feedRefreshLogger = reactHooksLogger.addSubsystem("feed-refresh");
11
-
12
- type Props = {
13
- reloadData?: ReloadDataFunction;
14
- component: ZappUIComponent;
15
- };
16
-
17
- const previousTimersMap = {};
18
- const minimumRefreshingInterval = 5;
19
- const defaultRefreshInterval = 60;
20
-
21
- export const useFeedRefresh = ({ reloadData, component }: Props): void => {
22
- const isDataRefreshingEnabled = isTrue(
23
- path(["rules", "enable_data_refreshing"], component)
24
- );
25
-
26
- const refreshing_interval = toNumberWithDefault(
27
- defaultRefreshInterval,
28
- component?.rules?.refreshing_interval
29
- );
30
-
31
- const refreshingIntervalInMilliseconds =
32
- max(refreshing_interval, minimumRefreshingInterval) * 1000;
33
-
34
- const isScreenActive = useIsScreenActive();
35
-
36
- React.useEffect(() => {
37
- if (isDataRefreshingEnabled && refreshing_interval && isScreenActive) {
38
- if (refreshing_interval < minimumRefreshingInterval) {
39
- feedRefreshLogger.warning({
40
- message: `You set your feed refresh interval to ${refreshing_interval} when minimum value is ${minimumRefreshingInterval}seconds.Your feed will refresh after ${minimumRefreshingInterval}seconds.`,
41
- });
42
- }
43
-
44
- if (!reloadData || typeof reloadData !== "function") {
45
- feedRefreshLogger.warning({
46
- message:
47
- "reloadData function is undefined, feed refresh feature won't work properly",
48
- });
49
- }
50
-
51
- if (previousTimersMap[component?.id]) {
52
- reloadData?.();
53
- }
54
-
55
- const refreshInterval = setInterval(() => {
56
- reloadData?.();
57
- }, refreshingIntervalInMilliseconds);
58
-
59
- return () => {
60
- previousTimersMap[component?.id] = true;
61
- clearInterval(refreshInterval);
62
- };
63
- }
64
- }, [reloadData, isScreenActive]);
65
- };