@applicaster/zapp-react-native-utils 15.0.0-alpha.9331298916 → 15.0.0-alpha.9423906047

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 (50) hide show
  1. package/actionsExecutor/ActionExecutorContext.tsx +3 -6
  2. package/actionsExecutor/feedDecorator.ts +6 -6
  3. package/adsUtils/index.ts +2 -2
  4. package/analyticsUtils/README.md +1 -1
  5. package/appUtils/HooksManager/index.ts +10 -10
  6. package/appUtils/accessibilityManager/__tests__/utils.test.ts +360 -0
  7. package/appUtils/accessibilityManager/hooks.ts +20 -13
  8. package/appUtils/accessibilityManager/index.ts +28 -1
  9. package/appUtils/accessibilityManager/utils.ts +59 -8
  10. package/appUtils/focusManager/index.ios.ts +8 -2
  11. package/appUtils/focusManagerAux/utils/index.ts +1 -1
  12. package/appUtils/focusManagerAux/utils/utils.ios.ts +60 -3
  13. package/appUtils/keyCodes/keys/keys.web.ts +1 -4
  14. package/appUtils/orientationHelper.ts +2 -4
  15. package/appUtils/platform/platformUtils.ts +115 -16
  16. package/appUtils/playerManager/playerNative.ts +29 -16
  17. package/cellUtils/index.ts +32 -0
  18. package/configurationUtils/__tests__/manifestKeyParser.test.ts +26 -26
  19. package/focusManager/aux/index.ts +1 -1
  20. package/manifestUtils/defaultManifestConfigurations/player.js +39 -0
  21. package/manifestUtils/tvAction/container/index.js +1 -1
  22. package/package.json +2 -2
  23. package/playerUtils/usePlayerTTS.ts +8 -3
  24. package/pluginUtils/index.ts +4 -0
  25. package/reactHooks/advertising/index.ts +2 -2
  26. package/reactHooks/debugging/__tests__/index.test.js +4 -4
  27. package/reactHooks/device/useMemoizedIsTablet.ts +3 -3
  28. package/reactHooks/feed/__tests__/useEntryScreenId.test.tsx +3 -0
  29. package/reactHooks/feed/__tests__/{useInflatedUrl.test.ts → useInflatedUrl.test.tsx} +62 -7
  30. package/reactHooks/feed/useEntryScreenId.ts +2 -2
  31. package/reactHooks/feed/useInflatedUrl.ts +43 -17
  32. package/reactHooks/flatList/useLoadNextPageIfNeeded.ts +13 -16
  33. package/reactHooks/layout/useDimensions/__tests__/{useDimensions.test.ts → useDimensions.test.tsx} +105 -25
  34. package/reactHooks/layout/useDimensions/useDimensions.ts +2 -2
  35. package/reactHooks/navigation/index.ts +7 -6
  36. package/reactHooks/navigation/useRoute.ts +8 -6
  37. package/reactHooks/resolvers/useCellResolver.ts +6 -2
  38. package/reactHooks/resolvers/useComponentResolver.ts +8 -2
  39. package/reactHooks/screen/__tests__/useTargetScreenData.test.tsx +10 -2
  40. package/reactHooks/screen/useTargetScreenData.ts +4 -2
  41. package/reactHooks/state/useRivers.ts +1 -1
  42. package/reactHooks/usePluginConfiguration.ts +2 -2
  43. package/testUtils/index.tsx +29 -20
  44. package/utils/__tests__/selectors.test.ts +124 -0
  45. package/utils/index.ts +10 -0
  46. package/utils/path.ts +6 -3
  47. package/utils/pathOr.ts +5 -1
  48. package/utils/selectors.ts +46 -0
  49. package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +34 -11
  50. package/zappFrameworkUtils/HookCallback/hookCallbackManifestExtensions.config.js +1 -1
@@ -1,24 +1,75 @@
1
+ import { createLogger } from "../../logger";
2
+
3
+ const { log_error } = createLogger({
4
+ category: "AccessibilityManager",
5
+ subsystem: "AppUtils",
6
+ });
7
+
1
8
  /**
2
9
  * Calculates the reading time for a given text based on word count
3
- * @param text - The text to calculate the reading time for
4
- * @param wordsPerMinute - Words per minute reading speed (default: 160)
10
+ * @param text - The text to calculate the reading time for (string or number)
11
+ * @param wordsPerMinute - Words per minute reading speed (default: 140)
5
12
  * @param minimumPause - Minimum pause time in milliseconds (default: 500)
6
13
  * @param announcementDelay - Additional delay for announcement in milliseconds (default: 700)
7
14
  * @returns The reading time in milliseconds
8
15
  */
