@applicaster/quick-brick-core 12.0.0-alpha.7725319213 → 12.0.0-alpha.7843515010

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 (26) hide show
  1. package/App/ActionSetters/index.ts +4 -4
  2. package/App/AssetCache/__tests__/assetCache.test.ts +1 -1
  3. package/App/AssetCache/index.ts +9 -2
  4. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/usePresentSchemeHandler.ts +3 -5
  5. package/App/DeepLinking/URLSchemeHandler/__tests__/URLSchemeHandler.test.tsx +3 -3
  6. package/App/DeepLinking/URLSchemeListener/__tests__/URLSchemeListenerTest.js +0 -2
  7. package/App/DeepLinking/URLSchemeListener/index.tsx +3 -7
  8. package/App/LogicAggregatorContainer/index.tsx +5 -0
  9. package/App/ModalProvider/ModalBottomSheet/index.tsx +5 -1
  10. package/App/ModalProvider/ModalContent.tsx +1 -1
  11. package/App/ModalProvider/index.tsx +3 -3
  12. package/App/NavigationProvider/NavigationProvider.tsx +43 -60
  13. package/App/NavigationProvider/ScreenHooks/ApplyScreenHooks.tsx +2 -8
  14. package/App/NavigationProvider/__tests__/__snapshots__/navigationProvider.test.tsx.snap +4 -21
  15. package/App/NavigationProvider/__tests__/navigationProvider.test.tsx +137 -231
  16. package/App/NetworkStatusProvider/utils.ts +23 -1
  17. package/App/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +14 -8
  18. package/App/RouteManager/__tests__/routeManager.test.js +18 -7
  19. package/App/RouteManager/index.tsx +3 -2
  20. package/App/ThemeManager/index.tsx +1 -9
  21. package/App/__tests__/createQuickBrickApp.test.js +5 -0
  22. package/App/index.tsx +33 -26
  23. package/const/index.ts +4 -0
  24. package/createZappApp/__tests__/__snapshots__/createZappApp.test.js.snap +1 -1
  25. package/createZappApp/index.tsx +9 -2
  26. package/package.json +9 -9
@@ -9,17 +9,9 @@ import {
9
9
  partitionByKeys,
10
10
  } from "@applicaster/zapp-react-native-utils/objectUtils";
11
11
 
12
- type Plugin = {
13
- name: string;
14
- identifier: string;
15
- module: any;
16
- type: string;
17
- configuration: { [key: string]: any };
18
- };
19
-
20
12
  type Props = {
21
13
  children: React.ReactNode;
22
- plugins: Plugin[];
14
+ plugins: QuickBrickPlugin[];
23
15
  };
24
16
 
25
17
  const DEFAULT_THEME_ID = "base-theme";
