@applicaster/quick-brick-core 14.0.0-alpha.3881160800 → 14.0.0-alpha.3890252181

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.
@@ -12,7 +12,6 @@ const debugActions = (actions) =>
12
12
  message: `useSubscribeToActionProviders - available actions count: ${
13
13
  Object.keys(actions).length
14
14
  }`,
15
- data: { actions },
16
15
  });
17
16
 
18
17
  const warnUndefinedContext = (context) =>
@@ -12,18 +12,18 @@ exports[`Actions Provider renders children 1`] = `
12
12
  "$$typeof": Symbol(react.context),
13
13
  "Consumer": {
14
14
  "$$typeof": Symbol(react.context),
15
+ "_calculateChangedBits": null,
15
16
  "_context": [Circular],
16
17
  },
17
18
  "Provider": {
18
19
  "$$typeof": Symbol(react.provider),
19
20
  "_context": [Circular],
20
21
  },
22
+ "_calculateChangedBits": null,
21
23
  "_currentRenderer": null,
22
24
  "_currentRenderer2": {},
23
25
  "_currentValue": null,
24
26
  "_currentValue2": null,
25
- "_defaultValue": null,
26
- "_globalName": null,
27
27
  "_threadCount": 0,
28
28
  },
29
29
  "contextProvider": [Function],
@@ -16,7 +16,7 @@ import {
16
16
  } from "../useOpenSchemeHandler/const";
17
17
  import { withInitialPlayerState } from "../useOpenSchemeHandler/utils";
18
18
 
19
- import { log_warning } from "../../../logger";
19
+ const { log_warning } = require("../../../logger");
20
20
 
21
21
  const rivers: Record<string, Partial<ZappRiver>> = {
22
22
  A1234: {
@@ -53,10 +53,13 @@ const navigator = {
53
53
  replace: jest.fn(),
54
54
  push: jest.fn(),
55
55
  goHome: jest.fn(),
56
- } as any;
56
+ };
57
57
 
58
58
  const mockStore = configureStore();
59
- jest.spyOn(useNavigationHooks, "useNavigation").mockReturnValue(navigator);
59
+
60
+ jest
61
+ .spyOn(useNavigationHooks, "useNavigation")
62
+ .mockImplementation(() => navigator);
60
63
 
61
64
  const helperSpy = jest.spyOn(helpers, "handlePresentNavigation");
62
65
  const feedLoaderSpy = jest.spyOn(feedLoader, "useFeedLoader");
@@ -69,7 +72,7 @@ jest.doMock("@applicaster/zapp-react-native-ui-components/Contexts", () => ({
69
72
  },
70
73
  }));
71
74
 
72
- jest.mock("../../../logger", () => ({
75
+ jest.doMock("../../../logger", () => ({
73
76
  log_info: jest.fn(),
74
77
  log_error: jest.fn(),
75
78
  log_warning: jest.fn(),
@@ -77,6 +80,10 @@ jest.mock("../../../logger", () => ({
77
80
  log_debug: jest.fn(),
78
81
  }));
79
82
 
83
+ jest.useFakeTimers({
84
+ legacyFakeTimers: true,
85
+ });
86
+
80
87
  // to use import instead of require it's required to use jest.mock above
81
88
  const { useOpenSchemeHandler } = require("../useOpenSchemeHandler");
82
89
 
@@ -185,6 +192,7 @@ describe("useOpenSchemeHandler", () => {
185
192
  it("doesn't log a warning", async () => {
186
193
  const tests = () => {
187
194
  expect(log_warning).not.toHaveBeenCalled();
195
+ expect.assertions(1);
188
196
  };
189
197
 
190
198
  await testHook({ url, query, tests });
@@ -1,13 +1,14 @@
1
+ import * as React from "react";
1
2
  import * as R from "ramda";
2
3
  import axios from "axios";
3
- import { renderHook } from "@testing-library/react-native";
4
+ import { renderHook } from "@testing-library/react-hooks";
4
5
  import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
6
+ import * as zappRedux from "@applicaster/zapp-react-native-redux";
5
7
  import * as helpers from "../../../helpers";
6
8
  import * as feedLoader from "@applicaster/zapp-react-native-utils/reactHooks/feed/useFeedLoader";
7
9
  import * as useNavigationHooks from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
8
- import { WrappedWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
9
- import { usePresentSchemeHandler } from "../usePresentSchemeHandler";
10
10
 
11
+ import { Provider } from "react-redux";
11
12
  import configureStore from "redux-mock-store";
12
13
 
13
14
  const rivers = {
@@ -19,22 +20,23 @@ const rivers = {
19
20
  const navigator = {
20
21
  currentRoute: "/river/A1234",
21
22
  replace: jest.fn(),
22
- goHome: jest.fn(),
23
- } as any;
23
+ };
24
24
 
25
25
  const mockStore = configureStore();
26
26
 
27
- jest.spyOn(useNavigationHooks, "useNavigation").mockReturnValue(navigator);
27
+ jest
28
+ .spyOn(useNavigationHooks, "useNavigation")
29
+ .mockImplementation(() => navigator);
28
30
 
29
31
  const helperSpy = jest.spyOn(helpers, "handlePresentNavigation");
30
32
  const feedLoaderSpy = jest.spyOn(feedLoader, "useFeedLoader");
31
33
 
34
+ const { usePresentSchemeHandler } = require("../usePresentSchemeHandler");
35
+
32
36
  const onFinish = jest.fn((cb) => {
33
37
  cb();
34
38
  });
35
39
 
36
- jest.useFakeTimers();
37
-
38
40
  describe("usePresentSchemeHandler", () => {
39
41
  beforeEach(() => {
40
42
  onFinish.mockClear();
@@ -42,7 +44,11 @@ describe("usePresentSchemeHandler", () => {
42
44
  navigator.replace.mockClear();
43
45
  });
44
46
 
45
- const store = { test: "test", rivers };
47
+ const store = mockStore({ test: "test", rivers });
48
+
49
+ const wrapper: React.FC<any> = ({ children }) => (
50
+ <Provider store={store}>{children}</Provider>
51
+ );
46
52
 
47
53
  describe("loading link url", () => {
48
54
  const query = { link_url: "http://applicaster.com" };
@@ -53,11 +59,10 @@ describe("usePresentSchemeHandler", () => {
53
59
 
54
60
  it("opens the link entry", () => {
55
61
  renderHook(() => usePresentSchemeHandler({ query, url, onFinish }), {
56
- wrapper: WrappedWithProviders,
57
- initialProps: { store },
62
+ wrapper,
58
63
  });
59
64
 
60
- expect(onFinish).toHaveBeenCalled();
65
+ expect(onFinish).toBeCalled();
61
66
 
62
67
  expect(helperSpy).toBeCalledWith(
63
68
  expect.objectContaining({
@@ -91,8 +96,7 @@ describe("usePresentSchemeHandler", () => {
91
96
  onFinish,
92
97
  }),
93
98
  {
94
- wrapper: WrappedWithProviders,
95
- initialProps: { store },
99
+ wrapper,
96
100
  }
97
101
  );
98
102
 
@@ -119,8 +123,7 @@ describe("usePresentSchemeHandler", () => {
119
123
  )}&show_nav_bar=true`;
