@applicaster/zapp-react-native-ui-components 12.0.5 → 13.0.0-alpha.1035032144

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 (105) hide show
  1. package/Components/AppContainer/__tests__/__snapshots__/AppContainer.test.js.snap +1 -1
  2. package/Components/AudioPlayer/__tests__/__snapshots__/Runtime.test.js.snap +4 -4
  3. package/Components/AudioPlayer/__tests__/__snapshots__/artWork.test.js.snap +3 -3
  4. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +6 -6
  5. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +7 -7
  6. package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +3 -3
  7. package/Components/AudioPlayer/__tests__/__snapshots__/summary.test.js.snap +2 -2
  8. package/Components/AudioPlayer/__tests__/__snapshots__/title.test.js.snap +2 -2
  9. package/Components/Cell/Cell.tsx +4 -8
  10. package/Components/Cell/CellWithFocusable.tsx +60 -44
  11. package/Components/Cell/TvOSCellComponent.tsx +3 -8
  12. package/Components/Cell/__tests__/CellWIthFocusable.test.js +6 -13
  13. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +20 -20
  14. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +5 -3
  15. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +5 -5
  16. package/Components/ComponentResolver/__tests__/componentResolver.test.js +11 -9
  17. package/Components/DisplayState/__tests__/__snapshots__/displayState.test.js.snap +2 -2
  18. package/Components/Focusable/FocusableTvOS.tsx +1 -1
  19. package/Components/FocusableList/index.tsx +0 -1
  20. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +9 -0
  21. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
  22. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +1 -0
  23. package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
  24. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -3
  25. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +9 -9
  26. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  27. package/Components/Layout/TV/__tests__/index.test.tsx +7 -3
  28. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
  29. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
  30. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -11
  31. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
  32. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
  33. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  34. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  35. package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
  36. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +7 -7
  37. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +34 -34
  38. package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
  39. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
  40. package/Components/NativeFocusables/{index.js → index.ts} +4 -2
  41. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +7 -7
  42. package/Components/OfflineHandler/__tests__/index.test.tsx +28 -25
  43. package/Components/PlayerContainer/PlayerContainer.tsx +5 -11
  44. package/Components/River/ComponentsMap/ComponentsMap.tsx +39 -65
  45. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
  46. package/Components/River/RefreshControl.tsx +1 -1
  47. package/Components/River/RiverFooter.tsx +39 -9
  48. package/Components/River/RiverItem.tsx +37 -2
  49. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +114 -45
  50. package/Components/River/__tests__/__snapshots__/river.test.js.snap +12 -12
  51. package/Components/River/__tests__/componentsMap.test.js +64 -17
  52. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -1
  53. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +1 -1
  54. package/Components/Screen/__tests__/Screen.test.tsx +41 -27
  55. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -4
  56. package/Components/Screen/hooks.ts +56 -0
  57. package/Components/Screen/index.tsx +13 -39
  58. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +2 -2
  59. package/Components/ScreenResolver/__tests__/screenResolver.test.js +31 -27
  60. package/Components/Tabs/Tab.tsx +1 -0
  61. package/Components/TextInputTv/__tests__/TextInputTv.test.js +42 -42
  62. package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +7 -0
  63. package/Components/TextInputTv/index.tsx +2 -2
  64. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
  65. package/Components/Transitioner/Scene.tsx +52 -23
  66. package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
  67. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +62 -46
  68. package/Components/Transitioner/__tests__/__snapshots__/config.test.js.snap +20 -20
  69. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +4 -4
  70. package/Components/Transitioner/index.js +8 -4
  71. package/Components/VideoLive/PlayerLiveImageComponent.tsx +5 -2
  72. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +14 -9
  73. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +5 -10
  74. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +1 -1
  75. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +4 -10
  76. package/Components/VideoModal/ModalAnimation/index.ts +2 -1
  77. package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
  78. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
  79. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +12 -9
  80. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +4 -4
  81. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +66 -66
  82. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
  83. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +1 -1
  84. package/Components/VideoModal/utils.ts +2 -4
  85. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +2 -2
  86. package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
  87. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +11 -11
  88. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +30 -30
  89. package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
  90. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +2 -2
  91. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +77 -77
  92. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +34 -39
  93. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -9
  94. package/Decorators/RiverFeedLoader/index.tsx +1 -1
  95. package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +39 -0
  96. package/Decorators/RiverFeedLoader/utils/index.ts +29 -0
  97. package/Decorators/RiverFeedLoader/utils/usePipesContexts.ts +40 -0
  98. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +5 -5
  99. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +16 -10
  100. package/Decorators/ZappPipesDataConnector/index.tsx +32 -2
  101. package/README.md +1 -13
  102. package/package.json +12 -6
  103. package/Components/Cell/CellWithFocusable.ios.tsx +0 -126
  104. package/Decorators/RiverFeedLoader/utils.ts +0 -100
  105. /package/Decorators/Analytics/{index.js → index.tsx} +0 -0
