@applicaster/zapp-react-native-utils 14.0.0-rc.9 → 15.0.0-rc.1
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/actionsExecutor/ActionExecutorContext.tsx +60 -84
- package/actionsExecutor/ScreenActions.ts +164 -0
- package/actionsExecutor/StorageActions.ts +110 -0
- package/actionsExecutor/feedDecorator.ts +171 -0
- package/actionsExecutor/screenResolver.ts +11 -0
- package/analyticsUtils/AnalyticsEvents/helper.ts +81 -0
- package/analyticsUtils/AnalyticsEvents/sendHeaderClickEvent.ts +1 -1
- package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +2 -1
- package/analyticsUtils/AnalyticsEvents/sendOnClickEvent.ts +14 -4
- package/analyticsUtils/__tests__/analyticsUtils.test.js +3 -0
- package/analyticsUtils/events.ts +8 -0
- package/analyticsUtils/index.tsx +3 -4
- package/analyticsUtils/manager.ts +1 -1
- package/analyticsUtils/playerAnalyticsTracker.ts +2 -1
- package/appUtils/HooksManager/Hook.ts +4 -4
- package/appUtils/HooksManager/index.ts +11 -1
- package/appUtils/accessibilityManager/const.ts +13 -0
- package/appUtils/accessibilityManager/hooks.ts +35 -1
- package/appUtils/accessibilityManager/index.ts +154 -30
- package/appUtils/accessibilityManager/utils.ts +24 -0
- package/appUtils/contextKeysManager/contextResolver.ts +42 -1
- package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +7 -0
- package/appUtils/focusManager/__tests__/focusManager.test.js +1 -1
- package/appUtils/focusManager/events.ts +2 -0
- package/appUtils/focusManager/index.ios.ts +10 -0
- package/appUtils/focusManager/index.ts +86 -11
- package/appUtils/focusManager/treeDataStructure/Tree/index.js +1 -1
- package/appUtils/focusManagerAux/utils/index.ts +94 -3
- package/appUtils/platform/platformUtils.ts +31 -1
- package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +0 -15
- package/appUtils/playerManager/useChapterMarker.tsx +0 -1
- package/appUtils/playerManager/usePlayerControllerSetup.tsx +16 -0
- package/arrayUtils/__tests__/isEmptyArray.test.ts +63 -0
- package/arrayUtils/__tests__/isFilledArray.test.ts +1 -1
- package/arrayUtils/index.ts +8 -3
- package/audioPlayerUtils/__tests__/getArtworkImage.test.ts +144 -0
- package/audioPlayerUtils/__tests__/getBackgroundImage.test.ts +72 -0
- package/audioPlayerUtils/__tests__/getImageFromEntry.test.ts +110 -0
- package/audioPlayerUtils/assets/index.ts +2 -0
- package/audioPlayerUtils/index.ts +242 -0
- package/componentsUtils/__tests__/isTabsScreen.test.ts +38 -0
- package/componentsUtils/index.ts +4 -1
- package/conf/player/__tests__/selectors.test.ts +34 -0
- package/conf/player/selectors.ts +10 -0
- package/configurationUtils/__tests__/configurationUtils.test.js +0 -31
- package/configurationUtils/__tests__/getMediaItems.test.ts +65 -0
- package/configurationUtils/__tests__/imageSrcFromMediaItem.test.ts +34 -0
- package/configurationUtils/__tests__/manifestKeyParser.test.ts +546 -0
- package/configurationUtils/index.ts +64 -35
- package/configurationUtils/manifestKeyParser.ts +57 -32
- package/focusManager/FocusManager.ts +104 -20
- package/focusManager/Tree.ts +25 -21
- package/focusManager/__tests__/FocusManager.test.ts +50 -8
- package/focusManager/aux/index.ts +98 -0
- package/focusManager/utils.ts +12 -6
- package/index.d.ts +1 -10
- package/manifestUtils/_internals/getDefaultConfiguration.js +28 -0
- package/manifestUtils/{_internals.js → _internals/index.js} +2 -25
- package/manifestUtils/createConfig.js +4 -1
- package/manifestUtils/defaultManifestConfigurations/player.js +2764 -1539
- package/manifestUtils/index.js +4 -0
- package/manifestUtils/keys.js +12 -0
- package/manifestUtils/progressBar/__tests__/mobileProgressBar.test.js +0 -30
- package/manifestUtils/sharedConfiguration/screenPicker/stylesFields.js +6 -0
- package/navigationUtils/__tests__/mapContentTypesToRivers.test.ts +130 -0
- package/navigationUtils/index.ts +7 -5
- package/package.json +2 -3
- package/playerUtils/PlayerTTS/PlayerTTS.ts +359 -0
- package/playerUtils/PlayerTTS/index.ts +1 -0
- package/playerUtils/__tests__/configurationUtils.test.ts +1 -65
- package/playerUtils/__tests__/getPlayerActionButtons.test.ts +54 -0
- package/playerUtils/_internals/__tests__/utils.test.ts +71 -0
- package/playerUtils/_internals/index.ts +1 -0
- package/playerUtils/_internals/utils.ts +31 -0
- package/playerUtils/configurationUtils.ts +0 -44
- package/playerUtils/getPlayerActionButtons.ts +17 -0
- package/playerUtils/index.ts +53 -0
- package/playerUtils/usePlayerTTS.ts +21 -0
- package/playerUtils/useValidatePlayerConfig.tsx +22 -19
- package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +15 -14
- package/reactHooks/cell-click/__tests__/index.test.js +3 -0
- package/reactHooks/cell-click/index.ts +8 -1
- package/reactHooks/debugging/__tests__/index.test.js +0 -1
- package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +47 -90
- package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +71 -31
- package/reactHooks/feed/index.ts +2 -0
- package/reactHooks/feed/useBatchLoading.ts +17 -10
- package/reactHooks/feed/useFeedLoader.tsx +36 -34
- package/reactHooks/feed/useLoadPipesDataDispatch.ts +63 -0
- package/reactHooks/feed/usePipesCacheReset.ts +3 -3
- package/reactHooks/flatList/useSequentialRenderItem.tsx +3 -3
- package/reactHooks/layout/__tests__/index.test.tsx +3 -1
- package/reactHooks/layout/isTablet/index.ts +12 -5
- package/reactHooks/layout/useDimensions/__tests__/useDimensions.test.ts +34 -36
- package/reactHooks/layout/useDimensions/useDimensions.ts +2 -3
- package/reactHooks/layout/useLayoutVersion.ts +5 -5
- package/reactHooks/navigation/index.ts +7 -5
- package/reactHooks/navigation/useIsScreenActive.ts +9 -5
- package/reactHooks/navigation/useRoute.ts +7 -2
- package/reactHooks/navigation/useScreenStateStore.ts +8 -0
- package/reactHooks/resolvers/__tests__/useCellResolver.test.tsx +4 -0
- package/reactHooks/screen/useScreenContext.ts +1 -1
- package/reactHooks/state/__tests__/ZStoreProvider.test.tsx +2 -1
- package/reactHooks/state/index.ts +1 -1
- package/reactHooks/state/useHomeRiver.ts +4 -2
- package/reactHooks/state/useRivers.ts +7 -8
- package/riverComponetsMeasurementProvider/index.tsx +1 -1
- package/screenPickerUtils/index.ts +13 -0
- package/services/js2native.ts +1 -0
- package/storage/ScreenSingleValueProvider.ts +204 -0
- package/storage/ScreenStateMultiSelectProvider.ts +293 -0
- package/storage/StorageMultiSelectProvider.ts +192 -0
- package/storage/StorageSingleSelectProvider.ts +108 -0
- package/testUtils/index.tsx +7 -8
- package/time/BackgroundTimer.ts +6 -4
- package/utils/__tests__/endsWith.test.ts +30 -0
- package/utils/__tests__/find.test.ts +36 -0
- package/utils/__tests__/omit.test.ts +19 -0
- package/utils/__tests__/path.test.ts +33 -0
- package/utils/__tests__/pathOr.test.ts +37 -0
- package/utils/__tests__/startsWith.test.ts +30 -0
- package/utils/__tests__/take.test.ts +40 -0
- package/utils/endsWith.ts +9 -0
- package/utils/find.ts +3 -0
- package/utils/index.ts +33 -1
- package/utils/omit.ts +5 -0
- package/utils/path.ts +5 -0
- package/utils/pathOr.ts +5 -0
- package/utils/startsWith.ts +9 -0
- package/utils/take.ts +5 -0
- package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +164 -0
- package/zappFrameworkUtils/HookCallback/hookCallbackManifestExtensions.config.js +60 -0
- package/zappFrameworkUtils/HookCallback/useCallbackActions.ts +22 -0
- package/zappFrameworkUtils/loginPluginUtils.ts +1 -1
- package/playerUtils/configurationGenerator.ts +0 -2572
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { isNil, pathOr } from "@applicaster/zapp-react-native-utils/utils";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
QUICK_BRICK_CONTENT,
|
|
5
|
+
QUICK_BRICK_NAVBAR,
|
|
6
|
+
QUICK_BRICK_NAVBAR_SECTIONS,
|
|
7
|
+
} from "@applicaster/quick-brick-core/const";
|
|
8
|
+
|
|
9
|
+
const isNavBar = (node) => QUICK_BRICK_NAVBAR === node?.id;
|
|
10
|
+
const isContent = (node) => QUICK_BRICK_CONTENT === node?.id;
|
|
11
|
+
|
|
12
|
+
// SCREEN_PICKER_SELECTOR_CONTAINER(we assume there is only one SCREEN_PICKER)
|
|
13
|
+
let screenPickerSelectorContainerId;
|
|
14
|
+
|
|
15
|
+
export const onRegisterScreenPickerSelectorContainer = (id) => {
|
|
16
|
+
screenPickerSelectorContainerId = id;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const onUnregisterScreenPickerSelectorContainer = (id) => {
|
|
20
|
+
// reset screenSelectorId on unregistration
|
|
21
|
+
if (screenPickerSelectorContainerId === id) {
|
|
22
|
+
screenPickerSelectorContainerId = undefined;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
// SCREEN_PICKER_SELECTOR_CONTAINER
|
|
26
|
+
|
|
27
|
+
// SCREEN_PICKER_CONTENT_CONTAINER(we assume there is only one SCREEN_PICKER)
|
|
28
|
+
let screenPickerContentContainerId;
|
|
29
|
+
|
|
30
|
+
export const onRegisterScreenPickerContentContainer = (id) => {
|
|
31
|
+
screenPickerContentContainerId = id;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const onUnregisterScreenPickerContentContainer = (id) => {
|
|
35
|
+
// reset screenSelectorId on unregistration
|
|
36
|
+
if (screenPickerContentContainerId === id) {
|
|
37
|
+
screenPickerContentContainerId = undefined;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const isScreenPickerContentContainer = (node) =>
|
|
42
|
+
screenPickerContentContainerId === node?.id;
|
|
43
|
+
|
|
44
|
+
// SCREEN_PICKER_CONTENT_CONTAINER
|
|
45
|
+
|
|
46
|
+
export const findSelectedMenuId = (
|
|
47
|
+
focusableTree,
|
|
48
|
+
{ index, sectionKey }: { index: number; sectionKey: string }
|
|
49
|
+
) => {
|
|
50
|
+
const sectionName = QUICK_BRICK_NAVBAR_SECTIONS[sectionKey];
|
|
51
|
+
|
|
52
|
+
return pathOr(
|
|
53
|
+
undefined,
|
|
54
|
+
["children", index, "id"],
|
|
55
|
+
focusableTree.find(sectionName)
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const findSelectedTabId = (focusableTree, index: number): string => {
|
|
60
|
+
const screenSelectorContainerNode = focusableTree.find(
|
|
61
|
+
screenPickerSelectorContainerId
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const selectedTabId = screenSelectorContainerNode.children[index]?.id;
|
|
65
|
+
|
|
66
|
+
return selectedTabId;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const isTabsScreenContentFocused = (focusableTree, id) => {
|
|
70
|
+
const node = focusableTree.find(id);
|
|
71
|
+
|
|
72
|
+
if (isNil(node)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (isNavBar(node)) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (isContent(node)) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (isScreenPickerContentContainer(node)) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return isTabsScreenContentFocused(focusableTree, node.parentId);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const contextWithoutScrolling = (
|
|
92
|
+
source: FocusManager.FocusContext["source"]
|
|
93
|
+
): FocusManager.FocusContext => {
|
|
94
|
+
return {
|
|
95
|
+
source,
|
|
96
|
+
preserveScroll: true,
|
|
97
|
+
};
|
|
98
|
+
};
|
package/focusManager/utils.ts
CHANGED
|
@@ -4,11 +4,11 @@ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/he
|
|
|
4
4
|
|
|
5
5
|
export const getFocusableId = (ref) => ref?.current?.props.id;
|
|
6
6
|
|
|
7
|
-
type Direction = "up" | "down" | "left" | "right";
|
|
8
|
-
|
|
9
7
|
const normalizeDirection = (direction) => direction.toLowerCase();
|
|
10
8
|
|
|
11
|
-
const checkDirection = (
|
|
9
|
+
const checkDirection = (
|
|
10
|
+
direction: FocusManager.Android.FocusNavigationDirections
|
|
11
|
+
) => {
|
|
12
12
|
invariant(!isNilOrEmpty(direction), "direction should not be empty");
|
|
13
13
|
|
|
14
14
|
invariant(
|
|
@@ -17,19 +17,25 @@ const checkDirection = (direction: Direction) => {
|
|
|
17
17
|
);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export const toFocusDirection = (
|
|
20
|
+
export const toFocusDirection = (
|
|
21
|
+
direction: FocusManager.Android.FocusNavigationDirections
|
|
22
|
+
) => {
|
|
21
23
|
checkDirection(direction);
|
|
22
24
|
|
|
23
25
|
return `nextFocus${capitalize(normalizeDirection(direction))}`;
|
|
24
26
|
};
|
|
25
27
|
|
|
26
|
-
export const isHorizontalDirection = (
|
|
28
|
+
export const isHorizontalDirection = (
|
|
29
|
+
direction: FocusManager.Android.FocusNavigationDirections
|
|
30
|
+
) => {
|
|
27
31
|
checkDirection(direction);
|
|
28
32
|
|
|
29
33
|
return ["left", "right"].includes(normalizeDirection(direction));
|
|
30
34
|
};
|
|
31
35
|
|
|
32
|
-
export const isVerticalDirection = (
|
|
36
|
+
export const isVerticalDirection = (
|
|
37
|
+
direction: FocusManager.Android.FocusNavigationDirections
|
|
38
|
+
) => {
|
|
33
39
|
checkDirection(direction);
|
|
34
40
|
|
|
35
41
|
return ["up", "down"].includes(normalizeDirection(direction));
|
package/index.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ declare type ExtraProps = ZappUIComponentProps & {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
declare type WebConfirmationDialog = {
|
|
72
|
-
message
|
|
72
|
+
message?: string;
|
|
73
73
|
confirmCompletion?: () => void;
|
|
74
74
|
cancelCompletion?: () => void;
|
|
75
75
|
};
|
|
@@ -137,12 +137,3 @@ declare type AccessibilityState = {
|
|
|
137
137
|
reduceMotionEnabled: boolean;
|
|
138
138
|
boldTextEnabled: boolean;
|
|
139
139
|
};
|
|
140
|
-
|
|
141
|
-
declare type AccessibilityProps = {
|
|
142
|
-
accessibilityLabel?: string;
|
|
143
|
-
accessibilityHint?: string;
|
|
144
|
-
"aria-label"?: string;
|
|
145
|
-
"aria-description"?: string;
|
|
146
|
-
accessibilityRole?: string;
|
|
147
|
-
"aria-role"?: string;
|
|
148
|
-
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const R = require("ramda");
|
|
2
|
+
const { defaultConfigurations } = require("../defaultManifestConfigurations");
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* returns default configuration keys for provided plugin type
|
|
6
|
+
* @param {('general-content'|'player')} pluginType
|
|
7
|
+
* @param options manifest generator information
|
|
8
|
+
* @param {string} options.version manifest version
|
|
9
|
+
* @param {string} options.platform qb platform value
|
|
10
|
+
*/
|
|
11
|
+
function getDefaultConfiguration(pluginType, options) {
|
|
12
|
+
const defConfig = R.compose(
|
|
13
|
+
R.unless(R.isNil, (fn) => fn(options)),
|
|
14
|
+
R.propOr(null, pluginType)
|
|
15
|
+
)(defaultConfigurations);
|
|
16
|
+
|
|
17
|
+
if (!defConfig) {
|
|
18
|
+
const availableKeys = R.keys(defaultConfigurations);
|
|
19
|
+
|
|
20
|
+
const message = `Requested key "${pluginType}" doesn't exist in the default configuration\nAvailable keys: ${availableKeys}`;
|
|
21
|
+
// eslint-disable-next-line no-console
|
|
22
|
+
console.warn(message);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return defConfig;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = { getDefaultConfiguration };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const R = require("ramda");
|
|
2
2
|
const camelize = require("camelize");
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const { getDefaultConfiguration } = require("./getDefaultConfiguration");
|
|
4
5
|
|
|
5
6
|
const toSnakeCase = R.compose(R.replace(/\s/g, "_"), R.toLower, R.trim);
|
|
6
7
|
|
|
@@ -173,30 +174,6 @@ function generateFieldsFromDefaultsWithoutPrefixedLabel(
|
|
|
173
174
|
)(fields);
|
|
174
175
|
}
|
|
175
176
|
|
|
176
|
-
/**
|
|
177
|
-
* returns default configuration keys for provided plugin type
|
|
178
|
-
* @param {('general-content'|'player')} pluginType
|
|
179
|
-
* @param options manifest generator information
|
|
180
|
-
* @param {string} options.version manifest version
|
|
181
|
-
* @param {string} options.platform qb platform value
|
|
182
|
-
*/
|
|
183
|
-
function getDefaultConfiguration(pluginType, options) {
|
|
184
|
-
const defConfig = R.compose(
|
|
185
|
-
R.unless(R.isNil, (fn) => fn(options)),
|
|
186
|
-
R.propOr(null, pluginType)
|
|
187
|
-
)(defaultConfigurations);
|
|
188
|
-
|
|
189
|
-
if (!defConfig) {
|
|
190
|
-
const availableKeys = R.keys(defaultConfigurations);
|
|
191
|
-
|
|
192
|
-
const message = `Requested key "${pluginType}" doesn't exist in the default configuration\nAvailable keys: ${availableKeys}`;
|
|
193
|
-
// eslint-disable-next-line no-console
|
|
194
|
-
console.warn(message);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return defConfig;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
177
|
module.exports = {
|
|
201
178
|
toSnakeCase,
|
|
202
179
|
toCamelCase,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
const R = require("ramda");
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
getDefaultConfiguration,
|
|
5
|
+
} = require("./_internals/getDefaultConfiguration");
|
|
3
6
|
|
|
4
7
|
const indexByKey = R.indexBy((obj) => R.prop(obj.group ? "label" : "key", obj));
|
|
5
8
|
const propIfExist = R.curry((prop) => R.when(R.prop(prop), R.prop(prop)));
|