@applicaster/zapp-react-native-ui-components 13.0.0-alpha.3637360334 → 13.0.0-alpha.3732093334

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 (40) hide show
  1. package/Components/AudioPlayer/AudioPlayer.tsx +0 -11
  2. package/Components/AudioPlayer/helpers.tsx +0 -2
  3. package/Components/Cell/CellWithFocusable.tsx +4 -2
  4. package/Components/Cell/CellWrapper.tsx +18 -0
  5. package/Components/CellRendererResolver/index.ts +2 -1
  6. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -0
  7. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +4 -2
  8. package/Components/GeneralContentScreen/utils/useEventAlerts.ts +30 -0
  9. package/Components/HandlePlayable/HandlePlayable.tsx +10 -3
  10. package/Components/Layout/TV/LayoutBackground.tsx +28 -0
  11. package/Components/Layout/TV/ScreenContainer.tsx +0 -1
  12. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
  13. package/Components/Layout/TV/__tests__/index.test.tsx +8 -2
  14. package/Components/Layout/TV/index.tsx +6 -20
  15. package/Components/Layout/TV/index.web.tsx +4 -1
  16. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
  17. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
  18. package/Components/ModalComponent/BottomSheetModalContent.tsx +59 -43
  19. package/Components/ModalComponent/Button/Item.tsx +6 -5
  20. package/Components/ModalComponent/Button/index.tsx +45 -62
  21. package/Components/ModalComponent/Header/index.tsx +9 -8
  22. package/Components/ModalComponent/utils.ts +55 -7
  23. package/Components/PlayerContainer/PlayerContainer.tsx +25 -2
  24. package/Components/River/RiverItem.tsx +2 -1
  25. package/Components/Screen/TV/__tests__/index.web.test.tsx +26 -0
  26. package/Components/Screen/__tests__/Screen.test.tsx +22 -14
  27. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -2
  28. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
  29. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +1 -1
  30. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +5 -2
  31. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +8 -1
  32. package/Components/VideoModal/ModalAnimation/utils.ts +4 -10
  33. package/Components/VideoModal/PlayerDetails.tsx +9 -4
  34. package/Components/VideoModal/PlayerWrapper.tsx +35 -22
  35. package/Components/VideoModal/VideoModal.tsx +19 -4
  36. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
  37. package/Components/VideoModal/utils.ts +3 -4
  38. package/Components/ZappUIComponent/index.tsx +4 -4
  39. package/package.json +5 -5
  40. package/Components/Cell/CellWrapper.ts +0 -5
@@ -74,20 +74,6 @@ const getScreenAspectRatio = () => {
74
74
  return longEdge / shortEdge;
75
75
  };
76
76
 
77
- const safeAreaStyles = (
78
- configuration: Configuration,
79
- isTablet: boolean
80
- ): ViewStyle => {
81
- const tablet_landscape_player_container_background_color =
82
- configuration?.tablet_landscape_player_container_background_color;
83
-
84
- return {
85
- backgroundColor: isTablet
86
- ? tablet_landscape_player_container_background_color
87
- : "transparent",
88
- };
89
- };
90
-
91
77
  const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
92
78
  if (isTablet) {
93
79
  return ["top"];
@@ -100,6 +86,24 @@ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
100
86
  return ["top"];
101
87
  };
102
88
 
