@applicaster/zapp-react-native-ui-components 16.0.0-rc.99 → 17.0.0-alpha.1201533844

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 (94) hide show
  1. package/Components/AudioPlayer/index.web.tsx +10 -0
  2. package/Components/Cell/PlatformCellComponent.ts +9 -0
  3. package/Components/Cell/PlatformCellComponent.web.ts +3 -0
  4. package/Components/Cell/index.js +2 -9
  5. package/Components/CellRendererResolver/index.ts +2 -2
  6. package/Components/ComponentResolver/ComponentResolver.ts +2 -2
  7. package/Components/ComponentResolver/__tests__/componentResolver.test.js +13 -5
  8. package/Components/ContentScreen/index.js +2 -2
  9. package/Components/Focusable/index.web.tsx +3 -0
  10. package/Components/FocusableList/hooks/useCheckItemIdsForUnique.ts +2 -7
  11. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +1 -1
  12. package/Components/GeneralContentScreen/hookAdapter/logger.ts +1 -1
  13. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +158 -1
  14. package/Components/GeneralContentScreen/utils/index.ts +2 -2
  15. package/Components/GeneralContentScreen/utils/logger.ts +3 -4
  16. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +32 -10
  17. package/Components/HandlePlayable/utils.ts +2 -7
  18. package/Components/HookRenderer/HookRenderer.tsx +2 -2
  19. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +13 -0
  20. package/Components/MasterCell/DefaultComponents/Image/hoc/utils/__tests__/withDimensions.test.ts +1 -1
  21. package/Components/MasterCell/DefaultComponents/Image/hoc/utils/index.ts +2 -4
  22. package/Components/MasterCell/DefaultComponents/Image/hooks/checkTooBigImageSize.ts +2 -7
  23. package/Components/MasterCell/DefaultComponents/Image/index.web.ts +7 -0
  24. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +12 -3
  25. package/Components/MasterCell/DefaultComponents/PressableView.tsx +3 -0
  26. package/Components/MasterCell/DefaultComponents/Text/hooks/useText.ts +2 -7
  27. package/Components/MasterCell/DefaultComponents/__tests__/ActionButton.test.tsx +288 -0
  28. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/ActionButton.tsx +2 -1
  29. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/PressableView.test.tsx +4 -2
  30. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/factory.test.ts +2 -2
  31. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +2 -1
  32. package/Components/MasterCell/__tests__/masterCell.test.js +60 -0
  33. package/Components/MasterCell/index.tsx +28 -4
  34. package/Components/MasterCell/logger.ts +2 -2
  35. package/Components/MasterCell/utils/__tests__/useIsCellSelected.test.ts +91 -0
  36. package/Components/MasterCell/utils/__tests__/withoutFocusedState.test.js +20 -0
  37. package/Components/MasterCell/utils/behaviorProvider.ts +57 -38
  38. package/Components/MasterCell/utils/index.ts +21 -18
  39. package/Components/ModalComponent/ActionsBottomSheet/openActionsBottomSheet.ts +1 -1
  40. package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +7 -3
  41. package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +22 -1
  42. package/Components/ModalComponent/AudioPlayer/Components/__tests__/Item.test.tsx +52 -1
  43. package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +77 -0
  44. package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +58 -16
  45. package/Components/ModalComponent/BottomSheetDragArea.web.tsx +15 -0
  46. package/Components/ModalComponent/BottomSheetModalContent.tsx +51 -82
  47. package/Components/ModalComponent/SortableList.tsx +2 -3
  48. package/Components/ModalComponent/__tests__/BottomSheetDragArea.test.tsx +30 -0
  49. package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +237 -17
  50. package/Components/ModalComponent/__tests__/showTextInput.test.ts +25 -0
  51. package/Components/ModalComponent/showTextInput.ts +2 -0
  52. package/Components/OfflineHandler/__tests__/index.test.tsx +136 -0
  53. package/Components/OfflineHandler/index.tsx +45 -6
  54. package/Components/PlayerContainer/PlayerContainer.tsx +30 -6
  55. package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +51 -0
  56. package/Components/PlayerContainer/logger.ts +9 -5
  57. package/Components/River/ComponentsMap/ComponentsMap.tsx +4 -1
  58. package/Components/River/ComponentsMap/index.web.tsx +3 -0
  59. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
  60. package/Components/ScreenFeedLoader/ScreenFeedLoader.tsx +2 -2
  61. package/Components/ScreenResolver/index.tsx +2 -3
  62. package/Components/Tabs/TV/index.web.tsx +5 -0
  63. package/Components/Transitioner/AnimationManager.js +1 -1
  64. package/Components/Transitioner/Scene.tsx +4 -3
  65. package/Components/Transitioner/Transitioner.tsx +71 -33
  66. package/Components/Transitioner/__tests__/transitioner.test.js +372 -3
  67. package/Components/VideoLive/LiveImageManager.ts +126 -12
  68. package/Components/VideoLive/MuteUnmuteController.ts +135 -0
  69. package/Components/VideoLive/PlayerLiveImageComponent.tsx +15 -19
  70. package/Components/VideoLive/__tests__/LiveImageMuteState.test.ts +311 -0
  71. package/Components/VideoLive/__tests__/MuteUnmuteController.test.ts +135 -0
  72. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -1
  73. package/Components/VideoLive/loggerHelper.ts +2 -2
  74. package/Components/VideoModal/PlayerWrapper.tsx +9 -2
  75. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -0
  76. package/Components/VideoModal/__tests__/playerWrapperStyle.test.ts +261 -0
  77. package/Components/VideoModal/__tests__/playerWrapperUtils.test.ts +85 -0
  78. package/Components/VideoModal/hooks/useModalSize.ts +2 -7
  79. package/Components/VideoModal/playerWrapperStyle.ts +58 -23
  80. package/Components/VideoModal/playerWrapperUtils.ts +95 -1
  81. package/Components/__tests__/webVariants.test.js +73 -0
  82. package/Components/default-cell-renderer/containerStyles/index.web.ts +6 -0
  83. package/Components/default-cell-renderer/viewTrees/index.web.ts +10 -0
  84. package/Contexts/ZappPipesContext/ZappPipesContextFactory.tsx +3 -5
  85. package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +4 -3
  86. package/Decorators/ZappPipesDataConnector/__tests__/screenToolbox.test.ts +347 -0
  87. package/Decorators/ZappPipesDataConnector/__tests__/screenToolboxUnavailable.test.ts +53 -0
  88. package/Decorators/ZappPipesDataConnector/index.tsx +19 -4
  89. package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +2 -21
  90. package/Decorators/ZappPipesDataConnector/screenToolbox.ts +384 -0
  91. package/Decorators/ZappPipesDataConnector/utils/mongoFilter.ts +1 -1
  92. package/Decorators/ZappPipesDataConnector/utils/useFilter.tsx +1 -1
  93. package/Helpers/logger.js +2 -2
  94. package/package.json +5 -5
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+
3
+ import { AudioPlayerTV } from "./tv";
4
+
5
+ import { Props } from "./types";
6
+
7
+ // isTV() is true on every web platform, so web builds always render the TV audio player and leave the mobile one out.
8
+ export function AudioPlayer(props: Props) {
9
+ return <AudioPlayerTV {...props} />;
10
+ }
@@ -0,0 +1,9 @@
1
+ import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
2
+
3
+ import { CellComponent } from "./Cell";
4
+ import { TvOSCellComponent } from "./TvOSCellComponent";
5
+
6
+ export const PlatformCellComponent = platformSelect({
7
+ tvos: TvOSCellComponent,
8
+ default: CellComponent,
9
+ });
@@ -0,0 +1,3 @@
1
+ // Web builds always select the default cell, so the tvOS one stays out of web
2
+ // bundles.
3
+ export { CellComponent as PlatformCellComponent } from "./Cell";
@@ -1,7 +1,6 @@
1
1
  import * as R from "ramda";
