@applicaster/zapp-react-native-ui-components 15.1.0-rc.9 → 16.0.0-alpha.1833861900

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 (155) hide show
  1. package/Components/BackgroundImage/BackgroundImage.tsx +42 -0
  2. package/Components/BackgroundImage/BackgroundImage.tv.android.tsx +28 -0
  3. package/Components/BackgroundImage/BackgroundImage.tv.ios.tsx +24 -0
  4. package/Components/BackgroundImage/index.ts +1 -0
  5. package/Components/BaseFocusable/index.ios.ts +12 -2
  6. package/Components/Cell/FocusableWrapper.tsx +3 -0
  7. package/Components/Cell/TvOSCellComponent.tsx +6 -3
  8. package/Components/Focusable/Focusable.tsx +4 -2
  9. package/Components/Focusable/FocusableTvOS.tsx +18 -1
  10. package/Components/Focusable/__tests__/__snapshots__/FocusableTvOS.test.tsx.snap +1 -0
  11. package/Components/FocusableGroup/FocusableTvOS.tsx +41 -8
  12. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +1 -1
  13. package/Components/HandlePlayable/HandlePlayable.tsx +13 -8
  14. package/Components/Layout/TV/NavBarContainer.tsx +1 -10
  15. package/Components/Layout/TV/ScreenContainer.tsx +2 -6
  16. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +7 -12
  17. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +7 -12
  18. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +0 -1
  19. package/Components/Layout/TV/index.tsx +5 -7
  20. package/Components/Layout/TV/index.web.tsx +5 -7
  21. package/Components/LinkHandler/LinkHandler.tsx +2 -2
  22. package/Components/MasterCell/CONFIG_BUILDER_TO_REACT_COMPONENT.md +144 -0
  23. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +16 -5
  24. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/model.test.ts +80 -0
  25. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/placement.test.ts +187 -0
  26. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/selectors.test.ts +45 -0
  27. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/style.test.ts +49 -0
  28. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/ActionButtonController.tsx +165 -0
  29. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/__tests__/ActionButtonController.test.tsx +405 -0
  30. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/index.ts +1 -0
  31. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/model.ts +47 -0
  32. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/placement.ts +170 -0
  33. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/selectors.ts +26 -0
  34. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/style.ts +29 -0
  35. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/types.ts +37 -0
  36. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -10
  37. package/Components/MasterCell/DefaultComponents/Button.tsx +0 -15
  38. package/Components/MasterCell/DefaultComponents/ButtonContainerView/components/HorizontalSeparator.tsx +8 -0
  39. package/Components/MasterCell/DefaultComponents/ButtonContainerView/index.tsx +15 -0
  40. package/Components/MasterCell/DefaultComponents/ButtonContainerView/index.tv.android.tsx +58 -0
  41. package/Components/MasterCell/DefaultComponents/{tv/ButtonContainerView/index.tsx → ButtonContainerView/index.tv.tsx} +3 -11
  42. package/Components/MasterCell/DefaultComponents/ButtonContainerView/index.web.ts +1 -0
  43. package/Components/MasterCell/DefaultComponents/ButtonContainerView/types.ts +40 -0
  44. package/Components/MasterCell/DefaultComponents/DataProvider/index.tsx +163 -0
  45. package/Components/MasterCell/DefaultComponents/FocusableView/index.android.tsx +2 -23
  46. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -22
  47. package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +8 -2
  48. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +11 -3
  49. package/Components/MasterCell/DefaultComponents/Image/Image.web.tsx +9 -1
  50. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +15 -14
  51. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +1 -2
  52. package/Components/MasterCell/DefaultComponents/PressableView.tsx +34 -0
  53. package/Components/MasterCell/DefaultComponents/SecondaryImage/hooks/__tests__/useGetImageDimensions.test.ts +7 -6
  54. package/Components/MasterCell/DefaultComponents/Text/hooks/useText.ts +11 -0
  55. package/Components/MasterCell/DefaultComponents/__tests__/DataProvider.test.tsx +141 -0
  56. package/Components/MasterCell/DefaultComponents/index.ts +9 -3
  57. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/ActionButton.tsx +135 -0
  58. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Asset.ts +33 -0
  59. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/AssetComponent.tsx +22 -0
  60. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Button.ts +125 -0
  61. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Spacer.ts +16 -0
  62. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/TextLabel.ts +67 -0
  63. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/TextLabelsContainer.ts +37 -0
  64. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/PressableView.test.tsx +393 -0
  65. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/builders.test.ts +141 -0
  66. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/index.test.ts +343 -0
  67. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/helpers.ts +105 -0
  68. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/index.ts +122 -0
  69. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/__tests__/insertButtons.test.ts +118 -0
  70. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/index.ts +238 -0
  71. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/Asset.ts +4 -18
  72. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/Button.ts +24 -73
  73. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/TextLabelsContainer.ts +37 -18
  74. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/TvActionButton.tsx +27 -0
  75. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/__tests__/index.test.ts +89 -0
  76. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/__tests__/renderedTree.test.tsx +231 -0
  77. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +47 -48
  78. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/__tests__/getPluginIdentifier.test.ts +115 -29
  79. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/index.ts +101 -144
  80. package/Components/MasterCell/MappingFunctions/index.js +3 -2
  81. package/Components/MasterCell/README.md +4 -0
  82. package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +24 -0
  83. package/Components/MasterCell/__tests__/configInflater.test.js +1 -0
  84. package/Components/MasterCell/__tests__/elementMapper.test.js +46 -0
  85. package/Components/MasterCell/dataAdapter.ts +4 -1
  86. package/Components/MasterCell/elementMapper.tsx +52 -7
  87. package/Components/MasterCell/utils/__tests__/cloneChildrenWithIds.test.tsx +43 -0
  88. package/Components/MasterCell/utils/__tests__/useFilterChildren.test.tsx +80 -0
  89. package/Components/MasterCell/utils/index.ts +85 -15
  90. package/Components/OfflineHandler/NotificationView/NotificationView.tsx +2 -2
  91. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +17 -18
  92. package/Components/OfflineHandler/__tests__/index.test.tsx +27 -18
  93. package/Components/PlayerContainer/PlayerContainer.tsx +8 -5
  94. package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +284 -0
  95. package/Components/River/ComponentsMap/ComponentsMap.tsx +6 -19
  96. package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +1 -1
  97. package/Components/River/RefreshControl.tsx +19 -88
  98. package/Components/River/River.tsx +9 -82
  99. package/Components/River/TV/River.tsx +31 -14
  100. package/Components/River/TV/index.tsx +8 -4
  101. package/Components/River/TV/utils/__tests__/toStringOrEmpty.test.ts +30 -0
  102. package/Components/River/TV/utils/index.ts +4 -0
  103. package/Components/River/TV/withFocusableGroupForContent.tsx +71 -0
  104. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -0
  105. package/Components/River/__tests__/componentsMap.test.js +38 -0
  106. package/Components/River/hooks/__tests__/usePullToRefresh.test.ts +132 -0
  107. package/Components/River/hooks/index.ts +1 -0
  108. package/Components/River/hooks/usePullToRefresh.ts +51 -0
  109. package/Components/Screen/TV/index.web.tsx +4 -2
  110. package/Components/Screen/__tests__/Screen.test.tsx +65 -42
  111. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +68 -44
  112. package/Components/Screen/hooks.ts +2 -3
  113. package/Components/Screen/index.tsx +2 -3
  114. package/Components/Screen/orientationHandler.ts +3 -3
  115. package/Components/ScreenResolver/index.tsx +9 -5
  116. package/Components/ScreenRevealManager/Overlay.tsx +34 -0
  117. package/Components/ScreenRevealManager/ScreenRevealManager.ts +40 -8
  118. package/Components/ScreenRevealManager/__tests__/Overlay.test.tsx +88 -0
  119. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +86 -69
  120. package/Components/ScreenRevealManager/withScreenRevealManager.tsx +9 -20
  121. package/Components/Tabs/TabContent.tsx +7 -4
  122. package/Components/TopCutoffOverlay/__tests__/TopCutoffOverlay.test.tsx +201 -0
  123. package/Components/TopCutoffOverlay/hooks/__tests__/useMarginTop.test.ts +130 -0
  124. package/Components/TopCutoffOverlay/hooks/index.ts +1 -0
  125. package/Components/TopCutoffOverlay/hooks/useMarginTop.ts +59 -0
  126. package/Components/TopCutoffOverlay/index.tsx +55 -0
  127. package/Components/Transitioner/index.js +3 -3
  128. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +5 -5
  129. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +15 -7
  130. package/Components/VideoModal/utils.ts +12 -10
  131. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +0 -2
  132. package/Components/Viewport/ViewportAware/index.tsx +16 -7
  133. package/Components/Viewport/ViewportEvents/__tests__/viewportEvents.test.js +1 -1
  134. package/Components/ZappFrameworkComponents/BarView/BarView.tsx +4 -6
  135. package/Components/ZappFrameworkComponents/BarView/__tests__/BarView.test.tsx +2 -2
  136. package/Components/default-cell-renderer/viewTrees/mobile/index.ts +0 -3
  137. package/Contexts/ScreenContext/index.tsx +25 -18
  138. package/Contexts/ScreenTrackedViewPositionsContext/__tests__/index.test.tsx +1 -1
  139. package/Decorators/Analytics/index.tsx +6 -5
  140. package/Decorators/ConfigurationWrapper/__tests__/__snapshots__/withConfigurationProvider.test.tsx.snap +1 -0
  141. package/Decorators/ConfigurationWrapper/const.ts +1 -0
  142. package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +39 -21
  143. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +1 -1
  144. package/Decorators/ZappPipesDataConnector/index.tsx +2 -2
  145. package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +1 -1
  146. package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +18 -7
  147. package/Helpers/DataSourceHelper/__tests__/itemLimitForData.test.ts +80 -0
  148. package/Helpers/DataSourceHelper/index.ts +19 -0
  149. package/Helpers/index.js +7 -1
  150. package/package.json +5 -5
  151. package/Components/Layout/TV/LayoutBackground.tsx +0 -28
  152. package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +0 -135
  153. package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/types.ts +0 -25
  154. package/Components/River/TV/withTVEventHandler.tsx +0 -36
  155. package/Helpers/DataSourceHelper/index.js +0 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "15.1.0-rc.9",
