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