@24i/bigscreen-sdk 1.0.54-alpha.2836 → 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 (278) hide show
  1. package/README.md +3 -2
  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 +5 -57
  11. package/packages/developer-tools/src/TechnicalInfo/__mocks__/Device.ts +0 -12
  12. package/packages/developer-tools/src/TechnicalInfo/translations.ts +0 -8
  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 -92
  17. package/packages/driver-androidtv/src/__mocks__/javaScriptBridge.ts +5 -38
  18. package/packages/driver-androidtv/src/index.ts +0 -1
  19. package/packages/driver-androidtv/src/keymap.ts +0 -18
  20. package/packages/driver-androidtv/src/types.ts +16 -144
  21. package/packages/driver-base/src/DeviceBase.ts +2 -80
  22. package/packages/driver-base/src/KeyMap/Key.ts +1 -8
  23. package/packages/driver-base/src/KeyMap/KeyMap.ts +0 -4
  24. package/packages/driver-base/src/KeyMap/interface.ts +0 -1
  25. package/packages/driver-base/src/KeyMap/overrideValues.ts +1 -2
  26. package/packages/driver-base/src/__mocks__/DeviceBase.ts +0 -24
  27. package/packages/driver-base/src/__mocks__/keyMap.ts +0 -1
  28. package/packages/driver-base/src/index.ts +0 -3
  29. package/packages/driver-base/src/types/DeviceEvent.ts +0 -2
  30. package/packages/driver-base/src/types/KeycodeKeyMap.ts +0 -1
  31. package/packages/driver-browser/src/DeviceBrowser.ts +0 -26
  32. package/packages/driver-browser/src/keymap.ts +0 -8
  33. package/packages/driver-entone/src/DeviceEntone.ts +1 -31
  34. package/packages/driver-entone/src/keymap.ts +0 -1
  35. package/packages/driver-hbbtv/src/DeviceHbbTV.ts +0 -26
  36. package/packages/driver-kreatv/src/DeviceKreaTV.ts +0 -26
  37. package/packages/driver-saphi/src/DeviceSaphi.ts +0 -26
  38. package/packages/driver-tizen/src/DeviceTizen.ts +7 -126
  39. package/packages/driver-tizen/src/ITizen.ts +202 -15116
  40. package/packages/driver-tizen/src/IWebapis.ts +87 -8643
  41. package/packages/driver-tizen/src/TizenKeys.ts +2 -4
  42. package/packages/driver-tizen/src/__mocks__/tizen.ts +8 -7
  43. package/packages/driver-tizen/src/constants.ts +195 -1
  44. package/packages/driver-tizen/src/types.ts +14 -0
  45. package/packages/driver-vidaa/src/DeviceVidaa.ts +2 -29
  46. package/packages/driver-vidaa/src/__mocks__/vidaa.ts +1 -1
  47. package/packages/driver-vidaa/src/keymap.ts +0 -2
  48. package/packages/driver-webos/src/DeviceWebos.ts +0 -55
  49. package/packages/driver-webos/src/__mocks__/webos.ts +0 -33
  50. package/packages/driver-webos/src/constants.ts +0 -1
  51. package/packages/driver-webos/src/keymap.ts +1 -2
  52. package/packages/driver-webos/src/types.ts +0 -30
  53. package/packages/driver-xbox/src/DeviceXbox.ts +1 -30
  54. package/packages/driver-xbox/src/keymap.ts +1 -1
  55. package/packages/epg/README.md +1 -3
  56. package/packages/epg/src/v2/Cell.tsx +2 -16
  57. package/packages/epg/src/v2/DataManager.ts +41 -112
  58. package/packages/epg/src/v2/DatePicker.tsx +3 -9
  59. package/packages/epg/src/v2/DateToast/DateToast.tsx +9 -12
  60. package/packages/epg/src/v2/Day.tsx +3 -6
  61. package/packages/epg/src/v2/Epg.tsx +5 -5
  62. package/packages/epg/src/v2/MockGenerator/generator.ts +2 -3
  63. package/packages/epg/src/v2/ProgramInfo/utils.ts +3 -4
  64. package/packages/epg/src/v2/Row.tsx +1 -3
  65. package/packages/epg/src/v2/TimelineSection.tsx +1 -4
  66. package/packages/epg/src/v2/basic/CellsManager.tsx +2 -7
  67. package/packages/epg/src/v2/basic/RowsManager.tsx +1 -3
  68. package/packages/epg/src/v2/interface.ts +0 -13
  69. package/packages/events-manager/src/EventsManager.ts +56 -1
  70. package/packages/focus/README.md +0 -33
  71. package/packages/focus/src/IFocusable.ts +0 -1
  72. package/packages/focus/src/Layout/Base.tsx +6 -41
  73. package/packages/focus/src/Layout/Matrix.tsx +19 -51
  74. package/packages/focus/src/Layout/__test__/Base.spec.ts +180 -0
  75. package/packages/focus/src/Layout/__test__/Horizontal.spec.ts +94 -0
  76. package/packages/focus/src/Layout/__test__/Matrix.spec.ts +261 -0
  77. package/packages/focus/src/Layout/__test__/Vertical.spec.ts +46 -0
  78. package/packages/focus/src/Layout/__test__/isRtl.spec.ts +23 -0
  79. package/packages/focus/src/Layout/__test__/shared.ts +19 -0
  80. package/packages/focus/src/focusFirstExisting.ts +1 -7
  81. package/packages/focus/src/index.ts +1 -2
  82. package/packages/gallup/src/Gallup.ts +3 -3
  83. package/packages/grid/src/Base/Base.tsx +10 -15
  84. package/packages/grid/src/FirstOnlyGrid/FirstOnlyGrid.tsx +2 -4
  85. package/packages/grid/src/UnifiedGridController/UnifiedGridController.ts +6 -6
  86. package/packages/icon/src/Icon.tsx +5 -27
  87. package/packages/input/README.md +1 -1
  88. package/packages/input/src/Input.tsx +10 -16
  89. package/packages/interactable/README.md +1 -2
  90. package/packages/interactable/src/Interactable.tsx +3 -9
  91. package/packages/interactable/src/interface.ts +0 -1
  92. package/packages/jsx/src/index.ts +1 -1
  93. package/packages/jsx/src/test-utils/index.ts +0 -1
  94. package/packages/keyboard/src/Backdrop/Backdrop.scss +0 -2
  95. package/packages/keyboard/src/KeyboardBase.tsx +4 -16
  96. package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.scss +0 -4
  97. package/packages/keyboard/src/WhitelabelKeyboard/Keyboard.tsx +20 -28
  98. package/packages/keyboard/src/WhitelabelKeyboard/_sizes.1080.scss +0 -1
  99. package/packages/keyboard/src/WhitelabelKeyboard/_sizes.scss +0 -1
  100. package/packages/keyboard/src/WhitelabelKeyboard/layouts/index.ts +0 -12
  101. package/packages/keyboard/src/WhitelabelKeyboard/types.ts +0 -1
  102. package/packages/keyboard/src/utils/caret.ts +8 -5
  103. package/packages/keyboard/src/utils/input.ts +6 -5
  104. package/packages/l10n/README.md +0 -18
  105. package/packages/l10n/src/date/common.ts +6 -18
  106. package/packages/l10n/src/date/cs.ts +8 -2
  107. package/packages/l10n/src/date/en-001.ts +3 -3
  108. package/packages/l10n/src/date/en-common.ts +4 -5
  109. package/packages/l10n/src/date/en-us.ts +3 -3
  110. package/packages/l10n/src/date/iso.ts +13 -12
  111. package/packages/l10n/src/date/types.ts +0 -9
  112. package/packages/l10n/src/l10n.ts +3 -61
  113. package/packages/list/src/Base/Base.tsx +9 -19
  114. package/packages/list/src/Base/interface.ts +2 -2
  115. package/packages/list/src/BasicList/BasicList.tsx +7 -7
  116. package/packages/list/src/CenteredList/CenteredList.tsx +2 -2
  117. package/packages/list/src/CenteredList/controller.ts +1 -0
  118. package/packages/list/src/EdgeOffsetList/EdgeOffsetList.tsx +10 -10
  119. package/packages/list/src/FirstOnlyList/FirstOnlyList.tsx +2 -2
  120. package/packages/list/src/FirstOnlyVariedList/FirstOnlyVariedList.tsx +2 -2
  121. package/packages/list/src/FixedToEndList/FixedToEndList.tsx +2 -2
  122. package/packages/list/src/UnifiedListController/UnifiedListController.ts +2 -6
  123. package/packages/list/src/interface.ts +2 -2
  124. package/packages/logger/src/loggers/ConsoleLogger/ConsoleLogger.ts +1 -7
  125. package/packages/logger/src/loggers/SentryLogger/Sentry.ts +0 -1
  126. package/packages/logger/src/loggers/SentryLogger/SentryLogger.ts +3 -5
  127. package/packages/menu/src/MenuAndContentContainer/MenuAndContentContainer.tsx +3 -31
  128. package/packages/menu/src/MenuAndContentContainer/interface.ts +0 -8
  129. package/packages/modal-service/README.md +1 -4
  130. package/packages/modal-service/src/ModalService.tsx +5 -29
  131. package/packages/perf-utils/README.md +120 -1
  132. package/packages/perf-utils/src/array/filter.ts +54 -1
  133. package/packages/perf-utils/src/array/find.ts +43 -1
  134. package/packages/perf-utils/src/array/findIndex.ts +43 -1
  135. package/packages/perf-utils/src/array/forEach.ts +48 -1
  136. package/packages/perf-utils/src/array/includes.ts +41 -1
  137. package/packages/perf-utils/src/array/includesNaN.ts +32 -1
  138. package/packages/perf-utils/src/array/index.ts +7 -1
  139. package/packages/perf-utils/src/array/map.ts +52 -1
  140. package/packages/player-ui/README.md +1 -1
  141. package/packages/player-ui/src/CurrentTime.tsx +2 -2
  142. package/packages/player-ui/src/Duration.tsx +2 -2
  143. package/packages/player-ui/src/PauseButton.tsx +0 -8
  144. package/packages/player-ui/src/PlayerInteractable.tsx +0 -1
  145. package/packages/player-ui/src/PlayerTime.tsx +1 -3
  146. package/packages/player-ui/src/PlayerUI.tsx +35 -68
  147. package/packages/player-ui/src/RemainingTime.tsx +2 -2
  148. package/packages/player-ui/src/Seekbar.tsx +18 -110
  149. package/packages/player-ui/src/Seeking.ts +16 -57
  150. package/packages/player-ui/src/Subtitles.tsx +2 -2
  151. package/packages/player-ui/src/index.ts +0 -1
  152. package/packages/player-ui/src/mocks.ts +8 -32
  153. package/packages/player-ui/src/timeUtils.ts +3 -3
  154. package/packages/player-ui/src/types.ts +3 -9
  155. package/packages/router/README.md +0 -1
  156. package/packages/router/src/Route.tsx +27 -61
  157. package/packages/router/src/Router.tsx +14 -63
  158. package/packages/router/src/history.ts +1 -8
  159. package/packages/router/src/index.ts +1 -1
  160. package/packages/router/src/utils.ts +4 -9
  161. package/packages/sass-utils/src/linear-gradient.scss +4 -9
  162. package/packages/sass-utils/src/scale.1080.scss +1 -3
  163. package/packages/sass-utils/src/scale.720.scss +1 -1
  164. package/packages/time/README.md +1 -4
  165. package/packages/time/src/Time.ts +13 -35
  166. package/packages/time/src/constants.ts +0 -1
  167. package/packages/toast/src/ToastService.tsx +5 -16
  168. package/packages/types-bigscreen-jsx/README.md +4 -5
  169. package/packages/types-bigscreen-jsx/index.d.ts +67 -72
  170. package/packages/utils/README.md +0 -27
  171. package/packages/utils/src/elementUtils.ts +0 -25
  172. package/packages/utils/src/index.ts +0 -8
  173. package/packages/utils/src/scaledImage.ts +3 -6
  174. package/packages/utils/src/textUtils.ts +14 -46
  175. package/packages/utils/src/wait.ts +1 -3
  176. package/packages/utils/src/xhr/xhrSend.ts +1 -3
  177. package/packages/utils/src/xhr/xhrSendRetry.ts +1 -3
  178. package/packages/zapping/src/ChannelZapping.ts +0 -9
  179. package/packages/zapping/src/Zapping.tsx +0 -10
  180. package/ci/is_ci_job_skippable.sh +0 -153
  181. package/packages/analytics/README.md +0 -8
  182. package/packages/analytics/src/A.ts +0 -1
  183. package/packages/analytics/src/Analytics.ts +0 -1
  184. package/packages/analytics/src/analyticsOnScroll.ts +0 -1
  185. package/packages/analytics/src/clients/ConsoleAnalytics/ConsoleAnalytics.ts +0 -1
  186. package/packages/analytics/src/clients/ConsoleAnalytics/index.ts +0 -1
  187. package/packages/analytics/src/clients/GoogleAnalytics/GoogleAnalytics.ts +0 -196
  188. package/packages/analytics/src/clients/GoogleAnalytics/constants.ts +0 -126
  189. package/packages/analytics/src/clients/GoogleAnalytics/getUrl.ts +0 -17
  190. package/packages/analytics/src/clients/GoogleAnalytics/index.ts +0 -2
  191. package/packages/analytics/src/clients/GoogleAnalytics/interface.ts +0 -82
  192. package/packages/analytics/src/clients/GoogleAnalytics/mapPayload.ts +0 -51
  193. package/packages/analytics/src/clients/GoogleAnalytics/prepareBody.ts +0 -14
  194. package/packages/analytics/src/clients/TealiumAnalytics/TealiumAnalytics.ts +0 -181
  195. package/packages/analytics/src/clients/TealiumAnalytics/constants.ts +0 -106
  196. package/packages/analytics/src/clients/TealiumAnalytics/findForLanguage.ts +0 -9
  197. package/packages/analytics/src/clients/TealiumAnalytics/index.ts +0 -4
  198. package/packages/analytics/src/clients/TealiumAnalytics/interface.ts +0 -35
  199. package/packages/analytics/src/clients/TealiumAnalytics/mappers/__mocks__/mediaPayload.ts +0 -72
  200. package/packages/analytics/src/clients/TealiumAnalytics/mappers/helper.ts +0 -36
  201. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapAppError.ts +0 -13
  202. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapAppOpen.ts +0 -13
  203. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapFavoriteAdd.ts +0 -11
  204. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapFavoriteRemove.ts +0 -11
  205. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapPlayerClose.ts +0 -15
  206. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapPlayerOpen.ts +0 -15
  207. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSceneView.ts +0 -18
  208. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearch.ts +0 -18
  209. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearchFailed.ts +0 -8
  210. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapSearchSuccess.ts +0 -8
  211. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoPause.ts +0 -15
  212. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoProgress.ts +0 -18
  213. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoResume.ts +0 -15
  214. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoStart.ts +0 -15
  215. package/packages/analytics/src/clients/TealiumAnalytics/mappers/mapVideoStop.ts +0 -15
  216. package/packages/analytics/src/clients/TealiumAnalytics/types.ts +0 -161
  217. package/packages/analytics/src/clients/TwentyFourIQ/TwentyFourIQClient.ts +0 -107
  218. package/packages/analytics/src/clients/TwentyFourIQ/constants.ts +0 -111
  219. package/packages/analytics/src/clients/TwentyFourIQ/helper.ts +0 -34
  220. package/packages/analytics/src/clients/TwentyFourIQ/index.ts +0 -2
  221. package/packages/analytics/src/clients/TwentyFourIQ/interface.ts +0 -34
  222. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapAdEvent.ts +0 -20
  223. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBase.ts +0 -24
  224. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBuffering.ts +0 -15
  225. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerClose.ts +0 -25
  226. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerOpen.ts +0 -17
  227. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapSceneView.ts +0 -15
  228. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapScroll.ts +0 -17
  229. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoComplete.ts +0 -22
  230. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoPause.ts +0 -25
  231. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoProgress.ts +0 -25
  232. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoStart.ts +0 -34
  233. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoStop.ts +0 -32
  234. package/packages/analytics/src/clients/TwentyFourIQ/types.ts +0 -132
  235. package/packages/analytics/src/constants.ts +0 -1
  236. package/packages/analytics/src/index.ts +0 -3
  237. package/packages/analytics/src/interface.ts +0 -1
  238. package/packages/analytics/src/utils/generateSessionId.ts +0 -8
  239. package/packages/device/src/driver/index.firetv.ts +0 -1
  240. package/packages/device/src/driver/index.smartcast.tv.ts +0 -1
  241. package/packages/driver-base/src/types/AdInfo.ts +0 -5
  242. package/packages/driver-base/src/types/InAppPurchase.ts +0 -25
  243. package/packages/driver-firetv/src/DeviceFireTV.ts +0 -91
  244. package/packages/driver-firetv/src/__mocks__/javaScriptBridge.ts +0 -45
  245. package/packages/driver-firetv/src/index.ts +0 -1
  246. package/packages/driver-firetv/src/types.ts +0 -1
  247. package/packages/driver-smartcast/src/DeviceSmartCast.ts +0 -394
  248. package/packages/driver-smartcast/src/__mocks__/api.ts +0 -79
  249. package/packages/driver-smartcast/src/index.ts +0 -1
  250. package/packages/driver-smartcast/src/keymap.ts +0 -9
  251. package/packages/driver-smartcast/src/types.ts +0 -111
  252. package/packages/focus/src/hasFocus.ts +0 -36
  253. package/packages/jsx/src/test-utils/keyup.ts +0 -27
  254. package/packages/keyboard/src/WhitelabelKeyboard/layouts/arabic.ts +0 -27
  255. package/packages/keyboard/src/WhitelabelKeyboard/layouts/burmese.ts +0 -27
  256. package/packages/keyboard/src/WhitelabelKeyboard/layouts/dari.ts +0 -28
  257. package/packages/keyboard/src/WhitelabelKeyboard/layouts/korean.ts +0 -26
  258. package/packages/keyboard/src/WhitelabelKeyboard/layouts/pashto.ts +0 -27
  259. package/packages/keyboard/src/WhitelabelKeyboard/layouts/persian.ts +0 -27
  260. package/packages/keyboard/src/WhitelabelKeyboard/layouts/russian.ts +0 -27
  261. package/packages/keyboard/src/WhitelabelKeyboard/layouts/spanish.ts +0 -26
  262. package/packages/keyboard/src/WhitelabelKeyboard/layouts/tibetan.ts +0 -26
  263. package/packages/keyboard/src/WhitelabelKeyboard/layouts/turkish.ts +0 -26
  264. package/packages/keyboard/src/WhitelabelKeyboard/layouts/ukrainian.ts +0 -27
  265. package/packages/keyboard/src/WhitelabelKeyboard/layouts/urdu.ts +0 -26
  266. package/packages/keyboard/src/utils/setInputSelectionRange.ts +0 -10
  267. package/packages/l10n/src/date/de.ts +0 -97
  268. package/packages/l10n/src/date/es.ts +0 -71
  269. package/packages/l10n/src/date/fr.ts +0 -94
  270. package/packages/l10n/src/date/he.ts +0 -101
  271. package/packages/time/src/adapters/24iMediaTimeApi.ts +0 -47
  272. package/packages/time/src/services/24iMediaTimeApi/24iMediaTimeApi.ts +0 -43
  273. package/packages/time/src/services/24iMediaTimeApi/index.ts +0 -6
  274. package/packages/utils/src/forceReflow.ts +0 -14
  275. package/packages/utils/src/keyPress/index.ts +0 -6
  276. package/packages/utils/src/keyPress/keyPressSimulator.ts +0 -74
  277. package/packages/utils/src/keyPress/simulateKeyPress.ts +0 -25
  278. package/utils/release/release.ts +0 -156
