@applicaster/zapp-react-native-ui-components 13.0.0-rc.13 → 13.0.0-rc.130

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 (212) 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/AudioPlayer.tsx +5 -9
  4. package/Components/AudioPlayer/AudioPlayerLayout.tsx +6 -7
  5. package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
  6. package/Components/AudioPlayer/__tests__/__snapshots__/Runtime.test.js.snap +4 -4
  7. package/Components/AudioPlayer/__tests__/__snapshots__/artWork.test.js.snap +3 -3
  8. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +56 -113
  9. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +39 -23
  10. package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +3 -3
  11. package/Components/AudioPlayer/__tests__/__snapshots__/summary.test.js.snap +2 -2
  12. package/Components/AudioPlayer/__tests__/__snapshots__/title.test.js.snap +2 -2
  13. package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
  14. package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
  15. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
  16. package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
  17. package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
  18. package/Components/AudioPlayer/__tests__/title.test.js +3 -5
  19. package/Components/AudioPlayer/helpers.tsx +1 -2
  20. package/Components/BaseFocusable/index.ios.ts +1 -1
  21. package/Components/BaseFocusable/index.tsx +67 -31
  22. package/Components/Cell/Cell.tsx +14 -14
  23. package/Components/Cell/CellWithFocusable.tsx +50 -59
  24. package/Components/Cell/CellWrapper.tsx +18 -0
  25. package/Components/Cell/TvOSCellComponent.tsx +20 -26
  26. package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
  27. package/Components/Cell/index.js +3 -1
  28. package/Components/Cell/styles.ts +17 -0
  29. package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +50 -50
  30. package/Components/CellRendererResolver/index.ts +2 -1
  31. package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
  32. package/Components/ComponentResolver/__tests__/componentResolver.test.js +26 -30
  33. package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
  34. package/Components/DisplayState/__tests__/__snapshots__/displayState.test.js.snap +2 -2
  35. package/Components/ErrorScreen/index.tsx +14 -6
  36. package/Components/Focusable/Focusable.tsx +1 -54
  37. package/Components/Focusable/FocusableTvOS.tsx +6 -2
  38. package/Components/Focusable/Touchable.tsx +19 -20
  39. package/Components/Focusable/index.android.tsx +10 -3
  40. package/Components/FocusableCell/index.tsx +1 -1
  41. package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
  42. package/Components/FocusableGroup/index.tsx +0 -3
  43. package/Components/FocusableList/index.tsx +26 -10
  44. package/Components/FocusableScrollView/index.tsx +43 -13
  45. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -0
  46. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +9 -0
  47. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +5 -3
  48. package/Components/GeneralContentScreen/utils/useEventAlerts.ts +30 -0
  49. package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
  50. package/Components/Layout/TV/LayoutBackground.tsx +28 -0
  51. package/Components/Layout/TV/NavBarContainer.tsx +19 -23
  52. package/Components/Layout/TV/ScreenContainer.tsx +8 -2
  53. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  54. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +3 -1
  55. package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
  56. package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +6 -5
  57. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +12 -11
  58. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
  59. package/Components/Layout/TV/__tests__/index.test.tsx +14 -4
  60. package/Components/Layout/TV/index.tsx +6 -20
  61. package/Components/Layout/TV/index.web.tsx +4 -1
  62. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
  63. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
  64. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
  65. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +10 -15
  66. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
  67. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
  68. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
  69. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
  70. package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
  71. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  72. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
  73. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
  74. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +1 -1
  75. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
  76. package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
  77. package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +11 -19
  78. package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +6 -235
  79. package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
  80. package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
  81. package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
  82. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +2 -2
  83. package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
  84. package/Components/MasterCell/utils/index.ts +9 -135
  85. package/Components/ModalComponent/BottomSheetModalContent.tsx +66 -54
  86. package/Components/ModalComponent/Button/Item.tsx +6 -5
  87. package/Components/ModalComponent/Button/assets.ts +1 -1
  88. package/Components/ModalComponent/Button/index.tsx +45 -62
  89. package/Components/ModalComponent/Header/index.tsx +12 -11
  90. package/Components/ModalComponent/utils.ts +55 -7
  91. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
  92. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
  93. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
  94. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +7 -7
  95. package/Components/OfflineHandler/__tests__/index.test.tsx +28 -25
  96. package/Components/OfflineHandler/utils/index.ts +1 -1
  97. package/Components/PlayerContainer/PlayerContainer.tsx +49 -29
  98. package/Components/PlayerContainer/PlayerContainerContext.tsx +9 -0
  99. package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
  100. package/Components/PlayerImageBackground/index.tsx +1 -1
  101. package/Components/River/ComponentsMap/ComponentsMap.tsx +53 -68
  102. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
  103. package/Components/River/RefreshControl.tsx +1 -1
  104. package/Components/River/RiverFooter.tsx +39 -9
  105. package/Components/River/RiverItem.tsx +43 -3
  106. package/Components/River/TV/index.tsx +6 -1
  107. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +121 -46
  108. package/Components/River/__tests__/__snapshots__/river.test.js.snap +21 -83
  109. package/Components/River/__tests__/componentsMap.test.js +64 -17
  110. package/Components/River/__tests__/river.test.js +75 -40
  111. package/Components/RouteManager/TestId.tsx +1 -5
  112. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -5
  113. package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
  114. package/Components/RouteManager/__tests__/testId.test.js +4 -6
  115. package/Components/Screen/TV/__tests__/index.web.test.tsx +26 -0
  116. package/Components/Screen/TV/index.web.tsx +5 -6
  117. package/Components/Screen/__tests__/Screen.test.tsx +53 -31
  118. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +6 -6
  119. package/Components/Screen/hooks.ts +53 -0
  120. package/Components/Screen/index.tsx +16 -42
  121. package/Components/ScreenResolver/__tests__/screenResolver.test.js +95 -70
  122. package/Components/Tabs/Tab.tsx +12 -9
  123. package/Components/TextInputTv/__tests__/TextInputTv.test.js +42 -42
  124. package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +7 -0
  125. package/Components/TextInputTv/index.tsx +6 -5
  126. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
  127. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
  128. package/Components/TrackedView/index.tsx +1 -0
  129. package/Components/Transitioner/AnimationManager.js +15 -15
  130. package/Components/Transitioner/Scene.tsx +53 -24
  131. package/Components/Transitioner/Transitioner.tsx +3 -3
  132. package/Components/Transitioner/__tests__/Scene.test.js +25 -14
  133. package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
  134. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +10 -50
  135. package/Components/Transitioner/__tests__/__snapshots__/config.test.js.snap +20 -20
  136. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +4 -4
  137. package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
  138. package/Components/Transitioner/index.js +8 -4
  139. package/Components/VideoLive/LiveImageManager.ts +27 -1
  140. package/Components/VideoLive/PlayerLiveImageComponent.tsx +36 -24
  141. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -8
  142. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +6 -10
  143. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  144. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +51 -31
  145. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +8 -4
  146. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +48 -23
  147. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +16 -15
  148. package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
  149. package/Components/VideoModal/ModalAnimation/const.ts +5 -0
  150. package/Components/VideoModal/ModalAnimation/index.ts +4 -1
  151. package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
  152. package/Components/VideoModal/ModalAnimation/utils.ts +32 -2
  153. package/Components/VideoModal/OpaqueLayer.tsx +33 -0
  154. package/Components/VideoModal/PlayerDetails.tsx +18 -10
  155. package/Components/VideoModal/PlayerWrapper.tsx +51 -57
  156. package/Components/VideoModal/VideoModal.tsx +17 -11
  157. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
  158. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +13 -10
  159. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
  160. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +66 -156
  161. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
  162. package/Components/VideoModal/hooks/index.ts +7 -0
  163. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
  164. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
  165. package/Components/VideoModal/hooks/utils/index.ts +33 -0
  166. package/Components/VideoModal/utils.ts +6 -9
  167. package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
  168. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
  169. package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
  170. package/Components/Viewport/__tests__/utils.test.js +5 -4
  171. package/Components/ZappUIComponent/Placeholder.tsx +3 -1
  172. package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
  173. package/Components/ZappUIComponent/index.tsx +4 -17
  174. package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
  175. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
  176. package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
  177. package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
  178. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  179. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  180. package/Contexts/ScreenContext/index.tsx +6 -12
  181. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  182. package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
  183. package/Decorators/Navigator/index.tsx +1 -1
  184. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +77 -77
  185. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +34 -39
  186. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -9
  187. package/Decorators/RiverFeedLoader/index.tsx +1 -1
  188. package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +39 -0
  189. package/Decorators/RiverFeedLoader/utils/index.ts +29 -0
  190. package/Decorators/RiverFeedLoader/utils/usePipesContexts.ts +40 -0
  191. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +27 -27
  192. package/Decorators/RiverResolver/index.tsx +6 -8
  193. package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
  194. package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
  195. package/Decorators/ZappPipesDataConnector/index.tsx +7 -3
  196. package/package.json +13 -11
  197. package/tsconfig.json +2 -3
  198. package/.babelrc +0 -8
  199. package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
  200. package/Components/Cell/CellStyles/Hero/index.js +0 -111
  201. package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
  202. package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
  203. package/Components/Cell/CellStyles/colors.js +0 -40
  204. package/Components/Cell/CellStyles/index.js +0 -15
  205. package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
  206. package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
  207. package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
  208. package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
  209. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
  210. package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
  211. package/Decorators/RiverFeedLoader/utils.ts +0 -100
  212. package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
