@applicaster/zapp-react-native-utils 13.0.0-alpha.6234681660 → 13.0.0-alpha.6372000108

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 (46) hide show
  1. package/actionsExecutor/ActionExecutorContext.tsx +34 -1
  2. package/actionsExecutor/consts.ts +4 -0
  3. package/appUtils/HooksManager/Hook.ts +4 -0
  4. package/appUtils/HooksManager/index.ts +2 -0
  5. package/appUtils/__tests__/__snapshots__/localizationsHelper.test.ts.snap +151 -0
  6. package/appUtils/__tests__/allZappLocales.ts +79 -0
  7. package/appUtils/__tests__/{localizationsHelper.test.js → localizationsHelper.test.ts} +11 -0
  8. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +2 -0
  9. package/appUtils/focusManager/index.ios.ts +14 -4
  10. package/appUtils/focusManager/index.ts +13 -0
  11. package/appUtils/focusManager/utils/__tests__/findChild.test.ts +35 -0
  12. package/appUtils/focusManager/utils/index.ts +5 -0
  13. package/appUtils/localizationsHelper.ts +31 -0
  14. package/appUtils/playerManager/usePlayerTitleSummaryOverlay.tsx +7 -1
  15. package/componentsUtils/__tests__/isFirstComponentGallery.test.ts +33 -0
  16. package/componentsUtils/__tests__/isFirstComponentScreenPicker.test.ts +33 -0
  17. package/componentsUtils/__tests__/isGallery.test.ts +33 -0
  18. package/componentsUtils/__tests__/isScreenPicker.test.ts +33 -0
  19. package/componentsUtils/index.ts +32 -0
  20. package/dateUtils/index.ts +19 -0
  21. package/focusManager/FocusManager.ts +3 -1
  22. package/focusManager/index.ts +4 -30
  23. package/functionUtils/index.ts +25 -0
  24. package/index.d.ts +0 -12
  25. package/localizationUtils/index.ts +5 -10
  26. package/manifestUtils/defaultManifestConfigurations/generalContent.js +13 -0
  27. package/manifestUtils/defaultManifestConfigurations/player.js +6 -0
  28. package/manifestUtils/keys.js +27 -2
  29. package/modalState/__tests__/index.test.ts +51 -0
  30. package/modalState/index.ts +32 -2
  31. package/navigationUtils/__tests__/__snapshots__/navigationUtils.test.js.snap +1 -0
  32. package/navigationUtils/index.ts +3 -1
  33. package/numberUtils/__tests__/toPositiveNumberWithDefault.test.ts +23 -3
  34. package/numberUtils/index.ts +4 -0
  35. package/package.json +2 -2
  36. package/playerUtils/configurationGenerator.ts +6 -0
  37. package/reactHooks/advertising/index.ts +5 -5
  38. package/reactHooks/feed/useFeedLoader.tsx +13 -6
  39. package/reactHooks/navigation/useRoute.ts +2 -2
  40. package/reactHooks/useListenEventBusEvent.ts +1 -1
  41. package/utils/README.md +30 -0
  42. package/utils/chunk.ts +5 -0
  43. package/utils/index.ts +5 -0
  44. package/utils/times.ts +5 -0
  45. package/zappFrameworkUtils/localStorageHelper.ts +6 -0
  46. package/zappFrameworkUtils/types.ts +11 -0
@@ -0,0 +1,30 @@
1
+ ### ramda replacement utils
2
+
3
+ See contribution guide below
4
+
5
+ ## Reference
6
+
7
+ Prefer non-fp variant as it more performant - if refactoring assumes you need more efforts rewrite ramda sample to lodash and it can be easily replaced with lodash-fp - use lodash-fp.
8
+
9
+ ### Ramda alternatives:
10
+
11
+ Custom
12
+ - `splitEvery` => `chunk`
13
+ - `times` => `times`
14
+
15
+ From `lodash`
16
+ - `clone` => `clone`
17
+ - `flatten` => `flatten`
18
+ - `drop` => `drop`
19
+ - `length` => `size`
20
+
21
+
22
+ ## Contribution
23
+
24
+ To add new helper function as ramda replacement
25
+
26
+ 1. Search for replacement ( you can use lodash or pure JS solution), arguments should match with Ramda definition (for easier transition).
27
+ 2. Add new file if needed, add test, update exports in index file. 2.1. Make sure it's well-typed.
28
+ 3. If the function can-be reexported from other 3rd party lib - update index.ts to re-export it.
29
+ 4. Make sure README is updated and contains reference for newly added function.
30
+ 5. You can use AI's help. Use query like 'lodash & lodash/fp equivalent of Ramda's R.clone function' to get an options you can use.
package/utils/chunk.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { chunk as _chunk } from "lodash";
2
+
3
+ export const chunk = <T>(size: number, array: T[]): T[][] => {
4
+ return _chunk(array, size);
5
+ };
package/utils/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export { chunk } from "./chunk";
2
+
3
+ export { times } from "./times";
4
+
5
+ export { cloneDeep as clone, flatten, drop, size } from "lodash";
package/utils/times.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { times as _times } from "lodash";
2
+
3
+ export const times = <T>(iteratee: (index: number) => T, n: number) => {
4
+ return _times(n, iteratee);
5
+ };
@@ -1,6 +1,12 @@
1
1
  import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
2
2
  import { isNilOrEmpty } from "../reactUtils/helpers";
3
3
  import { parseJsonIfNeeded } from "@applicaster/zapp-react-native-utils/functionUtils";
4
+ import {
5
+ StorageOwnedValues,
6
+ NamespaceValues,
7
+ StorageValuesToRemove,
8
+ StorageValuesToAdd,
9
+ } from "./types";
4
10
 
5
11
  const defaultOwnedKey = "owned_keys";
6
12
  const DEFAULT_NAMESPACE = "applicaster.v2";
@@ -0,0 +1,11 @@
1
+ export type StorageValuesToAdd = Record<string, NamespaceValues>;
2
+
3
+ export type StorageValuesToRemove = {
4
+ string?: string[];
5
+ };
6
+
7
+ export type StorageOwnedValues = {
8
+ string?: string[];
9
+ };
10
+
11
+ export type NamespaceValues = Record<string, string>;