3
+ "version": "16.0.0-alpha.1833861900",
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.1.0-rc.9",
32
- "@applicaster/zapp-react-native-bridge": "15.1.0-rc.9",
33
- "@applicaster/zapp-react-native-redux": "15.1.0-rc.9",
34
- "@applicaster/zapp-react-native-utils": "15.1.0-rc.9",
31
+ "@applicaster/applicaster-types": "16.0.0-alpha.1833861900",
32
+ "@applicaster/zapp-react-native-bridge": "16.0.0-alpha.1833861900",
33
+ "@applicaster/zapp-react-native-redux": "16.0.0-alpha.1833861900",
34
+ "@applicaster/zapp-react-native-utils": "16.0.0-alpha.1833861900",
35
35
  "fast-json-stable-stringify": "^2.1.0",
36
36
  "promise": "^8.3.0",
37
37
  "url": "^0.11.0",
@@ -1,28 +0,0 @@
1
- import React from "react";
2
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
3
- import { getBackgroundImageUrl } from "../utils";
4
- import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
5
-
6
- export const LayoutBackground = ({
7
- Background,
8
- children,
9
- }: {
10
- Background: React.ComponentType<any>;
11
- children: React.ReactNode;
12
- }) => {
13
- const theme = useTheme();
14
-
15
- const { remoteConfigurations } = usePickFromState(["remoteConfigurations"]);
16
-
17
- const backgroundColor = theme.app_background_color;
18
- const backgroundImageUrl = getBackgroundImageUrl(remoteConfigurations);
19
-
20
- return (
21
- <Background
22
- backgroundColor={backgroundColor}
23
- backgroundImageUrl={backgroundImageUrl}
24
- >
25
- {children}
26
- </Background>
27
- );
28
- };
@@ -1,135 +0,0 @@
1
- import React from "react";
2
- import { View, ButtonProps } from "react-native";
3
- import { Focusable } from "@applicaster/zapp-react-native-ui-components/Components/Focusable";
4
- import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
5
- import * as R from "ramda";
6
- import { useInitialFocus } from "@applicaster/zapp-react-native-utils/focusManager";
7
- import { getXray } from "@applicaster/zapp-react-native-utils/logger";
8
- import { useFocusable } from "@applicaster/zapp-react-native-ui-components/Components/Focusable/index.android";
9
- import {
10
- useIsRTL,
11
- applyRTLStylesIfNeeded,
12
- } from "@applicaster/zapp-react-native-utils/localizationUtils";
13
-
14
- const { Logger } = getXray();
15
-
16
- import {
17
- cloneElementsWithIds,
18
- insertBetween,
19
- recursiveCloneElementsWithState,
20
- useFilterChildren,
21
- } from "../../../utils";
22
-
23
- import type {
24
- HorizontalSeparatorProps,
25
- ContainerProps,
26
- ContainerChildren,
27
- } from "./types";
28
-
29
- const logger = new Logger("plugin", "plugins/navigation-action");
30
-
31
- const generateId = (cellUUID, suffixId) => `${cellUUID}--${suffixId}`;
32
-
33
- const HorizontalSeparator = ({ width }: HorizontalSeparatorProps) => (
34
- <View style={{ width }} />
35
- );
36
-
37
- export function ButtonContainerView({
38
- style,
39
- children,
40
- ...otherProps
41
- }: ContainerProps) {
42
- const isRTL = useIsRTL();
43
-
44
- const horizontalGutter = R.pathOr(0, ["horizontalGutter"], otherProps);
45
-
46
- const filteredChildren = useFilterChildren<ContainerChildren>(children);
47
-
48
- const buttonIds = filteredChildren.map((child) => {
49
- const { cellUUID, suffixId } = child.props;
50
-
51
- return generateId(cellUUID, suffixId);
52
- });
53
-
54
- useInitialFocus(otherProps.state === "focused", R.head(buttonIds));
55
-
56
- if (R.isEmpty(filteredChildren)) {
57
- return null;
58
- }
59
-
60
- return (
61
- <View style={applyRTLStylesIfNeeded(style, isRTL)}>
62
- {insertBetween(
63
- (index) => (
64
- <HorizontalSeparator
65
- key={`separator_${index}`}
66
- width={horizontalGutter}
67
- />
68
- ),
69
- cloneElementsWithIds(buttonIds, filteredChildren)
70
- )}
71
- </View>
72
- );
73
- }
74
-
75
- export function FocusableViewComponent(
76
- { style, children, item, ...otherProps }: ButtonProps,
77
- ref
78
- ) {
79
- const {
80
- cellUUID,
81
- groupId,
82
- suffixId,
83
- normalStyles,
84
- focusedStyles,
85
- nextFocusLeft,
86
- nextFocusRight,
87
- pluginIdentifier,
88
- disableFocus,
89
- } = otherProps;
90
-
91
- const parentFocus = useFocusable();
92
-
93
- const actionContext = useActions(pluginIdentifier);
94
-
95
- const onPress = () => {
96
- if (!actionContext) {
97
- logger.warning(
98
- `Cannot resolve action context for ${pluginIdentifier} - please make sure the plugin is installed and up to date`
99
- );
100
-
101
- return;
102
- }
103
-
104
- actionContext?.invokeAction?.(item);
105
- };
106
-
107
- return (
108
- <Focusable
109
- id={generateId(cellUUID, suffixId)}
110
- disableFocus={disableFocus}
111
- groupId={groupId}
112
- onPress={onPress}
113
- nextFocusUp={parentFocus?.nextFocusUp}
114
- nextFocusDown={parentFocus?.nextFocusDown}
115
- nextFocusLeft={nextFocusLeft || parentFocus?.nextFocusLeft}
116
- nextFocusRight={nextFocusRight || parentFocus?.nextFocusRight}
117
- ref={ref}
118
- >
119
- {(isFocused) => {
120
- const additionalStyles = isFocused ? focusedStyles : normalStyles;
121
-
122
- return (
123
- <View
124
- style={{
125
- ...style,
126
- ...additionalStyles,
127
- }}
128
- >
129
- {recursiveCloneElementsWithState(isFocused, children)}
130
- </View>
131
- );
132
- }}
133
- </Focusable>
134
- );
135
- }
@@ -1,25 +0,0 @@
1
- import { ImageStyle } from "react-native";
2
-
3
- export type ContainerProps = Record<string, any> & {
4
- buttonsToggleEnabled: boolean;
5
- skipButtons: boolean;
6
- style: ImageStyle;
7
- children: ContainerChildren[];
8
- };
9
-
10
- export type ButtonProps = Record<string, any> & {
11
- style: ImageStyle;
12
- };
13
-
14
- export type HorizontalSeparatorProps = {
15
- width: number;
16
- };
17
-
18
- export type ContainerChildren = {
19
- props: {
20
- item: any;
21
- pluginIdentifier: string;
22
- cellUUID: string;
23
- suffixId: string;
24
- };
25
- };
@@ -1,36 +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
- import { useIsStandaloneFullscreen } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
7
-
8
- export const withTvEventHandler = (Component) => {
9
- return function WithTVEventHandler(props) {
10
- const navigator = useNavigation();
11
-
12
- const isStandaloneFullscreen = useIsStandaloneFullscreen();
13
-
14
- const remoteHandler = (event) => {
15
- const { eventType } = event;
16
-
17
- const canGoBack = navigator.canGoBack();
18
-
19
- if (eventType === "menu" && isStandaloneFullscreen) {
20
- navigator.goHome();
21
-
22
- return;
23
- }
24
-
25
- if (eventType === "menu" && canGoBack) {
26
- navigator.goBack();
27
- }
28
- };
29
-
30
- return (
31
- <TVEventHandlerComponent tvEventHandler={remoteHandler}>
32
- <Component {...props} />
33
- </TVEventHandlerComponent>
34
- );
35
- };
36
- };
@@ -1,19 +0,0 @@
1
- import * as R from "ramda";
2
-
3
- export function itemLimitForData(entry = [], component) {
4
- const itemLimitValue = Number(R.path(["rules", "item_limit"], component));
5
-
6
- const itemLimit =
7
- itemLimitValue && itemLimitValue > 0
8
- ? itemLimitValue
9
- : Number.MAX_SAFE_INTEGER;
10
-
11
- const isInRange = (min, max) => R.both(R.gte(R.__, min), R.lt(R.__, max));
12
-
13
- const entryShouldBeSliced = (entry) =>
14
- isInRange(0, R.length(entry))(itemLimit);
15
-
16
- const sliceEntriesUpToItemLimit = R.slice(0, itemLimit);
17
-
18
- return R.when(entryShouldBeSliced, sliceEntriesUpToItemLimit)(entry);
19
- }