@applicaster/zapp-react-native-ui-components 16.0.0-rc.11 → 16.0.0-rc.110

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 (156) hide show
  1. package/Components/AudioPlayer/tv/__tests__/audioPlayer.test.js +19 -0
  2. package/Components/AudioPlayer/tv/__tests__/index.test.tsx +120 -0
  3. package/Components/AudioPlayer/tv/index.tsx +5 -1
  4. package/Components/Cell/Cell.tsx +3 -6
  5. package/Components/Cell/TvOSCellComponent.tsx +0 -1
  6. package/Components/CellRendererResolver/index.ts +2 -2
  7. package/Components/ComponentResolver/__tests__/componentResolver.test.js +1 -1
  8. package/Components/FocusableGroup/FocusableTvOS.tsx +11 -7
  9. package/Components/GeneralContentScreen/GeneralContentScreenHookAdapter.tsx +54 -0
  10. package/Components/GeneralContentScreen/__tests__/GeneralContentScreenHookAdapter.test.tsx +64 -0
  11. package/Components/GeneralContentScreen/__tests__/HookContentFocusGroup.web.test.tsx +91 -0
  12. package/Components/GeneralContentScreen/hookAdapter/__tests__/networkService.test.ts +74 -0
  13. package/Components/GeneralContentScreen/hookAdapter/__tests__/runInBackground.test.ts +139 -0
  14. package/Components/GeneralContentScreen/hookAdapter/__tests__/skipExpression.test.ts +294 -0
  15. package/Components/GeneralContentScreen/hookAdapter/__tests__/validationHelper.test.ts +188 -0
  16. package/Components/GeneralContentScreen/hookAdapter/logger.ts +6 -0
  17. package/Components/GeneralContentScreen/hookAdapter/networkService.ts +53 -0
  18. package/Components/GeneralContentScreen/hookAdapter/runInBackground.ts +48 -0
  19. package/Components/GeneralContentScreen/hookAdapter/skipExpression.ts +252 -0
  20. package/Components/GeneralContentScreen/hookAdapter/validationHelper.ts +90 -0
  21. package/Components/GeneralContentScreen/hookFocus/index.tsx +13 -0
  22. package/Components/GeneralContentScreen/hookFocus/index.web.tsx +69 -0
  23. package/Components/GeneralContentScreen/index.ts +2 -0
  24. package/Components/Layout/FullWidthRow.tsx +38 -0
  25. package/Components/LinkHandler/LinkHandler.tsx +2 -7
  26. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +5 -1
  27. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/placement.test.ts +47 -21
  28. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/ActionButtonController.tsx +19 -4
  29. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/__tests__/ActionButtonController.test.tsx +43 -1
  30. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/placement.ts +34 -6
  31. package/Components/MasterCell/DefaultComponents/Button.tsx +1 -0
  32. package/Components/MasterCell/DefaultComponents/Image/hoc/utils/__tests__/withDimensions.test.ts +420 -125
  33. package/Components/MasterCell/DefaultComponents/Image/hoc/utils/index.ts +114 -19
  34. package/Components/MasterCell/DefaultComponents/Image/hoc/withDimensions.tsx +19 -8
  35. package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -3
  36. package/Components/MasterCell/DefaultComponents/LiveImage/executePreloadHooks.ts +2 -4
  37. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -3
  38. package/Components/MasterCell/DefaultComponents/PressableView.tsx +29 -9
  39. package/Components/MasterCell/DefaultComponents/Text/hooks/useText.ts +4 -0
  40. package/Components/MasterCell/DefaultComponents/Toggle.tsx +36 -14
  41. package/Components/MasterCell/DefaultComponents/__tests__/Toggle.test.tsx +167 -0
  42. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/ActionButton.tsx +154 -100
  43. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/AssetComponent.tsx +15 -4
  44. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Button.ts +56 -22
  45. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Spacer.ts +6 -4
  46. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/TextLabelsContainer.ts +3 -1
  47. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/PressableView.test.tsx +32 -21
  48. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/index.test.ts +15 -4
  49. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/index.ts +23 -16
  50. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/__tests__/insertButtons.test.ts +8 -3
  51. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/index.ts +2 -2
  52. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/__tests__/insertButtonsBetweenLabels.test.ts +45 -13
  53. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/index.ts +2 -2
  54. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/factory.test.ts +32 -0
  55. package/Components/MasterCell/contexts/PressedStateContext.ts +3 -0
  56. package/Components/MasterCell/dataAdapter.ts +15 -5
  57. package/Components/MasterCell/hooks/index.ts +2 -0
  58. package/Components/MasterCell/hooks/usePressedState.ts +4 -0
  59. package/Components/MasterCell/index.tsx +30 -5
  60. package/Components/MasterCell/utils/__tests__/resolveColor.test.js +169 -132
  61. package/Components/MasterCell/utils/__tests__/resolveColorForProp.test.js +92 -0
  62. package/Components/MasterCell/utils/index.ts +85 -46
  63. package/Components/ModalComponent/ActionsBottomSheet/ActionButton.tsx +56 -0
  64. package/Components/ModalComponent/ActionsBottomSheet/__tests__/openActionsBottomSheet.test.ts +38 -0
  65. package/Components/ModalComponent/ActionsBottomSheet/boundActionButton.tsx +24 -0
  66. package/Components/ModalComponent/ActionsBottomSheet/index.ts +9 -0
  67. package/Components/ModalComponent/ActionsBottomSheet/openActionsBottomSheet.ts +61 -0
  68. package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +392 -0
  69. package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +772 -0
  70. package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +728 -0
  71. package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +1028 -0
  72. package/Components/ModalComponent/AudioPlayer/Components/NowPlayingHeaderSection.tsx +205 -0
  73. package/Components/ModalComponent/AudioPlayer/Components/__tests__/Item.test.tsx +164 -0
  74. package/Components/ModalComponent/AudioPlayer/Components/__tests__/NowPlayingHeaderSection.test.tsx +36 -0
  75. package/Components/ModalComponent/AudioPlayer/Components/index.ts +9 -0
  76. package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +393 -0
  77. package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +523 -0
  78. package/Components/ModalComponent/BottomSheetDragArea.tsx +33 -0
  79. package/Components/ModalComponent/BottomSheetModalContent.tsx +436 -50
  80. package/Components/ModalComponent/Button/index.tsx +5 -3
  81. package/Components/ModalComponent/Header/CloseButton.tsx +12 -0
  82. package/Components/ModalComponent/Header/__tests__/CloseButton.test.tsx +72 -0
  83. package/Components/ModalComponent/Header/index.tsx +20 -7
  84. package/Components/ModalComponent/Header/utils.ts +1 -1
  85. package/Components/ModalComponent/ModalBlocksStyleContext.tsx +10 -0
  86. package/Components/ModalComponent/SortableList.tsx +156 -0
  87. package/Components/ModalComponent/SortableList.web.tsx +34 -0
  88. package/Components/ModalComponent/TextInputContent.tsx +135 -0
  89. package/Components/ModalComponent/__tests__/BottomSheetDragArea.test.tsx +74 -0
  90. package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +343 -0
  91. package/Components/ModalComponent/__tests__/SortableList.web.test.tsx +16 -0
  92. package/Components/ModalComponent/__tests__/TextInputContent.test.tsx +169 -0
  93. package/Components/ModalComponent/__tests__/showTextInput.test.ts +95 -0
  94. package/Components/ModalComponent/index.tsx +18 -9
  95. package/Components/ModalComponent/presets/__tests__/getCell.test.ts +90 -0
  96. package/Components/ModalComponent/presets/dynamicCollectionCell.tsx +78 -0
  97. package/Components/ModalComponent/presets/index.ts +27 -0
  98. package/Components/ModalComponent/presets/selectableCell.tsx +28 -0
  99. package/Components/ModalComponent/presets/standardCell.tsx +41 -0
  100. package/Components/ModalComponent/presets/types.ts +35 -0
  101. package/Components/ModalComponent/showTextInput.ts +52 -0
  102. package/Components/ModalComponent/utils.ts +82 -21
  103. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +4 -85
  104. package/Components/OfflineHandler/__tests__/index.test.tsx +186 -17
  105. package/Components/OfflineHandler/hooks.ts +111 -0
  106. package/Components/OfflineHandler/index.tsx +91 -75
  107. package/Components/OfflineHandler/utils/index.ts +1 -13
  108. package/Components/PlayerContainer/PlayerContainer.tsx +33 -18
  109. package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -4
  110. package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +337 -0
  111. package/Components/PreloaderWrapper/index.tsx +1 -1
  112. package/Components/River/ComponentsMap/ComponentsMap.tsx +87 -61
  113. package/Components/River/River.tsx +4 -0
  114. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +140 -89
  115. package/Components/River/__tests__/componentsMap.test.js +8 -3
  116. package/Components/River/__tests__/resultCallback.test.tsx +47 -0
  117. package/Components/Screen/__tests__/Screen.test.tsx +24 -0
  118. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -0
  119. package/Components/Screen/index.tsx +13 -4
  120. package/Components/Screen/navigationHandler.ts +8 -8
  121. package/Components/ScreenFeedLoader/ScreenFeedLoader.tsx +5 -3
  122. package/Components/ScreenResolverFeedProvider/ScreenResolverFeedProvider.tsx +1 -1
  123. package/Components/ScreenRevealManager/ScreenRevealManager.ts +18 -2
  124. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +36 -0
  125. package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +56 -0
  126. package/Components/ScreenRevealManager/withScreenRevealManager.tsx +21 -4
  127. package/Components/TopCutoffOverlay/index.tsx +2 -2
  128. package/Components/Transitioner/AnimationManager.js +1 -1
  129. package/Components/Transitioner/Scene.tsx +4 -3
  130. package/Components/Transitioner/Transitioner.tsx +98 -49
  131. package/Components/Transitioner/__tests__/transitioner.test.js +372 -3
  132. package/Components/VideoLive/LiveImageManager.ts +9 -3
  133. package/Components/VideoLive/__tests__/LiveImageManager.test.ts +59 -0
  134. package/Components/VideoModal/utils.ts +6 -1
  135. package/Components/ZappFrameworkComponents/BarView/BarView.tsx +12 -5
  136. package/Components/ZappFrameworkComponents/BarView/__tests__/BarView.test.tsx +2 -2
  137. package/Contexts/CachedDimensionsContext/__tests__/index.test.ts +154 -0
  138. package/Contexts/CachedDimensionsContext/index.ts +17 -2
  139. package/Contexts/ModalNavigationContext/__tests__/index.test.tsx +15 -0
  140. package/Contexts/ModalNavigationContext/index.tsx +2 -2
  141. package/Helpers/ComponentCellSelectionHelper/index.js +0 -6
  142. package/Helpers/index.js +0 -39
  143. package/Hooks/useEntryActionsExpander.ts +63 -0
  144. package/assets/empty-Info.png +0 -0
  145. package/package.json +6 -5
  146. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +0 -112
  147. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +0 -107
  148. package/Components/OfflineHandler/NotificationView/NotificationView.tsx +0 -153
  149. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -66
  150. package/Components/OfflineHandler/NotificationView/utils.ts +0 -34
  151. package/Components/Screen/utils.ts +0 -16
  152. package/Helpers/Analytics/index.js +0 -95
  153. /package/Components/BackgroundImage/{BackgroundImage.tv.android.tsx → BackgroundImage.android.tv.tsx} +0 -0
  154. /package/Components/BackgroundImage/{BackgroundImage.tv.ios.tsx → BackgroundImage.ios.tv.tsx} +0 -0
  155. /package/Components/MasterCell/DefaultComponents/ButtonContainerView/{index.tv.android.tsx → index.android.tv.tsx} +0 -0
  156. /package/Decorators/ZappPipesDataConnector/__tests__/{Hero.js → Hero.tsx} +0 -0
