@applicaster/zapp-react-native-utils 12.0.0-alpha.3964644693 → 12.0.0-alpha.4043183114
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/appUtils/HooksManager/{Hook.js → Hook.ts} +17 -11
- package/appUtils/HooksManager/{constants.js → constants.ts} +1 -1
- package/appUtils/HooksManager/{index.js → index.ts} +98 -109
- package/appUtils/HooksManager/types.ts +93 -0
- package/appUtils/RiverFocusManager/index.js +17 -12
- package/appUtils/accessibilityManager/const.ts +50 -0
- package/appUtils/accessibilityManager/hooks.ts +31 -0
- package/appUtils/accessibilityManager/index.ts +150 -0
- package/appUtils/accessibilityManager/logger.ts +5 -0
- package/appUtils/focusManager/index.ts +0 -1
- package/appUtils/focusManager/treeDataStructure/Tree/index.js +2 -3
- package/appUtils/focusManager/treeDataStructure/Utils/index.js +2 -4
- package/appUtils/{index.js → index.ts} +2 -0
- package/appUtils/keyCodes/{index.js → index.ts} +2 -0
- package/appUtils/keyCodes/keys/index.ts +3 -0
- package/appUtils/keyCodes/{keys.android.js → keys/keyEventMapper.ts} +0 -19
- package/appUtils/keyCodes/keys/keys.android.ts +18 -0
- package/appUtils/keyCodes/keys/keys.ios.ts +25 -0
- package/appUtils/keyCodes/keys/keys.ts +15 -0
- package/appUtils/platform/platformUtils.ts +40 -92
- package/appUtils/playerManager/conts.ts +1 -0
- package/appUtils/playerManager/player.ts +9 -0
- package/appUtils/playerManager/usePlayerControllerSetup.tsx +1 -0
- package/domUtils/{cookieManager.js → cookieManager.ts} +1 -2
- package/functionUtils/index.ts +15 -11
- package/modalState/index.ts +1 -5
- package/navigationUtils/index.ts +62 -5
- package/package.json +2 -2
- package/pluginUtils/index.ts +9 -0
- package/reactHooks/navigation/index.ts +11 -4
- package/reactUtils/index.ts +0 -11
- package/appUtils/keyCodes/keys.ios.js +0 -46
- /package/appUtils/HooksManager/{logger.js → logger.ts} +0 -0
- /package/appUtils/{directionHelper.js → directionHelper.ts} +0 -0
- /package/appUtils/keyCodes/{androidTVKeys.js → androidTVKeys.ts} +0 -0
- /package/appUtils/keyCodes/{keys.web.js → keys/keys.web.ts} +0 -0
- /package/appUtils/keyCodes/{keysByPlatform.js → keys/keysByPlatform.ts} +0 -0
- /package/appUtils/{localizationsHelper.js → localizationsHelper.ts} +0 -0
- /package/domUtils/{logger.js → logger.ts} +0 -0
package/navigationUtils/index.ts
CHANGED
|
@@ -324,7 +324,13 @@ export function getPathAttributes({
|
|
|
324
324
|
* @param {object} rivers
|
|
325
325
|
* @returns {object}
|
|
326
326
|
*/
|
|
327
|
-
export function getRiverFromRoute({
|
|
327
|
+
export function getRiverFromRoute({
|
|
328
|
+
route,
|
|
329
|
+
rivers,
|
|
330
|
+
}: {
|
|
331
|
+
route: string;
|
|
332
|
+
rivers: Record<string, ZappRiver>;
|
|
333
|
+
}) {
|
|
328
334
|
if (!route) {
|
|
329
335
|
return null;
|
|
330
336
|
}
|
|
@@ -437,7 +443,7 @@ export const runZappHooksForEntry = async (
|
|
|
437
443
|
|
|
438
444
|
let success;
|
|
439
445
|
let payload;
|
|
440
|
-
const rivers = appStore.get("rivers");
|
|
446
|
+
const rivers: Record<string, ZappRiver> = appStore.get("rivers");
|
|
441
447
|
const plugins = appStore.get("plugins");
|
|
442
448
|
const appData = appStore.get("appData");
|
|
443
449
|
|
|
@@ -492,13 +498,16 @@ export const runZappHooksForEntry = async (
|
|
|
492
498
|
payload = _payload;
|
|
493
499
|
};
|
|
494
500
|
|
|
495
|
-
HooksManager(hooksOptions)
|
|
501
|
+
const hooksManager = HooksManager(hooksOptions);
|
|
502
|
+
|
|
503
|
+
hooksManager.subscriber
|
|
496
504
|
.on(HOOKS_EVENTS.PRESENT_SCREEN_HOOK, handleHookPresent)
|
|
497
505
|
.on(HOOKS_EVENTS.START_BACKGROUND_HOOK, handleBackgroundHook)
|
|
498
506
|
.on(HOOKS_EVENTS.ERROR, onFinished(false))
|
|
499
507
|
.on(HOOKS_EVENTS.CANCEL, onFinished(false))
|
|
500
|
-
.on(HOOKS_EVENTS.COMPLETE, onFinished(true))
|
|
501
|
-
|
|
508
|
+
.on(HOOKS_EVENTS.COMPLETE, onFinished(true));
|
|
509
|
+
|
|
510
|
+
hooksManager.handleHooks(entry);
|
|
502
511
|
|
|
503
512
|
// eslint-disable-next-line no-unmodified-loop-condition
|
|
504
513
|
while (success === undefined) {
|
|
@@ -592,3 +601,51 @@ export function isMenuDisabled(
|
|
|
592
601
|
export function routeIsPlayerScreen(currentRoute) {
|
|
593
602
|
return currentRoute?.includes("/playable");
|
|
594
603
|
}
|
|
604
|
+
|
|
605
|
+
export const getNavBarProps =
|
|
606
|
+
(currentRiver: ZappRiver, pathname: string, title: string) => () => {
|
|
607
|
+
const props = getNavigationPropsV2({
|
|
608
|
+
currentRiver,
|
|
609
|
+
title,
|
|
610
|
+
category: "nav_bar",
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
if (props) {
|
|
614
|
+
return {
|
|
615
|
+
...props,
|
|
616
|
+
id: pathname,
|
|
617
|
+
pathname: pathname,
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
return null;
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
export const findMenuPlugin = (
|
|
625
|
+
navigations: ZappNavigation[],
|
|
626
|
+
plugins
|
|
627
|
+
): QuickBrickPlugin => {
|
|
628
|
+
return resolveNavigationPlugin({
|
|
629
|
+
category: "menu",
|
|
630
|
+
navigations,
|
|
631
|
+
plugins,
|
|
632
|
+
}) as QuickBrickPlugin;
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
export const shouldNavBarDisplayMenu = (currentRiver: ZappRiver, plugins) =>
|
|
636
|
+
findMenuPlugin(currentRiver.navigations, plugins)?.identifier ===
|
|
637
|
+
"quick_brick_side_menu" ||
|
|
638
|
+
currentRiver?.navigations.findIndex(
|
|
639
|
+
(nav) => nav.category === "nav_bar" && nav.general?.override_menu_target
|
|
640
|
+
) > -1;
|
|
641
|
+
|
|
642
|
+
export const getScreenId = (
|
|
643
|
+
screenData: LegacyNavigationScreenData,
|
|
644
|
+
fallbackRiver: ZappRiver
|
|
645
|
+
) => {
|
|
646
|
+
return screenData?.targetScreen
|
|
647
|
+
? screenData?.targetScreen?.id ?? fallbackRiver.id
|
|
648
|
+
: "screen_id" in screenData
|
|
649
|
+
? screenData.screen_id
|
|
650
|
+
: fallbackRiver.id;
|
|
651
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "12.0.0-alpha.
|
|
3
|
+
"version": "12.0.0-alpha.4043183114",
|
|
4
4
|
"description": "Applicaster Zapp React Native utilities package",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "12.0.0-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "12.0.0-alpha.4043183114",
|
|
32
32
|
"buffer": "^5.2.1",
|
|
33
33
|
"camelize": "^1.0.0",
|
|
34
34
|
"create-react-context": "^0.2.3",
|
package/pluginUtils/index.ts
CHANGED
|
@@ -245,3 +245,12 @@ export function generateManifest({ manifestConfig, version }) {
|
|
|
245
245
|
|
|
246
246
|
return manifestConfig({ platform, version });
|
|
247
247
|
}
|
|
248
|
+
|
|
249
|
+
const getPluginType = R.pathOr("unknown_plugin_type", [
|
|
250
|
+
"state",
|
|
251
|
+
"screen",
|
|
252
|
+
"plugin_type",
|
|
253
|
+
]);
|
|
254
|
+
|
|
255
|
+
export const isPlayerPlugin = (routeState): boolean =>
|
|
256
|
+
getPluginType(routeState) === "player";
|
|
@@ -78,6 +78,10 @@ export function isNavBarVisible(
|
|
|
78
78
|
return false;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
if (screenData?.plugin_type === "login" && isTV()) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
81
85
|
/* Match if screen is Hook */
|
|
82
86
|
if (route.startsWith("/hooks/")) {
|
|
83
87
|
const module = screenData?.module;
|
|
@@ -316,16 +320,19 @@ export const useZappHooksForEntry = (
|
|
|
316
320
|
callbacks?.handleHookComplete?.(props);
|
|
317
321
|
};
|
|
318
322
|
|
|
319
|
-
const hookManager = HooksManager(hooksOptions)
|
|
323
|
+
const hookManager = HooksManager(hooksOptions);
|
|
324
|
+
|
|
325
|
+
hookManager.subscriber
|
|
320
326
|
.on(HOOKS_EVENTS.PRESENT_SCREEN_HOOK, handleHookPresent)
|
|
321
327
|
.on(HOOKS_EVENTS.ERROR, handleHookError)
|
|
322
328
|
.on(HOOKS_EVENTS.CANCEL, handleHookCancel)
|
|
323
329
|
.on(HOOKS_EVENTS.START_BACKGROUND_HOOK, handleBackgroundHook)
|
|
324
|
-
.on(HOOKS_EVENTS.COMPLETE, handleHookComplete)
|
|
325
|
-
|
|
330
|
+
.on(HOOKS_EVENTS.COMPLETE, handleHookComplete);
|
|
331
|
+
|
|
332
|
+
hookManager.handleHooks(entry);
|
|
326
333
|
|
|
327
334
|
return () => {
|
|
328
|
-
hookManager
|
|
335
|
+
hookManager.subscriber
|
|
329
336
|
.removeHandler(HOOKS_EVENTS.PRESENT_SCREEN_HOOK, handleHookPresent)
|
|
330
337
|
.removeHandler(HOOKS_EVENTS.ERROR, handleHookError)
|
|
331
338
|
.removeHandler(HOOKS_EVENTS.CANCEL, handleHookCancel)
|
package/reactUtils/index.ts
CHANGED
|
@@ -109,17 +109,6 @@ export const isTvOSPlatform = () => getPlatform() === "tvos";
|
|
|
109
109
|
|
|
110
110
|
export const isAndroidTVPlatform = () => getPlatform() === "android_tv";
|
|
111
111
|
|
|
112
|
-
declare global {
|
|
113
|
-
interface Window {
|
|
114
|
-
VIZIO?: {
|
|
115
|
-
exitApplication: () => void;
|
|
116
|
-
setClosedCaptionHandler: (
|
|
117
|
-
callback: (isCCEnabled: boolean) => void
|
|
118
|
-
) => void;
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
112
|
/**
|
|
124
113
|
* Platforms found in userAgent string, please note that simulators
|
|
125
114
|
* might not have the same agents that the devices have
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/* global tizen */
|
|
2
|
-
const isTizen = typeof tizen !== "undefined";
|
|
3
|
-
|
|
4
|
-
export const KEYS = {
|
|
5
|
-
Enter: { code: "Enter", keyCode: 13 },
|
|
6
|
-
Space: { code: "Space", keyCode: 32 },
|
|
7
|
-
m: { code: "m", keyCode: 77 },
|
|
8
|
-
ArrowLeft: { code: "ArrowLeft", keyCode: 37 },
|
|
9
|
-
ArrowUp: { code: "ArrowUp", keyCode: 38 },
|
|
10
|
-
ArrowRight: { code: "ArrowRight", keyCode: 39 },
|
|
11
|
-
ArrowDown: { code: "ArrowDown", keyCode: 40 },
|
|
12
|
-
Back: isTizen
|
|
13
|
-
? { code: "Back", keyCode: 10009 }
|
|
14
|
-
: { code: "Backspace", keyCode: 8 },
|
|
15
|
-
Play: isTizen
|
|
16
|
-
? { code: "MediaPlay", keyCode: 10252 }
|
|
17
|
-
: { code: "PlayPause", keyCode: 179 },
|
|
18
|
-
Pause: isTizen
|
|
19
|
-
? { code: "MediaPause", keyCode: 19 }
|
|
20
|
-
: { code: "Pause", keyCode: 179 },
|
|
21
|
-
Forward: isTizen
|
|
22
|
-
? { code: "MediaFastForward", keyCode: 417 }
|
|
23
|
-
: { code: "Forward", keyCode: 176 },
|
|
24
|
-
Rewind: isTizen
|
|
25
|
-
? { code: "MediaRewind", keyCode: 412 }
|
|
26
|
-
: { code: "Rewind", keyCode: 177 },
|
|
27
|
-
VolumeUp: isTizen
|
|
28
|
-
? { code: "VolumeUp", keyCode: 447 }
|
|
29
|
-
: { code: "VolumeUp", keyCode: 175 },
|
|
30
|
-
VolumeDown: isTizen
|
|
31
|
-
? { code: "VolumeDown", keyCode: 448 }
|
|
32
|
-
: { code: "VolumeDown", keyCode: 174 },
|
|
33
|
-
ToggleMute: isTizen
|
|
34
|
-
? { code: "VolumeMute", keyCode: 449 }
|
|
35
|
-
: { code: "VolumeMute", keyCode: 173 },
|
|
36
|
-
Stop: isTizen
|
|
37
|
-
? { code: "MediaStop", keyCode: 413 }
|
|
38
|
-
: { code: "Q", keyCode: 81 },
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const ARROW_KEYS = [
|
|
42
|
-
KEYS.ArrowUp,
|
|
43
|
-
KEYS.ArrowLeft,
|
|
44
|
-
KEYS.ArrowDown,
|
|
45
|
-
KEYS.ArrowRight,
|
|
46
|
-
];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|