@applicaster/quick-brick-core 15.0.0-rc.13 → 15.0.0-rc.131

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 (30) hide show
  1. package/App/ActionSetters/index.ts +5 -4
  2. package/App/ActionsProvider/ActionsProvider.tsx +6 -1
  3. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/useOpenSchemeHandler.test.tsx +12 -27
  4. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/usePresentSchemeHandler.test.tsx +72 -35
  5. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/useUrlSchemeHandler.test.tsx +197 -104
  6. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/useOpenSchemeHandler/index.ts +4 -7
  7. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/usePresentSchemeHandler.ts +14 -12
  8. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/useUrlSchemeHandler.ts +42 -30
  9. package/App/DeepLinking/URLSchemeHandler/URLSchemeHandler.tsx +4 -1
  10. package/App/DeepLinking/URLSchemeHandler/__tests__/URLSchemeHandler.test.tsx +20 -13
  11. package/App/DeepLinking/URLSchemeListener/URLSchemeContextProvider.tsx +59 -0
  12. package/App/DeepLinking/URLSchemeListener/index.tsx +3 -4
  13. package/App/DeepLinking/helpers/index.ts +3 -3
  14. package/App/ErrorBoundary/__tests__/store.test.js +1 -1
  15. package/App/ModalProvider/ModalBottomSheet/ModalBottomSheetFrame.tsx +6 -1
  16. package/App/NavigationProvider/Loader.tsx +3 -4
  17. package/App/NavigationProvider/NavigationProvider.tsx +29 -40
  18. package/App/NavigationProvider/ScreenHooks/usePluginScreenHooks.ts +2 -2
  19. package/App/NavigationProvider/__tests__/navigationProvider.test.tsx +193 -152
  20. package/App/NavigationProvider/navigator/selectors.ts +21 -5
  21. package/App/NetworkStatusProvider/NetworkStatusProvider.tsx +2 -2
  22. package/App/NetworkStatusProvider/__tests__/NetworkStatusProvider.test.tsx +4 -4
  23. package/App/ThemeManager/index.tsx +9 -0
  24. package/App/ThemeManager/utils.ts +54 -0
  25. package/App/__tests__/createQuickBrickApp.test.js +1 -1
  26. package/App/appRemoteDataLoader/index.tsx +2 -2
  27. package/App/remoteContextReloader/getRemoteContextData/getNativeRemoteContextData.ts +1 -1
  28. package/App/remoteContextReloader/helpers.ts +3 -3
  29. package/package.json +8 -8
  30. package/App/DeepLinking/URLSchemeHandler/__tests__/__snapshots__/URLSchemeHandler.test.tsx.snap +0 -24
@@ -0,0 +1,54 @@
1
+ import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
2
+
3
+ const NETWORK_STATUS_LOCALIZATIONS_KEY = "network_status_localizations";
4
+ const THEME_STORAGE_NAMESPACE = "quick-brick-theme";
5
+
6
+ const DEFAULT_NETWORK_STATUS_LOCALIZATIONS: Record<string, string> = {
7
+ offline_notification_title: "No internet connection",
8
+ offline_notification_subtitle: "Please check your connection",
9
+ online_notification_title: "You are back online",
10
+ online_notification_subtitle: "Feel free to continue where you left off",
11
+ };
12
+
13
+ const NETWORK_STATUS_KEYS = Object.keys(
14
+ DEFAULT_NETWORK_STATUS_LOCALIZATIONS
15
+ ) as (keyof typeof DEFAULT_NETWORK_STATUS_LOCALIZATIONS)[];
16
+
17
+ export async function saveNetworkStatusLocalizations(
18
+ themeOrLocalizations: Record<string, unknown>
19
+ ) {
20
+ try {
21
+ const storedLocalizations = await sessionStorage.getItem(
22
+ NETWORK_STATUS_LOCALIZATIONS_KEY,
23
+ THEME_STORAGE_NAMESPACE
24
+ );
25
+
26
+ if (storedLocalizations) {
27
+ return;
28
+ }
29
+
30
+ const networkStatusLocalizations = NETWORK_STATUS_KEYS.reduce(
31
+ (acc, key) => {
32
+ const value = themeOrLocalizations[key];
33
+
34
+ acc[key] =
35
+ typeof value === "string"
36
+ ? value
37
+ : DEFAULT_NETWORK_STATUS_LOCALIZATIONS[key];
38
+
39
+ return acc;
40
+ },
41
+ {} as Record<string, string>
42
+ );
43
+
44
+ if (Object.keys(networkStatusLocalizations).length > 0) {
45
+ await sessionStorage.setItem(
46
+ NETWORK_STATUS_LOCALIZATIONS_KEY,
47
+ JSON.stringify(networkStatusLocalizations),
48
+ THEME_STORAGE_NAMESPACE
49
+ );
50
+ }
51
+ } catch (error) {
52
+ console.error("Error saving network status localizations", error);
53
+ }
54
+ }
@@ -2,7 +2,7 @@
2
2
  import * as React from "react";
