@24i/bigscreen-sdk 1.1.0 → 2.1.1-alpha.2133

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 (256) hide show
  1. package/README.md +1 -1
  2. package/package.json +34 -53
  3. package/packages/adobe-heartbeat/src/AdobeHeartbeat.ts +9 -9
  4. package/packages/async-image/src/AsyncImage.tsx +10 -15
  5. package/packages/developer-tools/PlayerDebugWindow/README.md +1 -1
  6. package/packages/developer-tools/src/DeveloperToolsService/DeveloperToolsList.tsx +0 -11
  7. package/packages/developer-tools/src/PlayerDebugWindow/PlayerDebugWindow.tsx +5 -5
  8. package/packages/developer-tools/src/PlayerDebugWindow/constants.ts +0 -15
  9. package/packages/developer-tools/src/TechnicalInfo/TechnicalInfoDetail.tsx +1 -2
  10. package/packages/developer-tools/src/TechnicalInfo/TechnicalInfoProvider.ts +3 -34
  11. package/packages/developer-tools/src/TechnicalInfo/__mocks__/Device.ts +0 -4
  12. package/packages/developer-tools/src/TechnicalInfo/translations.ts +0 -4
  13. package/packages/device/src/getKeyDigit.ts +2 -2
  14. package/packages/device/src/resolver/resolver.ts +5 -18
  15. package/packages/digital-clock/src/DigitalClock.tsx +4 -15
  16. package/packages/driver-androidtv/src/DeviceAndroidTV.ts +9 -54
  17. package/packages/driver-androidtv/src/__mocks__/javaScriptBridge.ts +5 -29
  18. package/packages/driver-androidtv/src/keymap.ts +0 -18
  19. package/packages/driver-androidtv/src/types.ts +16 -102
  20. package/packages/driver-base/src/DeviceBase.ts +2 -61
  21. package/packages/driver-base/src/KeyMap/Key.ts +1 -8
  22. package/packages/driver-base/src/KeyMap/KeyMap.ts +0 -4
  23. package/packages/driver-base/src/KeyMap/interface.ts +0 -1
  24. package/packages/driver-base/src/KeyMap/overrideValues.ts +1 -2
  25. package/packages/driver-base/src/__mocks__/keyMap.ts +0 -1
  26. package/packages/driver-base/src/types/DeviceEvent.ts +0 -2
  27. package/packages/driver-base/src/types/KeycodeKeyMap.ts +0 -1
  28. package/packages/driver-browser/src/keymap.ts +0 -8
  29. package/packages/driver-entone/src/keymap.ts +0 -1
  30. package/packages/driver-tizen/src/TizenKeys.ts +0 -2
  31. package/packages/driver-vidaa/src/DeviceVidaa.ts +2 -3
  32. package/packages/driver-vidaa/src/__mocks__/vidaa.ts +1 -1
  33. package/packages/driver-vidaa/src/keymap.ts +0 -2
  34. package/packages/driver-webos/src/DeviceWebos.ts +0 -8
  35. package/packages/driver-webos/src/keymap.ts +1 -2
  36. package/packages/driver-xbox/src/keymap.ts +1 -1
  37. package/packages/epg/README.md +1 -3
  38. package/packages/epg/src/v2/Cell.tsx +2 -16
  39. package/packages/epg/src/v2/DataManager.ts +41 -112
  40. package/packages/epg/src/v2/DatePicker.tsx +3 -9
  41. package/packages/epg/src/v2/DateToast/DateToast.tsx +9 -12
  42. package/packages/epg/src/v2/Day.tsx +3 -6
  43. package/packages/epg/src/v2/Epg.tsx +5 -5
  44. package/packages/epg/src/v2/MockGenerator/generator.ts +2 -3
  45. package/packages/epg/src/v2/ProgramInfo/utils.ts +3 -4
  46. package/packages/epg/src/v2/Row.tsx +1 -3
  47. package/packages/epg/src/v2/TimelineSection.tsx +1 -4
  48. package/packages/epg/src/v2/basic/CellsManager.tsx +2 -7
  49. package/packages/epg/src/v2/basic/RowsManager.tsx +1 -3
  50. package/packages/epg/src/v2/interface.ts +0 -13
  51. package/packages/events-manager/src/EventsManager.ts +56 -1
  52. package/packages/focus/README.md +0 -33
  53. package/packages/focus/src/IFocusable.ts +0 -1
  54. package/packages/focus/src/Layout/Base.tsx +6 -41
  55. package/packages/focus/src/Layout/Matrix.tsx +19 -51
  56. package/packages/focus/src/Layout/__test__/Base.spec.ts +180 -0
  57. package/packages/focus/src/Layout/__test__/Horizontal.spec.ts +94 -0
  58. package/packages/focus/src/Layout/__test__/Matrix.spec.ts +261 -0
  59. package/packages/focus/src/Layout/__test__/Vertical.spec.ts +46 -0
  60. package/packages/focus/src/Layout/__test__/isRtl.spec.ts +23 -0
  61. package/packages/focus/src/Layout/__test__/shared.ts +19 -0
  62. package/packages/focus/src/focusFirstExisting.ts +1 -7
  63. package/packages/focus/src/index.ts +1 -2
  64. package/packages/gallup/src/Gallup.ts +3 -3
  65. package/packages/grid/src/Base/Base.tsx +10 -15
  66. package/packages/grid/src/FirstOnlyGrid/FirstOnlyGrid.tsx +2 -4
  67. package/packages/icon/src/Icon.tsx +5 -27
  68. package/packages/input/README.md +1 -4
  69. package/packages/input/src/Input.tsx +29 -65
  70. package/packages/input/src/handleOverflow.ts +29 -0
  71. package/packages/interactable/README.md +1 -2
  72. package/packages/interactable/src/Interactable.tsx +3 -9
  73. package/packages/interactable/src/interface.ts +0 -1
  74. package/packages/jsx/src/index.ts +1 -1
  75. package/packages/jsx/src/test-utils/index.ts +0 -1
  76. package/packages/keyboard/src/Backdrop/Backdrop.scss +0 -2
  77. package/packages/keyboard/src/KeyboardBase.tsx +4 -16
  78. package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.scss +0 -4
  79. package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.tsx +20 -28
  80. package/packages/keyboard/src/WhitelabelKeyboard/_sizes.1080.scss +0 -1
  81. package/packages/keyboard/src/WhitelabelKeyboard/_sizes.scss +0 -1
  82. package/packages/keyboard/src/WhitelabelKeyboard/layouts/index.ts +0 -11
  83. package/packages/keyboard/src/WhitelabelKeyboard/types.ts +0 -1
  84. package/packages/l10n/README.md +0 -18
  85. package/packages/l10n/src/date/common.ts +6 -18
  86. package/packages/l10n/src/date/cs.ts +8 -2
  87. package/packages/l10n/src/date/en-001.ts +3 -3
  88. package/packages/l10n/src/date/en-common.ts +4 -5
  89. package/packages/l10n/src/date/en-us.ts +3 -3
  90. package/packages/l10n/src/date/iso.ts +13 -12
  91. package/packages/l10n/src/date/types.ts +0 -9
  92. package/packages/l10n/src/l10n.ts +3 -61
  93. package/packages/list/src/Base/Base.tsx +9 -19
  94. package/packages/list/src/Base/interface.ts +2 -2
  95. package/packages/list/src/CenteredList/controller.ts +1 -0
  96. package/packages/list/src/EdgeOffsetList/EdgeOffsetList.tsx +3 -3
  97. package/packages/list/src/UnifiedListController/UnifiedListController.ts +2 -6
  98. package/packages/logger/src/loggers/SentryLogger/Sentry.ts +0 -1
  99. package/packages/logger/src/loggers/SentryLogger/SentryLogger.ts +2 -2
  100. package/packages/menu/src/MenuAndContentContainer/MenuAndContentContainer.tsx +3 -31
  101. package/packages/menu/src/MenuAndContentContainer/interface.ts +0 -8
  102. package/packages/modal-service/README.md +1 -4
  103. package/packages/modal-service/src/ModalService.tsx +5 -29
  104. package/packages/perf-utils/README.md +120 -1
  105. package/packages/perf-utils/src/array/filter.ts +54 -1
  106. package/packages/perf-utils/src/array/find.ts +43 -1
  107. package/packages/perf-utils/src/array/findIndex.ts +43 -1
  108. package/packages/perf-utils/src/array/forEach.ts +48 -1
  109. package/packages/perf-utils/src/array/includes.ts +41 -1
  110. package/packages/perf-utils/src/array/includesNaN.ts +32 -1
  111. package/packages/perf-utils/src/array/index.ts +7 -1
  112. package/packages/perf-utils/src/array/map.ts +52 -1
  113. package/packages/player-ui/README.md +1 -1
  114. package/packages/player-ui/src/CurrentTime.tsx +2 -2
  115. package/packages/player-ui/src/Duration.tsx +2 -2
  116. package/packages/player-ui/src/PauseButton.tsx +0 -8
  117. package/packages/player-ui/src/PlayerInteractable.tsx +0 -1
  118. package/packages/player-ui/src/PlayerTime.tsx +1 -3
  119. package/packages/player-ui/src/PlayerUI.tsx +35 -68
  120. package/packages/player-ui/src/RemainingTime.tsx +2 -2
  121. package/packages/player-ui/src/Seekbar.tsx +18 -110
  122. package/packages/player-ui/src/Seeking.ts +16 -57
  123. package/packages/player-ui/src/Subtitles.tsx +2 -2
  124. package/packages/player-ui/src/index.ts +0 -1
  125. package/packages/player-ui/src/mocks.ts +8 -32
  126. package/packages/player-ui/src/timeUtils.ts +3 -3
  127. package/packages/player-ui/src/types.ts +3 -9
  128. package/packages/router/src/Route.tsx +27 -61
  129. package/packages/router/src/Router.tsx +13 -59
  130. package/packages/router/src/history.ts +1 -8
  131. package/packages/router/src/index.ts +1 -1
  132. package/packages/router/src/utils.ts +4 -9
  133. package/packages/sass-utils/src/linear-gradient.scss +4 -9
  134. package/packages/sass-utils/src/scale.1080.scss +1 -3
  135. package/packages/sass-utils/src/scale.720.scss +1 -1
  136. package/packages/time/README.md +1 -4
  137. package/packages/time/src/Time.ts +13 -35
  138. package/packages/time/src/constants.ts +0 -1
  139. package/packages/toast/src/ToastService.tsx +5 -16
  140. package/packages/types-bigscreen-jsx/README.md +4 -5
  141. package/packages/types-bigscreen-jsx/index.d.ts +67 -72
  142. package/packages/utils/README.md +0 -27
  143. package/packages/utils/src/elementUtils.ts +0 -25
  144. package/packages/utils/src/index.ts +0 -8
  145. package/packages/utils/src/scaledImage.ts +3 -6
  146. package/packages/utils/src/textUtils.ts +14 -46
  147. package/packages/utils/src/wait.ts +1 -3
  148. package/packages/utils/src/xhr/xhrSend.ts +1 -3
  149. package/packages/utils/src/xhr/xhrSendRetry.ts +1 -3
  150. package/packages/zapping/src/ChannelZapping.ts +0 -9
  151. package/packages/zapping/src/Zapping.tsx +0 -10
  152. package/.vscode/settings.json +0 -6
  153. package/packages/analytics/README.md +0 -8
  154. package/packages/analytics/src/A.ts +0 -1
  155. package/packages/analytics/src/Analytics.ts +0 -1
  156. package/packages/analytics/src/analyticsOnScroll.ts +0 -1
  157. package/packages/analytics/src/clients/ConsoleAnalytics/ConsoleAnalytics.ts +0 -1
  158. package/packages/analytics/src/clients/ConsoleAnalytics/index.ts +0 -1
  159. package/packages/analytics/src/clients/GoogleAnalytics/GoogleAnalytics.ts +0 -200
  160. package/packages/analytics/src/clients/GoogleAnalytics/constants.ts +0 -118
  161. package/packages/analytics/src/clients/GoogleAnalytics/getUrl.ts +0 -17
  162. package/packages/analytics/src/clients/GoogleAnalytics/index.ts +0 -2
  163. package/packages/analytics/src/clients/GoogleAnalytics/interface.ts +0 -77
  164. package/packages/analytics/src/clients/GoogleAnalytics/mapPayload.ts +0 -50
  165. package/packages/analytics/src/clients/GoogleAnalytics/prepareBody.ts +0 -14
  166. package/packages/analytics/src/clients/TealiumAnalytics/TealiumAnalytics.ts +0 -169
  167. package/packages/analytics/src/clients/TealiumAnalytics/constants.ts +0 -102
  168. package/packages/analytics/src/clients/TealiumAnalytics/findIdForLanguage.ts +0 -9
  169. package/packages/analytics/src/clients/TealiumAnalytics/index.ts +0 -4
  170. package/packages/analytics/src/clients/TealiumAnalytics/interface.ts +0 -33
  171. package/packages/analytics/src/clients/TealiumAnalytics/mappers/__mocks__/mediaPayload.ts +0 -70
  172. package/packages/analytics/src/clients/TealiumAnalytics/mappers/helper.ts +0 -36
  173. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapAppError.ts +0 -13
  174. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapFavoriteAdd.ts +0 -11
  175. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapFavoriteRemove.ts +0 -11
  176. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapPlayerClose.ts +0 -15
  177. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapPlayerOpen.ts +0 -15
  178. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSceneView.ts +0 -18
  179. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearch.ts +0 -18
  180. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearchFailed.ts +0 -8
  181. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearchSuccess.ts +0 -8
  182. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoPause.ts +0 -15
  183. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoProgress.ts +0 -18
  184. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoResume.ts +0 -15
  185. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoStart.ts +0 -15
  186. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoStop.ts +0 -15
  187. package/packages/analytics/src/clients/TealiumAnalytics/types.ts +0 -156
  188. package/packages/analytics/src/clients/TwentyFourIQ/TwentyFourIQClient.ts +0 -116
  189. package/packages/analytics/src/clients/TwentyFourIQ/constants.ts +0 -99
  190. package/packages/analytics/src/clients/TwentyFourIQ/helper.ts +0 -34
  191. package/packages/analytics/src/clients/TwentyFourIQ/index.ts +0 -2
  192. package/packages/analytics/src/clients/TwentyFourIQ/interface.ts +0 -31
  193. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapAdLoaded.ts +0 -13
  194. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapAdSkipped.ts +0 -16
  195. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBase.ts +0 -21
  196. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBuffering.ts +0 -15
  197. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerClose.ts +0 -24
  198. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerOpen.ts +0 -18
  199. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapSceneView.ts +0 -15
  200. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapScroll.ts +0 -17
  201. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoComplete.ts +0 -21
  202. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoPause.ts +0 -24
  203. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoProgress.ts +0 -24
  204. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoStart.ts +0 -34
  205. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoStop.ts +0 -32
  206. package/packages/analytics/src/clients/TwentyFourIQ/types.ts +0 -115
  207. package/packages/analytics/src/constants.ts +0 -1
  208. package/packages/analytics/src/index.ts +0 -3
  209. package/packages/analytics/src/interface.ts +0 -1
  210. package/packages/analytics/src/utils/generateSessionId.ts +0 -8
  211. package/packages/create-package/dist/createPackage.js +0 -66
  212. package/packages/create-package/dist/createPackage.js.map +0 -1
  213. package/packages/create-package/dist/index.js +0 -5
  214. package/packages/create-package/dist/index.js.map +0 -1
  215. package/packages/create-package/dist/questionnaire/questions.js +0 -35
  216. package/packages/create-package/dist/questionnaire/questions.js.map +0 -1
  217. package/packages/create-package/dist/settings/Settings.js +0 -10
  218. package/packages/create-package/dist/settings/Settings.js.map +0 -1
  219. package/packages/create-package/dist/types.js +0 -3
  220. package/packages/create-package/dist/types.js.map +0 -1
  221. package/packages/device/src/driver/index.firetv.ts +0 -1
  222. package/packages/device/src/driver/index.smartcast.tv.ts +0 -1
  223. package/packages/driver-firetv/src/DeviceFireTV.ts +0 -18
  224. package/packages/driver-firetv/src/__mocks__/javaScriptBridge.ts +0 -36
  225. package/packages/driver-firetv/src/index.ts +0 -1
  226. package/packages/driver-smartcast/src/DeviceSmartCast.ts +0 -317
  227. package/packages/driver-smartcast/src/__mocks__/api.ts +0 -49
  228. package/packages/driver-smartcast/src/index.ts +0 -1
  229. package/packages/driver-smartcast/src/keymap.ts +0 -9
  230. package/packages/driver-smartcast/src/types.ts +0 -65
  231. package/packages/focus/src/hasFocus.ts +0 -36
  232. package/packages/input/src/utils.ts +0 -71
  233. package/packages/jsx/src/test-utils/keyup.ts +0 -27
  234. package/packages/keyboard/src/WhitelabelKeyboard/layouts/arabic.ts +0 -27
  235. package/packages/keyboard/src/WhitelabelKeyboard/layouts/burmese.ts +0 -27
  236. package/packages/keyboard/src/WhitelabelKeyboard/layouts/dari.ts +0 -28
  237. package/packages/keyboard/src/WhitelabelKeyboard/layouts/korean.ts +0 -26
  238. package/packages/keyboard/src/WhitelabelKeyboard/layouts/pashto.ts +0 -27
  239. package/packages/keyboard/src/WhitelabelKeyboard/layouts/persian.ts +0 -27
  240. package/packages/keyboard/src/WhitelabelKeyboard/layouts/russian.ts +0 -27
  241. package/packages/keyboard/src/WhitelabelKeyboard/layouts/tibetan.ts +0 -26
  242. package/packages/keyboard/src/WhitelabelKeyboard/layouts/turkish.ts +0 -26
  243. package/packages/keyboard/src/WhitelabelKeyboard/layouts/ukrainian.ts +0 -27
  244. package/packages/keyboard/src/WhitelabelKeyboard/layouts/urdu.ts +0 -26
  245. package/packages/l10n/src/date/de.ts +0 -97
  246. package/packages/l10n/src/date/es.ts +0 -71
  247. package/packages/l10n/src/date/fr.ts +0 -94
  248. package/packages/l10n/src/date/he.ts +0 -101
  249. package/packages/time/src/adapters/24iMediaTimeApi.ts +0 -47
  250. package/packages/time/src/services/24iMediaTimeApi/24iMediaTimeApi.ts +0 -43
  251. package/packages/time/src/services/24iMediaTimeApi/index.ts +0 -6
  252. package/packages/utils/src/forceReflow.ts +0 -14
  253. package/packages/utils/src/keyPress/index.ts +0 -6
  254. package/packages/utils/src/keyPress/keyPressSimulator.ts +0 -74
  255. package/packages/utils/src/keyPress/simulateKeyPress.ts +0 -25
  256. package/utils/release/release.ts +0 -154