2
2
 
3
3
  import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
4
- import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
5
4
 
6
5
  import {
7
6
  HorizontalScrollContext,
@@ -9,8 +8,7 @@ import {
9
8
  ScreenScrollingContext,
10
9
  } from "../../Contexts";
11
10
 
12
- import { CellComponent } from "./Cell";
13
- import { TvOSCellComponent } from "./TvOSCellComponent";
11
+ import { PlatformCellComponent } from "./PlatformCellComponent";
14
12
  import { withConsumer } from "../../Contexts/HeaderOffsetContext";
15
13
 
16
14
  import { ScreenLayoutContextConsumer } from "../../Contexts/ScreenLayoutContext";
@@ -23,11 +21,6 @@ export const ScrollInterceptorContext = createContext(
23
21
  (_) => _
24
22
  );
25
23
 
26
- const Component = platformSelect({
27
- tvos: TvOSCellComponent,
28
- default: CellComponent,
29
- });
30
-
31
24
  export const Cell = R.compose(
32
25
  connectToStore(R.pick(["remoteConfigurations", "appData"])),
33
26
  ScrollInterceptorContext.withConsumer,
@@ -37,4 +30,4 @@ export const Cell = R.compose(
37
30
  withConsumer,
38
31
  ScreenLayoutContextConsumer,
39
32
  withComponentsMapOffsetContextConsumer
40
- )(Component);
33
+ )(PlatformCellComponent);
@@ -1,8 +1,8 @@
1
1
  import { findPluginByIdentifier } from "@applicaster/zapp-react-native-utils/pluginUtils";
2
2
  import { isGroup } from "@applicaster/zapp-react-native-utils/componentsUtils";
3
3
 
4
- import { componentsLogger } from "../../Helpers/logger";
5
4
  import defaultCellRenderer from "../default-cell-renderer";
5
+ import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
6
6
 
7
7
  type Props = {
8
8
  component: any;
@@ -13,7 +13,7 @@ type Props = {
13
13
  generateId?: () => string;
14
14
  };
15
15
 
16
- const logger = componentsLogger.addSubsystem("CellRendererResolver");
16
+ const logger = subsystemLogger("ui/cells", "CellRendererResolver");
17
17
 
18
18
  /**
19
19
  * Checks the matching cellPluginConfigurationId in the cellStyles redux store
@@ -4,7 +4,7 @@ import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils
4
4
 
5
5
  import { CellRendererResolver } from "../CellRendererResolver";
6
6
 
7
- import { componentsLogger } from "../../Helpers/logger";
7
+ import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
8
8
 
9
9
  type Decorator = (arg: React.ComponentType<any>) => React.ComponentType<any>;
10
10
 
@@ -18,7 +18,7 @@ type Props = {
18
18
  cellStyles: any;
19
19
  };
20
20
 
21
- const logger = componentsLogger.addSubsystem("ComponentResolver");
21
+ const logger = subsystemLogger("ui/components", "ComponentResolver");
22
22
 
23
23
  export function ComponentResolver({
24
24
  component,
@@ -7,11 +7,19 @@ const mockLogger = {
7
7
  warning: jest.fn(),
8
8
  };
9
9
 
10
- jest.mock("../../../Helpers/logger", () => ({
11
- componentsLogger: {
12
- addSubsystem: jest.fn(() => mockLogger),
13
- },
14
- }));
10
+ jest.mock("@applicaster/zapp-react-native-utils/logger", () => {
11
+ const actual = jest.requireActual(
12
+ "@applicaster/zapp-react-native-utils/logger"
13
+ );
14
+
15
+ return {
16
+ ...actual,
17
+ subsystemLogger: (subsystem, category) =>
18
+ subsystem === "ui/components" || subsystem === "ui/cells"
19
+ ? mockLogger
20
+ : actual.subsystemLogger(subsystem, category),
21
+ };
22
+ });
15
23
 
16
24
  jest.mock("../../default-cell-renderer", () => {
17
25
  const View = jest.requireActual("react-native").View;
@@ -1,6 +1,6 @@
1
- import { componentsLogger } from "../../Helpers/logger";
1
+ import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
2
2
 
3
- const logger = componentsLogger.addSubsystem("unknown-component");
3
+ const logger = subsystemLogger("ui/screens", "ContentScreen");
4
4
 
5
5
  const errorMessage =
6
6
  "Content wasn't resolved properly - please check your datasource";
@@ -0,0 +1,3 @@
1
+ // Web builds always select the default Focusable, so the tvOS and iOS ones stay out
2
+ // of web bundles.
3
+ export { Focusable } from "./Focusable";
@@ -1,15 +1,10 @@
1
1
  import * as React from "react";
2
2
  import { pluck, uniq } from "ramda";
3
- import { quickBrickLogger } from "@applicaster/zapp-react-native-utils/logger";
3
+ import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
4
4
 
5
5
  import { getNonUniqueValues } from "./utils";
6
6
 
7
- const logger = quickBrickLogger
8
- .addSubsystem("packages")
9
- .addSubsystem("zapp-react-native-ui-components")
10
- .addSubsystem("Components")
11
- .addSubsystem("FocusableList")
12
- .addSubsystem("index.tsx");
7
+ const logger = subsystemLogger("ui/focus/list", "FocusableList");
13
8
 
14
9
  const getIds = pluck("id");
15
10
 
@@ -21,7 +21,7 @@ import { ScreenResolverFeedProvider } from "../ScreenResolverFeedProvider/Screen
21
21
 
22
22
  const { log_debug } = createLogger({
23
23
  category: "ScreenContainer",
24
- subsystem: "General",
24
+ subsystem: "ui/screens",
25
25
  });
26
26
 
27
27
  /** Provides screen-feed from general-screen configuration (if defined) */
@@ -2,5 +2,5 @@ import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
2
2
 
3
3
  export const { log_debug, log_error, log_info } = createLogger({
4
4
  category: "runInBackground",
5
- subsystem: "GeneralContentScreenHookAdapter",
5
+ subsystem: "ui/screens",
6
6
  });
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
- import { renderHook } from "@testing-library/react-native";
2
+ import { act, renderHook } from "@testing-library/react-native";
3
+ import { configureStore } from "@reduxjs/toolkit";
3
4
 
4
5
  import {
5
6
  getTransformedPreset,
@@ -12,6 +13,7 @@ import { NavigationContext } from "@applicaster/zapp-react-native-ui-components/
12
13
  import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
13
14
 
14
15
  import { WrappedWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
16
+ import * as loadPipesDispatchModule from "@applicaster/zapp-react-native-utils/reactHooks/feed/useLoadPipesDataDispatch";
15
17
 
16
18
  jest.mock(
17
19
  "@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute",
@@ -22,6 +24,19 @@ jest.mock(
22
24
  })
23
25
  );
24
26
 
27
+ jest.mock("@applicaster/zapp-pipes-v2-client", () => ({
28
+ __esModule: true,
29
+ subscribeForKeyChanges: jest.fn(),
30
+ subscribeForUrlContextKeyChanges: jest.fn(() => () => {}),
31
+ subscribeForUrlScreenKeyChanges: jest.fn(),
32
+ createError: jest.fn(),
33
+ RequestBuilder: jest.fn(),
34
+ findEndpointForUrl: jest.fn(),
35
+ findEndpointForURL: jest.fn(),
36
+ HTTP_METHODS: { GET: "get", POST: "post" },
37
+ default: jest.fn(),
38
+ }));
39
+
25
40
  const homeStack = {
26
41
  route: "/home",
27
42
  state: {
@@ -490,4 +505,146 @@ describe("getTransformedPreset should return the passed components if smartCompo
490
505
 
491
506
  expect(result.current).toEqual(mockTransformedComponents);
492
507
  });
508
+
509
+ describe("observation and refresh coordination for smart components", () => {
510
+ let mockLoadPipesDataDispatcher;
511
+
512
+ const mockSmartComponent = {
513
+ id: "smart-comp-1",
514
+ component_type: "quick-brick-smart-component",
515
+ data: { source: "https://pipes.applicaster.com/v2/curation" },
516
+ rules: {},
517
+ };
518
+
519
+ const mockLayoutPresets = {
520
+ preset_one: {
521
+ id: "",
522
+ component_type: "horizontal-list",
523
+ data: { source: "preset1_src" },
524
+ },
525
+ };
526
+
527
+ const mockPresetEntry = [
528
+ { preset_name: "preset_one", feed_url: "https://preset1.com" },
529
+ ];
530
+
531
+ const mockFeeds = {
532
+ "https://pipes.applicaster.com/v2/curation": {
533
+ loading: false,
534
+ data: { entry: mockPresetEntry },
535
+ },
536
+ };
537
+
538
+ beforeEach(() => {
539
+ jest.clearAllMocks();
540
+
541
+ mockLoadPipesDataDispatcher = jest.fn();
542
+
543
+ jest
544
+ .spyOn(loadPipesDispatchModule, "useLoadPipesDataDispatch")
545
+ .mockReturnValue(mockLoadPipesDataDispatcher);
546
+ });
547
+
548
+ afterEach(() => {
549
+ jest.restoreAllMocks();
550
+ });
551
+
552
+ it("loads uncached smart components", () => {
553
+ renderHook(() => useCurationAPI([mockSmartComponent]), {
554
+ wrapper: getWrapper({
555
+ zappPipes: {},
556
+ presetsMapping: { presets_mappings: mockLayoutPresets },
557
+ }),
558
+ });
559
+
560
+ expect(mockLoadPipesDataDispatcher).toHaveBeenCalledWith(
561
+ "https://pipes.applicaster.com/v2/curation",
562
+ { clearCache: false, silentRefresh: true }
563
+ );
564
+ });
565
+
566
+ it("revalidates mounted smart feeds on invalidation and re-enriches fresh content", () => {
567
+ const state = {
568
+ zappPipes: mockFeeds,
569
+ presetsMapping: { presets_mappings: mockLayoutPresets },
570
+ };
571
+
572
+ const store = configureStore({
573
+ reducer: (current = state, action) =>
574
+ action.type === "SET_FEED"
575
+ ? { ...current, zappPipes: action.payload }
576
+ : current,
577
+ });
578
+
579
+ const Wrapper = getWrapper(state);
580
+ const components = [mockSmartComponent];
581
+
582
+ const { result } = renderHook(() => useCurationAPI(components), {
583
+ wrapper: ({ children }) => (
584
+ <Wrapper>
585
+ <redux.Provider store={store}>{children}</redux.Provider>
586
+ </Wrapper>
587
+ ),
588
+ });
589
+
590
+ mockLoadPipesDataDispatcher.mockClear();
591
+ const url = mockSmartComponent.data.source;
592
+
593
+ act(() =>
594
+ store.dispatch({
595
+ type: "SET_FEED",
596
+ payload: {
597
+ [url]: { ...mockFeeds[url], stale: true, invalidationVersion: 1 },
598
+ },
599
+ })
600
+ );
601
+
602
+ expect(mockLoadPipesDataDispatcher).toHaveBeenCalledTimes(1);
603
+
604
+ expect(mockLoadPipesDataDispatcher).toHaveBeenCalledWith(url, {
605
+ clearCache: false,
606
+ silentRefresh: true,
607
+ });
608
+
609
+ act(() =>
610
+ store.dispatch({
611
+ type: "SET_FEED",
612
+ payload: {
613
+ [url]: {
614
+ loading: false,
615
+ data: {
616
+ entry: [
617
+ {
618
+ preset_name: "preset_one",
619
+ feed_url: "https://updated.example/feed",
620
+ },
621
+ ],
622
+ },
623
+ },
624
+ },
625
+ })
626
+ );
627
+
628
+ expect(result.current[0].data.source).toBe(
629
+ "https://updated.example/feed"
630
+ );
631
+ });
632
+
633
+ it("should not dispatch load when there are no smart components", () => {
634
+ const normalComp = {
635
+ id: "comp1",
636
+ data: { source: "https://test.com" },
637
+ component_type: "horizontal-list",
638
+ };
639
+
640
+ renderHook(() => useCurationAPI([normalComp]), {
641
+ wrapper: getWrapper({
642
+ zappPipes: mockFeeds,
643
+ presetsMapping: { presets_mappings: mockLayoutPresets },
644
+ }),
645
+ });
646
+
647
+ expect(mockLoadPipesDataDispatcher).not.toHaveBeenCalled();
648
+ });
649
+ });
493
650
  });
@@ -1,6 +1,6 @@
1
1
  import * as R from "ramda";
2
- import { componentsLogger } from "../../../Helpers/logger";
2
+ import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
3
3
 
4
- export const logger = componentsLogger.addSubsystem("GeneralContentScreen");
4
+ export const logger = subsystemLogger("ui/screens", "GeneralContentScreen");
5
5
 
6
6
  export const whenMatchingType = (type, value) => R.is(type, value) && value;
@@ -1,12 +1,11 @@
1
- import { getXray } from "@applicaster/zapp-react-native-utils/logger";
2
- const { Logger } = getXray();
1
+ import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
3
2
 
4
- export const Subsystem = "GeneralContentScreen";
3
+ export const Subsystem = "ui/screens";
5
4
 
6
5
  export const Categories = {
7
6
  CURATION_API: "useCurationApi",
8
7
  };
9
8
 
10
9
  export function createLogger({ category = "" }) {
11
- return new Logger(category, Subsystem);
10
+ return subsystemLogger(Subsystem, category);
12
11
  }
@@ -7,7 +7,7 @@ import {
7
7
  useZappPipesFeed,
8
8
  } from "@applicaster/zapp-react-native-redux";
9
9
  import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
10
- import { Categories } from "./logger";
10
+ import { Categories, Subsystem } from "./logger";
11
11
  import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
12
12
  import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
13
13
 
@@ -22,7 +22,8 @@ import {
22
22
  } from "@applicaster/zapp-react-native-utils/reactHooks/feed/useInflatedUrl";
23
23
 
24
24
  import { produce } from "immer";
25
- import { useLoadPipesDataDispatch } from "@applicaster/zapp-react-native-utils/reactHooks";
25
+ import { useLoadPipesDataDispatch } from "@applicaster/zapp-react-native-utils/reactHooks/feed/useLoadPipesDataDispatch";
26
+ import { useIsInitialRender } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
26
27
 
27
28
  // types reference
28
29
 
@@ -40,11 +41,15 @@ const QB_TABS_SCREEN_TYPE = "quick-brick-tabs";
40
41
  const SMART_COMPONENT_TYPE = "quick-brick-smart-component";
41
42
  const SOURCE_PATH = ["data", "source"];
42
43
  const MAPPING_PATH = ["data", "mapping"];
44
+ const EMPTY_OBJECT = {};
43
45
 
44
46
  const isSmartComponent = (component) =>
45
47
  component.component_type === SMART_COMPONENT_TYPE;
46
48
 
47
- const logger = createLogger({ category: Categories.CURATION_API });
49
+ const logger = createLogger({
50
+ category: Categories.CURATION_API,
51
+ subsystem: Subsystem,
52
+ });
48
53
 
49
54
  export const getTransformedPreset = (
50
55
  preset: CurationEntry,
@@ -146,10 +151,14 @@ export const useCurationAPI = (
146
151
 
147
152
  const screenContextData = useScreenContext();
148
153
 
149
- const entryContext = ((isNestedScreen && screenContextData?.nested?.entry
150
- ? screenContextData?.nested?.entry
151
- : (screenContextData?.entry?.payload ?? screenContextData?.entry)) ||
152
- {}) as ZappEntry;
154
+ const entryContext = useMemo(
155
+ () =>
156
+ ((isNestedScreen && screenContextData?.nested?.entry
157
+ ? screenContextData?.nested?.entry
158
+ : (screenContextData?.entry?.payload ?? screenContextData?.entry)) ||
159
+ EMPTY_OBJECT) as ZappEntry,
160
+ [isNestedScreen, screenContextData]
161
+ );
153
162
 
154
163
  const urlsMap = useMemo<{ [key: string]: string }>(() => {
155
164
  const map = {};
@@ -175,20 +184,33 @@ export const useCurationAPI = (
175
184
  const urls = useMemo<string[]>(() => Object.values(urlsMap), [urlsMap]);
176
185
 
177
186
  const loadPipesDataDispatcher = useLoadPipesDataDispatch();
187
+ const isInitialRender = useIsInitialRender();
188
+
189
+ const feeds = useZappPipesFeed(urls);
178
190
 
179
191
  useEffect(() => {
180
192
  urls.forEach((url, index) => {
181
193
  if (url) {
182
- loadPipesDataDispatcher(url, { clearCache: false });
194
+ const feed = feeds?.[url];
195
+
196
+ if (
197
+ !feed?.refreshing &&
198
+ (!feed?.error || isInitialRender) &&
199
+ (!feed?.data || feed.stale)
200
+ ) {
201
+ loadPipesDataDispatcher(url, {
202
+ clearCache: false,
203
+ silentRefresh: true,
204
+ });
205
+ }
183
206
  } else {
184
207
  logger.log_error("Curation url is empty", {
185
208
  componentId: smartComponents?.[index]?.id,
186
209
  });
187
210
  }
188
211
  });
189
- }, [urls, loadPipesDataDispatcher]);
212
+ }, [urls, smartComponents, loadPipesDataDispatcher, feeds, isInitialRender]);
190
213
 
191
- const feeds = useZappPipesFeed(urls);
192
214
  const layoutPresets = useLayoutPresets();
193
215
 
194
216
  const enrichedComponents = useMemo(() => {
@@ -5,14 +5,9 @@ import {
5
5
 
6
6
  import { CHROMECAST_PLUGIN_ID, YOUTUBE_PLUGIN_ID } from "./const";
7
7
  import { omit } from "@applicaster/zapp-react-native-utils/utils";
8
- import { getXray } from "@applicaster/zapp-react-native-utils/logger";
8
+ import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
9
9
 
10
- const { Logger } = getXray();
11
-
12
- const logger = new Logger(
13
- "QuickBrick",
14
- "packages/zapp-react-native-ui-components/Components/HandlePlayable"
15
- );
10
+ const logger = subsystemLogger("player/playable", "HandlePlayable");
16
11
 
17
12
  const getPlayerModuleProperties = (PlayerModule: ZappPlugin) => {
18
13
  if (PlayerModule?.Component && typeof PlayerModule.Component === "object") {
@@ -7,9 +7,9 @@ import {
7
7
  import { useHookAnalytics } from "@applicaster/zapp-react-native-utils/analyticsUtils/helpers/hooks";
8
8
  import { useSetNavbarState } from "@applicaster/zapp-react-native-utils/reactHooks";
9
9
 
10
- import { componentsLogger } from "../../Helpers/logger";
10
+ import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
11
11
 
12
- const logger = componentsLogger.addSubsystem("HookRenderer");
12
+ const logger = subsystemLogger("core/plugins/hooks", "HookRenderer");
13
13
 
14
14
  const HOOK_PRESENTATION_TYPE = "Hook";
15
15
 
@@ -96,6 +96,14 @@ export const ActionButton = React.memo(function ActionButtonComponent(
96
96
  }, [item?.id, setActionState, actionContext]);
97
97
 
98
98
  if (actionDisabled || !actionContext) return null;
99
+
100
+ if (
101
+ actionState?.visibleInCells &&
102
+ !actionState.visibleInCells.includes(cellUUID)
103
+ ) {
104
+ return null;
105
+ }
106
+
99
107
  const AssetComponent = actionState?.asset;
100
108
 
101
109
  // Default state is not yet ready
@@ -109,6 +117,11 @@ export const ActionButton = React.memo(function ActionButtonComponent(
109
117
  accessibilityLabel={props?.accessibilityLabel || `${item?.id}`}
110
118
  accessibilityHint={props?.accessibilityHint}
111
119
  accessibilityRole="button"
120
+ accessibilityState={
121
+ typeof actionState.checked === "boolean"
122
+ ? { checked: actionState.checked }
123
+ : undefined
124
+ }
112
125
  accessible={!!(props?.testID || props?.accessibilityLabel)}
113
126
  style={props?.style}
114
127
  >
@@ -8,7 +8,7 @@ jest.mock("@applicaster/zapp-react-native-utils/logger", () => {
8
8
  warning: (...args) => mockWarning(...args),
9
9
  };
10
10
 
11
- return { coreLogger: mockLogger };
11
+ return { coreLogger: mockLogger, subsystemLogger: () => mockLogger };
12
12
  });
13
13
 
14
14
  describe("withDimensions", () => {
@@ -1,10 +1,8 @@
1
1
  import { toFiniteNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
2
2
  import { isNil } from "ramda";
3
- import { coreLogger } from "@applicaster/zapp-react-native-utils/logger";
3
+ import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
4
4
 
5
- const imageResizingLogger = coreLogger
6
- ?.addSubsystem("components")
7
- ?.addSubsystem("ImageResizing");
5
+ const imageResizingLogger = subsystemLogger("ui/images", "ImageResizing");
8
6
 
9
7
  const TEMPLATE_REGEX = /{{(width|height)}}/gi;
10
8
  const UNRESOLVED_PLACEHOLDER_REGEX = /{{[^}]*}}?/;
@@ -1,6 +1,6 @@
1
1
  import { Image as RNImage } from "react-native";
2
2
  import memoizee from "memoizee";
3
- import { quickBrickLogger } from "@applicaster/zapp-react-native-utils/logger";
3
+ import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
4
4
  import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
5
5
  import { toFiniteNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
6
6
 
@@ -9,12 +9,7 @@ type Size = {
9
9
  height: number;
10
10
  };
11
11
 
12
- const logger = quickBrickLogger
13
- .addSubsystem("zapp-react-native-ui-components")
14
- .addSubsystem("Components")
15
- .addSubsystem("MasterCell")
16
- .addSubsystem("DefaultComponents")
17
- .addSubsystem("Image.android");
12
+ const logger = subsystemLogger("ui/images", "CheckTooBigImageSize");
18
13
 
19
14
  const THRESHOLD = 2; // in how many times size should be BIGGER than expected
20
15
 
@@ -0,0 +1,7 @@
1
+ import ImageWeb from "./Image.web";
2
+
3
+ import { withDimensionsHOC } from "./hoc/withDimensions";
4
+
5
+ // Web builds always select the web image, so the Android and iOS ones stay out of
6
+ // web bundles.
7
+ export default withDimensionsHOC(ImageWeb);
@@ -245,10 +245,19 @@ const LiveImageComponent = (props: LiveImageProps) => {
245
245
 
246
246
  const isCurrentlyFocused = useTrackCurrentAutoScrollingElement(componentId);
247
247
 
248
- const { playerPluginId, screenConfig, preloadHooks } =
249
- getPlayerConfig(player_screen_id, actionIdentifier) ?? {};
248
+ // New object identities here restart PlayerLiveImage's register effect,
249
+ // which throws away the in-flight player and runs preload hooks again.
250
+ const playerConfig = React.useMemo(
251
+ () => getPlayerConfig(player_screen_id, actionIdentifier),
252
+ [player_screen_id, actionIdentifier]
253
+ );
254
+
255
+ const { playerPluginId, screenConfig, preloadHooks } = playerConfig ?? {};
250
256
 
251
- const playableEntry = playerPluginId ? getPlayableEntry(item) : null;
257
+ const playableEntry = React.useMemo(
258
+ () => (playerPluginId ? getPlayableEntry(item) : null),
259
+ [playerPluginId, item?.id]
260
+ );
252
261
 
253
262
  const playerPlugin = getPluginByIdentifier(playerPluginId);
254
263
 
@@ -11,6 +11,7 @@ type Props = {
11
11
  accessibilityHint?: string;
12
12
  onPress?: () => void;
13
13
  testOnly_pressed?: boolean;
14
+ checked?: boolean;
14
15
  };
15
16
 
16
17
  export function PressableView({
@@ -22,11 +23,13 @@ export function PressableView({
22
23
  pressedStyle,
23
24
  onPress,
24
25
  testOnly_pressed = false,
26
+ checked,
25
27
  }: Props) {
26
28
  return (
27
29
  <Pressable
28
30
  testOnly_pressed={testOnly_pressed}
29
31
  onPress={onPress}
32
+ accessibilityState={checked === undefined ? undefined : { checked }}
30
33
  testID={testID}
31
34
  accessibilityLabel={accessibilityLabel}
32
35
  accessibilityHint={accessibilityHint}
@@ -2,14 +2,9 @@ import * as React from "react";
2
2
  import * as R from "ramda";
3
3
  import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
4
4
  import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
5
- import { getXray } from "@applicaster/zapp-react-native-utils/logger";
5
+ import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
6
6
 
7
- const { Logger } = getXray();
8
-
9
- const logger = new Logger(
10
- "plugin",
11
- "plugins/navigation-action|plugins/local-storage-favourites-action"
12
- );
7
+ const logger = subsystemLogger("ui/cells", "plugin");
13
8
 
14
9
  const firstEnglishWordRegex = /(^[a-zA-Z]+)/;
15
10