3
3
  import { render } from "@testing-library/react-native";
4
4
  import { Provider } from "react-redux";
5
- import thunk from "redux-thunk";
5
+ import { thunk } from "redux-thunk";
6
6
  import configureStore from "redux-mock-store";
7
7
 
8
8
  jest.mock(
@@ -3,7 +3,7 @@ import * as React from "react";
3
3
  import { getRemoteContextData } from "../remoteContextReloader/getRemoteContextData";
4
4
 
5
5
  import { coreAppLogger } from "../logger";
6
- import { AnyAction, Dispatch } from "@reduxjs/toolkit";
6
+ import { UnknownAction, Dispatch } from "@reduxjs/toolkit";
7
7
  import { isAndroidPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
8
8
 
9
9
  const logger = coreAppLogger.addSubsystem("AppRemoteDataLoader");
@@ -27,7 +27,7 @@ export function appRemoteDataLoader(Component: ReactComponent<any>) {
27
27
  const [isDataLoaded, setIsDataLoaded] = React.useState(false);
28
28
 
29
29
  const loadRemoteConfigurationJSONs = async (
30
- dispatch: Dispatch<AnyAction>,
30
+ dispatch: Dispatch<UnknownAction>,
31
31
  state
32
32
  ) => {
33
33
  if (!__DEV__ || process.env.ENABLE_REMOTE_DATA_IN_DEV === "true") {
@@ -74,7 +74,7 @@ export async function getNativeRemoteContextData(
74
74
  );
75
75
  }
76
76
 
77
- const apiVersion = layout?.layout?.["api_version"]; // Taken from remote configuration
77
+ const apiVersion = layout?.layout?.api_version; // Taken from remote configuration
78
78
 
79
79
  dispatch(AppData.actions.merge({ layoutVersion: apiVersion || "v1" }));
80
80
 
@@ -113,15 +113,15 @@ export async function prepareRuntimeConfigurationUrls(
113
113
  }
114
114
  }
115
115
 
116
- export async function getPromiseForType(
116
+ export async function getPromiseForType<T = FileResponse>(
117
117
  key: string
118
- ): Promise<FileResponse | never> {
118
+ ): Promise<T | never> {
119
119
  try {
120
120
  const response = await AppLoaderBridge?.getFile(key, null);
121
121
 
122
122
  return {
123
123
  [key]: JSON.parse(response),
124
- };
124
+ } as T;
125
125
  } catch (e) {
126
126
  throw new Error("cannot retrieve configuration data for " + key);
127
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-core",
3
- "version": "15.0.0-rc.13",
3
+ "version": "15.0.0-rc.131",
4
4
  "description": "Core package for Applicaster's Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,13 +28,13 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "15.0.0-rc.13",
32
- "@applicaster/quick-brick-core-plugins": "15.0.0-rc.13",
33
- "@applicaster/zapp-pipes-v2-client": "15.0.0-rc.13",
34
- "@applicaster/zapp-react-native-bridge": "15.0.0-rc.13",
35
- "@applicaster/zapp-react-native-redux": "15.0.0-rc.13",
36
- "@applicaster/zapp-react-native-ui-components": "15.0.0-rc.13",
37
- "@applicaster/zapp-react-native-utils": "15.0.0-rc.13",
31
+ "@applicaster/applicaster-types": "15.0.0-rc.131",
32
+ "@applicaster/quick-brick-core-plugins": "15.0.0-rc.131",
33
+ "@applicaster/zapp-pipes-v2-client": "15.0.0-rc.131",
34
+ "@applicaster/zapp-react-native-bridge": "15.0.0-rc.131",
35
+ "@applicaster/zapp-react-native-redux": "15.0.0-rc.131",
36
+ "@applicaster/zapp-react-native-ui-components": "15.0.0-rc.131",
37
+ "@applicaster/zapp-react-native-utils": "15.0.0-rc.131",
38
38
  "atob": "^2.1.2",
39
39
  "axios": "^0.28.0",
40
40
  "btoa": "^1.2.1",
@@ -1,24 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`URLSchemeHandler renders correctly and invokes the hook 1`] = `
4
- <View
5
- style={
6
- [
7
- {
8
- "alignItems": "center",
9
- "flex": 1,
10
- "justifyContent": "center",
11
- },
12
- {
13
- "backgroundColor": "white",
14
- "height": 1334,
15
- "width": 750,
16
- },
17
- ]
18
- }
19
- >
20
- <ActivityIndicator
21
- size="large"
22
- />
23
- </View>
24
- `;