@applicaster/zapp-react-native-ui-components 13.0.0-alpha.3334148221 → 13.0.0-alpha.3528549047

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 (101) 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/BaseFocusable/index.tsx +65 -28
  10. package/Components/Cell/Cell.tsx +10 -9
  11. package/Components/Cell/CellWithFocusable.tsx +1 -1
  12. package/Components/Cell/TvOSCellComponent.tsx +3 -8
  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/Focusable.tsx +0 -54
  19. package/Components/Focusable/FocusableTvOS.tsx +1 -1
  20. package/Components/FocusableList/index.tsx +0 -1
  21. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +76 -7
  22. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +53 -9
  23. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +1 -0
  24. package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
  25. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -3
  26. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +9 -9
  27. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  28. package/Components/Layout/TV/__tests__/index.test.tsx +7 -3
  29. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +1 -1
  30. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
  31. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  32. package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
  33. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +7 -7
  34. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +34 -34
  35. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
  36. package/Components/NativeFocusables/{index.js → index.ts} +4 -2
  37. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +7 -7
  38. package/Components/OfflineHandler/__tests__/index.test.tsx +28 -25
  39. package/Components/PlayerContainer/PlayerContainer.tsx +5 -11
  40. package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
  41. package/Components/River/RefreshControl.tsx +1 -1
  42. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +17 -17
  43. package/Components/River/__tests__/__snapshots__/river.test.js.snap +12 -12
  44. package/Components/River/__tests__/componentsMap.test.js +61 -13
  45. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -1
  46. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +1 -1
  47. package/Components/Screen/__tests__/Screen.test.tsx +41 -27
  48. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -4
  49. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +2 -2
  50. package/Components/ScreenResolver/__tests__/screenResolver.test.js +31 -27
  51. package/Components/Tabs/Tab.tsx +1 -0
  52. package/Components/TextInputTv/__tests__/TextInputTv.test.js +42 -42
  53. package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +7 -0
  54. package/Components/TextInputTv/index.tsx +2 -2
  55. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
  56. package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
  57. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +9 -9
  58. package/Components/Transitioner/__tests__/__snapshots__/config.test.js.snap +20 -20
  59. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
  60. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +12 -7
  61. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +6 -6
  62. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +5 -1
  63. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +5 -1
  64. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +1 -1
  65. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +4 -10
  66. package/Components/VideoModal/ModalAnimation/index.ts +2 -1
  67. package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
  68. package/Components/VideoModal/OpaqueLayer.tsx +33 -0
  69. package/Components/VideoModal/PlayerWrapper.tsx +16 -35
  70. package/Components/VideoModal/VideoModal.tsx +14 -23
  71. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
  72. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +13 -10
  73. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +4 -4
  74. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +66 -156
  75. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
  76. package/Components/VideoModal/hooks/index.ts +7 -0
  77. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
  78. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
  79. package/Components/VideoModal/hooks/utils/index.ts +33 -0
  80. package/Components/VideoModal/utils.ts +3 -5
  81. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +2 -2
  82. package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
  83. package/Components/ZappFrameworkComponents/BarView/BarView.tsx +1 -0
  84. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +11 -11
  85. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +30 -30
  86. package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
  87. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +18 -11
  88. package/Decorators/Analytics/{index.js → index.tsx} +11 -11
  89. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +2 -2
  90. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +77 -77
  91. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +34 -39
  92. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -9
  93. package/Decorators/RiverFeedLoader/index.tsx +1 -1
  94. package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +39 -0
  95. package/Decorators/RiverFeedLoader/utils/index.ts +29 -0
  96. package/Decorators/RiverFeedLoader/utils/usePipesContexts.ts +40 -0
  97. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +5 -5
  98. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +16 -10
  99. package/Decorators/ZappPipesDataConnector/index.tsx +32 -2
  100. package/package.json +12 -6
  101. package/Decorators/RiverFeedLoader/utils.ts +0 -100
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { shallow } from "enzyme";
3
3
  import { View } from "react-native";
4
4
  import { shallowToJson } from "enzyme-to-json";
