@applicaster/zapp-react-native-ui-components 13.0.0-rc.14 → 13.0.0-rc.140

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 (226) hide show
  1. package/Components/AppContainer/__tests__/AppContainer.test.js +4 -6
  2. package/Components/AppContainer/__tests__/__snapshots__/AppContainer.test.js.snap +1 -1
  3. package/Components/AudioPlayer/index.tsx +15 -0
  4. package/Components/AudioPlayer/mobile/Layout.tsx +63 -0
  5. package/Components/AudioPlayer/mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap +66 -0
  6. package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +18 -0
  7. package/Components/AudioPlayer/mobile/index.tsx +23 -0
  8. package/Components/AudioPlayer/tv/Artwork.tsx +40 -0
  9. package/Components/AudioPlayer/{AudioPlayerLayout.tsx → tv/Layout.tsx} +37 -79
  10. package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +2 -1
  11. package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +12 -9
  12. package/Components/AudioPlayer/{Title.tsx → tv/Title.tsx} +12 -9
  13. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/Runtime.test.js +5 -8
  14. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +6 -6
  15. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap +11 -6
  16. package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +170 -0
  17. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/channel.test.js.snap +3 -3
  18. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/summary.test.js.snap +3 -3
  19. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +3 -3
  20. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/artWork.test.js +3 -5
  21. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +5 -7
  22. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/channel.test.js +3 -5
  23. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/summary.test.js +3 -5
  24. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/title.test.js +3 -5
  25. package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +3 -5
  26. package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +21 -62
  27. package/Components/AudioPlayer/types.ts +40 -0
  28. package/Components/BaseFocusable/index.ios.ts +1 -1
  29. package/Components/BaseFocusable/index.tsx +67 -31
  30. package/Components/Cell/Cell.tsx +14 -14
  31. package/Components/Cell/CellWithFocusable.tsx +50 -59
  32. package/Components/Cell/CellWrapper.tsx +18 -0
  33. package/Components/Cell/TvOSCellComponent.tsx +20 -26
  34. package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
  35. package/Components/Cell/index.js +3 -1
  36. package/Components/Cell/styles.ts +17 -0
  37. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +50 -50
  38. package/Components/CellRendererResolver/index.ts +2 -1
  39. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
  40. package/Components/ComponentResolver/__tests__/componentResolver.test.js +26 -30
  41. package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
  42. package/Components/DisplayState/__tests__/__snapshots__/displayState.test.js.snap +2 -2
  43. package/Components/ErrorScreen/index.tsx +14 -6
  44. package/Components/Focusable/Focusable.tsx +1 -54
  45. package/Components/Focusable/FocusableTvOS.tsx +6 -2
  46. package/Components/Focusable/Touchable.tsx +19 -20
  47. package/Components/Focusable/index.android.tsx +10 -3
  48. package/Components/FocusableCell/index.tsx +1 -1
  49. package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
  50. package/Components/FocusableGroup/index.tsx +0 -3
  51. package/Components/FocusableList/index.tsx +26 -10
  52. package/Components/FocusableScrollView/index.tsx +43 -13
  53. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -0
  54. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +9 -0
  55. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +5 -3
  56. package/Components/GeneralContentScreen/utils/useEventAlerts.ts +30 -0
  57. package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
  58. package/Components/Layout/TV/LayoutBackground.tsx +28 -0
  59. package/Components/Layout/TV/NavBarContainer.tsx +19 -23
  60. package/Components/Layout/TV/ScreenContainer.tsx +8 -2
  61. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  62. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +3 -1
  63. package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
  64. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +6 -5
  65. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +12 -11
  66. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
  67. package/Components/Layout/TV/__tests__/index.test.tsx +14 -4
  68. package/Components/Layout/TV/index.tsx +6 -20
  69. package/Components/Layout/TV/index.web.tsx +4 -1
  70. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
  71. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
  72. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
  73. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +10 -15
  74. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
  75. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
  76. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
  77. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
  78. package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
  79. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  80. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
  81. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
  82. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  83. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
  84. package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
  85. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +11 -19
  86. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +6 -235
  87. package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
  88. package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
  89. package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
  90. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
  91. package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
  92. package/Components/MasterCell/utils/index.ts +9 -135
  93. package/Components/ModalComponent/BottomSheetModalContent.tsx +66 -54
  94. package/Components/ModalComponent/Button/Item.tsx +6 -5
  95. package/Components/ModalComponent/Button/assets.ts +1 -1
  96. package/Components/ModalComponent/Button/index.tsx +45 -62
  97. package/Components/ModalComponent/Header/index.tsx +12 -11
  98. package/Components/ModalComponent/utils.ts +55 -7
  99. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
  100. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
  101. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
  102. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +7 -7
  103. package/Components/OfflineHandler/__tests__/index.test.tsx +28 -25
  104. package/Components/OfflineHandler/utils/index.ts +1 -1
  105. package/Components/PlayerContainer/PlayerContainer.tsx +76 -66
  106. package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
  107. package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
  108. package/Components/PlayerImageBackground/index.tsx +2 -2
  109. package/Components/River/ComponentsMap/ComponentsMap.tsx +49 -68
  110. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
  111. package/Components/River/RefreshControl.tsx +1 -1
  112. package/Components/River/RiverFooter.tsx +39 -9
  113. package/Components/River/RiverItem.tsx +44 -4
  114. package/Components/River/TV/index.tsx +6 -1
  115. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +115 -46
  116. package/Components/River/__tests__/__snapshots__/river.test.js.snap +21 -83
  117. package/Components/River/__tests__/componentsMap.test.js +64 -17
  118. package/Components/River/__tests__/river.test.js +75 -40
  119. package/Components/RouteManager/TestId.tsx +1 -5
  120. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -5
  121. package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
  122. package/Components/RouteManager/__tests__/testId.test.js +4 -6
  123. package/Components/Screen/TV/__tests__/index.web.test.tsx +26 -0
  124. package/Components/Screen/TV/index.web.tsx +5 -6
  125. package/Components/Screen/__tests__/Screen.test.tsx +53 -31
  126. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +6 -6
  127. package/Components/Screen/hooks.ts +53 -0
  128. package/Components/Screen/index.tsx +16 -42
  129. package/Components/ScreenResolver/__tests__/screenResolver.test.js +95 -70
  130. package/Components/Tabs/Tab.tsx +12 -9
  131. package/Components/TextInputTv/__tests__/TextInputTv.test.js +42 -42
  132. package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +7 -0
  133. package/Components/TextInputTv/index.tsx +6 -5
  134. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
  135. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
  136. package/Components/TrackedView/index.tsx +1 -0
  137. package/Components/Transitioner/AnimationManager.js +15 -15
  138. package/Components/Transitioner/Scene.tsx +53 -24
  139. package/Components/Transitioner/Transitioner.tsx +3 -3
  140. package/Components/Transitioner/__tests__/Scene.test.js +25 -14
  141. package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
  142. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +10 -50
  143. package/Components/Transitioner/__tests__/__snapshots__/config.test.js.snap +20 -20
  144. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +4 -4
  145. package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
  146. package/Components/Transitioner/index.js +8 -4
  147. package/Components/VideoLive/LiveImageManager.ts +27 -1
  148. package/Components/VideoLive/PlayerLiveImageComponent.tsx +36 -24
  149. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -8
  150. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +6 -10
  151. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  152. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +51 -31
  153. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +8 -4
  154. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +48 -23
  155. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +16 -15
  156. package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
  157. package/Components/VideoModal/ModalAnimation/const.ts +5 -0
  158. package/Components/VideoModal/ModalAnimation/index.ts +4 -1
  159. package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
  160. package/Components/VideoModal/ModalAnimation/utils.ts +32 -2
  161. package/Components/VideoModal/OpaqueLayer.tsx +33 -0
  162. package/Components/VideoModal/PlayerDetails.tsx +18 -10
  163. package/Components/VideoModal/PlayerWrapper.tsx +51 -57
  164. package/Components/VideoModal/VideoModal.tsx +17 -11
  165. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
  166. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +13 -10
  167. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
  168. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +74 -104
  169. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +51 -0
  170. package/Components/VideoModal/hooks/index.ts +7 -0
  171. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +38 -0
  172. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
  173. package/Components/VideoModal/hooks/utils/index.ts +33 -0
  174. package/Components/VideoModal/utils.ts +6 -9
  175. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
  176. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
  177. package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
  178. package/Components/Viewport/__tests__/utils.test.js +5 -4
  179. package/Components/ZappUIComponent/Placeholder.tsx +3 -1
  180. package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
  181. package/Components/ZappUIComponent/index.tsx +4 -17
  182. package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
  183. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
  184. package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
  185. package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
  186. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  187. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  188. package/Contexts/ScreenContext/index.tsx +6 -12
  189. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  190. package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
  191. package/Decorators/Navigator/index.tsx +1 -1
  192. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +77 -77
  193. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +34 -39
  194. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -9
  195. package/Decorators/RiverFeedLoader/index.tsx +1 -1
  196. package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +39 -0
  197. package/Decorators/RiverFeedLoader/utils/index.ts +29 -0
  198. package/Decorators/RiverFeedLoader/utils/usePipesContexts.ts +40 -0
  199. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +27 -27
  200. package/Decorators/RiverResolver/index.tsx +6 -8
  201. package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
  202. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
  203. package/Decorators/ZappPipesDataConnector/index.tsx +7 -3
  204. package/package.json +13 -11
  205. package/tsconfig.json +2 -3
  206. package/.babelrc +0 -8
  207. package/Components/AudioPlayer/Artwork.tsx +0 -35
  208. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +0 -123
  209. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +0 -50
  210. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +0 -27
  211. package/Components/AudioPlayer/index.ts +0 -1
  212. package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
  213. package/Components/Cell/CellStyles/Hero/index.js +0 -111
  214. package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
  215. package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
  216. package/Components/Cell/CellStyles/colors.js +0 -40
  217. package/Components/Cell/CellStyles/index.js +0 -15
  218. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
  219. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
  220. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
  221. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
  222. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
  223. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
  224. package/Decorators/RiverFeedLoader/utils.ts +0 -100
  225. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
  226. /package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +0 -0
