@applicaster/zapp-react-native-utils 15.1.0-rc.8 → 16.0.0-alpha.1833861900
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.
- package/README.md +0 -6
- package/actionUtils/index.ts +7 -0
- package/actionsExecutor/ActionExecutorContext.tsx +43 -12
- package/actionsExecutor/feedDecorator.ts +6 -6
- package/adsUtils/__tests__/createVMAP.test.ts +419 -0
- package/adsUtils/index.ts +2 -2
- package/analyticsUtils/PlayerAnalyticsManager.ts +11 -1
- package/analyticsUtils/README.md +1 -1
- package/analyticsUtils/playerAnalyticsTracker.ts +26 -3
- package/appDataUtils/__tests__/urlScheme.test.ts +678 -0
- package/appUtils/HooksManager/__tests__/__snapshots__/hooksManager.test.js.snap +0 -188
- package/appUtils/HooksManager/__tests__/hooksManager.test.js +16 -2
- package/appUtils/HooksManager/index.ts +15 -26
- package/appUtils/RiverFocusManager/{index.js → index.ts} +25 -18
- package/appUtils/accessibilityManager/const.ts +4 -0
- package/appUtils/accessibilityManager/utils.ts +0 -1
- package/appUtils/contextKeysManager/__tests__/getKeys/failure.test.ts +7 -2
- package/appUtils/contextKeysManager/__tests__/getKeys/success.test.ts +48 -0
- package/appUtils/contextKeysManager/contextResolver.ts +51 -22
- package/appUtils/contextKeysManager/index.ts +65 -10
- package/appUtils/contextKeysManager/utils/index.ts +38 -25
- package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +3 -0
- package/appUtils/focusManager/index.ios.ts +43 -4
- package/appUtils/focusManager/treeDataStructure/Tree/__tests__/Tree.test.js +46 -0
- package/appUtils/focusManager/treeDataStructure/Tree/index.js +18 -18
- package/appUtils/focusManagerAux/utils/index.ios.ts +122 -0
- package/appUtils/focusManagerAux/utils/index.ts +11 -3
- package/appUtils/focusManagerAux/utils/utils.ios.ts +202 -3
- package/appUtils/keyCodes/keys/keys.web.ts +1 -4
- package/appUtils/orientationHelper.ts +2 -4
- package/appUtils/platform/platformUtils.ts +12 -1
- package/appUtils/playerManager/player.ts +4 -0
- package/appUtils/playerManager/playerNative.ts +30 -21
- package/appUtils/playerManager/usePlayerState.tsx +14 -2
- package/cloudEventsUtils/__tests__/index.test.ts +529 -0
- package/cloudEventsUtils/index.ts +65 -1
- package/componentsUtils/index.ts +8 -0
- package/configurationUtils/__tests__/manifestKeyParser.test.ts +26 -26
- package/enumUtils/__tests__/getEnumKeyByEnumValue.test.ts +207 -0
- package/errorUtils/__tests__/GeneralError.test.ts +97 -0
- package/errorUtils/__tests__/HttpStatusCode.test.ts +344 -0
- package/errorUtils/__tests__/MissingPluginError.test.ts +113 -0
- package/errorUtils/__tests__/NetworkError.test.ts +202 -0
- package/errorUtils/__tests__/getParsedResponse.test.ts +188 -0
- package/errorUtils/__tests__/invariant.test.ts +112 -0
- package/focusManager/aux/index.ts +1 -1
- package/headersUtils/__tests__/headersUtils.test.js +11 -1
- package/headersUtils/index.ts +2 -1
- package/manifestUtils/_internals/__tests__/index.test.js +41 -0
- package/manifestUtils/_internals/index.js +33 -0
- package/manifestUtils/defaultManifestConfigurations/player.js +59 -1
- package/manifestUtils/fieldUtils/__tests__/fieldUtils.test.js +49 -0
- package/manifestUtils/fieldUtils/index.js +54 -0
- package/manifestUtils/index.js +3 -1
- package/manifestUtils/keys.js +228 -0
- package/manifestUtils/mobileAction/button/__tests__/mobileActionButton.test.js +168 -0
- package/manifestUtils/mobileAction/button/index.js +140 -0
- package/manifestUtils/mobileAction/container/__tests__/mobileActionButtonsContainer.test.js +102 -0
- package/manifestUtils/mobileAction/container/index.js +73 -0
- package/manifestUtils/mobileAction/groups/__tests__/buildMobileActionButtonGroups.test.js +127 -0
- package/manifestUtils/mobileAction/groups/defaults.js +76 -0
- package/manifestUtils/mobileAction/groups/index.js +80 -0
- package/manifestUtils/tvAction/container/index.js +1 -1
- package/numberUtils/__tests__/toNumber.test.ts +27 -0
- package/numberUtils/__tests__/toPositiveNumber.test.ts +193 -0
- package/numberUtils/index.ts +23 -1
- package/package.json +4 -4
- package/playerUtils/index.ts +4 -2
- package/pluginUtils/index.ts +4 -0
- package/reactHooks/advertising/index.ts +2 -2
- package/reactHooks/analytics/__tests__/useSendAnalyticsOnPress.test.ts +537 -0
- package/reactHooks/app/__tests__/useAppState.test.ts +1 -1
- package/reactHooks/autoscrolling/__tests__/useTrackCurrentAutoScrollingElement.test.ts +1 -1
- package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +1 -2
- package/reactHooks/cell-click/__tests__/index.test.js +1 -3
- package/reactHooks/cell-click/index.ts +2 -1
- package/reactHooks/configuration/__tests__/index.test.tsx +1 -1
- package/reactHooks/connection/__tests__/index.test.js +1 -1
- package/reactHooks/debugging/__tests__/index.test.js +4 -4
- package/reactHooks/dev/__tests__/useReRenderLog.test.ts +188 -0
- package/reactHooks/device/useIsTablet.tsx +14 -19
- package/reactHooks/device/useMemoizedIsTablet.ts +3 -3
- package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +32 -23
- package/reactHooks/feed/__tests__/useBuildPipesUrl.test.tsx +19 -19
- package/reactHooks/feed/__tests__/useEntryScreenId.test.tsx +4 -1
- package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +42 -30
- package/reactHooks/feed/__tests__/useInflatedUrl.test.tsx +1 -1
- package/reactHooks/feed/index.ts +0 -2
- package/reactHooks/feed/useBatchLoading.ts +7 -1
- package/reactHooks/feed/useEntryScreenId.ts +2 -2
- package/reactHooks/feed/usePipesCacheReset.ts +3 -1
- package/reactHooks/flatList/useLoadNextPageIfNeeded.ts +13 -16
- package/reactHooks/layout/__tests__/index.test.tsx +1 -1
- package/reactHooks/layout/__tests__/useLayoutVersion.test.tsx +1 -1
- package/reactHooks/layout/useDimensions/__tests__/{useDimensions.test.ts → useDimensions.test.tsx} +105 -25
- package/reactHooks/layout/useDimensions/useDimensions.ts +2 -2
- package/reactHooks/navigation/__tests__/index.test.tsx +2 -4
- package/reactHooks/navigation/index.ts +7 -6
- package/reactHooks/navigation/useRoute.ts +8 -6
- package/reactHooks/player/TVSeekControlller/TVSeekController.ts +27 -10
- package/reactHooks/player/__tests__/useAutoSeek._test.tsx +1 -1
- package/reactHooks/player/__tests__/useTapSeek._test.ts +1 -1
- package/reactHooks/resolvers/__tests__/useCellResolver.test.tsx +1 -1
- package/reactHooks/resolvers/__tests__/useComponentResolver.test.tsx +1 -1
- package/reactHooks/resolvers/useCellResolver.ts +6 -2
- package/reactHooks/resolvers/useComponentResolver.ts +8 -2
- package/reactHooks/screen/__tests__/useCurrentScreenData.test.tsx +2 -2
- package/reactHooks/screen/__tests__/useIsStandaloneFullscreen.test.ts +114 -0
- package/reactHooks/screen/__tests__/useScreenBackgroundColor.test.tsx +1 -1
- package/reactHooks/screen/__tests__/useScreenData.test.tsx +1 -1
- package/reactHooks/screen/__tests__/useTargetScreenData.test.tsx +12 -4
- package/reactHooks/screen/useTargetScreenData.ts +4 -2
- package/reactHooks/state/useRivers.ts +1 -1
- package/reactHooks/ui/__tests__/useFadeOutWhenBlurred.test.ts +580 -0
- package/reactHooks/usePluginConfiguration.ts +2 -2
- package/reactHooks/utils/__tests__/index.test.js +1 -1
- package/rectUtils/__tests__/index.test.ts +549 -0
- package/rectUtils/index.ts +2 -2
- package/refreshUtils/RefreshCoordinator/__tests__/refreshCoordinator.test.ts +206 -0
- package/refreshUtils/RefreshCoordinator/index.ts +245 -0
- package/refreshUtils/RefreshCoordinator/utils/__tests__/getDataRefreshConfig.test.ts +104 -0
- package/refreshUtils/RefreshCoordinator/utils/index.ts +29 -0
- package/screenPickerUtils/__tests__/index.test.ts +333 -0
- package/screenState/__tests__/index.test.ts +1 -1
- package/screenUtils/index.ts +3 -0
- package/searchUtils/const.ts +7 -0
- package/searchUtils/index.ts +3 -0
- package/stringUtils/index.ts +1 -1
- package/testUtils/index.tsx +30 -21
- package/time/__tests__/BackgroundTimer.test.ts +156 -0
- package/time/__tests__/Timer.test.ts +236 -0
- package/typeGuards/__tests__/isString.test.ts +21 -0
- package/typeGuards/index.ts +4 -0
- package/utils/__tests__/mergeRight.test.ts +48 -0
- package/utils/__tests__/path.test.ts +7 -0
- package/utils/__tests__/selectors.test.ts +124 -0
- package/utils/index.ts +13 -0
- package/utils/mergeRight.ts +5 -0
- package/utils/path.ts +6 -3
- package/utils/pathOr.ts +5 -1
- package/utils/selectors.ts +46 -0
- package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +1 -1
- package/zappFrameworkUtils/HookCallback/hookCallbackManifestExtensions.config.js +1 -1
- package/zappFrameworkUtils/loginPluginUtils.ts +1 -1
- package/reactHooks/componentsMap/index.ts +0 -55
- package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +0 -75
- package/reactHooks/feed/useFeedRefresh.tsx +0 -65
|
@@ -3,7 +3,10 @@ import memoizee from "memoizee";
|
|
|
3
3
|
import * as R from "ramda";
|
|
4
4
|
|
|
5
5
|
import { CellRendererResolver } from "@applicaster/zapp-react-native-ui-components/Components/CellRendererResolver";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
usePlugins,
|
|
8
|
+
useCellStyles,
|
|
9
|
+
} from "@applicaster/zapp-react-native-redux";
|
|
7
10
|
import { useDimensions } from "../layout";
|
|
8
11
|
import { useIsRTL } from "../../localizationUtils";
|
|
9
12
|
|
|
@@ -53,7 +56,8 @@ export function useCellResolver({
|
|
|
53
56
|
updateForInactiveScreens: false,
|
|
54
57
|
});
|
|
55
58
|
|
|
56
|
-
const
|
|
59
|
+
const plugins = usePlugins();
|
|
60
|
+
const cellStyles = useCellStyles();
|
|
57
61
|
const isRTL = useIsRTL();
|
|
58
62
|
|
|
59
63
|
const options = {
|
|
@@ -4,7 +4,11 @@ import * as React from "react";
|
|
|
4
4
|
import { coreLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
5
5
|
|
|
6
6
|
import { findComponentByType } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
selectComponents,
|
|
9
|
+
useAppSelector,
|
|
10
|
+
usePlugins,
|
|
11
|
+
} from "@applicaster/zapp-react-native-redux";
|
|
8
12
|
|
|
9
13
|
type Decorator = (component: React.Component<any>) => React.Component<any>;
|
|
10
14
|
type Watcher = Array<any>;
|
|
@@ -17,7 +21,9 @@ export function useComponentResolver(
|
|
|
17
21
|
{ componentType, decorators }: Props,
|
|
18
22
|
watchers?: Watcher
|
|
19
23
|
): React.ComponentType<any> {
|
|
20
|
-
const
|
|
24
|
+
const plugins = usePlugins();
|
|
25
|
+
|
|
26
|
+
const components = useAppSelector(selectComponents);
|
|
21
27
|
|
|
22
28
|
const component = React.useMemo(
|
|
23
29
|
() =>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Provider } from "react-redux";
|
|
3
|
-
import { renderHook } from "@testing-library/react-
|
|
3
|
+
import { renderHook } from "@testing-library/react-native";
|
|
4
4
|
import configureStore from "redux-mock-store";
|
|
5
|
-
import thunk from "redux-thunk";
|
|
5
|
+
import { thunk } from "redux-thunk";
|
|
6
6
|
|
|
7
7
|
const mockStore = configureStore([thunk]);
|
|
8
8
|
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { renderHook } from "@testing-library/react-native";
|
|
2
|
+
import { useIsStandaloneFullscreen } from "../useIsStandaloneFullscreen";
|
|
3
|
+
|
|
4
|
+
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
5
|
+
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
6
|
+
|
|
7
|
+
jest.mock("@applicaster/zapp-react-native-utils/reactHooks");
|
|
8
|
+
jest.mock("@applicaster/zapp-react-native-utils/booleanUtils");
|
|
9
|
+
|
|
10
|
+
const mockUseNavigation = useNavigation as jest.Mock;
|
|
11
|
+
const mockToBoolean = toBooleanWithDefaultFalse as jest.Mock;
|
|
12
|
+
|
|
13
|
+
describe("useIsStandaloneFullscreen", () => {
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
jest.clearAllMocks();
|
|
16
|
+
|
|
17
|
+
mockUseNavigation.mockReturnValue({
|
|
18
|
+
canGoBack: jest.fn().mockReturnValue(false),
|
|
19
|
+
screenData: {
|
|
20
|
+
general: { allow_screen_plugin_presentation: true },
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
mockToBoolean.mockReturnValue(false);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("returns true when cannot go back and screen plugin presentation is allowed", () => {
|
|
28
|
+
mockToBoolean.mockReturnValue(true);
|
|
29
|
+
|
|
30
|
+
const { result } = renderHook(() => useIsStandaloneFullscreen());
|
|
31
|
+
|
|
32
|
+
expect(mockToBoolean).toHaveBeenCalledWith(true);
|
|
33
|
+
expect(result.current).toBe(true);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("returns false when can go back even if screen plugin presentation is allowed", () => {
|
|
37
|
+
mockUseNavigation.mockReturnValue({
|
|
38
|
+
canGoBack: jest.fn().mockReturnValue(true),
|
|
39
|
+
screenData: {
|
|
40
|
+
general: { allow_screen_plugin_presentation: true },
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
mockToBoolean.mockReturnValue(false);
|
|
45
|
+
|
|
46
|
+
const { result } = renderHook(() => useIsStandaloneFullscreen());
|
|
47
|
+
|
|
48
|
+
expect(mockToBoolean).toHaveBeenCalledWith(false);
|
|
49
|
+
expect(result.current).toBe(false);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("returns false when cannot go back but screen plugin presentation is not allowed", () => {
|
|
53
|
+
mockUseNavigation.mockReturnValue({
|
|
54
|
+
canGoBack: jest.fn().mockReturnValue(false),
|
|
55
|
+
screenData: {
|
|
56
|
+
general: { allow_screen_plugin_presentation: false },
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
mockToBoolean.mockReturnValue(false);
|
|
61
|
+
|
|
62
|
+
const { result } = renderHook(() => useIsStandaloneFullscreen());
|
|
63
|
+
|
|
64
|
+
expect(mockToBoolean).toHaveBeenCalledWith(false);
|
|
65
|
+
expect(result.current).toBe(false);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("returns false when screen plugin presentation flag is undefined", () => {
|
|
69
|
+
mockUseNavigation.mockReturnValue({
|
|
70
|
+
canGoBack: jest.fn().mockReturnValue(false),
|
|
71
|
+
screenData: { general: {} },
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
mockToBoolean.mockReturnValue(false);
|
|
75
|
+
|
|
76
|
+
const { result } = renderHook(() => useIsStandaloneFullscreen());
|
|
77
|
+
|
|
78
|
+
expect(mockToBoolean).toHaveBeenCalledWith(undefined);
|
|
79
|
+
expect(result.current).toBe(false);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("returns false when navigator is undefined", () => {
|
|
83
|
+
mockUseNavigation.mockReturnValue(undefined);
|
|
84
|
+
mockToBoolean.mockReturnValue(false);
|
|
85
|
+
|
|
86
|
+
const { result } = renderHook(() => useIsStandaloneFullscreen());
|
|
87
|
+
|
|
88
|
+
expect(mockToBoolean).toHaveBeenCalledWith(undefined);
|
|
89
|
+
expect(result.current).toBe(false);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("returns false when screenData is undefined", () => {
|
|
93
|
+
mockUseNavigation.mockReturnValue({
|
|
94
|
+
canGoBack: jest.fn().mockReturnValue(false),
|
|
95
|
+
screenData: undefined,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
mockToBoolean.mockReturnValue(false);
|
|
99
|
+
|
|
100
|
+
const { result } = renderHook(() => useIsStandaloneFullscreen());
|
|
101
|
+
|
|
102
|
+
expect(mockToBoolean).toHaveBeenCalledWith(undefined);
|
|
103
|
+
expect(result.current).toBe(false);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("passes the combined condition through toBooleanWithDefaultFalse", () => {
|
|
107
|
+
mockToBoolean.mockImplementation((val) => Boolean(val));
|
|
108
|
+
|
|
109
|
+
const { result } = renderHook(() => useIsStandaloneFullscreen());
|
|
110
|
+
|
|
111
|
+
expect(mockToBoolean).toHaveBeenCalledWith(true);
|
|
112
|
+
expect(result.current).toBe(true);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Provider } from "react-redux";
|
|
3
|
-
import { renderHook } from "@testing-library/react-
|
|
3
|
+
import { renderHook } from "@testing-library/react-native";
|
|
4
4
|
import configureStore from "redux-mock-store";
|
|
5
|
-
import thunk from "redux-thunk";
|
|
5
|
+
import { thunk } from "redux-thunk";
|
|
6
6
|
|
|
7
7
|
const mockStore = configureStore([thunk]);
|
|
8
8
|
|
|
9
9
|
import { useTargetScreenData } from "../useTargetScreenData";
|
|
10
10
|
|
|
11
11
|
describe("useTargetScreenData", function () {
|
|
12
|
-
const river_id_2 = {
|
|
13
|
-
|
|
12
|
+
const river_id_2 = {
|
|
13
|
+
id: "river_id_2",
|
|
14
|
+
type: "any",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const river_id_1 = {
|
|
18
|
+
id: "river_id_1",
|
|
19
|
+
type: "any",
|
|
20
|
+
};
|
|
21
|
+
|
|
14
22
|
const screenId = "river_id_2";
|
|
15
23
|
const entry = { id: "test", type: { value: "video" } };
|
|
16
24
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useContentTypes } from "@applicaster/zapp-react-native-redux/hooks";
|
|
3
3
|
import * as R from "ramda";
|
|
4
4
|
import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
|
|
5
|
+
import { useRivers } from "../state";
|
|
5
6
|
|
|
6
7
|
export function getTargetScreenData(
|
|
7
8
|
entry: ZappEntry,
|
|
@@ -43,7 +44,8 @@ export function getTargetScreenDataFromEntry(entry: ZappEntry): ZappRiver {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
export const useTargetScreenData = (entry: ZappEntry) => {
|
|
46
|
-
const
|
|
47
|
+
const rivers = useRivers();
|
|
48
|
+
const contentTypes = useContentTypes();
|
|
47
49
|
|
|
48
50
|
return React.useMemo(
|
|
49
51
|
() => getTargetScreenData(entry, rivers, contentTypes),
|