@applicaster/zapp-react-native-ui-components 13.0.0-alpha.7222980745 → 13.0.0-alpha.7223143213

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 (112) hide show
  1. package/Components/AppContainer/__tests__/AppContainer.test.js +4 -6
  2. package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
  3. package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
  4. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +54 -111
  5. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +36 -20
  6. package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
  7. package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
  8. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
  9. package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
  10. package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
  11. package/Components/AudioPlayer/__tests__/title.test.js +3 -5
  12. package/Components/AudioPlayer/helpers.tsx +1 -0
  13. package/Components/BaseFocusable/index.tsx +1 -2
  14. package/Components/Cell/Cell.tsx +1 -0
  15. package/Components/Cell/CellWithFocusable.tsx +2 -1
  16. package/Components/Cell/TvOSCellComponent.tsx +20 -22
  17. package/Components/Cell/index.js +3 -1
  18. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +46 -48
  19. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
  20. package/Components/ComponentResolver/__tests__/componentResolver.test.js +16 -22
  21. package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
  22. package/Components/ErrorScreen/index.tsx +6 -6
  23. package/Components/Focusable/Focusable.tsx +1 -0
  24. package/Components/Focusable/FocusableTvOS.tsx +5 -1
  25. package/Components/Focusable/index.android.tsx +10 -3
  26. package/Components/FocusableCell/index.tsx +1 -1
  27. package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
  28. package/Components/FocusableGroup/index.tsx +0 -3
  29. package/Components/FocusableList/index.tsx +26 -9
  30. package/Components/FocusableScrollView/index.tsx +43 -13
  31. package/Components/Layout/TV/NavBarContainer.tsx +19 -23
  32. package/Components/Layout/TV/ScreenContainer.tsx +8 -1
  33. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  34. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
  35. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -2
  36. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +3 -2
  37. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
  38. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
  39. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
  40. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +4 -12
  41. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +0 -229
  42. package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
  43. package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
  44. package/Components/MasterCell/utils/behaviorProvider.ts +139 -0
  45. package/Components/MasterCell/utils/index.ts +8 -134
  46. package/Components/ModalComponent/Button/index.tsx +6 -6
  47. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
  48. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
  49. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
  50. package/Components/PlayerContainer/PlayerContainer.tsx +26 -13
  51. package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
  52. package/Components/PlayerImageBackground/index.tsx +1 -1
  53. package/Components/River/ComponentsMap/ComponentsMap.tsx +3 -0
  54. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +3 -3
  55. package/Components/River/TV/index.tsx +6 -1
  56. package/Components/River/__tests__/__snapshots__/river.test.js.snap +20 -82
  57. package/Components/River/__tests__/river.test.js +75 -40
  58. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -4
  59. package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
  60. package/Components/RouteManager/__tests__/testId.test.js +8 -6
  61. package/Components/Screen/TV/index.web.tsx +5 -6
  62. package/Components/Screen/hooks.ts +3 -6
  63. package/Components/Screen/index.tsx +4 -4
  64. package/Components/ScreenResolver/__tests__/screenResolver.test.js +91 -70
  65. package/Components/Tabs/Tab.tsx +5 -3
  66. package/Components/TextInputTv/index.tsx +2 -1
  67. package/Components/TrackedView/index.tsx +1 -0
  68. package/Components/Transitioner/AnimationManager.js +15 -15
  69. package/Components/Transitioner/Scene.tsx +1 -1
  70. package/Components/Transitioner/Transitioner.tsx +3 -3
  71. package/Components/Transitioner/__tests__/Scene.test.js +25 -14
  72. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +12 -68
  73. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
  74. package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
  75. package/Components/VideoLive/PlayerLiveImageComponent.tsx +7 -3
  76. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
  77. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  78. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +44 -30
  79. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
  80. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +24 -11
  81. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +2 -2
  82. package/Components/VideoModal/PlayerDetails.tsx +9 -6
  83. package/Components/VideoModal/PlayerWrapper.tsx +2 -2
  84. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
  85. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
  86. package/Components/Viewport/__tests__/utils.test.js +5 -4
  87. package/Components/ZappUIComponent/Placeholder.tsx +3 -1
  88. package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
  89. package/Components/ZappUIComponent/index.tsx +3 -16
  90. package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
  91. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
  92. package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
  93. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  94. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  95. package/Contexts/ScreenContext/index.tsx +3 -10
  96. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  97. package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
  98. package/Decorators/Navigator/index.tsx +1 -1
  99. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +18 -24
  100. package/Decorators/RiverResolver/index.tsx +6 -8
  101. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
  102. package/Decorators/ZappPipesDataConnector/index.tsx +2 -29
  103. package/package.json +7 -10
  104. package/tsconfig.json +2 -3
  105. package/Components/Cell/CellWithFocusable.ios.tsx +0 -126
  106. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
  107. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
  108. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
  109. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
  110. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
  111. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
  112. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