@@ -4,8 +4,8 @@ exports[`PlayerWrapper renders inline 1`] = `
4
4
  <RNCSafeAreaProvider
5
5
  onInsetsChange={[Function]}
6
6
  style={
7
- Array [
8
- Object {
7
+ [
8
+ {
9
9
  "flex": 1,
10
10
  },
11
11
  undefined,
@@ -14,7 +14,7 @@ exports[`PlayerWrapper renders inline 1`] = `
14
14
  >
15
15
  <RNCSafeAreaView
16
16
  edges={
17
- Object {
17
+ {
18
18
  "bottom": "off",
19
19
  "left": "off",
20
20
  "right": "off",
@@ -22,31 +22,31 @@ exports[`PlayerWrapper renders inline 1`] = `
22
22
  }
23
23
  }
24
24
  style={
25
- Array [
26
- Object {
25
+ [
26
+ {
27
27
  "backgroundColor": "transparent",
28
28
  },
29
- Object {
29
+ {
30
30
  "height": 800,
31
31
  "width": 300,
32
32
  },
33
- Object {},
33
+ {},
34
34
  ]
35
35
  }
36
36
  >
37
37
  <View
38
38
  additionalData={
39
- Object {
39
+ {
40
40
  "saveArea": true,
41
41
  }
42
42
  }
43
43
  animationType="moveUpComponent"
44
44
  style={
45
- Array [
46
- Object {
45
+ [
46
+ {
47
47
  "flexDirection": "column",
48
48
  },
49
- Object {
49
+ {
50
50
  "flex": 1,
51
51
  },
52
52
  ]
@@ -54,53 +54,23 @@ exports[`PlayerWrapper renders inline 1`] = `
54
54
  >
55
55
  <View
56
56
  style={
57
- Array [
58
- Object {
57
+ [
58
+ {
59
59
  "alignSelf": "center",
60
60
  "position": "relative",
61
61
  "zIndex": 200,
62
62
  },
63
- Object {
63
+ {
64
64
  "aspectRatio": 1.7777777777777777,
65
65
  "height": undefined,
66
66
  "width": "100%",
67
67
  },
68
- Object {},
69
- Object {},
68
+ {},
69
+ {},
70
70
  ]
71
71
  }
72
72
  testID="test-player-container"
73
73
  />
74
- <View
75
- animationType="componentFade"
76
- style={
77
- Object {
78
- "flex": 1,
79
- }
80
- }
81
- >
82
- <View
83
- configuration={
84
- Object {
85
- "tablet_landscape_player_container_background_color": "red",
86
- "tablet_landscape_sidebar_width": "35%",
87
- }
88
- }
89
- entry={
90
- Object {
91
- "id": "test",
92
- }
93
- }
94
- isTablet={false}
95
- isTabletLandscape={false}
96
- style={
97
- Object {
98
- "flex": 1,
99
- "paddingTop": 20,
100
- }
101
- }
102
- />
103
- </View>
104
74
  </View>
105
75
  </RNCSafeAreaView>
106
76
  </RNCSafeAreaProvider>
@@ -110,8 +80,8 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
110
80
  <RNCSafeAreaProvider
111
81
  onInsetsChange={[Function]}
112
82
  style={
113
- Array [
114
- Object {
83
+ [
84
+ {
115
85
  "flex": 1,
116
86
  },
117
87
  undefined,
@@ -120,7 +90,7 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
120
90
  >
121
91
  <RNCSafeAreaView
122
92
  edges={
123
- Object {
93
+ {
124
94
  "bottom": "off",
125
95
  "left": "off",
126
96
  "right": "off",
@@ -128,31 +98,31 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
128
98
  }
129
99
  }
130
100
  style={
131
- Array [
132
- Object {
101
+ [
102
+ {
133
103
  "backgroundColor": "transparent",
134
104
  },
135
- Object {
105
+ {
136
106
  "height": undefined,
137
107
  "width": 300,
138
108
  },
139
- Object {},
109
+ {},
140
110
  ]
141
111
  }
142
112
  >
143
113
  <View
144
114
  additionalData={
145
- Object {
115
+ {
146
116
  "saveArea": true,
147
117
  }
148
118
  }
149
119
  animationType="moveUpComponent"
150
120
  style={
151
- Array [
152
- Object {
121
+ [
122
+ {
153
123
  "flexDirection": "column",
154
124
  },
155
- Object {
125
+ {
156
126
  "flex": 1,
157
127
  },
158
128
  ]
@@ -160,53 +130,23 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
160
130
  >
161
131
  <View
162
132
  style={
163
- Array [
164
- Object {
133
+ [
134
+ {
165
135
  "alignSelf": "center",
166
136
  "position": "relative",
167
137
  "zIndex": 200,
168
138
  },
169
- Object {
139
+ {
170
140
  "aspectRatio": undefined,
171
141
  "height": undefined,
172
142
  "width": "100%",
173
143
  },
174
- Object {},
175
- Object {},
144
+ {},
145
+ {},
176
146
  ]
177
147
  }
178
148
  testID="test-player-container"
179
149
  />
180
- <View
181
- animationType="componentFade"
182
- style={
183
- Object {
184
- "flex": 1,
185
- }
186
- }
187
- >
188
- <View
189
- configuration={
190
- Object {
191
- "tablet_landscape_player_container_background_color": "red",
192
- "tablet_landscape_sidebar_width": "35%",
193
- }
194
- }
195
- entry={
196
- Object {
197
- "id": "test",
198
- }
199
- }
200
- isTablet={false}
201
- isTabletLandscape={false}
202
- style={
203
- Object {
204
- "flex": 1,
205
- "paddingTop": 20,
206
- }
207
- }
208
- />
209
- </View>
210
150
  </View>
211
151
  </RNCSafeAreaView>
212
152
  </RNCSafeAreaProvider>
@@ -216,8 +156,8 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
216
156
  <RNCSafeAreaProvider
217
157
  onInsetsChange={[Function]}
218
158
  style={
219
- Array [
220
- Object {
159
+ [
160
+ {
221
161
  "flex": 1,
222
162
  },
223
163
  undefined,
@@ -226,7 +166,7 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
226
166
  >
227
167
  <RNCSafeAreaView
228
168
  edges={
229
- Object {
169
+ {
230
170
  "bottom": "off",
231
171
  "left": "off",
232
172
  "right": "off",
@@ -234,31 +174,31 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
234
174
  }
235
175
  }
236
176
  style={
237
- Array [
238
- Object {
177
+ [
178
+ {
239
179
  "backgroundColor": "red",
240
180
  },
241
- Object {
181
+ {
242
182
  "height": 800,
243
183
  "width": 300,
244
184
  },
245
- Object {},
185
+ {},
246
186
  ]
247
187
  }
248
188
  >
249
189
  <View
250
190
  additionalData={
251
- Object {
191
+ {
252
192
  "saveArea": true,
253
193
  }
254
194
  }
255
195
  animationType="moveUpComponent"
256
196
  style={
257
- Array [
258
- Object {
197
+ [
198
+ {
259
199
  "flexDirection": "row",
260
200
  },
261
- Object {
201
+ {
262
202
  "flex": 1,
263
203
  },
264
204
  ]
@@ -266,26 +206,26 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
266
206
  >
267
207
  <View
268
208
  style={
269
- Array [
270
- Object {
209
+ [
210
+ {
271
211
  "alignSelf": "center",
272
212
  "position": "relative",
273
213
  "zIndex": 200,
274
214
  },
275
- Object {
215
+ {
276
216
  "aspectRatio": 1.7777777777777777,
277
217
  "height": undefined,
278
218
  "width": 195,
279
219
  },
280
- Object {},
281
- Object {},
220
+ {},
221
+ {},
282
222
  ]
283
223
  }
284
224
  testID="test-player-container"
285
225
  >
286
226
  <View
287
227
  additionalData={
288
- Object {
228
+ {
289
229
  "disableAnimatedComponent": false,
290
230
  "resetAnimationValue": undefined,
291
231
  "useLayoutMeasure": true,
@@ -293,38 +233,8 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
293
233
  }
294
234
  animationType="moveUpComponent"
295
235
  style={
296
- Object {
297
- "flex": 1,
298
- }
299
- }
300
- />
301
- </View>
302
- <View
303
- animationType="componentFade"
304
- style={
305
- Object {
306
- "flex": 1,
307
- }
308
- }
309
- >
310
- <View
311
- configuration={
312
- Object {
313
- "tablet_landscape_player_container_background_color": "red",
314
- "tablet_landscape_sidebar_width": "35%",
315
- }
316
- }
317
- entry={
318
- Object {
319
- "id": "test",
320
- }
321
- }
322
- isTablet={true}
323
- isTabletLandscape={true}
324
- style={
325
- Object {
236
+ {
326
237
  "flex": 1,
327
- "paddingTop": 20,
328
238
  }
329
239
  }
330
240
  />
@@ -338,8 +248,8 @@ exports[`PlayerWrapper renders properly 1`] = `
338
248
  <RNCSafeAreaProvider
339
249
  onInsetsChange={[Function]}
340
250
  style={
341
- Array [
342
- Object {
251
+ [
252
+ {
343
253
  "flex": 1,
344
254
  },
345
255
  undefined,
@@ -348,7 +258,7 @@ exports[`PlayerWrapper renders properly 1`] = `
348
258
  >
349
259
  <RNCSafeAreaView
350
260
  edges={
351
- Object {
261
+ {
352
262
  "bottom": "off",
353
263
  "left": "off",
354
264
  "right": "off",
@@ -356,31 +266,31 @@ exports[`PlayerWrapper renders properly 1`] = `
356
266
  }
357
267
  }
358
268
  style={
359
- Array [
360
- Object {
269
+ [
270
+ {
361
271
  "backgroundColor": "transparent",
362
272
  },
363
- Object {
273
+ {
364
274
  "height": 800,
365
275
  "width": 300,
366
276
  },
367
- Object {},
277
+ {},
368
278
  ]
369
279
  }
370
280
  >
371
281
  <View
372
282
  additionalData={
373
- Object {
283
+ {
374
284
  "saveArea": true,
375
285
  }
376
286
  }
377
287
  animationType="moveUpComponent"
378
288
  style={
379
- Array [
380
- Object {
289
+ [
290
+ {
381
291
  "flexDirection": "column",
382
292
  },
383
- Object {
293
+ {
384
294
  "flex": 1,
385
295
  },
386
296
  ]
@@ -388,19 +298,19 @@ exports[`PlayerWrapper renders properly 1`] = `
388
298
  >
389
299
  <View
390
300
  style={
391
- Array [
392
- Object {
301
+ [
302
+ {
393
303
  "alignSelf": "center",
394
304
  "position": "relative",
395
305
  "zIndex": 200,
396
306
  },
397
- Object {
307
+ {
398
308
  "aspectRatio": 1.7786666666666666,
399
309
  "height": undefined,
400
310
  "width": "100%",
401
311
  },
402
- Object {},
403
- Object {},
312
+ {},
313
+ {},
404
314
  ]
405
315
  }
406
316
  testID="test-player-container"
@@ -0,0 +1,89 @@
1
+ import { renderHook } from "@testing-library/react-hooks";
2
+ import { useDelayedPlayerDetails } from "../useDelayedPlayerDetails";
3
+ import { withTimeout$ } from "@applicaster/zapp-react-native-utils/idleUtils";
4
+ import { showDetails } from "../utils";
5
+ import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
6
+
7
+ jest.mock("@applicaster/zapp-react-native-utils/idleUtils", () => ({
8
+ withTimeout$: jest.fn(),
9
+ }));
10
+
11
+ jest.mock("../utils", () => ({
12
+ showDetails: jest.fn(),
13
+ }));
14
+
15
+ jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
16
+ useIsTablet: jest.fn(),
17
+ }));
18
+
19
+ describe("useDelayedPlayerDetails", () => {
20
+ beforeEach(() => {
21
+ jest.clearAllMocks();
22
+ });
23
+
24
+ it("should return false initially", () => {
25
+ (withTimeout$ as jest.Mock).mockReturnValue({
26
+ subscribe: jest.fn().mockReturnValue({ unsubscribe: jest.fn() }),
27
+ });
28
+
29
+ const { result } = renderHook(() =>
30
+ useDelayedPlayerDetails({ isInline: true, isDocked: false, isPip: false })
31
+ );
32
+
33
+ expect(result.current).toBe(false);
34
+ });
35
+
36
+ it("should return true if showDetails returns true", () => {
37
+ (withTimeout$ as jest.Mock).mockReturnValue({
38
+ subscribe: (callback) => {
39
+ callback.next();
40
+
41
+ return { unsubscribe: jest.fn() };
42
+ },
43
+ });
44
+
45
+ (showDetails as jest.Mock).mockReturnValue(true);
46
+ (useIsTablet as jest.Mock).mockReturnValue(false);
47
+
48
+ const { result } = renderHook(() =>
49
+ useDelayedPlayerDetails({ isInline: true, isDocked: false, isPip: false })
50
+ );
51
+
52
+ expect(result.current).toBe(true);
53
+ });
54
+
55
+ it("should return false if showDetails returns false", () => {
56
+ (withTimeout$ as jest.Mock).mockReturnValue({
57
+ subscribe: (callback) => {
58
+ callback.next();
59
+
60
+ return { unsubscribe: jest.fn() };
61
+ },
62
+ });
63
+
64
+ (showDetails as jest.Mock).mockReturnValue(false);
65
+ (useIsTablet as jest.Mock).mockReturnValue(false);
66
+
67
+ const { result } = renderHook(() =>
68
+ useDelayedPlayerDetails({ isInline: true, isDocked: false, isPip: false })
69
+ );
70
+
71
+ expect(result.current).toBe(false);
72
+ });
73
+
74
+ it("should unsubscribe on unmount", () => {
75
+ const unsubscribeMock = jest.fn();
76
+
77
+ (withTimeout$ as jest.Mock).mockReturnValue({
78
+ subscribe: jest.fn().mockReturnValue({ unsubscribe: unsubscribeMock }),
79
+ });
80
+
81
+ const { unmount } = renderHook(() =>
82
+ useDelayedPlayerDetails({ isInline: true, isDocked: false, isPip: false })
83
+ );
84
+
85
+ unmount();
86
+
87
+ expect(unsubscribeMock).toHaveBeenCalled();
88
+ });
89
+ });
@@ -0,0 +1,7 @@
1
+ export { useBackgroundColor } from "./useBackgroundColor";
2
+
3
+ export { useDelayedPlayerDetails } from "./useDelayedPlayerDetails";
4
+
5
+ export { useInitialPlayerState } from "./useInitialPlayerState";
6
+
7
+ export { useModalSize } from "./useModalSize";
@@ -0,0 +1,49 @@
1
+ import * as React from "react";
2
+ import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
3
+ import { withTimeout$ } from "@applicaster/zapp-react-native-utils/idleUtils";
4
+
5
+ import { showDetails } from "./utils";
6
+
7
+ const TIMEOUT = 100; // ms
8
+
9
+ type Props = { isInline: boolean; isDocked: boolean; isPip: boolean };
10
+
11
+ /**
12
+ * Custom hook to determine whether to show player details with a delay.
13
+ *
14
+ * @param {Object} params - The parameters object.
15
+ * @param {boolean} params.isInline - Indicates if the player is inline.
16
+ * @param {boolean} params.isDocked - Indicates if the player is docked.
17
+ * @param {boolean} params.isPip - Indicates if the player is in PIP mode.
18
+ * @returns {boolean} - Returns true if player details should be shown, otherwise false.
19
+ */
20
+ export const useDelayedPlayerDetails = ({
21
+ isInline,
22
+ isDocked,
23
+ isPip,
24
+ }: Props): boolean => {
25
+ const [shouldShowDetails, setShouldShowDetails] = React.useState(false);
26
+
27
+ const isTablet = useIsTablet();
28
+
29
+ React.useEffect(() => {
30
+ const subscription = withTimeout$(TIMEOUT).subscribe({
31
+ next: () => {
32
+ setShouldShowDetails(() => {
33
+ return showDetails({
34
+ isMobile: !isTablet,
35
+ isInline,
36
+ isDocked,
37
+ isPip,
38
+ });
39
+ });
40
+ },
41
+ });
42
+
43
+ return () => {
44
+ subscription.unsubscribe();
45
+ };
46
+ }, [isDocked, isTablet, isInline, isPip]);
47
+
48
+ return shouldShowDetails;
49
+ };
@@ -0,0 +1,91 @@
1
+ import { showDetails } from "..";
2
+
3
+ describe("showDetails", () => {
4
+ it("should return false if isPip is true", () => {
5
+ const result = showDetails({
6
+ isMobile: true,
7
+ isInline: true,
8
+ isDocked: false,
9
+ isPip: true,
10
+ });
11
+
12
+ expect(result).toBe(false);
13
+ });
14
+
15
+ it("should return false if isDocked is true", () => {
16
+ const result = showDetails({
17
+ isMobile: true,
18
+ isInline: true,
19
+ isDocked: true,
20
+ isPip: false,
21
+ });
22
+
23
+ expect(result).toBe(false);
24
+ });
25
+
26
+ it("should return true if isMobile is true and isInline is true", () => {
27
+ const result = showDetails({
28
+ isMobile: true,
29
+ isInline: true,
30
+ isDocked: false,
31
+ isPip: false,
32
+ });
33
+
34
+ expect(result).toBe(true);
35
+ });
36
+
37
+ it("should return false if isMobile is true and isInline is false", () => {
38
+ const result = showDetails({
39
+ isMobile: true,
40
+ isInline: false,
41
+ isDocked: false,
42
+ isPip: false,
43
+ });
44
+
45
+ expect(result).toBe(false);
46
+ });
47
+
48
+ it("should return true if isMobile is false", () => {
49
+ const result = showDetails({
50
+ isMobile: false,
51
+ isInline: true,
52
+ isDocked: false,
53
+ isPip: false,
54
+ });
55
+
56
+ expect(result).toBe(true);
57
+ });
58
+
59
+ it("should return true if isMobile is false and isInline is false", () => {
60
+ const result = showDetails({
61
+ isMobile: false,
62
+ isInline: false,
63
+ isDocked: false,
64
+ isPip: false,
65
+ });
66
+
67
+ expect(result).toBe(true);
68
+ });
69
+
70
+ it("should return false if all properties are false except isMobile", () => {
71
+ const result = showDetails({
72
+ isMobile: true,
73
+ isInline: false,
74
+ isDocked: false,
75
+ isPip: false,
76
+ });
77
+
78
+ expect(result).toBe(false);
79
+ });
80
+
81
+ it("should return true if all properties are false except isInline", () => {
82
+ const result = showDetails({
83
+ isMobile: false,
84
+ isInline: true,
85
+ isDocked: false,
86
+ isPip: false,
87
+ });
88
+
89
+ expect(result).toBe(true);
90
+ });
91
+ });