@24i/bigscreen-sdk 1.0.13-alpha.2281 → 1.0.13
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.
- package/package.json +3 -3
- package/packages/analytics/src/clients/GoogleAnalytics/GoogleAnalytics.ts +18 -27
- package/packages/analytics/src/clients/GoogleAnalytics/constants.ts +9 -64
- package/packages/analytics/src/clients/GoogleAnalytics/interface.ts +14 -26
- package/packages/analytics/src/clients/GoogleAnalytics/mapPayload.ts +14 -31
- package/packages/driver-androidtv/src/DeviceAndroidTV.ts +0 -11
- package/packages/types-bigscreen-jsx/index.d.ts +7 -7
- package/packages/create-package/dist/createPackage.js +0 -66
- package/packages/create-package/dist/createPackage.js.map +0 -1
- package/packages/create-package/dist/index.js +0 -5
- package/packages/create-package/dist/index.js.map +0 -1
- package/packages/create-package/dist/questionnaire/questions.js +0 -35
- package/packages/create-package/dist/questionnaire/questions.js.map +0 -1
- package/packages/create-package/dist/settings/Settings.js +0 -10
- package/packages/create-package/dist/settings/Settings.js.map +0 -1
- package/packages/create-package/dist/types.js +0 -3
- package/packages/create-package/dist/types.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@24i/bigscreen-sdk",
|
|
3
|
-
"version": "1.0.13
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "SmartApps BIGscreen SDK monorepo",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/24i/smartapps-bigscreen-sdk#readme",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@24i/appstage-shared-analytics": "1.0.
|
|
40
|
+
"@24i/appstage-shared-analytics": "1.0.7",
|
|
41
41
|
"@24i/appstage-shared-events-manager": "1.0.7",
|
|
42
42
|
"@24i/appstage-shared-perf-utils": "1.0.5",
|
|
43
43
|
"@24i/player-base": "6.10.0",
|
|
44
|
-
"@24i/smartapps-datalayer": "3.0.
|
|
44
|
+
"@24i/smartapps-datalayer": "3.0.6-alpha.978",
|
|
45
45
|
"@sentry/browser": "7.35.0",
|
|
46
46
|
"@sentry/types": "7.35.0",
|
|
47
47
|
"@types/gtag.js": "^0.0.12",
|
|
@@ -34,20 +34,15 @@ export class GoogleAnalytics implements AnalyticsClient {
|
|
|
34
34
|
cid: '',
|
|
35
35
|
sid: 0,
|
|
36
36
|
uamb: 0,
|
|
37
|
+
uap: '',
|
|
38
|
+
uapv: '',
|
|
39
|
+
uam: '',
|
|
37
40
|
seg: 0,
|
|
38
41
|
sct: 0,
|
|
39
42
|
_p: generateUuid(),
|
|
40
|
-
'up.device_manufacturer': '',
|
|
41
|
-
'up.device_platform': '',
|
|
42
|
-
'up.device_platform_version': '',
|
|
43
|
-
'up.app_version': '',
|
|
44
43
|
};
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
platform = '';
|
|
49
|
-
|
|
50
|
-
platformVersion = '';
|
|
45
|
+
a24iOperational = false;
|
|
51
46
|
|
|
52
47
|
lastOnEvent: number | undefined = undefined;
|
|
53
48
|
|
|
@@ -63,7 +58,7 @@ export class GoogleAnalytics implements AnalyticsClient {
|
|
|
63
58
|
|
|
64
59
|
firstVisit: boolean | undefined = undefined;
|
|
65
60
|
|
|
66
|
-
constructor(private id: string
|
|
61
|
+
constructor(private id: string) {
|
|
67
62
|
this.init();
|
|
68
63
|
}
|
|
69
64
|
|
|
@@ -78,20 +73,16 @@ export class GoogleAnalytics implements AnalyticsClient {
|
|
|
78
73
|
if (this.firstVisit) {
|
|
79
74
|
await Storage.setItem(GA_FIRST_VISIT, '0');
|
|
80
75
|
}
|
|
81
|
-
this.manufacturer = await device.getManufacturerName();
|
|
82
|
-
this.platform = await device.getPlatformName();
|
|
83
|
-
this.platformVersion = await device.getPlatformVersion();
|
|
84
76
|
await this.startSession();
|
|
77
|
+
params.uap = await device.getPlatformName();
|
|
78
|
+
params.uapv = await device.getPlatformVersion();
|
|
79
|
+
params.uam = await device.getModelName();
|
|
85
80
|
}
|
|
86
81
|
|
|
87
82
|
async startSession() {
|
|
88
83
|
const sessionNumber = parseInt(await Storage.getItem(GA_SESSION_COUNTER) ?? '0', 10) + 1;
|
|
89
84
|
this.constantUrlParams.sct = sessionNumber;
|
|
90
85
|
this.constantUrlParams.sid = generateSessionId();
|
|
91
|
-
this.constantUrlParams['up.device_manufacturer'] = this.manufacturer;
|
|
92
|
-
this.constantUrlParams['up.device_platform'] = this.platform;
|
|
93
|
-
this.constantUrlParams['up.device_platform_version'] = this.platformVersion;
|
|
94
|
-
this.constantUrlParams['up.app_version'] = this.appVersion;
|
|
95
86
|
await Storage.setItem(GA_SESSION_COUNTER, sessionNumber.toString());
|
|
96
87
|
this.isSessionActive = true;
|
|
97
88
|
this.setSessionTimeout();
|
|
@@ -122,14 +113,11 @@ export class GoogleAnalytics implements AnalyticsClient {
|
|
|
122
113
|
const engagementTime = this.lastOnEvent ? now - this.lastOnEvent : undefined;
|
|
123
114
|
this.lastOnEvent = now;
|
|
124
115
|
await Promise.all(events.map(async (event, index) => {
|
|
125
|
-
|
|
126
|
-
index === 0 ? engagementTime : undefined,
|
|
127
|
-
);
|
|
116
|
+
if (event === 'a24i_operational' && !this.shouldContinueWithA24iOperational()) return;
|
|
128
117
|
const gtagPayload = mapPayload(
|
|
129
|
-
event, triggerName,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
},
|
|
118
|
+
event, triggerName, await this.getSessionInfo(
|
|
119
|
+
index === 0 ? engagementTime : undefined,
|
|
120
|
+
),
|
|
133
121
|
);
|
|
134
122
|
const urlParams = mapEventParamsToUrlParams(payload as SceneInfo);
|
|
135
123
|
this.send(event, gtagPayload, urlParams);
|
|
@@ -174,6 +162,12 @@ export class GoogleAnalytics implements AnalyticsClient {
|
|
|
174
162
|
|
|
175
163
|
private sendQueueWithDelay = debounce(this.sendQueue, SEND_DEBOUNCE_MS);
|
|
176
164
|
|
|
165
|
+
private shouldContinueWithA24iOperational() {
|
|
166
|
+
const { a24iOperational } = this;
|
|
167
|
+
if (!a24iOperational) this.a24iOperational = true;
|
|
168
|
+
return !a24iOperational;
|
|
169
|
+
}
|
|
170
|
+
|
|
177
171
|
private async getSessionInfo(engagementTime: number | undefined): Promise<SessionInfo> {
|
|
178
172
|
const sessionStarted = !this.sessionStartSent;
|
|
179
173
|
this.sessionStartSent = true;
|
|
@@ -182,9 +176,6 @@ export class GoogleAnalytics implements AnalyticsClient {
|
|
|
182
176
|
const { firstVisit } = this;
|
|
183
177
|
this.firstVisit = false;
|
|
184
178
|
return {
|
|
185
|
-
appVersion: this.appVersion,
|
|
186
|
-
manufacturer: this.manufacturer,
|
|
187
|
-
platform: this.platform,
|
|
188
179
|
sessionStarted,
|
|
189
180
|
engagementTime,
|
|
190
181
|
firstEvent,
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { GAEventsNames } from './interface';
|
|
2
2
|
|
|
3
|
-
const stringParameter = 'ep';
|
|
4
|
-
const numericParameter = 'epn';
|
|
5
|
-
|
|
6
3
|
export const GOOGLE_ANALYTICS_TRIGGERS = [
|
|
7
|
-
'scene_view',
|
|
8
4
|
'app_close',
|
|
9
|
-
// player triggers
|
|
10
5
|
'playback_10',
|
|
11
6
|
'playback_25',
|
|
12
7
|
'playback_50',
|
|
@@ -17,92 +12,42 @@ export const GOOGLE_ANALYTICS_TRIGGERS = [
|
|
|
17
12
|
'playback_stop',
|
|
18
13
|
'player_close',
|
|
19
14
|
'player_open',
|
|
20
|
-
'
|
|
21
|
-
// scroll triggers
|
|
15
|
+
'scene_view',
|
|
22
16
|
'scroll_25',
|
|
23
17
|
'scroll_50',
|
|
24
18
|
'scroll_75',
|
|
25
19
|
'scroll_90',
|
|
26
|
-
// additional triggers
|
|
27
|
-
'app_error',
|
|
28
|
-
'toggle_favorite',
|
|
29
|
-
'search',
|
|
30
|
-
'rate_content',
|
|
31
|
-
// ads triggers
|
|
32
|
-
'ad_loaded',
|
|
33
|
-
'ad_skipped',
|
|
34
|
-
// user triggers
|
|
35
|
-
'login',
|
|
36
|
-
'logout',
|
|
37
|
-
'sign_up',
|
|
38
|
-
// purchases
|
|
39
|
-
'purchase_cancel',
|
|
40
|
-
'purchase_complete',
|
|
41
|
-
'purchase_start',
|
|
42
|
-
|
|
43
20
|
] as const;
|
|
44
21
|
|
|
45
22
|
export const TRIGGER_NAME_TO_GA_EVENTS: Record<
|
|
46
23
|
typeof GOOGLE_ANALYTICS_TRIGGERS[number], GAEventsNames[]
|
|
47
24
|
> = {
|
|
48
25
|
// App
|
|
49
|
-
app_close: ['
|
|
26
|
+
app_close: ['app_close', 'video_progress'],
|
|
50
27
|
|
|
51
28
|
// Playback
|
|
52
|
-
heartbeat_5: ['video_progress'],
|
|
53
29
|
playback_10: ['video_progress'],
|
|
54
30
|
playback_25: ['video_progress'],
|
|
55
31
|
playback_50: ['video_progress'],
|
|
56
32
|
playback_75: ['video_progress'],
|
|
57
|
-
playback_90: ['
|
|
33
|
+
playback_90: ['video_progress'],
|
|
58
34
|
playback_pause: ['video_progress'],
|
|
59
35
|
playback_start: ['video_start'],
|
|
60
36
|
playback_stop: ['video_progress'],
|
|
61
37
|
|
|
62
38
|
// Player
|
|
63
|
-
player_close: ['
|
|
64
|
-
player_open: ['
|
|
39
|
+
player_close: ['a24i_content', 'video_progress'],
|
|
40
|
+
player_open: ['a24i_content'],
|
|
65
41
|
|
|
66
42
|
// Scenes
|
|
67
|
-
scene_view: [
|
|
43
|
+
scene_view: [
|
|
44
|
+
'page_view',
|
|
45
|
+
'a24i_operational',
|
|
46
|
+
],
|
|
68
47
|
|
|
69
48
|
// Scrolling in scene
|
|
70
49
|
scroll_25: ['scroll'],
|
|
71
50
|
scroll_50: ['scroll'],
|
|
72
51
|
scroll_75: ['scroll'],
|
|
73
52
|
scroll_90: ['scroll'],
|
|
74
|
-
|
|
75
|
-
// purchases
|
|
76
|
-
purchase_cancel: [],
|
|
77
|
-
purchase_complete: [],
|
|
78
|
-
purchase_start: [],
|
|
79
|
-
|
|
80
|
-
// additional triggers
|
|
81
|
-
app_error: [],
|
|
82
|
-
toggle_favorite: [],
|
|
83
|
-
search: [],
|
|
84
|
-
rate_content: [],
|
|
85
|
-
|
|
86
|
-
// ads triggers
|
|
87
|
-
ad_loaded: [],
|
|
88
|
-
ad_skipped: [],
|
|
89
|
-
|
|
90
|
-
// user triggers
|
|
91
|
-
login: ['login'],
|
|
92
|
-
logout: [],
|
|
93
|
-
sign_up: [],
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export const gtagPayloadParams: Record<string, string> = {
|
|
97
|
-
contentType: `${stringParameter}.content_type`,
|
|
98
|
-
episodeNumber: `${numericParameter}.episode_number`,
|
|
99
|
-
seasonNumber: `${numericParameter}.season_number`,
|
|
100
|
-
currentTime: `${numericParameter}.video_current_time`,
|
|
101
|
-
duration: `${numericParameter}.video_duration`,
|
|
102
|
-
percent: `${numericParameter}.video_current_percent`,
|
|
103
|
-
provider: `${stringParameter}.video_provider`,
|
|
104
|
-
title: `${stringParameter}.video_title`,
|
|
105
|
-
seriesTitle: `${stringParameter}.video_series_title`,
|
|
106
|
-
url: `${stringParameter}.video_url`,
|
|
107
|
-
assetId: `${stringParameter}.video_asset_id`,
|
|
108
53
|
};
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
export type GAEventsNames = (
|
|
2
|
-
| '
|
|
3
|
-
| '
|
|
4
|
-
| '
|
|
5
|
-
| '
|
|
6
|
-
| '
|
|
7
|
-
| '
|
|
8
|
-
| '
|
|
9
|
-
| '
|
|
10
|
-
| 'select_content' // When a user has selected content
|
|
11
|
-
| 'login' // When a user logs in
|
|
12
|
-
| 'sign_up' // When a user has signed up Allows you to see which methods of signup are popular
|
|
13
|
-
| 'search' // When a user searches your content
|
|
14
|
-
| 'purchase' // When a user completes a purchase
|
|
15
|
-
| 'share' // When a user has shared content
|
|
16
|
-
| 'user_engagement' // Periodically, while the app is in the foreground
|
|
2
|
+
| 'a24i_content'
|
|
3
|
+
| 'a24i_operational'
|
|
4
|
+
| 'app_close'
|
|
5
|
+
| 'buffering_start'
|
|
6
|
+
| 'page_view'
|
|
7
|
+
| 'scroll'
|
|
8
|
+
| 'video_progress'
|
|
9
|
+
| 'video_start'
|
|
17
10
|
);
|
|
18
11
|
|
|
19
12
|
export type QueuedEvent = {
|
|
@@ -23,9 +16,6 @@ export type QueuedEvent = {
|
|
|
23
16
|
};
|
|
24
17
|
|
|
25
18
|
export type SessionInfo = {
|
|
26
|
-
appVersion: string,
|
|
27
|
-
manufacturer: string,
|
|
28
|
-
platform: string,
|
|
29
19
|
engagementTime: number | undefined,
|
|
30
20
|
sessionStarted: boolean,
|
|
31
21
|
firstEvent: boolean,
|
|
@@ -39,20 +29,18 @@ export type ConstantUrlParams = {
|
|
|
39
29
|
sid: number,
|
|
40
30
|
/** 1 for mobile devices, 0 otherwise */
|
|
41
31
|
uamb: number,
|
|
32
|
+
/** Platform name */
|
|
33
|
+
uap: string,
|
|
34
|
+
/** Platform version */
|
|
35
|
+
uapv: string,
|
|
36
|
+
/** Device model name */
|
|
37
|
+
uam: string,
|
|
42
38
|
/** Session engagement 0 for first event of session, 1 otherwise */
|
|
43
39
|
seg: number,
|
|
44
40
|
/** Session count */
|
|
45
41
|
sct: number,
|
|
46
42
|
/** Random page hash */
|
|
47
43
|
_p: string,
|
|
48
|
-
/** Device manufacturer e.g. 'Samsung' */
|
|
49
|
-
'up.device_manufacturer': string,
|
|
50
|
-
/** Platform e.g. 'Tizen' */
|
|
51
|
-
'up.device_platform': string,
|
|
52
|
-
/** Platform version e.g. '5.0' */
|
|
53
|
-
'up.device_platform_version': string,
|
|
54
|
-
/** Version of application 'v1.0.0' */
|
|
55
|
-
'up.app_version': string,
|
|
56
44
|
};
|
|
57
45
|
|
|
58
46
|
export type EventUrlParams = {
|
|
@@ -1,46 +1,29 @@
|
|
|
1
|
-
import type { AnalyticsEventsNames
|
|
2
|
-
import type { EventUrlParams, GAEventsNames } from './interface';
|
|
3
|
-
import { gtagPayloadParams } from './constants';
|
|
1
|
+
import type { AnalyticsEventsNames } from '../../interface';
|
|
2
|
+
import type { EventUrlParams, GAEventsNames, SessionInfo } from './interface';
|
|
4
3
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export const mapEventParamsToUrlParams = (eventParams: Record<string, any>)
|
|
13
|
-
: EventUrlParams => {
|
|
14
|
-
const urlParams = {};
|
|
15
|
-
Object.entries(eventParams).forEach(([key]) => {
|
|
16
|
-
if (map[key]) {
|
|
17
|
-
Object.assign(urlParams, {
|
|
18
|
-
[map[key]]: eventParams[key] || '',
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
4
|
+
export const mapEventParamsToUrlParams = (eventParams: Record<string, any>) => {
|
|
5
|
+
const urlParams: Partial<EventUrlParams> = {};
|
|
6
|
+
if (eventParams.language) urlParams.ul = eventParams.language;
|
|
7
|
+
if (eventParams.resolution) urlParams.sr = eventParams.resolution;
|
|
8
|
+
if (eventParams.sceneId) urlParams.dl = eventParams.sceneId;
|
|
9
|
+
if (eventParams.sceneName) urlParams.dt = eventParams.sceneName;
|
|
22
10
|
return urlParams as EventUrlParams;
|
|
23
11
|
};
|
|
24
12
|
|
|
25
13
|
export const mapPayload = (
|
|
26
14
|
eventName: GAEventsNames,
|
|
27
15
|
triggerName: AnalyticsEventsNames,
|
|
28
|
-
|
|
16
|
+
sessionInfo: SessionInfo,
|
|
29
17
|
) => {
|
|
30
18
|
const gtagPayload: Record<string, any> = {
|
|
31
19
|
'ep.event_trigger': triggerName,
|
|
32
|
-
_et:
|
|
33
|
-
_ee:
|
|
34
|
-
_fv:
|
|
35
|
-
_ss:
|
|
20
|
+
_et: sessionInfo.engagementTime ?? 0,
|
|
21
|
+
_ee: sessionInfo.firstEvent ? 1 : 0,
|
|
22
|
+
_fv: sessionInfo.firstVisit ? 1 : 0,
|
|
23
|
+
_ss: sessionInfo.sessionStarted ? 1 : 0,
|
|
36
24
|
};
|
|
37
25
|
if (eventName === 'scroll') {
|
|
38
|
-
gtagPayload['epn.
|
|
26
|
+
gtagPayload['epn.percent_scroll'] = parseInt(triggerName.split('_')[1], 10);
|
|
39
27
|
}
|
|
40
|
-
Object.keys(payload).forEach((key: keyof typeof payload) => {
|
|
41
|
-
if (gtagPayloadParams[key] !== undefined) {
|
|
42
|
-
gtagPayload[gtagPayloadParams[key]] = payload[key];
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
28
|
return gtagPayload;
|
|
46
29
|
};
|
|
@@ -52,7 +52,6 @@ export class DeviceAndroidTV extends DeviceBase {
|
|
|
52
52
|
* on the active (focused) element in the DOM tree.
|
|
53
53
|
* @param event keyboard event
|
|
54
54
|
*/
|
|
55
|
-
// eslint-disable-next-line complexity
|
|
56
55
|
relaunchKeyEvent = (event: CustomKeyboardEvent) => {
|
|
57
56
|
if (event.bigscreenSdkRelaunched) { // prevent to relaunch event in loop
|
|
58
57
|
return;
|
|
@@ -61,16 +60,6 @@ export class DeviceAndroidTV extends DeviceBase {
|
|
|
61
60
|
const { key } = event;
|
|
62
61
|
let { keyCode } = event;
|
|
63
62
|
|
|
64
|
-
// KeyCodes collisions for some key sent from Android wrapper or JavaScript (webView)
|
|
65
|
-
if (
|
|
66
|
-
key === 'u' // keyCode 85, same like PLAYPAUSE
|
|
67
|
-
|| key === 'v' // keyCode 86, same like STOP
|
|
68
|
-
|| key === 'y' // keyCode 89, same like REW
|
|
69
|
-
|| key === 'z' // keyCode 90, same like FF
|
|
70
|
-
) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
63
|
/**
|
|
75
64
|
* Remap KeyCode by its key value.
|
|
76
65
|
* On Android all colors keys and some others coming with "0" keyCode.
|
|
@@ -783,10 +783,10 @@ declare namespace React {
|
|
|
783
783
|
|
|
784
784
|
/** Ensures that the props do not include ref at all */
|
|
785
785
|
type PropsWithoutRef<P> =
|
|
786
|
-
//
|
|
786
|
+
// Pick would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions.
|
|
787
787
|
// see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
|
|
788
788
|
// https://github.com/Microsoft/TypeScript/issues/28339
|
|
789
|
-
P extends any ? ('ref' extends keyof P ?
|
|
789
|
+
P extends any ? ('ref' extends keyof P ? Pick<P, Exclude<keyof P, 'ref'>> : P) : P;
|
|
790
790
|
/** Ensures that the props do not include string ref, which cannot be forwarded */
|
|
791
791
|
type PropsWithRef<P> =
|
|
792
792
|
// Just "P extends { ref?: infer R }" looks sufficient, but R will infer as {} if P is {}.
|
|
@@ -1941,7 +1941,7 @@ declare namespace React {
|
|
|
1941
1941
|
content?: string | undefined;
|
|
1942
1942
|
controls?: boolean | undefined;
|
|
1943
1943
|
coords?: string | undefined;
|
|
1944
|
-
crossOrigin?:
|
|
1944
|
+
crossOrigin?: string | undefined;
|
|
1945
1945
|
data?: string | undefined;
|
|
1946
1946
|
dateTime?: string | undefined;
|
|
1947
1947
|
default?: boolean | undefined;
|
|
@@ -2229,7 +2229,7 @@ declare namespace React {
|
|
|
2229
2229
|
autoFocus?: boolean | undefined;
|
|
2230
2230
|
capture?: boolean | 'user' | 'environment' | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
|
|
2231
2231
|
checked?: boolean | undefined;
|
|
2232
|
-
crossOrigin?:
|
|
2232
|
+
crossOrigin?: string | undefined;
|
|
2233
2233
|
disabled?: boolean | undefined;
|
|
2234
2234
|
enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' | undefined;
|
|
2235
2235
|
form?: string | undefined;
|
|
@@ -2281,7 +2281,7 @@ declare namespace React {
|
|
|
2281
2281
|
|
|
2282
2282
|
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
2283
2283
|
as?: string | undefined;
|
|
2284
|
-
crossOrigin?:
|
|
2284
|
+
crossOrigin?: string | undefined;
|
|
2285
2285
|
href?: string | undefined;
|
|
2286
2286
|
hrefLang?: string | undefined;
|
|
2287
2287
|
integrity?: string | undefined;
|
|
@@ -2307,7 +2307,7 @@ declare namespace React {
|
|
|
2307
2307
|
autoPlay?: boolean | undefined;
|
|
2308
2308
|
controls?: boolean | undefined;
|
|
2309
2309
|
controlsList?: string | undefined;
|
|
2310
|
-
crossOrigin?:
|
|
2310
|
+
crossOrigin?: string | undefined;
|
|
2311
2311
|
loop?: boolean | undefined;
|
|
2312
2312
|
mediaGroup?: string | undefined;
|
|
2313
2313
|
muted?: boolean | undefined;
|
|
@@ -2392,7 +2392,7 @@ declare namespace React {
|
|
|
2392
2392
|
async?: boolean | undefined;
|
|
2393
2393
|
/** @deprecated */
|
|
2394
2394
|
charSet?: string | undefined;
|
|
2395
|
-
crossOrigin?:
|
|
2395
|
+
crossOrigin?: string | undefined;
|
|
2396
2396
|
defer?: boolean | undefined;
|
|
2397
2397
|
integrity?: string | undefined;
|
|
2398
2398
|
noModule?: boolean | undefined;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.main = void 0;
|
|
5
|
-
const path = require("path");
|
|
6
|
-
const fs = require("fs");
|
|
7
|
-
const fse = require("fs-extra");
|
|
8
|
-
const chalk = require("chalk");
|
|
9
|
-
const minimist = require("minimist");
|
|
10
|
-
const questions_1 = require("./questionnaire/questions");
|
|
11
|
-
const Settings_1 = require("./settings/Settings");
|
|
12
|
-
async function isDirectoryEmpty(dirPath) {
|
|
13
|
-
const files = await fs.promises.readdir(dirPath);
|
|
14
|
-
return !files.length;
|
|
15
|
-
}
|
|
16
|
-
async function copyTemplateFiles(templateDir, targetDir) {
|
|
17
|
-
return fse.copy(templateDir, targetDir);
|
|
18
|
-
}
|
|
19
|
-
function updatePackageJsonFile(filePath, options) {
|
|
20
|
-
let data = fs.readFileSync(filePath, 'utf8');
|
|
21
|
-
const keywords = options.keywords.map((word) => `"${word}"`).join(', ');
|
|
22
|
-
data = data.replace(/("name": ")(.*)(")/, `$1${options.name}$3`);
|
|
23
|
-
data = data.replace(/("version": ")(.*)(")/, `$1${options.version}$3`);
|
|
24
|
-
data = data.replace(/("description": ")(.*)(")/, `$1${options.description}$3`);
|
|
25
|
-
data = data.replace(/("keywords": \[)(.*)(\])/, `$1${keywords}$3`);
|
|
26
|
-
data = data.replace(/("author": ")(.*)(")/, `$1${options.author}$3`);
|
|
27
|
-
fs.writeFileSync(filePath, data);
|
|
28
|
-
}
|
|
29
|
-
function parseArguments(rawArgv) {
|
|
30
|
-
const argv = minimist(rawArgv.slice(2));
|
|
31
|
-
const dirName = argv._[0];
|
|
32
|
-
if (!dirName) {
|
|
33
|
-
console.error('Error: Missing package name');
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
dirName,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
async function main() {
|
|
41
|
-
const { dirName: destDirName } = parseArguments(process.argv);
|
|
42
|
-
const destDir = path.join(process.cwd(), 'packages/', destDirName);
|
|
43
|
-
if (fs.existsSync(destDir)) {
|
|
44
|
-
console.error(`Error: Target directory "${destDir}" already exists`);
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
fs.mkdirSync(destDir, { recursive: true });
|
|
48
|
-
const isDirEmpty = await isDirectoryEmpty(destDir);
|
|
49
|
-
if (!isDirEmpty) {
|
|
50
|
-
console.error(`Error: Target directory "${destDir}" is not empty.`);
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
const settings = Object.assign({}, Settings_1.Settings);
|
|
54
|
-
settings.name = `${Settings_1.Settings.name}${destDirName}`.toLowerCase();
|
|
55
|
-
const details = await (0, questions_1.promptPackageDetails)(settings);
|
|
56
|
-
const templateDir = path.join(__dirname, '..', 'templates/typescript');
|
|
57
|
-
await copyTemplateFiles(templateDir, destDir);
|
|
58
|
-
const packageJsonFile = path.join(destDir, 'package.json');
|
|
59
|
-
updatePackageJsonFile(packageJsonFile, details);
|
|
60
|
-
const docsSymlinkTarget = path.join('../../../packages/', destDirName, '/README.md');
|
|
61
|
-
const docsSymlinkPath = path.join(process.cwd(), 'docs/packages/', destDirName, '/README.md');
|
|
62
|
-
await fse.ensureSymlink(docsSymlinkTarget, docsSymlinkPath);
|
|
63
|
-
console.log(`${chalk.green('Success')}, package has been initialized!`);
|
|
64
|
-
}
|
|
65
|
-
exports.main = main;
|
|
66
|
-
//# sourceMappingURL=createPackage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createPackage.js","sourceRoot":"","sources":["../src/createPackage.ts"],"names":[],"mappings":";;;;AAEA,6BAA6B;AAC7B,yBAAyB;AACzB,gCAAgC;AAChC,+BAA+B;AAC/B,qCAAqC;AACrC,yDAAiE;AACjE,kDAA+C;AAG/C,KAAK,UAAU,gBAAgB,CAAC,OAAe;IAC3C,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;AACzB,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,WAAmB,EAAE,SAAiB;IACnE,OAAO,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,qBAAqB,CAAC,QAAgB,EAAE,OAAwB;IACrE,IAAI,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACx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AAC,iCAAiC,CAAC,CAAC;AAC5E,CAAC;AA/BD,oBA+BC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,mDAAuC;AAEvC,IAAA,oBAAI,GAAE,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promptPackageDetails = void 0;
|
|
4
|
-
const inquirer = require("inquirer");
|
|
5
|
-
async function promptPackageDetails(defaultValues) {
|
|
6
|
-
return inquirer.prompt([
|
|
7
|
-
{
|
|
8
|
-
type: 'input',
|
|
9
|
-
name: 'name',
|
|
10
|
-
message: 'Package name:',
|
|
11
|
-
default: defaultValues.name,
|
|
12
|
-
}, {
|
|
13
|
-
type: 'input',
|
|
14
|
-
name: 'version',
|
|
15
|
-
message: 'Version:',
|
|
16
|
-
default: defaultValues.version,
|
|
17
|
-
}, {
|
|
18
|
-
type: 'input',
|
|
19
|
-
name: 'description',
|
|
20
|
-
message: 'Description:',
|
|
21
|
-
}, {
|
|
22
|
-
type: 'input',
|
|
23
|
-
name: 'keywords',
|
|
24
|
-
message: 'Keywords:',
|
|
25
|
-
filter: (ans) => ans.split(/[\s,]+/),
|
|
26
|
-
}, {
|
|
27
|
-
type: 'input',
|
|
28
|
-
name: 'author',
|
|
29
|
-
message: 'Author:',
|
|
30
|
-
default: defaultValues.author,
|
|
31
|
-
},
|
|
32
|
-
]);
|
|
33
|
-
}
|
|
34
|
-
exports.promptPackageDetails = promptPackageDetails;
|
|
35
|
-
//# sourceMappingURL=questions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"questions.js","sourceRoot":"","sources":["../../src/questionnaire/questions.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAWrC,KAAK,UAAU,oBAAoB,CAAC,aAA4C;IAC5E,OAAO,QAAQ,CAAC,MAAM,CAAC;QACnB;YACI,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,eAAe;YACxB,OAAO,EAAE,aAAa,CAAC,IAAI;SAC9B,EAAE;YACC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,UAAU;YACnB,OAAO,EAAE,aAAa,CAAC,OAAO;SACjC,EAAE;YACC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,cAAc;SAC1B,EAAE;YACC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,WAAW;YACpB,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC;SACvC,EAAE;YACC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,aAAa,CAAC,MAAM;SAChC;KACJ,CAAC,CAAC;AACP,CAAC;AAEQ,oDAAoB"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Settings = void 0;
|
|
4
|
-
const Settings = {
|
|
5
|
-
name: '@24i/smartapps-bigscreen-',
|
|
6
|
-
version: '0.0.1',
|
|
7
|
-
author: '24i',
|
|
8
|
-
};
|
|
9
|
-
exports.Settings = Settings;
|
|
10
|
-
//# sourceMappingURL=Settings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.js","sourceRoot":"","sources":["../../src/settings/Settings.ts"],"names":[],"mappings":";;;AAAA,MAAM,QAAQ,GAAG;IACb,IAAI,EAAE,2BAA2B;IACjC,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,KAAK;CAChB,CAAC;AAEO,4BAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|