@applicaster/zapp-react-native-utils 15.0.0-rc.14 → 15.0.0-rc.141

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 (178) hide show
  1. package/README.md +0 -6
  2. package/actionUtils/index.ts +7 -0
  3. package/actionsExecutor/ActionExecutorContext.tsx +86 -12
  4. package/actionsExecutor/feedDecorator.ts +6 -6
  5. package/adsUtils/__tests__/createVMAP.test.ts +419 -0
  6. package/adsUtils/index.ts +2 -2
  7. package/analyticsUtils/README.md +1 -1
  8. package/analyticsUtils/analyticsMapper.ts +10 -2
  9. package/appDataUtils/__tests__/urlScheme.test.ts +678 -0
  10. package/appUtils/HooksManager/__tests__/__snapshots__/hooksManager.test.js.snap +0 -188
  11. package/appUtils/HooksManager/__tests__/hooksManager.test.js +16 -2
  12. package/appUtils/HooksManager/index.ts +45 -10
  13. package/appUtils/RiverFocusManager/{index.js → index.ts} +25 -18
  14. package/appUtils/accessibilityManager/__tests__/utils.test.ts +360 -0
  15. package/appUtils/accessibilityManager/const.ts +4 -0
  16. package/appUtils/accessibilityManager/hooks.ts +20 -13
  17. package/appUtils/accessibilityManager/index.ts +28 -1
  18. package/appUtils/accessibilityManager/utils.ts +59 -8
  19. package/appUtils/contextKeysManager/__tests__/getKeys/failure.test.ts +7 -2
  20. package/appUtils/contextKeysManager/__tests__/getKeys/success.test.ts +48 -0
  21. package/appUtils/contextKeysManager/contextResolver.ts +51 -22
  22. package/appUtils/contextKeysManager/index.ts +65 -10
  23. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +3 -0
  24. package/appUtils/focusManager/index.ios.ts +43 -4
  25. package/appUtils/focusManager/treeDataStructure/Tree/__tests__/Tree.test.js +46 -0
  26. package/appUtils/focusManager/treeDataStructure/Tree/index.js +18 -18
  27. package/appUtils/focusManagerAux/utils/index.ios.ts +122 -0
  28. package/appUtils/focusManagerAux/utils/index.ts +13 -7
  29. package/appUtils/focusManagerAux/utils/utils.ios.ts +202 -3
  30. package/appUtils/keyCodes/keys/keys.web.ts +1 -4
  31. package/appUtils/localizationsHelper.ts +4 -0
  32. package/appUtils/orientationHelper.ts +2 -4
  33. package/appUtils/platform/platformUtils.ts +117 -18
  34. package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +94 -4
  35. package/appUtils/playerManager/OverlayObserver/utils.ts +32 -20
  36. package/appUtils/playerManager/index.ts +9 -0
  37. package/appUtils/playerManager/player.ts +5 -1
  38. package/appUtils/playerManager/playerNative.ts +31 -17
  39. package/appUtils/playerManager/usePlayer.tsx +5 -3
  40. package/appUtils/playerManager/usePlayerState.tsx +14 -2
  41. package/arrayUtils/__tests__/allTruthy.test.ts +24 -0
  42. package/arrayUtils/__tests__/anyThruthy.test.ts +24 -0
  43. package/arrayUtils/index.ts +5 -0
  44. package/cellUtils/__tests__/cellUtils.test.ts +39 -0
  45. package/cellUtils/index.ts +43 -1
  46. package/cloudEventsUtils/__tests__/index.test.ts +529 -0
  47. package/cloudEventsUtils/index.ts +65 -1
  48. package/componentsUtils/index.ts +8 -0
  49. package/configurationUtils/__tests__/imageSrcFromMediaItem.test.ts +38 -0
  50. package/configurationUtils/__tests__/manifestKeyParser.test.ts +26 -26
  51. package/configurationUtils/index.ts +17 -11
  52. package/dateUtils/__tests__/dayjs.test.ts +327 -0
  53. package/dateUtils/index.ts +2 -0
  54. package/enumUtils/__tests__/getEnumKeyByEnumValue.test.ts +207 -0
  55. package/errorUtils/__tests__/GeneralError.test.ts +97 -0
  56. package/errorUtils/__tests__/HttpStatusCode.test.ts +344 -0
  57. package/errorUtils/__tests__/MissingPluginError.test.ts +113 -0
  58. package/errorUtils/__tests__/NetworkError.test.ts +202 -0
  59. package/errorUtils/__tests__/getParsedResponse.test.ts +188 -0
  60. package/errorUtils/__tests__/invariant.test.ts +112 -0
  61. package/focusManager/aux/index.ts +1 -1
  62. package/headersUtils/__tests__/headersUtils.test.js +11 -1
  63. package/headersUtils/index.ts +2 -1
  64. package/manifestUtils/_internals/__tests__/index.test.js +41 -0
  65. package/manifestUtils/_internals/index.js +33 -0
  66. package/manifestUtils/defaultManifestConfigurations/player.js +115 -11
  67. package/manifestUtils/fieldUtils/__tests__/fieldUtils.test.js +49 -0
  68. package/manifestUtils/fieldUtils/index.js +54 -0
  69. package/manifestUtils/index.js +2 -0
  70. package/manifestUtils/keys.js +249 -0
  71. package/manifestUtils/mobileAction/button/__tests__/mobileActionButton.test.js +168 -0
  72. package/manifestUtils/mobileAction/button/index.js +140 -0
  73. package/manifestUtils/mobileAction/container/__tests__/mobileActionButtonsContainer.test.js +102 -0
  74. package/manifestUtils/mobileAction/container/index.js +73 -0
  75. package/manifestUtils/mobileAction/groups/__tests__/buildMobileActionButtonGroups.test.js +127 -0
  76. package/manifestUtils/mobileAction/groups/defaults.js +76 -0
  77. package/manifestUtils/mobileAction/groups/index.js +80 -0
  78. package/manifestUtils/platformIsTV.js +13 -0
  79. package/manifestUtils/sharedConfiguration/screenPicker/utils.js +1 -0
  80. package/manifestUtils/tvAction/container/index.js +1 -1
  81. package/navigationUtils/index.ts +15 -5
  82. package/numberUtils/__tests__/toNumber.test.ts +27 -0
  83. package/numberUtils/__tests__/toPositiveNumber.test.ts +193 -0
  84. package/numberUtils/index.ts +23 -1
  85. package/package.json +4 -4
  86. package/playerUtils/usePlayerTTS.ts +8 -3
  87. package/pluginUtils/index.ts +4 -0
  88. package/reactHooks/advertising/index.ts +2 -2
  89. package/reactHooks/analytics/__tests__/useSendAnalyticsOnPress.test.ts +537 -0
  90. package/reactHooks/app/__tests__/useAppState.test.ts +1 -1
  91. package/reactHooks/autoscrolling/__tests__/useTrackCurrentAutoScrollingElement.test.ts +1 -1
  92. package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +1 -2
  93. package/reactHooks/cell-click/__tests__/index.test.js +1 -3
  94. package/reactHooks/cell-click/index.ts +2 -1
  95. package/reactHooks/configuration/__tests__/index.test.tsx +1 -1
  96. package/reactHooks/connection/__tests__/index.test.js +1 -1
  97. package/reactHooks/debugging/__tests__/index.test.js +4 -4
  98. package/reactHooks/dev/__tests__/useReRenderLog.test.ts +188 -0
  99. package/reactHooks/device/useIsTablet.tsx +14 -19
  100. package/reactHooks/device/useMemoizedIsTablet.ts +3 -3
  101. package/reactHooks/events/index.ts +20 -0
  102. package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +32 -23
  103. package/reactHooks/feed/__tests__/useBuildPipesUrl.test.tsx +19 -19
  104. package/reactHooks/feed/__tests__/useEntryScreenId.test.tsx +4 -1
  105. package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +42 -30
  106. package/reactHooks/feed/__tests__/{useInflatedUrl.test.ts → useInflatedUrl.test.tsx} +62 -7
  107. package/reactHooks/feed/index.ts +0 -2
  108. package/reactHooks/feed/useBatchLoading.ts +7 -1
  109. package/reactHooks/feed/useEntryScreenId.ts +2 -2
  110. package/reactHooks/feed/useInflatedUrl.ts +44 -18
  111. package/reactHooks/feed/usePipesCacheReset.ts +3 -1
  112. package/reactHooks/flatList/useLoadNextPageIfNeeded.ts +13 -16
  113. package/reactHooks/hookModal/hooks/useHookModalScreenData.ts +12 -8
  114. package/reactHooks/index.ts +2 -0
  115. package/reactHooks/layout/__tests__/index.test.tsx +1 -1
  116. package/reactHooks/layout/__tests__/useLayoutVersion.test.tsx +1 -1
  117. package/reactHooks/layout/index.ts +1 -1
  118. package/reactHooks/layout/useDimensions/__tests__/{useDimensions.test.ts → useDimensions.test.tsx} +105 -25
  119. package/reactHooks/layout/useDimensions/useDimensions.ts +2 -2
  120. package/reactHooks/navigation/__tests__/index.test.tsx +40 -9
  121. package/reactHooks/navigation/index.ts +27 -11
  122. package/reactHooks/navigation/useRoute.ts +11 -7
  123. package/reactHooks/player/TVSeekControlller/TVSeekController.ts +27 -10
  124. package/reactHooks/player/__tests__/useAutoSeek._test.tsx +1 -1
  125. package/reactHooks/player/__tests__/useTapSeek._test.ts +1 -1
  126. package/reactHooks/resolvers/__tests__/useCellResolver.test.tsx +1 -1
  127. package/reactHooks/resolvers/__tests__/useComponentResolver.test.tsx +1 -1
  128. package/reactHooks/resolvers/useCellResolver.ts +6 -2
  129. package/reactHooks/resolvers/useComponentResolver.ts +19 -3
  130. package/reactHooks/screen/__tests__/useCurrentScreenData.test.tsx +2 -2
  131. package/reactHooks/screen/__tests__/useScreenBackgroundColor.test.tsx +1 -1
  132. package/reactHooks/screen/__tests__/useScreenData.test.tsx +1 -1
  133. package/reactHooks/screen/__tests__/useTargetScreenData.test.tsx +12 -4
  134. package/reactHooks/screen/useTargetScreenData.ts +4 -2
  135. package/reactHooks/state/__tests__/useComponentScreenState.test.ts +246 -0
  136. package/reactHooks/state/index.ts +2 -0
  137. package/reactHooks/state/useComponentScreenState.ts +45 -0
  138. package/reactHooks/state/useRefWithInitialValue.ts +10 -0
  139. package/reactHooks/state/useRivers.ts +1 -1
  140. package/reactHooks/ui/__tests__/useFadeOutWhenBlurred.test.ts +580 -0
  141. package/reactHooks/usePluginConfiguration.ts +2 -2
  142. package/reactHooks/utils/__tests__/index.test.js +1 -1
  143. package/rectUtils/__tests__/index.test.ts +549 -0
  144. package/rectUtils/index.ts +2 -2
  145. package/refreshUtils/RefreshCoordinator/__tests__/refreshCoordinator.test.ts +206 -0
  146. package/refreshUtils/RefreshCoordinator/index.ts +245 -0
  147. package/refreshUtils/RefreshCoordinator/utils/__tests__/getDataRefreshConfig.test.ts +104 -0
  148. package/refreshUtils/RefreshCoordinator/utils/index.ts +29 -0
  149. package/screenPickerUtils/__tests__/index.test.ts +333 -0
  150. package/screenPickerUtils/index.ts +5 -0
  151. package/screenState/__tests__/index.test.ts +1 -1
  152. package/screenUtils/index.ts +3 -0
  153. package/searchUtils/const.ts +7 -0
  154. package/searchUtils/index.ts +3 -0
  155. package/services/storageServiceSync.web.ts +1 -1
  156. package/stringUtils/index.ts +1 -1
  157. package/testUtils/index.tsx +30 -21
  158. package/time/__tests__/BackgroundTimer.test.ts +156 -0
  159. package/time/__tests__/Timer.test.ts +236 -0
  160. package/typeGuards/__tests__/isString.test.ts +21 -0
  161. package/typeGuards/index.ts +4 -0
  162. package/utils/__tests__/clone.test.ts +158 -0
  163. package/utils/__tests__/mapAccum.test.ts +73 -0
  164. package/utils/__tests__/mergeRight.test.ts +48 -0
  165. package/utils/__tests__/path.test.ts +7 -0
  166. package/utils/__tests__/selectors.test.ts +124 -0
  167. package/utils/clone.ts +7 -0
  168. package/utils/index.ts +21 -1
  169. package/utils/mapAccum.ts +23 -0
  170. package/utils/mergeRight.ts +5 -0
  171. package/utils/path.ts +6 -3
  172. package/utils/pathOr.ts +5 -1
  173. package/utils/selectors.ts +46 -0
  174. package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +49 -12
  175. package/zappFrameworkUtils/HookCallback/hookCallbackManifestExtensions.config.js +1 -1
  176. package/reactHooks/componentsMap/index.ts +0 -55
  177. package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +0 -75
  178. package/reactHooks/feed/useFeedRefresh.tsx +0 -65
