@24i/bigscreen-sdk 1.0.4 → 1.0.5-4.alpha-2832

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 (292) hide show
  1. package/README.md +2 -3
  2. package/ci/is_ci_job_skippable.sh +153 -0
  3. package/package.json +55 -34
  4. package/packages/adobe-heartbeat/src/AdobeHeartbeat.ts +9 -9
  5. package/packages/analytics/README.md +8 -0
  6. package/packages/analytics/src/A.ts +1 -0
  7. package/packages/analytics/src/Analytics.ts +1 -0
  8. package/packages/analytics/src/analyticsOnScroll.ts +1 -0
  9. package/packages/analytics/src/clients/ConsoleAnalytics/ConsoleAnalytics.ts +1 -0
  10. package/packages/analytics/src/clients/ConsoleAnalytics/index.ts +1 -0
  11. package/packages/analytics/src/clients/GoogleAnalytics/GoogleAnalytics.ts +196 -0
  12. package/packages/analytics/src/clients/GoogleAnalytics/constants.ts +126 -0
  13. package/packages/analytics/src/clients/GoogleAnalytics/getUrl.ts +17 -0
  14. package/packages/analytics/src/clients/GoogleAnalytics/index.ts +2 -0
  15. package/packages/analytics/src/clients/GoogleAnalytics/interface.ts +82 -0
  16. package/packages/analytics/src/clients/GoogleAnalytics/mapPayload.ts +51 -0
  17. package/packages/analytics/src/clients/GoogleAnalytics/prepareBody.ts +14 -0
  18. package/packages/analytics/src/clients/TealiumAnalytics/TealiumAnalytics.ts +181 -0
  19. package/packages/analytics/src/clients/TealiumAnalytics/constants.ts +106 -0
  20. package/packages/analytics/src/clients/TealiumAnalytics/findForLanguage.ts +9 -0
  21. package/packages/analytics/src/clients/TealiumAnalytics/index.ts +4 -0
  22. package/packages/analytics/src/clients/TealiumAnalytics/interface.ts +35 -0
  23. package/packages/analytics/src/clients/TealiumAnalytics/mappers/__mocks__/mediaPayload.ts +72 -0
  24. package/packages/analytics/src/clients/TealiumAnalytics/mappers/helper.ts +36 -0
  25. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapAppError.ts +13 -0
  26. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapAppOpen.ts +13 -0
  27. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapFavoriteAdd.ts +11 -0
  28. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapFavoriteRemove.ts +11 -0
  29. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapPlayerClose.ts +15 -0
  30. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapPlayerOpen.ts +15 -0
  31. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSceneView.ts +18 -0
  32. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearch.ts +18 -0
  33. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearchFailed.ts +8 -0
  34. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearchSuccess.ts +8 -0
  35. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoPause.ts +15 -0
  36. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoProgress.ts +18 -0
  37. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoResume.ts +15 -0
  38. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoStart.ts +15 -0
  39. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoStop.ts +15 -0
  40. package/packages/analytics/src/clients/TealiumAnalytics/types.ts +161 -0
  41. package/packages/analytics/src/clients/TwentyFourIQ/TwentyFourIQClient.ts +107 -0
  42. package/packages/analytics/src/clients/TwentyFourIQ/constants.ts +111 -0
  43. package/packages/analytics/src/clients/TwentyFourIQ/helper.ts +34 -0
  44. package/packages/analytics/src/clients/TwentyFourIQ/index.ts +2 -0
  45. package/packages/analytics/src/clients/TwentyFourIQ/interface.ts +34 -0
  46. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapAdEvent.ts +20 -0
  47. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBase.ts +24 -0
  48. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBuffering.ts +15 -0
  49. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerClose.ts +25 -0
  50. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerOpen.ts +17 -0
  51. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapSceneView.ts +15 -0
  52. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapScroll.ts +17 -0
  53. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoComplete.ts +22 -0
  54. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoPause.ts +25 -0
  55. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoProgress.ts +25 -0
  56. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoStart.ts +34 -0
  57. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoStop.ts +32 -0
  58. package/packages/analytics/src/clients/TwentyFourIQ/types.ts +132 -0
  59. package/packages/analytics/src/constants.ts +1 -0
  60. package/packages/analytics/src/index.ts +3 -0
  61. package/packages/analytics/src/interface.ts +1 -0
  62. package/packages/analytics/src/utils/generateSessionId.ts +8 -0
  63. package/packages/async-image/src/AsyncImage.tsx +15 -10
  64. package/packages/developer-tools/PlayerDebugWindow/README.md +1 -1
  65. package/packages/developer-tools/src/DeveloperConsole/DeveloperConsole.tsx +1 -0
  66. package/packages/developer-tools/src/DeveloperToolsService/DeveloperToolsList.tsx +11 -0
  67. package/packages/developer-tools/src/PlayerDebugWindow/PlayerDebugWindow.tsx +5 -5
  68. package/packages/developer-tools/src/PlayerDebugWindow/constants.ts +15 -0
  69. package/packages/developer-tools/src/TechnicalInfo/TechnicalInfo.tsx +2 -0
  70. package/packages/developer-tools/src/TechnicalInfo/TechnicalInfoDetail.tsx +2 -1
  71. package/packages/developer-tools/src/TechnicalInfo/TechnicalInfoProvider.ts +57 -5
  72. package/packages/developer-tools/src/TechnicalInfo/__mocks__/Device.ts +12 -0
  73. package/packages/developer-tools/src/TechnicalInfo/translations.ts +8 -0
  74. package/packages/device/src/driver/index.android.tv.ts +1 -0
  75. package/packages/device/src/driver/index.firetv.ts +1 -0
  76. package/packages/device/src/driver/index.smartcast.tv.ts +1 -0
  77. package/packages/device/src/getKeyDigit.ts +2 -2
  78. package/packages/device/src/resolver/resolver.ts +19 -0
  79. package/packages/digital-clock/src/DigitalClock.tsx +15 -4
  80. package/packages/driver-androidtv/src/DeviceAndroidTV.ts +262 -0
  81. package/packages/driver-androidtv/src/__mocks__/javaScriptBridge.ts +45 -0
  82. package/packages/driver-androidtv/src/formatUserAgent.ts +11 -0
  83. package/packages/driver-androidtv/src/index.ts +2 -0
  84. package/packages/driver-androidtv/src/keymap.ts +27 -0
  85. package/packages/driver-androidtv/src/types.ts +155 -0
  86. package/packages/driver-base/src/DeviceBase.ts +73 -2
  87. package/packages/driver-base/src/KeyMap/Key.ts +8 -1
  88. package/packages/driver-base/src/KeyMap/KeyMap.ts +4 -0
  89. package/packages/driver-base/src/KeyMap/interface.ts +1 -0
  90. package/packages/driver-base/src/KeyMap/overrideValues.ts +2 -1
  91. package/packages/driver-base/src/__mocks__/DeviceBase.ts +24 -0
  92. package/packages/driver-base/src/__mocks__/keyMap.ts +1 -0
  93. package/packages/driver-base/src/index.ts +3 -0
  94. package/packages/driver-base/src/types/AdInfo.ts +5 -0
  95. package/packages/driver-base/src/types/DeviceEvent.ts +2 -0
  96. package/packages/driver-base/src/types/InAppPurchase.ts +20 -0
  97. package/packages/driver-base/src/types/KeycodeKeyMap.ts +1 -0
  98. package/packages/driver-browser/src/DeviceBrowser.ts +26 -0
  99. package/packages/driver-browser/src/keymap.ts +8 -0
  100. package/packages/driver-entone/src/DeviceEntone.ts +31 -1
  101. package/packages/driver-entone/src/keymap.ts +1 -0
  102. package/packages/driver-firetv/src/DeviceFireTV.ts +86 -0
  103. package/packages/driver-firetv/src/__mocks__/javaScriptBridge.ts +45 -0
  104. package/packages/driver-firetv/src/index.ts +1 -0
  105. package/packages/driver-firetv/src/types.ts +1 -0
  106. package/packages/driver-hbbtv/src/DeviceHbbTV.ts +26 -0
  107. package/packages/driver-kreatv/src/DeviceKreaTV.ts +26 -0
  108. package/packages/driver-saphi/src/DeviceSaphi.ts +26 -0
  109. package/packages/driver-smartcast/src/DeviceSmartCast.ts +380 -0
  110. package/packages/driver-smartcast/src/__mocks__/api.ts +69 -0
  111. package/packages/driver-smartcast/src/index.ts +1 -0
  112. package/packages/driver-smartcast/src/keymap.ts +9 -0
  113. package/packages/driver-smartcast/src/types.ts +102 -0
  114. package/packages/driver-tizen/src/DeviceTizen.ts +121 -7
  115. package/packages/driver-tizen/src/ITizen.ts +15116 -202
  116. package/packages/driver-tizen/src/IWebapis.ts +8643 -87
  117. package/packages/driver-tizen/src/TizenKeys.ts +4 -2
  118. package/packages/driver-tizen/src/__mocks__/tizen.ts +7 -8
  119. package/packages/driver-tizen/src/constants.ts +1 -195
  120. package/packages/driver-vidaa/src/DeviceVidaa.ts +29 -2
  121. package/packages/driver-vidaa/src/__mocks__/vidaa.ts +1 -1
  122. package/packages/driver-vidaa/src/keymap.ts +2 -0
  123. package/packages/driver-webos/src/DeviceWebos.ts +55 -0
  124. package/packages/driver-webos/src/__mocks__/webos.ts +33 -0
  125. package/packages/driver-webos/src/constants.ts +1 -0
  126. package/packages/driver-webos/src/keymap.ts +2 -1
  127. package/packages/driver-webos/src/types.ts +30 -0
  128. package/packages/driver-xbox/src/DeviceXbox.ts +30 -1
  129. package/packages/driver-xbox/src/keymap.ts +1 -1
  130. package/packages/epg/README.md +3 -1
  131. package/packages/epg/src/v2/Cell.tsx +16 -2
  132. package/packages/epg/src/v2/DataManager.ts +112 -41
  133. package/packages/epg/src/v2/DatePicker.tsx +9 -3
  134. package/packages/epg/src/v2/DateToast/DateToast.tsx +12 -9
  135. package/packages/epg/src/v2/Day.tsx +6 -3
  136. package/packages/epg/src/v2/Epg.tsx +5 -5
  137. package/packages/epg/src/v2/MockGenerator/generator.ts +3 -2
  138. package/packages/epg/src/v2/ProgramInfo/utils.ts +4 -3
  139. package/packages/epg/src/v2/Row.tsx +3 -1
  140. package/packages/epg/src/v2/TimelineSection.tsx +4 -1
  141. package/packages/epg/src/v2/basic/CellsManager.tsx +7 -2
  142. package/packages/epg/src/v2/basic/RowsManager.tsx +3 -1
  143. package/packages/epg/src/v2/interface.ts +13 -0
  144. package/packages/events-manager/src/EventsManager.ts +1 -56
  145. package/packages/focus/README.md +33 -0
  146. package/packages/focus/src/IFocusable.ts +1 -0
  147. package/packages/focus/src/Layout/Base.tsx +41 -6
  148. package/packages/focus/src/Layout/Matrix.tsx +51 -19
  149. package/packages/focus/src/focusFirstExisting.ts +7 -1
  150. package/packages/focus/src/hasFocus.ts +36 -0
  151. package/packages/focus/src/index.ts +2 -1
  152. package/packages/gallup/src/Gallup.ts +3 -3
  153. package/packages/grid/src/Base/Base.tsx +15 -10
  154. package/packages/grid/src/FirstOnlyGrid/FirstOnlyGrid.tsx +4 -2
  155. package/packages/grid/src/UnifiedGridController/UnifiedGridController.ts +6 -6
  156. package/packages/icon/src/Icon.tsx +27 -5
  157. package/packages/input/README.md +1 -1
  158. package/packages/input/src/Input.tsx +10 -10
  159. package/packages/interactable/README.md +2 -1
  160. package/packages/interactable/src/Interactable.tsx +9 -3
  161. package/packages/interactable/src/interface.ts +1 -0
  162. package/packages/jsx/src/index.ts +1 -1
  163. package/packages/jsx/src/test-utils/index.ts +1 -0
  164. package/packages/jsx/src/test-utils/keyup.ts +27 -0
  165. package/packages/keyboard/README.md +2 -0
  166. package/packages/keyboard/src/Backdrop/Backdrop.scss +2 -0
  167. package/packages/keyboard/src/KeyboardBase.tsx +16 -4
  168. package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.scss +10 -0
  169. package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.tsx +128 -142
  170. package/packages/keyboard/src/WhitelabelKeyboard/WhitelabelStyles/whitelabel.scss +4 -0
  171. package/packages/keyboard/src/WhitelabelKeyboard/_sizes.1080.scss +1 -0
  172. package/packages/keyboard/src/WhitelabelKeyboard/_sizes.scss +1 -0
  173. package/packages/keyboard/src/WhitelabelKeyboard/icons/key_language.svg +20 -0
  174. package/packages/keyboard/src/WhitelabelKeyboard/index.ts +1 -1
  175. package/packages/keyboard/src/WhitelabelKeyboard/layouts/arabic.ts +27 -0
  176. package/packages/keyboard/src/WhitelabelKeyboard/layouts/burmese.ts +27 -0
  177. package/packages/keyboard/src/WhitelabelKeyboard/layouts/dari.ts +28 -0
  178. package/packages/keyboard/src/WhitelabelKeyboard/layouts/hebrew.ts +28 -0
  179. package/packages/keyboard/src/WhitelabelKeyboard/layouts/index.ts +15 -0
  180. package/packages/keyboard/src/WhitelabelKeyboard/layouts/korean.ts +26 -0
  181. package/packages/keyboard/src/WhitelabelKeyboard/layouts/latin.ts +26 -0
  182. package/packages/keyboard/src/WhitelabelKeyboard/layouts/pashto.ts +27 -0
  183. package/packages/keyboard/src/WhitelabelKeyboard/layouts/persian.ts +27 -0
  184. package/packages/keyboard/src/WhitelabelKeyboard/layouts/russian.ts +27 -0
  185. package/packages/keyboard/src/WhitelabelKeyboard/layouts/spanish.ts +26 -0
  186. package/packages/keyboard/src/WhitelabelKeyboard/layouts/special.ts +28 -0
  187. package/packages/keyboard/src/WhitelabelKeyboard/layouts/tibetan.ts +26 -0
  188. package/packages/keyboard/src/WhitelabelKeyboard/layouts/turkish.ts +26 -0
  189. package/packages/keyboard/src/WhitelabelKeyboard/layouts/ukrainian.ts +27 -0
  190. package/packages/keyboard/src/WhitelabelKeyboard/layouts/urdu.ts +26 -0
  191. package/packages/keyboard/src/WhitelabelKeyboard/types.ts +22 -2
  192. package/packages/keyboard/src/types/index.ts +1 -1
  193. package/packages/keyboard/src/utils/caret.ts +5 -8
  194. package/packages/keyboard/src/utils/input.ts +5 -6
  195. package/packages/keyboard/src/utils/setInputSelectionRange.ts +10 -0
  196. package/packages/l10n/README.md +18 -0
  197. package/packages/l10n/src/date/common.ts +18 -6
  198. package/packages/l10n/src/date/cs.ts +2 -8
  199. package/packages/l10n/src/date/de.ts +97 -0
  200. package/packages/l10n/src/date/en-001.ts +3 -3
  201. package/packages/l10n/src/date/en-common.ts +5 -4
  202. package/packages/l10n/src/date/en-us.ts +3 -3
  203. package/packages/l10n/src/date/es.ts +71 -0
  204. package/packages/l10n/src/date/fr.ts +94 -0
  205. package/packages/l10n/src/date/he.ts +101 -0
  206. package/packages/l10n/src/date/iso.ts +12 -13
  207. package/packages/l10n/src/date/types.ts +9 -0
  208. package/packages/l10n/src/l10n.ts +61 -3
  209. package/packages/list/src/Base/Base.tsx +19 -9
  210. package/packages/list/src/Base/interface.ts +2 -2
  211. package/packages/list/src/BasicList/BasicList.tsx +7 -7
  212. package/packages/list/src/CenteredList/CenteredList.tsx +2 -2
  213. package/packages/list/src/CenteredList/controller.ts +0 -1
  214. package/packages/list/src/EdgeOffsetList/EdgeOffsetList.tsx +10 -10
  215. package/packages/list/src/FirstOnlyList/FirstOnlyList.tsx +2 -2
  216. package/packages/list/src/FirstOnlyVariedList/FirstOnlyVariedList.tsx +2 -2
  217. package/packages/list/src/FixedToEndList/FixedToEndList.tsx +2 -2
  218. package/packages/list/src/UnifiedListController/UnifiedListController.ts +6 -2
  219. package/packages/list/src/interface.ts +2 -2
  220. package/packages/logger/src/loggers/ConsoleLogger/ConsoleLogger.ts +7 -1
  221. package/packages/logger/src/loggers/SentryLogger/Sentry.ts +1 -0
  222. package/packages/logger/src/loggers/SentryLogger/SentryLogger.ts +5 -3
  223. package/packages/menu/src/MenuAndContentContainer/MenuAndContentContainer.tsx +31 -3
  224. package/packages/menu/src/MenuAndContentContainer/interface.ts +8 -0
  225. package/packages/modal-service/README.md +4 -1
  226. package/packages/modal-service/src/ModalService.tsx +29 -5
  227. package/packages/perf-utils/README.md +1 -120
  228. package/packages/perf-utils/src/array/filter.ts +1 -54
  229. package/packages/perf-utils/src/array/find.ts +1 -43
  230. package/packages/perf-utils/src/array/findIndex.ts +1 -43
  231. package/packages/perf-utils/src/array/forEach.ts +1 -48
  232. package/packages/perf-utils/src/array/includes.ts +1 -41
  233. package/packages/perf-utils/src/array/includesNaN.ts +1 -32
  234. package/packages/perf-utils/src/array/index.ts +1 -7
  235. package/packages/perf-utils/src/array/map.ts +1 -52
  236. package/packages/player-ui/README.md +1 -1
  237. package/packages/player-ui/src/CurrentTime.tsx +2 -2
  238. package/packages/player-ui/src/Duration.tsx +2 -2
  239. package/packages/player-ui/src/PauseButton.tsx +8 -0
  240. package/packages/player-ui/src/PlayerInteractable.tsx +1 -0
  241. package/packages/player-ui/src/PlayerTime.tsx +3 -1
  242. package/packages/player-ui/src/PlayerUI.tsx +68 -35
  243. package/packages/player-ui/src/RemainingTime.tsx +2 -2
  244. package/packages/player-ui/src/Seekbar.tsx +110 -18
  245. package/packages/player-ui/src/Seeking.ts +57 -16
  246. package/packages/player-ui/src/Subtitles.tsx +2 -2
  247. package/packages/player-ui/src/index.ts +1 -0
  248. package/packages/player-ui/src/mocks.ts +32 -8
  249. package/packages/player-ui/src/timeUtils.ts +3 -3
  250. package/packages/player-ui/src/types.ts +9 -3
  251. package/packages/router/README.md +1 -0
  252. package/packages/router/src/Route.tsx +61 -27
  253. package/packages/router/src/Router.tsx +63 -14
  254. package/packages/router/src/history.ts +8 -1
  255. package/packages/router/src/index.ts +1 -1
  256. package/packages/router/src/utils.ts +9 -4
  257. package/packages/sass-utils/src/linear-gradient.scss +9 -4
  258. package/packages/sass-utils/src/scale.1080.scss +3 -1
  259. package/packages/sass-utils/src/scale.720.scss +1 -1
  260. package/packages/time/README.md +4 -1
  261. package/packages/time/src/Time.ts +35 -13
  262. package/packages/time/src/adapters/24iMediaTimeApi.ts +47 -0
  263. package/packages/time/src/constants.ts +1 -0
  264. package/packages/time/src/services/24iMediaTimeApi/24iMediaTimeApi.ts +43 -0
  265. package/packages/time/src/services/24iMediaTimeApi/index.ts +6 -0
  266. package/packages/toast/src/ToastService.scss +1 -0
  267. package/packages/toast/src/ToastService.tsx +16 -5
  268. package/packages/types-bigscreen-jsx/README.md +5 -4
  269. package/packages/types-bigscreen-jsx/index.d.ts +72 -67
  270. package/packages/utils/README.md +27 -0
  271. package/packages/utils/src/elementUtils.ts +25 -0
  272. package/packages/utils/src/forceReflow.ts +14 -0
  273. package/packages/utils/src/index.ts +8 -0
  274. package/packages/utils/src/keyPress/index.ts +6 -0
  275. package/packages/utils/src/keyPress/keyPressSimulator.ts +74 -0
  276. package/packages/utils/src/keyPress/simulateKeyPress.ts +25 -0
  277. package/packages/utils/src/scaledImage.ts +6 -3
  278. package/packages/utils/src/textUtils.ts +46 -14
  279. package/packages/utils/src/wait.ts +3 -1
  280. package/packages/utils/src/xhr/xhrSend.ts +3 -1
  281. package/packages/utils/src/xhr/xhrSendRetry.ts +3 -1
  282. package/packages/zapping/src/ChannelZapping.ts +9 -0
  283. package/packages/zapping/src/Zapping.tsx +10 -0
  284. package/utils/release/release.ts +156 -0
  285. package/packages/driver-tizen/src/types.ts +0 -14
  286. package/packages/focus/src/Layout/__test__/Base.spec.ts +0 -180
  287. package/packages/focus/src/Layout/__test__/Horizontal.spec.ts +0 -94
  288. package/packages/focus/src/Layout/__test__/Matrix.spec.ts +0 -261
  289. package/packages/focus/src/Layout/__test__/Vertical.spec.ts +0 -46
  290. package/packages/focus/src/Layout/__test__/isRtl.spec.ts +0 -23
  291. package/packages/focus/src/Layout/__test__/shared.ts +0 -19
  292. package/packages/keyboard/src/WhitelabelKeyboard/focusMatrix.ts +0 -19
