@applicaster/quick-brick-core 15.1.4 → 16.0.0-alpha.1042942411

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 (38) hide show
  1. package/App/ActionSetters/index.ts +5 -4
  2. package/App/ActionsProvider/ActionsProvider.tsx +31 -9
  3. package/App/ActionsProvider/LegacyActionsRegistryAdapter.tsx +107 -0
  4. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/useOpenSchemeHandler.test.tsx +12 -27
  5. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/useUrlSchemeHandler.test.tsx +197 -104
  6. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/useOpenSchemeHandler/index.ts +4 -7
  7. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/useUrlSchemeHandler.ts +42 -30
  8. package/App/DeepLinking/URLSchemeHandler/URLSchemeHandler.tsx +4 -1
  9. package/App/DeepLinking/URLSchemeHandler/__tests__/URLSchemeHandler.test.tsx +20 -13
  10. package/App/DeepLinking/URLSchemeListener/index.tsx +3 -4
  11. package/App/ErrorBoundary/__tests__/store.test.js +1 -1
  12. package/App/ModalProvider/ModalBottomSheet/DraggableBottomSheet/__tests__/index.test.tsx +88 -0
  13. package/App/ModalProvider/ModalBottomSheet/DraggableBottomSheet/index.tsx +30 -56
  14. package/App/NavigationProvider/Loader.tsx +3 -4
  15. package/App/NavigationProvider/NavigationProvider.tsx +22 -35
  16. package/App/NavigationProvider/ScreenHooks/usePluginScreenHooks.ts +2 -2
  17. package/App/NavigationProvider/__tests__/navigationProvider.test.tsx +193 -152
  18. package/App/NavigationProvider/navigator/selectors.ts +21 -5
  19. package/App/NetworkStatusProvider/NetworkStatusProvider.tsx +2 -2
  20. package/App/NetworkStatusProvider/__tests__/NetworkStatusProvider.test.tsx +4 -4
  21. package/App/NotificationToastRenderer/NotificationToastManager.ts +203 -0
  22. package/App/NotificationToastRenderer/NotificationToastRenderer.tsx +102 -0
  23. package/App/NotificationToastRenderer/NotificationToastRenderer.web.tsx +61 -0
  24. package/App/NotificationToastRenderer/__tests__/NotificationToastManager.test.ts +213 -0
  25. package/App/NotificationToastRenderer/__tests__/NotificationToastRenderer.test.tsx +85 -0
  26. package/App/NotificationToastRenderer/__tests__/NotificationToastRenderer.web.test.tsx +90 -0
  27. package/App/NotificationToastRenderer/__tests__/useNotificationHeight.test.tsx +53 -0
  28. package/App/NotificationToastRenderer/__tests__/useNotificationToastState.test.ts +112 -0
  29. package/App/NotificationToastRenderer/index.tsx +5 -0
  30. package/App/NotificationToastRenderer/useNotificationHeight.tsx +14 -0
  31. package/App/NotificationToastRenderer/useNotificationToastState.tsx +12 -0
  32. package/App/__tests__/createQuickBrickApp.test.js +1 -1
  33. package/App/appRemoteDataLoader/index.tsx +2 -2
  34. package/App/index.tsx +8 -5
  35. package/App/remoteContextReloader/getRemoteContextData/getNativeRemoteContextData.ts +1 -1
  36. package/App/remoteContextReloader/helpers.ts +3 -3
  37. package/package.json +8 -8
  38. package/App/DeepLinking/URLSchemeHandler/__tests__/__snapshots__/URLSchemeHandler.test.tsx.snap +0 -24
@@ -1,55 +1,59 @@
1
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
2
1
  import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
3
- import * as R from "ramda";
2
+ import {
3
+ selectUrlSchemePlugins,
4
+ useAppSelector,
5
+ } from "@applicaster/zapp-react-native-redux";
4
6
 
5
7
  import { schemeHandlerHooks } from ".";
6
8
  import { parseUrl } from "../../helpers";
7
-
8
9
  import { log_warning } from "../../logger";
10
+ import { getPluginModuleUrlScheme } from "@applicaster/zapp-react-native-utils/pluginUtils";
9
11
 
10
12
  type useUrlSchemeHandlerArgs = {
11
13
  url: string;
12
14
  onFinish: (callback: (done: () => void) => void) => void;
13
15
  };