@@ -1,193 +1,5 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`HooksManager when target route is playable executes the player hook 1`] = `
4
- [
5
- {
6
- "callback": [Function],
7
- "hookPlugin": Hook {
8
- "configuration": {
9
- "config_field": "bar",
10
- },
11
- "identifier": "headless_player_hook",
12
- "lastHook": true,
13
- "manager": {
14
- "executeHook": [Function],
15
- "handleHooks": [Function],
16
- "presentScreenHook": [Function],
17
- "runInBackground": [Function],
18
- "subscriber": {
19
- "handlers": {
20
- "complete": [
21
- [MockFunction] {
22
- "calls": [
23
- [
24
- {
25
- "callback": [Function],
26
- "hookPlugin": [Circular],
27
- "payload": {
28
- "foo": "bar",
29
- },
30
- },
31
- [Function],
32
- ],
33
- ],
34
- "results": [
35
- {
36
- "type": "return",
37
- "value": undefined,
38
- },
39
- ],
40
- },
41
- ],
42
- "presentScreenHook": [
43
- [MockFunction],
44
- ],
45
- "success": [
46
- [MockFunction] {
47
- "calls": [
48
- [Circular],
49
- ],
50
- "results": [
51
- {
52
- "type": "return",
53
- "value": undefined,
54
- },
55
- ],
56
- },
57
- ],
58
- },
59
- "invokeHandler": [Function],
60
- "on": [Function],
61
- "removeHandler": [Function],
62
- },
63
- },
64
- "module": {
65
- "hasPlayerHook": true,
66
- "run": [MockFunction] {
67
- "calls": [
68
- [
69
- {
70
- "foo": "bar",
71
- },
72
- [Function],
73
- {
74
- "config_field": "bar",
75
- },
76
- ],
77
- ],
78
- "results": [
79
- {
80
- "type": "return",
81
- "value": undefined,
82
- },
83
- ],
84
- },
85
- },
86
- "state": 7,
87
- "weight": 1,
88
- },
89
- "payload": {
90
- "foo": "bar",
91
- },
92
- },
93
- [Function],
94
- ]
95
- `;
96
-
97
- exports[`HooksManager when target route is playable executes the player hook 2`] = `
98
- [
99
- {
100
- "callback": [Function],
101
- "hookPlugin": Hook {
102
- "configuration": {
103
- "config_field": "bar",
104
- },
105
- "identifier": "headless_player_hook",
106
- "lastHook": true,
107
- "manager": {
108
- "executeHook": [Function],
109
- "handleHooks": [Function],
110
- "presentScreenHook": [Function],
111
- "runInBackground": [Function],
112
- "subscriber": {
113
- "handlers": {
114
- "complete": [
115
- [MockFunction] {
116
- "calls": [
117
- [Circular],
118
- ],
119
- "results": [
120
- {
121
- "type": "return",
122
- "value": undefined,
123
- },
124
- ],
125
- },
126
- ],
127
- "presentScreenHook": [
128
- [MockFunction],
129
- ],
130
- "success": [
131
- [MockFunction] {
132
- "calls": [
133
- [
134
- {
135
- "callback": [Function],
136
- "hookPlugin": [Circular],
137
- "payload": {
138
- "foo": "bar",
139
- },
140
- },
141
- [Function],
142
- ],
143
- ],
144
- "results": [
145
- {
146
- "type": "return",
147
- "value": undefined,
148
- },
149
- ],
150
- },
151
- ],
152
- },
153
- "invokeHandler": [Function],
154
- "on": [Function],
155
- "removeHandler": [Function],
156
- },
157
- },
158
- "module": {
159
- "hasPlayerHook": true,
160
- "run": [MockFunction] {
161
- "calls": [
162
- [
163
- {
164
- "foo": "bar",
165
- },
166
- [Function],
167
- {
168
- "config_field": "bar",
169
- },
170
- ],
171
- ],
172
- "results": [
173
- {
174
- "type": "return",
175
- "value": undefined,
176
- },
177
- ],
178
- },
179
- },
180
- "state": 7,
181
- "weight": 1,
182
- },
183
- "payload": {
184
- "foo": "bar",
185
- },
186
- },
187
- [Function],
188
- ]
189
- `;
190
-
191
3
  exports[`HooksManager when there are preload hooks hook with screen: executes 1`] = `
192
4
  [
193
5
  {
@@ -116,9 +116,23 @@ describe("HooksManager", () => {
116
116
  headlessPlayerHook.configuration
117
117
  );
118
118
 
119
- expect(successHandler.mock.calls[0]).toMatchSnapshot();
119
+ expect(successHandler).toHaveBeenCalledTimes(1);
120
+ expect(successHandler.mock.calls[0][0].payload).toEqual(payload);
120
121
 
121
- expect(completeHandler.mock.calls[0]).toMatchSnapshot();
122
+ expect(successHandler.mock.calls[0][0].hookPlugin.identifier).toBe(
123
+ "headless_player_hook"
124
+ );
125
+
126
+ expect(typeof successHandler.mock.calls[0][1]).toBe("function");
127
+
128
+ expect(completeHandler).toHaveBeenCalledTimes(1);
129
+ expect(completeHandler.mock.calls[0][0].payload).toEqual(payload);
130
+
131
+ expect(completeHandler.mock.calls[0][0].hookPlugin.identifier).toBe(
132
+ "headless_player_hook"
133
+ );
134
+
135
+ expect(typeof completeHandler.mock.calls[0][1]).toBe("function");
122
136
  });
123
137
  });
124
138
 
@@ -11,6 +11,10 @@ import { HOOKS_EVENTS, HOOKS_TYPE } from "./constants";
11
11
 
12
12
  import { hooksManagerLogger } from "./logger";
13
13
  import { HookManager, HookManagerArgs } from "./types";
14
+ import {
15
+ actionExecutor,
16
+ ActionResult,
17
+ } from "../../actionsExecutor/ActionExecutor";
14
18
 
15
19
  /**
16
20
  * orders the hooks according to their weight
@@ -230,7 +234,7 @@ export function HooksManager({
230
234
  function completeHook(hookPlugin, payload, callback) {
231
235
  logHookEvent(
232
236
  hooksManagerLogger.info,
233
- `completeHook: hook sequence completed successfully: ${hookPlugin["identifier"]}`,
237
+ `completeHook: hook sequence completed successfully: ${hookPlugin.identifier}`,
234
238
  {
235
239
  payload,
236
240
  hook: hookPlugin,
@@ -276,10 +280,12 @@ export function HooksManager({
276
280
  if (hookPlugin.isCancelled()) {
277
281
  logHookEvent(
278
282
  hooksManagerLogger.info,
279
- `hookCallback: hook was cancelled: ${hookPlugin["identifier"]}`,
283
+ `hookCallback: hook was cancelled: ${hookPlugin.identifier}`,
280
284
  {}
281
285
  );
282
286
 
287
+ actionExecutor.unregisterAction("finishHook");
288
+
283
289
  return;
284
290
  }
285
291
 
@@ -294,6 +300,8 @@ export function HooksManager({
294
300
  }
295
301
  );
296
302
 
303
+ actionExecutor.unregisterAction("finishHook");
304
+
297
305
  return hookPlugin.setStateAndNotify(HOOKS_EVENTS.ERROR, {
298
306
  error,
299
307
  hookPlugin,
@@ -305,7 +313,7 @@ export function HooksManager({
305
313
  if (!success) {
306
314
  logHookEvent(
307
315
  hooksManagerLogger.info,
308
- `hookCallback: hook was cancelled: ${hookPlugin["identifier"]}`,
316
+ `hookCallback: hook was cancelled: ${hookPlugin.identifier}`,
309
317
  {
310
318
  payload,
311
319
  hook: hookPlugin,
@@ -316,6 +324,8 @@ export function HooksManager({
316
324
  // TODO: Temporary hack to pass getLoginProtocol to other plugins to refresh in case token expired, need be deleted later
317
325
  delete payload.getLoginProtocol;
318
326
 
327
+ actionExecutor.unregisterAction("finishHook");
328
+
319
329
  hookPlugin.setStateAndNotify(HOOKS_EVENTS.CANCEL, {
320
330
  hookPlugin,
321
331
  payload,
@@ -334,7 +344,7 @@ export function HooksManager({
334
344
  if (isHookInHomescreen && isHookFlowBlocker && cancelled) {
335
345
  logHookEvent(
336
346
  hooksManagerLogger.info,
337
- `hookCallback: send app to background, cancelled flow blocker hook ${hookPlugin["identifier"]} on home screen`,
347
+ `hookCallback: send app to background, cancelled flow blocker hook ${hookPlugin.identifier} on home screen`,
338
348
  {
339
349
  payload,
340
350
  hook: hookPlugin,
@@ -349,7 +359,7 @@ export function HooksManager({
349
359
  } else {
350
360
  logHookEvent(
351
361
  hooksManagerLogger.info,
352
- `hookCallback: hook successfully finished: ${hookPlugin["identifier"]}`,
362
+ `hookCallback: hook successfully finished: ${hookPlugin.identifier}`,
353
363
  {
354
364
  payload,
355
365
  hook: hookPlugin,
@@ -359,7 +369,7 @@ export function HooksManager({
359
369
  if (!callback) {
360
370
  logHookEvent(
361
371
  hooksManagerLogger.warn,
362
- `hookCallback: ${hookPlugin["identifier"]} is missing \`callback\`, using hookCallback(default one)`,
372
+ `hookCallback: ${hookPlugin.identifier} is missing \`callback\`, using hookCallback(default one)`,
363
373
  {
364
374
  hookPlugin,
365
375
  }
