@applicaster/quick-brick-core 13.0.0-alpha.9946926334 → 13.0.0-rc.100
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/App/DeepLinking/URLSchemeListener/URLSchemeContextProvider.tsx +14 -7
- package/App/DeepLinking/URLSchemeListener/__tests__/URLSchemeListener.test.js +40 -0
- package/App/DeepLinking/URLSchemeListener/index.tsx +1 -1
- package/App/ErrorBoundary/__tests__/errorBoundary.test.jsx +232 -0
- package/App/ErrorBoundary/__tests__/store.test.js +143 -0
- package/App/ErrorBoundary/index.tsx +45 -21
- package/App/ErrorBoundary/store.ts +26 -0
- package/App/LoadingOverlay/LoadingOverlayManager.tsx +27 -0
- package/App/LoadingOverlay/index.tsx +49 -0
- package/App/LoadingOverlay/useLoadingOverlayVisibility.tsx +18 -0
- package/App/ModalProvider/ModalBottomSheet/Overlay.tsx +5 -7
- package/App/ModalProvider/ModalBottomSheet/index.tsx +6 -10
- package/App/ModalProvider/index.tsx +5 -6
- package/App/NavigationProvider/NavigationProvider.tsx +56 -43
- package/App/NavigationProvider/__tests__/navigationProvider.test.tsx +0 -44
- package/App/NetworkStatusProvider/utils.ts +0 -1
- package/App/StoreConnector/__tests__/storeConnector.test.js +17 -11
- package/App/appLifeCycleManager/__tests__/appLifeCycleManager.test.tsx +146 -0
- package/App/appLifeCycleManager/index.tsx +6 -7
- package/App/index.tsx +6 -3
- package/App/remoteContextReloader/__tests__/remoteContextReloader.test.js +11 -21
- package/App/remoteContextReloader/getRemoteContextData/getNativeRemoteContextData.ts +14 -0
- package/createZappApp/__tests__/__snapshots__/createZappApp.test.js.snap +5 -128
- package/createZappApp/__tests__/createZappApp.test.js +7 -20
- package/defaults/__tests__/defaults.test.js +3 -4
- package/index.d.ts +1 -1
- package/package.json +10 -14
- package/App/DeepLinking/URLSchemeListener/__tests__/URLSchemeListenerTest.js +0 -177
- package/App/ErrorBoundary/__tests__/__snapshots__/errorBoundary.test.js.snap +0 -9
- package/App/ErrorBoundary/__tests__/errorBoundary.test.js +0 -72
- package/App/ModalProvider/ModalChildrenWrapper/index.web.ts +0 -1
- package/App/NavigationProvider/__tests__/__snapshots__/navigationProvider.test.tsx.snap +0 -68
- package/App/StoreConnector/__tests__/__snapshots__/storeConnector.test.js.snap +0 -35
- package/App/appLifeCycleManager/__tests__/__snapshots__/appLifeCycleManager.test.js.snap +0 -30
- package/App/appLifeCycleManager/__tests__/appLifeCycleManager.test.js +0 -134
- package/App/remoteContextReloader/__tests__/__snapshots__/remoteContextReloader.test.js.snap +0 -43
- /package/App/ModalProvider/ModalChildrenWrapper/{index.ios.ts → index.ts} +0 -0
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`<NavigationProvider /> modal feature removes the visible flag when dismissing a modal 1`] = `
|
|
4
|
-
{
|
|
5
|
-
"options": {
|
|
6
|
-
"animated": true,
|
|
7
|
-
"animationType": "slide",
|
|
8
|
-
"onDismiss": [Function],
|
|
9
|
-
"onRequestClose": [Function],
|
|
10
|
-
"onShow": [Function],
|
|
11
|
-
"presentationStyle": "overFullScreen",
|
|
12
|
-
"transparent": true,
|
|
13
|
-
},
|
|
14
|
-
"props": undefined,
|
|
15
|
-
"screen": {
|
|
16
|
-
"id": "A1234",
|
|
17
|
-
"navigations": [],
|
|
18
|
-
"ui_components": [],
|
|
19
|
-
},
|
|
20
|
-
"visible": true,
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
exports[`<NavigationProvider /> modal feature removes the visible flag when dismissing a modal 2`] = `
|
|
25
|
-
{
|
|
26
|
-
"options": {},
|
|
27
|
-
"props": {},
|
|
28
|
-
"screen": null,
|
|
29
|
-
"visible": false,
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
exports[`<NavigationProvider /> modal feature sets the modalState when opening a modal 1`] = `undefined`;
|
|
34
|
-
|
|
35
|
-
exports[`<NavigationProvider /> modal feature should reset state to initial when dismissing a modal ( closeModalBottomSheet ) opened by openModalBottomSheet 1`] = `
|
|
36
|
-
{
|
|
37
|
-
"options": {
|
|
38
|
-
"animated": false,
|
|
39
|
-
"animationType": "none",
|
|
40
|
-
"onDismiss": [Function],
|
|
41
|
-
"onRequestClose": [Function],
|
|
42
|
-
"onShow": [Function],
|
|
43
|
-
"presentationStyle": "overFullScreen",
|
|
44
|
-
"transparent": true,
|
|
45
|
-
},
|
|
46
|
-
"props": {},
|
|
47
|
-
"screen": {
|
|
48
|
-
"ModalBottomSheetContent": {
|
|
49
|
-
"id": "A1234",
|
|
50
|
-
"navigations": [],
|
|
51
|
-
"ui_components": [],
|
|
52
|
-
},
|
|
53
|
-
"modalBottomSheetContentProps": {
|
|
54
|
-
"some": "props",
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
"visible": true,
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
exports[`<NavigationProvider /> modal feature should reset state to initial when dismissing a modal ( closeModalBottomSheet ) opened by openModalBottomSheet 2`] = `
|
|
62
|
-
{
|
|
63
|
-
"options": {},
|
|
64
|
-
"props": {},
|
|
65
|
-
"screen": null,
|
|
66
|
-
"visible": false,
|
|
67
|
-
}
|
|
68
|
-
`;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`storeConnector passes the props to the component 1`] = `
|
|
4
|
-
<Component
|
|
5
|
-
appSettings={
|
|
6
|
-
{
|
|
7
|
-
"bundleIdentifier": "com.app.test",
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
components={
|
|
11
|
-
{
|
|
12
|
-
"grid": [MockFunction],
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
dispatch={[Function]}
|
|
16
|
-
rivers={
|
|
17
|
-
{
|
|
18
|
-
"A123": {
|
|
19
|
-
"id": "A123",
|
|
20
|
-
"name": "home",
|
|
21
|
-
},
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
store={
|
|
25
|
-
{
|
|
26
|
-
"clearActions": [Function],
|
|
27
|
-
"dispatch": [Function],
|
|
28
|
-
"getActions": [Function],
|
|
29
|
-
"getState": [Function],
|
|
30
|
-
"replaceReducer": [Function],
|
|
31
|
-
"subscribe": [Function],
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/>
|
|
35
|
-
`;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`appLifeCycleManager runs the loaders, then sends quickBrickReady event 1`] = `
|
|
4
|
-
<View>
|
|
5
|
-
<Text>
|
|
6
|
-
I'm a component
|
|
7
|
-
</Text>
|
|
8
|
-
</View>
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
exports[`appLifeCycleManager sends the quickBrickReady event when a loader doesn't resolves 1`] = `
|
|
12
|
-
<View>
|
|
13
|
-
<Text>
|
|
14
|
-
I'm a component
|
|
15
|
-
</Text>
|
|
16
|
-
</View>
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
exports[`appLifeCycleManager sends the quickBrickReady event when a loader doesn't resolves 2`] = `
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
{
|
|
23
|
-
"data": {
|
|
24
|
-
"error": [Error: loading failed],
|
|
25
|
-
},
|
|
26
|
-
"message": "AppLifeCycleManager: A loading operation failed: loading failed",
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
]
|
|
30
|
-
`;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, Text } from "react-native";
|
|
3
|
-
import { create, act } from "react-test-renderer";
|
|
4
|
-
|
|
5
|
-
const Component = () => (
|
|
6
|
-
<View>
|
|
7
|
-
<Text>I'm a component</Text>
|
|
8
|
-
</View>
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
const mockLogger = {
|
|
12
|
-
warning: jest.fn(),
|
|
13
|
-
log: jest.fn(),
|
|
14
|
-
debug: jest.fn(),
|
|
15
|
-
info: jest.fn(),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
jest.mock("../../logger", () => ({
|
|
19
|
-
coreAppLogger: {
|
|
20
|
-
addSubsystem: jest.fn(() => mockLogger),
|
|
21
|
-
},
|
|
22
|
-
}));
|
|
23
|
-
|
|
24
|
-
const QuickBrickManager = {
|
|
25
|
-
sendQuickBrickEvent: jest.fn(),
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const LOADING_ERROR = new Error("loading failed");
|
|
29
|
-
|
|
30
|
-
const appLoader = jest.fn((_dispatch, _getState) => {
|
|
31
|
-
if (_getState().shouldFail) return Promise.reject(LOADING_ERROR);
|
|
32
|
-
|
|
33
|
-
return Promise.resolve();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const dispatch = jest.fn();
|
|
37
|
-
|
|
38
|
-
const state = {
|
|
39
|
-
rivers: {},
|
|
40
|
-
plugins: {},
|
|
41
|
-
appSettings: { runtimeConfigurationUrls: { rivers: "http://rivers.url" } },
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const QUICK_BRICK_READY_EVENT = "quickBrickReady";
|
|
45
|
-
|
|
46
|
-
const actions = {};
|
|
47
|
-
|
|
48
|
-
jest.doMock("@applicaster/zapp-react-native-utils/reactHooks/actions", () => ({
|
|
49
|
-
useActions: jest.fn(() => ({ actions })),
|
|
50
|
-
}));
|
|
51
|
-
|
|
52
|
-
const { appLifeCycleManager } = require("../index");
|
|
53
|
-
|
|
54
|
-
describe("appLifeCycleManager", () => {
|
|
55
|
-
const decorator = appLifeCycleManager(appLoader, QuickBrickManager);
|
|
56
|
-
|
|
57
|
-
beforeEach(() => {
|
|
58
|
-
mockLogger.warning.mockClear();
|
|
59
|
-
appLoader.mockClear();
|
|
60
|
-
QuickBrickManager.sendQuickBrickEvent.mockClear();
|
|
61
|
-
dispatch.mockClear();
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it("returns a function to decorate a component", () => {
|
|
65
|
-
expect(decorator).toBeFunction();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it("runs the loaders, then sends quickBrickReady event", (done) => {
|
|
69
|
-
const DecoratedComponent = decorator(Component);
|
|
70
|
-
|
|
71
|
-
let wrapper;
|
|
72
|
-
|
|
73
|
-
const testCallback = () => {
|
|
74
|
-
expect(dispatch).toHaveBeenCalledWith(
|
|
75
|
-
expect.objectContaining({ type: "SET_APP_READY" })
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
expect(QuickBrickManager.sendQuickBrickEvent).toHaveBeenCalledWith(
|
|
79
|
-
QUICK_BRICK_READY_EVENT
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
done();
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
act(() => {
|
|
86
|
-
wrapper = create(
|
|
87
|
-
<DecoratedComponent
|
|
88
|
-
dispatch={dispatch}
|
|
89
|
-
{...state}
|
|
90
|
-
testCallback={testCallback}
|
|
91
|
-
/>
|
|
92
|
-
);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
96
|
-
expect(appLoader).toHaveBeenCalled();
|
|
97
|
-
expect.assertions(4);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it("sends the quickBrickReady event when a loader doesn't resolves", (done) => {
|
|
101
|
-
const DecoratedComponent = decorator(Component);
|
|
102
|
-
|
|
103
|
-
let wrapper;
|
|
104
|
-
|
|
105
|
-
const testCallback = () => {
|
|
106
|
-
expect(dispatch).toHaveBeenCalledWith(
|
|
107
|
-
expect.objectContaining({ type: "SET_APP_READY" })
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
expect(QuickBrickManager.sendQuickBrickEvent).toHaveBeenCalledWith(
|
|
111
|
-
QUICK_BRICK_READY_EVENT
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
expect(mockLogger.warning.mock.calls).toMatchSnapshot();
|
|
115
|
-
|
|
116
|
-
done();
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
act(() => {
|
|
120
|
-
wrapper = create(
|
|
121
|
-
<DecoratedComponent
|
|
122
|
-
dispatch={dispatch}
|
|
123
|
-
{...state}
|
|
124
|
-
shouldFail
|
|
125
|
-
testCallback={testCallback}
|
|
126
|
-
/>
|
|
127
|
-
);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
131
|
-
expect(appLoader).toHaveBeenCalled();
|
|
132
|
-
expect.assertions(5);
|
|
133
|
-
});
|
|
134
|
-
});
|
package/App/remoteContextReloader/__tests__/__snapshots__/remoteContextReloader.test.js.snap
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`remoteContextReloader adds a componentDidMount method 1`] = `
|
|
4
|
-
<Component
|
|
5
|
-
appSettings={
|
|
6
|
-
{
|
|
7
|
-
"runtimeConfigurationUrls": {
|
|
8
|
-
"foo": "bar",
|
|
9
|
-
},
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
dispatch={[MockFunction]}
|
|
13
|
-
plugins={[]}
|
|
14
|
-
/>
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
exports[`remoteContextReloader when in __DEV__ doesn't invoke the context reloader 1`] = `
|
|
18
|
-
<Component
|
|
19
|
-
appSettings={
|
|
20
|
-
{
|
|
21
|
-
"runtimeConfigurationUrls": {
|
|
22
|
-
"foo": "bar",
|
|
23
|
-
},
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
dispatch={[MockFunction]}
|
|
27
|
-
plugins={[]}
|
|
28
|
-
/>
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
exports[`remoteContextReloader when not in __DEV__ invokes the context reloader 1`] = `
|
|
32
|
-
<Component
|
|
33
|
-
appSettings={
|
|
34
|
-
{
|
|
35
|
-
"runtimeConfigurationUrls": {
|
|
36
|
-
"foo": "bar",
|
|
37
|
-
},
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
dispatch={[MockFunction]}
|
|
41
|
-
plugins={[]}
|
|
42
|
-
/>
|
|
43
|
-
`;
|
|
File without changes
|