@@ -1,91 +0,0 @@
1
- import {
2
- DeviceAndroidTV,
3
- IAPErrorEvent,
4
- IAPSuccessEvent,
5
- } from '@24i/bigscreen-sdk/driver-androidtv';
6
- import {
7
- IAPSuccessPayload, IAPPromiseReject, IAPPromiseResolve,
8
- IAPPurchaseProductData,
9
- } from '@24i/bigscreen-sdk/driver-base';
10
- import { VendorType } from '@24i/smartapps-datalayer/api';
11
- import { Receipt } from './types';
12
-
13
- /**
14
- * Fire TV driver implementing API of Android TV Bridge.
15
- *
16
- * See https://github.com/24i/prd-smart-ott-androidtv
17
- */
18
- export class DeviceFireTV extends DeviceAndroidTV {
19
- subscriptionFeaturesConfiguration = {
20
- purchase: true,
21
- management: false,
22
- };
23
-
24
- async getPlatformName(): Promise<string> {
25
- return 'FireTV';
26
- }
27
-
28
- async getDeviceName(): Promise<string> {
29
- const modelName = await this.getModelName();
30
- const manufacturerName = await this.getManufacturerName();
31
- return `FireTV ${manufacturerName} ${modelName}`.trim();
32
- }
33
-
34
- async getAdInfo() {
35
- let adId = null;
36
- let latEnabled = null;
37
- const type = 'afai';
38
- try {
39
- adId = window.JavaScriptBridge.bridgeJavaScriptToAndroid_GetAdId() ?? null;
40
- latEnabled = window.JavaScriptBridge.bridgeJavaScriptToAndroid_GetLimitAdTracking()
41
- ?? true;
42
- } catch (e) {
43
- latEnabled = true;
44
- console.error('[DeviceFireTV] Failed to getAdInfo', e);
45
- }
46
- return { adId, type, latEnabled };
47
- }
48
-
49
- onIAPSuccess = (resolve: IAPPromiseResolve, reject: IAPPromiseReject) => (event: unknown) => {
50
- this.removeIAPListeners(resolve, reject);
51
- try {
52
- const { userId, receipt: receiptToParse } = event as IAPSuccessEvent;
53
- const receipt: Receipt = JSON.parse(receiptToParse);
54
- window.JavaScriptBridge
55
- .bridgeReceiptAmazonIAPValidated(receipt.receiptId);
56
- resolve({
57
- platform: VendorType.AMAZON,
58
- receiptPayload: {
59
- userId,
60
- receiptId: receipt.receiptId,
61
- },
62
- });
63
- } catch (e) {
64
- reject(e);
65
- }
66
- };
67
-
68
- onIAPError = (resolve: IAPPromiseResolve, reject: IAPPromiseReject) => (event: unknown) => {
69
- this.removeIAPListeners(resolve, reject);
70
- reject(new Error((event as IAPErrorEvent).message));
71
- };
72
-
73
- removeIAPListeners(resolve: IAPPromiseResolve, reject: IAPPromiseReject) {
74
- document.removeEventListener('iapSuccess', this.onIAPSuccess(resolve, reject));
75
- document.removeEventListener('iapError', this.onIAPError(resolve, reject));
76
- }
77
-
78
- async purchaseProduct(data: IAPPurchaseProductData): Promise<IAPSuccessPayload> {
79
- return new Promise((resolve, reject) => {
80
- document.addEventListener('iapSuccess', this.onIAPSuccess(resolve, reject));
81
- document.addEventListener('iapError', this.onIAPError(resolve, reject));
82
- window.JavaScriptBridge.bridgeReceiptAmazonIAPValidation(data.sku!);
83
- });
84
- }
85
-
86
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
87
- async cancelSubscription(data: IAPPurchaseProductData): Promise<void> {
88
- // not supported
89
- throw new Error('Not supported');
90
- }
91
- }
@@ -1,45 +0,0 @@
1
- import { IJavaScriptBridge } from '../../../driver-androidtv/src/types';
2
-
3
- export const mockJavaScriptBridge: IJavaScriptBridge = {
4
- JavaScriptBridge: {
5
- bridgeJavaScriptToAndroid_GetDeviceInfo: () => (
6
- JSON.stringify({
7
- deviceBrand: 'Amazon',
8
- deviceModel: 'AFTR',
9
- osVersion: '8.0.0',
10
- appVersion: '0.0.1',
11
- appFlavor: 'appstage-bigscreen',
12
- drmKeySystems: '["W3C Clear Key", "Google Widevine"]',
13
- ipLocal: '127.0.0.1',
14
- })
15
- ),
16
- bridgeJavaScriptToAndroid_GetAdId: () => 'afai-id',
17
- bridgeJavaScriptToAndroid_GetLimitAdTracking: () => false,
18
- bridgeJavaScriptToAndroid_GetOsLanguage: () => '',
19
- bridgeJavaScriptToAndroid_GetMediaInfo: () => '{}',
20
- bridgeJavaScriptToAndroid_Back: () => {},
21
- bridgeJavaScriptToAndroid_ReloadPlayer: () => {},
22
- bridgeJavaScriptToAndroid_StopVideo: () => {},
23
- bridgeJavaScriptToAndroid_FullScreenVideo: () => {},
24
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
- bridgeJavaScriptToAndroid_SetVideoPath: (url: string) => {},
26
- bridgeJavaScriptToAndroid_IsPlaying: () => true,
27
- bridgeJavaScriptToAndroid_PauseVideo: () => {},
28
- bridgeJavaScriptToAndroid_PlayVideo: () => {},
29
- bridgeJavaScriptToAndroid_IsLive: () => false,
30
- bridgeJavaScriptToAndroid_GetCurrentTime: () => Date.now(),
31
- bridgeJavaScriptToAndroid_GetTotalTime: () => Date.now(),
32
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
- bridgeJavaScriptToAndroid_SeekTo: (milliseconds: number) => {},
34
- bridgeJavaScriptToAndroid_getCurrentSubtitleTrack: () => '{}',
35
- bridgeJavaScriptToAndroid_getCurrentAudioTrack: () => '{}',
36
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
37
- bridgeJavaScriptToAndroid_SetTrack: (track: string) => {},
38
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
39
- bridgeJavaScriptToAndroid_SetAudioTrack: (track: string) => {},
40
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
41
- bridgeReceiptAmazonIAPValidation: (sku: string) => {},
42
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
43
- bridgeReceiptAmazonIAPValidated: (receiptId: string) => {},
44
- },
45
- };
@@ -1 +0,0 @@
1
- export { DeviceFireTV } from './DeviceFireTV';
@@ -1 +0,0 @@
1
- export type Receipt = object & { receiptId: string };
@@ -1,394 +0,0 @@
1
- import {
2
- DeviceBase, ConnectionType, ScreenSaverStatus, VolumeRange,
3
- IAPSuccessPayload,
4
- IAPPurchaseProductData,
5
- } from '@24i/bigscreen-sdk/driver-base';
6
- import { runAsync } from '@24i/bigscreen-sdk/utils/timers';
7
- import { ipify } from '@24i/bigscreen-sdk/ipify';
8
- import { VendorType } from '@24i/smartapps-datalayer/api';
9
- import { getKeyMap } from './keymap';
10
- import {
11
- ISmartCastApi,
12
- IFA,
13
- DEFAULT_TTS_TIMEOUT,
14
- DevicePlaybackQuality,
15
- DeviceLanguage,
16
- PurchaseData,
17
- } from './types';
18
-
19
- declare const window: Window & { VIZIO: ISmartCastApi };
20
-
21
- export class DeviceSmartCast extends DeviceBase {
22
- keyMap = getKeyMap();
23
-
24
- deviceId = '';
25
-
26
- deviceModel = '';
27
-
28
- deviceFirmware = '';
29
-
30
- readonly backAsBackspaceInSearch = true;
31
-
32
- devicePlaybackQualities: DevicePlaybackQuality[] = [];
33
-
34
- closedCaptionsStatus = false;
35
-
36
- textToSpeechStatus = false;
37
-
38
- textToSpeechTimeout?: null | number;
39
-
40
- lastTextToSpeechItem?: { delay: number, text: string } | null;
41
-
42
- deviceLanguage?: DeviceLanguage;
43
-
44
- API?: ISmartCastApi;
45
-
46
- IFA?: IFA;
47
-
48
- publicIpAddress?: string;
49
-
50
- async initDevice() {
51
- this.initNetworkChangeListener();
52
- this.initVisibilityChangeListener();
53
- this.initMouseActiveListener();
54
- await this.initPlatformApiListeners();
55
- this.setSubscriptionFeaturesConfiguration();
56
- }
57
-
58
- async initPlatformApiListeners(): Promise<void> {
59
- return new Promise((resolve) => {
60
- document.addEventListener('VIZIO_LIBRARY_DID_LOAD', async () => {
61
- const API = window.VIZIO;
62
- this.API = window.VIZIO;
63
- const promises = [];
64
-
65
- API.setClosedCaptionHandler((isEnabled: boolean) => {
66
- this.closedCaptionsStatus = isEnabled;
67
- this.triggerEvent('cctoggle', { isEnabled });
68
- });
69
-
70
- promises.push(new Promise<void>((r) => {
71
- API.setAdvertiserIDListener((advertiserID: IFA) => {
72
- this.IFA = advertiserID;
73
- r();
74
- });
75
- }));
76
-
77
- promises.push(new Promise<void>((r) => {
78
- API.getDeviceId((id: string) => {
79
- this.deviceId = id;
80
- r();
81
- });
82
- }));
83
-
84
- this.deviceModel = API.deviceModel;
85
-
86
- promises.push(new Promise<void>((r) => {
87
- API.getFirmwareVersion((version: string) => {
88
- this.deviceFirmware = version;
89
- r();
90
- });
91
- }));
92
-
93
- promises.push(new Promise<void>((r) => {
94
- API.getDevicePlaybackQualities((qualities: DevicePlaybackQuality[]) => {
95
- this.devicePlaybackQualities = qualities;
96
- r();
97
- });
98
- }));
99
-
100
- promises.push(new Promise<void>((r) => {
101
- API.setDeviceLanguageHandler((deviceLanguage: DeviceLanguage) => {
102
- this.deviceLanguage = deviceLanguage;
103
- r();
104
- });
105
- }));
106
-
107
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
108
- API.setContentChangeHandler(this.handleDeeplink);
109
-
110
- await Promise.all(promises);
111
-
112
- resolve();
113
- });
114
-
115
- document.addEventListener('VIZIO_TTS_ENABLED', () => {
116
- this.textToSpeechStatus = true;
117
- }, false);
118
-
119
- document.addEventListener('VIZIO_TTS_DISABLED', () => {
120
- this.lastTextToSpeechItem = null;
121
- this.textToSpeechStatus = false;
122
- window.clearTimeout(this.textToSpeechTimeout as any);
123
- this.API?.Chromevox.cancel();
124
- }, false);
125
-
126
- const object = document.createElement('script');
127
- object.src = 'http://127.0.0.1:12345/scfs/cl/js/vizio-companion-lib.js';
128
- document.body.appendChild(object);
129
- });
130
- }
131
-
132
- initNetworkChangeListener() {
133
- window.addEventListener('online', () => {
134
- this.triggerEvent('networkchange', { isConnected: true });
135
- });
136
- window.addEventListener('offline', () => {
137
- this.triggerEvent('networkchange', { isConnected: false });
138
- });
139
- }
140
-
141
- initVisibilityChangeListener() {
142
- document.addEventListener('visibilitychange', () => {
143
- this.triggerEvent('visibilitychange', {
144
- isVisible: document.visibilityState === 'visible',
145
- });
146
- });
147
- }
148
-
149
- initMouseActiveListener() {
150
- document.addEventListener('mousemove', this.onMouseActive);
151
- }
152
-
153
- onMouseActive = () => {
154
- document.removeEventListener('mousemove', this.onMouseActive);
155
- document.addEventListener('keydown', this.onMouseInactive, true);
156
- this.isMouseActive = true;
157
- this.triggerEvent('mouseactive', { isMouseActive: true });
158
- };
159
-
160
- onMouseInactive = (event: KeyboardEvent) => {
161
- if (!this.isDirectionalArrow(event)) return;
162
- document.removeEventListener('keydown', this.onMouseInactive);
163
- this.initMouseActiveListener();
164
-
165
- // to let other handlers to use this property before change
166
- runAsync(() => {
167
- this.isMouseActive = false;
168
- });
169
- this.triggerEvent('mouseactive', { isMouseActive: false });
170
- };
171
-
172
- handleDeeplink = (deeplinkUrl: string) => {
173
- if (typeof deeplinkUrl !== 'string') return;
174
- const newRoute = deeplinkUrl.split('#')[1];
175
- if (newRoute) {
176
- const currentUrl = window.location.href.split('#')[0];
177
- window.location.href = `${currentUrl}#${newRoute}`;
178
- }
179
- };
180
-
181
- /**
182
- * Reads provided text by the device internal reader.
183
- */
184
- readText({ text, delay = DEFAULT_TTS_TIMEOUT }: {
185
- text: string, delay?: number
186
- }) {
187
- if (this.textToSpeechStatus && text) {
188
- if (this.textToSpeechTimeout) {
189
- this.lastTextToSpeechItem = { text, delay };
190
- } else {
191
- this.API?.Chromevox.play(text);
192
-
193
- this.textToSpeechTimeout = window.setTimeout(() => {
194
- this.textToSpeechTimeout = null;
195
-
196
- if (this.lastTextToSpeechItem) {
197
- const last = this.lastTextToSpeechItem;
198
-
199
- this.API?.Chromevox.play(last.text);
200
- this.lastTextToSpeechItem = null;
201
- }
202
- }, delay);
203
- }
204
- }
205
- }
206
-
207
- exit() {
208
- this.API?.exitApplication();
209
- }
210
-
211
- reboot() {
212
- window.location.reload();
213
- }
214
-
215
- /**
216
- * Returns the status of Closed Captions feature.
217
- */
218
- async getClosedCaptionsStatus() {
219
- return this.closedCaptionsStatus;
220
- }
221
-
222
- /**
223
- * Returns the status of Text to Speech Engine if it is available by the device.
224
- */
225
- async getTextToSpeechStatus() {
226
- return this.textToSpeechStatus;
227
- }
228
-
229
- /**
230
- * Returns filled in Vast Tag URL.
231
- */
232
- async getVastTagUrl(template: string): Promise<null | string> {
233
- const IFAObject = this.IFA;
234
- const resolution = this.getResolution();
235
-
236
- if (!IFAObject) return null;
237
-
238
- this.publicIpAddress = this.publicIpAddress ?? await ipify();
239
-
240
- return template
241
- .replace('{{width}}', String(resolution.width))
242
- .replace('{{height}}', String(resolution.height))
243
- .replace('{{cb}}', String(Date.now()))
244
- .replace('{{user_agent}}', encodeURIComponent(window.navigator.userAgent))
245
- .replace('{{ifa}}', IFAObject.IFA)
246
- .replace('{{ifa_type}}', IFAObject.IFA_TYPE)
247
- .replace('{{ip_address}}', this.publicIpAddress!)
248
- .replace('{{lmt}}', IFAObject.LMT ? '1' : '0')
249
- .replace('{{us_privacy}}', IFAObject.LMT ? '1YYN' : '1YNN');
250
- }
251
-
252
- async getUserMetadata() {
253
- await this.checkAndLinkTv();
254
- const result = await this.API!.Account.getUserMetadata();
255
- return result?.data || null;
256
- }
257
-
258
- async getManufacturerName() {
259
- return 'VIZIO';
260
- }
261
-
262
- async getPlatformName() {
263
- return 'SmartCast';
264
- }
265
-
266
- async getPlatformVersion() {
267
- return '';
268
- }
269
-
270
- async getDeviceName() {
271
- return 'VIZIO SmartCast';
272
- }
273
-
274
- async getModelName() {
275
- return this.deviceModel;
276
- }
277
-
278
- async getFirmware() {
279
- return this.deviceFirmware;
280
- }
281
-
282
- async is4KSupported() {
283
- return this.devicePlaybackQualities.includes('UHD');
284
- }
285
-
286
- async is8KSupported() {
287
- return false;
288
- }
289
-
290
- async getUuid() {
291
- return this.deviceId;
292
- }
293
-
294
- async getAdInfo() {
295
- const adId = this.IFA?.IFA ?? null;
296
- const type = this.IFA?.IFA_TYPE ?? 'vida';
297
- const latEnabled = (this.IFA?.LMT !== null || this.IFA?.LMT !== undefined)
298
- ? Boolean(this.IFA?.LMT)
299
- : true;
300
- return { adId, type, latEnabled };
301
- }
302
-
303
- async getOsLanguage() {
304
- return this.deviceLanguage?.code || '';
305
- }
306
-
307
- async getVolume() {
308
- return VolumeRange.UNSUPPORTED;
309
- }
310
-
311
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
312
- async setVolume(volumePercentage: number) {
313
- // not supported on SmartCast platform
314
- }
315
-
316
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
317
- async mute(mute: boolean) {
318
- // not supported on SmartCast platform
319
- }
320
-
321
- async isMute() {
322
- return false;
323
- }
324
-
325
- async getScreenSaver() {
326
- return { enabled: false };
327
- }
328
-
329
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
330
- async setScreenSaver(status: ScreenSaverStatus) {
331
- // not supported on SmartCast platform
332
- }
333
-
334
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
335
- async setUserAgent(userAgent: string) {
336
- return false;
337
- }
338
-
339
- async getConnectionType() {
340
- return 'unknown' as ConnectionType;
341
- }
342
-
343
- async isNetworkConnected() {
344
- return window.navigator.onLine;
345
- }
346
-
347
- async getLocalIP() {
348
- // not supported on SmartCast platform
349
- return '';
350
- }
351
-
352
- async getMacAddress() {
353
- // not supported on SmartCast platform
354
- return '';
355
- }
356
-
357
- setSubscriptionFeaturesConfiguration() {
358
- try {
359
- this.subscriptionFeaturesConfiguration.purchase = this.API?.Account.isSVODEnabled?.()
360
- || false;
361
- } catch {}
362
- }
363
-
364
- registerPartner(callback: (challenge: string) => Promise<string>, appKeyId: string) {
365
- this.API!.Account.registerPartner(callback, appKeyId);
366
- }
367
-
368
- async checkAndLinkTv() {
369
- const isLinked = await this.API!.Account.getLinkStatus();
370
- if (!isLinked) await this.API!.Account.startTVLink();
371
- }
372
-
373
- async purchaseProduct({ sku, serviceId }: IAPPurchaseProductData): Promise<IAPSuccessPayload> {
374
- await this.checkAndLinkTv();
375
- await this.API!.Account.getPlans({ includeBundlePlans: true });
376
- const purchaseResult = await this.API!.Account.startSVODPurchase(
377
- sku!, serviceId ?? '',
378
- );
379
- const receiptPayload: PurchaseData = {
380
- customerId: purchaseResult.data.customerId,
381
- partnerAccountId: purchaseResult.data.partnerAccountId,
382
- planCode: purchaseResult.data.planCode,
383
- addOnCodes: purchaseResult.data.addOnCodes,
384
- subscriptionId: purchaseResult.data.subscriptionId,
385
- };
386
- return { platform: VendorType.VIZIO, receiptPayload };
387
- }
388
-
389
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
390
- async cancelSubscription(data: IAPPurchaseProductData): Promise<void> {
391
- // not supported
392
- throw new Error('Not supported');
393
- }
394
- }
@@ -1,79 +0,0 @@
1
- import { IFA, ISmartCastApi, DevicePlaybackQuality, DeviceLanguage } from '../types';
2
-
3
- export const deviceId = '2bd671ef-02cd-445f-9295-b3565dbaf1e8';
4
- export const deviceModel = 'D24f4-J01';
5
- export const firmware = '3.520.28.1-2';
6
- export const playbackQualities = ['UHD', 'HD'] as DevicePlaybackQuality[];
7
- // eslint-disable-next-line max-len
8
- export const deeplinkUrl = 'https://smartapps-bigscreen.24i.com/#/detail/SERIES/FO03OogBXRsigNB1VRz_/undefined/undefined/';
9
- // eslint-disable-next-line max-len
10
- export const deeplinkUrl2 = 'https://smartapps-bigscreen.24i.com/#/detail/SERIES/Ge1sO4gBXRsigNB1TBwy/undefined/undefined/';
11
- // eslint-disable-next-line max-len
12
- export const vastTagTemplate = 'w={{width}}&h={{height}}&did={{ifa}}&ifa_type={{ifa_type}}&lmt={{lmt}}&ip={{ip_address}}&us_privacy={{us_privacy}}';
13
-
14
- export const SmartCastMockApi: ISmartCastApi = {
15
- deviceModel,
16
-
17
- getDeviceId: (callback: (id: string) => void): void => callback(deviceId),
18
-
19
- getFirmwareVersion: (callback: (id: string) => void): void => callback(firmware),
20
-
21
- getDevicePlaybackQualities: (
22
- callback: (
23
- qualities: DevicePlaybackQuality[]
24
- ) => void,
25
- ): void => callback(playbackQualities),
26
-
27
- exitApplication: (): void => {},
28
-
29
- setClosedCaptionHandler: (callback: (isEnabled: boolean) => void): void => callback(false),
30
-
31
- setAdvertiserIDListener: (callback: (advertiserID: IFA) => void): void => callback({
32
- IFA: deviceId,
33
- IFA_TYPE: 'vida',
34
- LMT: 0,
35
- }),
36
-
37
- setContentChangeHandler:
38
- (callback: (contentUrl: string) => void): void => callback(deeplinkUrl),
39
-
40
- setDeviceLanguageHandler: (
41
- callback: (deviceLanguage: DeviceLanguage) => void,
42
- ): void => callback({ code: 'en', name: 'English' }),
43
-
44
- Chromevox: {
45
- cancel: (): void => {
46
- throw new Error('Function not implemented.');
47
- },
48
- play: (text: string): void => {
49
- // eslint-disable-next-line no-console
50
- console.log(text);
51
- },
52
- },
53
-
54
- Account: {
55
- isSVODEnabled: () => true,
56
- startSVODPurchase: async () => ({
57
- id: 'id',
58
- data: {
59
- customerId: 'customerId',
60
- partnerAccountId: 'partnerAccountId',
61
- planCode: 'planCode',
62
- subscriptionId: 'subscriptionId',
63
- },
64
- }),
65
- registerPartner: jest.fn(),
66
- getLinkStatus: async () => true,
67
- getUserMetadata: async () => ({
68
- id: 'id',
69
- data: {
70
- customerId: 'customerId',
71
- email: 'email@example.com',
72
- firstName: 'First',
73
- lastName: 'Last',
74
- },
75
- }),
76
- startTVLink: async () => ({}),
77
- getPlans: async () => ({ id: 'id', data: [] }),
78
- },
79
- };
@@ -1 +0,0 @@
1
- export { DeviceSmartCast } from './DeviceSmartCast';
@@ -1,9 +0,0 @@
1
- import { generateKeyCodeKeyMap, overrideValues } from '@24i/bigscreen-sdk/driver-base/keymap';
2
-
3
- export const getKeyMap = () => {
4
- overrideValues({
5
- CHANNEL_PREVIOUS: { code: 'PrevCh', keyCode: 500 },
6
- SUBTITLES: { keyCode: 204 },
7
- });
8
- return generateKeyCodeKeyMap();
9
- };