@applicaster/zapp-react-native-utils 12.0.15 → 12.0.16-rc.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "12.0.15",
3
+ "version": "12.0.16-rc.0",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "12.0.15",
31
+ "@applicaster/applicaster-types": "12.0.16-rc.0",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",
@@ -5,7 +5,7 @@ import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
5
5
  import { useZappPipesFeed } from "@applicaster/zapp-react-native-redux/hooks";
6
6
 
7
7
  import { reactHooksLogger } from "../logger";
8
- import { useIsInitialRender, shouldDispatchData } from "../utils";
8
+ import { shouldDispatchData, useIsInitialRender } from "../utils";
9
9
  import { useInflatedUrl } from "./useInflatedUrl";
10
10
  import { useRoute } from "../navigation";
11
11
 
@@ -55,7 +55,9 @@ export const useFeedLoader = ({
55
55
 
56
56
  const currentFeed = useZappPipesFeed(callableFeedUrl);
57
57
 
58
- const riverId = screenData?.id;
58
+ const riverId =
59
+ (screenData as LegacyNavigationScreenData)?.targetScreen?.id ??
60
+ screenData?.id;
59
61
 
60
62
  const reloadData = React.useCallback<ReloadDataFunction>(
61
63
  (silentRefresh = true, callback) => {
@@ -0,0 +1,39 @@
1
+ import { reactHooksLogger } from "../../logger";
2
+ import { useZappHooksModalState } from "@applicaster/zapp-react-dom-ui-components/Components/ZappHooksModal/hooks/useZappHooksModalState";
3
+
4
+ const logger = reactHooksLogger.addSubsystem("useHookModalScreenData");
5
+
6
+ type VariousScreenData = LegacyNavigationScreenData | ZappRiver | ZappEntry;
7
+
8
+ export const useHookModalScreenData = (): VariousScreenData | undefined => {
9
+ const hookModalState = useZappHooksModalState();
10
+
11
+ if (!hookModalState.state?.screenData) {
12
+ return;
13
+ }
14
+
15
+ try {
16
+ const screenData = hookModalState.state.screenData?.payload;
17
+ const hookPlugin = hookModalState.state.screenData.hookPlugin;
18
+
19
+ if (hookPlugin?.screen_id) {
20
+ return {
21
+ ...screenData,
22
+ targetScreen: hookPlugin,
23
+ };
24
+ }
25
+
26
+ return hookModalState.state.screenData?.payload;
27
+ } catch (error) {
28
+ logger.error({
29
+ message: "Hook modal screen data creation failed",
30
+ data: {
31
+ error,
32
+ hookModalState,
33
+ },
34
+ jsOnly: true,
35
+ });
36
+
37
+ return hookModalState.state.screenData?.payload;
38
+ }
39
+ };
@@ -17,7 +17,6 @@ import {
17
17
  QUICK_BRICK_NAVBAR,
18
18
  QUICK_BRICK_CONTENT,
19
19
  } from "@applicaster/quick-brick-core/const";
20
- import { useZappHooksModalState } from "@applicaster/zapp-react-dom-ui-components/Components/ZappHooksModal/hooks/useZappHooksModalState";
21
20
  import { ZappHookModalContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
22
21
  import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
23
22
  import { HookModalContextT } from "@applicaster/zapp-react-native-ui-components/Contexts/ZappHookModalContext";
@@ -36,6 +35,7 @@ import { useNavbarState } from "../screen";
36
35
  import { useNavigation } from "./useNavigation";
37
36
  import { useModalStore } from "../../modalState";
38
37
  import { ScreenDataContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenDataContext";
38
+ import { useHookModalScreenData } from "../hookModal/hooks/useHookModalScreenData";
39
39
 
40
40
  export { useNavigation } from "./useNavigation";
41
41
 
@@ -156,6 +156,7 @@ export const useRoute = (): {
156
156
  } => {
157
157
  const pathname = usePathname() || "";
158
158
  const navigator = useNavigation();
159
+
159
160
  const screenDataContext = legacyScreenData(useContext(ScreenDataContext));
160
161
 
161
162
  const { plugins, contentTypes, rivers } = usePickFromState([
@@ -165,14 +166,13 @@ export const useRoute = (): {
165
166
  ]);
166
167
 
167
168
  const { modalState } = useModalStore();
168
- const hookModalState = useZappHooksModalState();
169
169
 
170
170
  const modalScreenData = modalState.screen;
171
171
 
172
- const hookModalScreenData = hookModalState.state.screenData?.payload;
172
+ const hookModalScreenData = useHookModalScreenData();
173
173
 
174
174
  const videoModalScreenData =
175
- navigator.videoModalState?.item &&
175
+ navigator?.videoModalState?.item &&
176
176
  legacyScreenData(
177
177
  {
178
178
  entry: navigator.videoModalState?.item as ZappEntry,