@applicaster/zapp-react-native-utils 16.0.0-alpha.5222020837 → 16.0.0-alpha.5305005033

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 (141) hide show
  1. package/actionsExecutor/ActionExecutor.ts +8 -10
  2. package/actionsExecutor/ActionExecutorContext.tsx +47 -326
  3. package/actionsExecutor/actions/__tests__/dismissBottomSheet.test.ts +22 -0
  4. package/actionsExecutor/actions/__tests__/loadItemsFromSource.test.ts +88 -0
  5. package/actionsExecutor/actions/__tests__/openBottomSheet.customContent.test.ts +76 -0
  6. package/actionsExecutor/actions/__tests__/showToast.test.ts +63 -0
  7. package/actionsExecutor/actions/appRestart.ts +24 -0
  8. package/actionsExecutor/actions/confirmDialog.ts +53 -0
  9. package/actionsExecutor/actions/dismissBottomSheet.ts +22 -0
  10. package/actionsExecutor/actions/index.ts +34 -0
  11. package/actionsExecutor/actions/localStorageRemove.ts +27 -0
  12. package/actionsExecutor/actions/localStorageSet.ts +28 -0
  13. package/actionsExecutor/actions/localStorageToggleFlag.ts +28 -0
  14. package/actionsExecutor/actions/navigateToScreen.ts +123 -0
  15. package/actionsExecutor/actions/openBottomSheet.ts +318 -0
  16. package/actionsExecutor/actions/refreshComponent.ts +85 -0
  17. package/actionsExecutor/actions/screenSetVariable.ts +35 -0
  18. package/actionsExecutor/actions/screenToggleFlag.ts +38 -0
  19. package/actionsExecutor/actions/sendCloudEvent.ts +96 -0
  20. package/actionsExecutor/actions/sessionStorageRemove.ts +19 -0
  21. package/actionsExecutor/actions/sessionStorageSet.ts +20 -0
  22. package/actionsExecutor/actions/sessionStorageToggleFlag.ts +15 -0
  23. package/actionsExecutor/actions/showToast.ts +31 -0
  24. package/actionsExecutor/actions/switchLayout.ts +40 -0
  25. package/actionsExecutor/types.ts +59 -0
  26. package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +2 -2
  27. package/analyticsUtils/PlayerAnalyticsManager.ts +12 -2
  28. package/analyticsUtils/__tests__/analyticsMapper.test.ts +35 -0
  29. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testACP_events.json +1 -1
  30. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testBlockUnlistedParams_rules.json +1 -1
  31. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_events.json +4 -0
  32. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_rules.json +6 -0
  33. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEventRegex_events.json +3 -9
  34. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_events.json +18 -0
  35. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_rules.json +16 -0
  36. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_events.json +4 -0
  37. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_rules.json +6 -0
  38. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_events.json +4 -0
  39. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_rules.json +6 -0
  40. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_events.json +4 -0
  41. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_rules.json +6 -0
  42. package/analyticsUtils/__tests__/fixtures/index.js +20 -0
  43. package/analyticsUtils/analyticsMapper.ts +4 -1
  44. package/analyticsUtils/playerAnalyticsTracker.ts +26 -3
  45. package/appUtils/HooksManager/index.ts +3 -8
  46. package/appUtils/contextKeysManager/__tests__/getKey/failure.test.ts +1 -1
  47. package/appUtils/contextKeysManager/__tests__/removeKey/failure.test.ts +1 -1
  48. package/appUtils/contextKeysManager/__tests__/setKey/failure/invalidKey.test.ts +4 -4
  49. package/appUtils/contextKeysManager/index.ts +1 -1
  50. package/appUtils/contextKeysManager/utils/index.ts +38 -25
  51. package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +12 -6
  52. package/appUtils/playerManager/__tests__/playerFactory.test.ts +150 -0
  53. package/appUtils/playerManager/{conts.ts → const.ts} +20 -0
  54. package/appUtils/playerManager/index.ts +1 -1
  55. package/appUtils/playerManager/player.ts +1 -1
  56. package/appUtils/playerManager/playerFactory.ts +18 -35
  57. package/appUtils/playerManager/playerNative.ts +1 -1
  58. package/appUtils/playerManager/usePlayerControllerSetup.tsx +1 -1
  59. package/appUtils/playerManager/userLanguagePreference.ts +1 -1
  60. package/arrayUtils/__tests__/{anyThruthy.test.ts → anyTruthy.test.ts} +8 -0
  61. package/arrayUtils/__tests__/arrayUtils.test.ts +165 -108
  62. package/arrayUtils/__tests__/isEmptyArray.test.ts +11 -0
  63. package/arrayUtils/__tests__/isFilledArray.test.ts +12 -0
  64. package/arrayUtils/__tests__/isFirst.test.ts +17 -0
  65. package/arrayUtils/__tests__/isIndexInRange.test.ts +14 -0
  66. package/arrayUtils/__tests__/isLast.test.ts +31 -0
  67. package/arrayUtils/__tests__/makeListOf.test.ts +31 -0
  68. package/arrayUtils/__tests__/makeListOfIndexes.test.ts +20 -0
  69. package/arrayUtils/__tests__/sample.test.ts +61 -0
  70. package/arrayUtils/index.ts +57 -20
  71. package/bottomSheet/__tests__/scrollContext.test.tsx +35 -0
  72. package/bottomSheet/index.ts +17 -0
  73. package/cellUtils/index.ts +3 -5
  74. package/colorUtils/__tests__/isTransparentColor.test.ts +76 -0
  75. package/colorUtils/__tests__/isValidColor.test.ts +70 -0
  76. package/colorUtils/index.ts +50 -0
  77. package/manifestUtils/_internals/index.js +6 -0
  78. package/manifestUtils/defaultManifestConfigurations/generalContent.js +35 -0
  79. package/manifestUtils/defaultManifestConfigurations/player.js +19 -19
  80. package/manifestUtils/fieldUtils/__tests__/fieldUtils.test.js +84 -0
  81. package/manifestUtils/fieldUtils/index.js +125 -0
  82. package/manifestUtils/keys.js +9 -0
  83. package/manifestUtils/mobileAction/button/index.js +16 -0
  84. package/manifestUtils/mobileAction/container/index.js +3 -1
  85. package/manifestUtils/mobileAction/groups/defaults.js +3 -1
  86. package/manifestUtils/platformIsTV.js +1 -0
  87. package/modalState/ContentViewModel.ts +111 -0
  88. package/modalState/EditableCollection.ts +17 -0
  89. package/modalState/EditableCollectionRegistry.ts +51 -0
  90. package/modalState/ModalOrchestrator.ts +198 -0
  91. package/modalState/RemoteEditableCollection.ts +189 -0
  92. package/modalState/__tests__/ContentViewModel.editable.test.ts +69 -0
  93. package/modalState/__tests__/ContentViewModel.test.ts +165 -0
  94. package/modalState/__tests__/EditableCollectionRegistry.test.ts +112 -0
  95. package/modalState/__tests__/ModalOrchestrator.phase3.test.ts +28 -0
  96. package/modalState/__tests__/RemoteEditableCollection.test.ts +259 -0
  97. package/modalState/__tests__/useBottomSheetContent.test.ts +372 -0
  98. package/modalState/index.ts +30 -83
  99. package/modalState/store.ts +102 -0
  100. package/modalState/types.ts +110 -0
  101. package/modalState/useBottomSheetContent.ts +98 -0
  102. package/numberUtils/__tests__/isMinusZero.test.ts +20 -0
  103. package/numberUtils/__tests__/isZero.test.ts +27 -0
  104. package/numberUtils/__tests__/requireNumber.test.ts +50 -0
  105. package/numberUtils/__tests__/toNumber.test.ts +27 -0
  106. package/numberUtils/__tests__/toNumberWithDefault.test.ts +64 -0
  107. package/numberUtils/__tests__/toNumberWithDefaultZero.test.ts +48 -0
  108. package/numberUtils/index.ts +27 -8
  109. package/package.json +2 -2
  110. package/pipesUtils/__tests__/buildUrlWithQuery.test.ts +33 -0
  111. package/pipesUtils/__tests__/withPipesEndpoint.test.tsx +56 -0
  112. package/pipesUtils/index.ts +1 -0
  113. package/pipesUtils/withPipesEndpoint.tsx +54 -0
  114. package/playerUtils/index.ts +24 -2
  115. package/reactHooks/actions/index.ts +51 -1
  116. package/reactHooks/cell-click/index.ts +18 -10
  117. package/reactHooks/feed/__mocks__/useMarkPipesDataStale.ts +4 -0
  118. package/reactHooks/feed/__tests__/useInflatedUrl.test.tsx +25 -0
  119. package/reactHooks/feed/index.ts +5 -1
  120. package/reactHooks/feed/useBatchLoading.ts +9 -1
  121. package/reactHooks/feed/{usePipesCacheReset.ts → useMarkPipesDataStale.ts} +12 -4
  122. package/reactHooks/layout/index.ts +1 -1
  123. package/reactHooks/navigation/__mocks__/index.ts +4 -0
  124. package/reactHooks/navigation/__tests__/useIsScreenActive.test.ts +42 -0
  125. package/reactHooks/navigation/index.ts +1 -1
  126. package/reactHooks/navigation/useIsScreenActive.ts +29 -8
  127. package/reactHooks/screen/__tests__/useIsStandaloneFullscreen.test.ts +114 -0
  128. package/reactHooks/screen/index.ts +2 -0
  129. package/reactHooks/screen/useIsStandaloneFullscreen.ts +12 -0
  130. package/reactHooks/state/useComponentScreenState.ts +1 -1
  131. package/reactHooks/utils/index.ts +3 -2
  132. package/reactHooks/videoModal/hooks/useVideoModalScreenData.tsx +22 -4
  133. package/riverComponetsMeasurementProvider/index.tsx +12 -8
  134. package/stringUtils/__tests__/stringUtils.test.js +42 -0
  135. package/stringUtils/index.ts +2 -2
  136. package/uiActionsRegistrator/index.ts +203 -0
  137. package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +1 -1
  138. package/zappFrameworkUtils/__tests__/localStorageHelper.test.ts +146 -0
  139. package/zappFrameworkUtils/localStorageHelper.ts +9 -13
  140. package/reactHooks/feed/__mocks__/usePipesCacheReset.ts +0 -1
  141. /package/reactHooks/actions/__tests__/{index.test.js → index.test.tsx} +0 -0
@@ -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();