@applicaster/zapp-react-native-utils 12.0.0-alpha.4963544520 → 12.0.0-alpha.4987513251

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 (32) hide show
  1. package/analyticsUtils/AnalyticPlayerListener.ts +141 -0
  2. package/analyticsUtils/PlayerAnalyticsManager.ts +90 -0
  3. package/analyticsUtils/{analyticsTracker.ts → playerAnalyticsTracker.ts} +19 -10
  4. package/appUtils/accessibilityManager/const.ts +50 -0
  5. package/appUtils/accessibilityManager/hooks.ts +40 -0
  6. package/appUtils/accessibilityManager/index.ts +166 -0
  7. package/appUtils/accessibilityManager/logger.ts +5 -0
  8. package/appUtils/focusManager/index.ts +0 -1
  9. package/appUtils/focusManager/treeDataStructure/Utils/index.js +1 -1
  10. package/appUtils/index.js +2 -0
  11. package/appUtils/platform/platformUtils.ts +71 -77
  12. package/appUtils/playerManager/conts.ts +1 -0
  13. package/appUtils/playerManager/index.ts +9 -27
  14. package/appUtils/playerManager/player.ts +9 -0
  15. package/appUtils/playerManager/playerHooks/usePlayerCurrentTime.tsx +57 -0
  16. package/appUtils/playerManager/playerNative.ts +1 -1
  17. package/appUtils/playerManager/usePlayerControllerSetup.tsx +2 -1
  18. package/appUtils/playerManager/usePlayerState.tsx +19 -34
  19. package/cellUtils/index.ts +5 -5
  20. package/functionUtils/index.ts +38 -0
  21. package/index.d.ts +15 -0
  22. package/navigationUtils/index.ts +48 -0
  23. package/numberUtils/__tests__/toNumber.test.ts +2 -2
  24. package/package.json +2 -2
  25. package/playerUtils/imaScriptDom.ts +59 -0
  26. package/pluginUtils/index.ts +9 -0
  27. package/reactHooks/debugging/__tests__/index.test.js +81 -11
  28. package/reactHooks/layout/useDimensions/useDimensions.ts +2 -0
  29. package/reactHooks/navigation/index.ts +4 -0
  30. package/reactHooks/player/useAutoSeek.tsx +5 -4
  31. package/reactHooks/resolvers/useCellResolver.ts +5 -1
  32. package/reactUtils/index.ts +4 -2
@@ -1,8 +1,10 @@
1
1
  import { BehaviorSubject } from "rxjs";
2
2
 
3
3
  import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
4
- import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
5
- import { PlayerWebController } from "@applicaster/zapp-react-native-default-player/src/playerFactory/players/playerWebController";
4
+ import {
5
+ isLgPlatform,
6
+ isSamsungPlatform,
7
+ } from "@applicaster/zapp-react-dom-app/App/Loader/utils/platform";
6
8
 
7
9
  import { PLATFORM_KEYS, PLATFORMS } from "./const";
8
10
  import { createLogger, utilsLogger } from "../../logger";
