@applicaster/zapp-react-native-utils 14.0.0-alpha.1661204539 → 14.0.0-alpha.1740013076

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 (115) hide show
  1. package/actionsExecutor/ActionExecutorContext.tsx +11 -6
  2. package/actionsExecutor/ScreenActions.ts +91 -17
  3. package/actionsExecutor/feedDecorator.ts +171 -0
  4. package/actionsExecutor/screenResolver.ts +6 -3
  5. package/analyticsUtils/AnalyticsEvents/helper.ts +81 -0
  6. package/analyticsUtils/AnalyticsEvents/sendHeaderClickEvent.ts +1 -1
  7. package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +2 -1
  8. package/analyticsUtils/AnalyticsEvents/sendOnClickEvent.ts +14 -4
  9. package/analyticsUtils/__tests__/analyticsUtils.test.js +3 -0
  10. package/analyticsUtils/events.ts +8 -0
  11. package/analyticsUtils/index.tsx +3 -4
  12. package/analyticsUtils/manager.ts +1 -1
  13. package/analyticsUtils/playerAnalyticsTracker.ts +2 -1
  14. package/appUtils/HooksManager/Hook.ts +4 -4
  15. package/appUtils/HooksManager/index.ts +11 -1
  16. package/appUtils/accessibilityManager/const.ts +13 -0
  17. package/appUtils/accessibilityManager/hooks.ts +35 -1
  18. package/appUtils/accessibilityManager/index.ts +154 -30
  19. package/appUtils/accessibilityManager/utils.ts +24 -0
  20. package/appUtils/contextKeysManager/contextResolver.ts +30 -3
  21. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +5 -0
  22. package/appUtils/focusManager/__tests__/focusManager.test.js +1 -1
  23. package/appUtils/focusManager/index.ios.ts +10 -0
  24. package/appUtils/focusManager/index.ts +82 -11
  25. package/appUtils/focusManager/treeDataStructure/Tree/index.js +1 -1
  26. package/appUtils/focusManagerAux/utils/index.ts +106 -3
  27. package/appUtils/platform/platformUtils.ts +31 -1
  28. package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +0 -15
  29. package/appUtils/playerManager/useChapterMarker.tsx +0 -1
  30. package/appUtils/playerManager/usePlayerControllerSetup.tsx +16 -0
  31. package/arrayUtils/__tests__/isEmptyArray.test.ts +63 -0
  32. package/arrayUtils/__tests__/isFilledArray.test.ts +1 -1
  33. package/arrayUtils/index.ts +8 -3
  34. package/audioPlayerUtils/__tests__/getArtworkImage.test.ts +144 -0
  35. package/audioPlayerUtils/__tests__/getBackgroundImage.test.ts +72 -0
  36. package/audioPlayerUtils/__tests__/getImageFromEntry.test.ts +110 -0
  37. package/audioPlayerUtils/assets/index.ts +2 -0
  38. package/audioPlayerUtils/index.ts +242 -0
  39. package/componentsUtils/__tests__/isTabsScreen.test.ts +38 -0
  40. package/componentsUtils/index.ts +4 -1
  41. package/conf/player/__tests__/selectors.test.ts +34 -0
  42. package/conf/player/selectors.ts +10 -0
  43. package/configurationUtils/__tests__/configurationUtils.test.js +0 -31
  44. package/configurationUtils/__tests__/getMediaItems.test.ts +65 -0
  45. package/configurationUtils/__tests__/imageSrcFromMediaItem.test.ts +34 -0
  46. package/configurationUtils/__tests__/manifestKeyParser.test.ts +546 -0
  47. package/configurationUtils/index.ts +64 -35
  48. package/configurationUtils/manifestKeyParser.ts +57 -32
  49. package/focusManager/FocusManager.ts +26 -16
  50. package/focusManager/Tree.ts +25 -21
  51. package/focusManager/__tests__/FocusManager.test.ts +50 -8
  52. package/index.d.ts +1 -10
  53. package/manifestUtils/_internals/getDefaultConfiguration.js +28 -0
  54. package/manifestUtils/{_internals.js → _internals/index.js} +2 -25
  55. package/manifestUtils/createConfig.js +4 -1
  56. package/manifestUtils/defaultManifestConfigurations/player.js +1253 -200
  57. package/manifestUtils/progressBar/__tests__/mobileProgressBar.test.js +0 -30
  58. package/manifestUtils/sharedConfiguration/screenPicker/stylesFields.js +1 -2
  59. package/navigationUtils/__tests__/mapContentTypesToRivers.test.ts +130 -0
  60. package/navigationUtils/index.ts +7 -5
  61. package/package.json +2 -3
  62. package/playerUtils/PlayerTTS/PlayerTTS.ts +359 -0
  63. package/playerUtils/PlayerTTS/index.ts +1 -0
  64. package/playerUtils/__tests__/configurationUtils.test.ts +1 -65
  65. package/playerUtils/__tests__/getPlayerActionButtons.test.ts +54 -0
  66. package/playerUtils/_internals/__tests__/utils.test.ts +71 -0
  67. package/playerUtils/_internals/index.ts +1 -0
  68. package/playerUtils/_internals/utils.ts +31 -0
  69. package/playerUtils/configurationUtils.ts +0 -44
  70. package/playerUtils/getPlayerActionButtons.ts +17 -0
  71. package/playerUtils/index.ts +59 -0
  72. package/playerUtils/usePlayerTTS.ts +21 -0
  73. package/playerUtils/useValidatePlayerConfig.tsx +22 -19
  74. package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +15 -14
  75. package/reactHooks/cell-click/__tests__/index.test.js +3 -0
  76. package/reactHooks/cell-click/index.ts +3 -0
  77. package/reactHooks/debugging/__tests__/index.test.js +0 -1
  78. package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +47 -90
  79. package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +71 -31
  80. package/reactHooks/feed/index.ts +2 -0
  81. package/reactHooks/feed/useBatchLoading.ts +17 -10
  82. package/reactHooks/feed/useFeedLoader.tsx +39 -44
  83. package/reactHooks/feed/useLoadPipesDataDispatch.ts +63 -0
  84. package/reactHooks/feed/usePipesCacheReset.ts +3 -3
  85. package/reactHooks/flatList/useSequentialRenderItem.tsx +3 -3
  86. package/reactHooks/layout/__tests__/index.test.tsx +3 -1
  87. package/reactHooks/layout/isTablet/index.ts +12 -5
  88. package/reactHooks/layout/useDimensions/__tests__/useDimensions.test.ts +34 -36
  89. package/reactHooks/layout/useDimensions/useDimensions.ts +2 -3
  90. package/reactHooks/layout/useLayoutVersion.ts +5 -5
  91. package/reactHooks/navigation/index.ts +7 -5
  92. package/reactHooks/navigation/useIsScreenActive.ts +9 -5
  93. package/reactHooks/navigation/useRoute.ts +7 -2
  94. package/reactHooks/navigation/useScreenStateStore.ts +8 -0
  95. package/reactHooks/resolvers/__tests__/useCellResolver.test.tsx +4 -0
  96. package/reactHooks/screen/useScreenContext.ts +1 -1
  97. package/reactHooks/state/__tests__/ZStoreProvider.test.tsx +2 -1
  98. package/reactHooks/state/index.ts +1 -1
  99. package/reactHooks/state/useHomeRiver.ts +4 -2
  100. package/reactHooks/state/useRivers.ts +7 -8
  101. package/riverComponetsMeasurementProvider/index.tsx +1 -1
  102. package/screenPickerUtils/index.ts +7 -0
  103. package/services/js2native.ts +1 -0
  104. package/storage/ScreenSingleValueProvider.ts +138 -26
  105. package/storage/ScreenStateMultiSelectProvider.ts +210 -36
  106. package/testUtils/index.tsx +7 -8
  107. package/time/BackgroundTimer.ts +6 -4
  108. package/utils/__tests__/find.test.ts +36 -0
  109. package/utils/__tests__/pathOr.test.ts +37 -0
  110. package/utils/__tests__/startsWith.test.ts +30 -0
  111. package/utils/find.ts +3 -0
  112. package/utils/index.ts +24 -1
  113. package/utils/pathOr.ts +5 -0
  114. package/utils/startsWith.ts +9 -0
  115. package/playerUtils/configurationGenerator.ts +0 -2572