120
124
 
121
125
  renderHook(() => usePresentSchemeHandler({ query, url, onFinish }), {
122
- wrapper: WrappedWithProviders,
123
- initialProps: { store },
126
+ wrapper,
124
127
  });
125
128
 
126
129
  expect(onFinish).toBeCalled();
@@ -152,22 +155,22 @@ describe("usePresentSchemeHandler", () => {
152
155
  )}&screen_id=${screen_id}`;
153
156
 
154
157
  renderHook(() => usePresentSchemeHandler({ query, url, onFinish }), {
155
- wrapper: WrappedWithProviders,
156
- initialProps: { store },
158
+ wrapper,
157
159
  });
158
160
 
159
161
  expect(onFinish).toBeCalled();
160
162
 
161
- expect(helperSpy).toHaveBeenCalledWith(
163
+ expect(helperSpy).toBeCalledWith(
162
164
  expect.objectContaining({
163
165
  data: {
164
166
  id: "url_scheme_entry",
165
167
  type: { value: "link" },
168
+ screen_type: screen_id,
166
169
  link: { href: query.link_url, type: "text/html" },
167
170
  extensions: { showNavBar: false },
168
171
  },
169
- navigator: expect.anything(),
170
- pushScreen: "http://applicaster.com",
172
+ navigator,
173
+ pushScreen: expect.anything(),
171
174
  })
172
175
  );
173
176
  });
@@ -177,7 +180,9 @@ describe("usePresentSchemeHandler", () => {
177
180
  it("Re-sets app ready state and calls loadAppContextData with new river and cellStyles data", async () => {
178
181
  const store = mockStore({ test: "test" });
179
182
 
180
- const wrapper = WrappedWithProviders;
183
+ const wrapper: React.FC<any> = ({ children }) => (
184
+ <Provider store={store}>{children}</Provider>
185
+ );
181
186
 
182
187
  const query = {
183
188
  rivers_configuration_id: "test",
@@ -185,6 +190,7 @@ describe("usePresentSchemeHandler", () => {
185
190
 
186
191
  const storageSpy = jest.spyOn(sessionStorage, "getAllItems");
187
192
  const axiosGetSpy = jest.spyOn(axios, "get");
193
+ const zappReduxSpy = jest.spyOn(zappRedux, "loadAppContextData");
188
194
 
189
195
  const getAllItems = jest.fn().mockResolvedValue({
190
196
  accountsAccountId: "accountsAccountId",
@@ -198,6 +204,7 @@ describe("usePresentSchemeHandler", () => {
198
204
 
199
205
  storageSpy.mockImplementation(getAllItems);
200
206
  axiosGetSpy.mockImplementation(get);
207
+ zappReduxSpy.mockReturnValue(null);
201
208
 
202
209
  renderHook(() => usePresentSchemeHandler({ query, url: "", onFinish }), {
203
210
  wrapper,
@@ -210,6 +217,13 @@ describe("usePresentSchemeHandler", () => {
210
217
  actions?.find(R.propEq("type", "SET_APP_NOT_READY"))
211
218
  ).toBeDefined();
212
219
 
220
+ expect(actions?.find(R.propEq("type", "SET_APP_READY"))).toBeDefined();
221
+
222
+ expect(zappReduxSpy).toBeCalledWith(expect.any(Function), {
223
+ cellStyles: "url",
224
+ rivers: "url",
225
+ });
226
+
213
227
  expect(navigator.replace).toBeCalledWith({});
214
228
  };
215
229
  });
@@ -247,7 +261,7 @@ describe("usePresentSchemeHandler", () => {
247
261
  },
248
262
  }),
249
263
  {
250
- wrapper: WrappedWithProviders,
264
+ wrapper,
251
265
  }
252
266
  );
253
267
 
@@ -279,7 +293,7 @@ describe("usePresentSchemeHandler", () => {
279
293
  },
280
294
  }),
281
295
  {
282
- wrapper: WrappedWithProviders,
296
+ wrapper,
283
297
  }
284
298
  );
285
299
 
@@ -311,7 +325,7 @@ describe("usePresentSchemeHandler", () => {
311
325
  },
312
326
  }),
313
327
  {
314
- wrapper: WrappedWithProviders,
328
+ wrapper,
315
329
  }
316
330
  );
317
331
 
@@ -343,7 +357,7 @@ describe("usePresentSchemeHandler", () => {
343
357
  },
344
358
  }),
345
359
  {
346
- wrapper: WrappedWithProviders,
360
+ wrapper,
347
361
  }
348
362
  );
349
363
 
@@ -5,7 +5,7 @@ import * as URLHandlersMap from "..";
5
5
  import { Provider } from "react-redux";
6
6
  import configureStore from "redux-mock-store";
7
7
 
8
- import { log_warning } from "../../../logger";
8
+ const { log_warning } = require("../../../logger");
9
9
 
10
10
  const mockStore = configureStore();
11
11
 
@@ -60,6 +60,10 @@ export class ErrorBoundary extends React.Component<Props> {
60
60
  useErrorStore.getState().setError(error, info, recoverable);
61
61
  }
62
62
 
63
+ getDerivedStateFromError(_error) {
64
+ return { hasError: true };
65
+ }
66
+
63
67
  render() {
64
68
  return <ErrorBoundaryContent>{this.props.children}</ErrorBoundaryContent>;
65
69
  }
@@ -47,7 +47,7 @@ const getSheetHeight = ({ height, bottomOffset, maxHeight }) => {
47
47
  ios: height - bottomOffset,
48
48
  default:
49
49
  (height || maxHeight) -
50
- (!isAndroidVersionAtLeast(35) && isAndroidPlatform() ? bottomOffset : 0),
50
+ (isAndroidPlatform() && !isAndroidVersionAtLeast(35) ? bottomOffset : 0),
51
51
  });
52
52
  };
53
53
 
@@ -44,6 +44,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
44
44
  "supports_offline": false,
45
45
  "type": "general_content",
46
46
  },
47
+ "screenStateStore": [Function],
47
48
  },
48
49
  },
49
50
  "options": {
@@ -79,6 +80,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
79
80
  "supports_offline": false,
80
81
  "type": "general_content",
81
82
  },
83
+ "screenStateStore": undefined,
82
84
  },
83
85
  },
84
86
  ],
@@ -114,6 +116,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
114
116
  "supports_offline": false,
115
117
  "type": "general_content",
116
118
  },
119
+ "screenStateStore": [Function],
117
120
  },
118
121
  },
119
122
  "options": {
@@ -149,6 +152,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
149
152
  "supports_offline": false,
150
153
  "type": "general_content",
151
154
  },
155
+ "screenStateStore": undefined,
152
156
  },
153
157
  },
154
158
  {
@@ -180,6 +184,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
180
184
  "supports_offline": false,
181
185
  "type": "general_content",
182
186
  },
187
+ "screenStateStore": undefined,
183
188
  },
184
189
  },
185
190
  ],
@@ -215,6 +220,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
215
220
  "supports_offline": false,
216
221
  "type": "general_content",
217
222
  },
223
+ "screenStateStore": [Function],
218
224
  },
219
225
  },
220
226
  "options": {
@@ -250,6 +256,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
250
256
  "supports_offline": false,
251
257
  "type": "general_content",
252
258
  },
259
+ "screenStateStore": undefined,
253
260
  },
254
261
  },
255
262
  {
@@ -281,6 +288,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
281
288
  "supports_offline": false,
282
289
  "type": "general_content",
283
290
  },
291
+ "screenStateStore": undefined,
284
292
  },
285
293
  },
286
294
  {
@@ -312,6 +320,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
312
320
  "supports_offline": false,
313
321
  "type": "general_content",
314
322
  },
323
+ "screenStateStore": undefined,
315
324
  },
316
325
  },
317
326
  ],
@@ -348,6 +357,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
348
357
  "supports_offline": false,
349
358
  "type": "general_content",
350
359
  },
360
+ "screenStateStore": undefined,
351
361
  },
352
362
  },
353
363
  "options": {
@@ -383,6 +393,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
383
393
  "supports_offline": false,
384
394
  "type": "general_content",
385
395
  },
396
+ "screenStateStore": undefined,
386
397
  },
387
398
  },
388
399
  {
@@ -414,6 +425,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
414
425
  "supports_offline": false,
415
426
  "type": "general_content",
416
427
  },
428
+ "screenStateStore": undefined,
417
429
  },
418
430
  },
419
431
  ],
@@ -449,6 +461,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
449
461
  "supports_offline": false,
450
462
  "type": "general_content",
451
463
  },
464
+ "screenStateStore": [Function],
452
465
  },
453
466
  },
454
467
  "options": {
@@ -484,6 +497,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
484
497
  "supports_offline": false,
485
498
  "type": "general_content",
486
499
  },
500
+ "screenStateStore": undefined,
487
501
  },
488
502
  },
489
503
  {
@@ -515,6 +529,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
515
529
  "supports_offline": false,
516
530
  "type": "general_content",
517
531
  },
532
+ "screenStateStore": undefined,
518
533
  },
519
534
  },
520
535
  {
@@ -546,6 +561,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
546
561
  "supports_offline": false,
547
562
  "type": "general_content",
548
563
  },
564
+ "screenStateStore": undefined,
549
565
  },
550
566
  },
551
567
  ],
@@ -582,6 +598,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
582
598
  "supports_offline": false,
583
599
  "type": "general_content",
584
600
  },
601
+ "screenStateStore": undefined,
585
602
  },
586
603
  },
587
604
  "options": {
@@ -617,6 +634,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
617
634
  "supports_offline": false,
618
635
  "type": "general_content",
619
636
  },
637
+ "screenStateStore": undefined,
620
638
  },
621
639
  },
622
640
  {
@@ -648,6 +666,7 @@ exports[`reducer when a back action is dispatched push, back, push, back does wh
648
666
  "supports_offline": false,
