@applicaster/zapp-react-native-utils 15.0.0-alpha.8680244503 → 15.0.0-alpha.9300744523

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/utils/pathOr.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import { get } from "lodash";
2
2
 
3
- export const pathOr = (defaultValue, path, record) => {
3
+ export const pathOr = <T = any>(
4
+ defaultValue: T,
5
+ path: (number | string) | (number | string)[],
6
+ record: any
7
+ ): T => {
4
8
  return get(record, path, defaultValue);
5
9
  };
@@ -46,7 +46,7 @@ const legacyMappingKeys = {
46
46
  actionType: "login_completion_action",
47
47
  targetScreen: "navigate_to_login_screen",
48
48
  },
49
- "quick-brick-user-account-ui-component": {
49
+ "quick-brick-user-account-ui-component.login": {
50
50
  actionType: "callbackAction",
51
51
  },
52
52
  "quick-brick-login-multi-login-providers.login": {
@@ -84,7 +84,8 @@ export const getNavigationKeys = (
84
84
  ): NavKeys => {
85
85
  const general = (item?.general ?? {}) as General;
86
86
 
87
- const pluginIdentifier = (item as any).identifier ?? item?.type ?? "";
87
+ const pluginIdentifier =
88
+ (item as any).identifier ?? item?.type ?? item?.component_type ?? "";
88
89
 
89
90
  const legacy =
90
91
  legacyMappingKeys[`${pluginIdentifier}.${resultType}`] ??
@@ -175,12 +176,25 @@ export const useCallbackNavigationAction = (
175
176
  return;
176
177
  }
177
178
 
178
- const data = getNavigationKeys(item, args.options?.resultType ?? null);
179
+ let data = getNavigationKeys(item, args.options?.resultType ?? null);
179
180
 
180
181
  if (!data) {
181
- hookCallback?.(args);
182
+ const isScreen = !hookCallback;
182
183
 
183
- return;
184
+ if (isScreen && args.options?.resultType === ResultType.login) {
185
+ log_debug(
186
+ `${LogPrefix} no navigation data found, applying GO BACK for login screen`
187
+ );
188
+
189
+ data = {
190
+ action: NavigationCallbackOptions.GO_BACK,
191
+ targetScreenId: null,
192
+ };
193
+ } else {
194
+ hookCallback?.(args);
195
+
196
+ return;
197
+ }
184
198
  }
185
199
 
186
200
  hookCallback?.({ ...args, success: false, cancelled: true });
@@ -20,7 +20,7 @@ const callbackKeyPrefix = (key, prefix, keySeparator = "_") =>
20
20
 
21
21
  const extendManifestWithHookCallback = (prefix = null) => ({
22
22
  group: true,
23
- label: "CallBack Navigation",
23
+ label: `CallBack Navigation: ${prefix}`,
24
24
  folded: true,
25
25
  fields: [
26
26
  {