@@ -15,6 +15,11 @@ jest.mock(
15
15
  // This is meant to silence errors with react-native-gesture-handler
16
16
  jest.mock("../ModalProvider/ModalBottomSheet", () => () => null);
17
17
 
18
+ jest.mock(
19
+ "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation",
20
+ () => () => null
21
+ );
22
+
18
23
  jest.mock("react-native-safe-area-context", () => ({
19
24
  SafeAreaProvider: jest.fn(
20
25
  () =>
package/App/index.tsx CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as React from "react";
2
2
  import * as R from "ramda";
3
3
  import {
4
- SafeAreaProvider,
5
4
  initialWindowMetrics,
5
+ SafeAreaProvider,
6
6
  } from "react-native-safe-area-context";
7
7
 
8
8
  import { ErrorBoundary } from "./ErrorBoundary";
@@ -27,16 +27,15 @@ import {
27
27
  import { withURLSchemeContextProvider } from "./DeepLinking/URLSchemeListener/URLSchemeContextProvider";
28
28
  import { appRemoteDataLoader } from "./appRemoteDataLoader";
29
29
  import { withActionExecutor } from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutorContext";
30
+ import { withScreenDataContextProvider } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenDataContext";
31
+ import { LogicAggregatorContainer } from "./LogicAggregatorContainer";
30
32
 
31
- /**
32
- * @typedef {Object} AppOptions
33
- * @param {Function} InteractionManager decorator to use for managing complex user interactions in the app
34
- * @param {ReactComponent} Layout Component to use as main layout for the app
35
-
36
- * @param {Object} QuickBrickManager QB manager module
37
- * @param {Function} QuickBrickManager.sendQuickBrickEvent function invoked to pass events to the native side
38
- * @param {[Function]} ContextProviders array of context providers to pass to the app
39
- */
33
+ interface AppOptions {
34
+ Layout: React.ComponentType;
35
+ OfflineHandler: React.ComponentType;
36
+ SplashLoader: React.ComponentType;
37
+ InteractionManager: React.ComponentType;
38
+ }
40
39
 
41
40
  /**
42
41
  * Creates a QuickBrick app with the provided options
@@ -44,12 +43,19 @@ import { withActionExecutor } from "@applicaster/zapp-react-native-utils/actions
44
43
  * @param {AppOptions} options
45
44
  * @returns {ReactComponent}
46
45
  */
47
- const App = ({ Layout, OfflineHandler, SplashLoader }): ZappApp =>
48
- React.memo(function ZappApp({
49
- styles,
50
- components: { AppContainer },
51
- plugins,
52
- }: AppComponentProps) {
46
+ const App = ({
47
+ Layout,
48
+ OfflineHandler,
49
+ SplashLoader,
50
+ InteractionManager,
51
+ }: AppOptions): ZappApp =>
52
+ React.memo(function ZappApp(props: AppComponentProps) {
53
+ const {
54
+ styles,
55
+ components: { AppContainer },
56
+ plugins,
57
+ } = props;
58
+
53
59
  return (
54
60
  <ThemeManager plugins={plugins}>
55
61
  <SafeAreaProvider initialMetrics={initialWindowMetrics}>
@@ -58,15 +64,16 @@ const App = ({ Layout, OfflineHandler, SplashLoader }): ZappApp =>
58
64
  <URLSchemeListener>
59
65
  <SplashLoader>
60
66
  <OfflineHandler>
61
- <ApplyScreenHooks>
62
- <Layout>
63
- <RouteManager />
64
- </Layout>
65
- </ApplyScreenHooks>
67
+ <Layout>
68
+ <RouteManager />
69
+ </Layout>
66
70
  </OfflineHandler>
67
71
  </SplashLoader>
68
72
  <ModalProvider />
69
73
  </URLSchemeListener>
74
+ <LogicAggregatorContainer
75
+ components={[InteractionManager, ApplyScreenHooks]}
76
+ />
70
77
  </ErrorBoundary>
71
78
  </AppContainer>
72
79
  </SafeAreaProvider>
@@ -76,7 +83,7 @@ const App = ({ Layout, OfflineHandler, SplashLoader }): ZappApp =>
76
83
 
77
84
  export function createQuickBrickApp(options): ZappApp {
78
85
  const {
79
- InteractionManager = R.identity,
86
+ InteractionManager = () => null,
80
87
  Layout,
81
88
  QuickBrickManager,
82
89
  OfflineHandler = R.prop("children"),
@@ -94,15 +101,15 @@ export function createQuickBrickApp(options): ZappApp {
94
101
  storeConnector, // storeConnector should be first, as it disregards other props
95
102
  ...ContextProviders, // contexts consumers are only working below this point
96
103
  appRemoteDataLoader,
97
- withAppManager, // provides handlers when the app is going in the background, or comes out of it
104
+ withAppManager, // provides handlers when the app is going in the background, or comes out of it, can be moved to LogicAggregatorContainer
98
105
  ZappPipesEntryContext.withProvider,
99
106
  withURLSchemeContextProvider,
100
107
  withNetworkStatusProvider,
101
108
  withNavigationProvider,
109
+ withScreenDataContextProvider,
102
110
  ZappPipesSearchContext.withProvider,
103
- InteractionManager,
104
111
  withActionExecutor,
105
112
  withActionsProvider,
106
- appLifeCycleManager(appLoader, QuickBrickManager)
107
- )(App({ Layout, OfflineHandler, SplashLoader }));
113
+ appLifeCycleManager(appLoader, QuickBrickManager) // can be moved to LogicAggregatorContainer
114
+ )(App({ Layout, OfflineHandler, SplashLoader, InteractionManager }));
108
115
  }
package/const/index.ts CHANGED
@@ -34,3 +34,7 @@ export const requiredSessionKeys = [
34
34
  "userAgent",
35
35
  "version_name",
36
36
  ];
37
+
38
+ export const QUICK_BRICK_NAVBAR = "quick-brick-navbar";
39
+
40
+ export const QUICK_BRICK_CONTENT = "quick-brick-content";
@@ -20,13 +20,13 @@ Object {
20
20
  "isAvailable": null,
21
21
  "nextState": null,
22
22
  },
23
- "isTransitioning": false,
24
23
  },
25
24
  "cellStyles": Object {},
26
25
  "components": Object {
27
26
  "AppContainer": [Function],
28
27
  "ContentScreen": [Function],
29
28
  "HookRenderer": [Function],
29
+ "ModalComponent": [Function],
30
30
  "PlayerContainer": Object {
31
31
  "$$typeof": Symbol(react.memo),
32
32
  "WrappedComponent": Object {
@@ -7,6 +7,10 @@
7
7
  import * as React from "react";
8
8
  import * as R from "ramda";
9
9
  import { Dimensions } from "react-native";
10
+ import {
11
+ isNotEmpty,
12
+ isNotNil,
13
+ } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
10
14
 
11
15
  import {
12
16
  createZappReduxStore,
@@ -27,6 +31,9 @@ import { remoteDataLoader } from "../App/appRemoteDataLoader/remoteDataLoader";
27
31
  import * as QuickBrickManager from "@applicaster/zapp-react-native-bridge/QuickBrick";
28
32
  import { isAndroidPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
29
33
 
34
+ const isNotEmptyObject = (value: unknown) =>
35
+ isNotNil(value) && R.is(Object, value) && isNotEmpty(value);
36
+
30
37
  /**
31
38
  * Creates a Zapp App with the provided options
32
39
  * @export
@@ -55,8 +62,8 @@ export function createZappApp(zappAppConfig: ZappAppConfig) {
55
62
 
56
63
  const useTabletLayout =
57
64
  isTablet({ width, height }, width > height ? "landscape" : "portrait") &&
58
- tabletLayout &&
59
- tabletCellStyles;
65
+ isNotEmptyObject(tabletLayout) &&
66
+ isNotEmptyObject(tabletCellStyles);
60
67
 
61
68
  function fetchPluginConfiguration(plugin) {
62
69
  const configuration = R.compose(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-core",
3
- "version": "12.0.0-alpha.7725319213",
3
+ "version": "12.0.0-alpha.7843515010",
4
4
  "description": "Core package for Applicaster's Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -30,15 +30,15 @@
30
30
  },
31
31
  "homepage": "https://github.com/applicaster/quickbrick#readme",
32
32
  "dependencies": {
33
- "@applicaster/applicaster-types": "12.0.0-alpha.7725319213",
34
- "@applicaster/quick-brick-core-plugins": "12.0.0-alpha.7725319213",
35
- "@applicaster/zapp-pipes-v2-client": "12.0.0-alpha.7725319213",
36
- "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.7725319213",
37
- "@applicaster/zapp-react-native-redux": "12.0.0-alpha.7725319213",
38
- "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.7725319213",
39
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.7725319213",
33
+ "@applicaster/applicaster-types": "12.0.0-alpha.7843515010",
34
+ "@applicaster/quick-brick-core-plugins": "12.0.0-alpha.7843515010",
35
+ "@applicaster/zapp-pipes-v2-client": "12.0.0-alpha.7843515010",
36
+ "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.7843515010",
37
+ "@applicaster/zapp-react-native-redux": "12.0.0-alpha.7843515010",
38
+ "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.7843515010",
39
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.7843515010",
40
40
  "atob": "^2.1.2",
41
- "axios": "^0.21.2",
41
+ "axios": "^0.28.0",
42
42
  "btoa": "^1.2.1",
43
43
  "camelize": "^1.0.0",
44
44
  "md5": "^2.3.0",