@applicaster/zapp-react-native-ui-components 14.0.32-alpha.3791942842 → 14.0.32

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.
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { StyleSheet } from "react-native";
3
- import { SafeAreaView } from "react-native-safe-area-context";
3
+ import { SafeAreaView } from "@applicaster/zapp-react-native-ui-components/Components/SafeAreaView";
4
4
 
5
5
  import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
6
6
  import CloseButton from "./Buttons/CloseButton";
@@ -1,6 +1,7 @@
1
1
  import { create, useStore } from "zustand";
2
2
  import { produce } from "immer";
3
3
  import { useCallback, useMemo } from "react";
4
+ import { last } from "@applicaster/zapp-react-native-utils/utils";
4
5
 
5
6
  type Dimensions = {
6
7
  width: Option<number>;
@@ -10,14 +11,17 @@ type Dimensions = {
10
11
  type DimensionsState = {
11
12
  dimensions: Record<string, Dimensions>;
12
13
  setCachedDimensions: (id: string, dimensions: Dimensions) => void;
14
+ ids: string[];
13
15
  };
14
16
 
15
17
  const dimensionsStore = create<DimensionsState>((set) => ({
16
18
  dimensions: {},
19
+ ids: [],
17
20
  setCachedDimensions: (id, dimensions) =>
18
21
  set(
19
22
  produce((draft) => {
20
23
  draft.dimensions[id] = dimensions;
24
+ draft.ids.push(id);
21
25
  })
22
26
  ),
23
27
  }));
@@ -28,7 +32,7 @@ const initialDimensions = () => ({
28
32
  });
29
33
 
30
34
  export const useCachedDimensions = (id: string) => {
31
- const { dimensions, setCachedDimensions } = useStore(
35
+ const { dimensions, setCachedDimensions, ids } = useStore(
32
36
  dimensionsStore
33
37
  ) as DimensionsState;
34
38
 
@@ -40,11 +44,22 @@ export const useCachedDimensions = (id: string) => {
40
44
  setCachedDimensions(id, newDimensions);
41
45
  }, []);
42
46
 
47
+ const getLastCachedDimensions = useCallback(() => {
48
+ const previousId = last(ids);
49
+
50
+ if (!previousId) {
51
+ return undefined;
52
+ }
53
+
54
+ return dimensions[previousId];
55
+ }, [dimensions, ids]);
56
+
43
57
  return useMemo(
44
58
  () => ({
45
59
  getCachedDimensions,
46
60
  setCachedDimensions: handleSetCachedDimensions,
61
+ getLastCachedDimensions,
47
62
  }),
48
- [getCachedDimensions, handleSetCachedDimensions]
63
+ [getCachedDimensions, handleSetCachedDimensions, getLastCachedDimensions]
49
64
  );
50
65
  };
@@ -1,4 +1,3 @@
1
- import { sendTapCellEvent, sendTapMenuItem } from "../Analytics";
2
1
  import { getItemType } from "@applicaster/zapp-react-native-utils/navigationUtils";
3
2
  import { SCREEN_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/itemTypes";
4
3
 
@@ -12,7 +11,6 @@ export function onCellPress(
12
11
  itemIndex,
13
12
  layoutVersion = "v1"
14
13
  ) {
15
- sendTapCellEvent(entry, component, headerTitle, itemIndex);
16
14
  const componentScreenType = screenTypeFromComponent(component);
17
15
  const entryScreenType = screenTypeFromEntry(entry);
18
16
  const itemType = getItemType(entry, layoutVersion);
@@ -37,7 +35,3 @@ function screenTypeFromComponent(component) {
37
35
  function screenTypeFromEntry(entry) {
38
36
  return entry && entry.screen_type;
39
37
  }
40
-
41
- export function onMenuItemFocus({ item, index, isHome }) {
42
- sendTapMenuItem({ item, index, isHome });
43
- }
package/Helpers/index.js CHANGED
@@ -7,42 +7,3 @@ export const ASSETS = {
7
7
  amazon: "tv_app_background",
8
8
  }),
9
9
  };
10
-
11
- export const ANALYTICS_CORE_EVENTS = {
12
- TAP_CELL: "Tap Cell",
13
- PLAY_VOD_ITEM: "Play VOD Item",
14
- VOD_ITEM_PLAY_WAS_TRIGGERED: "VOD Item: Play Was Triggered",
15
- CHANNEL_ITEM_PLAY_WAS_TRIGGERED: "Channel Item: Play Was Triggered",
16
- PROGRAM_ITEM_PLAY_WAS_TRIGGERED: "Program Item: Play Was Triggered",
17
- TAP_MENU_ICON: "Tap Menu Item",
18
- HOME_SCREEN_VIEWED: "Home Screen: Viewed",
19
- ITEM_NOT_AVAILABLE: "N/A",
20
- };
21
-
22
- export const ANALYTICS_ENTRY_EVENTS = {
23
- ITEM_TYPE: "Item Type",
24
- ITEM_TITLE: "Item Name",
25
- ITEM_ID: "Item ID",
26
- ITEM_LINK: "Item Link",
27
- ITEM_INDEX: "Item Number",
28
- ITEM_TIME_PLAYED: "Item Total Time Played",
29
- ITEM_TOTAL_TIME_PLAYED: "Item Total Time Played",
30
- ITEM_PLAY_COMPLETED: "Completed",
31
- ITEM_CUSTOM_PROPERTY: "Custom Property",
32
- };
33
-
34
- export const ANALYTICS_COMPONENT_EVENTS = {
35
- COMPONENT_ID: "Component ID",
36
- COMPONENT_TYPE: "Component Type",
37
- CELL_STYLE: "Cell Style",
38
- HEADER_TITLE: "Header Name",
39
- COMPONENT_SOURCE: "Component Source",
40
- };
41
-
42
- export const ANALYTICS_MENU_ITEM_EVENTS = {
43
- ITEM_TYPE: "Item Type",
44
- ITEM_TITLE: "Item Name",
45
- ITEM_ID: "Item ID",
46
- ITEM_HOME_SCREEN: "Home Screen",
47
- ITEM_INDEX: "Item Number",
48
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "14.0.32-alpha.3791942842",
3
+ "version": "14.0.32",
4
4
  "description": "Applicaster Zapp React Native ui components for the Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "14.0.32-alpha.3791942842",
32
- "@applicaster/zapp-react-native-bridge": "14.0.32-alpha.3791942842",
33
- "@applicaster/zapp-react-native-redux": "14.0.32-alpha.3791942842",
34
- "@applicaster/zapp-react-native-utils": "14.0.32-alpha.3791942842",
31
+ "@applicaster/applicaster-types": "14.0.32",
32
+ "@applicaster/zapp-react-native-bridge": "14.0.32",
33
+ "@applicaster/zapp-react-native-redux": "14.0.32",
34
+ "@applicaster/zapp-react-native-utils": "14.0.32",
35
35
  "fast-json-stable-stringify": "^2.1.0",
36
36
  "promise": "^8.3.0",
37
37
  "url": "^0.11.0",
@@ -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
- }