@applicaster/zapp-react-native-ui-components 15.0.0-alpha.8680244503 → 15.0.0-alpha.9102699023

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 (53) hide show
  1. package/Components/BaseFocusable/index.ios.ts +12 -2
  2. package/Components/Cell/Cell.tsx +6 -0
  3. package/Components/Cell/CellWithFocusable.tsx +9 -0
  4. package/Components/Cell/FocusableWrapper.tsx +3 -0
  5. package/Components/Cell/TvOSCellComponent.tsx +5 -0
  6. package/Components/Focusable/Focusable.tsx +4 -2
  7. package/Components/Focusable/FocusableTvOS.tsx +18 -1
  8. package/Components/Focusable/__tests__/__snapshots__/FocusableTvOS.test.tsx.snap +1 -0
  9. package/Components/FocusableGroup/FocusableTvOS.tsx +32 -1
  10. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +1 -1
  11. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +22 -6
  12. package/Components/HandlePlayable/utils.ts +31 -0
  13. package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +40 -39
  14. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/Image.test.tsx +95 -0
  15. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +86 -0
  16. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/index.test.ts +141 -0
  17. package/Components/MasterCell/DefaultComponents/SecondaryImage/hooks/__tests__/useGetImageDimensions.test.ts +7 -6
  18. package/Components/MasterCell/DefaultComponents/SecondaryImage/index.ts +1 -1
  19. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -2
  20. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/__tests__/getPluginIdentifier.test.ts +233 -11
  21. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/index.ts +19 -15
  22. package/Components/MasterCell/hoc/__tests__/withAsyncRender.test.tsx +219 -0
  23. package/Components/MasterCell/hoc/withAsyncRender.tsx +9 -7
  24. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +17 -9
  25. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +16 -8
  26. package/Components/OfflineHandler/NotificationView/utils.ts +34 -0
  27. package/Components/PlayerContainer/PlayerContainer.tsx +47 -38
  28. package/Components/PlayerContainer/useRestrictMobilePlayback.tsx +131 -0
  29. package/Components/River/ComponentsMap/ComponentsMap.tsx +16 -0
  30. package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +1 -1
  31. package/Components/River/TV/River.tsx +31 -14
  32. package/Components/River/TV/index.tsx +8 -4
  33. package/Components/River/TV/utils/__tests__/toStringOrEmpty.test.ts +30 -0
  34. package/Components/River/TV/utils/index.ts +4 -0
  35. package/Components/River/TV/withFocusableGroupForContent.tsx +71 -0
  36. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
  37. package/Components/River/__tests__/componentsMap.test.js +38 -0
  38. package/Components/Screen/orientationHandler.ts +7 -10
  39. package/Components/Tabs/TabContent.tsx +7 -4
  40. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +15 -7
  41. package/Components/Viewport/ViewportAware/index.tsx +16 -7
  42. package/Components/Viewport/ViewportEvents/__tests__/viewportEvents.test.js +1 -1
  43. package/Contexts/ScreenContext/index.tsx +25 -18
  44. package/Contexts/ScreenTrackedViewPositionsContext/__tests__/index.test.tsx +1 -1
  45. package/Contexts/ZappHookModalContext/index.tsx +37 -61
  46. package/Contexts/index.ts +0 -2
  47. package/Decorators/ConfigurationWrapper/__tests__/__snapshots__/withConfigurationProvider.test.tsx.snap +1 -0
  48. package/Decorators/ConfigurationWrapper/const.ts +1 -0
  49. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +1 -1
  50. package/events/index.ts +3 -0
  51. package/events/scrollEndReached.ts +15 -0
  52. package/package.json +5 -5
  53. package/Components/River/TV/withTVEventHandler.tsx +0 -27
@@ -1,4 +1,4 @@
1
- import React, { useCallback } from "react";
1
+ import { create } from "zustand";
2
2
 
