@applicaster/zapp-react-native-utils 14.0.0-rc.3 → 14.0.0-rc.31

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 (52) hide show
  1. package/actionsExecutor/ActionExecutorContext.tsx +1 -1
  2. package/analyticsUtils/AnalyticsEvents/helper.ts +81 -0
  3. package/analyticsUtils/AnalyticsEvents/sendOnClickEvent.ts +14 -4
  4. package/analyticsUtils/__tests__/analyticsUtils.test.js +14 -0
  5. package/analyticsUtils/events.ts +8 -0
  6. package/appUtils/accessibilityManager/index.ts +5 -2
  7. package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +0 -15
  8. package/appUtils/playerManager/useChapterMarker.tsx +0 -1
  9. package/arrayUtils/__tests__/isEmptyArray.test.ts +63 -0
  10. package/arrayUtils/__tests__/isFilledArray.test.ts +1 -1
  11. package/arrayUtils/index.ts +7 -2
  12. package/audioPlayerUtils/__tests__/getArtworkImage.test.ts +144 -0
  13. package/audioPlayerUtils/__tests__/getBackgroundImage.test.ts +72 -0
  14. package/audioPlayerUtils/__tests__/getImageFromEntry.test.ts +110 -0
  15. package/audioPlayerUtils/assets/index.ts +2 -0
  16. package/audioPlayerUtils/index.ts +242 -0
  17. package/conf/player/__tests__/selectors.test.ts +34 -0
  18. package/conf/player/selectors.ts +10 -0
  19. package/configurationUtils/__tests__/configurationUtils.test.js +0 -31
  20. package/configurationUtils/__tests__/getMediaItems.test.ts +65 -0
  21. package/configurationUtils/__tests__/imageSrcFromMediaItem.test.ts +34 -0
  22. package/configurationUtils/index.ts +63 -34
  23. package/focusManager/FocusManager.ts +26 -16
  24. package/focusManager/Tree.ts +25 -21
  25. package/focusManager/__tests__/FocusManager.test.ts +50 -8
  26. package/manifestUtils/_internals/getDefaultConfiguration.js +28 -0
  27. package/manifestUtils/{_internals.js → _internals/index.js} +2 -25
  28. package/manifestUtils/createConfig.js +4 -1
  29. package/manifestUtils/defaultManifestConfigurations/player.js +1239 -200
  30. package/manifestUtils/progressBar/__tests__/mobileProgressBar.test.js +0 -30
  31. package/manifestUtils/sharedConfiguration/screenPicker/stylesFields.js +1 -2
  32. package/package.json +2 -2
  33. package/playerUtils/__tests__/configurationUtils.test.ts +1 -65
  34. package/playerUtils/__tests__/getPlayerActionButtons.test.ts +54 -0
  35. package/playerUtils/_internals/__tests__/utils.test.ts +71 -0
  36. package/playerUtils/_internals/index.ts +1 -0
  37. package/playerUtils/_internals/utils.ts +31 -0
  38. package/playerUtils/configurationUtils.ts +0 -44
  39. package/playerUtils/getPlayerActionButtons.ts +17 -0
  40. package/playerUtils/index.ts +2 -0
  41. package/playerUtils/useValidatePlayerConfig.tsx +22 -19
  42. package/reactHooks/feed/useBatchLoading.ts +3 -3
  43. package/reactHooks/feed/usePipesCacheReset.ts +1 -1
  44. package/reactHooks/layout/isTablet/index.ts +5 -2
  45. package/reactHooks/navigation/useIsScreenActive.ts +9 -5
  46. package/reactHooks/screen/useScreenContext.ts +1 -1
  47. package/reactHooks/state/__tests__/ZStoreProvider.test.tsx +2 -1
  48. package/riverComponetsMeasurementProvider/index.tsx +1 -1
  49. package/services/js2native.ts +1 -0
  50. package/time/BackgroundTimer.ts +5 -3
  51. package/utils/index.ts +16 -1
  52. package/playerUtils/configurationGenerator.ts +0 -2572
@@ -8,37 +8,41 @@ export class Tree {
8
8
  this.tree = focusManagerTree;
9
9
  }
10
10
 