@@ -4,6 +4,12 @@ import { SCREEN_WIDTH } from './sizes';
4
4
 
5
5
  const SAFE_TIMEOUT = 100;
6
6
 
7
+ /**
8
+ * Test if the element (or element in the reference) is wrapped visible. This means that the
9
+ * element does not have `display: none` or `visibility: hidden`.
10
+ * @param elementOrReference DOM element or reference to element on which we test wrapping
11
+ * @returns true if element is visible
12
+ */
7
13
  export const isElementVisible = (
8
14
  elementOrReference: HTMLElement | Reference<HTMLElement>,
9
15
  ) => {
@@ -13,10 +19,18 @@ export const isElementVisible = (
13
19
  return style.display !== 'none' && style.visibility !== 'hidden';
14
20
  };
15
21
 
22
+ /**
23
+ * Test if the element (or element in the reference) is wrapped fully visible. This means that the
24
+ * element does not have `display: none` or `visibility: hidden` and exists
25
+ * inside visible DOM tree, which exists in the document.body.
26
+ * @param elementOrReference DOM element or reference to element on which we test wrapping
27
+ * @returns true if element is visible
28
+ */
16
29
  export const isElementFullyVisible = (
17
30
  elementOrReference: HTMLElement | Reference<HTMLElement>,
18
31
  ) => {
19
32
  const element = unwrapReference(elementOrReference);
33
+ if (!element) return false;
20
34
  if (isElementVisible(element)) {
21
35
  let parent = element.parentElement;
22
36
  while (parent) {
@@ -33,6 +47,16 @@ export const isElementFullyVisible = (
33
47
  return false;
34
48
  };
35
49
 
50
+ /**
51
+ * Test if the element (or element in the reference) is wrapped by another element.
52
+ * @param elementOrReference DOM element or reference to element on which we test wrapping
53
+ * @param wrapperElementOrReferenceOrCondition wrapper element or certain condition (utils is
54
+ * running upwards in the DOM tree from first element till some element has some specific condition)
55
+ * @param includesElementItself if true, test will check also provided element itself.
56
+ * This is useful in some cases when we need to include also provided element as wrapper
57
+ * in one run of the util.
58
+ * @returns true if the element is wrapped by provided wrapper
59
+ */
36
60
  export const isElementWrappedBy = (
37
61
  elementOrReference: HTMLElement | Reference<HTMLElement>,
38
62
  wrapperElementOrReferenceOrCondition:
@@ -40,6 +64,7 @@ export const isElementWrappedBy = (
40
64
  includesElementItself = false,
41
65
  ) => {
42
66
  const element = unwrapReference(elementOrReference);
67
+ if (!element) return false;
43
68
  let currentParent = includesElementItself ? element : element.parentElement;
44
69
  let wrapperElement: HTMLElement | null = null;
45
70
  let condition: ((currentWrapper: HTMLElement) => boolean) | null = null;
@@ -0,0 +1,14 @@
1
+ import { Reference, unwrapReference } from '@24i/bigscreen-sdk/jsx';
2
+
3
+ /**
4
+ * To force a DOM reflow on given DOM element. It can be needed for transitions
5
+ * or other purposes.
6
+ * @param elementOrReference DOM element or reference to element on which reflow is called.
7
+ */
8
+ export const forceReflow = (
9
+ elementOrReference: HTMLElement | Reference<HTMLElement>,
10
+ ) => {
11
+ const element = unwrapReference(elementOrReference);
12
+ if (!element) return;
13
+ void element.offsetHeight; // eslint-disable-line no-void
14
+ };
@@ -6,6 +6,7 @@ export { addClass } from './addClass';
6
6
  export { removeClass } from './removeClass';
7
7
  export { debounce } from './debounce';
8
8
  export { wait } from './wait';
9
+ export { forceReflow } from './forceReflow';
9
10
  export { scaledImage } from './scaledImage';
10
11
  export { nTimes } from './nTimes';
11
12
  export { getDisplayToggler, DISPLAY_NONE } from './displayToggler';
@@ -15,6 +16,7 @@ export {
15
16
  isElementVisible,
16
17
  isElementFullyVisible,
17
18
  isElementWrappedBy,
19
+ preventDefaultScroll,
18
20
  } from './elementUtils';
19
21
  export { createInterval, createTimeout, runAsync } from './timers';
20
22
  export type { TimedFunction } from './timers';
@@ -33,3 +35,9 @@ export {
33
35
  } from './timeConstants';
34
36
  export { xhrSend, xhrSendRetry, defaultRetryConfig, mockXhr } from './xhr';
35
37
  export type { XhrOptions, XhrResponse, RetryConfig, RSOptions, ShouldRetryParam } from './xhr';
38
+ export {
39
+ registerKeyPressSimulator,
40
+ unregisterKeyPressSimulator,
41
+ dispatchKeyboardEvent,
42
+ simulateKeyPress,
43
+ } from './keyPress';
@@ -0,0 +1,6 @@
1
+ export {
2
+ registerKeyPressSimulator,
3
+ unregisterKeyPressSimulator,
4
+ dispatchKeyboardEvent,
5
+ } from './keyPressSimulator';
6
+ export { simulateKeyPress } from './simulateKeyPress';
@@ -0,0 +1,74 @@
1
+ import { Key } from '@24i/bigscreen-sdk/driver-base/keymap';
2
+ import { stopEvent } from '@24i/bigscreen-sdk/utils';
3
+
4
+ let keysPressed: Record<number, boolean>;
5
+
6
+ interface CustomKeyboardEvent extends KeyboardEvent {
7
+ skipKeyPressSimulation: boolean;
8
+ }
9
+
10
+ const shouldSkipEvent = (e: KeyboardEvent) => (
11
+ Boolean((e as CustomKeyboardEvent).skipKeyPressSimulation)
12
+ );
13
+
14
+ const onKeyDown = (e: KeyboardEvent) => {
15
+ if (shouldSkipEvent(e)) return;
16
+ const { keyCode } = e;
17
+ if (keysPressed[keyCode] === true) {
18
+ console.warn(`Key ${e.code} (${e.keyCode}) is skipped by the key press simulator`);
19
+ stopEvent(e);
20
+ } else if (typeof keysPressed[keyCode] !== 'undefined') {
21
+ keysPressed[keyCode] = true;
22
+ }
23
+ };
24
+
25
+ const onKeyUp = (e: KeyboardEvent) => {
26
+ const { keyCode } = e;
27
+ if (keysPressed[keyCode] === true) keysPressed[keyCode] = false;
28
+ };
29
+
30
+ /**
31
+ * Modifies `keydown` event behavior to similar to `keypress` and causes
32
+ * triggering `keydown` event only once before the key is released. This is
33
+ * because `keypress` event is deprecated and it is not implemented with the same
34
+ * behavior on all platforms. This functionality is applied across the board for
35
+ * all provided keys globally. To use in one specific handler only
36
+ * use `simulateKeyPress` util.
37
+ * @param keys array with keys to behave as keypress
38
+ */
39
+ export const registerKeyPressSimulator = (keys: Key[]) => {
40
+ keysPressed = {};
41
+ keys.forEach((key) => {
42
+ keysPressed[key.keyCode] = false;
43
+ });
44
+ window.document.addEventListener('keydown', onKeyDown, true);
45
+ window.document.addEventListener('keyup', onKeyUp, true);
46
+ };
47
+
48
+ /**
49
+ * Unregister key press simulator events, turn off the functionality.
50
+ */
51
+ export const unregisterKeyPressSimulator = () => {
52
+ window.document.removeEventListener('keydown', onKeyDown, true);
53
+ window.document.removeEventListener('keyup', onKeyUp, true);
54
+ };
55
+
56
+ /**
57
+ * This should be the main method for manually dispatching keyboard events when the
58
+ * key press simulator is registered in the app. When parameter `skipKeyPressSimulation`
59
+ * is `true`, those event's won't be caught by the key press simulator and
60
+ * are no longer under it's influence. Key press simulator should work only with events
61
+ * generated from input device.
62
+ * @param target element target to dispatch event
63
+ * @param event dispatching event
64
+ * @param skipKeyPressSimulation default value is `true`, when false, the event
65
+ * will be caught by the simulator and other dispatched events will be stopped.
66
+ */
67
+ export const dispatchKeyboardEvent = (
68
+ target: HTMLElement,
69
+ event: KeyboardEvent,
70
+ skipKeyPressSimulation = true,
71
+ ) => {
72
+ (event as CustomKeyboardEvent).skipKeyPressSimulation = skipKeyPressSimulation;
73
+ target.dispatchEvent(event);
74
+ };
@@ -0,0 +1,25 @@
1
+ const NO_KEY = -1;
2
+
3
+ /**
4
+ * Returns a new `keydown` handler wrapped with the simulated key press functionality.
5
+ * Modifies `keydown` event behavior to similar to `keypress` and causes triggering keydown
6
+ * event only once before the key is released. This is because `keypress` event is deprecated
7
+ * and it is not implemented with the same behavior on all platforms. Apply this globally for
8
+ * the specific keys by using `keyPressSimulator` util.
9
+ * @param onKeyDown original handler for keydown event
10
+ * @returns decorated handler with key press functionality
11
+ */
12
+ export const simulateKeyPress = (onKeyDown: (e: KeyboardEvent) => void) => {
13
+ let keyPressed = NO_KEY;
14
+ const onKeyUp = (e: KeyboardEvent) => {
15
+ if (e.keyCode !== keyPressed) return;
16
+ window.document.removeEventListener('keyup', onKeyUp);
17
+ keyPressed = NO_KEY;
18
+ };
19
+ return (e: KeyboardEvent) => {
20
+ if (keyPressed !== NO_KEY) return;
21
+ keyPressed = e.keyCode;
22
+ window.document.addEventListener('keyup', onKeyUp);
23
+ onKeyDown(e);
24
+ };
25
+ };
@@ -1,15 +1,18 @@
1
- export const DEFAULT_SCALING_ENDPOINT = 'http://imageresize.24i.com';
2
-
3
1
  type Dimensions = {
4
2
  height: number,
5
3
  width: number,
6
4
  fit?: 'cover' | 'contain' | 'inside',
7
5
  };
8
6
 
7
+ const getEndpointProtocol = (protocol: string) => (protocol === 'https:' ? 'https:' : 'http:');
8
+
9
9
  const attention = (fit: Dimensions['fit']) => (
10
10
  fit === 'cover' ? '&a=attention' : ''
11
11
  );
12
12
 
13
+ // eslint-disable-next-line max-len
14
+ export const DEFAULT_SCALING_ENDPOINT = `${getEndpointProtocol(window.location.protocol)}//imageresize.24i.com`;
15
+
13
16
  const scaledImage = (
14
17
  url: string,
15
18
  { height, width, fit = 'cover' }: Dimensions,
@@ -18,4 +21,4 @@ const scaledImage = (
18
21
  `${scalingEndpoint}?url=${url}&h=${height}&w=${width}&fit=${fit}${attention(fit)}`
19
22
  );
20
23
 
21
- export { scaledImage, Dimensions };
24
+ export { scaledImage, Dimensions, getEndpointProtocol };
@@ -1,25 +1,57 @@
1
1
  const ELLIPSIS = '...';
2
2
 
3
- export const trimWithLeadingEllipsis = (row: HTMLSpanElement, requestedNumberOfLines: number) => {
4
- if (row && row.textContent != null) {
5
- row.style.visibility = 'hidden';
6
- const lineHeightString = window.getComputedStyle(row, null).getPropertyValue('line-height');
7
- const lineHeight = parseInt(lineHeightString, 10);
8
- let numberOfLines = row.offsetHeight / lineHeight;
9
- if (numberOfLines > requestedNumberOfLines) {
10
- const originalTextContent = row.textContent;
11
- row.textContent = ELLIPSIS;
12
- let stringBuffer = '';
3
+ const trimWithEllipsis = (
4
+ row: HTMLSpanElement | HTMLDivElement,
5
+ requestedNumberOfLines: number,
6
+ ellipsis = ELLIPSIS,
7
+ ending = false,
8
+ ) : void => {
9
+ if (!row.textContent) {
10
+ return;
11
+ }
12
+ const { visibility } = row.style;
13
+ row.style.visibility = 'hidden';
14
+ const lineHeightString = window.getComputedStyle(row, null).getPropertyValue('line-height');
15
+ const lineHeight = parseInt(lineHeightString, 10);
16
+ let numberOfLines = row.offsetHeight / lineHeight;
17
+ if (numberOfLines > requestedNumberOfLines) {
18
+ const originalTextContent = row.textContent!;
19
+ row.textContent = ellipsis;
20
+ let stringBuffer = '';
21
+ if (ending) {
22
+ let currentPosition = 0;
23
+ do {
24
+ stringBuffer += originalTextContent.charAt(currentPosition);
25
+ row.textContent = stringBuffer + ellipsis;
26
+ currentPosition += 1;
27
+ numberOfLines = row.offsetHeight / lineHeight;
28
+ } while (numberOfLines <= requestedNumberOfLines
29
+ && currentPosition < originalTextContent.length);
30
+ row.textContent = stringBuffer.substring(0, stringBuffer.length - 1) + ellipsis;
31
+
32
+ } else {
13
33
  let currentPosition = originalTextContent.length - 1;
14
34
  do {
15
- const charToAdd = originalTextContent.at(currentPosition);
35
+ const charToAdd = originalTextContent.charAt(currentPosition);
16
36
  stringBuffer = `${charToAdd}${stringBuffer}`;
17
- row.textContent = `${ELLIPSIS}${stringBuffer}`;
37
+ row.textContent = `${ellipsis}${stringBuffer}`;
18
38
  currentPosition -= 1;
19
39
  numberOfLines = Math.floor(row.offsetHeight / lineHeight);
20
40
  } while (numberOfLines <= requestedNumberOfLines && currentPosition >= 0);
21
- row.textContent = `${ELLIPSIS}${stringBuffer.substring(1)}`;
41
+ row.textContent = `${ellipsis}${stringBuffer.substring(1)}`;
22
42
  }
23
- row.style.visibility = '';
24
43
  }
44
+ row.style.visibility = visibility;
25
45
  };
46
+
47
+ export const trimWithLeadingEllipsis = (
48
+ row: HTMLSpanElement | HTMLDivElement,
49
+ requestedNumberOfLines: number,
50
+ ellipsis = ELLIPSIS,
51
+ ) => trimWithEllipsis(row, requestedNumberOfLines, ellipsis, false);
52
+
53
+ export const trimWithEndingEllipsis = (
54
+ row: HTMLSpanElement | HTMLDivElement,
55
+ requestedNumberOfLines: number,
56
+ ellipsis = ELLIPSIS,
57
+ ) => trimWithEllipsis(row, requestedNumberOfLines, ellipsis, true);
@@ -1 +1,3 @@
1
- export const wait = (waitMs: number) => new Promise((r) => setTimeout(r, waitMs));
1
+ export const wait = (waitMs: number) => new Promise((r) => {
2
+ setTimeout(r, waitMs);
3
+ });
@@ -84,7 +84,9 @@ function xhrSend(url: string, options: Partial<XhrOptions> = {}): Promise<XhrRes
84
84
  const xhr = new XMLHttpRequest();
85
85
 
86
86
  function onLoad() {
87
- const dataText = 'response' in xhr ? xhr.response : xhr.responseText;
87
+ const dataText = 'response' in (xhr as XMLHttpRequest)
88
+ ? xhr.response
89
+ : xhr.responseText;
88
90
  const dataJson = parseJson(dataText);
89
91
  const status = xhr.status === undefined ? HttpStatusCode.OK : xhr.status;
90
92
  const statusText = xhr.statusText === undefined ? 'OK' : xhr.statusText;
@@ -68,7 +68,9 @@ Promise<XhrResponse | TypeError> {
68
68
  const shouldRetryFn = config.shouldRetry || defaultRetryConfig.shouldRetry;
69
69
  const shouldRetry = shouldRetryFn({ options, response, error });
70
70
  if (shouldRetry) {
71
- await new Promise((res) => window.setTimeout(res, config.retryDelay));
71
+ await new Promise((res) => {
72
+ window.setTimeout(res, config.retryDelay);
73
+ });
72
74
  config.currentRetryAttempt += 1;
73
75
  return xhrSendRetry(url, options);
74
76
  }
@@ -99,6 +99,15 @@ export class ChannelZapping<T extends Asset = Asset> {
99
99
  }
100
100
  }
101
101
 
102
+ /**
103
+ * Updates the current index of channel zapping.
104
+ * @param channels the array of all channels
105
+ * @param currentChannel currently active channel
106
+ */
107
+ onUpdate(channels: T[], currentChannel: T) {
108
+ this.currentIndex = getCurrentChannelIndex(channels, currentChannel);
109
+ }
110
+
102
111
  /**
103
112
  * Changes to the next/previous channel.
104
113
  * @param direction direction of the change
@@ -96,10 +96,20 @@ export class Zapping<T extends Asset = Asset> extends Component<Props<T>> {
96
96
  this.channelZapping!.onKeyDown(event);
97
97
  };
98
98
 
99
+ /**
100
+ * Updates channel zapping with new data.
101
+ * @param channels the array of all channels
102
+ * @param currentChannel currently active channel
103
+ */
104
+ onUpdate(channels: T[], currentChannel: T) {
105
+ this.channelZapping!.onUpdate(channels, currentChannel);
106
+ }
107
+
99
108
  render() {
100
109
  const { numericZapper } = this.props;
101
110
  return numericZapper
102
111
  ? <NumericZapper {...numericZapper} ref={zapperServiceRef} />
112
+ // eslint-disable-next-line react/jsx-no-useless-fragment
103
113
  : <></>;
104
114
  }
105
115
  }
@@ -0,0 +1,156 @@
1
+ import { ok } from 'assert';
2
+ import { execSync, ExecSyncOptions } from 'child_process';
3
+
4
+ const NO_VERIFY_PARAM = '--no-verify';
5
+ const branchNames = {
6
+ dev: 'development',
7
+ main: 'master',
8
+ release: 'release',
9
+ };
10
+
11
+ const cmdSync = (command: string, options?: ExecSyncOptions) => execSync(command, options);
12
+ const cmdSyncInheritOut = (command: string) => cmdSync(command, { stdio: 'inherit' });
13
+ const cmdSyncPipeOut = (command: string) => cmdSync(command, { stdio: 'pipe' });
14
+ const cmdSyncTrimOut = (command: string) => cmdSync(command).toString().trim();
15
+
16
+ const splitByNewLine = (string = '') => string.split(/\r?\n/);
17
+
18
+ const statusList = () => {
19
+ const gitCmd = 'git status --porcelain';
20
+ const outputString = cmdSyncTrimOut(gitCmd);
21
+
22
+ if (!outputString) return [];
23
+ const handleMultipleWhitespaces = (rowString: string) => {
24
+ const spaceChar = ' ';
25
+ const parts = rowString.split(spaceChar);
26
+ return parts.filter(Boolean).join(spaceChar);
27
+ };
28
+
29
+ return splitByNewLine(outputString).map(handleMultipleWhitespaces);
30
+ };
31
+ const createBranch = (branchName: string) => cmdSyncPipeOut(`git branch ${branchName}`);
32
+ const checkout = (branchName: string) => cmdSyncPipeOut(`git checkout ${branchName}`);
33
+ const addAll = () => cmdSyncPipeOut('git add --all');
34
+
35
+ const commit = (commitMessage: string, noVerify = false) => {
36
+ const maybeNoVerifyParam = noVerify ? NO_VERIFY_PARAM : '';
37
+ return cmdSyncPipeOut(`git commit -m "${commitMessage}" ${maybeNoVerifyParam}`.trimEnd());
38
+ };
39
+
40
+ const push = (branchName: string, noVerify = false) => {
41
+ const maybeNoVerifyParam = noVerify ? NO_VERIFY_PARAM : '';
42
+ const cmd = `git push --set-upstream origin ${branchName} ${maybeNoVerifyParam}`.trimEnd();
43
+ return cmdSyncPipeOut(cmd);
44
+ };
45
+
46
+ const pushTag = (version: string, noVerify = false) => {
47
+ const maybeNoVerifyParam = noVerify ? NO_VERIFY_PARAM : '';
48
+ const cmd = `git push origin v${version} ${maybeNoVerifyParam}`.trimEnd();
49
+ return cmdSyncPipeOut(cmd);
50
+ };
51
+
52
+ const assertEmptyStatusList = () => {
53
+ ok(statusList().length === 0, 'An empty GIT stage is expected!');
54
+ };
55
+
56
+ const getCurrentBranchName = () => cmdSyncTrimOut('git branch --show-current');
57
+
58
+ const remoteBranchExists = (expectedBranchName: string) => {
59
+ const gitCmd = `git ls-remote --heads origin ${expectedBranchName}`;
60
+ const output = cmdSyncTrimOut(gitCmd);
61
+ return Boolean(output);
62
+ };
63
+
64
+ // only for GitHub
65
+ const pullRequest = (fromBranch: string, toBranch: string, prTitle: string) => {
66
+ const cmdTool = 'hub';
67
+ const installDocUrl = 'https://github.com/github/hub#installation';
68
+ const errorMsg = `${cmdTool} is not installed! See ${installDocUrl}\n`;
69
+
70
+ try {
71
+ const toolPath = cmdSyncTrimOut(`${cmdTool} --version`);
72
+ ok(toolPath, errorMsg);
73
+ } catch (error) {
74
+ throw new Error(errorMsg);
75
+ }
76
+
77
+ const cmd = `${cmdTool} pull-request -m "${prTitle}" --head ${fromBranch} --base ${toBranch}`;
78
+ cmdSyncInheritOut(cmd);
79
+ };
80
+
81
+ const assertCurrentBranch = (expectedBranchName: string) => {
82
+ const currentGitBranchName = getCurrentBranchName();
83
+ // eslint-disable-next-line max-len
84
+ const errorMsg = `The ${expectedBranchName} branch is expected to be active, not "${currentGitBranchName}"`;
85
+ ok(currentGitBranchName === expectedBranchName, errorMsg);
86
+ };
87
+
88
+ const bumpVersion = (version: string | 'major' | 'minor' | 'patch') => {
89
+ // it bumps version, creates commit and GIT tag
90
+ execSync(`npm version ${version}`, { stdio: 'inherit' });
91
+ };
92
+
93
+ const getNewReleaseBranchName = () => {
94
+ const date = new Date();
95
+ const yyyy = date.getFullYear();
96
+ const mm = String(date.getMonth() + 1).padStart(2, '0');
97
+ const dd = String(date.getDate()).padStart(2, '0');
98
+ let bod = 0;
99
+ const dateString = `${yyyy}-${mm}-${dd}`;
100
+ while (true) {
101
+ bod += 1;
102
+ const bodString = String(bod).padStart(2, '0');
103
+ const branchName = `${branchNames.release}/${dateString}-${bodString}`;
104
+ if (!remoteBranchExists(branchName)) {
105
+ return branchName;
106
+ }
107
+ }
108
+ };
109
+
110
+ /**
111
+ * Release process.
112
+ * @param versionType Version type one of 'major', 'minor', 'patch' or specific
113
+ * version like '0.0.2'.
114
+ */
115
+ const release = (versionType: string | 'major' | 'minor' | 'patch') => {
116
+ console.log(`Start release with version: ${versionType}`);
117
+ assertCurrentBranch(branchNames.dev);
118
+ assertEmptyStatusList();
119
+ const newReleaseBranchName = getNewReleaseBranchName();
120
+
121
+ console.log(`Creating "${newReleaseBranchName}" branch ...`);
122
+ createBranch(newReleaseBranchName);
123
+ checkout(newReleaseBranchName);
124
+
125
+ console.log(`Bumping version with "${versionType}" ...`);
126
+ bumpVersion(versionType);
127
+ const version = cmdSyncTrimOut('npm pkg get version').replace(/"/g, '');
128
+ ok(version, 'Oops, cannot get current version from package.json');
129
+
130
+ console.log(`Publishing package version: ${version} ...`);
131
+ cmdSyncInheritOut('npm publish');
132
+
133
+ console.log(`Generating changelog: ${version} ...`);
134
+ cmdSyncInheritOut('npm run generate-changelog');
135
+ addAll(); // add version changes (changelog) into a git stage
136
+
137
+ console.log('Creating commit with changed version and changelog ...');
138
+ commit('chore(CHANGELOG): generated changelog', true);
139
+
140
+ console.log(`Pushing ${newReleaseBranchName} branch ...`);
141
+ push(newReleaseBranchName, true);
142
+
143
+ console.log(`Pushing ${version} tag ...`);
144
+ pushTag(version, true);
145
+
146
+ const prTitle = `Release: ${newReleaseBranchName.split('/')[1]}`;
147
+ // eslint-disable-next-line max-len
148
+ console.log(`Creating Pull Request from ${newReleaseBranchName} branch to ${branchNames.main} branch...`);
149
+ console.log(`Applied PR title: "${prTitle}"`);
150
+ pullRequest(newReleaseBranchName, branchNames.main, prTitle);
151
+
152
+ console.log('Done!');
153
+ };
154
+
155
+ const version = process.argv[2] || 'patch'; // 'major' | 'minor' | 'patch'
156
+ release(version);
@@ -1,14 +0,0 @@
1
- export {
2
- ITizen,
3
- SystemInfo,
4
- TVAudioControl,
5
- TVInputDevice,
6
- TizenApplication,
7
- WebSetting,
8
- } from './ITizen';
9
- export {
10
- AppCommon,
11
- IWebapis,
12
- Network,
13
- ProductInfo,
14
- } from './IWebapis';