@applicaster/zapp-react-native-utils 14.0.0-alpha.5974411329 → 14.0.0-alpha.6000342231

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 (69) hide show
  1. package/actionsExecutor/ActionExecutorContext.tsx +0 -1
  2. package/actionsExecutor/ScreenActions.ts +20 -19
  3. package/analyticsUtils/AnalyticPlayerListener.ts +5 -2
  4. package/analyticsUtils/__tests__/analyticsUtils.test.js +0 -11
  5. package/analyticsUtils/playerAnalyticsTracker.ts +2 -1
  6. package/appUtils/accessibilityManager/const.ts +13 -0
  7. package/appUtils/accessibilityManager/hooks.ts +35 -1
  8. package/appUtils/accessibilityManager/index.ts +151 -30
  9. package/appUtils/accessibilityManager/utils.ts +24 -0
  10. package/appUtils/contextKeysManager/contextResolver.ts +12 -1
  11. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +8 -0
  12. package/appUtils/focusManager/__tests__/focusManager.test.js +1 -1
  13. package/appUtils/focusManager/events.ts +2 -0
  14. package/appUtils/focusManager/index.ios.ts +27 -0
  15. package/appUtils/focusManager/index.ts +86 -11
  16. package/appUtils/focusManagerAux/utils/index.ts +112 -3
  17. package/appUtils/focusManagerAux/utils/utils.ios.ts +35 -0
  18. package/appUtils/platform/platformUtils.ts +33 -3
  19. package/appUtils/playerManager/conts.ts +21 -0
  20. package/arrayUtils/__tests__/allTruthy.test.ts +24 -0
  21. package/arrayUtils/__tests__/anyThruthy.test.ts +24 -0
  22. package/arrayUtils/index.ts +5 -0
  23. package/configurationUtils/__tests__/manifestKeyParser.test.ts +0 -1
  24. package/configurationUtils/index.ts +1 -1
  25. package/focusManager/FocusManager.ts +78 -4
  26. package/focusManager/aux/index.ts +98 -0
  27. package/focusManager/utils.ts +12 -6
  28. package/index.d.ts +1 -1
  29. package/manifestUtils/defaultManifestConfigurations/player.js +188 -2
  30. package/manifestUtils/index.js +4 -0
  31. package/manifestUtils/keys.js +12 -0
  32. package/manifestUtils/sharedConfiguration/screenPicker/stylesFields.js +6 -0
  33. package/navigationUtils/index.ts +20 -17
  34. package/package.json +2 -2
  35. package/playerUtils/PlayerTTS/PlayerTTS.ts +359 -0
  36. package/playerUtils/PlayerTTS/index.ts +1 -0
  37. package/playerUtils/getPlayerActionButtons.ts +1 -1
  38. package/playerUtils/usePlayerTTS.ts +21 -0
  39. package/reactHooks/cell-click/__tests__/index.test.js +3 -0
  40. package/reactHooks/debugging/__tests__/index.test.js +0 -1
  41. package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +8 -2
  42. package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +57 -37
  43. package/reactHooks/feed/index.ts +2 -0
  44. package/reactHooks/feed/useBatchLoading.ts +14 -9
  45. package/reactHooks/feed/useFeedLoader.tsx +39 -59
  46. package/reactHooks/feed/useInflatedUrl.ts +23 -29
  47. package/reactHooks/feed/useLoadPipesDataDispatch.ts +63 -0
  48. package/reactHooks/layout/index.ts +1 -1
  49. package/reactHooks/navigation/useScreenStateStore.ts +3 -3
  50. package/reactHooks/state/index.ts +1 -1
  51. package/reactHooks/state/useHomeRiver.ts +4 -2
  52. package/screenPickerUtils/index.ts +13 -0
  53. package/storage/ScreenSingleValueProvider.ts +25 -22
  54. package/storage/ScreenStateMultiSelectProvider.ts +26 -23
  55. package/utils/__tests__/endsWith.test.ts +30 -0
  56. package/utils/__tests__/find.test.ts +36 -0
  57. package/utils/__tests__/omit.test.ts +19 -0
  58. package/utils/__tests__/path.test.ts +33 -0
  59. package/utils/__tests__/pathOr.test.ts +37 -0
  60. package/utils/__tests__/startsWith.test.ts +30 -0
  61. package/utils/__tests__/take.test.ts +40 -0
  62. package/utils/endsWith.ts +9 -0
  63. package/utils/find.ts +3 -0
  64. package/utils/index.ts +19 -1
  65. package/utils/omit.ts +5 -0
  66. package/utils/path.ts +5 -0
  67. package/utils/pathOr.ts +5 -0
  68. package/utils/startsWith.ts +9 -0
  69. package/utils/take.ts +5 -0