@@ -0,0 +1,30 @@
1
+ import { startsWith } from "../startsWith";
2
+
3
+ describe("startsWith", () => {
4
+ it("returns false when str is null", () => {
5
+ expect(startsWith("a", null)).toBe(false);
6
+ });
7
+
8
+ it("returns false when str is undefined", () => {
9
+ expect(startsWith("a", undefined)).toBe(false);
10
+ });
11
+
12
+ it("returns true when string starts with target", () => {
13
+ expect(startsWith("he", "hello")).toBe(true);
14
+ expect(startsWith("", "hello")).toBe(true); // empty target always matches
15
+ });
16
+
17
+ it("returns false when string does not start with target", () => {
18
+ expect(startsWith("yo", "hello")).toBe(false);
19
+ });
20
+
21
+ it("works with single character target", () => {
22
+ expect(startsWith("h", "hello")).toBe(true);
23
+ expect(startsWith("x", "hello")).toBe(false);
24
+ });
25
+
26
+ it("is case-sensitive", () => {
27
+ expect(startsWith("He", "hello")).toBe(false);
28
+ expect(startsWith("he", "hello")).toBe(true);
29
+ });
30
+ });
package/utils/find.ts ADDED
@@ -0,0 +1,3 @@
1
+ export const find = (predicate, xs) => {
2
+ return (xs || []).find((x, index) => predicate(x, index));
3
+ };
package/utils/index.ts CHANGED
@@ -2,4 +2,27 @@ export { chunk } from "./chunk";
2
2
 
3
3
  export { times } from "./times";
4
4
 
5
- export { cloneDeep as clone, flatten, drop, size, isNil } from "lodash";
5
+ export { startsWith } from "./startsWith";
6
+
7
+ export { find } from "./find";
8
+
9
+ export { pathOr } from "./pathOr";
10
+
11
+ export {
12
+ cloneDeep as clone,
13
+ flatten,
14
+ drop,
15
+ size,
16
+ isNil,
17
+ isEmpty,
18
+ get,
19
+ has,
20
+ flatMap,
21
+ difference,
22
+ take,
23
+ pick,
24
+ map,
25
+ trim,
26
+ toString,
27
+ last,
28
+ } from "lodash";
@@ -0,0 +1,5 @@
1
+ import { get } from "lodash";
2
+
3
+ export const pathOr = (defaultValue, path, record) => {
4
+ return get(record, path, defaultValue);
5
+ };
@@ -0,0 +1,9 @@
1
+ import { isNil } from "lodash";
2
+
3
+ export const startsWith = (target, str) => {
4
+ if (isNil(str)) {
5
+ return false;
6
+ }
7
+
8
+ return str.startsWith(target);
9
+ };