@applicaster/zapp-react-native-ui-components 15.0.0-rc.48 → 15.0.0-rc.49

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.
@@ -1,9 +1,14 @@
1
1
  import * as React from "react";
2
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
2
+ import {
3
+ useAppData,
4
+ useContentTypes,
5
+ usePlugins,
6
+ } from "@applicaster/zapp-react-native-redux/hooks";
3
7
  import {
4
8
  useDimensions,
5
9
  useIsTablet as isTablet,
6
10
  useNavigation,
11
+ useRivers,
7
12
  } from "@applicaster/zapp-react-native-utils/reactHooks";
8
13
 
9
14
  import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
@@ -39,12 +44,10 @@ export function HandlePlayable({
39
44
  mode,
40
45
  groupId,
41
46
  }: Props): React.ReactElement | null {
42
- const { plugins, contentTypes, rivers, appData } = usePickFromState([
43
- "plugins",
44
- "contentTypes",
45
- "rivers",
46
- "appData",
47
- ]);
47
+ const plugins = usePlugins();
48
+ const contentTypes = useContentTypes();
49
+ const rivers = useRivers();
50
+ const appData = useAppData();
48
51
 
49
52
  const { closeVideoModal } = useNavigation();
50
53
 
@@ -1,7 +1,10 @@
1
1
  import React from "react";
2
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
3
2
  import { getBackgroundImageUrl } from "../utils";
4
3
  import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
4
+ import {
5
+ selectRemoteConfigurations,
6
+ useAppSelector,
7
+ } from "@applicaster/zapp-react-native-redux";
5
8
 
6
9
  export const LayoutBackground = ({
7
10
  Background,
@@ -12,7 +15,7 @@ export const LayoutBackground = ({
12
15
  }) => {
13
16
  const theme = useTheme();
14
17
 
15
- const { remoteConfigurations } = usePickFromState(["remoteConfigurations"]);
18
+ const remoteConfigurations = useAppSelector(selectRemoteConfigurations);
16
19
 
17
20
  const backgroundColor = theme.app_background_color;
18
21
  const backgroundImageUrl = getBackgroundImageUrl(remoteConfigurations);
@@ -18,7 +18,7 @@ import {
18
18
  routeIsPlayerScreen,
19
19
  } from "@applicaster/zapp-react-native-utils/navigationUtils";
20
20
  import { isApplePlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
21
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
21
+ import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
22
22
  import { NavBarContainer } from "./NavBarContainer";
23
23
 
24
24
  type ComponentsExtraProps = {
@@ -111,11 +111,7 @@ export const ScreenContainer = React.memo(function ScreenContainer({
111
111
  const { activeRiver } = navigator;
112
112
  const { title, visible } = useNavbarState();
113
113
 
114
- const { plugins = [] } = usePickFromState([
115
- "appState",
116
- "remoteConfigurations",
117
- "plugins",
118
- ]);
114
+ const plugins = usePlugins();
119
115
 
120
116
  const navigationProps = getNavigationProps({
121
117
  navigator,
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
2
+ import { useAppSelector } from "@applicaster/zapp-react-native-redux/hooks";
3
3
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
4
4
 
5
5
  import { LayoutContainer } from "./LayoutContainer";
@@ -10,6 +10,7 @@ import { PathnameContext } from "../../../Contexts/PathnameContext";
10
10
  import { ScreenDataContext } from "../../../Contexts/ScreenDataContext";
11
11
  import { ScreenContextProvider } from "../../../Contexts/ScreenContext";
12
12
  import { LayoutBackground } from "./LayoutBackground";
13
+ import { selectAppReady } from "@applicaster/zapp-react-native-redux";
13
14
 
14
15
  type Components = {
15
16
  NavBar: React.ComponentType<any>;
@@ -29,9 +30,7 @@ type Props = {
29
30
  const Layout = ({ Components, ComponentsExtraProps, children }: Props) => {
30
31
  const navigator = useNavigation();
31
32
 
32
- const { appState: { appReady = false } = {} } = usePickFromState([
33
- "appState",
34
- ]);
33
+ const appReady = useAppSelector(selectAppReady);
35
34
 
36
35
  if (!appReady) {
37
36
  return null;
@@ -1,11 +1,11 @@
1
1
  import * as React from "react";
2
- import { pathOr } from "ramda";
3
2
 
4
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
3
+ import { useAppSelector } from "@applicaster/zapp-react-native-redux/hooks";
5
4
 
6
5
  import { ScreenLayoutContextProvider } from "./ScreenLayoutContextProvider";
7
6
  import { StackNavigator } from "../../Navigator";
8
7
  import { LayoutBackground } from "./LayoutBackground";
8
+ import { selectAppReady } from "@applicaster/zapp-react-native-redux";
9
9
 
10
10
  type Components = {
11
11
  NavBar: React.ComponentType<any>;
@@ -17,8 +17,7 @@ type Props = {
17
17
  };
18
18
 
19
19
  const Layout = ({ Components }: Props) => {
20
- const { appState } = usePickFromState(["appState"]);
21
- const appReady = pathOr(false, ["appReady"], appState);
20
+ const appReady = useAppSelector(selectAppReady);
22
21
 
23
22
  if (!appReady) {
24
23
  return null;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import * as R from "ramda";
3
3
 
4
4
  import { findPluginByIdentifier } from "@applicaster/zapp-react-native-utils/pluginUtils";
5
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
5
+ import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
6
6
  import {
7
7
  inflateString,
8
8
  objectToReadableString,
@@ -40,7 +40,7 @@ export async function inflateUrl(url) {
40
40
 
41
41
  export function LinkHandler(props: Props) {
42
42
  const screenData = props?.screenData;
43
- const { plugins } = usePickFromState(["rivers", "plugins"]);
43
+ const plugins = usePlugins();
44
44
 
45
45
  const ScreenPlugin = findPluginByIdentifier(
46
46
  WEBVIEW_SCREEN_IDENTIFIER,
@@ -8,7 +8,7 @@ import {
8
8
  TouchableWithoutFeedback,
9
9
  } from "react-native";
10
10
 
11
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
11
+ import { usePlugins } from "@applicaster/zapp-react-native-redux";
12
12
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
13
13
  import { textTransform } from "@applicaster/zapp-react-native-utils/cellUtils";
14
14
  import { useNotificationHeight } from "../utils";
@@ -46,7 +46,7 @@ export const NotificationView = ({
46
46
  online = true,
47
47
  dismiss,
48
48
  }: Props) => {
49
- const { plugins } = usePickFromState(["plugins"]);
49
+ const plugins = usePlugins();
50
50
  const { statusHeight, notificationHeight } = useNotificationHeight();
51
51
 
52
52
  const offlinePlugin = R.find(
@@ -8,25 +8,24 @@ import {
8
8
  offlinePhrase,
9
9
  } from "../NotificationView";
10
10
 
11
- jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
12
- usePickFromState: () => ({
13
- plugins: [
14
- {
15
- name: "offline experience",
16
- identifier: "offline-experience",
17
- type: "general",
18
- module: {
19
- useOfflineExperienceConfiguration: () => ({
20
- configurationFields: {},
21
- localizations: {
22
- offline_toast_message: "No internet connection",
23
- online_toast_message: "You are back online",
24
- },
25
- }),
26
- },
11
+ jest.mock("@applicaster/zapp-react-native-redux", () => ({
12
+ ...jest.requireActual("@applicaster/zapp-react-native-redux"),
13
+ usePlugins: () => [
14
+ {
15
+ name: "offline experience",
16
+ identifier: "offline-experience",
17
+ type: "general",
18
+ module: {
19
+ useOfflineExperienceConfiguration: () => ({
20
+ configurationFields: {},
21
+ localizations: {
22
+ offline_toast_message: "No internet connection",
23
+ online_toast_message: "You are back online",
24
+ },
25
+ }),
27
26
  },
28
- ],
29
- }),
27
+ },
28
+ ],
30
29
  }));
31
30
 
32
31
  jest.mock("react-native-safe-area-context", () => ({
@@ -8,36 +8,45 @@ const mockPreviousValue = null;
8
8
 
9
9
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/connection", () => {
10
10
  return {
11
+ ...jest.requireActual(
12
+ "@applicaster/zapp-react-native-utils/reactHooks/connection"
13
+ ),
11
14
  useConnectionInfo: jest.fn(() => mockConnectionStatus),
12
15
  };
13
16
  });
14
17
 
15
18
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/utils", () => {
16
19
  return {
20
+ ...jest.requireActual(
21
+ "@applicaster/zapp-react-native-utils/reactHooks/utils"
22
+ ),
17
23
  usePrevious: jest.fn(() => mockPreviousValue),
18
24
  };
19
25
  });
20
26
 
27
+ const mock_storeObj = {
28
+ plugins: [
29
+ {
30
+ name: "offline experience",
31
+ identifier: "offline-experience",
32
+ type: "general",
33
+ module: {
34
+ useOfflineExperienceConfiguration: () => ({
35
+ configurationFields: {},
36
+ localizations: {
37
+ offline_toast_message: "No internet connection",
38
+ online_toast_message: "You are back online",
39
+ },
40
+ }),
41
+ },
42
+ },
43
+ ],
44
+ };
45
+
21
46
  jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
22
47
  ...jest.requireActual("@applicaster/zapp-react-native-redux/hooks"),
23
- usePickFromState: () => ({
24
- plugins: [
25
- {
26
- name: "offline experience",
27
- identifier: "offline-experience",
28
- type: "general",
29
- module: {
30
- useOfflineExperienceConfiguration: () => ({
31
- configurationFields: {},
32
- localizations: {
33
- offline_toast_message: "No internet connection",
34
- online_toast_message: "You are back online",
35
- },
36
- }),
37
- },
38
- },
39
- ],
40
- }),
48
+ usePlugins: () => mock_storeObj.plugins,
49
+ usePickFromState: () => ({}),
41
50
  }));
42
51
 
43
52
  jest.mock("react-native-safe-area-context", () => ({
@@ -17,7 +17,7 @@ import {
17
17
 
18
18
  import { TVEventHandlerComponent } from "@applicaster/zapp-react-native-tvos-ui-components/Components/TVEventHandlerComponent";
19
19
  import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
20
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
20
+
21
21
  import {
22
22
  useBackHandler,
23
23
  useNavigation,
@@ -60,6 +60,7 @@ import {
60
60
  PlayerNativeCommandTypes,
61
61
  PlayerNativeSendCommand,
62
62
  } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerNativeCommand";
63
+ import { useAppData } from "@applicaster/zapp-react-native-redux";
63
64
 
64
65
  type Props = {
65
66
  Player: React.ComponentType<any>;
@@ -238,7 +239,7 @@ const PlayerContainerComponent = (props: Props) => {
238
239
  const [isLoadingNextVideo, setIsLoadingNextVideo] = React.useState(false);
239
240
 
240
241
  const navigator = useNavigation();
241
- const { appData } = usePickFromState(["appData"]);
242
+ const { isTabletPortrait } = useAppData();
242
243
  const prevItemId = usePrevious(item?.id);
243
244
  const screenData = useTargetScreenData(item);
244
245
  const { setVisible: showNavBar } = useSetNavbarState();
@@ -675,7 +676,7 @@ const PlayerContainerComponent = (props: Props) => {
675
676
  fullscreen={mode === VideoModalMode.FULLSCREEN}
676
677
  inline={inline}
677
678
  isModal={isModal}
678
- isTabletPortrait={appData.isTabletPortrait}
679
+ isTabletPortrait={isTabletPortrait}
679
680
  muted={false}
680
681
  playableItem={item}
681
682
  playerEvent={playerEvent}
@@ -9,9 +9,10 @@ import {
9
9
  import {
10
10
  useIsScreenActive,
11
11
  useNavigation,
12
+ useRivers,
12
13
  } from "@applicaster/zapp-react-native-utils/reactHooks";
13
14
  import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
14
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
15
+ import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
15
16
  import {
16
17
  useNavbarState,
17
18
  useScreenBackgroundColor,
@@ -102,7 +103,8 @@ export const Screen = ({ route, Components }: Props) => {
102
103
  }
103
104
 
104
105
  const navigator = useNavigation();
105
- const { plugins = [], rivers = [] } = usePickFromState(["plugins", "rivers"]);
106
+ const plugins = usePlugins();
107
+ const rivers = useRivers();
106
108
 
107
109
  const pathAttributes = getPathAttributes({ pathname: route });
108
110
  const routeState = navigator.getStackForPathname(route);
@@ -1,18 +1,15 @@
1
1
  import * as React from "react";
2
2
  import { View } from "react-native";
3
- import { render } from "@testing-library/react-native";
3
+ import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
4
4
 
5
5
  const Mocked_RouteManager = jest.fn((props) => (
6
6
  <View testID="routeManager" {...props} />
7
7
  ));
8
8
 
9
- const mock_navBarVisibleFlag = true;
10
-
11
- const mockIsNavBarVisible = jest.fn(() => mock_navBarVisibleFlag);
12
-
13
9
  const mockIsOrientationCompatible = jest.fn(() => true);
14
10
 
15
11
  jest.mock("react-native-safe-area-context", () => ({
12
+ ...jest.requireActual("react-native-safe-area-context"),
16
13
  useSafeAreaInsets: () => ({ top: 44 }),
17
14
  }));
18
15
 
@@ -35,12 +32,14 @@ jest.mock(
35
32
  );
36
33
 
37
34
  jest.mock("@applicaster/zapp-react-native-utils/analyticsUtils", () => ({
35
+ ...jest.requireActual("@applicaster/zapp-react-native-utils/analyticsUtils"),
38
36
  useAnalytics: jest.fn(() => ({
39
37
  sendScreenEvent: jest.fn(),
40
38
  })),
41
39
  }));
42
40
 
43
41
  jest.mock("@applicaster/zapp-react-native-utils/theme", () => ({
42
+ ...jest.requireActual("@applicaster/zapp-react-native-utils/theme"),
44
43
  useTheme: jest.fn(() => ({
45
44
  app_background_color: "blue",
46
45
  })),
@@ -77,21 +76,44 @@ jest.mock(
77
76
  })
78
77
  );
79
78
 
80
- jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
81
- isNavBarVisible: mockIsNavBarVisible,
82
- useIsScreenActive: jest.fn().mockReturnValue(true),
83
- useNavigation: jest.fn(() => ({
84
- canGoBack: () => false,
85
- currentRoute: "/river/testId",
86
- activeRiver: { id: "testId" },
87
- screenData: { id: "testId" },
88
- data: { screen: { id: "testId" } },
89
- })),
90
- useRoute: jest.fn(() => ({
91
- pathname: "/river/testId",
92
- screenData: { id: "testId" },
93
- })),
94
- }));
79
+ jest.mock(
80
+ "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation",
81
+ () => ({
82
+ ...jest.requireActual(
83
+ "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation"
84
+ ),
85
+ useNavigation: jest.fn(() => ({
86
+ canGoBack: () => false,
87
+ currentRoute: "/river/testId",
88
+ activeRiver: { id: "testId" },
89
+ screenData: { id: "testId" },
90
+ data: { screen: { id: "testId" } },
91
+ })),
92
+ })
93
+ );
94
+
95
+ jest.mock(
96
+ "@applicaster/zapp-react-native-utils/reactHooks/navigation/useIsScreenActive",
97
+ () => ({
98
+ ...jest.requireActual(
99
+ "@applicaster/zapp-react-native-utils/reactHooks/navigation/useIsScreenActive"
100
+ ),
101
+ useIsScreenActive: jest.fn().mockReturnValue(true),
102
+ })
103
+ );
104
+
105
+ jest.mock(
106
+ "@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute",
107
+ () => ({
108
+ ...jest.requireActual(
109
+ "@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute"
110
+ ),
111
+ useRoute: jest.fn(() => ({
112
+ pathname: "/river/testId",
113
+ screenData: { id: "testId" },
114
+ })),
115
+ })
116
+ );
95
117
 
96
118
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
97
119
  ...jest.requireActual("@applicaster/zapp-react-native-utils/reactHooks"),
@@ -112,26 +134,6 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
112
134
  useIsTablet: jest.fn(() => false),
113
135
  }));
114
136
 
115
- jest.mock("@applicaster/zapp-react-native-redux/hooks", () => {
116
- const View = jest.requireActual("react-native").View;
117
-
118
- return {
119
- ...jest.requireActual("@applicaster/zapp-react-native-redux/hooks"),
120
- usePickFromState: () => ({
121
- plugins: [
122
- {
123
- name: "Offline Plugin",
124
- identifier: "offline-experience",
125
- type: "general",
126
- module: {
127
- OfflineFallbackScreen: ({ children }) => <View>{children}</View>, // eslint-disable-line
128
- },
129
- },
130
- ],
131
- }),
132
- };
133
- });
134
-
135
137
  const {
136
138
  allowedOrientationsForScreen,
137
139
  getOrientation,
@@ -151,6 +153,19 @@ const screenProps = {
151
153
 
152
154
  const { Screen } = require("..");
153
155
 
156
+ const store = {
157
+ plugins: [
158
+ {
159
+ name: "Offline Plugin",
160
+ identifier: "offline-experience",
161
+ type: "general",
162
+ module: {
163
+ OfflineFallbackScreen: ({ children }) => <View>{children}</View>, // eslint-disable-line
164
+ },
165
+ },
166
+ ],
167
+ };
168
+
154
169
  describe("<Screen Component />", () => {
155
170
  beforeEach(() => {
156
171
  allowedOrientationsForScreen.mockClear();
@@ -160,14 +175,22 @@ describe("<Screen Component />", () => {
160
175
 
161
176
  describe("when the navbar should show", () => {
162
177
  it("renders correctly", () => {
163
- const { toJSON } = render(<Screen {...screenProps} />);
178
+ const { toJSON } = renderWithProviders(
179
+ <Screen {...screenProps} />,
180
+ store
181
+ );
182
+
164
183
  expect(toJSON()).toMatchSnapshot();
165
184
  });
166
185
  });
167
186
 
168
187
  describe("when the navbar should be hidden", () => {
169
188
  it("renders correctly", () => {
170
- const { toJSON } = render(<Screen {...screenProps} />);
189
+ const { toJSON } = renderWithProviders(
190
+ <Screen {...screenProps} />,
191
+ store
192
+ );
193
+
171
194
  expect(toJSON()).toMatchSnapshot();
172
195
  });
173
196
  });
@@ -1,67 +1,91 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<Screen Component /> when the navbar should be hidden renders correctly 1`] = `
4
- <View
5
- importantForAccessibility="yes"
4
+ <RNCSafeAreaProvider
5
+ onInsetsChange={[Function]}
6
6
  style={
7
- {
8
- "backgroundColor": "blue",
9
- "flex": 1,
10
- "paddingTop": 0,
11
- }
7
+ [
8
+ {
9
+ "flex": 1,
10
+ },
11
+ undefined,
12
+ ]
12
13
  }
13
14
  >
14
15
  <View
15
- hasMenu={false}
16
- id="/river/testId"
17
- pathname="/river/testId"
18
- selected="testId"
19
- testID="navBar"
20
- title="Test Title"
21
- />
22
- <View>
16
+ importantForAccessibility="yes"
17
+ style={
18
+ {
19
+ "backgroundColor": "blue",
20
+ "flex": 1,
21
+ "paddingTop": 0,
22
+ }
23
+ }
24
+ >
23
25
  <View
26
+ hasMenu={false}
27
+ id="/river/testId"
24
28
  pathname="/river/testId"
25
- screenData={
26
- {
27
- "id": "testId",
28
- }
29
- }
30
- testID="routeManager"
29
+ selected="testId"
30
+ testID="navBar"
31
+ title="Test Title"
31
32
  />
33
+ <View>
34
+ <View
35
+ pathname="/river/testId"
36
+ screenData={
37
+ {
38
+ "id": "testId",
39
+ }
40
+ }
41
+ testID="routeManager"
42
+ />
43
+ </View>
32
44
  </View>
33
- </View>
45
+ </RNCSafeAreaProvider>
34
46
  `;
35
47
 
36
48
  exports[`<Screen Component /> when the navbar should show renders correctly 1`] = `
37
- <View
38
- importantForAccessibility="yes"
49
+ <RNCSafeAreaProvider
50
+ onInsetsChange={[Function]}
39
51
  style={
40
- {
41
- "backgroundColor": "blue",
42
- "flex": 1,
43
- "paddingTop": 0,
44
- }
52
+ [
53
+ {
54
+ "flex": 1,
55
+ },
56
+ undefined,
57
+ ]
45
58
  }
46
59
  >
47
60
  <View
48
- hasMenu={false}
49
- id="/river/testId"
50
- pathname="/river/testId"
51
- selected="testId"
52
- testID="navBar"
53
- title="Test Title"
54
- />
55
- <View>
61
+ importantForAccessibility="yes"
62
+ style={
63
+ {
64
+ "backgroundColor": "blue",
65
+ "flex": 1,
66
+ "paddingTop": 0,
67
+ }
68
+ }
69
+ >
56
70
  <View
71
+ hasMenu={false}
72
+ id="/river/testId"
57
73
  pathname="/river/testId"
58
- screenData={
59
- {
60
- "id": "testId",
61
- }
62
- }
63
- testID="routeManager"
74
+ selected="testId"
75
+ testID="navBar"
76
+ title="Test Title"
64
77
  />
78
+ <View>
79
+ <View
80
+ pathname="/river/testId"
81
+ screenData={
82
+ {
83
+ "id": "testId",
84
+ }
85
+ }
86
+ testID="routeManager"
87
+ />
88
+ </View>
65
89
  </View>
66
- </View>
90
+ </RNCSafeAreaProvider>
67
91
  `;
@@ -1,4 +1,4 @@
1
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
1
+ import { useAppData } from "@applicaster/zapp-react-native-redux/hooks";
2
2
  import {
3
3
  useGetScreenOrientation,
4
4
  isOrientationCompatible,
@@ -25,8 +25,7 @@ export const useWaitForValidOrientation = () => {
25
25
 
26
26
  const isTablet = useIsTablet();
27
27
 
28
- const { appData } = usePickFromState(["appData"]);
29
- const isTabletPortrait = appData?.isTabletPortrait;
28
+ const { isTabletPortrait } = useAppData();
30
29
 
31
30
  const layoutData = useMemo(
32
31
  () => ({ isTablet, isTabletPortrait, width: screenWidth, height }),
@@ -1,8 +1,7 @@
1
1
  /// <reference types="@applicaster/applicaster-types" />
2
2
  import React from "react";
3
3
  import { AccessibilityInfo, findNodeHandle, View } from "react-native";
4
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
5
-
4
+ import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
6
5
  import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
7
6
  import { getComponentModule } from "@applicaster/zapp-react-native-utils/pluginUtils";
8
7
  import {
@@ -41,7 +40,7 @@ type Props = {
41
40
  export function Screen(_props: Props) {
42
41
  const theme = useTheme<BaseThemePropertiesMobile>();
43
42
  const navigation = useNavigation();
44
- const { plugins } = usePickFromState(["plugins"]);
43
+ const plugins = usePlugins();
45
44
 
46
45
  // Gets the data for the current screen configuration
47
46
  const currentScreenData = useCurrentScreenData();
@@ -7,7 +7,7 @@ import {
7
7
  useGetScreenOrientation,
8
8
  } from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
9
9
  import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
10
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
10
+ import { usePlugins, useAppData } from "@applicaster/zapp-react-native-redux";
11
11
  import { findPluginByType } from "@applicaster/zapp-react-native-utils/pluginUtils";
12
12
  import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
13
13
 
@@ -65,8 +65,8 @@ export function useNewOrientationForScreenData({
65
65
  }: OrientationHookArgs) {
66
66
  const isTablet = useIsTablet();
67
67
 
68
- const { appData, plugins } = usePickFromState(["appData", "plugins"]);
69
- const isTabletPortrait = appData?.isTabletPortrait;
68
+ const plugins = usePlugins();
69
+ const { isTabletPortrait } = useAppData();
70
70
  const isLandscapeTablet = isTablet && !isTabletPortrait;
71
71
 
72
72
  const screenOrientation = useGetScreenOrientation(screenData);
@@ -11,12 +11,19 @@ import { LinkHandler } from "../LinkHandler";
11
11
  import { Favorites } from "../Favorites";
12
12
  import { ZappPipesScreenContext } from "../../Contexts";
13
13
  import { componentsLogger } from "../../Helpers/logger";
14
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
15
- import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
14
+ import {
15
+ useAppSelector,
16
+ usePlugins,
17
+ } from "@applicaster/zapp-react-native-redux/hooks";
18
+ import {
19
+ useNavigation,
20
+ useRivers,
21
+ } from "@applicaster/zapp-react-native-utils/reactHooks";
16
22
  import { useScreenAnalytics } from "@applicaster/zapp-react-native-utils/analyticsUtils/helpers/hooks";
17
23
 
18
24
  import { useCallbackActions } from "@applicaster/zapp-react-native-utils/zappFrameworkUtils/HookCallback/useCallbackActions";
19
25
  import { ScreenResultCallback } from "@applicaster/zapp-react-native-utils/zappFrameworkUtils/HookCallback/callbackNavigationAction";
26
+ import { selectComponents } from "@applicaster/zapp-react-native-redux";
20
27
 
21
28
  const logger = componentsLogger.addSubsystem("ScreenResolver");
22
29
 
@@ -49,11 +56,10 @@ export function ScreenResolverComponent(props: Props) {
49
56
 
50
57
  const { hookPlugin } = screenData || {};
51
58
 
52
- const { components, plugins, rivers } = usePickFromState([
53
- "components",
54
- "plugins",
55
- "rivers",
56
- ]);
59
+ const plugins = usePlugins();
60
+ const rivers = useRivers();
61
+
62
+ const components = useAppSelector(selectComponents);
57
63
 
58
64
  const {
59
65
  videoModalState: { mode },
@@ -1,7 +1,8 @@
1
1
  import * as React from "react";
2
2
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
3
3
  import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks/layout";
4
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
4
+ import { useAppData } from "@applicaster/zapp-react-native-redux";
5
+
5
6
  import { TransitionerComponent } from "./Transitioner";
6
7
 
7
8
  export const Transitioner = (props) => {
@@ -16,8 +17,7 @@ export const Transitioner = (props) => {
16
17
  deviceInfo: true,
17
18
  });
18
19
 
19
- const { appData } = usePickFromState(["appData"]);
20
- const isTabletPortrait = appData?.isTabletPortrait;
20
+ const { isTabletPortrait } = useAppData();
21
21
 
22
22
  return (
23
23
  <TransitionerComponent
@@ -4,7 +4,10 @@ import { Animated, Dimensions } from "react-native";
4
4
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
5
5
 
6
6
  import { useConfiguration } from "../utils";
7
- import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
7
+ import {
8
+ useAppData,
9
+ usePlugins,
10
+ } from "@applicaster/zapp-react-native-redux/hooks";
8
11
  import { isBottomTabVisible } from "../../Screen/navigationHandler";
9
12
 
10
13
  import {
@@ -18,7 +21,6 @@ import {
18
21
  import { getTabBarHeight } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/getTabBarHeight";
19
22
  import { PROGRESS_BAR_HEIGHT } from "./utils";
20
23
  import { useIsTablet as getIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
21
- import { useAppSelector } from "@applicaster/zapp-react-native-redux";
22
24
 
23
25
  export type ModalAnimationContextT = {
24
26
  yTranslate: React.MutableRefObject<Animated.AnimatedInterpolation<number>>;
@@ -64,9 +66,7 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
64
66
  screenData,
65
67
  } = useNavigation();
66
68
 
67
- const isTabletPortrait = useAppSelector(
68
- (state) => state.appData.isTabletPortrait
69
- );
69
+ const { isTabletPortrait } = useAppData();
70
70
 
71
71
  const plugins = usePlugins();
72
72
 
@@ -1,32 +1,35 @@
1
1
  import { mergeRight } from "ramda";
2
2
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
3
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
3
+ import {
4
+ useAppSelector,
5
+ useContentTypes,
6
+ } from "@applicaster/zapp-react-native-redux/hooks";
4
7
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
5
8
  import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device/useIsTablet";
6
9
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
7
10
  import { create } from "zustand";
11
+ import { useRivers } from "@applicaster/zapp-react-native-utils/reactHooks";
12
+ import { selectPluginConfigurationsByPluginId } from "@applicaster/zapp-react-native-redux";
8
13
 
9
14
  export const useConfiguration = () => {
10
15
  const {
11
16
  videoModalState: { item },
12
17
  } = useNavigation();
13
18
 
14
- const { rivers, contentTypes, pluginConfigurations } = usePickFromState([
15
- "rivers",
16
- "contentTypes",
17
- "pluginConfigurations",
18
- ]);
19
+ const rivers = useRivers();
20
+ const contentTypes = useContentTypes();
19
21
 
20
22
  const targetScreenId = contentTypes?.[item?.type?.value]?.screen_id;
21
23
  const targetScreenConfiguration = rivers?.[targetScreenId];
22
24
 
23
- const pluginConfiguration =
24
- pluginConfigurations[targetScreenConfiguration?.type]?.configuration_json;
25
+ const { configuration_json } = useAppSelector((state) =>
26
+ selectPluginConfigurationsByPluginId(state, targetScreenConfiguration?.type)
27
+ );
25
28
 
26
29
  const playerPluginConfig = playerManager.getPluginConfiguration();
27
30
 
28
31
  const config = mergeRight(playerPluginConfig, {
29
- ...pluginConfiguration,
32
+ ...configuration_json,
30
33
  ...targetScreenConfiguration?.general,
31
34
  ...targetScreenConfiguration?.styles,
32
35
  });
@@ -1,7 +1,6 @@
1
1
  import React from "react";
2
2
 
3
3
  import { getAnalyticsFunctions } from "@applicaster/zapp-react-native-utils/analyticsUtils";
4
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
5
4
 
6
5
  type ComponentProps = {
7
6
  component: {
@@ -21,11 +20,13 @@ type ComponentProps = {
21
20
 
22
21
  function withAnalytics(Component) {
23
22
  return function WithAnalytics(props: ComponentProps) {
24
- const { appData } = usePickFromState(["appData"]);
25
-
26
23
  const analyticsFunctions = React.useMemo(
27
- () => getAnalyticsFunctions({ props, appData }),
28
- [props, appData]
24
+ () =>
25
+ getAnalyticsFunctions({
26
+ component: props.component,
27
+ zappPipesData: props.zappPipesData,
28
+ } as any),
29
+ [props.component, props.zappPipesData]
29
30
  );
30
31
 
31
32
  return (
@@ -2,7 +2,7 @@
2
2
  /// <reference types="@applicaster/zapp-react-native-ui-components" />
3
3
  import React from "react";
4
4
  import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
5
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
5
+ import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
6
6
  import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
7
7
  import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
8
8
  import { ResolverSelector } from "./ResolverSelector";
@@ -23,7 +23,7 @@ export function zappPipesDataConnector(
23
23
  ) {
24
24
  return function WrappedWithZappPipesData(props: Props) {
25
25
  const { screenData } = useRoute();
26
- const { plugins } = usePickFromState(["plugins"]);
26
+ const plugins = usePlugins();
27
27
  const screenContextData = useScreenContext();
28
28
 
29
29
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "15.0.0-rc.48",
3
+ "version": "15.0.0-rc.49",
4
4
  "description": "Applicaster Zapp React Native ui components for the Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "15.0.0-rc.48",
32
- "@applicaster/zapp-react-native-bridge": "15.0.0-rc.48",
33
- "@applicaster/zapp-react-native-redux": "15.0.0-rc.48",
34
- "@applicaster/zapp-react-native-utils": "15.0.0-rc.48",
31
+ "@applicaster/applicaster-types": "15.0.0-rc.49",
32
+ "@applicaster/zapp-react-native-bridge": "15.0.0-rc.49",
33
+ "@applicaster/zapp-react-native-redux": "15.0.0-rc.49",
34
+ "@applicaster/zapp-react-native-utils": "15.0.0-rc.49",
35
35
  "fast-json-stable-stringify": "^2.1.0",
36
36
  "promise": "^8.3.0",
37
37
  "url": "^0.11.0",