11
- add(component, parentFocusable, isFocusableCell) {
12
- const focusableId = getFocusableId(component);
13
- const parentId = getFocusableId(parentFocusable);
11
+ add(
12
+ touchableRef: FocusManager.TouchableReactRef,
13
+ parentFocusableRef: FocusManager.TouchableReactRef,
14
+ isFocusableCell: boolean,
15
+ parentFocusableId: string
16
+ ) {
17
+ const focusableId = getFocusableId(touchableRef);
18
+ const parentId = getFocusableId(parentFocusableRef) || parentFocusableId;
14
19
  const focusableComponentInTree = this.find(focusableId);
15
20
 
16
21
  // update node if it already exists
17
22
  if (focusableComponentInTree) {
18
- focusableComponentInTree.updateNode(component);
23
+ focusableComponentInTree.updateNode(touchableRef);
19
24
  }
20
25
 
21
- if (parentFocusable?.current) {
22
- if (!this.find(parentId)) {
23
- this.tree.push(new TreeNode(null, parentId, null, isFocusableCell));
24
- }
26
+ if (!this.find(parentId)) {
27
+ // create temporary node to the root of the tree
28
+ this.tree.push(new TreeNode(null, parentId, null, isFocusableCell));
29
+ }
25
30
 
26
- const parentNode = this.find(parentId);
31
+ const parentNode = this.find(parentId);
27
32
 
28
- if (parentNode) {
29
- if (focusableComponentInTree) {
30
- focusableComponentInTree.isFocusableCell = isFocusableCell;
31
- focusableComponentInTree.parentId = parentNode.id;
33
+ if (parentNode) {
34
+ if (focusableComponentInTree) {
35
+ focusableComponentInTree.isFocusableCell = isFocusableCell;
36
+ focusableComponentInTree.parentId = parentNode.id;
32
37
 
33
- parentNode.addChild(focusableComponentInTree);
38
+ parentNode.addChild(focusableComponentInTree);
34
39
 
35
- // remove root object from the list
36
- this.tree = this.tree.filter(
37
- (node) => node !== focusableComponentInTree
38
- );
39
- } else {
40
- parentNode.addChild(component, focusableId, isFocusableCell);
41
- }
40
+ // remove root object from the list
41
+ this.tree = this.tree.filter(
42
+ (node) => node !== focusableComponentInTree
43
+ );
44
+ } else {
45
+ parentNode.addChild(touchableRef, focusableId, isFocusableCell);
42
46
  }
43
47
  }
44
48
  }
@@ -1,5 +1,8 @@
1
1
  import { focusManager } from "../FocusManager";
2
2
 
3
+ const isFocusableCell = true;
4
+ const parentFocusableId = "parentFocusableId";
5
+
3
6
  const group = {
4
7
  current: {
5
8
  props: {
@@ -62,13 +65,47 @@ jest.useFakeTimers();
62
65
 
63
66
  describe("FocusManager", () => {
64
67
  beforeAll(() => {
65
- focusManager.registerFocusable(group, { current: null });
66
- focusManager.registerFocusable(child1, group);
67
- focusManager.registerFocusable(child2, group);
68
- focusManager.registerFocusable(child3, child2);
69
-
70
- focusManager.registerFocusable(child4, child2);
71
- focusManager.registerFocusable(child5, child2);
68
+ focusManager.registerFocusable({
69
+ touchableRef: group,
70
+ parentFocusableRef: { current: null },
71
+ isFocusableCell,
72
+ parentFocusableId,
73
+ });
74
+
75
+ focusManager.registerFocusable({
76
+ touchableRef: child1,
77
+ parentFocusableRef: group,
78
+ isFocusableCell,
79
+ parentFocusableId,
80
+ });
81
+
82
+ focusManager.registerFocusable({
83
+ touchableRef: child2,
84
+ parentFocusableRef: group,
85
+ isFocusableCell,
86
+ parentFocusableId,
87
+ });
88
+
89
+ focusManager.registerFocusable({
90
+ touchableRef: child3,
91
+ parentFocusableRef: child2,
92
+ isFocusableCell,
93
+ parentFocusableId,
94
+ });
95
+
96
+ focusManager.registerFocusable({
97
+ touchableRef: child4,
98
+ parentFocusableRef: child2,
99
+ isFocusableCell,
100
+ parentFocusableId,
101
+ });
102
+
103
+ focusManager.registerFocusable({
104
+ touchableRef: child5,
105
+ parentFocusableRef: child2,
106
+ isFocusableCell,
107
+ parentFocusableId,
108
+ });
72
109
  });
73
110
 
74
111
  it("focusManager should be defined", () => {
@@ -199,7 +236,12 @@ describe("FocusManager", () => {
199
236
  });
200
237
 
201
238
  it("focusManager registerFocusable should register", () => {
202
- focusManager.registerFocusable(child5, child2);
239
+ focusManager.registerFocusable({
240
+ touchableRef: child5,
241
+ parentFocusableRef: child2,
242
+ isFocusableCell,
243
+ parentFocusableId,
244
+ });
203
245
 
204
246
  expect(
205
247
  focusManager.isFocusableChildOf(child5.current.props.id, child2)
@@ -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
- const { defaultConfigurations } = require("./defaultManifestConfigurations");
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
- const { getDefaultConfiguration } = require("./_internals");
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)));