@applicaster/zapp-react-native-utils 13.0.0-rc.82 → 13.0.0-rc.84
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/actionsExecutor/ActionExecutorContext.tsx +23 -1
- package/appUtils/contextKeysManager/contextResolver.ts +1 -12
- package/package.json +2 -2
- package/reactHooks/feed/useFeedLoader.tsx +4 -2
- package/reactHooks/hookModal/hooks/useHookModalScreenData.ts +39 -0
- package/reactHooks/navigation/useRoute.ts +2 -4
- package/zappFrameworkUtils/loginPluginUtils.ts +6 -2
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
EntryResolver,
|
|
20
20
|
resolveObjectValues,
|
|
21
21
|
} from "../appUtils/contextKeysManager/contextResolver";
|
|
22
|
+
import { get } from "lodash";
|
|
22
23
|
|
|
23
24
|
const { log_error, log_info } = createLogger({
|
|
24
25
|
subsystem: "ActionExecutorContext",
|
|
@@ -169,8 +170,29 @@ const prepareDefaultActions = (actionExecutor) => {
|
|
|
169
170
|
action: ActionType,
|
|
170
171
|
context?: Record<string, any>
|
|
171
172
|
): Promise<ActionResult> => {
|
|
173
|
+
if (!context) {
|
|
174
|
+
log_error(
|
|
175
|
+
"handleAction: localStorageToggleFlag action missing context"
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
return ActionResult.Error;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const entry = context?.entry as ZappEntry;
|
|
182
|
+
|
|
183
|
+
if (!entry) {
|
|
184
|
+
log_error(
|
|
185
|
+
"handleAction: localStorageToggleFlag action missing entry. Entry is required to get the tag."
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
return ActionResult.Error;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const tag = action.options?.selector
|
|
192
|
+
? get(entry, action.options.selector)
|
|
193
|
+
: (entry.extensions?.tag ?? entry.id);
|
|
194
|
+
|
|
172
195
|
const keyNamespace = action.options?.key;
|
|
173
|
-
const tag = context?.entry?.extensions?.tag;
|
|
174
196
|
|
|
175
197
|
if (keyNamespace && tag) {
|
|
176
198
|
const multiSelectProvider =
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { createLogger } from "../../logger";
|
|
2
1
|
import { ContextKeysManager } from "./index";
|
|
3
2
|
import * as R from "ramda";
|
|
4
3
|
|
|
5
|
-
const { log_error } = createLogger({
|
|
6
|
-
subsystem: "contextResolver",
|
|
7
|
-
category: "General",
|
|
8
|
-
});
|
|
9
|
-
|
|
10
4
|
interface IResolver {
|
|
11
5
|
resolve: (string) => Promise<string | number | object>;
|
|
12
6
|
}
|
|
@@ -64,12 +58,7 @@ export const resolveObjectValues = async (
|
|
|
64
58
|
return [key, resolvedValue];
|
|
65
59
|
}
|
|
66
60
|
|
|
67
|
-
|
|
68
|
-
key,
|
|
69
|
-
value,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
return [key, null];
|
|
61
|
+
return [key, value];
|
|
73
62
|
})
|
|
74
63
|
);
|
|
75
64
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "13.0.0-rc.
|
|
3
|
+
"version": "13.0.0-rc.84",
|
|
4
4
|
"description": "Applicaster Zapp React Native utilities package",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@applicaster/applicaster-types": "13.0.0-rc.
|
|
30
|
+
"@applicaster/applicaster-types": "13.0.0-rc.84",
|
|
31
31
|
"buffer": "^5.2.1",
|
|
32
32
|
"camelize": "^1.0.0",
|
|
33
33
|
"dayjs": "^1.11.10",
|
|
@@ -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 {
|
|
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 =
|
|
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
|
+
};
|
|
@@ -7,9 +7,8 @@ import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
|
7
7
|
|
|
8
8
|
import { legacyScreenData } from "@applicaster/quick-brick-core/App/NavigationProvider/utils";
|
|
9
9
|
|
|
10
|
-
import { useZappHooksModalState } from "@applicaster/zapp-react-dom-ui-components/Components/ZappHooksModal/hooks/useZappHooksModalState";
|
|
11
|
-
|
|
12
10
|
import { getTargetScreenData } from "../screen/useTargetScreenData";
|
|
11
|
+
import { useHookModalScreenData } from "../hookModal/hooks/useHookModalScreenData";
|
|
13
12
|
|
|
14
13
|
import { useNavigation } from "./useNavigation";
|
|
15
14
|
import { useModalStore } from "../../modalState";
|
|
@@ -45,11 +44,10 @@ export const useRoute = (): {
|
|
|
45
44
|
]);
|
|
46
45
|
|
|
47
46
|
const { modalState } = useModalStore();
|
|
48
|
-
const hookModalState = useZappHooksModalState();
|
|
49
47
|
|
|
50
48
|
const modalScreenData = modalState.screen;
|
|
51
49
|
|
|
52
|
-
const hookModalScreenData =
|
|
50
|
+
const hookModalScreenData = useHookModalScreenData();
|
|
53
51
|
|
|
54
52
|
const videoModalScreenData =
|
|
55
53
|
navigator?.videoModalState?.item &&
|
|
@@ -89,11 +89,15 @@ const runInBackground = async ({
|
|
|
89
89
|
const shouldPresent = await hookPresentPolicy.shouldPresentScreen();
|
|
90
90
|
|
|
91
91
|
if (!shouldPresent) {
|
|
92
|
+
const isRefreshed = await checkUserAuthenticated();
|
|
93
|
+
|
|
92
94
|
log_info(
|
|
93
|
-
|
|
95
|
+
`runInBackground: Background mode finished, ${isRefreshed ? "finish hook with completion true" : "refresh failed will presentUI"}`
|
|
94
96
|
);
|
|
95
97
|
|
|
96
|
-
|
|
98
|
+
isRefreshed
|
|
99
|
+
? callback({ success: isRefreshed, payload: item })
|
|
100
|
+
: presentUI();
|
|
97
101
|
|
|
98
102
|
return;
|
|
99
103
|
}
|