9
16
  export function calculateReadingTime(
10
- text: string,
17
+ text: string | number,
11
18
  wordsPerMinute: number = 140,
12
19
  minimumPause: number = 500,
13
20
  announcementDelay: number = 700
14
21
  ): number {
15
- const words = text
16
- .trim()
22
+ if (typeof text !== "string" && typeof text !== "number") {
23
+ log_error(
24
+ `Invalid text input for reading time calculation got: ${
25
+ typeof text === "symbol" ? String(text) : text
26
+ }`
27
+ );
28
+
29
+ return 0;
30
+ }
31
+
32
+ const trimmed = typeof text === "number" ? String(text) : text.trim();
33
+
34
+ if (!trimmed) {
35
+ return 0;
36
+ }
37
+
38
+ const words = trimmed
17
39
  .split(/(?<=\d)(?=[a-zA-Z])|(?<=[a-zA-Z])(?=\d)|[^\w\s]+|\s+/)
18
40
  .filter(Boolean).length;
19
41
 
20
- return (
21
- Math.max(minimumPause, (words / wordsPerMinute) * 60 * 1000) +
22
- announcementDelay
42
+ // Count spaces - multiple consecutive spaces add extra pause time
43
+ const spaceMatches: string[] = trimmed.match(/\s+/g) || [];
44
+
45
+ const totalSpaces = spaceMatches.reduce(
46
+ (sum: number, match: string) => sum + match.length,
47
+ 0
23
48
  );
49
+
50
+ const extraSpaces = Math.max(0, totalSpaces - (words - 1)); // words-1 is normal spacing
51
+
52
+ // Heuristic: punctuation increases TTS duration beyond word-based WPM.
53
+ // Commas typically introduce short pauses, sentence terminators longer ones.
54
+ const commaCount = (trimmed.match(/,/g) || []).length;
55
+ const semicolonCount = (trimmed.match(/;/g) || []).length;
56
+ const colonCount = (trimmed.match(/:/g) || []).length;
57
+ const dashCount = (trimmed.match(/\u2013|\u2014|-/g) || []).length; // – — -
58
+ const sentenceEndCount = (trimmed.match(/[.!?](?!\d)/g) || []).length;
59
+
60
+ const commaPauseMs = 220; // short prosody pause for ","
61
+ const midPauseMs = 260; // for ";", ":", dashes
62
+ const sentenceEndPauseMs = 420; // for ".", "!", "?"
63
+ const extraSpacePauseMs = 50; // per extra space beyond normal spacing
64
+
65
+ const punctuationPause =
66
+ commaCount * commaPauseMs +
67
+ (semicolonCount + colonCount + dashCount) * midPauseMs +
68
+ sentenceEndCount * sentenceEndPauseMs +
69
+ extraSpaces * extraSpacePauseMs;
70
+
71
+ const baseByWordsMs = (words / wordsPerMinute) * 60 * 1000;
72
+ const estimatedMs = Math.max(minimumPause, baseByWordsMs + punctuationPause);
73
+
74
+ return estimatedMs + announcementDelay;
24
75
  }
@@ -188,9 +188,15 @@ export const focusManager = (function () {
188
188
  function register({ id, component }) {
189
189
  const { isGroup = false } = component;
190
190
 
191
- emitRegistered(id);
191
+ if (isGroup) {
192
+ registerGroup(id, component);
193
+ } else {
194
+ registerItem(id, component);
195
+ }
196
+
197
+ const parentId = component?.props?.groupId;
192
198
 
193
- return isGroup ? registerGroup(id, component) : registerItem(id, component);
199
+ emitRegistered({ id, parentId, isGroup });
194
200
  }
195
201
 
196
202
  function unregister(id, { group = false } = {}) {
@@ -102,7 +102,7 @@ export const getNavbarNode = (focusableTree) => {
102
102
 
103
103
  export const waitForContent = (focusableTree) => {
104
104
  const contentHasAnyChildren = (): boolean => {
105
- const countOfChildren = pathOr(
105
+ const countOfChildren = pathOr<number>(
106
106
  0,
107
107
  ["children", "length"],
108
108
  getContentNode(focusableTree)
@@ -1,5 +1,5 @@
1
- import { ReplaySubject } from "rxjs";
2
- import { filter } from "rxjs/operators";
1
+ import { ReplaySubject, Subject } from "rxjs";
2
+ import { filter, switchMap, take } from "rxjs/operators";
3
3
  import { BUTTON_PREFIX } from "@applicaster/zapp-react-native-ui-components/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const";
4
4
  import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager/index.ios";
5
5
 
@@ -9,6 +9,15 @@ type RegistrationEvent = {
9
9
  registered: boolean;
10
10
  };
11
11
 
12
+ let focusableViewRegistrationSubject$ = new Subject<{
13
+ id: FocusableID;
14
+ parentId: FocusableID;
15
+ }>();
16
+
17
+ let focusableGroupRegistrationSubject$ = new ReplaySubject<{
18
+ id: FocusableID;
19
+ }>();
20
+
12
21
  const isFocusableButton = (id: Option<FocusableID>): boolean =>
13
22
  id && id.includes?.(BUTTON_PREFIX);
14
23
 
@@ -22,10 +31,58 @@ export const focusableButtonsRegistration$ = (focusableGroupId: string) =>
22
31
  )
23
32
  );
24
33
 
25
- export const emitRegistered = (id: Option<FocusableID>): void => {
34
+ export const resetFocusableRegistration = () => {
35
+ // complete the old subject so subscribers are notified and resources are freed
36
+ if (!focusableViewRegistrationSubject$.closed) {
37
+ focusableViewRegistrationSubject$.complete();
38
+ }
39
+
40
+ if (!focusableGroupRegistrationSubject$.closed) {
41
+ focusableGroupRegistrationSubject$.complete();
42
+ }
43
+
44
+ focusableViewRegistrationSubject$ = new Subject<{
45
+ id: FocusableID;
46
+ parentId: FocusableID;
47
+ }>();
48
+
49
+ focusableGroupRegistrationSubject$ = new ReplaySubject<{
50
+ id: FocusableID;
51
+ }>();
52
+ };
53
+
54
+ export const firstFocusableViewRegistrationFactory = () =>
55
+ focusableViewRegistrationSubject$.pipe(
56
+ take(1), // we care about only first FocusableView registration
57
+ switchMap(({ parentId }) =>
58
+ // start waiting registration of its parent
59
+ focusableGroupRegistrationSubject$.pipe(
60
+ filter(({ id }) => id === parentId)
61
+ )
62
+ ),
63
+ take(1)
64
+ );
65
+
66
+ export const emitRegistered = ({
67
+ id,
68
+ parentId,
69
+ isGroup,
70
+ }: {
71
+ id: Option<FocusableID>;
72
+ parentId: Option<FocusableID>;
73
+ isGroup: boolean;
74
+ }): void => {
26
75
  if (isFocusableButton(id)) {
27
76
  registeredSubject$.next({ id, registered: true });
28
77
  }
78
+
79
+ if (isGroup && id) {
80
+ focusableGroupRegistrationSubject$.next({ id });
81
+ }
82
+
83
+ if (!isGroup && id && parentId) {
84
+ focusableViewRegistrationSubject$.next({ id, parentId });
85
+ }
29
86
  };
30
87
 
31
88
  export const emitUnregistered = (id: Option<FocusableID>): void => {
@@ -10,10 +10,7 @@ import { Platform } from "react-native";
10
10
  * platformKeys[Platform.OS] should only include keys
11
11
  * that are unique to that platform, i.e. Exit: { keyCode: 10182 }
12
12
  */
13
- export const KEYS = Object.assign(
14
- platformKeys["web"],
15
- platformKeys[Platform.OS]
16
- );
13
+ export const KEYS = Object.assign(platformKeys.web, platformKeys[Platform.OS]);
17
14
 
18
15
  export const ARROW_KEYS = [
19
16
  KEYS.ArrowUp,
@@ -1,5 +1,5 @@
1
1
  import * as ReactNative from "react-native";
2
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
2
+ import { useAppData } from "@applicaster/zapp-react-native-redux/hooks";
3
3
 
4
4
  import { isTV, platformSelect } from "../reactUtils";
5
5
  import { useIsTablet } from "../reactHooks";
@@ -184,9 +184,7 @@ export const getScreenOrientation = ({
184
184
 
185
185
  export const useGetScreenOrientation = (screenData) => {
186
186
  const isTablet = useIsTablet();
187
-
188
- const { appData } = usePickFromState(["appData"]);
189
- const isTabletPortrait = appData?.isTabletPortrait;
187
+ const { isTabletPortrait } = useAppData();
190
188
 
191
189
  return getScreenOrientation({
192
190
  screenData,
@@ -79,7 +79,7 @@ export class ClosedCaptioningManager {
79
79
  private constructor() {
80
80
  this.initialize();
81
81
 
82
- window["vizioDebug"] = {
82
+ window.vizioDebug = {
83
83
  setCCEnabled: (isCCEnabled: boolean) => {
84
84
  this.ccState$.next(isCCEnabled);
85
85
  },
@@ -170,7 +170,9 @@ export const getClosedCaptionState = () => {
170
170
  */
171
171
  export class TTSManager {
172
172
  private ttsState$ = new BehaviorSubject<boolean>(false);
173
+ private screenReaderEnabled$ = new BehaviorSubject<boolean>(false);
173
174
  private static ttsManagerInstance: TTSManager;
175
+ private samsungListenerId: number | null = null;
174
176
 
175
177
  private constructor() {
176
178
  this.initialize();
@@ -185,23 +187,116 @@ export class TTSManager {
185
187
  }
186
188
 
187
189
  async initialize() {
188
- if (!isVizioPlatform()) return;
190
+ if (isVizioPlatform()) {
191
+ document.addEventListener(
192
+ "VIZIO_TTS_ENABLED",
193
+ () => {
194
+ log_debug("Vizio screen reader enabled");
195
+ this.screenReaderEnabled$.next(true);
196
+ },
197
+ false
198
+ );
189
199
 
190
- document.addEventListener(
191
- "VIZIO_TTS_ENABLED",
192
- () => {
193
- this.ttsState$.next(true);
194
- },
195
- false
196
- );
200
+ document.addEventListener(
201
+ "VIZIO_TTS_DISABLED",
202
+ () => {
203
+ log_debug("Vizio screen reader disabled");
204
+ this.screenReaderEnabled$.next(false);
205
+ },
206
+ false
207
+ );
208
+ }
197
209
 
198
- document.addEventListener(
199
- "VIZIO_TTS_DISABLED",
200
- () => {
201
- this.ttsState$.next(false);
202
- },
203
- false
204
- );
210
+ if (isLgPlatform() && window.webOS?.service) {
211
+ try {
212
+ // https://webostv.developer.lge.com/develop/references/settings-service
213
+ window.webOS.service.request("luna://com.webos.settingsservice", {
214
+ method: "getSystemSettings",
215
+ parameters: {
216
+ category: "option",
217
+ keys: ["audioGuidance"],
218
+ subscribe: true, // Request a subscription to changes
219
+ },
220
+ onSuccess: (response: any) => {
221
+ const isEnabled = response?.settings?.audioGuidance === "on";
222
+
223
+ log_debug("LG Audio Guidance status changed", {
224
+ isEnabled,
225
+ response,
226
+ });
227
+
228
+ this.screenReaderEnabled$.next(isEnabled);
229
+ },
230
+ onFailure: (error: any) => {
231
+ log_debug("webOS settings subscription failed", { error });
232
+ this.screenReaderEnabled$.next(false);
233
+ },
234
+ });
235
+ } catch (error) {
236
+ log_debug("webOS settings service request error", { error });
237
+ // Fallback to false if the service is not available
238
+ this.screenReaderEnabled$.next(false);
239
+ }
240
+ }
241
+
242
+ if (isSamsungPlatform() && typeof window.webapis !== "undefined") {
243
+ try {
244
+ if (
245
+ window.webapis?.tvinfo &&
246
+ typeof window.webapis.tvinfo.getMenuValue === "function" &&
247
+ typeof window.webapis.tvinfo.addCaptionChangeListener === "function"
248
+ ) {
249
+ // Get initial Voice Guide status
250
+ const initialStatus = window.webapis.tvinfo.getMenuValue(
251
+ window.webapis.tvinfo.TvInfoMenuKey.VOICE_GUIDE_KEY
252
+ );
253
+
254
+ const isEnabled =
255
+ initialStatus === window.webapis.tvinfo.TvInfoMenuValue.ON;
256
+
257
+ log_debug("Samsung Voice Guide initial status", {
258
+ isEnabled,
259
+ initialStatus,
260
+ });
261
+
262
+ this.screenReaderEnabled$.next(isEnabled);
263
+
264
+ // Listen for Voice Guide status changes
265
+ const onChange = () => {
266
+ const currentStatus = window.webapis.tvinfo.getMenuValue(
267
+ window.webapis.tvinfo.TvInfoMenuKey.VOICE_GUIDE_KEY
268
+ );
269
+
270
+ const enabled =
271
+ currentStatus === window.webapis.tvinfo.TvInfoMenuValue.ON;
272
+
273
+ log_debug("Samsung Voice Guide status changed", {
274
+ enabled,
275
+ currentStatus,
276
+ });
277
+
278
+ this.screenReaderEnabled$.next(enabled);
279
+ };
280
+
281
+ this.samsungListenerId =
282
+ window.webapis.tvinfo.addCaptionChangeListener(
283
+ window.webapis.tvinfo.TvInfoMenuKey.VOICE_GUIDE_KEY,
284
+ onChange
285
+ );
286
+
287
+ log_debug("Samsung Voice Guide listener registered", {
288
+ listenerId: this.samsungListenerId,
289
+ });
290
+ } else {
291
+ log_debug("Samsung TvInfo API not available");
292
+ this.screenReaderEnabled$.next(false);
293
+ }
294
+ } catch (error) {
295
+ log_debug("Samsung Voice Guide listener error", { error });
296
+ // Fallback to false if the service is not available
297
+ this.screenReaderEnabled$.next(false);
298
+ }
299
+ }
205
300
  }
206
301
 
207
302
  getCurrentState(): boolean {
@@ -212,6 +307,10 @@ export class TTSManager {
212
307
  return this.ttsState$.asObservable();
213
308
  }
214
309
 
310
+ getScreenReaderEnabledAsObservable() {
311
+ return this.screenReaderEnabled$.asObservable();
312
+ }
313
+
215
314
  readText(text: string) {
216
315
  this.ttsState$.next(true);
217
316
 
@@ -15,6 +15,22 @@ const logger = createLogger({
15
15
 
16
16
  const { log_warning } = logger;
17
17
 
18
+ interface PlayerMethods {
19
+ seeking?: (position: number) => void;
20
+ forward?: (deltaTime: number) => void;
21
+ rewind?: (deltaTime: number) => void;
22
+ startSleepTimer?: (sleepTimestamp: number) => void;
23
+ selectTrack?: (
24
+ selected: QuickBrickPlayer.TextTrack | QuickBrickPlayer.AudioTrack
25
+ ) => void;
26
+ setPlaybackRate?: (rate: number) => void;
27
+ appStateChange?: (appState: string, previousAppState: string) => void;
28
+ closeNativePlayer?: () => void;
29
+ togglePlayPause?: () => void;
30
+ }
31
+
32
+ type PlayerComponent = ReactComponent<PlayerRefProps> & PlayerMethods;
33
+
18
34
  type PlayerPlugnId = "QuickBrickPlayerPlugin" | "KalturaPlayerPlugin";
19
35
 
20
36
  type Props = {
@@ -62,7 +78,7 @@ export class PlayerNative extends Player {
62
78
  return this.playerState.contentPosition;
63
79
  };
64
80
 
65
- currentPlayerComponent = (): ReactComponent<PlayerRefProps> =>
81
+ currentPlayerComponent = (): PlayerComponent | null =>
66
82
  this.playerComponent?.current;
67
83
 
68
84
  getState = () => this.playerState;
@@ -121,7 +137,7 @@ export class PlayerNative extends Player {
121
137
 
122
138
  this.playerState.seekPosition = newPosition;
123
139
 
124
- this.currentPlayerComponent()?.["seeking"](this.playerState.seekPosition);
140
+ this.currentPlayerComponent()?.seeking?.(this.playerState.seekPosition);
125
141
  }
126
142
 
127
143
  this.logState(PlayerModuleFuncNames.seekTo, { position });
@@ -135,7 +151,7 @@ export class PlayerNative extends Player {
135
151
  if (!this.invokeNativeFunction(PlayerModuleFuncNames.forward, deltaTime)) {
136
152
  // Kaltura does not have yet this implementation, use legacy code
137
153
 
138
- this.currentPlayerComponent()?.["forward"](deltaTime);
154
+ this.currentPlayerComponent()?.forward?.(deltaTime);
139
155
  }
140
156
 
141
157
  this.notifyPlayHeadPositionUpdate();
@@ -151,7 +167,7 @@ export class PlayerNative extends Player {
151
167
  if (!this.invokeNativeFunction(PlayerModuleFuncNames.rewind, deltaTime)) {
152
168
  // Kaltura does not have yet this implementation, use legacy code
153
169
 
154
- this.currentPlayerComponent()?.["rewind"](deltaTime);
170
+ this.currentPlayerComponent()?.rewind?.(deltaTime);
155
171
  }
156
172
 
157
173
  this.notifyPlayHeadPositionUpdate();
@@ -178,7 +194,7 @@ export class PlayerNative extends Player {
178
194
  sleepTimestamp
179
195
  )
180
196
  ) {
181
- this.currentPlayerComponent()?.["startSleepTimer"](sleepTimestamp);
197
+ this.currentPlayerComponent()?.startSleepTimer?.(sleepTimestamp);
182
198
  }
183
199
  };
184
200
 
@@ -195,11 +211,11 @@ export class PlayerNative extends Player {
195
211
  selectTrack = (
196
212
  selected: QuickBrickPlayer.TextTrack | QuickBrickPlayer.AudioTrack
197
213
  ) => {
198
- this.currentPlayerComponent()?.["selectTrack"]?.(selected);
214
+ this.currentPlayerComponent()?.selectTrack?.(selected);
199
215
  };
200
216
 
201
217
  setPlaybackRate = (rate: number) => {
202
- this.currentPlayerComponent()?.["setPlaybackRate"]?.(rate);
218
+ this.currentPlayerComponent()?.setPlaybackRate?.(rate);
203
219
  };
204
220
 
205
221
  getPluginConfiguration = () => {
@@ -209,19 +225,16 @@ export class PlayerNative extends Player {
209
225
  getProps = () => (this.currentPlayerComponent() as any)?.props;
210
226
 
211
227
  appStateChange = (appState, previousAppState) => {
212
- this.currentPlayerComponent()?.["appStateChange"]?.(
213
- appState,
214
- previousAppState
215
- );
228
+ this.currentPlayerComponent()?.appStateChange?.(appState, previousAppState);
216
229
  };
217
230
 
218
231
  closeNativePlayer = () => {
219
232
  // TODO: Delete does not work
220
- this.currentPlayerComponent()?.["closeNativePlayer"]?.();
233
+ this.currentPlayerComponent()?.closeNativePlayer?.();
221
234
  };
222
235
 
223
236
  togglePlayPause = () => {
224
- this.currentPlayerComponent()?.["togglePlayPause"]?.();
237
+ this.currentPlayerComponent()?.togglePlayPause?.();
225
238
  };
226
239
 
227
240
  onVideoLoad = (event) => {
@@ -289,19 +302,19 @@ export class PlayerNative extends Player {
289
302
  isFullScreenSupported = (): boolean => {
290
303
  const config = this.getConfig();
291
304
 
292
- const disableFullScreen = config?.["disable_fullscreen"];
305
+ const disableFullScreen = config?.disable_fullscreen;
293
306
 
294
307
  if (disableFullScreen) {
295
308
  return false;
296
309
  }
297
310
 
298
- const isFullScreenAudioPlayer = config?.["full_screen_audio_player"];
311
+ const isFullScreenAudioPlayer = config?.full_screen_audio_player;
299
312
 
300
313
  return !(isFullScreenAudioPlayer && this.isAudioItem());
301
314
  };
302
315
 
303
316
  supportsNativeControls = (): boolean =>
304
- toBooleanWithDefaultFalse(this.getConfig()?.["supports_native_controls"]);
317
+ toBooleanWithDefaultFalse(this.getConfig()?.supports_native_controls);
305
318
 
306
319
  supportNativeCast = (): boolean =>
307
320
  toBooleanWithDefaultFalse(
@@ -505,3 +505,35 @@ export const getImageContainerMarginStyles = ({ value }: { value: any }) => {
505
505
  marginRight: value("image_margin_right"),
506
506
  };
507
507
  };
508
+
509
+ export const isTextLabel = (key: string): boolean =>
510
+ key.includes("text_label_") && key.endsWith("_switch");
511
+
512
+ export const hasTextLabelsEnabled = (
513
+ configuration: Record<string, any>
514
+ ): boolean => {
515
+ const textLabelsKeys = Object.keys(configuration).filter(isTextLabel);
516
+
517
+ const picked = textLabelsKeys.reduce(
518
+ (acc, key) => {
519
+ acc[key] = configuration[key];
520
+
521
+ return acc;
522
+ },
523
+ {} as Record<string, any>
524
+ );
525
+
526
+ const pickedValues = Object.values(picked);
527
+
528
+ return pickedValues.some((value) => {
529
+ if (typeof value === "boolean") {
530
+ return value === true;
531
+ }
532
+
533
+ if (typeof value === "string") {
534
+ return value !== "" && value.toLowerCase() !== "false";
535
+ }
536
+
537
+ return Boolean(value);
538
+ });
539
+ };