@@ -1,153 +0,0 @@
1
- import React, { useRef, useState, useEffect } from "react";
2
- import * as R from "ramda";
3
- import {
4
- View,
5
- Text,
6
- Animated,
7
- StyleSheet,
8
- TouchableWithoutFeedback,
9
- } from "react-native";
10
-
11
- import { usePlugins } from "@applicaster/zapp-react-native-redux";
12
- import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
13
- import { textTransform } from "@applicaster/zapp-react-native-utils/cellUtils";
14
- import { useNotificationHeight } from "../utils";
15
-
16
- export const onlinePhrase = "You are back online";
17
-
18
- export const offlinePhrase = "No internet connection";
19
-
20
- const styles = StyleSheet.create({
21
- notificationView: {
22
- flex: 1,
23
- position: "absolute",
24
- alignItems: "center",
25
- justifyContent: "center",
26
- top: 0,
27
- left: 0,
28
- right: 0,
29
- },
30
- });
31
-
32
- type Props = {
33
- children?: React.ReactNode;
34
- hidden?: boolean;
35
- online?: boolean;
36
- dismiss: () => void;
37
- };
38
-
39
- type NumberBoolean = 0 | 1;
40
-
41
- const OFFLINE_EXPERIENCE = "offline-experience";
42
-
43
- export const NotificationView = ({
44
- children,
45
- hidden = true,
46
- online = true,
47
- dismiss,
48
- }: Props) => {
49
- const plugins = usePlugins();
50
- const { statusHeight, notificationHeight } = useNotificationHeight();
51
-
52
- const offlinePlugin = R.find(
53
- R.propEq("identifier", OFFLINE_EXPERIENCE),
54
- plugins
55
- );
56
-
57
- const { useOfflineExperienceConfiguration } = offlinePlugin.module;
58
-
59
- const {
60
- configurationFields,
61
- localizations,
62
- }: {
63
- configurationFields: OfflineExperiencePluginConfiguration;
64
- localizations: OfflineExperienceLocalizations;
65
- } = useOfflineExperienceConfiguration?.();
66
-
67
- const [notificationOpacity, setNotificationOpacity] =
68
- useState<NumberBoolean>(0);
69
-
70
- const yPosition = useRef(new Animated.Value(0)).current;
71
-
72
- const showNotification = () => {
73
- setNotificationOpacity(1);
74
-
75
- Animated.timing(yPosition, {
76
- toValue: 1,
77
- useNativeDriver: true,
78
- duration: 300,
79
- }).start();
80
- };
81
-
82
- const hideNotification = () => {
83
- Animated.timing(yPosition, {
84
- toValue: 0,
85
- useNativeDriver: true,
86
- duration: 300,
87
- }).start(() => {
88
- setNotificationOpacity(0);
89
- });
90
- };
91
-
92
- useEffect(() => {
93
- hidden ? hideNotification() : showNotification();
94
- }, [hidden]);
95
-
96
- const backgroundColor = online
97
- ? configurationFields.offline_toast_online_background_color
98
- : configurationFields.offline_toast_offline_background_color;
99
-
100
- const animatedViewStyles = {
101
- ...styles.notificationView,
102
- transform: [
103
- {
104
- translateY: yPosition.interpolate({
105
- inputRange: [0, 1],
106
- outputRange: [-notificationHeight, 0],
107
- }),
108
- },
109
- ],
110
- opacity: notificationOpacity,
111
- height: notificationHeight,
112
- width: "100%",
113
- backgroundColor,
114
- };
115
-
116
- const textStyles = {
117
- color: online
118
- ? configurationFields.offline_toast_message_online_font_color
119
- : configurationFields.offline_toast_message_font_color,
120
- fontFamily: platformSelect({
121
- ios: configurationFields.offline_toast_message_ios_font_family,
122
- android: configurationFields.offline_toast_message_android_font_family,
123
- }),
124
- fontSize: configurationFields.offline_toast_message_font_size,
125
- lineHeight: configurationFields.offline_toast_message_line_height,
126
- letterSpacing: platformSelect({
127
- ios: configurationFields.offline_toast_message_letter_spacing_ios,
128
- android: configurationFields.offline_toast_message_letter_spacing_android,
129
- }),
130
- };
131
-
132
- const message = textTransform(
133
- configurationFields.offline_toast_message_text_transform,
134
- online
135
- ? localizations.online_toast_message
136
- : localizations.offline_toast_message
137
- );
138
-
139
- return (
140
- <View style={StyleSheet.absoluteFill}>
141
- {children}
142
- <TouchableWithoutFeedback
143
- style={styles.notificationView}
144
- onPress={dismiss}
145
- >
146
- <Animated.View style={animatedViewStyles}>
147
- <View style={{ height: statusHeight, backgroundColor }} />
148
- <Text style={textStyles}>{message}</Text>
149
- </Animated.View>
150
- </TouchableWithoutFeedback>
151
- </View>
152
- );
153
- };
@@ -1,66 +0,0 @@
1
- import React from "react";
2
- import { Text, Animated } from "react-native";
3
- import { render } from "@testing-library/react-native";
4
-
5
- import {
6
- NotificationView,
7
- onlinePhrase,
8
- offlinePhrase,
9
- } from "../NotificationView";
10
-
11
- jest.mock("@applicaster/zapp-react-native-redux", () => ({
12
- ...jest.requireActual("@applicaster/zapp-react-native-redux"),
13
- usePlugins: () => [
14
- {
15
- name: "offline experience",
16
- identifier: "offline-experience",
17
- type: "general",
18
- module: {
19
- useOfflineExperienceConfiguration: () => ({
20
- configurationFields: {},
21
- localizations: {
22
- offline_toast_message: "No internet connection",
23
- online_toast_message: "You are back online",
24
- },
25
- }),
26
- },
27
- },
28
- ],
29
- }));
30
-
31
- jest.mock("react-native-safe-area-context", () => ({
32
- useSafeAreaInsets: () => ({ top: 44 }),
33
- }));
34
-
35
- const dismiss = jest.fn();
36
-
37
- describe("NotificationView", () => {
38
- it("Show online message when Online", () => {
39
- const component = render(<NotificationView online dismiss={dismiss} />);
40
-
41
- expect(component.UNSAFE_getByType(Text).props.children).toBe(onlinePhrase);
42
- });
43
-
44
- it("Show offline message when Online", () => {
45
- const component = render(
46
- <NotificationView online={false} dismiss={dismiss} />
47
- );
48
-
49
- expect(component.UNSAFE_getByType(Text).props.children).toBe(offlinePhrase);
50
- });
51
-
52
- it("When hidden is false to true notification is visible", () => {
53
- const component = render(
54
- <NotificationView online={false} hidden={false} dismiss={dismiss} />
55
- );
56
-
57
- component.rerender(
58
- <NotificationView online={false} hidden={true} dismiss={dismiss} />
59
- );
60
-
61
- const animatedView = component.UNSAFE_getByType(Animated.View);
62
- const animatedViewStyles = animatedView.props.style;
63
-
64
- expect(animatedViewStyles.opacity).toBe(1);
65
- });
66
- });
@@ -1,34 +0,0 @@
1
- import * as React from "react";
2
- import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
3
-
4
- export const NETWORK_STATUS_LOCALIZATIONS_KEY = "network_status_localizations";
5
-
6
- export const THEME_STORAGE_NAMESPACE = "quick-brick-theme";
7
-
8
- export function useNetworkStatusLocalizations() {
9
- const [storedLocalizations, setStoredLocalizations] = React.useState<Record<
10
- string,
11
- string
12
- > | null>(null);
13
-
14
- React.useEffect(() => {
15
- async function loadStoredLocalizations() {
16
- try {
17
- const stored = await sessionStorage.getItem(
18
- NETWORK_STATUS_LOCALIZATIONS_KEY,
19
- THEME_STORAGE_NAMESPACE
20
- );
21
-
22
- if (stored) {
23
- setStoredLocalizations(stored);
24
- }
25
- } catch (error) {
26
- console.error("Error loading network status localizations", error);
27
- }
28
- }
29
-
30
- loadStoredLocalizations();
31
- }, []);
32
-
33
- return storedLocalizations;
34
- }
@@ -1,16 +0,0 @@
1
- import { map, split, replace, compose, trim } from "ramda";
2
-
3
- function colorIsNotTransparent(color) {
4
- const layers = compose(
5
- map(trim),
6
- split(","),
7
- replace(")", ""),
8
- replace("rgba(", "")
9
- )(color);
10
-
11
- return Number(layers?.[3]) > 0;
12
- }
13
-
14
- export function isValidColor(string) {
15
- return string && string !== "transparent" && colorIsNotTransparent(string);
16
- }
@@ -1,95 +0,0 @@
1
- import * as R from "ramda";
2
- import { postAnalyticEvent } from "@applicaster/zapp-react-native-tvos-app/AnalyticsManager";
3
- import { extensionsEvents } from "@applicaster/zapp-react-native-utils/analyticsUtils/AnalyticsEvents/helper";
4
- import {
5
- ANALYTICS_CORE_EVENTS,
6
- ANALYTICS_ENTRY_EVENTS,
7
- ANALYTICS_COMPONENT_EVENTS,
8
- ANALYTICS_MENU_ITEM_EVENTS,
9
- } from "../";
10
-
11
- export function sendTapCellEvent(item, component, headerTitle, itemIndex) {
12
- const itemReadableIndex = itemIndex + 1;
13
-
14
- const analyticsProperties = R.compose(
15
- R.reject(R.isNil),
16
- R.merge(eventForEntry(item, itemReadableIndex))
17
- )(eventForComponent(component, headerTitle));
18
-
19
- postEvent(ANALYTICS_CORE_EVENTS.TAP_CELL, analyticsProperties);
20
- }
21
-
22
- export function sendTapMenuItem({ item, index, isHome }) {
23
- const analyticsProperties = R.compose(R.reject(R.isNil))(
24
- eventForMenuItemEntry({ item, index, isHome })
25
- );
26
-
27
- postEvent(ANALYTICS_CORE_EVENTS.TAP_MENU_ICON, analyticsProperties);
28
-
29
- if (isHome) {
30
- postEvent(ANALYTICS_CORE_EVENTS.HOME_SCREEN_VIEWED, null);
31
- }
32
- }
33
-
34
- function postEvent(event, properties) {
35
- postAnalyticEvent(event, properties);
36
- }
37
-
38
- function eventForEntry(item, itemIndex) {
39
- const {
40
- title,
41
- type: { value: valueType },
42
- id,
43
- } = item;
44
-
45
- const analyticsCustomProperties = extensionsEvents(item.extensions);
46
-
47
- const analyticsEvents = {
48
- [ANALYTICS_ENTRY_EVENTS.ITEM_TYPE]: valueType,
49
- [ANALYTICS_ENTRY_EVENTS.ITEM_TITLE]: title,
50
- [ANALYTICS_ENTRY_EVENTS.ITEM_ID]: id,
51
- [ANALYTICS_ENTRY_EVENTS.ITEM_INDEX]:
52
- (itemIndex && itemIndex.toString()) || null,
53
- };
54
-
55
- if (analyticsCustomProperties) {
56
- analyticsEvents.analyticsCustomProperties = analyticsCustomProperties;
57
- }
58
-
59
- return analyticsEvents;
60
- }
61
-
62
- function eventForComponent(
63
- component,
64
- headerTitle, // Zapp Pipes data passed for group components
65
- zappPipesData = null
66
- ) {
67
- const { id, component_type, styles, data } = component;
68
- const { cell_style } = styles;
69
- const source = data?.source || zappPipesData?.data?.url || null;
70
-
71
- return {
72
- [ANALYTICS_COMPONENT_EVENTS.COMPONENT_ID]: id,
73
- [ANALYTICS_COMPONENT_EVENTS.COMPONENT_TYPE]: component_type,
74
- [ANALYTICS_COMPONENT_EVENTS.CELL_STYLE]:
75
- cell_style || ANALYTICS_CORE_EVENTS.ITEM_NOT_AVAILABLE,
76
- [ANALYTICS_COMPONENT_EVENTS.COMPONENT_SOURCE]:
77
- (source && encodeURIComponent(source)) || null,
78
- [ANALYTICS_COMPONENT_EVENTS.HEADER_TITLE]: headerTitle,
79
- };
80
- }
81
-
82
- function eventForMenuItemEntry({ item, index, isHome }) {
83
- const { title, type, id } = item;
84
-
85
- const itemReadableIndex = index + 1;
86
-
87
- return {
88
- [ANALYTICS_MENU_ITEM_EVENTS.ITEM_INDEX]:
89
- (itemReadableIndex && itemReadableIndex.toString()) || null,
90
- [ANALYTICS_MENU_ITEM_EVENTS.ITEM_TYPE]: type,
91
- [ANALYTICS_MENU_ITEM_EVENTS.ITEM_TITLE]: title,
92
- [ANALYTICS_MENU_ITEM_EVENTS.ITEM_ID]: id,
93
- [ANALYTICS_MENU_ITEM_EVENTS.ITEM_HOME_SCREEN]: isHome ? "YES" : "NO",
94
- };
95
- }