@@ -28,8 +28,6 @@ const filterNulls = (allChildren: (JSX.Element | null)[]) => (
28
28
  export class Router extends Component<Props> {
29
29
  paths: { [key: string]: RoutePath } = {};
30
30
 
31
- routerDomRef = createRef<HTMLDivElement>();
32
-
33
31
  static defaultProps = {
34
32
  defaultPath: '/',
35
33
  detachInactiveRoutes: true,
@@ -40,14 +38,12 @@ export class Router extends Component<Props> {
40
38
  constructor(props: Props) {
41
39
  super(props);
42
40
  routerRef.current = this;
43
- const { children } = this.props;
44
- this.createRefs(children);
41
+ this.createRefs();
45
42
  }
46
43
 
47
44
  componentDidMount() {
48
45
  window.document.addEventListener('keydown', this.onKeyDown, false);
49
46
  window.addEventListener('hashchange', this.onHashChange, false);
50
- this.hideAllRoutes();
51
47
  this.goToDefaultPath();
52
48
  }
53
49
 
@@ -95,8 +91,6 @@ export class Router extends Component<Props> {
95
91
  return activeRoutePath?.ref.current || null;
96
92
  }
97
93
 
98
- // TODO: refactor to reduce complexity
99
- // eslint-disable-next-line sonarjs/cognitive-complexity
100
94
  switchRoutes(
101
95
  routePathToHide: RoutePath | null,
102
96
  routePathToShow: RoutePath | null,
@@ -110,31 +104,18 @@ export class Router extends Component<Props> {
110
104
  } else if (routePathToShow) {
111
105
  routeToHide!.hide();
112
106
  routePathToHide.isVisible = false;
113
- if (detachInactiveRoutes) {
114
- routeToHide!.replace(routeToShow!);
115
- } else {
116
- routeToHide!.hideRoute();
117
- routeToShow!.showRoute();
118
- }
107
+ if (detachInactiveRoutes) routeToHide!.replace(routeToShow!);
119
108
  routeToShow!.show();
120
109
  routePathToShow.isVisible = true;
121
110
  return;
122
111
  } else {
123
112
  routeToHide!.hide();
124
113
  routePathToHide.isVisible = false;
125
- if (detachInactiveRoutes) {
126
- routeToHide!.detach();
127
- } else {
128
- routeToHide!.hideRoute();
129
- }
114
+ if (detachInactiveRoutes) routeToHide!.detach();
130
115
  }
131
116
  }
132
117
  if (routePathToShow) {
133
- if (detachInactiveRoutes) {
134
- routeToShow!.attach();
135
- } else {
136
- routeToShow!.showRoute();
137
- }
118
+ if (detachInactiveRoutes) routeToShow!.attach();
138
119
  routeToShow!.show();
139
120
  routePathToShow.isVisible = true;
140
121
  }
@@ -144,10 +125,11 @@ export class Router extends Component<Props> {
144
125
  this.getActiveRoute()?.focus();
145
126
  }
146
127
 
147
- createRefs(routes: JSX.Element[]) {
148
- forEach(routes, (route: JSX.Element) => {
149
- if (route.type === Route) {
150
- const { path } = route.props;
128
+ createRefs() {
129
+ const { children } = this.props;
130
+ forEach(children, (child: JSX.Element) => {
131
+ if (child.type === Route) {
132
+ const { path } = child.props;
151
133
  const { regexpPath, paramNames } = pathToRegExp(path);
152
134
  this.paths[path] = {
153
135
  ref: createRef<Route>(),
@@ -169,28 +151,9 @@ export class Router extends Component<Props> {
169
151
  }
170
152
  }
171
153
 
172
- hideAllRoutes() {
173
- const { detachInactiveRoutes } = this.props;
174
- forEach(Object.keys(this.paths), (key: string) => {
175
- const route = this.paths[key];
176
- if (!route.isVisible) {
177
- if (detachInactiveRoutes) {
178
- route.ref.current!.detach();
179
- } else {
180
- route.ref.current!.hideRoute();
181
- }
182
- }
183
- });
184
- }
185
-
186
- appendRoutes(routes: JSX.Element[]) {
187
- this.createRefs(routes);
188
- this.appendMount(this.renderRoutes(routes), this.routerDomRef);
189
- this.hideAllRoutes();
190
- }
191
-
192
- renderRoutes(routes: JSX.Element[]) {
193
- return filterNulls(map(routes, (child: JSX.Element) => {
154
+ render() {
155
+ const { children, detachInactiveRoutes } = this.props;
156
+ return filterNulls(map(children, (child: JSX.Element) => {
194
157
  if (child.type === Route) {
195
158
  const { path, Component: RouteComponent } = child.props;
196
159
  const route = this.paths[path];
@@ -198,23 +161,14 @@ export class Router extends Component<Props> {
198
161
  <Route
199
162
  ref={route.ref}
200
163
  path={path}
201
- domParent={this.routerDomRef}
202
164
  regexpPath={route.regexpPath}
203
165
  Component={RouteComponent}
204
166
  paramNames={route.paramNames}
167
+ isDetachable={detachInactiveRoutes}
205
168
  />
206
169
  );
207
170
  }
208
171
  return null;
209
172
  }));
210
173
  }
211
-
212
- render() {
213
- const { children } = this.props;
214
- return (
215
- <div ref={this.routerDomRef} className="router">
216
- {this.renderRoutes(children)}
217
- </div>
218
- );
219
- }
220
174
  }
@@ -2,10 +2,8 @@ import { NavigationConfig } from './types';
2
2
 
3
3
  export const history: string[] = [];
4
4
 
5
- const pathWithHash = (path:string) => `#${path}`;
6
-
7
5
  const navigate = (path: string) => {
8
- window.location.href = pathWithHash(path);
6
+ window.location.href = `#${path}`;
9
7
  };
10
8
 
11
9
  export const go = (path: string, { skipHistory, replaceHistory }: NavigationConfig = {}) => {
@@ -24,8 +22,3 @@ export const back = () => {
24
22
  export const clearHistory = () => {
25
23
  history.length = 0;
26
24
  };
27
-
28
- export const replaceState = (path: string) => {
29
- history[history.length - 1] = path;
30
- window.history.replaceState(null, '', pathWithHash(path));
31
- };
@@ -1,6 +1,6 @@
1
1
  export { Router } from './Router';
2
2
  export { Route } from './Route';
3
3
  export type { IRoute } from './types';
4
- export { history, go, back, clearHistory, replaceState } from './history';
4
+ export { history, go, back, clearHistory } from './history';
5
5
  export { focusActiveRoute } from './focusActiveRoute';
6
6
  export { fromSafeUrl, toSafeUrl } from './utils';
@@ -6,16 +6,14 @@ export const isPathVisible = (hash: string, regexpPath?: RegExp) => (
6
6
 
7
7
  export const getCurrentHash = () => window.location.href.split('#')[1] || '';
8
8
 
9
- // eslint-disable-next-line no-useless-escape
10
- const PARAM_REGEX = /([a-zA-Z0-9+\-=.:%_()\[\]{}]+)/;
11
- export const PARAM_REGEX_STR = PARAM_REGEX.source;
9
+ const PARAM = '([a-zA-Z0-9-=.:%_()\\[\\]{}]+)';
12
10
 
13
11
  export const pathToRegExp = (path: string) => {
14
12
  const regexpParts: string[] = [];
15
13
  const paramNames: string[] = [];
16
14
  forEach(path.split('/'), (pathPart) => {
17
15
  if (pathPart.indexOf(':') === 0) {
18
- regexpParts.push(PARAM_REGEX_STR);
16
+ regexpParts.push(PARAM);
19
17
  paramNames.push(pathPart.replace(':', ''));
20
18
  } else regexpParts.push(pathPart);
21
19
  });
@@ -25,13 +23,10 @@ export const pathToRegExp = (path: string) => {
25
23
  };
26
24
  };
27
25
 
28
- const toUrlSafeBase64 = (param: string) => btoa(param).replace('/', '_');
29
- const fromUrlSafeBase64 = (base64: string) => atob(base64.replace('_', '/'));
30
-
31
26
  export const toSafeUrl = (param: string) => (
32
- toUrlSafeBase64(unescape(encodeURIComponent(param)))
27
+ btoa(unescape(encodeURIComponent(param)))
33
28
  );
34
29
 
35
30
  export const fromSafeUrl = (base64: string) => (
36
- decodeURIComponent(escape(fromUrlSafeBase64(base64)))
31
+ decodeURIComponent(escape(atob(base64)))
37
32
  );
@@ -1,8 +1,3 @@
1
- @use 'sass:list';
2
- @use 'sass:math';
3
- @use 'sass:meta';
4
- @use 'sass:map';
5
-
6
1
  @function legacy-direction($value) {
7
2
  @if is-direction($value) == false {
8
3
  @error "Cannot convert `#{$value}` to legacy syntax because it doesn't seem to be a direction.";
@@ -21,18 +16,18 @@
21
16
  to left top : right bottom,
22
17
  to top left : bottom right
23
18
  );
24
- @if map.has-key($conversion-map, $value) {
25
- @return map.get($conversion-map, $value);
19
+ @if map-has-key($conversion-map, $value) {
20
+ @return map-get($conversion-map, $value);
26
21
  }
27
22
  @return 90deg - $value;
28
23
  }
29
24
 
30
25
  @function is-direction($value) {
31
- $is-keyword: list.index((
26
+ $is-keyword: index((
32
27
  to top, to top right, to right top, to right, to bottom right, to right bottom,
33
28
  to bottom, to bottom left, to left bottom, to left, to left top, to top left,
34
29
  ), $value);
35
- $is-angle: meta.type-of($value) == 'number' and list.index('deg' 'grad' 'turn' 'rad', math.unit($value));
30
+ $is-angle: type-of($value) == 'number' and index('deg' 'grad' 'turn' 'rad', unit($value));
36
31
 
37
32
  @return $is-keyword or $is-angle;
38
33
  }
@@ -1,5 +1,3 @@
1
- @use 'sass:math';
2
-
3
1
  @function scale($value) {
4
- @return math.round($number: $value);
2
+ @return round($number: $value);
5
3
  }
@@ -1,5 +1,5 @@
1
1
  @use 'sass:math';
2
2
 
3
3
  @function scale($value) {
4
- @return math.round($number: math.div($value, 1.5));
4
+ @return round($number: math.div($value, 1.5));
5
5
  }
@@ -52,7 +52,7 @@ await time.init({
52
52
  ```
53
53
 
54
54
  ### `getCurrentTime(): Date`
55
- It returns date object having UTC time set to local time.
55
+ It returns date object having local time set to server current time.
56
56
 
57
57
  ### `getCurrentUnixTime(): number`
58
58
  It returns UNIX time in milliseconds of server UTC time.
@@ -60,9 +60,6 @@ It returns UNIX time in milliseconds of server UTC time.
60
60
  ### `getTimezoneOffset(): number`
61
61
  It returns timezone offset in minutes, for UTC+1 (Germany) is 60.
62
62
 
63
- ### `getTimezoneOffsetMs(): number`
64
- It returns timezone offset in milliseconds, for UTC+1 (Germany) is 3600000.
65
-
66
63
  ### `initStatus: InitStatus`
67
64
  To check what time you are using, just check the `initStatus` property.
68
65
 
@@ -1,6 +1,6 @@
1
1
  import { createInterval } from '@24i/bigscreen-sdk/utils/timers';
2
2
  import { parseIsoDate, getDayStart, getDayEnd } from './utils';
3
- import { InitStatus, ErrorCode, MS_PER_MINUTE } from './constants';
3
+ import { InitStatus, ErrorCode } from './constants';
4
4
  import { Config, TimeServiceResp } from './types';
5
5
 
6
6
  /**
@@ -22,9 +22,6 @@ class Time {
22
22
  /** The difference in milliseconds between System Date and Server Date */
23
23
  offsetMs = 0;
24
24
 
25
- /** The difference Date object internally adds to timestamp if not asking for UTC time. */
26
- deviceOffset = new Date().getTimezoneOffset() * MS_PER_MINUTE;
27
-
28
25
  /** Timer for periodical time update */
29
26
  syncInterval = createInterval();
30
27
 
@@ -116,7 +113,7 @@ class Time {
116
113
  this.currentTime = currentTime;
117
114
  this.serverTime = date;
118
115
  this.serverUnixTime = unixTime;
119
- this.offsetMs = this.currentTime.getTime() - this.serverTime.getTime() + this.deviceOffset;
116
+ this.offsetMs = this.currentTime.getTime() - this.serverTime.getTime();
120
117
  this.timezoneOffset = timezoneOffset;
121
118
  }
122
119
 
@@ -171,15 +168,6 @@ class Time {
171
168
  return this.timezoneOffset;
172
169
  }
173
170
 
174
- /**
175
- * Returns the timezone offset in milliseconds.
176
- *
177
- * @returns Timezone offset in milliseconds, e.g. for UTC+1 (Germany) is 3600000.
178
- */
179
- getTimezoneOffsetMs() {
180
- return this.timezoneOffset * MS_PER_MINUTE;
181
- }
182
-
183
171
  /**
184
172
  * Returns offset (milliseconds) between System and Server Date object.
185
173
  *
@@ -204,34 +192,24 @@ class Time {
204
192
  }
205
193
 
206
194
  /**
207
- * Returns time, which is manipulated, based on the fact, that UI is displaying values in UTC.
195
+ * Returns current time.
208
196
  *
209
- * @returns Current time values as being in UTC zone.
197
+ * @returns Current time.
210
198
  */
211
199
  getCurrentTime() {
212
200
  const now = new Date().getTime();
213
201
  return new Date(now - this.offsetMs);
214
202
  }
215
203
 
216
- /**
217
- * Returns current time.
218
- *
219
- * @returns Current time.
220
- */
221
- getCurrentTimeReal() {
222
- const nowShifted = this.getCurrentTime().getTime();
223
- return new Date(nowShifted + this.deviceOffset);
224
- }
225
-
226
204
  /**
227
205
  * Returns whether the timestamp belongs to today
228
206
  * @param timestamp to check
229
207
  * @returns true if the timestamp falls between start and end of today
230
208
  */
231
209
  isToday(timestamp: number) {
232
- const currentDate = this.getCurrentTimeReal();
233
- const startOfToday = getDayStart(currentDate) - this.deviceOffset; // We must get 00:00 UTC
234
- const endOfToday = getDayEnd(currentDate) - this.deviceOffset;
210
+ const currentTime = this.getCurrentTime();
211
+ const startOfToday = getDayStart(currentTime);
212
+ const endOfToday = getDayEnd(currentTime);
235
213
  return startOfToday <= timestamp && timestamp < endOfToday;
236
214
  }
237
215
 
@@ -241,10 +219,10 @@ class Time {
241
219
  * @returns true if the timestamp falls between start and end of tomorrow
242
220
  */
243
221
  isTomorrow(timestamp: number) {
244
- const currentDate = this.getCurrentTimeReal();
245
- const startOfTomorrow = getDayEnd(currentDate) - this.deviceOffset;
222
+ const currentTime = this.getCurrentTime();
223
+ const startOfTomorrow = getDayEnd(currentTime);
246
224
  const tommorow = new Date(startOfTomorrow + 1);
247
- const endOfTomorrow = getDayEnd(tommorow) - this.deviceOffset;
225
+ const endOfTomorrow = getDayEnd(tommorow);
248
226
  return startOfTomorrow <= timestamp && timestamp < endOfTomorrow;
249
227
  }
250
228
 
@@ -254,10 +232,10 @@ class Time {
254
232
  * @returns true if the timestamp falls between start and end of yesterday
255
233
  */
256
234
  isYesterday(timestamp: number) {
257
- const currentDate = this.getCurrentTimeReal();
258
- const endOfYesterday = getDayStart(currentDate) - this.deviceOffset;
235
+ const currentTime = this.getCurrentTime();
236
+ const endOfYesterday = getDayStart(currentTime);
259
237
  const yesterday = new Date(endOfYesterday - 1);
260
- const startOfYesterday = getDayStart(yesterday) - this.deviceOffset;
238
+ const startOfYesterday = getDayStart(yesterday);
261
239
  return startOfYesterday <= timestamp && timestamp < endOfYesterday;
262
240
  }
263
241
  }
@@ -9,6 +9,5 @@ export const ErrorCode = {
9
9
  NO_TIME_SERVICE_PROVIDER: 'NO_TIME_SERVICE_PROVIDER',
10
10
  };
11
11
 
12
- export const MS_PER_MINUTE = 60000;
13
12
  export const MINUTES_PER_HOUR = 60;
14
13
  export const HOURS_PER_DAY = 24;
@@ -34,22 +34,11 @@ export class ToastService<T extends MinimalToastProps> extends Component<Props<T
34
34
  this.serviceContinue();
35
35
  },
36
36
  } as T);
37
-
38
- // Check if toast element with the same message already exists in stack
39
- const elementExists = this.toastElementBuffer.find((item) => {
40
- const { message: newMessage } = toastElement.props;
41
- const { message } = item.props;
42
-
43
- return message === newMessage;
44
- }) !== undefined;
45
-
46
- if (!elementExists) {
47
- if (!this.isShowingToast) {
48
- this.appendMount(toastElement, this.rootDivRef);
49
- this.isShowingToast = true;
50
- } else {
51
- this.toastElementBuffer.push(toastElement);
52
- }
37
+ if (!this.isShowingToast) {
38
+ this.appendMount(toastElement, this.rootDivRef);
39
+ this.isShowingToast = true;
40
+ } else {
41
+ this.toastElementBuffer.push(toastElement);
53
42
  }
54
43
  }
55
44
 
@@ -1,12 +1,11 @@
1
1
  # BIGscreen JSX Types
2
2
  BIGscreen JSX is a set of tools that allow you to write JSX and converts it to JS Dom API.
3
- This package contains types originally from @types/react, modified for bigscreen-jsx needs.
3
+ This package contains types originally from @types/react, modified for smartapps-bigscreen-jsx needs.
4
4
 
5
5
  # Contributing
6
- Navigate to `<root>/node_modules/@types/react/`.
7
- All react types are inside files `index.d.ts` and `global.d.ts`. Modify them to suit your needs and afterwards run this commands in the `<root>` directory:
6
+ Navigate to `<root>/packages/types-smartapps-bigscreen-jsx/node_modules/@types/react/`.
7
+ All react types are inside files `index.d.ts` and `global.d.ts`. Modify them to suit your needs and afterwards run this command in the `packages/types-smartapps-bigscreen-jsx/` directory:
8
8
 
9
9
  `npx patch-package @types/react`
10
- `npm install`
11
10
 
12
- You can confirm everything worked by looking into `<root>/patches/`. You should see a file named `@types+react+<version-etc>.patch` that includes diff of your changes.
11
+ You can confirm everything worked by looking into `packages/types-smartapps-bigscreen-jsx/patches/`. You should see a file named `@types+react+<version-etc>.patch` that includes diff of your changes.