@applicaster/zapp-react-native-ui-components 16.0.0-rc.99 → 17.0.0-alpha.1037440043
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/Components/CellRendererResolver/index.ts +2 -2
- package/Components/ComponentResolver/ComponentResolver.ts +2 -2
- package/Components/ComponentResolver/__tests__/componentResolver.test.js +13 -5
- package/Components/ContentScreen/index.js +2 -2
- package/Components/FocusableList/hooks/useCheckItemIdsForUnique.ts +2 -7
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +1 -1
- package/Components/GeneralContentScreen/hookAdapter/logger.ts +1 -1
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +158 -1
- package/Components/GeneralContentScreen/utils/index.ts +2 -2
- package/Components/GeneralContentScreen/utils/logger.ts +3 -4
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +32 -10
- package/Components/HandlePlayable/utils.ts +2 -7
- package/Components/HookRenderer/HookRenderer.tsx +2 -2
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +13 -0
- package/Components/MasterCell/DefaultComponents/Image/hoc/utils/__tests__/withDimensions.test.ts +1 -1
- package/Components/MasterCell/DefaultComponents/Image/hoc/utils/index.ts +2 -4
- package/Components/MasterCell/DefaultComponents/Image/hooks/checkTooBigImageSize.ts +2 -7
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +12 -3
- package/Components/MasterCell/DefaultComponents/PressableView.tsx +3 -0
- package/Components/MasterCell/DefaultComponents/Text/hooks/useText.ts +2 -7
- package/Components/MasterCell/DefaultComponents/__tests__/ActionButton.test.tsx +288 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/ActionButton.tsx +2 -1
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/PressableView.test.tsx +4 -2
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/factory.test.ts +2 -2
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +2 -1
- package/Components/MasterCell/__tests__/masterCell.test.js +60 -0
- package/Components/MasterCell/index.tsx +28 -4
- package/Components/MasterCell/logger.ts +2 -2
- package/Components/MasterCell/utils/__tests__/useIsCellSelected.test.ts +91 -0
- package/Components/MasterCell/utils/__tests__/withoutFocusedState.test.js +20 -0
- package/Components/MasterCell/utils/behaviorProvider.ts +57 -38
- package/Components/MasterCell/utils/index.ts +21 -18
- package/Components/ModalComponent/ActionsBottomSheet/openActionsBottomSheet.ts +1 -1
- package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +7 -3
- package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +22 -1
- package/Components/ModalComponent/AudioPlayer/Components/__tests__/Item.test.tsx +52 -1
- package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +77 -0
- package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +58 -16
- package/Components/ModalComponent/BottomSheetDragArea.web.tsx +15 -0
- package/Components/ModalComponent/BottomSheetModalContent.tsx +51 -82
- package/Components/ModalComponent/SortableList.tsx +2 -3
- package/Components/ModalComponent/__tests__/BottomSheetDragArea.test.tsx +30 -0
- package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +237 -17
- package/Components/ModalComponent/__tests__/showTextInput.test.ts +25 -0
- package/Components/ModalComponent/showTextInput.ts +2 -0
- package/Components/OfflineHandler/__tests__/index.test.tsx +136 -0
- package/Components/OfflineHandler/index.tsx +45 -6
- package/Components/PlayerContainer/PlayerContainer.tsx +30 -6
- package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +51 -0
- package/Components/PlayerContainer/logger.ts +9 -5
- package/Components/River/ComponentsMap/ComponentsMap.tsx +4 -1
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
- package/Components/ScreenFeedLoader/ScreenFeedLoader.tsx +2 -2
- package/Components/ScreenResolver/index.tsx +2 -3
- package/Components/Transitioner/AnimationManager.js +1 -1
- package/Components/Transitioner/Scene.tsx +4 -3
- package/Components/Transitioner/Transitioner.tsx +71 -33
- package/Components/Transitioner/__tests__/transitioner.test.js +372 -3
- package/Components/VideoLive/LiveImageManager.ts +126 -12
- package/Components/VideoLive/MuteUnmuteController.ts +135 -0
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +15 -19
- package/Components/VideoLive/__tests__/LiveImageMuteState.test.ts +311 -0
- package/Components/VideoLive/__tests__/MuteUnmuteController.test.ts +135 -0
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -1
- package/Components/VideoLive/loggerHelper.ts +2 -2
- package/Components/VideoModal/PlayerWrapper.tsx +4 -1
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -0
- package/Components/VideoModal/__tests__/playerWrapperStyle.test.ts +58 -0
- package/Components/VideoModal/__tests__/playerWrapperUtils.test.ts +16 -0
- package/Components/VideoModal/hooks/useModalSize.ts +2 -7
- package/Components/VideoModal/playerWrapperStyle.ts +21 -3
- package/Components/VideoModal/playerWrapperUtils.ts +7 -1
- package/Contexts/ZappPipesContext/ZappPipesContextFactory.tsx +3 -5
- package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +4 -3
- package/Decorators/ZappPipesDataConnector/__tests__/screenToolbox.test.ts +347 -0
- package/Decorators/ZappPipesDataConnector/__tests__/screenToolboxUnavailable.test.ts +53 -0
- package/Decorators/ZappPipesDataConnector/index.tsx +19 -4
- package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +2 -21
- package/Decorators/ZappPipesDataConnector/screenToolbox.ts +384 -0
- package/Decorators/ZappPipesDataConnector/utils/mongoFilter.ts +1 -1
- package/Decorators/ZappPipesDataConnector/utils/useFilter.tsx +1 -1
- package/Helpers/logger.js +2 -2
- package/package.json +5 -5
|
@@ -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 =
|
|
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 {
|
|
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 =
|
|
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("
|
|
11
|
-
|
|
12
|
-
|
|
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 {
|
|
1
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
2
2
|
|
|
3
|
-
const logger =
|
|
3
|
+
const logger = subsystemLogger("ui/screens", "ContentScreen");
|
|
4
4
|
|
|
5
5
|
const errorMessage =
|
|
6
6
|
"Content wasn't resolved properly - please check your datasource";
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { pluck, uniq } from "ramda";
|
|
3
|
-
import {
|
|
3
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
4
4
|
|
|
5
5
|
import { getNonUniqueValues } from "./utils";
|
|
6
6
|
|
|
7
|
-
const logger =
|
|
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: "
|
|
24
|
+
subsystem: "ui/screens",
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
/** Provides screen-feed from general-screen configuration (if defined) */
|
|
@@ -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 {
|
|
2
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
3
3
|
|
|
4
|
-
export const logger =
|
|
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 {
|
|
2
|
-
const { Logger } = getXray();
|
|
1
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
3
2
|
|
|
4
|
-
export const Subsystem = "
|
|
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
|
|
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({
|
|
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 = (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
-
|
|
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 {
|
|
8
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
9
9
|
|
|
10
|
-
const
|
|
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 {
|
|
10
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
11
11
|
|
|
12
|
-
const logger =
|
|
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
|
>
|
package/Components/MasterCell/DefaultComponents/Image/hoc/utils/__tests__/withDimensions.test.ts
CHANGED
|
@@ -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 {
|
|
3
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
4
4
|
|
|
5
|
-
const imageResizingLogger =
|
|
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 {
|
|
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 =
|
|
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
|
|
|
@@ -245,10 +245,19 @@ const LiveImageComponent = (props: LiveImageProps) => {
|
|
|
245
245
|
|
|
246
246
|
const isCurrentlyFocused = useTrackCurrentAutoScrollingElement(componentId);
|
|
247
247
|
|
|
248
|
-
|
|
249
|
-
|
|
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 =
|
|
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 {
|
|
5
|
+
import { subsystemLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
6
6
|
|
|
7
|
-
const
|
|
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
|
|