@@ -1,8 +1,8 @@
1
1
  import * as React from "react";
2
2
 
3
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
4
3
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
5
- import { usePathname } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
4
+ import { usePathname } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/usePathname";
5
+ import { useRivers } from "@applicaster/zapp-react-native-utils/reactHooks";
6
6
 
7
7
  type Props = ZappUIComponentProps & {
8
8
  rivers: ZappRivers;
@@ -12,27 +12,25 @@ type Props = ZappUIComponentProps & {
12
12
 
13
13
  export function withRiver(Component: ZappComponent): ZappComponent {
14
14
  const RiverWithData = ({ screenId, ...otherProps }: Props) => {
15
- const { rivers } = usePickFromState(["rivers"]);
15
+ const river = useRivers()?.[screenId];
16
16
  const pathname = usePathname();
17
- const river = rivers[screenId];
18
17
 
19
18
  if (!river) {
20
19
  return null;
21
20
  }
22
21
 
23
- if (!otherProps.screenData) {
24
- otherProps.screenData = river;
25
- }
26
-
27
22
  return (
28
23
  <Component
29
24
  screenId={screenId}
30
25
  river={river}
31
26
  key={isTV() ? pathname : undefined}
32
27
  {...otherProps}
28
+ screenData={otherProps.screenData || river}
33
29
  />
34
30
  );
35
31
  };
36
32
 
33
+ RiverWithData.displayName = `RiverWithData(${Component.displayName || Component.name})`;
34
+
37
35
  return RiverWithData;
38
36
  }
@@ -2,7 +2,7 @@ import React, { useEffect } from "react";
2
2
  import { View } from "react-native";
3
3
 
4
4
  type Props = {
5
- onLoadFinished: () => void,
5
+ onLoadFinished: () => void;
6
6
  };
7
7
 
8
8
  export function Hero(props: Props) {
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
3
- import { shallowToJson } from "enzyme-to-json";
2
+ import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
3
+
4
4
  import * as zappPipesRedux from "@applicaster/zapp-react-native-redux/ZappPipes";
5
5
  import configureStore from "redux-mock-store";
6
6
  import thunk from "redux-thunk";
@@ -8,6 +8,7 @@ import thunk from "redux-thunk";
8
8
  import { zappPipesDataConnector } from "../index";
9
9
 
10
10
  import { Hero } from "./Hero";
11
+ import { render } from "ejs";
11
12
 
12
13
  const mockStore = configureStore([thunk]);
13
14
 
@@ -20,6 +21,15 @@ const initialState = {
20
21
  },
21
22
  };
22
23
 
24
+ jest.mock(
25
+ "@applicaster/zapp-react-native-utils/reactHooks/navigation/useIsScreenActive",
26
+ () => ({
27
+ useIsScreenActive: () => ({
28
+ isScreenActive: true,
29
+ }),
30
+ })
31
+ );
32
+
23
33
  const store = mockStore(initialState);
24
34
 
25
35
  const zappPipesSpy = jest
@@ -31,6 +41,7 @@ const WrappedComponent = zappPipesDataConnector(Hero);
31
41
  const componentProp = (data) => ({ data });
32
42
 
33
43
  // tests need to be re-written due to TS refactor
44
+ // this test has old usage of enzyme API, that's need to be replaced with @testing-library/react-native
34
45
  describe.skip("zappPipesDataConnector", () => {
35
46
  beforeEach(() => {
36
47
  zappPipesSpy.mockClear();
@@ -43,7 +54,7 @@ describe.skip("zappPipesDataConnector", () => {
43
54
  it("loads the provided feed url", () => {
44
55
  expect(zappPipesDataConnector).toBeFunction();
45
56
 
46
- const wrapper = shallow(
57
+ const wrapper = renderWithProviders(
47
58
  <WrappedComponent
48
59
  component={componentProp(data)}
49
60
  feedUrl={feedUrl}
@@ -51,8 +62,7 @@ describe.skip("zappPipesDataConnector", () => {
51
62
  />
52
63
  ).dive();
53
64
 
54
- expect(shallowToJson(wrapper)).toMatchSnapshot();
55
- expect(wrapper.first().shallow()).toMatchSnapshot();
65
+ expect(wrapper.toJSON()).toMatchSnapshot();
56
66
 
57
67
  expect(zappPipesSpy).toHaveBeenCalledWith(feedUrl, {
58
68
  clearCache: false,
@@ -71,12 +81,11 @@ describe.skip("zappPipesDataConnector", () => {
71
81
  it("is a HoC", () => {
72
82
  expect(zappPipesDataConnector).toBeFunction();
73
83
 
74
- const wrapper = shallow(
84
+ const wrapper = renderWithProviders(
75
85
  <WrappedComponent component={componentProp(data)} store={store} />
76
86
  ).dive();
77
87
 
78
- expect(shallowToJson(wrapper)).toMatchSnapshot();
79
- expect(wrapper.first().shallow()).toMatchSnapshot();
88
+ expect(wrapper.toJSON()).toMatchSnapshot();
80
89
 
81
90
  expect(zappPipesSpy).toHaveBeenCalledWith(data.source, {
82
91
  clearCache: false,
@@ -99,12 +108,11 @@ describe.skip("zappPipesDataConnector", () => {
99
108
  it("calls clearCache true and silentRefresh with false", () => {
100
109
  expect(zappPipesDataConnector).toBeFunction();
101
110
 
102
- const wrapper = shallow(
111
+ const wrapper = renderWithProviders(
103
112
  <WrappedComponent component={{ data, rules }} store={store} />
104
113
  ).dive();
105
114
 
106
- expect(shallowToJson(wrapper)).toMatchSnapshot();
107
- expect(wrapper.first().shallow()).toMatchSnapshot();
115
+ expect(wrapper.toJSON()).toMatchSnapshot();
108
116
 
109
117
  expect(zappPipesSpy).toHaveBeenCalledWith(data.source, {
110
118
  clearCache: true,
@@ -123,12 +131,11 @@ describe.skip("zappPipesDataConnector", () => {
123
131
  it("is a HoC", () => {
124
132
  expect(zappPipesDataConnector).toBeFunction();
125
133
 
126
- const wrapper = shallow(
134
+ const wrapper = renderWithProviders(
127
135
  <WrappedComponent component={componentProp(data)} store={store} />
128
136
  ).dive();
129
137
 
130
- expect(shallowToJson(wrapper)).toMatchSnapshot();
131
- expect(wrapper.first().shallow()).toMatchSnapshot();
138
+ expect(wrapper.toJSON()).toMatchSnapshot();
132
139
 
133
140
  expect(zappPipesSpy).toHaveBeenCalledWith(
134
141
  "applicaster://fetchData?type=APPLICASTER_COLLECTION&collectionId=1234",
@@ -146,11 +153,11 @@ describe.skip("zappPipesDataConnector", () => {
146
153
  it("is a HoC", () => {
147
154
  expect(zappPipesDataConnector).toBeFunction();
148
155
 
149
- const wrapper = shallow(
156
+ const wrapper = renderWithProviders(
150
157
  <WrappedComponent component={componentProp(data)} store={store} />
151
158
  ).dive();
152
159
 
153
- expect(shallowToJson(wrapper)).toMatchSnapshot();
160
+ expect(wrapper.toJSON()).toMatchSnapshot();
154
161
  expect(wrapper.first().shallow()).toMatchSnapshot();
155
162
 
156
163
  expect(zappPipesSpy).toHaveBeenCalledWith(
@@ -171,11 +178,11 @@ describe.skip("zappPipesDataConnector", () => {
171
178
  };
172
179
 
173
180
  it("calls loadPipesData with favourites option", () => {
174
- const wrapper = shallow(
181
+ const wrapper = renderWithProviders(
175
182
  <WrappedComponent component={componentProp(data)} store={store} />
176
183
  ).dive();
177
184
 
178
- expect(shallowToJson(wrapper)).toMatchSnapshot();
185
+ expect(wrapper.toJSON()).toMatchSnapshot();
179
186
  expect(wrapper.first().shallow()).toMatchSnapshot();
180
187
 
181
188
  expect(zappPipesSpy).toHaveBeenCalledWith("FAVOURITES", {
@@ -188,7 +195,7 @@ describe.skip("zappPipesDataConnector", () => {
188
195
 
189
196
  describe("getDataSourceUrl", () => {
190
197
  it("returns null if data prop is empty", () => {
191
- const wrapper = shallow(
198
+ const wrapper = render(
192
199
  <WrappedComponent component={componentProp({})} store={store} />
193
200
  ).dive();
194
201
 
@@ -199,7 +206,7 @@ describe.skip("zappPipesDataConnector", () => {
199
206
  });
200
207
 
201
208
  it("returns null if data.source is falsy", () => {
202
- const wrapper = shallow(
209
+ const wrapper = renderWithProviders(
203
210
  <WrappedComponent
204
211
  component={componentProp({ source: null })}
205
212
  store={store}
@@ -222,7 +229,7 @@ describe.skip("zappPipesDataConnector", () => {
222
229
  it("reloads the app's datasource", () => {
223
230
  store.clearActions();
224
231
 
225
- const wrapper = shallow(
232
+ const wrapper = renderWithProviders(
226
233
  <WrappedComponent component={componentProp(data)} store={store} />
227
234
  ).dive();
228
235
 
@@ -251,7 +258,7 @@ describe.skip("zappPipesDataConnector", () => {
251
258
  entry: [{ id: "test-entry", title: "test entry" }],
252
259
  }));
253
260
 
254
- const wrapper = shallow(
261
+ const wrapper = renderWithProviders(
255
262
  <WrappedComponent
256
263
  component={{ data, getStaticComponentFeed }}
257
264
  store={store}
@@ -1,10 +1,10 @@
1
1
  /// <reference types="@applicaster/applicaster-types" />
2
2
  /// <reference types="@applicaster/zapp-react-native-ui-components" />
3
3
  import React, { useEffect, useMemo } from "react";
4
+
4
5
  import * as R from "ramda";
5
6
  import { Platform } from "react-native";
6
7
  import Url from "url";
7
-
8
8
  import { favoritesListener } from "@applicaster/zapp-react-native-bridge/Favorites";
9
9
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
10
10
  import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
@@ -16,9 +16,10 @@ import {
16
16
  } from "@applicaster/zapp-react-native-utils/reactHooks";
17
17
 
18
18
  import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
19
- import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
19
+ import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
20
20
 
21
21
  import { isVerticalListOrGrid } from "./utils";
22
+ import { subscribeForUrlContextKeyChanges } from "@applicaster/zapp-pipes-v2-client";
22
23
 
23
24
  type Props = {
24
25
  component: ZappUIComponent;
@@ -229,7 +230,8 @@ export function zappPipesDataConnector(
229
230
  const entryContext =
230
231
  (shouldUseNestedContext && screenContextData?.nested?.entry
231
232
  ? screenContextData?.nested?.entry
232
- : screenContextData?.entry) || {};
233
+ : (screenContextData?.entry?.payload ?? screenContextData?.entry)) ||
234
+ {};
233
235
 
234
236
  const screenContext =
235
237
  (shouldUseNestedContext && screenContextData?.nested?.screen
@@ -291,6 +293,8 @@ export function zappPipesDataConnector(
291
293
  if (addListener) {
292
294
  return addListener(reloadData);
293
295
  }
296
+ } else {
297
+ return subscribeForUrlContextKeyChanges(dataSourceUrl, {}, reloadData);
294
298
  }
295
299
  }, [dataSourceUrl, reloadData]);
296
300
 
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.0-rc.14",
3
+ "version": "13.0.0-rc.140",
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",
7
7
  "scripts": {
8
- "test": "jest -w=2",
9
8
  "build": "echo skipping hybrid typescript build for now"
10
9
  },
11
10
  "publishConfig": {
@@ -29,25 +28,28 @@
29
28
  },
30
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
31
30
  "devDependencies": {
32
- "@types/react": "17.0.2",
33
- "@types/react-native": "0.69.6",
34
31
  "redux-mock-store": "^1.5.3"
35
32
  },
36
33
  "dependencies": {
37
- "@applicaster/applicaster-types": "13.0.0-rc.14",
38
- "@applicaster/zapp-react-native-bridge": "13.0.0-rc.14",
39
- "@applicaster/zapp-react-native-redux": "13.0.0-rc.14",
40
- "@applicaster/zapp-react-native-utils": "13.0.0-rc.14",
34
+ "@applicaster/applicaster-types": "13.0.0-rc.140",
35
+ "@applicaster/zapp-react-native-bridge": "13.0.0-rc.140",
36
+ "@applicaster/zapp-react-native-redux": "13.0.0-rc.140",
37
+ "@applicaster/zapp-react-native-utils": "13.0.0-rc.140",
41
38
  "promise": "^8.3.0",
42
39
  "react-router-native": "^5.1.2",
43
40
  "url": "^0.11.0",
44
41
  "uuid": "^3.3.2"
45
42
  },
46
43
  "peerDependencies": {
44
+ "@applicaster/zapp-pipes-v2-client": "*",
47
45
  "@react-native-community/netinfo": "*",
48
- "react": "17.0.2",
49
- "react-native": "0.68.6",
46
+ "immer": "*",
47
+ "react": "*",
48
+ "react-native": "*",
50
49
  "react-native-safe-area-context": "*",
51
- "react-native-svg": "*"
50
+ "react-native-svg": "*",
51
+ "uglify-js": "*",
52
+ "validate-color": "*",
53
+ "zustand": "*"
52
54
  }
53
55
  }
package/tsconfig.json CHANGED
@@ -2,8 +2,7 @@
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
4
  "outDir": "./lib",
5
- "rootDir": "./src"
5
+ "rootDir": "./"
6
6
  },
7
- "exclude": ["src/**/*.test.tsx"],
8
- "include": ["src/**/*"]
7
+ "include": ["**/*"],
9
8
  }
package/.babelrc DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "presets": ["react-native", "flow", "react-native-stage-0/decorator-support"],
3
- "env": {
4
- "test": {
5
- "presets": [["env", { "modules": "commonjs" }], "react-native", "flow"]
6
- }
7
- }
8
- }
@@ -1,35 +0,0 @@
1
- import React from "react";
2
- import { View, Image } from "react-native";
3
-
4
- type Props = {
5
- srcImage: string;
6
- config?: {
7
- titleColor: string;
8
- summaryColor: string;
9
- backgroundColor: string;
10
- backgroundImage: string;
11
- isRTL: boolean;
12
- };
13
- };
14
-
15
- const containerStyles = {
16
- marginHorizontal: 24,
17
- };
18
-
19
- const imageStyles = {
20
- width: 400,
21
- height: 400,
22
- };
23
-
24
- export function Artwork({ srcImage }: Props) {
25
- return (
26
- <View style={containerStyles}>
27
- <Image
28
- fadeDuration={0}
29
- source={{ uri: srcImage }}
30
- style={imageStyles}
31
- resizeMode="cover"
32
- />
33
- </View>
34
- );
35
- }
@@ -1,123 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<AudioPlayer /> renders correctly 1`] = `
4
- <AudioPlayerLayout
5
- config={
6
- Object {
7
- "artworkAspectRatio": "1:1",
8
- "audioPlayerBackgroundImageQuery": "",
9
- "backgroundColor": "black",
10
- "backgroundImage": "https://example.com",
11
- "channelIcon": "https://example.com",
12
- "isRTL": true,
13
- "magicBackground": false,
14
- "runTimeFontFamily": undefined,
15
- "runTimeFontSize": undefined,
16
- "summaryColor": "white",
17
- "summaryFontFamily": undefined,
18
- "summaryFontSize": undefined,
19
- "titleColor": "white",
20
- "titleFontFamily": undefined,
21
- "titleFontSize": undefined,
22
- }
23
- }
24
- style={Object {}}
25
- >
26
- <Channel
27
- config={
28
- Object {
29
- "artworkAspectRatio": "1:1",
30
- "audioPlayerBackgroundImageQuery": "",
31
- "backgroundColor": "black",
32
- "backgroundImage": "https://example.com",
33
- "channelIcon": "https://example.com",
34
- "isRTL": true,
35
- "magicBackground": false,
36
- "runTimeFontFamily": undefined,
37
- "runTimeFontSize": undefined,
38
- "summaryColor": "white",
39
- "summaryFontFamily": undefined,
40
- "summaryFontSize": undefined,
41
- "titleColor": "white",
42
- "titleFontFamily": undefined,
43
- "titleFontSize": undefined,
44
- }
45
- }
46
- srcImage="https://example.com"
47
- />
48
- <Title
49
- config={
50
- Object {
51
- "artworkAspectRatio": "1:1",
52
- "audioPlayerBackgroundImageQuery": "",
53
- "backgroundColor": "black",
54
- "backgroundImage": "https://example.com",
55
- "channelIcon": "https://example.com",
56
- "isRTL": true,
57
- "magicBackground": false,
58
- "runTimeFontFamily": undefined,
59
- "runTimeFontSize": undefined,
60
- "summaryColor": "white",
61
- "summaryFontFamily": undefined,
62
- "summaryFontSize": undefined,
63
- "titleColor": "white",
64
- "titleFontFamily": undefined,
65
- "titleFontSize": undefined,
66
- }
67
- }
68
- title="tittle"
69
- />
70
- <Summary
71
- config={
72
- Object {
73
- "artworkAspectRatio": "1:1",
74
- "audioPlayerBackgroundImageQuery": "",
75
- "backgroundColor": "black",
76
- "backgroundImage": "https://example.com",
77
- "channelIcon": "https://example.com",
78
- "isRTL": true,
79
- "magicBackground": false,
80
- "runTimeFontFamily": undefined,
81
- "runTimeFontSize": undefined,
82
- "summaryColor": "white",
83
- "summaryFontFamily": undefined,
84
- "summaryFontSize": undefined,
85
- "titleColor": "white",
86
- "titleFontFamily": undefined,
87
- "titleFontSize": undefined,
88
- }
89
- }
90
- summary="Summary"
91
- />
92
- <Runtime
93
- audio_player_artwork_aspect_ratio="1:1"
94
- audio_player_background_color="black"
95
- audio_player_background_image="https://example.com"
96
- audio_player_channel_icon="https://example.com"
97
- audio_player_rtl={true}
98
- audio_player_summary_color="white"
99
- audio_player_title_color="white"
100
- config={
101
- Object {
102
- "artworkAspectRatio": "1:1",
103
- "audioPlayerBackgroundImageQuery": "",
104
- "backgroundColor": "black",
105
- "backgroundImage": "https://example.com",
106
- "channelIcon": "https://example.com",
107
- "isRTL": true,
108
- "magicBackground": false,
109
- "runTimeFontFamily": undefined,
110
- "runTimeFontSize": undefined,
111
- "summaryColor": "white",
112
- "summaryFontFamily": undefined,
113
- "summaryFontSize": undefined,
114
- "titleColor": "white",
115
- "titleFontFamily": undefined,
116
- "titleFontSize": undefined,
117
- }
118
- }
119
- end_time="11:11"
120
- start_time="10:10"
121
- />
122
- </AudioPlayerLayout>
123
- `;
@@ -1,50 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<AudioPlayerLayout /> renders correctly 1`] = `
4
- <View
5
- pointerEvents="none"
6
- style={
7
- Object {
8
- "backgroundColor": "transparent",
9
- "overflow": "hidden",
10
- }
11
- }
12
- >
13
- <ForwardRef(AnimatedComponentWrapper)
14
- style={
15
- Array [
16
- Object {
17
- "backgroundColor": "transparent",
18
- "overflow": "hidden",
19
- },
20
- Object {
21
- "opacity": 0,
22
- },
23
- ]
24
- }
25
- >
26
- <ImageBackground
27
- resizeMode="cover"
28
- source={
29
- Object {
30
- "uri": "https://example.com",
31
- }
32
- }
33
- style={
34
- Object {
35
- "flex": 1,
36
- }
37
- }
38
- >
39
- <View
40
- style={
41
- Object {
42
- "backgroundColor": "transparent",
43
- "overflow": "hidden",
44
- }
45
- }
46
- />
47
- </ImageBackground>
48
- </ForwardRef(AnimatedComponentWrapper)>
49
- </View>
50
- `;
@@ -1,27 +0,0 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
3
- import { shallowToJson } from "enzyme-to-json";
4
-
5
- import { AudioPlayerLayout } from "../AudioPlayerLayout";
6
-
7
- const audioPlayerLayoutProps = {
8
- artwork: "string",
9
- config: {
10
- titleColor: "white",
11
- summaryColor: "white",
12
- backgroundColor: "black",
13
- backgroundImage: "https://example.com",
14
- isRTL: true,
15
- },
16
- children: [],
17
- };
18
-
19
- jest.useFakeTimers();
20
-
21
- describe("<AudioPlayerLayout />", () => {
22
- const wrapper = shallow(<AudioPlayerLayout {...audioPlayerLayoutProps} />);
23
-
24
- it("renders correctly", () => {
25
- expect(shallowToJson(wrapper)).toMatchSnapshot();
26
- });
27
- });
@@ -1 +0,0 @@
1
- export { AudioPlayer } from "./AudioPlayer";