@@ -1,12 +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
- import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
5
4
 
6
5
  import * as R from "ramda";
7
6
  import { Platform } from "react-native";
8
7
  import Url from "url";
9
- import { ENDPOINT_TAGS } from "@applicaster/zapp-react-native-utils/types";
10
8
  import { favoritesListener } from "@applicaster/zapp-react-native-bridge/Favorites";
11
9
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
12
10
  import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
@@ -21,12 +19,7 @@ import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-compon
21
19
  import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
22
20
 
23
21
  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
+ import { subscribeForUrlContextKeyChanges } from "@applicaster/zapp-pipes-v2-client";
30
23
 
31
24
  type Props = {
32
25
  component: ZappUIComponent;
@@ -300,27 +293,7 @@ export function zappPipesDataConnector(
300
293
  return addListener(reloadData);
301
294
  }
302
295
  } 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
- }
296
+ return subscribeForUrlContextKeyChanges(dataSourceUrl, {}, reloadData);
324
297
  }
325
298
  }, [dataSourceUrl, reloadData]);
326
299
 
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.7222980745",
3
+ "version": "13.0.0-alpha.7223143213",
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",
@@ -29,15 +29,13 @@
29
29
  },
30
30
  "homepage": "https://github.com/applicaster/quickbrick#readme",
31
31
  "devDependencies": {
32
- "@types/react": "17.0.2",
33
- "@types/react-native": "0.69.6",
34
32
  "redux-mock-store": "^1.5.3"
35
33
  },