649
667
  "type": "general_content",
650
668
  },
669
+ "screenStateStore": undefined,
651
670
  },
652
671
  },
653
672
  ],
@@ -5,6 +5,7 @@ import {
5
5
  firstStackEntriesSelector,
6
6
  previousStackEntriesSelector,
7
7
  } from "./selectors";
8
+ import { create, StoreApi, UseBoundStore } from "zustand";
8
9
 
9
10
  /* initial state */
10
11
 
@@ -120,12 +121,12 @@ export const setNestedContent = (
120
121
 
121
122
  const navigationEntry = (
122
123
  type: ActionValues,
123
- { route, screen, entry, key, options }: AnyRecord
124
+ { route, screen, entry, key, options, screenStateStore }: AnyRecord
124
125
  ) => ({
125
126
  key,
126
127
  action: type,
127
128
  route,
128
- state: { screen, entry, options },
129
+ state: { screen, entry, options, screenStateStore },
129
130
  });
130
131
 
131
132
  function updatePopActions(state) {
@@ -274,6 +275,25 @@ function locationReducer(
274
275
  ) {
275
276
  const { route, key, screen, entry, options } = payload;
276
277
 
278
+ const screenStateStore: UseBoundStore<StoreApi<ScreenStateStore>> =
279
+ create<ScreenStateStore>((set) => ({
280
+ data: {},
281
+ setValue: (key, value) =>
282
+ set((state) => ({
283
+ data: {
284
+ ...state.data,
285
+ [key]: value,
286
+ },
287
+ })),
288
+ removeValue: (key) =>
289
+ set((state) => {
290
+ const newData = { ...state.data };
291
+ delete newData[key];
292
+
293
+ return { data: newData };
294
+ }),
295
+ }));
296
+
277
297
  switch (type) {
278
298
  case ACTIONS.BACK:
279
299
  // eslint-disable-next-line no-case-declarations
@@ -294,14 +314,18 @@ function locationReducer(
294
314
  case ACTIONS.REPLACE:
295
315
  case ACTIONS.REPLACE_TOP:
296
316
  case ACTIONS.BACK_PLAYER_NESTED_CONTENT:
297
- return { pathname: route, state: { screen, entry, options }, key };
317
+ return {
318
+ pathname: route,
319
+ state: { screen, entry, options, screenStateStore },
320
+ key,
321
+ };
298
322
 
299
323
  case ACTIONS.SET_NESTED_CONTENT:
300
324
  // eslint-disable-next-line no-case-declarations
301
- const nestedEntry = navigationEntry(
302
- ACTIONS.REPLACE,
303
- payload as AnyRecord
304
- );
325
+ const nestedEntry = navigationEntry(ACTIONS.REPLACE, {
326
+ ...payload,
327
+ screenStateStore,
328
+ } as AnyRecord);
305
329
 
306
330
  return R.assocPath(["state", "nested"], nestedEntry.state, state);
307
331
  default:
@@ -1,11 +1,15 @@
1
1
  import * as React from "react";
2
2
  import * as R from "ramda";
3
3
  import { renderHook, act } from "@testing-library/react-hooks";
4
+ import configureStore from "redux-mock-store";
5
+ import thunk from "redux-thunk";
4
6
  import { NetworkStatusContext } from "@applicaster/zapp-react-native-ui-components/Contexts/NetworkStatusContext";
5
7
  import { NetworkStatusProvider } from "../NetworkStatusProvider";
6
- import { WrappedWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
8
+ import { Provider } from "react-redux";
7
9
  import NetInfo from "@react-native-community/netinfo";
8
10
 
11
+ const mockStore = configureStore([thunk]);
12
+
9
13
  const NetInfoMock = {
10
14
  type: "cellular",
11
15
  details: {
@@ -20,9 +24,9 @@ const NetInfoMock = {
20
24
  const getWrapper = (store) => ({
21
25
  // eslint-disable-next-line react/prop-types,react/display-name
22
26
  wrapper: ({ children }) => (
23
- <WrappedWithProviders store={store}>
27
+ <Provider store={store}>
24
28
  <NetworkStatusProvider>{children}</NetworkStatusProvider>
25
- </WrappedWithProviders>
29
+ </Provider>
26
30
  ),
27
31
  });
28
32
 
@@ -37,9 +41,9 @@ const useNetInfoMock = () => {
37
41
 
38
42
  describe("NetworkStatusProvider", function () {
39
43
  it("should return netInfoData", function () {
40
- const store = {
44
+ const store = mockStore({
41
45
  plugins: [{}],
42
- };
46
+ });
43
47
 
44
48
  // @ts-ignore
45
49
  jest.spyOn(NetInfo, "useNetInfo").mockImplementation(useNetInfoMock);
@@ -55,9 +59,9 @@ describe("NetworkStatusProvider", function () {
55
59
  it("should call onConnectionLost callback when connection type changes to none", function () {
56
60
  const onConnectionLost = jest.fn();
57
61
 
58
- const store = {
62
+ const store = mockStore({
59
63
  plugins: [{ module: { networkHooks: { onConnectionLost } } }],
60
- };
64
+ });
61
65
 
62
66
  // @ts-ignore
63
67
  jest.spyOn(NetInfo, "useNetInfo").mockImplementation(useNetInfoMock);
@@ -82,9 +86,9 @@ describe("NetworkStatusProvider", function () {
82
86
  it("should call onConnectionRestored callback when connection type switches from none", function () {
83
87
  const onConnectionRestored = jest.fn();
84
88
 
85
- const store = {
89
+ const store = mockStore({
86
90
  plugins: [{ module: { networkHooks: { onConnectionRestored } } }],
87
- };
91
+ });
88
92
 
89
93
  // @ts-ignore
90
94
  jest.spyOn(NetInfo, "useNetInfo").mockImplementation(useNetInfoMock);
@@ -119,9 +123,9 @@ describe("NetworkStatusProvider", function () {
119
123
  it("should call onConnectionTypeChanged callback when connection type changes", function () {
120
124
  const onConnectionTypeChanged = jest.fn();
121
125
 
122
- const store = {
126
+ const store = mockStore({
123
127
  plugins: [{ module: { networkHooks: { onConnectionTypeChanged } } }],
124
- };
128
+ });
125
129
 
126
130
  // @ts-ignore
127
131
  jest.spyOn(NetInfo, "useNetInfo").mockImplementation(useNetInfoMock);
@@ -1,9 +1,11 @@
1
1
  import * as React from "react";
2
2
  import * as ReactIs from "react-is";
3
3
  import { View, Text } from "react-native";
4
- import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
4
+ import { render } from "@testing-library/react-native";
5
+ import configureStore from "redux-mock-store";
5
6
 
6
7
  import { storeConnector } from "../index";
8
+ import { Provider } from "react-redux";
7
9
 
8
10
  const styles = { foo: "bar" };
9
11
  const components = { grid: jest.fn() };
@@ -16,12 +18,12 @@ const Component = (props) => (
16
18
  </View>
17
19
  );
18
20
 
19
- const store = {
21
+ const store = configureStore()({
20
22
  styles,
21
23
  components,
22
24
  rivers,
23
25
  appSettings,
24
- };
26
+ });
25
27
 
26
28
  describe("storeConnector", () => {
27
29
  it("returns a Component", () => {
@@ -39,9 +41,10 @@ describe("storeConnector", () => {
39
41
  it("passes the props to the component", () => {
40
42
  const WrappedComponent = storeConnector(Component);
41
43
 
42
- const { getByText, getByTestId } = renderWithProviders(
43
- <WrappedComponent />,
44
- store
44
+ const { getByText, getByTestId } = render(
45
+ <Provider store={store}>
46
+ <WrappedComponent />
47
+ </Provider>
45
48
  );
46
49
 
47
50
  expect(getByText("I'm a component")).toBeTruthy();
@@ -42,9 +42,12 @@ jest.mock("../AppStateDecorator", () => ({
42
42
  withAppManager: (Comp) => Comp,
43
43
  }));
44
44
 
45
- jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
46
- useDimensions: jest.fn(() => ({ width: 375, height: 800 })),
47
- }));
45
+ jest.mock(
46
+ "@applicaster/zapp-react-native-utils/reactHooks/layout/useDimensions",
47
+ () => ({
48
+ useDimensions: jest.fn(() => ({ width: 375, height: 800 })),
49
+ })
50
+ );
48
51
 
49
52
  jest.mock("react-native", () => {
50
53
  const RNMock = jest.genMockFromModule("react-native");
@@ -10,15 +10,6 @@ import { appLifeCycleManager } from "../";
10
10
 
11
11
  const mock_actions = {};
12
12
 
13
- jest.mock(
14
- "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage",
15
- () => ({
16
- sessionStorage: {
17
- getAllItems: jest.fn(() => Promise.resolve(mocked_items)),
18
- },
19
- })
20
- );
21
-
22
13
  jest.mock("@applicaster/zapp-react-native-redux/AppData", () => ({
23
14
  loadAppData: jest.fn(() => () => Promise.resolve()),
24
15
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-core",
3
- "version": "14.0.0-alpha.3881160800",
3
+ "version": "14.0.0-alpha.3890252181",
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": "14.0.0-alpha.3881160800",
32
- "@applicaster/quick-brick-core-plugins": "14.0.0-alpha.3881160800",
33
- "@applicaster/zapp-pipes-v2-client": "14.0.0-alpha.3881160800",
34
- "@applicaster/zapp-react-native-bridge": "14.0.0-alpha.3881160800",
35
- "@applicaster/zapp-react-native-redux": "14.0.0-alpha.3881160800",
36
- "@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.3881160800",
37
- "@applicaster/zapp-react-native-utils": "14.0.0-alpha.3881160800",
31
+ "@applicaster/applicaster-types": "14.0.0-alpha.3890252181",
32
+ "@applicaster/quick-brick-core-plugins": "14.0.0-alpha.3890252181",
33
+ "@applicaster/zapp-pipes-v2-client": "14.0.0-alpha.3890252181",
34
+ "@applicaster/zapp-react-native-bridge": "14.0.0-alpha.3890252181",
35
+ "@applicaster/zapp-react-native-redux": "14.0.0-alpha.3890252181",
36
+ "@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.3890252181",
37
+ "@applicaster/zapp-react-native-utils": "14.0.0-alpha.3890252181",
38
38
  "atob": "^2.1.2",
39
39
  "axios": "^0.28.0",
40
40
  "btoa": "^1.2.1",
@@ -42,7 +42,7 @@
42
42
  "md5": "^2.3.0",
43
43
  "promise": "^8.3.0",
44
44
  "query-string": "7.1.3",
45
- "react-redux": "9.2.0",
45
+ "react-redux": "^7.2.1",
46
46
  "redux": "^4.0.4",
47
47
  "reselect": "^4.0.0",
48
48
  "url": "^0.11.0",
@@ -60,18 +60,12 @@
60
60
  "react": "*",
61
61
  "react-native": "*",
62
62
  "react-native-fs": "*",
63
- "react-native-gesture-handler": "*",
64
63
  "react-native-linear-gradient": "*",
64
+ "react-native-safe-area-context": "*",
65
65
  "react-native-svg": "*",
66
- "react-native-web": "*",
67
66
  "react-native-webview": "*",
68
67
  "uglify-js": "*",
69
68
  "validate-color": "*",
70
69
  "zustand": "*"
71
- },
72
- "devDependencies": {
73
- "nock": "^10.0.0",
74
- "redux-mock-store": "^1.5.3"
75
- },
76
- "gitHead": "a473487564142c55cdb50f02505cf0b60fe75658"
70
+ }
77
71
  }
@@ -19,7 +19,7 @@
19
19
  * @param {React.ComponentType<any>} App component to start
20
20
  */
21
21
  export function renderZappApp(options) {
22
- const { App, AppRegistry, appMountId } = options;
22
+ const { App, AppRegistry, appMountId, mode } = options;
23
23
 
24
24
  if (!App) {
25
25
  throw new Error("No App Component provided, nothing to render");
@@ -37,6 +37,7 @@ export function renderZappApp(options) {
37
37
  if (appMountId) {
38
38
  AppRegistry.runApplication("QuickBrickApp", {
39
39
  rootTag: document.getElementById(appMountId),
40
+ mode,
40
41
  });
41
42
  }
42
43
  }