@24i/bigscreen-sdk 1.0.52 → 1.0.53-alpha.2837

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 (51) hide show
  1. package/package.json +4 -3
  2. package/packages/analytics/src/clients/GoogleAnalytics/constants.ts +10 -2
  3. package/packages/analytics/src/clients/GoogleAnalytics/interface.ts +5 -1
  4. package/packages/analytics/src/clients/TwentyFourIQ/TwentyFourIQClient.ts +2 -0
  5. package/packages/analytics/src/clients/TwentyFourIQ/constants.ts +15 -4
  6. package/packages/analytics/src/clients/TwentyFourIQ/interface.ts +7 -4
  7. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapAdEvent.ts +20 -0
  8. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapBase.ts +2 -0
  9. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapPlayerClose.ts +2 -1
  10. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoComplete.ts +2 -1
  11. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoPause.ts +2 -1
  12. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapVideoProgress.ts +2 -1
  13. package/packages/analytics/src/clients/TwentyFourIQ/types.ts +38 -29
  14. package/packages/driver-androidtv/src/DeviceAndroidTV.ts +14 -0
  15. package/packages/driver-androidtv/src/__mocks__/javaScriptBridge.ts +5 -0
  16. package/packages/driver-androidtv/src/index.ts +1 -0
  17. package/packages/driver-androidtv/src/types.ts +22 -0
  18. package/packages/driver-base/src/DeviceBase.ts +14 -0
  19. package/packages/driver-base/src/__mocks__/DeviceBase.ts +13 -0
  20. package/packages/driver-base/src/index.ts +3 -0
  21. package/packages/driver-base/src/types/InAppPurchase.ts +25 -0
  22. package/packages/driver-browser/src/DeviceBrowser.ts +14 -0
  23. package/packages/driver-entone/src/DeviceEntone.ts +19 -1
  24. package/packages/driver-firetv/src/DeviceFireTV.ts +59 -1
  25. package/packages/driver-firetv/src/__mocks__/javaScriptBridge.ts +5 -0
  26. package/packages/driver-firetv/src/types.ts +1 -0
  27. package/packages/driver-hbbtv/src/DeviceHbbTV.ts +14 -0
  28. package/packages/driver-kreatv/src/DeviceKreaTV.ts +14 -0
  29. package/packages/driver-saphi/src/DeviceSaphi.ts +14 -0
  30. package/packages/driver-smartcast/src/DeviceSmartCast.ts +49 -0
  31. package/packages/driver-smartcast/src/__mocks__/api.ts +26 -0
  32. package/packages/driver-smartcast/src/types.ts +36 -0
  33. package/packages/driver-tizen/src/DeviceTizen.ts +102 -7
  34. package/packages/driver-tizen/src/ITizen.ts +15116 -202
  35. package/packages/driver-tizen/src/IWebapis.ts +8641 -92
  36. package/packages/driver-tizen/src/TizenKeys.ts +2 -2
  37. package/packages/driver-tizen/src/__mocks__/tizen.ts +0 -8
  38. package/packages/driver-tizen/src/constants.ts +1 -195
  39. package/packages/driver-vidaa/src/DeviceVidaa.ts +14 -0
  40. package/packages/driver-webos/src/DeviceWebos.ts +14 -0
  41. package/packages/driver-xbox/src/DeviceXbox.ts +19 -1
  42. package/packages/input/src/Input.tsx +6 -0
  43. package/packages/list/DoubleList/README.md +105 -0
  44. package/packages/list/DoubleList/index.ts +1 -0
  45. package/packages/list/src/DoubleList/DoubleList.tsx +267 -0
  46. package/packages/list/src/DoubleList/DoubleListAdapter.ts +72 -0
  47. package/packages/list/src/DoubleList/config.ts +15 -0
  48. package/packages/list/src/DoubleList/interface.ts +82 -0
  49. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapAdLoaded.ts +0 -13
  50. package/packages/analytics/src/clients/TwentyFourIQ/mappers/mapAdSkipped.ts +0 -16
  51. package/packages/driver-tizen/src/types.ts +0 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/bigscreen-sdk",
3
- "version": "1.0.52",
3
+ "version": "1.0.53-alpha.2837",
4
4
  "description": "SmartApps BIGscreen SDK monorepo",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -38,11 +38,11 @@