3
3
  type HookModalState = {
4
4
  path: string;
@@ -10,11 +10,12 @@ export type HookModalContextT = {
10
10
  setIsHooksExecutionInProgress: (hookExecutionState?: boolean) => void;
11
11
  isRunningInBackground: boolean;
12
12
  isPresentationFullScreen: boolean;
13
- setIsRunningInBackground: (hookBackgroundProcessState?: boolean) => void;
14
- setIsPresentingFullScreen: (hookBackgroundProcessState?: boolean) => void;
13
+ setIsRunningInBackground: () => void;
14
+ setIsPresentingFullScreen: () => void;
15
15
  state: HookModalState;
16
16
  setState: (state: HookModalState) => void;
17
17
  resetState: () => void;
18
+ hookPresentationMode: HookPresentationMode;
18
19
  };
19
20
 
20
21
  const initialState = {
@@ -24,68 +25,43 @@ const initialState = {
24
25
 
25
26
  type HookPresentationMode = "background" | "fullScreen";
26
27
 
27
- const ReactContext = React.createContext<HookModalContextT>({
28
- isHooksExecutionInProgress: false,
29
- setIsHooksExecutionInProgress: () => {},
30
- isRunningInBackground: null,
31
- setIsRunningInBackground: () => {},
32
- setIsPresentingFullScreen: () => {},
33
- isPresentationFullScreen: null,
28
+ // Use useZappHookModalStore() in React components (hooks)
29
+ // Use zappHookModalStore.getState() in non-React functions (utility functions, etc.)
30
+ export const useZappHookModalStore = create<HookModalContextT>()((set) => ({
34
31
  state: initialState,
35
- setState: () => null,
36
- resetState: () => null,
37
- });
38
-
39
- const Provider = ({ children }: { children: React.ReactNode }) => {
40
- const [state, setState] = React.useState<HookModalState>(initialState);
41
-
42
- const [hookPresentationMode, setHookPresentationMode] =
43
- React.useState<HookPresentationMode>(null);
44
-
45
- const resetState = useCallback(() => {
46
- setState(initialState);
47
- }, [setState]);
48
-
49
- const [isHooksExecutionInProgress, setIsHooksExecutionInProgress] =
50
- React.useState(false);
32
+ isHooksExecutionInProgress: false,
33
+ hookPresentationMode: null as HookPresentationMode,
34
+ isRunningInBackground: false,
35
+ isPresentationFullScreen: false,
51
36
 
52
- const setIsRunningInBackground = () => {
53
- setHookPresentationMode("background");
54
- };
37
+ setState: (newState: HookModalState) => {
38
+ set({ state: newState });
39
+ },
55
40
 
56
- const setIsPresentingFullScreen = () => {
57
- setHookPresentationMode("fullScreen");
58
- };
41
+ setIsHooksExecutionInProgress: (hookExecutionState?: boolean) => {
42
+ set({ isHooksExecutionInProgress: hookExecutionState ?? false });
43
+ },
59
44
 
60
- return (
61
- <ReactContext.Provider
62
- value={{
63
- isRunningInBackground: hookPresentationMode === "background",
64
- setIsRunningInBackground,
65
- setIsPresentingFullScreen,
66
- isPresentationFullScreen: hookPresentationMode === "fullScreen",
67
- isHooksExecutionInProgress,
68
- setIsHooksExecutionInProgress,
69
- state,
70
- setState,
71
- resetState,
72
- }}
73
- >
74
- {children}
75
- </ReactContext.Provider>
76
- );
77
- };
45
+ setIsRunningInBackground: () => {
46
+ set({
47
+ hookPresentationMode: "background",
48
+ isRunningInBackground: true,
49
+ isPresentationFullScreen: false,
50
+ });
51
+ },
78
52
 
79
- const withProvider = (Component) => {
80
- const WithProvider = (props) => {
81
- return (
82
- <Provider>
83
- <Component {...props} />
84
- </Provider>
85
- );
86
- };
53
+ setIsPresentingFullScreen: () => {
54
+ set({
55
+ hookPresentationMode: "fullScreen",
56
+ isRunningInBackground: false,
57
+ isPresentationFullScreen: true,
58
+ });
59
+ },
87
60
 
88
- return WithProvider;
89
- };
61
+ resetState: () => {
62
+ set({ state: initialState });
63
+ },
64
+ }));
90
65
 
91
- export const ZappHookModalContext = { withProvider, ReactContext };
66
+ // Export an alias for clearer non-React usage (utility functions, etc.)
67
+ export const zappHookModalStore = useZappHookModalStore;
package/Contexts/index.ts CHANGED
@@ -12,8 +12,6 @@ export { HorizontalScrollContext } from "./HorizontalScrollContext";
12
12
 
13
13
  export { RiverOffsetContext } from "./RiverOffsetContext";
14
14
 
15
- export { ZappHookModalContext } from "./ZappHookModalContext";
16
-
17
15
  export { MeasurementContext } from "./MeasurementContext";
18
16
 
19
17
  export * from "./ZappPipesContext";
@@ -88,6 +88,7 @@ exports[`withConfigurationProvider correctly passes all the configuration keys c
88
88
  tab_cell_padding_right={10}
89
89
  tab_cell_padding_top={14}
90
90
  tablet_theme={false}
91
+ tabs_screen_background_color="transparent"
91
92
  target={false}
92
93
  target_screen_switch={false}
93
94
  text_label_active_font_color="rgba(239, 239, 239, 0.5)"
@@ -208,4 +208,5 @@ export const keysMap: Record<string, Function> = {
208
208
  tab_bar_item_margin_right: castOrDefaultValue(Number, 0),
209
209
  tab_bar_item_margin_bottom: castOrDefaultValue(Number, 0),
210
210
  tab_bar_item_margin_left: castOrDefaultValue(Number, 0),
211
+ tabs_screen_background_color: castOrDefaultValue(R.identity, "transparent"),
211
212
  };
@@ -3,7 +3,7 @@ import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUt
3
3
 
4
4
  import * as zappPipesRedux from "@applicaster/zapp-react-native-redux/ZappPipes";
5
5
  import configureStore from "redux-mock-store";
6
- import thunk from "redux-thunk";
6
+ import { thunk } from "redux-thunk";
7
7
 
8
8
  import { zappPipesDataConnector } from "../index";
9
9
 
package/events/index.ts CHANGED
@@ -5,4 +5,7 @@ export enum QBUIComponentEvents {
5
5
  scrollVerticallyToInitialOffset = "scrollVerticallyToInitialOffset",
6
6
  focusOnSelectedTab = "focusOnSelectedTab",
7
7
  focusOnSelectedTopMenuItem = "focusOnSelectedTopMenuItem",
8
+ scrollToTopForScreenWrappedInContainer = "scrollToTopForScreenWrappedInContainer",
8
9
  }
10
+
11
+ export { scrollEndReached$, emitScrollEndReached } from "./scrollEndReached";
@@ -0,0 +1,15 @@
1
+ import { Subject } from "rxjs";
2
+ import { throttleTime } from "rxjs/operators";
3
+
4
+ const SCROLL_END_THROTTLE_MS = 1000;
5
+ const scrollEndReachedSubject = new Subject<void>();
6
+
7
+ /* Throttle so we only emit at most once per second; RN often fires onEndReached repeatedly (e.g. on Android) when near the bottom. */
8
+ export const scrollEndReached$ = scrollEndReachedSubject.pipe(
9
+ throttleTime(SCROLL_END_THROTTLE_MS)
10
+ );
11
+
12
+ /* Call from scroll container (ComponentsMap or Tabs) when scroll reaches end. */
13
+ export const emitScrollEndReached = (): void => {
14
+ scrollEndReachedSubject.next();
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "15.0.0-alpha.8680244503",
3
+ "version": "15.0.0-alpha.9102699023",
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-alpha.8680244503",
32
- "@applicaster/zapp-react-native-bridge": "15.0.0-alpha.8680244503",
33
- "@applicaster/zapp-react-native-redux": "15.0.0-alpha.8680244503",
34
- "@applicaster/zapp-react-native-utils": "15.0.0-alpha.8680244503",
31
+ "@applicaster/applicaster-types": "15.0.0-alpha.9102699023",
32
+ "@applicaster/zapp-react-native-bridge": "15.0.0-alpha.9102699023",
33
+ "@applicaster/zapp-react-native-redux": "15.0.0-alpha.9102699023",
34
+ "@applicaster/zapp-react-native-utils": "15.0.0-alpha.9102699023",
35
35
  "fast-json-stable-stringify": "^2.1.0",
36
36
  "promise": "^8.3.0",
37
37
  "url": "^0.11.0",
@@ -1,27 +0,0 @@
1
- /* eslint max-len: off */
2
-
3
- import React from "react";
4
- import { TVEventHandlerComponent } from "@applicaster/zapp-react-native-tvos-ui-components/Components/TVEventHandlerComponent";
5
- import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
6
-
7
- export const withTvEventHandler = (Component) => {
8
- return function WithTVEventHandler(props) {
9
- const navigator = useNavigation();
10
-
11
- const remoteHandler = (event) => {
12
- const { eventType } = event;
13
-
14
- const canGoBack = navigator.canGoBack();
15
-
16
- if (eventType === "menu" && canGoBack) {
17
- navigator.goBack();
18
- }
19
- };
20
-
21
- return (
22
- <TVEventHandlerComponent tvEventHandler={remoteHandler}>
23
- <Component {...props} />
24
- </TVEventHandlerComponent>
25
- );
26
- };
27
- };