@@ -381,6 +391,27 @@ export function HooksManager({
381
391
  };
382
392
  }
383
393
 
394
+ function registerFinishHookAction(payload, callback) {
395
+ // Ensure no stale finishHook remains (e.g. presentUI re-entry from runInBackground)
396
+ actionExecutor.unregisterAction("finishHook");
397
+
398
+ actionExecutor.registerAction("finishHook", async (action: ActionType) => {
399
+ const { success, errorMessage, abort } = action.options;
400
+
401
+ actionExecutor.unregisterAction("finishHook");
402
+
403
+ if (errorMessage) {
404
+ callback({ success, error: new Error(errorMessage), payload, abort });
405
+ } else {
406
+ callback({ success, error: null, payload, abort });
407
+ }
408
+
409
+ hooksManagerLogger.info("finishHook action executed, finishing flow");
410
+
411
+ return ActionResult.Success;
412
+ });
413
+ }
414
+
384
415
  /**
385
416
  * presents a screen hook by triggering an event invoking the handler with
386
417
  * the appropriate route & payload
@@ -401,13 +432,15 @@ export function HooksManager({
401
432
 
402
433
  logHookEvent(
403
434
  hooksManagerLogger.info,
404
- `presentScreenHook: Presenting screen hook: ${hookPlugin["identifier"]}`,
435
+ `presentScreenHook: Presenting screen hook: ${hookPlugin.identifier}`,
405
436
  {
406
437
  hook: hookPlugin,
407
438
  payload,
408
439
  }
409
440
  );
410
441
 
442
+ registerFinishHookAction(payload, callback);
443
+
411
444
  hookPlugin.setStateAndNotify(HOOKS_EVENTS.PRESENT_SCREEN_HOOK, {
412
445
  hookPlugin,
413
446
  route: targetScreenRoute,
@@ -421,7 +454,7 @@ export function HooksManager({
421
454
  hooksManager.executeHook = function (hookPlugin, payload, callback) {
422
455
  logHookEvent(
423
456
  hooksManagerLogger.info,
424
- `executeHook: ${hookPlugin["identifier"]}`,
457
+ `executeHook: ${hookPlugin.identifier}`,
425
458
  {
426
459
  hook: hookPlugin,
427
460
  payload,
@@ -433,7 +466,7 @@ export function HooksManager({
433
466
  } catch (error) {
434
467
  logHookEvent(
435
468
  hooksManagerLogger.error,
436
- `executeHook: error executing hook: ${hookPlugin["identifier"]} error: ${error.message}`,
469
+ `executeHook: error executing hook: ${hookPlugin.identifier} error: ${error.message}`,
437
470
  {
438
471
  hook: hookPlugin,
439
472
  payload,
@@ -460,13 +493,15 @@ export function HooksManager({
460
493
  try {
461
494
  logHookEvent(
462
495
  hooksManagerLogger.info,
463
- `runInBackground: Executing hook: ${hookPlugin["identifier"]}`,
496
+ `runInBackground: Executing hook: ${hookPlugin.identifier}`,
464
497
  {
465
498
  hook: hookPlugin,
466
499
  payload,
467
500
  }
468
501
  );
469
502
 
503
+ registerFinishHookAction(payload, callback);
504
+
470
505
  hookPlugin.module.runInBackground(
471
506
  payload,
472
507
  callback,
@@ -1,11 +1,31 @@
1
- import * as R from "ramda";
2
-
3
- import { focusManager } from "../focusManager";
1
+ import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager/index.ios";
2
+ import { QUICK_BRICK_CONTENT } from "@applicaster/quick-brick-core/const";
3
+ import { isNil, isEmpty } from "@applicaster/zapp-react-native-utils/utils";
4
+ import { isNotNil } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
4
5
 
5
6
  let riverFocusData = {};
6
7
  let initialyPresentedScreenFocused = false;
7
8
 
8
9
  export const riverFocusManager = (function () {
10
+ /**
11
+ * Create unique key that will be used for save focused group data inside specific screen
12
+ * @param {{ screenId: string, isInsideContainer: boolean }}
13
+ * screenId Unique Id of the screen from layout.json
14
+ * isInsideContainer If this screen a screen picker child
15
+ *
16
+ */
17
+ function screenFocusableGroupId({
18
+ screenId,
19
+ isInsideContainer,
20
+ }: {
21
+ screenId: string;
22
+ isInsideContainer: Option<boolean>;
23
+ }) {
24
+ return `${QUICK_BRICK_CONTENT}-${screenId}${
25
+ isNil(isInsideContainer) ? "" : "-isInsideContainer"
26
+ }`;
27
+ }
28
+
9
29
  function setScreenFocusableData({
10
30
  screenFocusableGroupId,
11
31
  groupId,
@@ -78,8 +98,8 @@ export const riverFocusManager = (function () {
78
98
  }) {
79
99
  // Check if screen should be focused
80
100
  const shouldFocus =
81
- (initialyPresentedScreenFocused === false && R.isEmpty(riverFocusData)) ||
82
- R.compose(R.not, R.isNil)(riverFocusData[screenFocusableGroupId]) ||
101
+ (initialyPresentedScreenFocused === false && isEmpty(riverFocusData)) ||
102
+ isNotNil(riverFocusData[screenFocusableGroupId]) ||
83
103
  isDeepLink;
84
104
 
85
105
  // TODO: Uncommit it to start fixing bug where selection wrong item
@@ -118,19 +138,6 @@ export const riverFocusManager = (function () {
118
138
  }
119
139
  }
120
140
 
121
- /**
122
- * Create unique key that will be used for save focused group data inside specific screen
123
- * @param {{ screenId: string, isInsideContainer: boolean }}
124
- * screenId Unique Id of the screen from layout.json
125
- * isInsideContainer If this screen a screen picker child
126
- *
127
- */
128
- function screenFocusableGroupId({ screenId, isInsideContainer }) {
129
- return `RiverFocusableGroup-${screenId}${
130
- R.isNil(isInsideContainer) ? "" : "-isInsideContainer"
131
- }`;
132
- }
133
-
134
141
  return {
135
142
  setScreenFocusableData,
136
143
  clearAllScreensData,