38
38
  },
39
39
  "homepage": "https://github.com/24i/smartapps-bigscreen-sdk#readme",
40
40
  "dependencies": {
41
- "@24i/appstage-shared-analytics": "1.0.22",
41
+ "@24i/appstage-shared-analytics": "1.0.24",
42
42
  "@24i/appstage-shared-events-manager": "1.0.11",
43
43
  "@24i/appstage-shared-perf-utils": "1.0.11",
44
44
  "@24i/bigscreen-players-engine-base": "4.1.0",
45
- "@24i/smartapps-datalayer": "3.0.21",
45
+ "@24i/smartapps-datalayer": "3.0.24",
46
46
  "@sentry/browser": "7.35.0",
47
47
  "@sentry/types": "7.35.0",
48
48
  "csstype": "^3.1.3",
@@ -193,6 +193,7 @@
193
193
  "./l10n": "./packages/l10n/src/index.ts",
194
194
  "./list/AttachDetachItem": "./packages/list/AttachDetachItem/index.ts",
195
195
  "./list/Basic": "./packages/list/BasicList/index.ts",
196
+ "./list/Double": "./packages/list/DoubleList/index.ts",
196
197
  "./list/Basic/static": "./packages/list/BasicList/static.ts",
197
198
  "./list/Centered": "./packages/list/CenteredList/index.ts",
198
199
  "./list/Centered/static": "./packages/list/CenteredList/static.ts",
@@ -31,8 +31,12 @@ export const GOOGLE_ANALYTICS_TRIGGERS = [
31
31
  AnalyticsTriggers.SEARCH,
32
32
  AnalyticsTriggers.RATE_CONTENT,
33
33
  // ads triggers
34
- AnalyticsTriggers.AD_LOADED,
34
+ AnalyticsTriggers.AD_BUFFERING,
35
+ AnalyticsTriggers.AD_COMPLETE,
36
+ AnalyticsTriggers.AD_ERROR,
35
37
  AnalyticsTriggers.AD_SKIPPED,
38
+ AnalyticsTriggers.AD_START,
39
+ AnalyticsTriggers.AD_STOP,
36
40
  // user triggers
37
41
  AnalyticsTriggers.LOGIN,
38
42
  AnalyticsTriggers.LOGOUT,
@@ -87,8 +91,12 @@ export const TRIGGER_NAME_TO_GA_EVENTS: Record<
87
91
  [AnalyticsTriggers.RATE_CONTENT]: ['rate_content'],
88
92
 
89
93
  // ads triggers
90
- [AnalyticsTriggers.AD_LOADED]: ['ad_loaded'],
94
+ [AnalyticsTriggers.AD_BUFFERING]: ['ad_buffering'],
95
+ [AnalyticsTriggers.AD_COMPLETE]: ['ad_complete'],
96
+ [AnalyticsTriggers.AD_ERROR]: ['ad_error'],
91
97
  [AnalyticsTriggers.AD_SKIPPED]: ['ad_skipped'],
98
+ [AnalyticsTriggers.AD_START]: ['ad_start'],
99
+ [AnalyticsTriggers.AD_STOP]: ['ad_stop'],
92
100
 
93
101
  // user triggers
94
102
  [AnalyticsTriggers.LOGIN]: ['login'],
@@ -17,8 +17,12 @@ export type GAEventsNames = (
17
17
  | 'favorite_add' // When a user add asset to favorites
18
18
  | 'favorite_remove' // When a user remove asset froms favorites
19
19
  | 'user_engagement' // Periodically, while the app is in the foreground
20
- | 'ad_loaded' // When advertisement has been loaded
20
+ | 'ad_buffering' // When advertisement is buffering
21
+ | 'ad_complete' // When advertisement has been completed
22
+ | 'ad_error' // When advertisement has an error
21
23
  | 'ad_skipped' // When user skipped current advertisement
24
+ | 'ad_start' // When advertisement has been started
25
+ | 'ad_stop' // When advertisement has been stopped
22
26
  | 'app_exception' // When application throws an error
23
27
  | 'rate_content' // When user rates an asset
24
28
  );
@@ -26,6 +26,7 @@ export class TwentyFourIQClient implements AnalyticsClient {
26
26
  deviceId: '',
27
27
  manufacturer: '',
28
28
  platform: '',
29
+ deviceModel: '',
29
30
  };
30
31
 
31
32
  sessionTimeout = createTimeout();
@@ -42,6 +43,7 @@ export class TwentyFourIQClient implements AnalyticsClient {
42
43
  this.constantPayload.deviceId = await device.getUuid();
43
44
  this.constantPayload.manufacturer = await device.getManufacturerName();
44
45
  this.constantPayload.platform = await device.getPlatformName();
46
+ this.constantPayload.deviceModel = await device.getModelName();
45
47
  this.constantPayload.appVersion = this.appVersion;
46
48
  await this.startSession();
47
49
  }
@@ -54,8 +54,12 @@ export const TWENTY_FOUR_IQ_TRIGGERS = [
54
54
  AnalyticsTriggers.SCROLL_90,
55
55
 
56
56
  // Ads
57
- AnalyticsTriggers.AD_LOADED,
57
+ AnalyticsTriggers.AD_BUFFERING,
58
+ AnalyticsTriggers.AD_COMPLETE,
59
+ AnalyticsTriggers.AD_ERROR,
58
60
  AnalyticsTriggers.AD_SKIPPED,
61
+ AnalyticsTriggers.AD_START,
62
+ AnalyticsTriggers.AD_STOP,
59
63
  ];
60
64
 
61
65
  export enum EVENTS {
@@ -69,8 +73,12 @@ export enum EVENTS {
69
73
  PLAYER_CLOSE = 'player_close',
70
74
  PLAYER_OPEN = 'player_open',
71
75
  SCROLL = 'scroll',
72
- AD_LOADED = 'ad_loaded',
76
+ AD_BUFFERING = 'ad_buffering',
77
+ AD_COMPLETE = 'ad_complete',
78
+ AD_ERROR = 'ad_error',
73
79
  AD_SKIPPED = 'ad_skipped',
80
+ AD_START = 'ad_start',
81
+ AD_STOP = 'ad_stop',
74
82
  }
75
83
 
76
84
  export const TRIGGER_NAME_TO_24IQ_EVENTS: { [K in AnalyticsTriggers]?: EVENTS[]; } = {
@@ -92,9 +100,12 @@ export const TRIGGER_NAME_TO_24IQ_EVENTS: { [K in AnalyticsTriggers]?: EVENTS[];
92
100
  [AnalyticsTriggers.SCROLL_75]: [EVENTS.SCROLL],
93
101
  [AnalyticsTriggers.SCROLL_90]: [EVENTS.SCROLL],
94
102
  [AnalyticsTriggers.APP_CLOSE]: [EVENTS.VIDEO_STOP, EVENTS.PLAYER_CLOSE],
95
- // VERSION 2 ?
96
- [AnalyticsTriggers.AD_LOADED]: [EVENTS.AD_LOADED],
103
+ [AnalyticsTriggers.AD_BUFFERING]: [EVENTS.AD_BUFFERING],
104
+ [AnalyticsTriggers.AD_COMPLETE]: [EVENTS.AD_COMPLETE],
105
+ [AnalyticsTriggers.AD_ERROR]: [EVENTS.AD_ERROR],
97
106
  [AnalyticsTriggers.AD_SKIPPED]: [EVENTS.AD_SKIPPED],
107
+ [AnalyticsTriggers.AD_START]: [EVENTS.AD_START],
108
+ [AnalyticsTriggers.AD_STOP]: [EVENTS.AD_STOP],
98
109
  };
99
110
 
100
111
  export const HUNDRED_PERCENT = 100;
@@ -11,8 +11,7 @@ import { mapPlayerOpen } from './mappers/mapPlayerOpen';
11
11
  import { mapPlayerClose } from './mappers/mapPlayerClose';
12
12
  import { mapVideoStart } from './mappers/mapVideoStart';
13
13
  import { mapVideoPause } from './mappers/mapVideoPause';
14
- import { mapAdLoaded } from './mappers/mapAdLoaded';
15
- import { mapAdSkipped } from './mappers/mapAdSkipped';
14
+ import { mapAdEvent } from './mappers/mapAdEvent';
16
15
  import { EventMappingFunction } from './types';
17
16
 
18
17
  export const EVENTS_MAPPING: Record<EVENTS, EventMappingFunction> = {
@@ -26,6 +25,10 @@ export const EVENTS_MAPPING: Record<EVENTS, EventMappingFunction> = {
26
25
  [EVENTS.VIDEO_PROGRESS]: mapVideoProgress,
27
26
  [EVENTS.VIDEO_COMPLETE]: mapVideoComplete,
28
27
  [EVENTS.VIDEO_PAUSE]: mapVideoPause,
29
- [EVENTS.AD_LOADED]: mapAdLoaded,
30
- [EVENTS.AD_SKIPPED]: mapAdSkipped,
28
+ [EVENTS.AD_BUFFERING]: mapAdEvent,
29
+ [EVENTS.AD_COMPLETE]: mapAdEvent,
30
+ [EVENTS.AD_ERROR]: mapAdEvent,
31
+ [EVENTS.AD_SKIPPED]: mapAdEvent,
32
+ [EVENTS.AD_START]: mapAdEvent,
33
+ [EVENTS.AD_STOP]: mapAdEvent,
31
34
  };
@@ -0,0 +1,20 @@
1
+ import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
2
+ import { Payload, AdEventResult } from '../types';
3
+ import { mapBase } from './mapBase';
4
+
5
+ export const mapAdEvent = (
6
+ triggerName: AnalyticsTriggers,
7
+ payload: Payload,
8
+ ): AdEventResult => ({
9
+ ...mapBase(payload),
10
+ action: triggerName,
11
+ event_trigger: triggerName,
12
+ ad_id: payload.adId || '',
13
+ ad_name: payload.adName || '',
14
+ ad_position: payload.adType || '',
15
+ ad_playback_position: payload.adPosition || '',
16
+ ad_playback_duration: payload.adDuration || '',
17
+ thing_id: payload.assetId || '',
18
+ attribution_id: payload.attributionId || '',
19
+ custom_campaign_url: '',
20
+ });
@@ -6,11 +6,13 @@ export const mapBase = (payload: Payload): BaseResult => {
6
6
  const timestampDate = time.getCurrentTime();
7
7
  const formattedTimestamp = getTimezoneOffsetString();
8
8
  return {
9
+ device_appversion: payload.appVersion || '',
9
10
  session_id: payload.sessionId.toString(),
10
11
  timestamp_initiated: formatDateTime(timestampDate),
11
12
  device_id: payload.deviceId,
12
13
  device_type: 'SmartTV',
13
14
  device_platform: payload.platform || '',
15
+ device_model: payload.deviceModel || '',
14
16
  device_manufacturer: payload.manufacturer || '',
15
17
  device_timezone: formattedTimestamp,
16
18
  service_id: payload.serviceId || '',
@@ -1,6 +1,6 @@
1
1
  import { SECOND_IN_MS } from '@24i/bigscreen-sdk/utils';
2
2
  import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
3
- import { EVENTS, HUNDRED_PERCENT } from '../constants';
3
+ import { DefaultScreens, EVENTS, HUNDRED_PERCENT } from '../constants';
4
4
  import { PlayerCloseResult, Payload } from '../types';
5
5
  import { mapBase } from './mapBase';
6
6
 
@@ -16,6 +16,7 @@ export const mapPlayerClose = (
16
16
  ...mapBase(payload),
17
17
  action: EVENTS.PLAYER_CLOSE,
18
18
  event_trigger: triggerName,
19
+ source_page: DefaultScreens.PLAYBACK,
19
20
  thing_id: payload.assetId || '',
20
21
  attribution_id: payload.attributionId || '',
21
22
  duration,
@@ -1,6 +1,6 @@
1
1
  import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
2
2
  import { SECOND_IN_MS } from '@24i/bigscreen-sdk/utils';
3
- import { EVENTS } from '../constants';
3
+ import { DefaultScreens, EVENTS } from '../constants';
4
4
  import { Payload, VideoCompleteResult } from '../types';
5
5
  import { mapBase } from './mapBase';
6
6
 
@@ -17,5 +17,6 @@ export const mapVideoComplete = (
17
17
  attribution_id: payload.attributionId || '',
18
18
  progress_pct: 90,
19
19
  duration: assetDuration,
20
+ source_page: DefaultScreens.PLAYBACK,
20
21
  };
21
22
  };
@@ -1,6 +1,6 @@
1
1
  import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
2
2
  import { SECOND_IN_MS } from '@24i/bigscreen-sdk/utils';
3
- import { EVENTS, HUNDRED_PERCENT } from '../constants';
3
+ import { DefaultScreens, EVENTS, HUNDRED_PERCENT } from '../constants';
4
4
  import { VideoPauseResult, Payload } from '../types';
5
5
  import { mapBase } from './mapBase';
6
6
 
@@ -20,5 +20,6 @@ export const mapVideoPause = (
20
20
  attribution_id: payload.attributionId || '',
21
21
  duration: overallDuration,
22
22
  progress_pct: progressPercent,
23
+ source_page: DefaultScreens.PLAYBACK,
23
24
  };
24
25
  };
@@ -1,7 +1,7 @@
1
1
  import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
2
2
  import { SECOND_IN_MS } from '@24i/bigscreen-sdk/utils';
3
3
  import { Payload, VideoProgressResult } from '../types';
4
- import { EVENTS, HUNDRED_PERCENT } from '../constants';
4
+ import { DefaultScreens, EVENTS, HUNDRED_PERCENT } from '../constants';
5
5
  import { mapBase } from './mapBase';
6
6
 
7
7
  export const mapVideoProgress = (
@@ -20,5 +20,6 @@ export const mapVideoProgress = (
20
20
  attribution_id: payload.attributionId || '',
21
21
  progress_pct: progressPercent,
22
22
  duration: durationInSeconds,
23
+ source_page: DefaultScreens.PLAYBACK,
23
24
  };
24
25
  };
@@ -1,6 +1,6 @@
1
1
  import { Asset } from '@24i/smartapps-datalayer/models';
2
2
  import { AnalyticsTriggers } from '@24i/appstage-shared-analytics';
3
- import type { AnyPayload, UserInfo, AppInfo } from '../../interface';
3
+ import type { AnyPayload, UserInfo, AppInfo, AdType } from '../../interface';
4
4
 
5
5
  interface ScreenParams {
6
6
  screen: string;
@@ -29,6 +29,7 @@ export interface DeviceInfo {
29
29
  manufacturer: string,
30
30
  platform: string,
31
31
  deviceId: string,
32
+ deviceModel: string,
32
33
  }
33
34
 
34
35
  export interface SceneInfo {
@@ -37,7 +38,21 @@ export interface SceneInfo {
37
38
  sceneType?: string,
38
39
  }
39
40
 
40
- export type Payload = CorePayload & SceneInfo & SessionInfo & UserInfo & DeviceInfo & AppInfo;
41
+ export interface AdInfo {
42
+ adId: string;
43
+ adName: string;
44
+ adType: AdType;
45
+ adDuration: string;
46
+ adPosition: string;
47
+ }
48
+
49
+ export type Payload = CorePayload
50
+ & SceneInfo
51
+ & SessionInfo
52
+ & UserInfo
53
+ & DeviceInfo
54
+ & AppInfo
55
+ & AdInfo;
41
56
 
42
57
  export type EventBody = AnyPayload;
43
58
 
@@ -47,12 +62,14 @@ export type EventMappingFunction = (
47
62
  ) => AnyPayload | void;
48
63
 
49
64
  export type BaseResult = {
65
+ device_appversion: string,
50
66
  session_id: string;
51
67
  timestamp_initiated: string;
52
68
  device_id: string;
53
69
  device_type: string;
54
70
  device_platform: string;
55
71
  device_manufacturer: string;
72
+ device_model: string;
56
73
  device_timezone: string;
57
74
  service_id: string;
58
75
  user_id?: string;
@@ -74,13 +91,6 @@ export type BufferingResult = SceneViewResult;
74
91
  export type ScrollResult = SceneViewResult & {
75
92
  percent_scrolled: string;
76
93
  };
77
- export type VideoProgressResult = CoreResult & {
78
- thing_id: string;
79
- attribution_id: string;
80
- progress_pct: number;
81
- duration: number;
82
- };
83
-
84
94
  export type PlayerOpenResult = CoreResult & {
85
95
  thing_id: string;
86
96
  attribution_id: string;
@@ -88,36 +98,35 @@ export type PlayerOpenResult = CoreResult & {
88
98
  source_rail?: string | null;
89
99
  };
90
100
 
91
- export type VideoStartResult = CoreResult & {
101
+ export type VideoBaseResult = CoreResult & {
92
102
  thing_id: string;
93
103
  attribution_id: string;
94
104
  duration: number;
95
105
  progress_pct: number;
96
106
  source_page: string;
97
- source_rail?: string | null;
98
107
  };
99
108
 
100
- export type VideoPauseResult = CoreResult & {
101
- thing_id: string;
102
- attribution_id: string;
103
- duration: number;
104
- progress_pct: number;
109
+ export type VideoStartResult = VideoBaseResult & {
110
+ source_rail?: string | null;
105
111
  };
106
112
 
107
- export type AdLoadedResult = CoreResult & {
108
- thing_id: string;
109
- attribution_id: string;
110
- player_advertisment_name: string;
111
- player_advertisment_position: number;
112
- };
113
+ export type VideoPauseResult = VideoBaseResult;
114
+
115
+ export type VideoStopResult = VideoStartResult;
116
+
117
+ export type VideoProgressResult = VideoBaseResult;
118
+
119
+ export type VideoCompleteResult = VideoBaseResult;
113
120
 
114
- export type AdSkippedResult = CoreResult & {
121
+ export type PlayerCloseResult = VideoBaseResult;
122
+
123
+ export type AdEventResult = CoreResult & {
124
+ ad_id: string;
125
+ ad_name: string;
126
+ ad_position: AdType;
127
+ ad_playback_position: string;
128
+ ad_playback_duration: string;
115
129
  thing_id: string;
116
130
  attribution_id: string;
117
- player_advertisment_name: string;
118
- player_advertisment_position: number;
131
+ custom_campaign_url: string;
119
132
  };
120
-
121
- export type VideoCompleteResult = VideoPauseResult;
122
- export type VideoStopResult = VideoStartResult;
123
- export type PlayerCloseResult = VideoPauseResult;
@@ -3,6 +3,8 @@ import {
3
3
  ConnectionType,
4
4
  ScreenSaverStatus,
5
5
  VolumeRange,
6
+ IAPSuccessPayload,
7
+ IAPPurchaseProductData,
6
8
  } from '@24i/bigscreen-sdk/driver-base';
7
9
  import { IJavaScriptBridge, DeviceInfo } from './types';
8
10
  import { getFirmware } from './formatUserAgent';
@@ -245,4 +247,16 @@ export class DeviceAndroidTV extends DeviceBase {
245
247
  // not supported on AndroidTV platform
246
248
  return '';
247
249
  }
250
+
251
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
252
+ async purchaseProduct(data: IAPPurchaseProductData): Promise<IAPSuccessPayload> {
253
+ // not supported
254
+ throw new Error('Not supported');
255
+ }
256
+
257
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
258
+ async cancelSubscription(data: IAPPurchaseProductData): Promise<void> {
259
+ // not supported
260
+ throw new Error('Not supported');
261
+ }
248
262
  }
@@ -18,6 +18,7 @@ export const mockJavaScriptBridge: IJavaScriptBridge = {
18
18
  bridgeJavaScriptToAndroid_GetOsLanguage: () => '',
19
19
  bridgeJavaScriptToAndroid_GetMediaInfo: () => '{}',
20
20
  bridgeJavaScriptToAndroid_Back: () => {},
21
+ bridgeJavaScriptToAndroid_ReloadPlayer: () => {},
21
22
  bridgeJavaScriptToAndroid_StopVideo: () => {},
22
23
  bridgeJavaScriptToAndroid_FullScreenVideo: () => {},
23
24
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -36,5 +37,9 @@ export const mockJavaScriptBridge: IJavaScriptBridge = {
36
37
  bridgeJavaScriptToAndroid_SetTrack: (track: string) => {},
37
38
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
38
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) => {},
39
44
  },
40
45
  };
@@ -1 +1,2 @@
1
1
  export { DeviceAndroidTV } from './DeviceAndroidTV';
2
+ export type { IAPErrorEvent, IAPSuccessEvent } from './types';
@@ -31,6 +31,10 @@ interface JavaScriptBridge {
31
31
  * It simulates a native Android back press.
32
32
  */
33
33
  bridgeJavaScriptToAndroid_Back: () => void,
34
+ /**
35
+ * It reloads the video player
36
+ */
37
+ bridgeJavaScriptToAndroid_ReloadPlayer: () => void;
34
38
  /**
35
39
  * It simulates a native Android stop button press.
36
40
  */
@@ -87,6 +91,14 @@ interface JavaScriptBridge {
87
91
  * It sets audio track to be used.
88
92
  */
89
93
  bridgeJavaScriptToAndroid_SetAudioTrack: (track: string) => void;
94
+ /**
95
+ * It launch in app purchase.
96
+ */
97
+ bridgeReceiptAmazonIAPValidation: (sku: string) => void;
98
+ /**
99
+ * It validate purchase.
100
+ */
101
+ bridgeReceiptAmazonIAPValidated: (receiptId: string) => void;
90
102
  }
91
103
 
92
104
  export type DeviceInfo = {
@@ -131,3 +143,13 @@ export type DeviceInfo = {
131
143
  export interface IJavaScriptBridge {
132
144
  JavaScriptBridge: JavaScriptBridge,
133
145
  }
146
+
147
+ export type IAPSuccessEvent = {
148
+ userId: string;
149
+ receipt: string;
150
+ sku: string;
151
+ };
152
+
153
+ export type IAPErrorEvent = {
154
+ message: string;
155
+ };
@@ -10,6 +10,11 @@ import { KeycodeKeyMap } from './types/KeycodeKeyMap';
10
10
  import { DeviceEventMap } from './types/DeviceEvent';
11
11
  import { AdInfo } from './types/AdInfo';
12
12
  import { ScreenSaverStatus } from './types/ScreenSaverStatus';
13
+ import {
14
+ SubscriptionFeaturesConfiguration,
15
+ IAPPurchaseProductData,
16
+ IAPSuccessPayload,
17
+ } from './types/InAppPurchase';
13
18
  import { ExitOptions } from './types/ExitOptions';
14
19
  import { inRange } from './utils';
15
20
  import { ErrorTemplate } from './errors';
@@ -56,6 +61,11 @@ export abstract class DeviceBase<
56
61
 
57
62
  isOffline: boolean = false;
58
63
 
64
+ subscriptionFeaturesConfiguration: SubscriptionFeaturesConfiguration = {
65
+ purchase: false,
66
+ management: false,
67
+ };
68
+
59
69
  // MARK: Initialization
60
70
 
61
71
  /**
@@ -179,6 +189,10 @@ export abstract class DeviceBase<
179
189
 
180
190
  abstract getMacAddress(): Promise<string>;
181
191
 
192
+ abstract purchaseProduct(data: IAPPurchaseProductData): Promise<IAPSuccessPayload>;
193
+
194
+ abstract cancelSubscription(data: IAPPurchaseProductData): Promise<void>;
195
+
182
196
  // MARK: Private functions
183
197
 
184
198
  private bindPreventDefaultEvents(rootElement: HTMLElement) {
@@ -1,6 +1,7 @@
1
1
  import { DeviceBase as AbstractDeviceBase } from '../DeviceBase';
2
2
  import { ScreenSaverStatus } from '../types/ScreenSaverStatus';
3
3
  import { ConnectionType } from '../ConnectionType';
4
+ import { IAPPurchaseProductData, IAPSuccessPayload } from '../types/InAppPurchase';
4
5
 
5
6
  export class DeviceBase extends AbstractDeviceBase {
6
7
  volume = 0;
@@ -108,4 +109,16 @@ export class DeviceBase extends AbstractDeviceBase {
108
109
  async getMacAddress() {
109
110
  return '00:11:22:33:44:55';
110
111
  }
112
+
113
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
114
+ async purchaseProduct(data: IAPPurchaseProductData): Promise<IAPSuccessPayload> {
115
+ // not supported
116
+ throw new Error('Not supported');
117
+ }
118
+
119
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
120
+ async cancelSubscription(data: IAPPurchaseProductData): Promise<void> {
121
+ // not supported
122
+ throw new Error('Not supported');
123
+ }
111
124
  }
@@ -5,6 +5,9 @@ export { VolumeRange } from './VolumeRange';
5
5
  export type { ScreenSize } from './ScreenSize';
6
6
  export type { KeycodeKeyMap } from './types/KeycodeKeyMap';
7
7
  export type { DeviceEventMap } from './types/DeviceEvent';
8
+ export type {
9
+ IAPSuccessPayload, IAPErrorPayload, IAPPromiseResolve, IAPPromiseReject, IAPPurchaseProductData,
10
+ } from './types/InAppPurchase';
8
11
  export type { ScreenSaverStatus } from './types/ScreenSaverStatus';
9
12
  export type { ExitOptions } from './types/ExitOptions';
10
13
  export * as KeyMap from './KeyMap';
@@ -0,0 +1,25 @@
1
+ import { Product } from '@24i/smartapps-datalayer/models';
2
+ import { VendorType } from '@24i/smartapps-datalayer/src/api';
3
+
4
+ export type SubscriptionFeaturesConfiguration = {
5
+ purchase: boolean,
6
+ management: boolean,
7
+ };
8
+
9
+ export type IAPSuccessPayload = {
10
+ platform: VendorType,
11
+ receiptPayload: object
12
+ };
13
+
14
+ export type IAPPurchaseProductData = Partial<{
15
+ sku: string,
16
+ serviceId: string,
17
+ product: Product,
18
+ appId: string,
19
+ }>;
20
+
21
+ export type IAPErrorPayload = { message: string };
22
+
23
+ export type IAPPromiseResolve = (value: IAPSuccessPayload | PromiseLike<IAPSuccessPayload>) => void;
24
+
25
+ export type IAPPromiseReject = (reason?: unknown) => void;
@@ -1,5 +1,7 @@
1
1
  import {
2
2
  DeviceBase, ConnectionType, ScreenSaverStatus, VolumeRange,
3
+ IAPSuccessPayload,
4
+ IAPPurchaseProductData,
3
5
  } from '@24i/bigscreen-sdk/driver-base';
4
6
  import { runAsync } from '@24i/bigscreen-sdk/utils/timers';
5
7
  import { generateUuid } from '@24i/bigscreen-sdk/utils';
@@ -179,4 +181,16 @@ export class DeviceBrowser extends DeviceBase {
179
181
  // for development purpose. Correctly, it should return '' for unknown MAC addr.
180
182
  return '00:00:00:00:00:00';
181
183
  }
184
+
185
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
186
+ async purchaseProduct(data: IAPPurchaseProductData): Promise<IAPSuccessPayload> {
187
+ // not supported
188
+ throw new Error('Not supported');
189
+ }
190
+
191
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
192
+ async cancelSubscription(data: IAPPurchaseProductData): Promise<void> {
193
+ // not supported
194
+ throw new Error('Not supported');
195
+ }
182
196
  }
@@ -1,4 +1,10 @@
1
- import { DeviceBase, ScreenSaverStatus, VolumeRange } from '@24i/bigscreen-sdk/driver-base';
1
+ import {
2
+ DeviceBase,
3
+ IAPPurchaseProductData,
4
+ IAPSuccessPayload,
5
+ ScreenSaverStatus,
6
+ VolumeRange,
7
+ } from '@24i/bigscreen-sdk/driver-base';
2
8
  import { generateUuid } from '@24i/bigscreen-sdk/utils';
3
9
  import { getKeyMap } from './keymap';
4
10
  import { EntoneDeviceModelName } from './constants';
@@ -241,4 +247,16 @@ export class DeviceEntone extends DeviceBase {
241
247
  }
242
248
  return macAddress || '';
243
249
  }
250
+
251
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
252
+ async purchaseProduct(data: IAPPurchaseProductData): Promise<IAPSuccessPayload> {
253
+ // not supported
254
+ throw new Error('Not supported');
255
+ }
256
+
257
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
258
+ async cancelSubscription(data: IAPPurchaseProductData): Promise<void> {
259
+ // not supported
260
+ throw new Error('Not supported');
261
+ }
244
262
  }