36
34
  "dependencies": {
37
- "@applicaster/applicaster-types": "13.0.0-alpha.7222980745",
38
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.7222980745",
39
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.7222980745",
40
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.7222980745",
35
+ "@applicaster/applicaster-types": "13.0.0-alpha.7223143213",
36
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.7223143213",
37
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.7223143213",
38
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.7223143213",
41
39
  "promise": "^8.3.0",
42
40
  "react-router-native": "^5.1.2",
43
41
  "url": "^0.11.0",
@@ -46,10 +44,9 @@
46
44
  "peerDependencies": {
47
45
  "@applicaster/zapp-pipes-v2-client": "*",
48
46
  "@react-native-community/netinfo": "*",
49
- "@types/node": "*",
50
47
  "immer": "*",
51
- "react": "17.0.2",
52
- "react-native": "0.68.6",
48
+ "react": "*",
49
+ "react-native": "*",
53
50
  "react-native-safe-area-context": "*",
54
51
  "react-native-svg": "*",
55
52
  "uglify-js": "*",
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
  }
@@ -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,53 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`CellRendererResolver renders correctly 1`] = `
4
- <View
5
- someProp={
6
- {
7
- "cellOptions": {},
8
- "cellStyles": {
9
- "ABCDE-123456": {
10
- "configuration": {},
11
- "plugin_identifier": "custom_renderer_plugin",
12
- },
13
- "FGHIJ-123456": {
14
- "configuration": {},
15
- "plugin_identifier": "unknown_plugin",
16
- },
17
- },
18
- "component": {
19
- "styles": {
20
- "cell_plugin_configuration_id": "ABCDE-123456",
21
- },
22
- },
23
- "styles": {},
24
- }
25
- }
26
- />
27
- `;
28
-
29
- exports[`CellRendererResolver with a default renderer plugin renders correctly 1`] = `
30
- <View
31
- someProp={
32
- {
33
- "cellOptions": {},
34
- "cellStyles": {
35
- "ABCDE-123456": {
36
- "configuration": {},
37
- "plugin_identifier": "custom_renderer_plugin",
38
- },
39
- "FGHIJ-123456": {
40
- "configuration": {},
41
- "plugin_identifier": "unknown_plugin",
42
- },
43
- },
44
- "component": {
45
- "styles": {
46
- "cell_plugin_configuration_id": "ABCDE-123456",
47
- },
48
- },
49
- "styles": {},
50
- }
51
- }
52
- />
53
- `;
@@ -1,17 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`TestId renders correctly and assigns the testID to a wrapping view 1`] = `
4
- <View
5
- accessibilityLabel="A1234"
6
- style={
7
- {
8
- "flex": 1,
9
- }
10
- }
11
- testID="A1234"
12
- >
13
- <TestComponent
14
- name="dev test"
15
- />
16
- </View>
17
- `;
@@ -1,17 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<ScreenResolver /> renders correctly 1`] = `
4
- <mockConstructor
5
- screenData={{}}
6
- screenId="1234"
7
- screenType="screen_type_1"
8
- />
9
- `;
10
-
11
- exports[`<ScreenResolver /> wraps the player with the playerController component when the screenType is playable 1`] = `
12
- <HandlePlayable
13
- isModal={false}
14
- item={{}}
15
- mode="FULLSCREEN"
16
- />
17
- `;
@@ -1,91 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`ZappUIComponent when zapp pipes data is loading renders correctly otherwise 1`] = `
4
- <ContextProvider
5
- value={
6
- {
7
- "parent": null,
8
- }
9
- }
10
- >
11
- <LoadingComponent
12
- onLoadFinished={[MockFunction]}
13
- parent={null}
14
- zappPipesData={
15
- {
16
- "loading": true,
17
- }
18
- }
19
- />
20
- </ContextProvider>
21
- `;
22
-
23
- exports[`ZappUIComponent when zapp pipes data is loading renders null if no loading component is provided 1`] = `
24
- <ContextProvider
25
- value={
26
- {
27
- "parent": null,
28
- }
29
- }
30
- >
31
- <Placeholder
32
- onLoadFinished={[MockFunction]}
33
- parent={null}
34
- zappPipesData={
35
- {
36
- "loading": true,
37
- }
38
- }
39
- />
40
- </ContextProvider>
41
- `;
42
-
43
- exports[`ZappUIComponent when zapp pipes data returns properly renders correctly 1`] = `
44
- <ContextProvider
45
- value={
46
- {
47
- "parent": null,
48
- }
49
- }
50
- >
51
- <Component
52
- onLoadFinished={[MockFunction]}
53
- parent={null}
54
- zappPipesData={
55
- {
56
- "data": {
57
- "type": {
58
- "value": "feed",
59
- },
60
- },
61
- "loading": false,
62
- }
63
- }
64
- />
65
- </ContextProvider>
66
- `;
67
-
68
- exports[`ZappUIComponent whenn zapp pipes data returns with error renders correctly otherwise 1`] = `
69
- <ContextProvider
70
- value={
71
- {
72
- "parent": null,
73
- }
74
- }
75
- >
76
- <ErrorComponent
77
- onLoadFinished={[MockFunction]}
78
- parent={null}
79
- zappPipesData={
80
- {
81
- "error": {
82
- "message": "oups",
83
- },
84
- "loading": false,
85
- }
86
- }
87
- />
88
- </ContextProvider>
89
- `;
90
-
91
- exports[`ZappUIComponent whenn zapp pipes data returns with error renders null if no error component is provided 1`] = `""`;