@applicaster/zapp-react-native-utils 14.0.0-alpha.5521273514 → 14.0.0-alpha.5621117258

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 { BehaviorSubject } from "rxjs";
2
2
  import { accessibilityManagerLogger as logger } from "./logger";
3
- import { TTSManager } from "../platform";
3
+ import { TTSManager } from "../platform/platformUtils";
4
4
  import { BUTTON_ACCESSIBILITY_KEYS } from "./const";
5
5
  import { AccessibilityRole } from "react-native";
6
6
 
@@ -8,7 +8,6 @@ const {
8
8
  conditional_horizontal_type,
9
9
  conditional_vertical_type,
10
10
  conditional_horizontal_type_item_fixed,
11
- conditional_horizontal_type_item_dynamic,
12
11
  conditional_horizontal_asset_on,
13
12
  conditional_horizontal_display_type_fixed,
14
13
  } = require("./utils");
@@ -48,7 +47,7 @@ const componentConfigurationFields = [
48
47
  { text: "Right", value: "right" },
49
48
  { text: "Center", value: "center" },
50
49
  ],
51
- ...conditional_horizontal_type_item_dynamic,
50
+ ...conditional_horizontal_type,
52
51
  },
53
52
  {
54
53
  type: "select",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "14.0.0-alpha.5521273514",
3
+ "version": "14.0.0-alpha.5621117258",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/applicaster-types": "14.0.0-alpha.5521273514",
30
+ "@applicaster/applicaster-types": "14.0.0-alpha.5621117258",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",
@@ -5,6 +5,7 @@ import { isFilledArray } from "@applicaster/zapp-react-native-utils/arrayUtils";
5
5
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
6
6
 
7
7
  import { getBoolFromConfigValue } from "../configurationUtils";
8
+ import { Dimensions } from "react-native";
8
9
 
9
10
  /**
10
11
  * Gets duration value from player manager, and from extensions
@@ -95,3 +96,53 @@ export const isAudioItem = (item: Option<ZappEntry>) => {
95
96
  export const isInlineTV = (screenData) => {
96
97
  return isTV() && isFilledArray(screenData?.ui_components);
97
98
  };
99
+
100
+ const isPercentage = (value: string | number): boolean => {
101
+ if (typeof value === "string") {
102
+ return value.includes("%");
103
+ }
104
+
105
+ return false;
106
+ };
107
+
108
+ const getPercentageOf = (percent: string, value: number) => {
109
+ const percentageValue = parseFloat(percent.replace("%", ""));
110
+
111
+ if (isNaN(percentageValue)) {
112
+ return value;
113
+ }
114
+
115
+ return (value * percentageValue) / 100;
116
+ };
117
+
118
+ type DimensionsT = {
119
+ width: number | string;
120
+ height: number | string | undefined;
121
+ aspectRatio?: number;
122
+ };
123
+
124
+ export const getTabletWidth = (
125
+ tablet_landscape_sidebar_width,
126
+ dimensions: DimensionsT
127
+ ) => {
128
+ const { width: SCREEN_WIDTH } = Dimensions.get("screen");
129
+
130
+ const { width } = dimensions;
131
+ let widthValue = Number(width);
132
+
133
+ if (isPercentage(width)) {
134
+ widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
135
+ }
136
+
137
+ const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
138
+
139
+ if (tablet_landscape_sidebar_width?.includes("%")) {
140
+ return widthValue * (1 - sidebarWidth / 100);
141
+ }
142
+
143
+ if (Number.isNaN(sidebarWidth)) {
144
+ return widthValue * 0.65;
145
+ }
146
+
147
+ return widthValue - sidebarWidth;
148
+ };
@@ -10,7 +10,7 @@ import {
10
10
  getSearchContext,
11
11
  } from "@applicaster/zapp-react-native-utils/reactHooks";
12
12
  import { isGallery } from "@applicaster/zapp-react-native-utils/componentsUtils";
13
- import { useScreenContext } from "../screen";
13
+ import { useScreenContext } from "../screen/useScreenContext";
14
14
 
15
15
  type Options = {
16
16
  initialBatchSize?: number;
@@ -5,7 +5,7 @@ import { getDatasourceUrl } from "@applicaster/zapp-react-native-ui-components/D
5
5
  import { usePipesContexts } from "@applicaster/zapp-react-native-ui-components/Decorators/RiverFeedLoader/utils/usePipesContexts";
6
6
  import { clearPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
7
7
 
8
- import { useRoute } from "../navigation";
8
+ import { useRoute } from "../navigation/useRoute";
9
9
 
10
10
  /**
11
11
  * reset river components cache when screen is unmounted
@@ -2,7 +2,7 @@ import { useContext, useMemo } from "react";
2
2
 
3
3
  import { useModalNavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ModalNavigationContext";
4
4
  import { useNestedNavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/NestedNavigationContext";
5
- import { useNavigation } from "../navigation";
5
+ import { useNavigation } from "../navigation/useNavigation";
6
6
 
7
7
  import { ScreenContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenContext";
8
8
  import { ScreenDataContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenDataContext";
@@ -3,7 +3,7 @@ import { NativeModules, StyleSheet, View } from "react-native";
3
3
  import { getXray } from "@applicaster/zapp-react-native-utils/logger";
4
4
 
5
5
  import { isApplePlatform, isWeb } from "../reactUtils";
6
- import { useRivers } from "../reactHooks";
6
+ import { useRivers } from "../reactHooks/state";
7
7
 
8
8
  const layoutReducer = (state, { payload }) => {
9
9
  return state.map((item, index, _state) => ({
@@ -496,7 +496,6 @@ async function removeStorageListenerHandler(payload: { listenerId?: string }) {
496
496
  function log({ level, messages }) {
497
497
  try {
498
498
  const parsedMessages = parseJsonIfNeeded(messages);
499
- // eslint-disable-next-line no-console
500
499
  const logFn = console[level] || console.log;
501
500
 
502
501
  if (Array.isArray(parsedMessages)) {