@applicaster/zapp-react-native-utils 16.0.0-alpha.5222020837 → 16.0.0-alpha.5305005033

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 (141) hide show
  1. package/actionsExecutor/ActionExecutor.ts +8 -10
  2. package/actionsExecutor/ActionExecutorContext.tsx +47 -326
  3. package/actionsExecutor/actions/__tests__/dismissBottomSheet.test.ts +22 -0
  4. package/actionsExecutor/actions/__tests__/loadItemsFromSource.test.ts +88 -0
  5. package/actionsExecutor/actions/__tests__/openBottomSheet.customContent.test.ts +76 -0
  6. package/actionsExecutor/actions/__tests__/showToast.test.ts +63 -0
  7. package/actionsExecutor/actions/appRestart.ts +24 -0
  8. package/actionsExecutor/actions/confirmDialog.ts +53 -0
  9. package/actionsExecutor/actions/dismissBottomSheet.ts +22 -0
  10. package/actionsExecutor/actions/index.ts +34 -0
  11. package/actionsExecutor/actions/localStorageRemove.ts +27 -0
  12. package/actionsExecutor/actions/localStorageSet.ts +28 -0
  13. package/actionsExecutor/actions/localStorageToggleFlag.ts +28 -0
  14. package/actionsExecutor/actions/navigateToScreen.ts +123 -0
  15. package/actionsExecutor/actions/openBottomSheet.ts +318 -0
  16. package/actionsExecutor/actions/refreshComponent.ts +85 -0
  17. package/actionsExecutor/actions/screenSetVariable.ts +35 -0
  18. package/actionsExecutor/actions/screenToggleFlag.ts +38 -0
  19. package/actionsExecutor/actions/sendCloudEvent.ts +96 -0
  20. package/actionsExecutor/actions/sessionStorageRemove.ts +19 -0
  21. package/actionsExecutor/actions/sessionStorageSet.ts +20 -0
  22. package/actionsExecutor/actions/sessionStorageToggleFlag.ts +15 -0
  23. package/actionsExecutor/actions/showToast.ts +31 -0
  24. package/actionsExecutor/actions/switchLayout.ts +40 -0
  25. package/actionsExecutor/types.ts +59 -0
  26. package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +2 -2
  27. package/analyticsUtils/PlayerAnalyticsManager.ts +12 -2
  28. package/analyticsUtils/__tests__/analyticsMapper.test.ts +35 -0
  29. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testACP_events.json +1 -1
  30. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testBlockUnlistedParams_rules.json +1 -1
  31. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_events.json +4 -0
  32. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_rules.json +6 -0
  33. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEventRegex_events.json +3 -9
  34. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_events.json +18 -0
  35. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_rules.json +16 -0
  36. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_events.json +4 -0
  37. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_rules.json +6 -0
  38. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_events.json +4 -0
  39. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_rules.json +6 -0
  40. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_events.json +4 -0
  41. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_rules.json +6 -0
  42. package/analyticsUtils/__tests__/fixtures/index.js +20 -0
  43. package/analyticsUtils/analyticsMapper.ts +4 -1
  44. package/analyticsUtils/playerAnalyticsTracker.ts +26 -3
  45. package/appUtils/HooksManager/index.ts +3 -8
  46. package/appUtils/contextKeysManager/__tests__/getKey/failure.test.ts +1 -1
  47. package/appUtils/contextKeysManager/__tests__/removeKey/failure.test.ts +1 -1
  48. package/appUtils/contextKeysManager/__tests__/setKey/failure/invalidKey.test.ts +4 -4
  49. package/appUtils/contextKeysManager/index.ts +1 -1
  50. package/appUtils/contextKeysManager/utils/index.ts +38 -25
  51. package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +12 -6
  52. package/appUtils/playerManager/__tests__/playerFactory.test.ts +150 -0
  53. package/appUtils/playerManager/{conts.ts → const.ts} +20 -0
  54. package/appUtils/playerManager/index.ts +1 -1
  55. package/appUtils/playerManager/player.ts +1 -1
  56. package/appUtils/playerManager/playerFactory.ts +18 -35
  57. package/appUtils/playerManager/playerNative.ts +1 -1
  58. package/appUtils/playerManager/usePlayerControllerSetup.tsx +1 -1
  59. package/appUtils/playerManager/userLanguagePreference.ts +1 -1
  60. package/arrayUtils/__tests__/{anyThruthy.test.ts → anyTruthy.test.ts} +8 -0
  61. package/arrayUtils/__tests__/arrayUtils.test.ts +165 -108
  62. package/arrayUtils/__tests__/isEmptyArray.test.ts +11 -0
  63. package/arrayUtils/__tests__/isFilledArray.test.ts +12 -0
  64. package/arrayUtils/__tests__/isFirst.test.ts +17 -0
  65. package/arrayUtils/__tests__/isIndexInRange.test.ts +14 -0
  66. package/arrayUtils/__tests__/isLast.test.ts +31 -0
  67. package/arrayUtils/__tests__/makeListOf.test.ts +31 -0
  68. package/arrayUtils/__tests__/makeListOfIndexes.test.ts +20 -0
  69. package/arrayUtils/__tests__/sample.test.ts +61 -0
  70. package/arrayUtils/index.ts +57 -20
  71. package/bottomSheet/__tests__/scrollContext.test.tsx +35 -0
  72. package/bottomSheet/index.ts +17 -0
  73. package/cellUtils/index.ts +3 -5
  74. package/colorUtils/__tests__/isTransparentColor.test.ts +76 -0
  75. package/colorUtils/__tests__/isValidColor.test.ts +70 -0
  76. package/colorUtils/index.ts +50 -0
  77. package/manifestUtils/_internals/index.js +6 -0
  78. package/manifestUtils/defaultManifestConfigurations/generalContent.js +35 -0
  79. package/manifestUtils/defaultManifestConfigurations/player.js +19 -19
  80. package/manifestUtils/fieldUtils/__tests__/fieldUtils.test.js +84 -0
  81. package/manifestUtils/fieldUtils/index.js +125 -0
  82. package/manifestUtils/keys.js +9 -0
  83. package/manifestUtils/mobileAction/button/index.js +16 -0
  84. package/manifestUtils/mobileAction/container/index.js +3 -1
  85. package/manifestUtils/mobileAction/groups/defaults.js +3 -1
  86. package/manifestUtils/platformIsTV.js +1 -0
  87. package/modalState/ContentViewModel.ts +111 -0
  88. package/modalState/EditableCollection.ts +17 -0
  89. package/modalState/EditableCollectionRegistry.ts +51 -0
  90. package/modalState/ModalOrchestrator.ts +198 -0
  91. package/modalState/RemoteEditableCollection.ts +189 -0
  92. package/modalState/__tests__/ContentViewModel.editable.test.ts +69 -0
  93. package/modalState/__tests__/ContentViewModel.test.ts +165 -0
  94. package/modalState/__tests__/EditableCollectionRegistry.test.ts +112 -0
  95. package/modalState/__tests__/ModalOrchestrator.phase3.test.ts +28 -0
  96. package/modalState/__tests__/RemoteEditableCollection.test.ts +259 -0
  97. package/modalState/__tests__/useBottomSheetContent.test.ts +372 -0
  98. package/modalState/index.ts +30 -83
  99. package/modalState/store.ts +102 -0
  100. package/modalState/types.ts +110 -0
  101. package/modalState/useBottomSheetContent.ts +98 -0
  102. package/numberUtils/__tests__/isMinusZero.test.ts +20 -0
  103. package/numberUtils/__tests__/isZero.test.ts +27 -0
  104. package/numberUtils/__tests__/requireNumber.test.ts +50 -0
  105. package/numberUtils/__tests__/toNumber.test.ts +27 -0
  106. package/numberUtils/__tests__/toNumberWithDefault.test.ts +64 -0
  107. package/numberUtils/__tests__/toNumberWithDefaultZero.test.ts +48 -0
  108. package/numberUtils/index.ts +27 -8
  109. package/package.json +2 -2
  110. package/pipesUtils/__tests__/buildUrlWithQuery.test.ts +33 -0
  111. package/pipesUtils/__tests__/withPipesEndpoint.test.tsx +56 -0
  112. package/pipesUtils/index.ts +1 -0
  113. package/pipesUtils/withPipesEndpoint.tsx +54 -0
  114. package/playerUtils/index.ts +24 -2
  115. package/reactHooks/actions/index.ts +51 -1
  116. package/reactHooks/cell-click/index.ts +18 -10
  117. package/reactHooks/feed/__mocks__/useMarkPipesDataStale.ts +4 -0
  118. package/reactHooks/feed/__tests__/useInflatedUrl.test.tsx +25 -0
  119. package/reactHooks/feed/index.ts +5 -1
  120. package/reactHooks/feed/useBatchLoading.ts +9 -1
  121. package/reactHooks/feed/{usePipesCacheReset.ts → useMarkPipesDataStale.ts} +12 -4
  122. package/reactHooks/layout/index.ts +1 -1
  123. package/reactHooks/navigation/__mocks__/index.ts +4 -0
  124. package/reactHooks/navigation/__tests__/useIsScreenActive.test.ts +42 -0
  125. package/reactHooks/navigation/index.ts +1 -1
  126. package/reactHooks/navigation/useIsScreenActive.ts +29 -8
  127. package/reactHooks/screen/__tests__/useIsStandaloneFullscreen.test.ts +114 -0
  128. package/reactHooks/screen/index.ts +2 -0
  129. package/reactHooks/screen/useIsStandaloneFullscreen.ts +12 -0
  130. package/reactHooks/state/useComponentScreenState.ts +1 -1
  131. package/reactHooks/utils/index.ts +3 -2
  132. package/reactHooks/videoModal/hooks/useVideoModalScreenData.tsx +22 -4
  133. package/riverComponetsMeasurementProvider/index.tsx +12 -8
  134. package/stringUtils/__tests__/stringUtils.test.js +42 -0
  135. package/stringUtils/index.ts +2 -2
  136. package/uiActionsRegistrator/index.ts +203 -0
  137. package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +1 -1
  138. package/zappFrameworkUtils/__tests__/localStorageHelper.test.ts +146 -0
  139. package/zappFrameworkUtils/localStorageHelper.ts +9 -13
  140. package/reactHooks/feed/__mocks__/usePipesCacheReset.ts +0 -1
  141. /package/reactHooks/actions/__tests__/{index.test.js → index.test.tsx} +0 -0