5
- import * as navigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
5
+ import * as usePathnameHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation/usePathname";
6
6
 
7
7
  const rivers = {
8
8
  A123: {
@@ -13,15 +13,21 @@ const rivers = {
13
13
  },
14
14
  };
15
15
 
16
- jest.doMock("@applicaster/zapp-react-native-redux/hooks", () => ({
17
- usePickFromState: jest.fn(() => ({ rivers })),
18
- }));
19
-
20
- jest.mock("@applicaster/zapp-react-native-utils/reactHooks/layout", () => ({
21
- useLayoutVersion: jest.fn(() => true),
22
- }));
23
-
24
- jest.spyOn(navigationHooks, "usePathname").mockReturnValue("/home");
16
+ jest.doMock(
17
+ "@applicaster/zapp-react-native-redux/hooks/usePickFromState",
18
+ () => ({
19
+ usePickFromState: jest.fn(() => ({ rivers })),
20
+ })
21
+ );
22
+
23
+ jest.mock(
24
+ "@applicaster/zapp-react-native-utils/reactHooks/layout/useLayoutVersion",
25
+ () => ({
26
+ useLayoutVersion: jest.fn(() => true),
27
+ })
28
+ );
29
+
30
+ jest.spyOn(usePathnameHooks, "usePathname").mockReturnValue("/home");
25
31
 
26
32
  // mocks useNavigator to return currentRoute: "/home"
27
33
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
@@ -1,10 +1,12 @@
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
+ import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
5
+
4
6
  import * as R from "ramda";
5
7
  import { Platform } from "react-native";
6
8
  import Url from "url";
7
-
9
+ import { ENDPOINT_TAGS } from "@applicaster/zapp-react-native-utils/types";
8
10
  import { favoritesListener } from "@applicaster/zapp-react-native-bridge/Favorites";
9
11
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
10
12
  import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
@@ -16,9 +18,15 @@ import {
16
18
  } from "@applicaster/zapp-react-native-utils/reactHooks";
17
19
 
18
20
  import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
19
- import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
21
+ import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
20
22
 
21
23
  import { isVerticalListOrGrid } from "./utils";
24
+ import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
25
+ import {
26
+ findEndpointForURL,
27
+ HTTP_METHODS,
28
+ } from "@applicaster/zapp-pipes-v2-client";
29
+ import { getNamespaceAndKey } from "@applicaster/zapp-react-native-utils/appUtils/contextKeysManager/utils";
22
30
 
23
31
  type Props = {
24
32
  component: ZappUIComponent;
@@ -291,6 +299,28 @@ export function zappPipesDataConnector(
291
299
  if (addListener) {
292
300
  return addListener(reloadData);
293
301
  }
302
+ } else {
303
+ const pipesEndpoints = appStore.get("pipesEndpoints");
304
+
305
+ const endpointURL = findEndpointForURL(
306
+ dataSourceUrl,
307
+ pipesEndpoints,
308
+ HTTP_METHODS.GET
309
+ );
310
+
311
+ const endpoint = pipesEndpoints?.[endpointURL];
312
+
313
+ if (endpoint?.tags?.includes(ENDPOINT_TAGS.observe_storage)) {
314
+ const subscriptions: (() => void)[] = endpoint.context_obj.map(
315
+ (data: Record<string, any>) => {
316
+ const { namespace, key } = getNamespaceAndKey(data.key);
317
+
318
+ return localStorage.addListener({ key, namespace }, reloadData);
319
+ }
320
+ );
321
+
322
+ return () => subscriptions.forEach((listener) => listener());
323
+ }
294
324
  }
295
325
  }, [dataSourceUrl, reloadData]);
296
326
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.0-alpha.3334148221",
3
+ "version": "13.0.0-alpha.3528549047",
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": "13.0.0-alpha.3334148221",
38
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.3334148221",
39
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.3334148221",
40
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.3334148221",
37
+ "@applicaster/applicaster-types": "13.0.0-alpha.3528549047",
38
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.3528549047",
39
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.3528549047",
40
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.3528549047",
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,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
- }