package/README.md CHANGED
@@ -78,17 +78,6 @@ export default MyAwesomeComponent;
78
78
  export { MyAwesomeComponent } from "./MyAwesomeComponent";
79
79
  ```
80
80
 
81
- We provide flow types for component props - please use it to make sure your component will be compliant
82
-
83
- ```javascript
84
- import * as React from "react";
85
- import type { ZappComponentProps } from "../../flow-types"; // in the root of the project
86
-
87
- export class MyComponent extends React.Component<ZappComponentProps> {
88
- /* ... */
89
- }
90
- ```
91
-
92
81
  ## Connecting my component to Zapp Pipes
93
82
 
94
83
  Zapp App components rely on [Zapp-Pipes](https://github.com/applicaster/zapp-pipes) to load data.
@@ -100,10 +89,9 @@ In order to connect your component to ZappPipes, you simply need to use the `Zap
100
89
  import * as React from "react";
101
90
  import { View, Text } from "react-native";
102
91
  import { zappPipesDataConnector } from "../ZappPipesDataConnector";
103
- import type { ZappComponentProps } from "../../flow-types";
104
92
 
105
93
  @zappPipesDataConnector
106
- export class MyComponent extends React.Component<ZappComponentProps> {
94
+ export class MyComponent extends React.Component {
107
95
  renderComponent = (data) => {
108
96
  return (
109
97
  <View>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "12.0.5",
3
+ "version": "13.0.0-alpha.1035032144",
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",
@@ -34,20 +34,26 @@
34
34
  "redux-mock-store": "^1.5.3"
35
35
  },
36
36
  "dependencies": {
37
- "@applicaster/applicaster-types": "12.0.5",
38
- "@applicaster/zapp-react-native-bridge": "12.0.5",
39
- "@applicaster/zapp-react-native-redux": "12.0.5",
40
- "@applicaster/zapp-react-native-utils": "12.0.5",
37
+ "@applicaster/applicaster-types": "13.0.0-alpha.1035032144",
38
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1035032144",
39
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.1035032144",
40
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1035032144",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",
44
44
  "uuid": "^3.3.2"
45
45
  },
46
46
  "peerDependencies": {
47
+ "@applicaster/zapp-pipes-v2-client": "*",
47
48
  "@react-native-community/netinfo": "*",
49
+ "@types/node": "*",
50
+ "immer": "*",
48
51
  "react": "17.0.2",
49
52
  "react-native": "0.68.6",
50
53
  "react-native-safe-area-context": "*",
51
- "react-native-svg": "*"
54
+ "react-native-svg": "*",
55
+ "uglify-js": "*",
56
+ "validate-color": "*",
57
+ "zustand": "*"
52
58
  }
53
59
  }
@@ -1,126 +0,0 @@
1
- /** TODO: Remove this file when tvos FocusableGroup
2
- * behaviour is aligned to the web one
3
- * FocusableGroup should only send onFocus and onBlur events when
4
- * Focus enters and leaves the Focusables inside the branch
5
- */
6
- import * as React from "react";
7
-
8
- import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
9
- import * as FOCUS_EVENTS from "@applicaster/zapp-react-native-utils/appUtils/focusManager/events";
10
- import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
11
- import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
12
-
13
- import { isAppleTV } from "../../Helpers/Platform";
14
- import { useCellState } from "../MasterCell/utils";
15
-
16
- const useCellFocusedState = (
17
- skipFocusManagerRegistration: boolean,
18
- groupId: string,
19
- id: string
20
- ) => {
21
- const [currentCellFocused, setCurrentCellFocused] = React.useState(false);
22
-
23
- React.useEffect(() => {
24
- const isGroupItemFocused = () => {
25
- if (!skipFocusManagerRegistration) {
26
- const isFocused = focusManager.isGroupItemFocused(groupId, id);
27
- setCurrentCellFocused(isFocused);
28
- }
29
- };
30
-
31
- const handler = () => {
32
- // tvOS hack for properly checking focus
33
- if (isAppleTV()) {
34
- setTimeout(() => {
35
- isGroupItemFocused();
36
- }, 0);
37
- } else {
38
- isGroupItemFocused();
39
- }
40
- };
41
-
42
- focusManager.on(FOCUS_EVENTS.FOCUS, handler);
43
-
44
- return () => {
45
- focusManager.removeHandler(FOCUS_EVENTS.FOCUS, handler);
46
- };
47
- }, [groupId, skipFocusManagerRegistration]);
48
-
49
- return currentCellFocused;
50
- };
51
-
52
- type Props = {
53
- item: ZappEntry;
54
- CellRenderer: React.FunctionComponent<any>;
55
- id: string;
56
- groupId: string;
57
- onFocus: Function;
58
- index: number;
59
- scrollTo: Function;
60
- preferredFocus?: boolean;
61
- skipFocusManagerRegistration?: boolean;
62
- isFocusable?: boolean;
63
- behavior: Behavior;
64
- focused?: boolean;
65
- };
66
-
67
- export function CellWithFocusable(props: Props) {
68
- const {
69
- index,
70
- item,
71
- CellRenderer,
72
- id,
73
- groupId,
74
- onFocus,
75
- scrollTo = noop,
76
- preferredFocus,
77
- skipFocusManagerRegistration,
78
- isFocusable,
79
- behavior,
80
- focused,
81
- } = props;
82
-
83
- const isFocused = useCellFocusedState(
84
- skipFocusManagerRegistration,
85
- groupId,
86
- id
87
- );
88
-
89
- const state = useCellState({
90
- id: item.id,
91
- behavior,
92
- focused: isFocused || toBooleanWithDefaultFalse(focused),
93
- });
94
-
95
- const [focusedButtonId, setFocusedButtonId] = React.useState(undefined);
96
-
97
- // for horizontal scrolling
98
- React.useEffect(() => {
99
- if (focusedButtonId) {
100
- scrollTo(index);
101
- }
102
- }, [focusedButtonId]);
103
-
104
- const handleToggleFocus = (value) => {
105
- setFocusedButtonId(value.focusedButtonId);
106
-
107
- if (value.focusable) {
108
- onFocus(value.focusable, value.mouse);
109
- }
110
- };
111
-
112
- return (
113
- <CellRenderer
114
- item={item}
115
- groupId={groupId}
116
- onToggleFocus={handleToggleFocus}
117
- state={state}
118
- prefixId={id}
119
- focusedButtonId={focusedButtonId}
120
- preferredFocus={preferredFocus}
121
- skipFocusManagerRegistration={skipFocusManagerRegistration}
122
- isFocusable={isFocusable}
123
- focused={focused}
124
- />
125
- );
126
- }
@@ -1,100 +0,0 @@
1
- import * as R from "ramda";
2
- import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
3
-
4
- import {
5
- getInflatedDataSourceUrl,
6
- getSearchContext,
7
- } from "@applicaster/zapp-react-native-utils/reactHooks";
8
-
9
- import {
10
- mapPromises,
11
- reducePromises,
12
- } from "@applicaster/zapp-react-native-utils/arrayUtils";
13
-
14
- import {
15
- ZappPipesEntryContext,
16
- ZappPipesScreenContext,
17
- ZappPipesSearchContext,
18
- } from "../../Contexts";
19
-
20
- export const DATASOURCE_CHUNKS = 10;
21
-
22
- export async function loadDatasources(urls: string[][], riverId, dispatch) {
23
- return reducePromises<string, void>(
24
- mapPromises<string, void>((url) => {
25
- if (url) {
26
- return dispatch(loadPipesData(url, { riverId }));
27
- }
28
- }),
29
- undefined,
30
- urls
31
- );
32
- }
33
-
34
- export function riverIsCurrentRoute(riverId, route) {
35
- const routeRiverId = R.compose(R.last, R.split("/"))(route);
36
-
37
- return typeof riverId === "undefined" || routeRiverId === riverId;
38
- }
39
-
40
- export const ignoreComponentsWithClearCacheFlag = R.reject(
41
- R.pathEq(["rules", "clear_cache_on_reload"], true)
42
- );
43
-
44
- export const getDatasourceUrl: (
45
- contexts: {
46
- screenData?: Record<string, any>;
47
- entryContext: ReturnType<
48
- typeof ZappPipesEntryContext.useZappPipesContext
49
- >[0];
50
- searchContext: string;
51
- screenContext: ZappRiver;
52
- },
53
- component?: ZappUIComponent
54
- ) => string | null = R.curry(
55
- (
56
- { screenData, entryContext, searchContext, screenContext },
57
- component: ZappUIComponent
58
- ) => {
59
- const { source, mapping } = R.propOr({}, ["data"], component);
60
-
61
- if (mapping) {
62
- const contexts = {
63
- entry: entryContext,
64
- screen: screenContext || screenData,
65
- search: getSearchContext(searchContext, mapping),
66
- };
67
-
68
- return getInflatedDataSourceUrl({ source, mapping, contexts });
69
- }
70
-
71
- return source;
72
- }
73
- );
74
-
75
- export function usePipesContexts(
76
- riverId: string,
77
- route: string
78
- ): {
79
- entryContext: ReturnType<typeof ZappPipesEntryContext.useZappPipesContext>[0];
80
- searchContext: string;
81
- screenContext: ZappRiver;
82
- } {
83
- const isNestedScreen = !riverIsCurrentRoute(riverId, route);
84
-
85
- const routeForEntry = isNestedScreen ? `${route}/river/${riverId}` : route;
86
-
87
- const [entryContext] = ZappPipesEntryContext.useZappPipesContext(
88
- routeForEntry,
89
- isNestedScreen
90
- );
91
-
92
- const [searchContext] = ZappPipesSearchContext.useZappPipesContext();
93
- const [screenContext] = ZappPipesScreenContext.useZappPipesContext();
94
-
95
- return {
96
- entryContext,
97
- searchContext,
98
- screenContext,
99
- };
100
- }
File without changes