@applicaster/zapp-react-native-utils 13.0.0-rc.2 → 13.0.0-rc.21

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 (109) hide show
  1. package/actionsExecutor/ActionExecutor.ts +16 -9
  2. package/actionsExecutor/ActionExecutorContext.tsx +74 -9
  3. package/alertUtils/alert.ts +148 -0
  4. package/alertUtils/index.ts +1 -148
  5. package/analyticsUtils/AnalyticPlayerListener.ts +18 -1
  6. package/analyticsUtils/__tests__/__snapshots__/analyticsManagerNoModule.test.js.snap +9 -9
  7. package/analyticsUtils/helpers/hooks.ts +1 -1
  8. package/appUtils/HooksManager/{Hook.js → Hook.ts} +35 -23
  9. package/appUtils/HooksManager/__tests__/__snapshots__/hook.test.js.snap +10 -8
  10. package/appUtils/HooksManager/__tests__/__snapshots__/hooksManager.test.js.snap +693 -0
  11. package/appUtils/HooksManager/__tests__/hook.test.js +196 -184
  12. package/appUtils/HooksManager/__tests__/hooksManager.test.js +96 -99
  13. package/appUtils/HooksManager/{constants.js → constants.ts} +1 -1
  14. package/appUtils/HooksManager/{index.js → index.ts} +121 -112
  15. package/appUtils/HooksManager/types.ts +119 -0
  16. package/appUtils/RiverFocusManager/index.js +17 -12
  17. package/appUtils/accessibilityManager/index.ts +42 -1
  18. package/appUtils/contextKeysManager/contextResolver.ts +73 -0
  19. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +6 -6
  20. package/appUtils/focusManager/index.ts +90 -63
  21. package/appUtils/focusManager/treeDataStructure/Tree/index.js +25 -3
  22. package/appUtils/focusManager/treeDataStructure/Utils/index.js +1 -3
  23. package/appUtils/focusManager/utils/enums.ts +4 -0
  24. package/appUtils/focusManagerAux/utils/index.ts +4 -3
  25. package/appUtils/{index.js → index.ts} +1 -1
  26. package/appUtils/keyCodes/__tests__/__snapshots__/keyCodes.test.js.snap +2 -2
  27. package/appUtils/keyCodes/__tests__/keyCodes.test.js +4 -4
  28. package/appUtils/keyCodes/{index.js → index.ts} +2 -0
  29. package/appUtils/keyCodes/keys/index.ts +3 -0
  30. package/appUtils/keyCodes/{keys.android.js → keys/keyEventMapper.ts} +0 -19
  31. package/appUtils/keyCodes/keys/keys.android.ts +18 -0
  32. package/appUtils/keyCodes/keys/keys.ios.ts +25 -0
  33. package/appUtils/keyCodes/keys/keys.ts +15 -0
  34. package/appUtils/keyCodes/{keysByPlatform.js → keys/keysByPlatform.ts} +4 -0
  35. package/appUtils/keyCodes/keysByPlatform.ts +8 -0
  36. package/appUtils/keyInputHandler/KeyInputHandler.ts +68 -0
  37. package/appUtils/orientationHelper.ts +1 -1
  38. package/appUtils/platform/const.ts +14 -0
  39. package/appUtils/platform/platformUtils.ts +17 -15
  40. package/appUtils/playerManager/index.ts +6 -2
  41. package/appUtils/playerManager/player.ts +17 -5
  42. package/appUtils/playerManager/playerFactory.ts +5 -4
  43. package/appUtils/playerManager/playerNative.ts +3 -2
  44. package/appUtils/playerManager/usePlayerControllerSetup.tsx +3 -3
  45. package/arrayUtils/__tests__/__snapshots__/arrayUtils.test.ts.snap +4 -4
  46. package/domUtils/{cookieManager.js → cookieManager.ts} +1 -2
  47. package/functionUtils/__tests__/__snapshots__/functionUtils.test.js.snap +4 -4
  48. package/functionUtils/index.ts +15 -11
  49. package/idleUtils/__tests__/withTimeout$.test.ts +37 -0
  50. package/idleUtils/index.ts +1 -1
  51. package/idleUtils/withTimeout.ts +15 -2
  52. package/logger/const.ts +9 -67
  53. package/manifestUtils/__tests__/createConfig.test.js +18 -16
  54. package/modalState/index.ts +1 -5
  55. package/navigationUtils/__tests__/__snapshots__/navigationUtils.test.js.snap +6 -6
  56. package/navigationUtils/__tests__/itemTypes.test.js +2 -2
  57. package/navigationUtils/__tests__/navigationUtils.test.js +2 -2
  58. package/navigationUtils/index.ts +14 -5
  59. package/package.json +3 -2
  60. package/reactHooks/autoscrolling/__tests__/useTrackCurrentAutoScrollingElement.test.ts +1 -1
  61. package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +1 -1
  62. package/reactHooks/cell-click/__tests__/index.test.js +10 -2
  63. package/reactHooks/cell-click/index.ts +7 -1
  64. package/reactHooks/feed/__tests__/useBuildPipesUrl.test.tsx +4 -4
  65. package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +20 -13
  66. package/reactHooks/feed/useFeedLoader.tsx +12 -8
  67. package/reactHooks/feed/usePipesCacheReset.ts +5 -5
  68. package/reactHooks/flatList/__tests__/index.test.tsx +30 -21
  69. package/reactHooks/layout/__tests__/index.test.tsx +10 -10
  70. package/reactHooks/layout/useDimensions/helpers/__tests__/getInitialDimensions.native.test.js +14 -28
  71. package/reactHooks/navigation/__tests__/index.test.tsx +0 -4
  72. package/reactHooks/navigation/index.ts +29 -218
  73. package/reactHooks/navigation/useGetBottomTabBarHeight.ts +12 -0
  74. package/reactHooks/navigation/useGetNavBarTopBorderWidth.ts +14 -0
  75. package/reactHooks/navigation/useGetTabBarHeight.ts +12 -0
  76. package/reactHooks/navigation/useIsScreenActive.ts +17 -0
  77. package/reactHooks/navigation/useNavigationPluginData.ts +15 -0
  78. package/reactHooks/navigation/useNavigationType.ts +15 -0
  79. package/reactHooks/navigation/usePathname.ts +4 -0
  80. package/reactHooks/navigation/useRoute.ts +100 -0
  81. package/reactHooks/navigation/useUniqueRouteSuffix.ts +41 -0
  82. package/reactHooks/player/TVSeekControlller/ISeekController.ts +32 -0
  83. package/reactHooks/player/TVSeekControlller/LongPressSeekController.ts +71 -0
  84. package/reactHooks/player/TVSeekControlller/TVSeekController.ts +258 -0
  85. package/reactHooks/player/TVSeekControlller/TapSeekController.ts +53 -0
  86. package/reactHooks/player/__tests__/{useAutoSeek.test.tsx → useAutoSeek._test.tsx} +2 -3
  87. package/reactHooks/player/const.ts +0 -4
  88. package/reactHooks/player/index.ts +0 -6
  89. package/reactHooks/utils/index.ts +13 -0
  90. package/reactUtils/__tests__/reactUtils.test.js +10 -28
  91. package/reactUtils/createContext/__tests__/__snapshots__/helpers.test.js.snap +19 -19
  92. package/reactUtils/createContext/__tests__/__snapshots__/index.test.js.snap +2 -2
  93. package/reactUtils/createContext/__tests__/__snapshots__/provider.test.js.snap +3 -3
  94. package/reactUtils/createContext/__tests__/helpers.test.js +8 -8
  95. package/reactUtils/index.ts +0 -14
  96. package/theme/__mocks__/index.ts +4 -0
  97. package/time/Timer.ts +1 -1
  98. package/types.ts +1 -0
  99. package/appUtils/keyCodes/keys.ios.js +0 -46
  100. package/reactHooks/player/useAutoSeek.tsx +0 -87
  101. package/reactHooks/player/useSeek.tsx +0 -66
  102. package/reactHooks/player/useTapSeek.tsx +0 -58
  103. /package/appUtils/HooksManager/{logger.js → logger.ts} +0 -0
  104. /package/appUtils/{directionHelper.js → directionHelper.ts} +0 -0
  105. /package/appUtils/keyCodes/{androidTVKeys.js → androidTVKeys.ts} +0 -0
  106. /package/appUtils/keyCodes/{keys.web.js → keys/keys.web.ts} +0 -0
  107. /package/appUtils/{localizationsHelper.js → localizationsHelper.ts} +0 -0
  108. /package/domUtils/{logger.js → logger.ts} +0 -0
  109. /package/reactHooks/player/__tests__/{useTapSeek.test.ts → useTapSeek._test.ts} +0 -0