@@ -59,6 +59,7 @@ type PlayNextConfig = {
59
59
  export type PlayNextState = PlayNextConfig & {
60
60
  triggerTime: number;
61
61
  handleUserCancelPlayNext: () => void;
62
+ hidePlayNext: () => void;
62
63
  };
63
64
 
64
65
  export class OverlaysObserver {
@@ -76,7 +77,7 @@ export class OverlaysObserver {
76
77
  private chapterMarkerEvents: ChapterMarkerEvent[];
77
78
  readonly player: Player;
78
79
  private playNextConfig?: PlayNextConfig;
79
- private isCanceledByUser = false;
80
+ private isPlayNextSuppressed = false;
80
81
 
81
82
  constructor({ player }: ChapterMarkersObserverProps) {
82
83
  this.chapterSubject = new BehaviorSubject(null);
@@ -143,11 +144,15 @@ export class OverlaysObserver {
143
144
  return this.titleSummarySubject.asObservable().pipe(distinctUntilChanged());
144
145
  }
145
146
 
146
- handleUserCancelPlayNext = () => {
147
- this.isCanceledByUser = true;
147
+ hidePlayNext = () => {
148
+ this.isPlayNextSuppressed = true;
148
149
  this.playNextSubject.next(null);
149
150
  };
150
151
 
152
+ handleUserCancelPlayNext = () => {
153
+ this.hidePlayNext();
154
+ };
155
+
151
156
  preparePlayNext = async () => {
152
157
  try {
153
158
  const plugins = appStore.get("plugins");
@@ -270,7 +275,7 @@ export class OverlaysObserver {
270
275
 
271
276
  // TODO: Hack for video end, will be replaced with playlist prev/next in the future
272
277
  getPlayNextEntry = () =>
273
- !this.isCanceledByUser ? this.playNextConfig?.entry : null;
278
+ !this.isPlayNextSuppressed ? this.playNextConfig?.entry : null;
274
279
 
275
280
  prepareChapterMarkers = () => {
276
281
  const chapterMarkers: ChapterMarkerOriginal[] =
@@ -353,7 +358,7 @@ export class OverlaysObserver {
353
358
  const shouldPlayNextBeVisible = currentTime > triggerTime;
354
359
 
355
360
  if (shouldPlayNextBeVisible) {
356
- if (this.isCanceledByUser) {
361
+ if (this.isPlayNextSuppressed) {
357
362
  return;
358
363
  }
359
364
 
@@ -361,10 +366,11 @@ export class OverlaysObserver {
361
366
  ...this.playNextConfig,
362
367
  triggerTime,
363
368
  handleUserCancelPlayNext: this.handleUserCancelPlayNext,
369
+ hidePlayNext: this.hidePlayNext,
364
370
  });
365
371
  } else {
366
372
  this.playNextSubject.next(null);
367
- this.isCanceledByUser = false;
373
+ this.isPlayNextSuppressed = false;
368
374
  }
369
375
  };
370
376
 
@@ -0,0 +1,150 @@
1
+ const mockAppStoreGet = jest.fn();
2
+ const mockFindPluginByIdentifier = jest.fn();
3
+
4
+ jest.mock("@applicaster/zapp-react-native-redux/AppStore", () => ({
5
+ appStore: { get: (key: string) => mockAppStoreGet(key) },
6
+ }));
7
+
8
+ jest.mock("@applicaster/zapp-react-native-utils/pluginUtils", () => ({
9
+ findPluginByIdentifier: (id: string, plugins: any) =>
10
+ mockFindPluginByIdentifier(id, plugins),
11
+ }));
12
+
13
+ import { PlayerRole } from "../const";
14
+ import { playerFactory } from "../playerFactory";
15
+
16
+ const fakeComponent = () => null;
17
+
18
+ class FakeController {
19
+ receivedConfig: any;
20
+ constructor(config: any) {
21
+ this.receivedConfig = config;
22
+ }
23
+ }
24
+
25
+ const baseConfig = {
26
+ player: {},
27
+ playerId: "p1",
28
+ autoplay: false,
29
+ entry: { id: "entry-1" } as any,
30
+ muted: false,
31
+ playerPluginId: "test-plugin",
32
+ screenConfig: { foo: "bar" },
33
+ playerRole: PlayerRole.Cell,
34
+ };
35
+
36
+ const installPluginWithProtocol = (
37
+ protocolReturn: any | ((screenConfig: any, entry: any) => any)
38
+ ) => {
39
+ const playerProtocol =
40
+ typeof protocolReturn === "function"
41
+ ? protocolReturn
42
+ : () => protocolReturn;
43
+
44
+ mockAppStoreGet.mockImplementation((key: string) =>
45
+ key === "plugins" ? { "test-plugin": {} } : null
46
+ );
47
+
48
+ mockFindPluginByIdentifier.mockReturnValue({
49
+ module: { playerProtocol },
50
+ });
51
+ };
52
+
53
+ describe("playerFactory", () => {
54
+ beforeEach(() => {
55
+ mockAppStoreGet.mockReset();
56
+ mockFindPluginByIdentifier.mockReset();
57
+ });
58
+
59
+ it("resolves with controller and Component when playerProtocol returns synchronously", async () => {
60
+ installPluginWithProtocol({
61
+ Component: fakeComponent,
62
+ controllerClass: FakeController,
63
+ });
64
+
65
+ const item = await playerFactory(baseConfig);
66
+
67
+ expect(item).not.toBeNull();
68
+ expect(item?.Component).toBe(fakeComponent);
69
+ expect(item?.controller).toBeInstanceOf(FakeController);
70
+
71
+ expect((item?.controller as FakeController).receivedConfig).toBe(
72
+ baseConfig
73
+ );
74
+ });
75
+
76
+ it("resolves with controller and Component when playerProtocol returns a Promise (delayed import)", async () => {
77
+ installPluginWithProtocol(async () => ({
78
+ Component: fakeComponent,
79
+ controllerClass: FakeController,
80
+ }));
81
+
82
+ const item = await playerFactory(baseConfig);
83
+
84
+ expect(item).not.toBeNull();
85
+ expect(item?.Component).toBe(fakeComponent);
86
+ expect(item?.controller).toBeInstanceOf(FakeController);
87
+ });
88
+
89
+ it("passes screenConfig and entry through to playerProtocol", async () => {
90
+ const playerProtocol = jest.fn(() => ({
91
+ Component: fakeComponent,
92
+ controllerClass: FakeController,
93
+ }));
94
+
95
+ mockAppStoreGet.mockImplementation((key: string) =>
96
+ key === "plugins" ? { "test-plugin": {} } : null
97
+ );
98
+
99
+ mockFindPluginByIdentifier.mockReturnValue({ module: { playerProtocol } });
100
+
101
+ await playerFactory(baseConfig);
102
+
103
+ expect(playerProtocol).toHaveBeenCalledWith(
104
+ baseConfig.screenConfig,
105
+ baseConfig.entry
106
+ );
107
+ });
108
+
109
+ it("resolves to null when playerPluginId is missing", async () => {
110
+ expect(
111
+ await playerFactory({ ...baseConfig, playerPluginId: "" } as any)
112
+ ).toBeNull();
113
+ });
114
+
115
+ it("resolves to null when appStore has no plugins", async () => {
116
+ mockAppStoreGet.mockReturnValue(null);
117
+
118
+ expect(await playerFactory(baseConfig)).toBeNull();
119
+ });
120
+
121
+ it("resolves to null when the plugin has no playerProtocol", async () => {
122
+ mockAppStoreGet.mockImplementation((key: string) =>
123
+ key === "plugins" ? { "test-plugin": {} } : null
124
+ );
125
+
126
+ mockFindPluginByIdentifier.mockReturnValue({ module: {} });
127
+
128
+ expect(await playerFactory(baseConfig)).toBeNull();
129
+ });
130
+
131
+ it("resolves to null when playerProtocol returns without a Component", async () => {
132
+ installPluginWithProtocol({ controllerClass: FakeController });
133
+
134
+ expect(await playerFactory(baseConfig)).toBeNull();
135
+ });
136
+
137
+ it("resolves to null when playerProtocol returns without a controllerClass", async () => {
138
+ installPluginWithProtocol({ Component: fakeComponent });
139
+
140
+ expect(await playerFactory(baseConfig)).toBeNull();
141
+ });
142
+
143
+ it("rejects when playerProtocol throws synchronously", async () => {
144
+ installPluginWithProtocol(() => {
145
+ throw new Error("boom");
146
+ });
147
+
148
+ await expect(playerFactory(baseConfig)).rejects.toThrow("boom");
149
+ });
150
+ });
@@ -67,3 +67,23 @@ export enum PlayerRole {
67
67
  Chromecast = "Chromecast",
68
68
  Unspecified = "Unspecified",
69
69
  }
70
+
71
+ /**
72
+ * The playback engine backing a web player. Published on
73
+ * `window.applicaster.playerType` when a player is created, so that plugins
74
+ * observing the player can tell which engine they are looking at instead of
75
+ * inferring it from the API the instance happens to expose.
76
+ *
77
+ * Keep in sync with `ApplicasterGlobals["playerType"]` in applicaster-types.
78
+ */
79
+ export enum WebPlayerEngine {
80
+ Videojs = "videojs",
81
+ Hlsjs = "hlsjs",
82
+ Dashjs = "dashjs",
83
+ }
84
+
85
+ export enum PLAYER_EVENTS {
86
+ PlayNextTriggered = "play_next_triggered",
87
+ }
88
+
89
+ export type PlayNextTriggeredEvent = { id: string };
@@ -9,7 +9,7 @@ import {
9
9
  unsubscribeToDeviceNetworkChanges,
10
10
  } from "@applicaster/quick-brick-core/App/NetworkStatusProvider/utils";
11
11
  import { setUserLanguagePreference } from "./userLanguagePreference";
12
- import { PlayerRole } from "./conts";
12
+ import { PlayerRole } from "./const";
13
13
  import { RNPlayerManager } from "./nativePlayerManager";
14
14
 
15
15
  const { log_error, log_debug, log_warning } = createLogger({
@@ -3,7 +3,7 @@ import { BehaviorSubject } from "rxjs";
3
3
  import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
4
4
  import { createLogger, utilsLogger } from "../../logger";
5
5
  import { getBoolFromConfigValue } from "../../configurationUtils";
6
- import { PlayerRole, SharedPlayerCallBacksKeys } from "./conts";
6
+ import { PlayerRole, SharedPlayerCallBacksKeys } from "./const";
7
7
  import { OverlaysObserver } from "./OverlayObserver/OverlaysObserver";
8
8
  import { TVSeekController } from "../../reactHooks/player/TVSeekControlller/TVSeekController";
9
9
 
@@ -1,7 +1,7 @@
1
1
  import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
2
2
  import { findPluginByIdentifier } from "@applicaster/zapp-react-native-utils/pluginUtils";
3
3
  import { Player } from "./player";
4
- import { PlayerRole } from "./conts";
4
+ import { PlayerRole } from "./const";
5
5
 
6
6
  type PlayerFactoryItem = {
7
7
  Component: any;
@@ -19,52 +19,35 @@ type PlayerFactoryProps = {
19
19
  playerRole: PlayerRole;
20
20
  };
21
21
 
22
- interface PlayerConstructor {
22
+ interface PlayerControllerConstructor {
23
23
  new (params: any): Player;
24
24
  }
25
25
 
26
- export const playerFactory = (
27
- config: PlayerFactoryProps
28
- ): PlayerFactoryItem | null => {
29
- const IDENTIFIER = config?.playerPluginId;
26
+ type PlayerProtocol = {
27
+ Component: any;
28
+ controllerClass: PlayerControllerConstructor;
29
+ };
30
30
 
31
- if (!IDENTIFIER) {
32
- return null;
33
- }
31
+ export const playerFactory = async (
32
+ config: PlayerFactoryProps
33
+ ): Promise<PlayerFactoryItem | null> => {
34
+ if (!config?.playerPluginId) return null;
34
35
 
35
36
  const plugins = appStore.get("plugins");
37
+ if (!plugins) return null;
36
38
 
37
- if (!plugins) {
38
- return null;
39
- }
40
-
41
- const playerPlugin = findPluginByIdentifier(IDENTIFIER, plugins);
39
+ const playerPlugin = findPluginByIdentifier(config.playerPluginId, plugins);
40
+ if (!playerPlugin?.module?.playerProtocol) return null;
42
41
 
43
- if (!playerPlugin?.module?.playerProtocol) {
44
- return null;
45
- }
46
-
47
- const playerProtocol: PlayerConstructor = playerPlugin.module.playerProtocol(
48
- config?.screenConfig,
49
- config?.entry
50
- );
42
+ const playerProtocol: PlayerProtocol | null =
43
+ await playerPlugin.module.playerProtocol(config.screenConfig, config.entry);
51
44
 
52
- const playerView = (playerProtocol as any)?.Component || null;
53
-
54
- if (!playerView) {
45
+ if (!playerProtocol?.Component || !playerProtocol.controllerClass) {
55
46
  return null;
56
47
  }
57
48
 
58
- const Controller = (playerProtocol as any)?.controllerClass || null;
59
-
60
- if (Controller === null) {
61
- return null;
62
- }
63
-
64
- const controller = new Controller(config);
65
-
66
49
  return {
67
- controller,
68
- Component: playerView,
50
+ controller: new playerProtocol.controllerClass(config),
51
+ Component: playerProtocol.Component,
69
52
  };
70
53
  };
@@ -3,7 +3,7 @@ import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
3
3
  import { createLogger, utilsLogger } from "../../logger";
4
4
  import { Player } from "./player";
5
5
  import { findNodeHandle } from "react-native";
6
- import { PlayerRole } from "./conts";
6
+ import { PlayerRole } from "./const";
7
7
  import { toBooleanWithDefaultFalse } from "../../booleanUtils";
8
8
  import { RNPlayerManager } from "./nativePlayerManager";
9
9
 
@@ -3,7 +3,7 @@ import { useConfiguration } from "../../reactHooks/useConfiguration";
3
3
  import { useEffect } from "react";
4
4
  import { playerManager } from "./index";
5
5
  import { useValidatePlayerConfig } from "../../playerUtils/useValidatePlayerConfig";
6
- import { PlayerRole } from "./conts";
6
+ import { PlayerRole } from "./const";
7
7
  import { isAppleTV } from "@applicaster/zapp-react-native-ui-components/Helpers/Platform";
8
8
  import { TVSeekController } from "../../reactHooks/player/TVSeekControlller/TVSeekController";
9
9
  import { KeyInputHandler } from "../keyInputHandler/KeyInputHandler";
@@ -1,7 +1,7 @@
1
1
  import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
2
2
  import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
3
3
  import { createLogger, utilsLogger } from "../../logger";
4
- import { userPreferencesNamespace } from "./conts";
4
+ import { userPreferencesNamespace } from "./const";
5
5
 
6
6
  export const preferredAudioLanguageStorageKey = "preferred_audio_language";
7
7
 
@@ -21,4 +21,12 @@ describe("anyTruthy", () => {
21
21
  expect(anyTruthy([true])).toBe(true);
22
22
  expect(anyTruthy([false])).toBe(false);
23
23
  });
24
+
25
+ it("should return true when the first value is true", () => {
26
+ expect(anyTruthy([true, false, false])).toBe(true);
27
+ });
28
+
29
+ it("should return true when only the last value is true", () => {
30
+ expect(anyTruthy([false, false, true])).toBe(true);
31
+ });
24
32
  });