@applicaster/zapp-react-native-utils 16.0.0-alpha.6174143047 → 16.0.0-alpha.6409114856

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 (95) hide show
  1. package/actionsExecutor/ActionExecutor.ts +8 -10
  2. package/actionsExecutor/ActionExecutorContext.tsx +41 -325
  3. package/actionsExecutor/actions/appRestart.ts +24 -0
  4. package/actionsExecutor/actions/confirmDialog.ts +53 -0
  5. package/actionsExecutor/actions/index.ts +30 -0
  6. package/actionsExecutor/actions/localStorageRemove.ts +27 -0
  7. package/actionsExecutor/actions/localStorageSet.ts +28 -0
  8. package/actionsExecutor/actions/localStorageToggleFlag.ts +28 -0
  9. package/actionsExecutor/actions/navigateToScreen.ts +123 -0
  10. package/actionsExecutor/actions/refreshComponent.ts +79 -0
  11. package/actionsExecutor/actions/screenSetVariable.ts +35 -0
  12. package/actionsExecutor/actions/screenToggleFlag.ts +38 -0
  13. package/actionsExecutor/actions/sendCloudEvent.ts +88 -0
  14. package/actionsExecutor/actions/sessionStorageRemove.ts +19 -0
  15. package/actionsExecutor/actions/sessionStorageSet.ts +20 -0
  16. package/actionsExecutor/actions/sessionStorageToggleFlag.ts +15 -0
  17. package/actionsExecutor/actions/showToast.ts +31 -0
  18. package/actionsExecutor/actions/switchLayout.ts +40 -0
  19. package/actionsExecutor/types.ts +59 -0
  20. package/analyticsUtils/PlayerAnalyticsManager.ts +1 -1
  21. package/appUtils/contextKeysManager/__tests__/getKey/failure.test.ts +1 -1
  22. package/appUtils/contextKeysManager/__tests__/removeKey/failure.test.ts +1 -1
  23. package/appUtils/contextKeysManager/__tests__/setKey/failure/invalidKey.test.ts +4 -4
  24. package/appUtils/contextKeysManager/index.ts +1 -1
  25. package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +12 -6
  26. package/appUtils/playerManager/OverlayObserver/__tests__/utils.test.ts +41 -0
  27. package/appUtils/playerManager/OverlayObserver/utils.ts +3 -0
  28. package/appUtils/playerManager/__tests__/playerFactory.test.ts +1 -1
  29. package/appUtils/playerManager/{conts.ts → const.ts} +20 -0
  30. package/appUtils/playerManager/index.ts +1 -1
  31. package/appUtils/playerManager/player.ts +1 -1
  32. package/appUtils/playerManager/playerFactory.ts +1 -1
  33. package/appUtils/playerManager/playerNative.ts +1 -1
  34. package/appUtils/playerManager/usePlayerControllerSetup.tsx +1 -1
  35. package/appUtils/playerManager/userLanguagePreference.ts +1 -1
  36. package/arrayUtils/__tests__/{anyThruthy.test.ts → anyTruthy.test.ts} +8 -0
  37. package/arrayUtils/__tests__/arrayUtils.test.ts +165 -108
  38. package/arrayUtils/__tests__/isEmptyArray.test.ts +11 -0
  39. package/arrayUtils/__tests__/isFilledArray.test.ts +12 -0
  40. package/arrayUtils/__tests__/isFirst.test.ts +17 -0
  41. package/arrayUtils/__tests__/isIndexInRange.test.ts +14 -0
  42. package/arrayUtils/__tests__/isLast.test.ts +31 -0
  43. package/arrayUtils/__tests__/makeListOf.test.ts +31 -0
  44. package/arrayUtils/__tests__/makeListOfIndexes.test.ts +20 -0
  45. package/arrayUtils/__tests__/sample.test.ts +61 -0
  46. package/arrayUtils/index.ts +57 -20
  47. package/bottomSheet/__tests__/scrollContext.test.tsx +35 -0
  48. package/bottomSheet/index.ts +17 -0
  49. package/cellUtils/index.ts +3 -5
  50. package/colorUtils/__tests__/isTransparentColor.test.ts +76 -0
  51. package/colorUtils/__tests__/isValidColor.test.ts +70 -0
  52. package/colorUtils/index.ts +50 -0
  53. package/manifestUtils/__tests__/player.audioControls.test.js +158 -0
  54. package/manifestUtils/_internals/index.js +6 -0
  55. package/manifestUtils/defaultManifestConfigurations/player.js +161 -19
  56. package/manifestUtils/fieldUtils/__tests__/fieldUtils.test.js +84 -0
  57. package/manifestUtils/fieldUtils/index.js +125 -0
  58. package/manifestUtils/keys.js +9 -0
  59. package/manifestUtils/mobileAction/button/index.js +16 -0
  60. package/manifestUtils/mobileAction/container/index.js +3 -1
  61. package/manifestUtils/mobileAction/groups/defaults.js +3 -1
  62. package/manifestUtils/platformIsTV.js +1 -0
  63. package/numberUtils/__tests__/isMinusZero.test.ts +20 -0
  64. package/numberUtils/__tests__/isZero.test.ts +27 -0
  65. package/numberUtils/__tests__/requireNumber.test.ts +50 -0
  66. package/numberUtils/__tests__/toNumber.test.ts +27 -0
  67. package/numberUtils/__tests__/toNumberWithDefault.test.ts +64 -0
  68. package/numberUtils/__tests__/toNumberWithDefaultZero.test.ts +48 -0
  69. package/numberUtils/index.ts +27 -8
  70. package/package.json +2 -2
  71. package/pipesUtils/__tests__/buildUrlWithQuery.test.ts +33 -0
  72. package/pipesUtils/__tests__/withPipesEndpoint.test.tsx +56 -0
  73. package/pipesUtils/index.ts +1 -0
  74. package/pipesUtils/withPipesEndpoint.tsx +54 -0
  75. package/reactHooks/actions/index.ts +51 -1
  76. package/reactHooks/cell-click/index.ts +3 -3
  77. package/reactHooks/feed/__mocks__/useMarkPipesDataStale.ts +4 -0
  78. package/reactHooks/feed/__tests__/useInflatedUrl.test.tsx +25 -0
  79. package/reactHooks/feed/index.ts +5 -1
  80. package/reactHooks/feed/useBatchLoading.ts +9 -1
  81. package/reactHooks/feed/{usePipesCacheReset.ts → useMarkPipesDataStale.ts} +12 -4
  82. package/reactHooks/layout/index.ts +1 -1
  83. package/reactHooks/navigation/__mocks__/index.ts +4 -0
  84. package/reactHooks/navigation/__tests__/useIsScreenActive.test.ts +42 -0
  85. package/reactHooks/navigation/index.ts +1 -1
  86. package/reactHooks/navigation/useIsScreenActive.ts +29 -8
  87. package/reactHooks/state/useComponentScreenState.ts +1 -1
  88. package/reactHooks/utils/index.ts +3 -2
  89. package/riverComponetsMeasurementProvider/index.tsx +12 -8
  90. package/stringUtils/__tests__/stringUtils.test.js +42 -0
  91. package/stringUtils/index.ts +2 -2
  92. package/uiActionsRegistrator/index.ts +203 -0
  93. package/zappFrameworkUtils/__tests__/localStorageHelper.test.ts +146 -0
  94. package/zappFrameworkUtils/localStorageHelper.ts +9 -13
  95. package/reactHooks/feed/__mocks__/usePipesCacheReset.ts +0 -1