14
16
 
15
- function resolveSchemeHandler(host, plugins) {
17
+ function resolveSchemeHandler(
18
+ host: string,
19
+ eligiblePlugins: QuickBrickPlugin[]
20
+ ) {
21
+ // First check built-in scheme handlers
16
22
  if (schemeHandlerHooks?.[host]) return schemeHandlerHooks?.[host];
17
23
 
18
- const elligiblePlugins = R.filter(
19
- R.hasPath(["module", "urlScheme"]),
20
- plugins
21
- );
22
-
23
- if (elligiblePlugins?.length > 0) {
24
- const match = R.compose(
25
- R.prop("handler"),
26
- R.head,
27
- R.filter(R.propEq("host", host)),
28
- R.map(R.path(["module", "urlScheme"]))
29
- )(elligiblePlugins);
24
+ if (eligiblePlugins?.length > 0) {
25
+ // Find the first plugin with matching host
26
+ const matchingPlugin = eligiblePlugins.find(
27
+ (plugin) => getPluginModuleUrlScheme(plugin)?.host === host
28
+ );
30
29
 
31
- return match;
30
+ return getPluginModuleUrlScheme(matchingPlugin)?.handler || null;
32
31
  }
33
- }
34
32
 
35
- const skipSchemeHandle = ({ url }) => {
36
- throw new Error(
37
- `Non of the installed plugins knows how to handle this urlScheme ${url}`
38
- );
39
- };
33
+ return null;
34
+ }
40
35
 
41
36
  export function useUrlSchemeHandler({
42
37
  url,
43
38
  onFinish,
44
39
  }: useUrlSchemeHandlerArgs) {
45
40
  const { host, query } = parseUrl(url);
46
- const { plugins } = usePickFromState(["plugins"]);
41
+ const pluginsWithUrlScheme = useAppSelector(selectUrlSchemePlugins) || [];
47
42
 
48
- const useSchemeHandler =
49
- resolveSchemeHandler(host, plugins) || skipSchemeHandle;
43
+ const schemeHandler = resolveSchemeHandler(host, pluginsWithUrlScheme);
50
44
 
51
45
  try {
52
- useSchemeHandler({ query, url, onFinish });
46
+ if (schemeHandler) {
47
+ schemeHandler({ query, url, onFinish });
48
+ } else {
49
+ onFinish((done) => {
50
+ log_warning(
51
+ `unable to resolve ${url}: No handler found for scheme ${host}`
52
+ );
53
+
54
+ done?.();
55
+ });
56
+ }
53
57
  } catch (e) {
54
58
  onFinish((done) => {
55
59
  log_warning(`unable to resolve ${url}: ${e.message}`);
@@ -58,11 +62,19 @@ export function useUrlSchemeHandler({
58
62
  }
59
63
  }
60
64
 
61
- export function handleActionSchemeUrl({ url }) {
65
+ export function handleActionSchemeUrl({
66
+ url,
67
+ availablePlugins = appStore.get("plugins"),
68
+ }) {
62
69
  const { host, query } = parseUrl(url);
63
- const plugins = appStore.get("plugins");
64
70
 
65
- const actionScheme = resolveSchemeHandler(host, plugins) || skipSchemeHandle;
71
+ const actionScheme = resolveSchemeHandler(host, availablePlugins);
72
+
73
+ if (!actionScheme) {
74
+ throw new Error(
75
+ `Non of the installed plugins knows how to handle this urlScheme ${url}`
76
+ );
77
+ }
66
78
 
67
79
  actionScheme({ query, url });
68
80
  }
@@ -30,7 +30,10 @@ export function URLSchemeHandler({ url, onFinish }: Props) {
30
30
  useUrlSchemeHandler({ url, onFinish });
31
31
 
32
32
  return (
33
- <View style={[viewStyles.container, { width, height, backgroundColor }]}>
33
+ <View
34
+ testID="URLSchemeHandler"
35
+ style={[viewStyles.container, { width, height, backgroundColor }]}
36
+ >
34
37
  <Spinner size="large" />
35
38
  </View>
36
39
  );
@@ -1,5 +1,7 @@
1
1
  import React from "react";
2
- import { cleanup, render, waitFor } from "@testing-library/react-native";
2
+ import { StyleSheet } from "react-native";
3
+ import { cleanup } from "@testing-library/react-native";
4
+ import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
3
5
 
4
6
  const theme = {
5
7
  screen_margin_top: 0,
@@ -10,14 +12,6 @@ jest.mock(
10
12
  "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation"
11
13
  );
12
14
 
13
- jest.mock("@applicaster/zapp-react-native-utils/theme", () => ({
14
- useTheme: jest.fn(() => theme),
15
- }));
16
-
17
- jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
18
- usePickFromState: jest.fn(() => ({})),
19
- }));
20
-
21
15
  const { URLSchemeHandler } = require("../URLSchemeHandler");
22
16
  const schemeHooks = require("../SchemeHandlerHooks/useUrlSchemeHandler");
23
17
 
@@ -36,12 +30,25 @@ describe("URLSchemeHandler", () => {
36
30
 
37
31
  afterEach(cleanup);
38
32
 
39
- it("renders correctly and invokes the hook", async () => {
40
- const wrapper = await waitFor(() =>
41
- render(<URLSchemeHandler url={url} onFinish={onFinish} />)
33
+ it("renders correctly and invokes the hook", () => {
34
+ const wrapper = renderWithProviders(
35
+ <URLSchemeHandler url={url} onFinish={onFinish} />,
36
+ {},
37
+ theme
42
38
  );
43
39
 
44
- expect(wrapper.toJSON()).toMatchSnapshot();
40
+ expect(wrapper.getByTestId("URLSchemeHandler")).toBeTruthy();
41
+
42
+ expect(
43
+ StyleSheet.flatten(wrapper.getByTestId("URLSchemeHandler").props.style)
44
+ ).toMatchObject({
45
+ alignItems: "center",
46
+ backgroundColor: "white",
47
+ flex: 1,
48
+ height: 1334,
49
+ justifyContent: "center",
50
+ width: 750,
51
+ });
45
52
 
46
53
  expect(hookSpy).toHaveBeenCalledWith(
47
54
  expect.objectContaining({ url, onFinish })
@@ -3,16 +3,15 @@ import React, { useCallback, useContext } from "react";
3
3
  import { URLSchemeHandler } from "../URLSchemeHandler";
4
4
  import { URLSchemeContext } from "./URLSchemeContextProvider";
5
5
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
6
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
6
+ import { useAppSelector } from "@applicaster/zapp-react-native-redux/hooks";
7
+ import { selectAppReady } from "@applicaster/zapp-react-native-redux";
7
8
 
8
9
  export function URLSchemeListener({ children }: { children: React.ReactNode }) {
9
10
  const { url, done } = useContext(URLSchemeContext);
10
11
 
11
12
  const navigator = useNavigation();
12
13
 
13
- const { appState } = usePickFromState(["appState"]);
14
-
15
- const appReady = appState?.appReady;
14
+ const appReady = useAppSelector(selectAppReady);
16
15
 
17
16
  const onFinish = useCallback(
18
17
  (callback) => {
@@ -1,4 +1,4 @@
1
- import { act, renderHook } from "@testing-library/react-hooks";
1
+ import { act, renderHook } from "@testing-library/react-native";
2
2
  import { useErrorStore } from "../store";
3
3
 
4
4
  describe("Error Store", () => {
@@ -0,0 +1,88 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import { render } from "@testing-library/react-native";
4
+ import { State } from "react-native-gesture-handler";
5
+ import { DraggableBottomSheet } from "../index";
6
+
7
+ // Render the gesture handlers as passthrough Views so we can mount the sheet
8
+ // and drive its release handler directly. State stays real (we need ACTIVE).
9
+ jest.mock("react-native-gesture-handler", () => {
10
+ const RN = require("react-native");
11
+ const ReactActual = require("react");
12
+ const actual = jest.requireActual("react-native-gesture-handler");
13
+
14
+ const Passthrough = ReactActual.forwardRef(({ children }: any, _ref: any) => (
15
+ <RN.View>{children}</RN.View>
16
+ ));
17
+
18
+ return {
19
+ __esModule: true,
20
+ ...actual,
21
+ PanGestureHandler: Passthrough,
22
+ TapGestureHandler: Passthrough,
23
+ };
24
+ });
25
+
26
+ // height 800, sheetHeight 400, no header:
27
+ // SnapPoints.top = 800 - 400 = 400 (lastSnap after mount)
28
+ // SnapPoints.threshold = max(800 - 400 / 2, 100) = 600
29
+ // Release dismisses when lastSnap + translationY + 0.05 * velocityY > 600,
30
+ // i.e. once the drag+toss pushes past 200px.
31
+ const mountSheet = () => {
32
+ const dismiss = jest.fn();
33
+ const ref = React.createRef<DraggableBottomSheet>();
34
+
35
+ render(
36
+ <DraggableBottomSheet
37
+ ref={ref}
38
+ header={() => null}
39
+ dismiss={dismiss}
40
+ visible={true}
41
+ sheetHeight={400}
42
+ width={320}
43
+ height={800}
44
+ hasHeader={false}
45
+ maxWidth={320}
46
+ >
47
+ <View testID="child" />
48
+ </DraggableBottomSheet>
49
+ );
50
+
51
+ return { instance: ref.current as DraggableBottomSheet, dismiss };
52
+ };
53
+
54
+ const release = (
55
+ instance: DraggableBottomSheet,
56
+ translationY: number,
57
+ velocityY = 0
58
+ ) =>
59
+ instance._onHandlerStateChange({
60
+ nativeEvent: { oldState: State.ACTIVE, translationY, velocityY },
61
+ });
62
+
63
+ describe("DraggableBottomSheet release", () => {
64
+ // Mounting an open sheet schedules a deferred animateIn via setTimeout. Keep
65
+ // it on fake timers so it never fires into a torn-down Jest environment.
66
+ beforeEach(() => jest.useFakeTimers());
67
+
68
+ afterEach(() => {
69
+ jest.clearAllTimers();
70
+ jest.useRealTimers();
71
+ });
72
+
73
+ it("dismisses when the release lands past the threshold", () => {
74
+ const { instance, dismiss } = mountSheet();
75
+
76
+ release(instance, 300);
77
+
78
+ expect(dismiss).toHaveBeenCalledTimes(1);
79
+ });
80
+
81
+ it("springs back (does not dismiss) when the release is below the threshold", () => {
82
+ const { instance, dismiss } = mountSheet();
83
+
84
+ release(instance, 50);
85
+
86
+ expect(dismiss).not.toHaveBeenCalled();
87
+ });
88
+ });
@@ -1,15 +1,24 @@
1
- import React, { Component, ReactChild, ReactElement } from "react";
1
+ import React, { Component, ReactElement } from "react";
2
2
  import { Animated, StyleSheet, View, Easing } from "react-native";
3
3
  import {
4
4
  PanGestureHandler,
5
- NativeViewGestureHandler,
6
5
  State,
7
6
  TapGestureHandler,
8
7
  } from "react-native-gesture-handler";
9
8
 
10
9
  import { SnapPoints } from "./SnapPoints";
11
-
12
- const USE_NATIVE_DRIVER = true;
10
+ import {
11
+ BottomSheetContext,
12
+ BottomSheetContextValue,
13
+ } from "@applicaster/zapp-react-native-utils/bottomSheet";
14
+
15
+ // Must stay false: the sheet drives _dragY from old-API PanGestureHandler
16
+ // onGestureEvent props via RN Animated.event. This RNGH version cannot attach
17
+ // a native (useNativeDriver: true) Animated.event to those handlers — it leaks
18
+ // the AnimatedEvent object into the JS event path and throws "Expected
19
+ // onGestureHandlerEvent listener to be a function". Native-threaded dragging
20
+ // needs the full reanimated + Gesture-API migration (tracked separately).
21
+ const USE_NATIVE_DRIVER = false;
13
22
  const HEADER_HEIGHT = 44;
14
23
 
15
24
  const ANIMATION_DURATION = 400;
@@ -24,7 +33,7 @@ const styles = StyleSheet.create({
24
33
  });
25
34
 
26
35
  type Props = {
27
- children: ReactChild;
36
+ children: ReactElement;
28
37
  header: (boolean) => ReactElement;
29
38
  dismiss: () => void;
30
39
  visible: boolean;
@@ -49,35 +58,24 @@ export class DraggableBottomSheet extends Component<Props, ComponentState> {
49
58
  _isMounted = false;
50
59
  _animatedIn = false;
51
60
  _animating = false;
52
- _lastScrollYValue: number;
53
- _lastScrollY: Animated.Value;
54
61
  _dragY: Animated.Value;
55
- _reverseLastScrollY: Animated.AnimatedInterpolation<number>;
56
62
  _translateYOffset: Animated.Value;
57
63
  _translateY: Animated.AnimatedInterpolation<number>;
58
64
  _snapPoints: SnapPoints;
59
65
  _prevContentHeight = 0;
66
+ _bottomSheetContextValue: BottomSheetContextValue;
60
67
 
61
68
  _callWhenMounted: () => void | null;
62
69
 
63
- _onRegisterLastScroll: (...args: any[]) => void;
70
+ // One shared JS Animated.event feeds _dragY for every drag handler (top
71
+ // handle, header drag-area, body). Safe because useNativeDriver is false — the
72
+ // event is a plain JS listener that setValue's _dragY for whichever handler
73
+ // is active, and only one gesture is ever active at a time.
64
74
  _onGestureEvent: (...args: any[]) => void;
65
75
 
66
76
  constructor(props) {
67
77
  super(props);
68
78
 
69
- this._lastScrollYValue = 0;
70
- this._lastScrollY = new Animated.Value(0);
71
-
72
- this._onRegisterLastScroll = Animated.event(
73
- [{ nativeEvent: { contentOffset: { y: this._lastScrollY } } }],
74
- { useNativeDriver: USE_NATIVE_DRIVER }
75
- );
76
-
77
- this._lastScrollY.addListener(({ value }) => {
78
- this._lastScrollYValue = value;
79
- });
80
-
81
79
  this._dragY = new Animated.Value(0);
82
80
 
83
81
  this._onGestureEvent = Animated.event(
@@ -85,10 +83,11 @@ export class DraggableBottomSheet extends Component<Props, ComponentState> {
85
83
  { useNativeDriver: USE_NATIVE_DRIVER }
86
84
  );
87
85
 
88
- this._reverseLastScrollY = Animated.multiply(
89
- new Animated.Value(-1),
90
- this._lastScrollY
91
- );
86
+ this._bottomSheetContextValue = {
87
+ masterDrawerRef: this.masterdrawer,
88
+ onDragGestureEvent: this._onGestureEvent,
89
+ onDragStateChange: this._onHeaderHandlerStateChange,
90
+ };
92
91
 
93
92
  const initialSnapPoints = new SnapPoints(props.height, props.sheetHeight);
94
93
 
@@ -181,7 +180,7 @@ export class DraggableBottomSheet extends Component<Props, ComponentState> {
181
180
 
182
181
  this._translateY = Animated.add(
183
182
  this._translateYOffset,
184
- Animated.add(this._dragY, this._reverseLastScrollY)
183
+ this._dragY
185
184
  ).interpolate({
186
185
  inputRange: [this._snapPoints.top, this._snapPoints.bottom],
187
186
  outputRange: [this._snapPoints.top, this._snapPoints.bottom],
@@ -226,10 +225,6 @@ export class DraggableBottomSheet extends Component<Props, ComponentState> {
226
225
  return;
227
226
  }
228
227
 
229
- if (nativeEvent.oldState === State.BEGAN) {
230
- this._lastScrollY.setValue(0);
231
- }
232
-
233
228
  this._onHandlerStateChange({ nativeEvent });
234
229
  };
235
230
 
@@ -240,8 +235,7 @@ export class DraggableBottomSheet extends Component<Props, ComponentState> {
240
235
 
241
236
  if (nativeEvent.oldState === State.ACTIVE) {
242
237
  const { velocityY } = nativeEvent;
243
- let { translationY } = nativeEvent;
244
- translationY -= this._lastScrollYValue;
238
+ const { translationY } = nativeEvent;
245
239
  const dragToss = 0.05;
246
240
 
247
241
  const endOffsetY =
@@ -300,7 +294,7 @@ export class DraggableBottomSheet extends Component<Props, ComponentState> {
300
294
  >
301
295
  <PanGestureHandler
302
296
  ref={this.drawerheader}
303
- simultaneousHandlers={[this.scroll, this.masterdrawer]}
297
+ simultaneousHandlers={[this.masterdrawer]}
304
298
  shouldCancelWhenOutside={false}
305
299
  onGestureEvent={this._onGestureEvent}
306
300
  onHandlerStateChange={this._onHeaderHandlerStateChange}
@@ -309,31 +303,11 @@ export class DraggableBottomSheet extends Component<Props, ComponentState> {
309
303
  {this.props?.header(this.state.dragging)}
310
304
  </Animated.View>
311
305
  </PanGestureHandler>
312
- <PanGestureHandler
313
- ref={this.drawer}
314
- simultaneousHandlers={[this.scroll, this.masterdrawer]}
315
- shouldCancelWhenOutside={false}
316
- onGestureEvent={this._onGestureEvent}
317
- onHandlerStateChange={this._onHandlerStateChange}
318
- >
306
+ <BottomSheetContext.Provider value={this._bottomSheetContextValue}>
319
307
  <Animated.View style={styles.container}>
320
- <NativeViewGestureHandler
321
- ref={this.scroll}
322
- waitFor={this.masterdrawer}
323
- simultaneousHandlers={this.drawer}
324
- >
325
- <Animated.ScrollView
326
- bounces={false}
327
- onScrollBeginDrag={this._onRegisterLastScroll}
328
- scrollEventThrottle={1}
329
- scrollEnabled={false}
330
- showsVerticalScrollIndicator={false}
331
- >
332
- {this.props.children}
333
- </Animated.ScrollView>
334
- </NativeViewGestureHandler>
308
+ {this.props.children}
335
309
  </Animated.View>
336
- </PanGestureHandler>
310
+ </BottomSheetContext.Provider>
337
311
  </Animated.View>
338
312
  </View>
339
313
  </TapGestureHandler>
@@ -2,8 +2,9 @@ import React from "react";
2
2
  import { View, StyleSheet } from "react-native";
3
3
 
4
4
  import { Spinner } from "@applicaster/zapp-react-native-ui-components/Components/Spinner";
5
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
5
+ import { useAppSelector } from "@applicaster/zapp-react-native-redux/hooks";
6
6
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
7
+ import { selectAppLaunched } from "@applicaster/zapp-react-native-redux";
7
8
 
8
9
  type Props = {
9
10
  children: React.ReactChild;
@@ -21,9 +22,7 @@ const styles = StyleSheet.create({
21
22
  });
22
23
 
23
24
  export function Loader({ children }: Props) {
24
- const {
25
- appState: { appLaunched },
26
- } = usePickFromState(["appState"]);
25
+ const appLaunched = useAppSelector(selectAppLaunched);
27
26
 
28
27
  const { currentRoute } = useNavigation();
29
28
 
@@ -13,10 +13,6 @@ import {
13
13
  useGetScreenOrientation,
14
14
  } from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
15
15
  import { focusManager } from "@applicaster/zapp-react-native-utils/focusManager/FocusManager";
16
- import {
17
- useContentTypes,
18
- usePickFromState,
19
- } from "@applicaster/zapp-react-native-redux/hooks";
20
16
 
21
17
  import reducer, {
22
18
  ACTIONS,
@@ -44,6 +40,7 @@ import {
44
40
  activeRiverSelector,
45
41
  homeRiverSelector,
46
42
  lastEntrySelector,
43
+ startUpHookPluginIdentifiersSelector,
47
44
  } from "./navigator/selectors";
48
45
 
49
46
  import { coreAppLogger } from "../logger";
@@ -79,6 +76,16 @@ import { Hook } from "@applicaster/zapp-react-native-utils/appUtils/HooksManager
79
76
  import { URLSchemeContext } from "../DeepLinking/URLSchemeListener/URLSchemeContextProvider";
80
77
 
81
78
  import { loadingOverlayManager } from "../LoadingOverlay";
79
+ import {
80
+ selectAppLaunched,
81
+ useAppSelector,
82
+ useContentTypes,
83
+ usePlugins,
84
+ } from "@applicaster/zapp-react-native-redux";
85
+ import {
86
+ useLayoutVersion,
87
+ useRivers,
88
+ } from "@applicaster/zapp-react-native-utils/reactHooks";
82
89
 
83
90
  const logger = coreAppLogger.addSubsystem("Navigator");
84
91
 
@@ -100,22 +107,11 @@ const platform = getPlatform();
100
107
  export function NavigationProvider({ children }: Props) {
101
108
  const { url: deepLinkURL } = React.useContext(URLSchemeContext);
102
109
 
103
- const {
104
- appData: { layoutVersion },
105
- rivers,
106
- plugins,
107
- pluginConfigurations,
108
- appState: { appLaunched },
109
- } = usePickFromState([
110
- "appData",
111
- "rivers",
112
- "plugins",
113
- "pluginConfigurations",
114
- "appState",
115
- "contentTypes",
116
- ]);
117
-
110
+ const appLaunched = useAppSelector(selectAppLaunched);
111
+ const layoutVersion = useLayoutVersion();
112
+ const rivers = useRivers();
118
113
  const contentTypes = useContentTypes();
114
+ const plugins = usePlugins();
119
115
 
120
116
  const [state, dispatch] = React.useReducer<
121
117
  NavigationReducer,
@@ -227,6 +223,7 @@ export function NavigationProvider({ children }: Props) {
227
223
  };
228
224
 
229
225
  const isVideoModalDocked = () =>
226
+ state?.options.videoModal.visible &&
230
227
  state?.options.videoModal.mode === "MINIMIZED";
231
228
 
232
229
  // TODO: Remove as it's using a concept of "current" route.
@@ -485,21 +482,11 @@ export function NavigationProvider({ children }: Props) {
485
482
  openLoadingOverlay();
486
483
  };
487
484
 
488
- const checkStartUpHooks = React.useMemo(() => {
489
- if (!pluginConfigurations) return false;
490
-
491
- const startUpHooksIdentifiers = R.compose(
492
- R.map((item) => item.plugin.identifier),
493
- R.filter(
494
- R.allPass([
495
- R.pathEq(["plugin", "api", "require_startup_execution"], true),
496
- R.pathEq(["plugin", "react_native"], true),
497
- R.pathEq(["plugin", "preload"], true),
498
- ])
499
- ),
500
- R.values
501
- )(pluginConfigurations);
485
+ const startUpHooksIdentifiers = useAppSelector(
486
+ startUpHookPluginIdentifiersSelector
487
+ );
502
488
 
489
+ const checkStartUpHooks = React.useMemo(() => {
503
490
  if (startUpHooksIdentifiers?.length) {
504
491
  const startUpHooks = R.filter(
505
492
  (plugin) => R.includes(plugin.identifier, startUpHooksIdentifiers),
@@ -531,7 +518,7 @@ export function NavigationProvider({ children }: Props) {
531
518
  }
532
519
 
533
520
  return false;
534
- }, [pluginConfigurations, plugins, rivers]);
521
+ }, [startUpHooksIdentifiers, plugins, rivers]);
535
522
 
536
523
  const [startUpHooks, _setStartUpHooks] = React.useState(checkStartUpHooks);
537
524
  const currentStartUpHooks = React.useRef(checkStartUpHooks);
@@ -734,7 +721,7 @@ export function NavigationProvider({ children }: Props) {
734
721
  activeRiver,
735
722
  getPathname: () => pathnameRef.current, // hack use to fix issue causing broken navigation as currentRoute is unreliable
736
723
  currentRoute: pathname, // TODO: remove. Current route shouldn't be needed
737
- previousAction: lastEntrySelector(state)
724
+ previousAction: (lastEntrySelector(state) as any)
738
725
  ?.action as QuickBrickNavigationActionType,
739
726
  push: pushItem,
740
727
  replace: replaceItem,
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import * as R from "ramda";
3
3
 
4
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
4
+ import { usePlugins } from "@applicaster/zapp-react-native-redux";
5
5
 
6
6
  enum ReactHooks {
7
7
  useEffect = "useEffect",
@@ -39,7 +39,7 @@ function invokeScreenHook(hooksWrappers) {
39
39
  }
40
40
 
41
41
  export function usePluginScreenHooks(pathname: string) {
42
- const { plugins } = usePickFromState(["plugins"]);
42
+ const plugins = usePlugins();
43
43
 
44
44
  const hooks = React.useMemo(
45
45
  () => R.filter(hasScreenHook, plugins) || [],