@@ -11,6 +13,9 @@ declare global {
11
13
  interface Window {
12
14
  VIZIO?: {
13
15
  exitApplication: () => void;
16
+ Chromevox: {
17
+ play: (text: string) => void;
18
+ };
14
19
  setClosedCaptionHandler: (
15
20
  callback: (isCCEnabled: boolean) => void
16
21
  ) => void;
@@ -18,7 +23,7 @@ declare global {
18
23
  }
19
24
  }
20
25
 
21
- const { log_debug, log_error } = createLogger({
26
+ const { log_debug } = createLogger({
22
27
  category: "General",
23
28
  subsystem: "PlatformUtils",
24
29
  parent: utilsLogger,
@@ -63,7 +68,7 @@ export const hasVizioAPIs = () => {
63
68
  * Manages device based closed captioning state
64
69
  * Returns an observable that emits the current state and updates whenever it changes
65
70
  */
66
- class ClosedCaptioningManager {
71
+ export class ClosedCaptioningManager {
67
72
  private ccState$ = new BehaviorSubject<boolean>(false);
68
73
  private static ccManagerInstance: ClosedCaptioningManager;
69
74
 
@@ -128,96 +133,85 @@ export const getClosedCaptionState = () => {
128
133
  return ccManager.getStateAsObservable();
129
134
  };
130
135
 
131
- export class TextTrackManager {
132
- private controller?: PlayerWebController;
133
- private static instance: TextTrackManager;
134
-
135
- private constructor() {}
136
-
137
- static getInstance(): TextTrackManager {
138
- if (!TextTrackManager.instance) {
139
- TextTrackManager.instance = new TextTrackManager();
140
- }
136
+ /**
137
+ * Manages device based closed captioning state
138
+ * Returns an observable that emits the current state and updates whenever it changes
139
+ */
140
+ export class TTSManager {
141
+ private ttsState$ = new BehaviorSubject<boolean>(false);
142
+ private static ttsManagerInstance: TTSManager;
141
143
 
142
- return TextTrackManager.instance;
144
+ private constructor() {
145
+ this.initialize();
143
146
  }
144
147
 
145
- initialize(controller: PlayerWebController) {
146
- if (!controller) {
147
- throw new Error(
148
- "Controller is required for TextTrackManager initialization"
149
- );
148
+ static getInstance(): TTSManager {
149
+ if (!TTSManager.ttsManagerInstance) {
150
+ TTSManager.ttsManagerInstance = new TTSManager();
150
151
  }
151
152
 
152
- this.controller = controller;
153
+ return TTSManager.ttsManagerInstance;
153
154
  }
154
155
 
155
- async setTextTrackBasedOnCaptions(closedCaptionsState: boolean) {
156
- if (!this.controller) {
157
- log_error("Controller is not initialized");
158
-
159
- return;
160
- }
161
-
162
- if (closedCaptionsState) {
163
- const textTracks = this.controller.getTracksState().textTracks;
164
- const preferredTextTrack = await this.getPreferredTextTrack(textTracks);
165
-
166
- if (preferredTextTrack) {
167
- this.controller.selectTrack(preferredTextTrack);
168
- }
169
- } else {
170
- this.controller.selectTrack(null);
171
- }
172
- }
173
-
174
- async getPreferredTextTrack(
175
- textTracks: QuickBrickPlayer.TextTrack[]
176
- ): Promise<QuickBrickPlayer.TextTrack | undefined> {
177
- if (!this.controller) return;
156
+ async initialize() {
157
+ if (!isVizioPlatform()) return;
158
+
159
+ document.addEventListener(
160
+ "VIZIO_TTS_ENABLED",
161
+ () => {
162
+ this.ttsState$.next(true);
163
+ },
164
+ false
165
+ );
178
166
 
179
- const userPreferredTextLanguageLocalStorage = await localStorage.getItem(
180
- "preferred_text_language",
181
- "user_preferences"
167
+ document.addEventListener(
168
+ "VIZIO_TTS_DISABLED",
169
+ () => {
170
+ this.ttsState$.next(false);
171
+ },
172
+ false
182
173
  );
174
+ }
183
175
 
184
- let userPreferredTextLanguage;
176
+ getCurrentState(): boolean {
177
+ return this.ttsState$.getValue();
178
+ }
185
179
 
186
- if (userPreferredTextLanguageLocalStorage) {
187
- userPreferredTextLanguage = textTracks.find(
188
- (track) => track.language === userPreferredTextLanguageLocalStorage
189
- );
190
- }
180
+ getStateAsObservable() {
181
+ return this.ttsState$.asObservable();
182
+ }
191
183
 
192
- if (userPreferredTextLanguage?.id) {
193
- return userPreferredTextLanguage;
184
+ readText(text: string) {
185
+ if (isSamsungPlatform() && window.speechSynthesis) {
186
+ const utterance = new SpeechSynthesisUtterance(text);
187
+ window.speechSynthesis.speak(utterance);
194
188
  }
195
189
 
196
- const enableAutoTextTrackSelection =
197
- this.controller.getPluginConfiguration()
198
- ?.enable_auto_text_track_selection ||
199
- this.controller.getTracksState().textTracks.length > 0;
200
-
201
- if (enableAutoTextTrackSelection) {
202
- const languageCode = await sessionStorage.getItem("languageCode");
203
-
204
- if (languageCode) {
205
- const chosenTextTrackBySystemLanguage = textTracks.find(
206
- (track) => track.language === languageCode
207
- );
208
-
209
- if (chosenTextTrackBySystemLanguage?.id) {
210
- return chosenTextTrackBySystemLanguage;
211
- }
190
+ if (isLgPlatform() && window.webOS?.service) {
191
+ try {
192
+ window.webOS.service.request("luna://com.webos.service.tts", {
193
+ method: "speak",
194
+ onFailure(error: any) {
195
+ log_debug("There was a failure setting up webOS TTS service", {
196
+ error,
197
+ });
198
+ },
199
+ onSuccess(response: any) {
200
+ log_debug("webOS TTS service is configured successfully", {
201
+ response,
202
+ });
203
+ },
204
+ parameters: {
205
+ text,
206
+ },
207
+ });
208
+ } catch (error) {
209
+ log_debug("webOS TTS service error", { error });
212
210
  }
213
211
  }
214
212
 
215
- return textTracks?.[0];
216
- }
217
-
218
- isTextTrackEnabled(): boolean {
219
- if (!this.controller) return false;
213
+ if (!window.VIZIO?.Chromevox) return;
220
214
 
221
- return this.controller.getTracksState().textTrackId !== null;
215
+ window.VIZIO.Chromevox.play(text);
222
216
  }
223
217
  }
@@ -7,6 +7,7 @@ export enum SharedPlayerCallBacksKeys {
7
7
  OnPlayerPause = "onPlayerPause",
8
8
  OnLoad = "onLoad",
9
9
  OnError = "onError",
10
+ OnVideoError = "onVideoError",
10
11
  OnVideoEnd = "onVideoEnd",
11
12
  OnPlaybackRateChange = "onPlaybackRateChange",
12
13
  OnVideoLoad = "onVideoLoad",
@@ -3,7 +3,6 @@ import * as R from "ramda";
3
3
  import { subscriber } from "../../functionUtils";
4
4
  import { utilsLogger, createLogger } from "../../logger";
5
5
  import { Player } from "./player";
6
- import { AnalyticsTracker } from "../../analyticsUtils/analyticsTracker";
7
6
  import {
8
7
  hasTizenAPIs,
9
8
  subscribeToDeviceNetworkChanges,
@@ -37,7 +36,10 @@ export interface PlayerLifecycleListener {
37
36
  }
38
37
 
39
38
  type PlayersMap = {
40
- [id: string]: { player: Player; isInViewport: boolean };
39
+ [id: string]: {
40
+ player: Player;
41
+ isInViewport: boolean;
42
+ };
41
43
  };
42
44
 
43
45
  export class PlayerManager {
@@ -46,7 +48,6 @@ export class PlayerManager {
46
48
  private playersMap: PlayersMap = {};
47
49
  private manager = subscriber();
48
50
  private castingReceiver: Player;
49
- private analyticsTracker: AnalyticsTracker;
50
51
  private lifecycleListeners: PlayerLifecycleListener[] = [];
51
52
 
52
53
  public static getInstance() {
@@ -57,7 +58,7 @@ export class PlayerManager {
57
58
  return PlayerManager.instance;
58
59
  }
59
60
 
60
- public getActivePlayerId = (): String | null => {
61
+ public getActivePlayerId = (): string | null => {
61
62
  return this.activePlayerId;
62
63
  };
63
64
 
@@ -102,7 +103,10 @@ export class PlayerManager {
102
103
  }
103
104
 
104
105
  private addPlayer = (id: string, player: Player) => {
105
- this.playersMap[id] = { player: player, isInViewport: false };
106
+ this.playersMap[id] = {
107
+ player: player,
108
+ isInViewport: false,
109
+ };
106
110
  };
107
111
 
108
112
  public isPlayerRegistered = (id: string) => !!this.playersMap[id];
@@ -251,28 +255,6 @@ export class PlayerManager {
251
255
  this.castingReceiver = null;
252
256
  }
253
257
 
254
- /**
255
- * Handles analytic events, generates a new analytics tracker and transmits events
256
- * Passes entry data, and playerState to the tracker for additional context
257
- * The end result is an event formatted and passed to AnalyticsBridge.postEvent
258
- * When we get the synthetic event we need to pull the data in the e object
259
- * e contains the return value from native
260
- */
261
- public handleAnalyticEvent(event, data = {}, entry: ZappEntry) {
262
- const playerState = this.getActivePlayer()?.getState();
263
-
264
- if (!this.analyticsTracker?.handleAnalyticEvent) {
265
- this.analyticsTracker = new AnalyticsTracker(entry);
266
- }
267
-
268
- this.analyticsTracker?.handleAnalyticEvent?.(
269
- event,
270
- data,
271
- entry,
272
- playerState
273
- );
274
- }
275
-
276
258
  /**
277
259
  * Method retrieves the instantiated player instance controller
278
260
  * Instance controller exposes methods like getContentDuration, getContentPosision
@@ -359,6 +359,13 @@ export class Player {
359
359
  });
360
360
  };
361
361
 
362
+ onVideoError = (error: Error) => {
363
+ this.invokeListenersUpdate({
364
+ callbackName: SharedPlayerCallBacksKeys.OnVideoError,
365
+ event: error,
366
+ });
367
+ };
368
+
362
369
  onError = (error: Error) => {
363
370
  this.invokeListenersUpdate({
364
371
  callbackName: SharedPlayerCallBacksKeys.OnError,
@@ -650,6 +657,7 @@ export class Player {
650
657
  onPlayerSeekComplete: this.onSeekComplete,
651
658
  onVideoEnd: this.onVideoEnd,
652
659
  onError: this.onError,
660
+ onVideoError: this.onVideoError,
653
661
  onLoad: this.onLoad,
654
662
  onPlayerPause: this.onPlayerPause,
655
663
  onPlayerResume: this.onPlayerResume,
@@ -725,4 +733,5 @@ export class Player {
725
733
 
726
734
  public supportsNativeControls = (): boolean => false;
727
735
  public supportNativeCast = (): boolean => false;
736
+ public destroy = () => {};
728
737
  }
@@ -0,0 +1,57 @@
1
+ import { useState, useEffect, useCallback } from "react";
2
+ import { Player } from "../player";
3
+ import { usePlayer } from "../usePlayer";
4
+ import { useThrottle } from "../../../functionUtils";
5
+
6
+ /**
7
+ *
8
+ * @param listenerId - A unique identifier for the listener.
9
+ * @param playerId - (Optional) The ID of the player to observe.
10
+ * @returns The current playback time in seconds.
11
+ */
12
+ export const usePlayerCurrentTime = (
13
+ listenerId: string,
14
+ playerId?: string
15
+ ): number | null => {
16
+ const [currentTime, setCurrentTime] = useState<number | null>(null);
17
+ const player: Player = usePlayer(playerId);
18
+
19
+ const updateCurrentTime = useCallback(() => {
20
+ if (player) {
21
+ const newCurrentTime = player.getContentPosition();
22
+
23
+ setCurrentTime((prevTime) =>
24
+ prevTime !== newCurrentTime ? newCurrentTime : prevTime
25
+ );
26
+ }
27
+ }, [player]);
28
+
29
+ const { throttledFunction: throttledUpdate, cancel } = useThrottle(
30
+ updateCurrentTime,
31
+ 1000
32
+ );
33
+
34
+ useEffect(() => {
35
+ if (player) {
36
+ throttledUpdate();
37
+
38
+ const listeners = {
39
+ onVideoProgress: throttledUpdate,
40
+ };
41
+
42
+ const id = `${listenerId}_player_current_time`;
43
+
44
+ player.addListener({
45
+ id: id,
46
+ listener: listeners,
47
+ });
48
+
49
+ return () => {
50
+ player.removeListener(id);
51
+ cancel();
52
+ };
53
+ }
54
+ }, [player, listenerId, throttledUpdate, cancel]);
55
+
56
+ return currentTime;
57
+ };
@@ -61,7 +61,7 @@ export class PlayerNative extends Player {
61
61
  currentPlayerComponent = (): ReactComponent<PlayerProps> =>
62
62
  this.playerComponent?.current;
63
63
 
64
- getState = () => this.currentPlayerComponent()?.["getState"]?.() ?? {};
64
+ getState = () => this.playerState;
65
65
 
66
66
  // TODO: Try to add module interface
67
67
  invokeNativeFunction = (funcName: string, ...params: any[]): boolean => {
@@ -50,7 +50,7 @@ export const usePlayerControllerSetup = ({
50
50
  });
51
51
 
52
52
  setPlayerController(newPlayerController);
53
- }, [playerId, entry?.id]);
53
+ }, [playerId, entry?.id, ref.current]);
54
54
 
55
55
  React.useEffect(() => {
56
56
  if (!playerController) {
@@ -72,6 +72,7 @@ export const usePlayerControllerSetup = ({
72
72
 
73
73
  return () => {
74
74
  playerManager.unregisterPlayer(playerId);
75
+ playerController.destroy?.();
75
76
  };
76
77
  }, [playerId, playerController]);
77
78
 
@@ -16,24 +16,28 @@ export const usePlayerState = (
16
16
  listenerId: string,
17
17
  playerId?: string
18
18
  ): PlayerState => {
19
- const [currentTime, setCurrentTime] = React.useState<number>(null);
20
- const [duration, setDuration] = React.useState<number>(null);
21
- const [seekableDuration, setSeekableDuration] = React.useState<number>(null);
22
- const [isLive, setIsLive] = React.useState<boolean>(null);
23
- const [isBuffering, setIsBuffering] = React.useState<boolean>(false);
24
- const [isReadyToPlay, setIsReadyToPlay] = React.useState<boolean>(false);
25
- const [isPaused, setIsPaused] = React.useState<boolean>(false);
19
+ const [state, setState] = React.useState<PlayerState>({
20
+ currentTime: null,
21
+ duration: null,
22
+ seekableDuration: null,
23
+ isLive: null,
24
+ isPaused: null,
25
+ isBuffering: false,
26
+ isReadyToPlay: false,
27
+ });
26
28
 
27
29
  const player: Player = usePlayer(playerId);
28
30
 
29
31
  const onPlayerChangeState = React.useCallback(() => {
30
- setIsBuffering(player.isBuffering());
31
- setIsReadyToPlay(player.isReadyToPlay);
32
- setCurrentTime(player.getContentPosition());
33
- setDuration(player.getDuration());
34
- setSeekableDuration(player.getSeekableDuration());
35
- setIsLive(player.isLive());
36
- setIsPaused(player.isPaused());
32
+ setState({
33
+ currentTime: player.getContentPosition(),
34
+ duration: player.getDuration(),
35
+ seekableDuration: player.getSeekableDuration(),
36
+ isLive: player.isLive(),
37
+ isPaused: player.isPaused(),
38
+ isBuffering: player.isBuffering(),
39
+ isReadyToPlay: player.isReadyToPlay(),
40
+ });
37
41
  }, [player]);
38
42
 
39
43
  React.useEffect(() => {
@@ -55,24 +59,5 @@ export const usePlayerState = (
55
59
  }
56
60
  }, [player]);
57
61
 
58
- return React.useMemo(
59
- () => ({
60
- currentTime,
61
- duration,
62
- seekableDuration,
63
- isLive,
64
- isPaused,
65
- isBuffering,
66
- isReadyToPlay,
67
- }),
68
- [
69
- currentTime,
70
- duration,
71
- seekableDuration,
72
- isLive,
73
- isPaused,
74
- isBuffering,
75
- isReadyToPlay,
76
- ]
77
- );
62
+ return state;
78
63
  };
@@ -31,13 +31,12 @@ export const getKeyForLabel = (dataKey, customKey) => {
31
31
  * This method will return true if the argument passed to it is either empty or nil
32
32
  * The method prevents zero from being evaluated as falsey in an || condition
33
33
  * i.e. - NaN, null, {}, "", [], should all return true
34
- * @param {*} argument - argument passed to it could be any type
35
34
  * @returns {Boolean} returns true if empty or nil
35
+ * @param value
36
36
  */
37
- export const isEmptyOrNil = R.either(
38
- R.equals(NaN),
39
- R.either(R.isEmpty, R.isNil)
40
- );
37
+
38
+ export const isEmptyOrNil = (value: any): boolean =>
39
+ Number.isNaN(value) || value == null || R.isEmpty(value);
41
40
 
42
41
  /**
43
42
  * This method is used to find the appropriate label for any given text field.
@@ -320,6 +319,7 @@ export const ifElseFocusedSelected = (
320
319
  * @param {Object} stylesObj styles object with keys from zapp { button_icon_width: "10" }
321
320
  * @returns {*} value, returns any type that can be used as styles
322
321
  */
322
+
323
323
  export const getValue = (stylesObj) => (key) => {
324
324
  return R.propOr(null, key, stylesObj);
325
325
  };
@@ -1,4 +1,42 @@
1
1
  import * as R from "ramda";
2
+ import { useRef } from "react";
3
+
4
+ /**
5
+ *
6
+ * @param callback - The function to throttle.
7
+ * @param delay - The delay in milliseconds.
8
+ * @returns A throttled version of the callback.
9
+ */
10
+ export const useThrottle = (callback: () => void, delay: number) => {
11
+ const lastCallRef = useRef<number>(0);
12
+ const timeoutRef = useRef<any | null>(null);
13
+
14
+ const throttledFunction = () => {
15
+ const now = Date.now();
16
+
17
+ if (now - lastCallRef.current >= delay) {
18
+ callback();
19
+ lastCallRef.current = now;
20
+ } else if (!timeoutRef.current) {
21
+ const remainingTime = delay - (now - lastCallRef.current);
22
+
23
+ timeoutRef.current = setTimeout(() => {
24
+ callback();
25
+ lastCallRef.current = Date.now();
26
+ timeoutRef.current = null;
27
+ }, remainingTime);
28
+ }
29
+ };
30
+
31
+ const cancel = () => {
32
+ if (timeoutRef.current) {
33
+ clearTimeout(timeoutRef.current);
34
+ timeoutRef.current = null;
35
+ }
36
+ };
37
+
38
+ return { throttledFunction, cancel };
39
+ };
2
40
 
3
41
  /**
4
42
  * standard debounce function.
package/index.d.ts CHANGED
@@ -143,3 +143,18 @@ declare type BuilderData = {
143
143
  river?: ZappRiver;
144
144
  method?: string;
145
145
  };
146
+
147
+ declare type AccessibilityState = {
148
+ screenReaderEnabled: boolean;
149
+ reduceMotionEnabled: boolean;
150
+ boldTextEnabled: boolean;
151
+ };
152
+
153
+ declare type AccessibilityProps = {
154
+ accessibilityLabel?: string;
155
+ accessibilityHint?: string;
156
+ "aria-label"?: string;
157
+ "aria-description"?: string;
158
+ accessibilityRole?: string;
159
+ "aria-role"?: string;
160
+ };
@@ -592,3 +592,51 @@ export function isMenuDisabled(
592
592
  export function routeIsPlayerScreen(currentRoute) {
593
593
  return currentRoute?.includes("/playable");
594
594
  }
595
+
596
+ export const getNavBarProps =
597
+ (currentRiver: ZappRiver, pathname: string, title: string) => () => {
598
+ const props = getNavigationPropsV2({
599
+ currentRiver,
600
+ title,
601
+ category: "nav_bar",
602
+ });
603
+
604
+ if (props) {
605
+ return {
606
+ ...props,
607
+ id: pathname,
608
+ pathname: pathname,
609
+ };
610
+ }
611
+
612
+ return null;
613
+ };
614
+
615
+ export const findMenuPlugin = (
616
+ navigations: ZappNavigation[],
617
+ plugins
618
+ ): QuickBrickPlugin => {
619
+ return resolveNavigationPlugin({
620
+ category: "menu",
621
+ navigations,
622
+ plugins,
623
+ }) as QuickBrickPlugin;
624
+ };
625
+
626
+ export const shouldNavBarDisplayMenu = (currentRiver: ZappRiver, plugins) =>
627
+ findMenuPlugin(currentRiver.navigations, plugins)?.identifier ===
628
+ "quick_brick_side_menu" ||
629
+ currentRiver?.navigations.findIndex(
630
+ (nav) => nav.category === "nav_bar" && nav.general?.override_menu_target
631
+ ) > -1;
632
+
633
+ export const getScreenId = (
634
+ screenData: LegacyNavigationScreenData,
635
+ fallbackRiver: ZappRiver
636
+ ) => {
637
+ return screenData?.targetScreen
638
+ ? screenData?.targetScreen?.id ?? fallbackRiver.id
639
+ : "screen_id" in screenData
640
+ ? screenData.screen_id
641
+ : fallbackRiver.id;
642
+ };
@@ -2,7 +2,7 @@ import { toNumber } from "..";
2
2
 
3
3
  describe("toNumber", () => {
4
4
  it("return number if input is number", () => {
5
- const inputs = [-1, 0, 1, 100];
5
+ const inputs = [-1, 0, 1, 100, 0.2];
6
6
  expect.assertions(inputs.length);
7
7
 
8
8
  inputs.forEach((input) => {
@@ -12,7 +12,7 @@ describe("toNumber", () => {
12
12
  });
13
13
 
14
14
  it("return number if input is string as number", () => {
15
- const inputs = ["-1", "0", "1", "100"];
15
+ const inputs = ["-1", "0", "1", "100", "0.2"];
16
16
  expect.assertions(inputs.length);
17
17
 
18
18
  inputs.forEach((input) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "12.0.0-alpha.4963544520",
3
+ "version": "12.0.0-alpha.4987513251",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "12.0.0-alpha.4963544520",
31
+ "@applicaster/applicaster-types": "12.0.0-alpha.4987513251",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",