@@ -0,0 +1,33 @@
1
+ import { path } from "../path";
2
+
3
+ test("example 1", () => {
4
+ const route = ["a", "b", "c"];
5
+ const xs = { a: { b: { c: 1 } } };
6
+
7
+ const output = 1;
8
+
9
+ expect(path(route, xs)).toEqual(output);
10
+ });
11
+
12
+ test("example 2", () => {
13
+ const route = ["a", "b"];
14
+ const xs = { a: { b: { c: 1 } } };
15
+
16
+ const output = { c: 1 };
17
+
18
+ expect(path(route, xs)).toEqual(output);
19
+ });
20
+
21
+ test("example 3", () => {
22
+ const route = ["a", "b", "x"];
23
+ const xs = { a: { b: { c: 1 } } };
24
+
25
+ expect(path(route, xs)).toBeUndefined();
26
+ });
27
+
28
+ test("example 4", () => {
29
+ const route = ["a", "b", "c"];
30
+ const xs = undefined;
31
+
32
+ expect(path(route, xs)).toBeUndefined();
33
+ });
@@ -0,0 +1,37 @@
1
+ import { pathOr } from "../pathOr";
2
+
3
+ test("example 1", () => {
4
+ const defaultValue = "defaultValue";
5
+ const path = ["a", "b", "c"];
6
+ const xs = { a: { b: { c: 1 } } };
7
+
8
+ const output = 1;
9
+
10
+ expect(pathOr(defaultValue, path, xs)).toEqual(output);
11
+ });
12
+
13
+ test("example 2", () => {
14
+ const defaultValue = "defaultValue";
15
+ const path = ["a", "b"];
16
+ const xs = { a: { b: { c: 1 } } };
17
+
18
+ const output = { c: 1 };
19
+
20
+ expect(pathOr(defaultValue, path, xs)).toEqual(output);
21
+ });
22
+
23
+ test("example 3", () => {
24
+ const defaultValue = "defaultValue";
25
+ const path = ["a", "b", "x"];
26
+ const xs = { a: { b: { c: 1 } } };
27
+
28
+ expect(pathOr(defaultValue, path, xs)).toBe(defaultValue);
29
+ });
30
+
31
+ test("example 4", () => {
32
+ const defaultValue = "defaultValue";
33
+ const path = ["a", "b", "c"];
34
+ const xs = undefined;
35
+
36
+ expect(pathOr(defaultValue, path, xs)).toBe(defaultValue);
37
+ });
@@ -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
+ });
@@ -0,0 +1,40 @@
1
+ import { take } from "../take";
2
+
3
+ describe("take", () => {
4
+ it("takes n elements from the beginning", () => {
5
+ expect(take(2, [1, 2, 3])).toEqual([1, 2]);
6
+ });
7
+
8
+ it("returns the whole array if n is larger than length", () => {
9
+ expect(take(5, [1, 2, 3])).toEqual([1, 2, 3]);
10
+ });
11
+
12
+ it("returns empty array if n is 0", () => {
13
+ expect(take(0, [1, 2, 3])).toEqual([]);
14
+ });
15
+
16
+ it("returns empty array for empty input array", () => {
17
+ expect(take(2, [])).toEqual([]);
18
+ });
19
+
20
+ it("returns empty array if n is negative", () => {
21
+ expect(take(-1, [1, 2, 3])).toEqual([]);
22
+ });
23
+
24
+ it("works with strings in array", () => {
25
+ expect(take(2, ["a", "b", "c"])).toEqual(["a", "b"]);
26
+ });
27
+
28
+ it("works with objects in array", () => {
29
+ const arr = [{ id: 1 }, { id: 2 }];
30
+ expect(take(1, arr)).toEqual([{ id: 1 }]);
31
+ });
32
+
33
+ it("returns empty array if input is not an array", () => {
34
+ // @ts-expect-error testing non-array input
35
+ expect(take(2, null)).toEqual([]);
36
+
37
+ // @ts-expect-error testing non-array input
38
+ expect(take(2, undefined)).toEqual([]);
39
+ });
40
+ });
@@ -0,0 +1,9 @@
1
+ import { isNil } from "lodash";
2
+
3
+ export const endsWith = (target, str) => {
4
+ if (isNil(str)) {
5
+ return false;
6
+ }
7
+
8
+ return str.endsWith(target);
9
+ };
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,6 +2,20 @@ export { chunk } from "./chunk";
2
2
 
3
3
  export { times } from "./times";
4
4
 
5
+ export { startsWith } from "./startsWith";
6
+
7
+ export { find } from "./find";
8
+
9
+ export { pathOr } from "./pathOr";
10
+
11
+ export { path } from "./path";
12
+
13
+ export { omit } from "./omit";
14
+
15
+ export { endsWith } from "./endsWith";
16
+
17
+ export { take } from "./take";
18
+
5
19
  export {
6
20
  cloneDeep as clone,
7
21
  flatten,
@@ -13,9 +27,13 @@ export {
13
27
  has,
14
28
  flatMap,
15
29
  difference,
16
- take,
17
30
  pick,
18
31
  map,
19
32
  trim,
20
33
  toString,
34
+ last,
35
+ toLower,
36
+ isEqual as equals,
37
+ flowRight as compose,
38
+ partial,
21
39
  } from "lodash";
package/utils/omit.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { omit as Lodash_omit } from "lodash";
2
+
3
+ export const omit = (path, record) => {
4
+ return Lodash_omit(record, path);
5
+ };
package/utils/path.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { get } from "lodash";
2
+
3
+ export const path = (route, record) => {
4
+ return get(record, route, undefined);
5
+ };
@@ -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
+ };
package/utils/take.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { take as Ltake } from "lodash";
2
+
3
+ export function take<T>(n: number, xs: T[]): T[] {
4
+ return Ltake(xs, n);
5
+ }