@@ -29,7 +29,9 @@ const hooks = (options, otherHook = null) =>
29
29
  const manager = {
30
30
  presentScreenHook: jest.fn(),
31
31
  executeHook: jest.fn(),
32
- invokeHandler: jest.fn(),
32
+ subscriber: {
33
+ invokeHandler: jest.fn(),
34
+ },
33
35
  };
34
36
 
35
37
  const getHook = (options, otherHook) =>
@@ -42,257 +44,267 @@ const getHook = (options, otherHook) =>
42
44
  function clearMocks() {
43
45
  manager.presentScreenHook.mockClear();
44
46
  manager.executeHook.mockClear();
45
- manager.invokeHandler.mockClear();
47
+ manager.subscriber.invokeHandler.mockClear();
46
48
  }
47
49
 
48
- describe("Hook Properties", () => {
49
- const hookPlugin = getHook({});
50
+ describe("Hook", () => {
51
+ describe("Hook Properties", () => {
52
+ const hookPlugin = getHook({});
50
53
 
51
- beforeEach(clearMocks);
54
+ beforeEach(clearMocks);
52
55
 
53
- it("has all the hook properties", () => {
54
- expect(hookPlugin).toMatchSnapshot();
56
+ it("has all the hook properties", () => {
57
+ expect(hookPlugin).toMatchSnapshot();
58
+ });
55
59
  });
56
- });
57
60
 
58
- describe("getModalContainer", () => {
59
- it("returns ModalContainer", () => {
60
- const ModalContainer = jest.fn();
61
+ describe("getModalContainer", () => {
62
+ it("returns ModalContainer", () => {
63
+ const ModalContainer = jest.fn();
61
64
 
62
- const hookPlugin = getHook({
63
- general: {},
64
- module: { ModalContainer },
65
- });
65
+ const hookPlugin = getHook({
66
+ general: {},
67
+ module: { ModalContainer },
68
+ });
66
69
 
67
- expect(hookPlugin.getModalContainer()).toBe(ModalContainer);
70
+ expect(hookPlugin.getModalContainer()).toBe(ModalContainer);
71
+ });
68
72
  });
69
- });
70
73
 
71
- describe("isFlowBlocker", () => {
72
- it("returns true if the hook is flow blocker", () => {
73
- const hookPlugin = getHook({ general: { is_flow_blocker: true } });
74
+ describe("isFlowBlocker", () => {
75
+ it("returns true if the hook is flow blocker", () => {
76
+ const hookPlugin = getHook({ general: { is_flow_blocker: true } });
74
77
 
75
- const hookWithoutScreen = getHook({
76
- general: {},
77
- module: { isFlowBlocker: () => true },
78
+ const hookWithoutScreen = getHook({
79
+ general: {},
80
+ module: { isFlowBlocker: () => true },
81
+ });
82
+
83
+ expect(hookPlugin.isFlowBlocker()).toBe(true);
84
+ expect(hookWithoutScreen.isFlowBlocker()).toBe(true);
78
85
  });
79
86
 
80
- expect(hookPlugin.isFlowBlocker()).toBe(true);
81
- expect(hookWithoutScreen.isFlowBlocker()).toBe(true);
82
- });
87
+ it("returns false otherwise", () => {
88
+ const hookPlugin = getHook({ general: { is_flow_blocker: false } });
83
89
 
84
- it("returns false otherwise", () => {
85
- const hookPlugin = getHook({ general: { is_flow_blocker: false } });
90
+ const hookWithoutScreen = getHook({
91
+ general: {},
92
+ module: { isFlowBlocker: () => false },
93
+ });
86
94
 
87
- const hookWithoutScreen = getHook({
88
- general: {},
89
- module: { isFlowBlocker: () => false },
95
+ expect(hookPlugin.isFlowBlocker()).toBeFalsy();
96
+ expect(hookWithoutScreen.isFlowBlocker()).toBeFalsy();
90
97
  });
91
-
92
- expect(hookPlugin.isFlowBlocker()).toBeFalsy();
93
- expect(hookWithoutScreen.isFlowBlocker()).toBeFalsy();
94
98
  });
95
- });
96
99
 
97
- describe("skipHook", () => {
98
- it("returns true if the hooks module skipHook method returns true", () => {
99
- const hookPlugin = getHook({ module: { skipHook: () => true } });
100
+ describe("skipHook", () => {
101
+ it("returns true if the hooks module skipHook method returns true", () => {
102
+ const hookPlugin = getHook({ module: { skipHook: () => true } });
100
103
 
101
- expect(hookPlugin.skipHook()).toBe(true);
102
- });
104
+ expect(hookPlugin.skipHook()).toBe(true);
105
+ });
103
106
 
104
- it("returns false otherwise", () => {
105
- const hookPlugin = getHook({ module: { skipHook: false } });
106
- const hookPluginWithUndefinedSkipHook = getHook({ module: {} });
107
+ it("returns false otherwise", () => {
108
+ const hookPlugin = getHook({ module: { skipHook: false } });
109
+ const hookPluginWithUndefinedSkipHook = getHook({ module: {} });
107
110
 
108
- expect(hookPlugin.skipHook()).toBeFalsy();
109
- expect(hookPluginWithUndefinedSkipHook.skipHook()).toBeFalsy();
111
+ expect(hookPlugin.skipHook()).toBeFalsy();
112
+ expect(hookPluginWithUndefinedSkipHook.skipHook()).toBeFalsy();
113
+ });
110
114
  });
111
- });
112
115
 
113
- describe("lastHook", () => {
114
- it("returns true if the current hook is the last one", () => {
115
- const hookPlugin = getHook({});
116
- expect(hookPlugin.lastHook).toBe(true);
117
- });
116
+ describe("lastHook", () => {
117
+ it("returns true if the current hook is the last one", () => {
118
+ const hookPlugin = getHook({});
119
+ expect(hookPlugin.lastHook).toBe(true);
120
+ });
118
121
 
119
- it("returns false otherwise", () => {
120
- const hookPlugin = getHook(
121
- {},
122
- {
123
- screen_id: "B4567",
124
- type: "general",
125
- identifier: "some_hook",
126
- weight: 2,
127
- }
128
- );
129
-
130
- expect(hookPlugin.lastHook).toBe(false);
122
+ it("returns false otherwise", () => {
123
+ const hookPlugin = getHook(
124
+ {},
125
+ {
126
+ screen_id: "B4567",
127
+ type: "general",
128
+ identifier: "some_hook",
129
+ weight: 2,
130
+ }
131
+ );
132
+
133
+ expect(hookPlugin.lastHook).toBe(false);
134
+ });
131
135
  });
132
- });
133
136
 
134
- describe("setStateAndNotify", () => {
135
- let hookPlugin;
136
- const args = ["foo", { bar: 42 }];
137
+ describe("setStateAndNotify", () => {
138
+ let hookPlugin;
139
+ const args = ["foo", { bar: 42 }];
137
140
 
138
- beforeEach(() => {
139
- clearMocks();
140
- hookPlugin = getHook({});
141
- });
141
+ beforeEach(() => {
142
+ clearMocks();
143
+ hookPlugin = getHook({});
144
+ });
142
145
 
143
- it("changes the hook's state", () => {
144
- hookPlugin.setStateAndNotify(HOOKS_EVENTS.START, ...args);
145
- expect(hookPlugin.state).toEqual(1);
146
- });
146
+ it("changes the hook's state", () => {
147
+ hookPlugin.setStateAndNotify(HOOKS_EVENTS.START, ...args);
148
+ expect(hookPlugin.state).toEqual(1);
149
+ });
147
150
 
148
- it("calls invokes the handler on the hook manager", () => {
149
- hookPlugin.setStateAndNotify(HOOKS_EVENTS.START, ...args);
151
+ it("calls invokes the handler on the hook manager", () => {
152
+ hookPlugin.setStateAndNotify(HOOKS_EVENTS.START, ...args);
150
153
 
151
- expect(manager.invokeHandler).toHaveBeenCalledWith(
152
- HOOKS_EVENTS.START,
153
- ...args
154
- );
154
+ expect(manager.subscriber.invokeHandler).toHaveBeenCalledWith(
155
+ HOOKS_EVENTS.START,
156
+ ...args
157
+ );
158
+ });
155
159
  });
156
- });
157
160
 
158
- describe("shouldPresentScreenHook", () => {
159
- it("returns true if the hook has a screenId and allows screen presentation", () => {
160
- const hookPlugin = getHook({});
161
+ describe("shouldPresentScreenHook", () => {
162
+ it("returns true if the hook has a screenId and allows screen presentation", () => {
163
+ const hookPlugin = getHook({});
161
164
 
162
- const hookWithoutRiver = getHook({
163
- screen_id: undefined,
164
- module: { presentFullScreen: true },
165
+ const hookWithoutRiver = getHook({
166
+ screen_id: undefined,
167
+ module: { presentFullScreen: true },
168
+ });
169
+
170
+ expect(hookPlugin.shouldPresentScreenHook()).toBe(true);
171
+ expect(hookWithoutRiver.shouldPresentScreenHook()).toBe(true);
165
172
  });
166
173
 
167
- expect(hookPlugin.shouldPresentScreenHook()).toBe(true);
168
- expect(hookWithoutRiver.shouldPresentScreenHook()).toBe(true);
169
- });
174
+ it("returns true if the hook is modal presentation", () => {
175
+ const hookPlugin = getHook({
176
+ general: { transition_type: HOOKS_TRANSITION_TYPE.MODAL },
177
+ });
170
178
 
171
- it("returns true if the hook is modal presentation", () => {
172
- const hookPlugin = getHook({
173
- general: { transition_type: HOOKS_TRANSITION_TYPE.MODAL },
179
+ expect(hookPlugin.shouldPresentScreenHook()).toBe(true);
174
180
  });
175
181
 
176
- expect(hookPlugin.shouldPresentScreenHook()).toBe(true);
177
- });
182
+ it("returns false otherwise", () => {
183
+ const hookWithoutScreen = getHook({ screen_id: undefined });
178
184
 
179
- it("returns false otherwise", () => {
180
- const hookWithoutScreen = getHook({ screen_id: undefined });
185
+ const hookWithoutRiver = getHook({
186
+ screen_id: undefined,
187
+ module: { presentFullScreen: false },
188
+ });
181
189
 
182
- const hookWithoutRiver = getHook({
183
- screen_id: undefined,
184
- module: { presentFullScreen: false },
185
- });
190
+ const hookWithoutAllowScreen = getHook({
191
+ general: { allow_screen_plugin_presentation: false },
192
+ });
186
193
 
187
- const hookWithoutAllowScreen = getHook({
188
- general: { allow_screen_plugin_presentation: false },
189
- });
194
+ const hookWithoutScreenAndAllow = getHook({
195
+ general: { allow_screen_plugin_presentation: false },
196
+ screen_id: null,
197
+ });
190
198
 
191
- const hookWithoutScreenAndAllow = getHook({
192
- general: { allow_screen_plugin_presentation: false },
193
- screen_id: null,
199
+ expect(hookWithoutScreen.shouldPresentScreenHook()).toBeFalsy();
200
+ expect(hookWithoutAllowScreen.shouldPresentScreenHook()).toBeFalsy();
201
+ expect(hookWithoutScreenAndAllow.shouldPresentScreenHook()).toBeFalsy();
202
+ expect(hookWithoutRiver.shouldPresentScreenHook()).toBeFalsy();
194
203
  });
195
-
196
- expect(hookWithoutScreen.shouldPresentScreenHook()).toBeFalsy();
197
- expect(hookWithoutAllowScreen.shouldPresentScreenHook()).toBeFalsy();
198
- expect(hookWithoutScreenAndAllow.shouldPresentScreenHook()).toBeFalsy();
199
- expect(hookWithoutRiver.shouldPresentScreenHook()).toBeFalsy();
200
204
  });
201
- });
202
205
 
203
- describe("shouldStartNexHook", () => {
204
- const hookPlugin = getHook({});
205
- const hookWithoutScreen = getHook({ screen_id: undefined });
206
-
207
- it("returns true if the nextHook has the same weight and is not a screen", () => {
208
- expect(
209
- hookWithoutScreen.shouldStartNextHook({
210
- weight: hookWithoutScreen.weight,
211
- })
212
- ).toBe(true);
213
- });
206
+ describe("shouldStartNexHook", () => {
207
+ const hookPlugin = getHook({});
208
+ const hookWithoutScreen = getHook({ screen_id: undefined });
214
209
 
215
- it("returns false otherwise", () => {
216
- // even if weight if the same, since hookPlugin should present a screen,
217
- // it cannot run in parallel
218
- expect(hookPlugin.shouldStartNextHook({ weight: hookPlugin })).toBeFalsy();
210
+ it("returns true if the nextHook has the same weight and is not a screen", () => {
211
+ expect(
212
+ hookWithoutScreen.shouldStartNextHook({
213
+ weight: hookWithoutScreen.weight,
214
+ })
215
+ ).toBe(true);
216
+ });
219
217
 
220
- expect(
221
- hookWithoutScreen.shouldStartNextHook({
222
- weight: hookWithoutScreen.weight + 1,
223
- })
224
- ).toBeFalsy();
218
+ it("returns false otherwise", () => {
219
+ // even if weight if the same, since hookPlugin should present a screen,
220
+ // it cannot run in parallel
221
+ expect(
222
+ hookPlugin.shouldStartNextHook({ weight: hookPlugin })
223
+ ).toBeFalsy();
224
+
225
+ expect(
226
+ hookWithoutScreen.shouldStartNextHook({
227
+ weight: hookWithoutScreen.weight + 1,
228
+ })
229
+ ).toBeFalsy();
230
+ });
225
231
  });
226
- });
227
232
 
228
- describe("execute", () => {
229
- const payload = { foo: "bar" };
230
- const next = jest.fn();
233
+ describe("execute", () => {
234
+ const payload = { foo: "bar" };
235
+ const next = jest.fn();
231
236
 
232
- beforeEach(clearMocks);
237
+ beforeEach(clearMocks);
233
238
 
234
- describe("when the hook execution should be skipped", () => {
235
- it("doesn't execute the hook, and goes to the next", () => {
236
- const hookPlugin = getHook({ module: { skipHook: () => true } });
237
- hookPlugin.execute(payload, next);
239
+ describe("when the hook execution should be skipped", () => {
240
+ it("doesn't execute the hook, and goes to the next", () => {
241
+ const hookPlugin = getHook({ module: { skipHook: () => true } });
242
+ hookPlugin.execute(payload, next);
238
243
 
239
- expect(manager.presentScreenHook).not.toHaveBeenCalled();
240
- expect(manager.executeHook).not.toHaveBeenCalled();
241
- expect(next).toHaveBeenCalledWith({ payload, success: true });
244
+ expect(manager.presentScreenHook).not.toHaveBeenCalled();
245
+ expect(manager.executeHook).not.toHaveBeenCalled();
246
+ expect(next).toHaveBeenCalledWith({ payload, success: true });
247
+ });
242
248
  });
243
- });
244
249
 
245
- describe("when the hook is not in pending state", () => {
246
- it("doesn't execute the hook, and goes to the next", () => {
247
- const hookPlugin = getHook({});
248
- hookPlugin.setStateAndNotify(HOOKS_EVENTS.START);
249
- hookPlugin.execute(payload, next);
250
+ describe("when the hook is not in pending state", () => {
251
+ it("doesn't execute the hook, and goes to the next", () => {
252
+ const hookPlugin = getHook({});
253
+ hookPlugin.setStateAndNotify(HOOKS_EVENTS.START);
254
+ hookPlugin.execute(payload, next);
250
255
 
251
- const hookStateSpy = jest.spyOn(hookPlugin, "setStateAndNotify");
256
+ const hookStateSpy = jest.spyOn(hookPlugin, "setStateAndNotify");
252
257
 
253
- expect(hookStateSpy).not.toHaveBeenCalled();
254
- expect(manager.presentScreenHook).not.toHaveBeenCalled();
255
- expect(manager.executeHook).not.toHaveBeenCalled();
256
- expect(next).toHaveBeenCalledWith({ payload });
258
+ expect(hookStateSpy).not.toHaveBeenCalled();
259
+ expect(manager.presentScreenHook).not.toHaveBeenCalled();
260
+ expect(manager.executeHook).not.toHaveBeenCalled();
261
+ expect(next).toHaveBeenCalledWith({ payload });
257
262
 
258
- hookStateSpy.mockRestore();
263
+ hookStateSpy.mockRestore();
264
+ });
259
265
  });
260
- });
261
266
 
262
- describe("when the screen should be presented", () => {
263
- it("executes the hook", () => {
264
- const hookPlugin = getHook({});
265
- const hookStateSpy = jest.spyOn(hookPlugin, "setStateAndNotify");
267
+ describe("when the screen should be presented", () => {
268
+ it("executes the hook", () => {
269
+ const hookPlugin = getHook({});
270
+ const hookStateSpy = jest.spyOn(hookPlugin, "setStateAndNotify");
266
271
 
267
- hookPlugin.execute(payload, next);
272
+ hookPlugin.execute(payload, next);
268
273
 
269
- expect(hookStateSpy).toHaveBeenCalledWith(HOOKS_EVENTS.START, hookPlugin);
274
+ expect(hookStateSpy).toHaveBeenCalledWith(
275
+ HOOKS_EVENTS.START,
276
+ hookPlugin
277
+ );
270
278
 
271
- expect(manager.presentScreenHook).toHaveBeenCalledWith(
272
- hookPlugin,
273
- payload,
274
- next
275
- );
279
+ expect(manager.presentScreenHook).toHaveBeenCalledWith(
280
+ hookPlugin,
281
+ payload,
282
+ next
283
+ );
284
+ });
276
285
  });
277
- });
278
286
 
279
- describe("when the hook is headless", () => {
280
- it("executes the hook", () => {
281
- const hookPlugin = getHook({
282
- general: { allow_screen_plugin_presentation: false },
283
- });
287
+ describe("when the hook is headless", () => {
288
+ it("executes the hook", () => {
289
+ const hookPlugin = getHook({
290
+ general: { allow_screen_plugin_presentation: false },
291
+ });
284
292
 
285
- const hookStateSpy = jest.spyOn(hookPlugin, "setStateAndNotify");
293
+ const hookStateSpy = jest.spyOn(hookPlugin, "setStateAndNotify");
286
294
 
287
- hookPlugin.execute(payload, next);
295
+ hookPlugin.execute(payload, next);
288
296
 
289
- expect(hookStateSpy).toHaveBeenCalledWith(HOOKS_EVENTS.START, hookPlugin);
297
+ expect(hookStateSpy).toHaveBeenCalledWith(
298
+ HOOKS_EVENTS.START,
299
+ hookPlugin
300
+ );
290
301
 
291
- expect(manager.executeHook).toHaveBeenCalledWith(
292
- hookPlugin,
293
- payload,
294
- next
295
- );
302
+ expect(manager.executeHook).toHaveBeenCalledWith(
303
+ hookPlugin,
304
+ payload,
305
+ next
306
+ );
307
+ });
296
308
  });
297
309
  });
298
310
  });