@applicaster/quick-brick-core 12.0.0-rc.11 → 12.0.0-rc.111

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 -31
  23. package/const/index.ts +4 -0
  24. package/createZappApp/__tests__/__snapshots__/createZappApp.test.js.snap +1 -1
  25. package/createZappApp/{index.js → index.tsx} +9 -7
  26. package/package.json +9 -10
@@ -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,15 +1,10 @@
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
- import type {
9
- AppComponentProps,
10
- ZappApp,
11
- } from "@applicaster/zapp-react-native-flow-types";
12
-
13
8
  import { ErrorBoundary } from "./ErrorBoundary";
14
9
  import { RouteManager } from "./RouteManager";
15
10
  import { withNavigationProvider } from "./NavigationProvider";
@@ -32,16 +27,15 @@ import {
32
27
  import { withURLSchemeContextProvider } from "./DeepLinking/URLSchemeListener/URLSchemeContextProvider";
33
28
  import { appRemoteDataLoader } from "./appRemoteDataLoader";
34
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";
35
32
 
36
- /**
37
- * @typedef {Object} AppOptions
38
- * @param {Function} InteractionManager decorator to use for managing complex user interactions in the app
39
- * @param {ReactComponent} Layout Component to use as main layout for the app
40
-
41
- * @param {Object} QuickBrickManager QB manager module
42
- * @param {Function} QuickBrickManager.sendQuickBrickEvent function invoked to pass events to the native side
43
- * @param {[Function]} ContextProviders array of context providers to pass to the app
44
- */
33
+ interface AppOptions {
34
+ Layout: React.ComponentType;
35
+ OfflineHandler: React.ComponentType;
36
+ SplashLoader: React.ComponentType;
37
+ InteractionManager: React.ComponentType;
38
+ }
45
39
 
46
40
  /**
47
41
  * Creates a QuickBrick app with the provided options
@@ -49,12 +43,19 @@ import { withActionExecutor } from "@applicaster/zapp-react-native-utils/actions
49
43
  * @param {AppOptions} options
50
44
  * @returns {ReactComponent}
51
45
  */
52
- const App = ({ Layout, OfflineHandler, SplashLoader }): ZappApp =>
53
- React.memo(function ZappApp({
54
- styles,
55
- components: { AppContainer },
56
- plugins,
57
- }: 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
+
58
59
  return (
59
60
  <ThemeManager plugins={plugins}>
60
61
  <SafeAreaProvider initialMetrics={initialWindowMetrics}>
@@ -63,15 +64,16 @@ const App = ({ Layout, OfflineHandler, SplashLoader }): ZappApp =>
63
64
  <URLSchemeListener>
64
65
  <SplashLoader>
65
66
  <OfflineHandler>
66
- <ApplyScreenHooks>
67
- <Layout>
68
- <RouteManager />
69
- </Layout>
70
- </ApplyScreenHooks>
67
+ <Layout>
68
+ <RouteManager />
69
+ </Layout>
71
70
  </OfflineHandler>
72
71
  </SplashLoader>
73
72
  <ModalProvider />
74
73
  </URLSchemeListener>
74
+ <LogicAggregatorContainer
75
+ components={[InteractionManager, ApplyScreenHooks]}
76
+ />
75
77
  </ErrorBoundary>
76
78
  </AppContainer>
77
79
  </SafeAreaProvider>
@@ -81,7 +83,7 @@ const App = ({ Layout, OfflineHandler, SplashLoader }): ZappApp =>
81
83
 
82
84
  export function createQuickBrickApp(options): ZappApp {
83
85
  const {
84
- InteractionManager = R.identity,
86
+ InteractionManager = () => null,
85
87
  Layout,
86
88
  QuickBrickManager,
87
89
  OfflineHandler = R.prop("children"),
@@ -99,15 +101,15 @@ export function createQuickBrickApp(options): ZappApp {
99
101
  storeConnector, // storeConnector should be first, as it disregards other props
100
102
  ...ContextProviders, // contexts consumers are only working below this point
101
103
  appRemoteDataLoader,
102
- 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
103
105
  ZappPipesEntryContext.withProvider,
104
106
  withURLSchemeContextProvider,
105
107
  withNetworkStatusProvider,
106
108
  withNavigationProvider,
109
+ withScreenDataContextProvider,
107
110
  ZappPipesSearchContext.withProvider,
108
- InteractionManager,
109
111
  withActionExecutor,
110
112
  withActionsProvider,
111
- appLifeCycleManager(appLoader, QuickBrickManager)
112
- )(App({ Layout, OfflineHandler, SplashLoader }));
113
+ appLifeCycleManager(appLoader, QuickBrickManager) // can be moved to LogicAggregatorContainer
114
+ )(App({ Layout, OfflineHandler, SplashLoader, InteractionManager }));
113
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,11 +7,10 @@
7
7
  import * as React from "react";
8
8
  import * as R from "ramda";
9
9
  import { Dimensions } from "react-native";
10
-
11
- import type {
12
- AppComponentProps,
13
- ZappAppConfig,
14
- } from "@applicaster/zapp-react-native-flow-types";
10
+ import {
11
+ isNotEmpty,
12
+ isNotNil,
13
+ } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
15
14
 
16
15
  import {
17
16
  createZappReduxStore,
@@ -32,6 +31,9 @@ import { remoteDataLoader } from "../App/appRemoteDataLoader/remoteDataLoader";
32
31
  import * as QuickBrickManager from "@applicaster/zapp-react-native-bridge/QuickBrick";
33
32
  import { isAndroidPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
34
33
 
34
+ const isNotEmptyObject = (value: unknown) =>
35
+ isNotNil(value) && R.is(Object, value) && isNotEmpty(value);
36
+
35
37
  /**
36
38
  * Creates a Zapp App with the provided options
37
39
  * @export
@@ -60,8 +62,8 @@ export function createZappApp(zappAppConfig: ZappAppConfig) {
60
62
 
61
63
  const useTabletLayout =
62
64
  isTablet({ width, height }, width > height ? "landscape" : "portrait") &&
63
- tabletLayout &&
64
- tabletCellStyles;
65
+ isNotEmptyObject(tabletLayout) &&
66
+ isNotEmptyObject(tabletCellStyles);
65
67
 
66
68
  function fetchPluginConfiguration(plugin) {
67
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-rc.11",
3
+ "version": "12.0.0-rc.111",
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-rc.11",
34
- "@applicaster/quick-brick-core-plugins": "12.0.0-rc.11",
35
- "@applicaster/zapp-pipes-v2-client": "12.0.0-rc.11",
36
- "@applicaster/zapp-react-native-bridge": "12.0.0-rc.11",
37
- "@applicaster/zapp-react-native-redux": "12.0.0-rc.11",
38
- "@applicaster/zapp-react-native-ui-components": "12.0.0-rc.11",
39
- "@applicaster/zapp-react-native-utils": "12.0.0-rc.11",
33
+ "@applicaster/applicaster-types": "12.0.0-rc.111",
34
+ "@applicaster/quick-brick-core-plugins": "12.0.0-rc.111",
35
+ "@applicaster/zapp-pipes-v2-client": "12.0.0-rc.111",
36
+ "@applicaster/zapp-react-native-bridge": "12.0.0-rc.111",
37
+ "@applicaster/zapp-react-native-redux": "12.0.0-rc.111",
38
+ "@applicaster/zapp-react-native-ui-components": "12.0.0-rc.111",
39
+ "@applicaster/zapp-react-native-utils": "12.0.0-rc.111",
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",
@@ -58,7 +58,6 @@
58
58
  "react-native-safe-area-context": "*"
59
59
  },
60
60
  "devDependencies": {
61
- "@applicaster/zapp-react-native-flow-types": "1.5.0",
62
61
  "@types/react-native": "0.69.6",
63
62
  "@types/tizen-tv-webapis": "^2.0.1",
64
63
  "nock": "^10.0.0",