89
+ const isPercentage = (value: string | number): boolean => {
90
+ if (typeof value === "string") {
91
+ return value.includes("%");
92
+ }
93
+
94
+ return false;
95
+ };
96
+
97
+ const getPercentageOf = (percent: string, value: number) => {
98
+ const percentageValue = parseFloat(percent.replace("%", ""));
99
+
100
+ if (isNaN(percentageValue)) {
101
+ return value;
102
+ }
103
+
104
+ return (value * percentageValue) / 100;
105
+ };
106
+
103
107
  const getTabletWidth = (
104
108
  configuration: Configuration,
105
109
  dimensions: DimensionsT
@@ -108,18 +112,23 @@ const getTabletWidth = (
108
112
  configuration?.tablet_landscape_sidebar_width;
109
113
 
110
114
  const { width } = dimensions;
115
+ let widthValue = Number(width);
116
+
117
+ if (isPercentage(width)) {
118
+ widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
119
+ }
111
120
 
112
121
  const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
113
122
 
114
123
  if (tablet_landscape_sidebar_width?.includes("%")) {
115
- return Number(width) * (1 - sidebarWidth / 100);
124
+ return widthValue * (1 - sidebarWidth / 100);
116
125
  }
117
126
 
118
127
  if (Number.isNaN(sidebarWidth)) {
119
- return Number(width) * 0.65;
128
+ return widthValue * 0.65;
120
129
  }
121
130
 
122
- return Number(width) - sidebarWidth;
131
+ return widthValue - sidebarWidth;
123
132
  };
124
133
 
125
134
  const PlayerWrapperComponent = (props: Props) => {
@@ -133,6 +142,7 @@ const PlayerWrapperComponent = (props: Props) => {
133
142
  children,
134
143
  isTabletPortrait,
135
144
  configuration,
145
+ fullscreen,
136
146
  pip,
137
147
  } = props;
138
148
 
@@ -188,14 +198,17 @@ const PlayerWrapperComponent = (props: Props) => {
188
198
  [containerDimensions, playerDimensionsHack]
189
199
  );
190
200
 
201
+ const wrapperViewStyle: ViewStyle = {
202
+ backgroundColor:
203
+ isTablet && !fullscreen
204
+ ? configuration?.tablet_landscape_player_container_background_color
205
+ : "transparent",
206
+ };
207
+
191
208
  return (
192
209
  <WrapperView
193
210
  edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
194
- style={[
195
- safeAreaStyles(configuration, isTablet),
196
- style,
197
- playerDimensionsHack,
198
- ]}
211
+ style={[wrapperViewStyle, style, playerDimensionsHack]}
199
212
  >
200
213
  <AnimationComponent
201
214
  animationType={ComponentAnimationType.moveUpComponent}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { equals } from "ramda";
3
- import { StyleSheet, StatusBar } from "react-native";
3
+ import { StyleSheet, StatusBar, View } from "react-native";
4
4
 
5
5
  import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
6
6
  import {
@@ -30,10 +30,13 @@ import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHook
30
30
  import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/configurationUtils";
31
31
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
32
32
  import { ScreenContextProvider } from "../../Contexts/ScreenContext";
33
+ import { Spinner } from "../Spinner";
33
34
  import { OpaqueLayer } from "./OpaqueLayer";
34
35
 
35
36
  import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
36
37
 
38
+ const LOADER_BACKGROUND_COLOR = "rgba(64,64,64,0.5)";
39
+
37
40
  const styles = StyleSheet.create({
38
41
  container: {
39
42
  top: 0,
@@ -42,6 +45,16 @@ const styles = StyleSheet.create({
42
45
  bottom: 0,
43
46
  position: "absolute",
44
47
  },
48
+ loaderContainer: {
49
+ top: 0,
50
+ left: 0,
51
+ right: 0,
52
+ bottom: 0,
53
+ position: "absolute",
54
+ alignItems: "center",
55
+ justifyContent: "center",
56
+ backgroundColor: LOADER_BACKGROUND_COLOR,
57
+ },
45
58
  });
46
59
 
47
60
  const VideoModalComponent = () => {
@@ -131,14 +144,12 @@ const VideoModalComponent = () => {
131
144
  {/* Hide content underneath when we switch to next video in fullscreen mode */}
132
145
  {mode === "FULLSCREEN" && <OpaqueLayer />}
133
146
 
134
- {itemIdHooksFinished === item?.id && (
147
+ {itemIdHooksFinished === item?.id ? (
135
148
  <AnimatedPlayerModalWrapper
136
149
  style={[
137
150
  styles.container,
138
151
  {
139
152
  backgroundColor,
140
- width: modalSize.width,
141
- height: modalSize.height,
142
153
  },
143
154
  ]}
144
155
  >
@@ -148,6 +159,10 @@ const VideoModalComponent = () => {
148
159
  mode={mode}
149
160
  />
150
161
  </AnimatedPlayerModalWrapper>
162
+ ) : (
163
+ <View style={styles.loaderContainer}>
164
+ <Spinner />
165
+ </View>
151
166
  )}
152
167
  </ScreenContextProvider>
153
168
  </PathnameContext.Provider>
@@ -1,43 +1,5 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`PlayerDetails renders properly 1`] = `
4
- <View
5
- collapsable={false}
6
- style={
7
- {
8
- "backgroundColor": "transparent",
9
- "flex": 1,
10
- "marginTop": -8,
11
- "paddingTop": -8,
12
- "width": 750,
13
- }
14
- }
15
- >
16
- <View
17
- feed="test-source"
18
- riverComponents={[]}
19
- riverId="test-id"
20
- />
21
- </View>
22
- `;
3
+ exports[`PlayerDetails renders properly 1`] = `null`;
23
4
 
24
- exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] = `
25
- <View
26
- collapsable={false}
27
- style={
28
- {
29
- "backgroundColor": "transparent",
30
- "flex": 1,
31
- "marginTop": -20,
32
- "paddingTop": 40,
33
- "width": 750,
34
- }
35
- }
36
- >
37
- <View
38
- feed="test-source"
39
- riverComponents={[]}
40
- riverId="test-id"
41
- />
42
- </View>
43
- `;
5
+ exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] = `null`;
@@ -1,5 +1,4 @@
1
- import * as R from "ramda";
2
-
1
+ import { mergeRight } from "ramda";
3
2
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
4
3
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
5
4
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
@@ -25,10 +24,10 @@ export const useConfiguration = () => {
25
24
 
26
25
  const playerPluginConfig = playerManager.getPluginConfiguration();
27
26
 
28
- const config = R.mergeRight(playerPluginConfig, {
27
+ const config = mergeRight(playerPluginConfig, {
28
+ ...pluginConfiguration,
29
29
  ...targetScreenConfiguration?.general,
30
30
  ...targetScreenConfiguration?.styles,
31
- ...pluginConfiguration,
32
31
  });
33
32
 
34
33
  const {
@@ -8,7 +8,6 @@ import {
8
8
 
9
9
  import { Placeholder } from "./Placeholder";
10
10
  import { useInitialLoading } from "./hooks";
11
- import { useIsFocusable } from "@applicaster/zapp-react-native-utils/focusManager";
12
11
 
13
12
  type ReactComponent = React.ComponentType<any>;
14
13
 
@@ -138,12 +137,13 @@ New signature: {Component, ErrorComponent, LoadingComponent, options}`
138
137
  );
139
138
 
140
139
  const componentProps = React.useMemo(
141
- () => ({ ...props, parent }),
140
+ () => ({
141
+ ...props,
142
+ parent,
143
+ }),
142
144
  [props, parent]
143
145
  );
144
146
 
145
- useIsFocusable(componentProps);
146
-
147
147
  React.useEffect(() => {
148
148
  if (!skipOnLoadFinished && !isLoading) {
149
149
  onLoadFinished();
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.3637360334",
3
+ "version": "13.0.0-alpha.3732093334",
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",
@@ -31,10 +31,10 @@
31
31
  "redux-mock-store": "^1.5.3"
32
32
  },
33
33
  "dependencies": {
34
- "@applicaster/applicaster-types": "13.0.0-alpha.3637360334",
35
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.3637360334",
36
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.3637360334",
37
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.3637360334",
34
+ "@applicaster/applicaster-types": "13.0.0-alpha.3732093334",
35
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.3732093334",
36
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.3732093334",
37
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.3732093334",
38
38
  "promise": "^8.3.0",
39
39
  "react-router-native": "^5.1.2",
40
40
  "url": "^0.11.0",
@@ -1,5 +0,0 @@
1
- import { isTvOSPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
2
- import React from "react";
3
- import { View } from "react-native";
4
-
5
- export const CellWrapper = isTvOSPlatform() ? View : React.Fragment;