@@ -2,10 +2,10 @@ import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/
2
2
  import { isNilOrEmpty } from "../reactUtils/helpers";
3
3
  import { parseJsonIfNeeded } from "@applicaster/zapp-react-native-utils/functionUtils";
4
4
  import {
5
- StorageOwnedValues,
6
5
  NamespaceValues,
7
- StorageValuesToRemove,
6
+ StorageOwnedValues,
8
7
  StorageValuesToAdd,
8
+ StorageValuesToRemove,
9
9
  } from "./types";
10
10
  import { Storage } from "@applicaster/zapp-react-native-bridge/ZappStorage/Storage";
11
11
 
@@ -43,10 +43,10 @@ function mapOwnedKeysToAdd(
43
43
  ): StorageOwnedValues {
44
44
  const mappedData = {};
45
45
 
46
- Object.keys(storageValues).forEach((namespace: string) => {
46
+ for (const namespace of Object.keys(storageValues)) {
47
47
  const data = storageValues[namespace];
48
48
  mappedData[namespace] = Object.keys(data);
49
- });
49
+ }
50
50
 
51
51
  return mappedData;
52
52
  }
@@ -111,12 +111,12 @@ async function addOwnedKeys({
111
111
  ownershipNamespace
112
112
  );
113
113
 
114
- Object.keys(newKeys).forEach(async (namespace: string) => {
114
+ for (const namespace of Object.keys(newKeys)) {
115
115
  const newOwnedKeys: string[] = newKeys[namespace];
116
116
  const currentKeys = allStoragedOwnedKeys[namespace] || [];
117
117
  const combinedSet = new Set([...currentKeys, ...newOwnedKeys]);
118
118
  allStoragedOwnedKeys[namespace] = Array.from(combinedSet);
119
- });
119
+ }
120
120
 
121
121
  const data = JSON.stringify(allStoragedOwnedKeys);
122
122
  await localStorage.setItem(ownershipKey, data, ownershipNamespace);
@@ -136,18 +136,14 @@ async function removeOwnedKeys({
136
136
  ownershipNamespace
137
137
  );
138
138
 
139
- Object.keys(toRemoveKeys).forEach(async (namespace: string) => {
139
+ for (const namespace of Object.keys(toRemoveKeys)) {
140
140
  const keysToRemove: string[] = toRemoveKeys[namespace] || [];
141
141
  const currentKeys: string[] = currentKeysList[namespace] || [];
142
142
 
143
143
  const storageOwnedSet = new Set(currentKeys);
144
144
  const keysToRemoveSet = new Set(keysToRemove);
145
145
 
146
- function removeAll(originalSet, toBeRemovedSet) {
147
- toBeRemovedSet.forEach(Set.prototype.delete, originalSet);
148
- }
149
-
150
- removeAll(storageOwnedSet, keysToRemoveSet);
146
+ keysToRemoveSet.forEach((key) => storageOwnedSet.delete(key));
151
147
  const newLoginKeys = Array.from(storageOwnedSet);
152
148
 
153
149
  if (isNilOrEmpty(newLoginKeys)) {
@@ -155,7 +151,7 @@ async function removeOwnedKeys({
155
151
  } else {
156
152
  currentKeysList[namespace] = newLoginKeys;
157
153
  }
158
- });
154
+ }
159
155
 
160
156
  if (isNilOrEmpty(currentKeysList)) {
161
157
  await localStorage.removeItem(ownershipKey, ownershipNamespace);
@@ -1 +0,0 @@
1
- export const usePipesCacheReset = jest.fn();