@applicaster/zapp-react-native-utils 15.0.0-rc.99 → 15.1.0-alpha.2915689988

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 (160) hide show
  1. package/actionsExecutor/ActionExecutorContext.tsx +51 -5
  2. package/actionsExecutor/feedDecorator.ts +6 -6
  3. package/adsUtils/index.ts +2 -2
  4. package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +2 -2
  5. package/analyticsUtils/PlayerAnalyticsManager.ts +11 -1
  6. package/analyticsUtils/README.md +1 -1
  7. package/analyticsUtils/__tests__/analyticsMapper.test.ts +35 -0
  8. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testACP_events.json +1 -1
  9. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testBlockUnlistedParams_rules.json +1 -1
  10. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_events.json +4 -0
  11. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_rules.json +6 -0
  12. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEventRegex_events.json +3 -9
  13. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_events.json +18 -0
  14. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_rules.json +16 -0
  15. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_events.json +4 -0
  16. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_rules.json +6 -0
  17. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_events.json +4 -0
  18. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_rules.json +6 -0
  19. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_events.json +4 -0
  20. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_rules.json +6 -0
  21. package/analyticsUtils/__tests__/fixtures/index.js +20 -0
  22. package/analyticsUtils/analyticsMapper.ts +4 -1
  23. package/analyticsUtils/playerAnalyticsTracker.ts +26 -3
  24. package/appUtils/HooksManager/__tests__/__snapshots__/hooksManager.test.js.snap +188 -0
  25. package/appUtils/HooksManager/__tests__/hooksManager.test.js +2 -16
  26. package/appUtils/HooksManager/index.ts +47 -17
  27. package/appUtils/RiverFocusManager/{index.ts → index.js} +18 -25
  28. package/appUtils/accessibilityManager/const.ts +0 -4
  29. package/appUtils/accessibilityManager/utils.ts +1 -0
  30. package/appUtils/contextKeysManager/__tests__/getKeys/failure.test.ts +2 -7
  31. package/appUtils/contextKeysManager/__tests__/getKeys/success.test.ts +0 -48
  32. package/appUtils/contextKeysManager/contextResolver.ts +22 -51
  33. package/appUtils/contextKeysManager/index.ts +10 -65
  34. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +0 -3
  35. package/appUtils/focusManager/index.ios.ts +4 -43
  36. package/appUtils/focusManagerAux/utils/index.ts +3 -5
  37. package/appUtils/focusManagerAux/utils/utils.ios.ts +3 -199
  38. package/appUtils/keyCodes/keys/keys.web.ts +4 -1
  39. package/appUtils/localizationsHelper.ts +4 -0
  40. package/appUtils/orientationHelper.ts +4 -2
  41. package/appUtils/platform/platformUtils.ts +1 -1
  42. package/appUtils/playerManager/__tests__/playerFactory.test.ts +150 -0
  43. package/appUtils/playerManager/index.ts +9 -0
  44. package/appUtils/playerManager/player.ts +1 -5
  45. package/appUtils/playerManager/playerFactory.ts +17 -34
  46. package/appUtils/playerManager/playerNative.ts +22 -30
  47. package/appUtils/playerManager/usePlayer.tsx +5 -3
  48. package/appUtils/playerManager/usePlayerState.tsx +2 -14
  49. package/cellUtils/__tests__/cellUtils.test.ts +39 -0
  50. package/cellUtils/index.ts +11 -1
  51. package/cloudEventsUtils/index.ts +1 -65
  52. package/configurationUtils/__tests__/manifestKeyParser.test.ts +26 -26
  53. package/dateUtils/__tests__/dayjs.test.ts +0 -3
  54. package/dateUtils/index.ts +2 -0
  55. package/focusManager/aux/index.ts +1 -1
  56. package/headersUtils/__tests__/headersUtils.test.js +1 -11
  57. package/headersUtils/index.ts +1 -2
  58. package/manifestUtils/defaultManifestConfigurations/player.js +7 -75
  59. package/manifestUtils/tvAction/container/index.js +1 -1
  60. package/numberUtils/__tests__/toNumber.test.ts +0 -12
  61. package/numberUtils/index.ts +1 -19
  62. package/package.json +4 -4
  63. package/playerUtils/index.ts +24 -2
  64. package/pluginUtils/index.ts +4 -9
  65. package/reactHooks/advertising/index.ts +2 -2
  66. package/reactHooks/app/__tests__/useAppState.test.ts +1 -1
  67. package/reactHooks/autoscrolling/__tests__/useTrackCurrentAutoScrollingElement.test.ts +1 -1
  68. package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +2 -1
  69. package/reactHooks/casting/index.ts +1 -0
  70. package/reactHooks/casting/useIsCasting.tsx +57 -0
  71. package/reactHooks/cell-click/__tests__/index.test.js +3 -1
  72. package/reactHooks/componentsMap/index.ts +55 -0
  73. package/reactHooks/configuration/__tests__/index.test.tsx +1 -1
  74. package/reactHooks/connection/__tests__/index.test.js +1 -1
  75. package/reactHooks/debugging/__tests__/index.test.js +4 -4
  76. package/reactHooks/device/useIsTablet.tsx +19 -14
  77. package/reactHooks/device/useMemoizedIsTablet.ts +3 -3
  78. package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +23 -32
  79. package/reactHooks/feed/__tests__/useBuildPipesUrl.test.tsx +19 -19
  80. package/reactHooks/feed/__tests__/useEntryScreenId.test.tsx +1 -4
  81. package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +30 -42
  82. package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +1 -1
  83. package/reactHooks/feed/__tests__/useInflatedUrl.test.tsx +1 -1
  84. package/reactHooks/feed/useBatchLoading.ts +1 -7
  85. package/reactHooks/feed/useEntryScreenId.ts +2 -2
  86. package/reactHooks/feed/useInflatedUrl.ts +1 -1
  87. package/reactHooks/feed/usePipesCacheReset.ts +1 -3
  88. package/reactHooks/flatList/useLoadNextPageIfNeeded.ts +16 -13
  89. package/reactHooks/layout/__tests__/index.test.tsx +1 -1
  90. package/reactHooks/layout/__tests__/useLayoutVersion.test.tsx +1 -1
  91. package/reactHooks/layout/useDimensions/__tests__/{useDimensions.test.tsx → useDimensions.test.ts} +25 -105
  92. package/reactHooks/layout/useDimensions/useDimensions.ts +2 -2
  93. package/reactHooks/navigation/__tests__/index.test.tsx +4 -2
  94. package/reactHooks/navigation/index.ts +6 -7
  95. package/reactHooks/navigation/useRoute.ts +6 -8
  96. package/reactHooks/player/TVSeekControlller/TVSeekController.ts +10 -27
  97. package/reactHooks/player/__tests__/useAutoSeek._test.tsx +1 -1
  98. package/reactHooks/player/__tests__/useTapSeek._test.ts +1 -1
  99. package/reactHooks/resolvers/__tests__/useCellResolver.test.tsx +1 -1
  100. package/reactHooks/resolvers/__tests__/useComponentResolver.test.tsx +1 -1
  101. package/reactHooks/resolvers/useCellResolver.ts +2 -6
  102. package/reactHooks/resolvers/useComponentResolver.ts +13 -9
  103. package/reactHooks/screen/__tests__/useCurrentScreenData.test.tsx +2 -2
  104. package/reactHooks/screen/__tests__/useCurrentScreenIsHook.test.ts +103 -0
  105. package/reactHooks/screen/__tests__/useCurrentScreenIsStartupHook.test.ts +94 -0
  106. package/reactHooks/screen/__tests__/useScreenBackgroundColor.test.tsx +1 -1
  107. package/reactHooks/screen/__tests__/useScreenData.test.tsx +1 -1
  108. package/reactHooks/screen/__tests__/useTargetScreenData.test.tsx +4 -12
  109. package/reactHooks/screen/index.ts +6 -0
  110. package/reactHooks/screen/useCurrentScreenIsHook.ts +9 -0
  111. package/reactHooks/screen/useCurrentScreenIsStartupHook.ts +8 -0
  112. package/reactHooks/screen/useIsStandaloneFullscreen.ts +12 -0
  113. package/reactHooks/screen/useTargetScreenData.ts +2 -4
  114. package/reactHooks/state/__tests__/useComponentScreenState.test.ts +246 -0
  115. package/reactHooks/state/index.ts +2 -0
  116. package/reactHooks/state/useComponentScreenState.ts +45 -0
  117. package/reactHooks/state/useRivers.ts +1 -1
  118. package/reactHooks/usePluginConfiguration.ts +2 -2
  119. package/reactHooks/utils/__tests__/index.test.js +1 -1
  120. package/reactHooks/videoModal/hooks/useVideoModalScreenData.tsx +22 -4
  121. package/rectUtils/index.ts +2 -2
  122. package/screenPickerUtils/index.ts +5 -0
  123. package/screenState/__tests__/index.test.ts +1 -1
  124. package/stringUtils/index.ts +1 -1
  125. package/testUtils/index.tsx +21 -30
  126. package/typeGuards/index.ts +0 -4
  127. package/utils/__tests__/clone.test.ts +158 -0
  128. package/utils/clone.ts +7 -0
  129. package/utils/index.ts +1 -13
  130. package/utils/path.ts +3 -6
  131. package/utils/pathOr.ts +1 -5
  132. package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +2 -2
  133. package/zappFrameworkUtils/HookCallback/hookCallbackManifestExtensions.config.js +1 -1
  134. package/zappFrameworkUtils/loginPluginUtils.ts +1 -1
  135. package/adsUtils/__tests__/createVMAP.test.ts +0 -419
  136. package/appDataUtils/__tests__/urlScheme.test.ts +0 -678
  137. package/appUtils/focusManagerAux/utils/index.ios.ts +0 -122
  138. package/cloudEventsUtils/__tests__/index.test.ts +0 -529
  139. package/enumUtils/__tests__/getEnumKeyByEnumValue.test.ts +0 -207
  140. package/errorUtils/__tests__/GeneralError.test.ts +0 -97
  141. package/errorUtils/__tests__/HttpStatusCode.test.ts +0 -344
  142. package/errorUtils/__tests__/MissingPluginError.test.ts +0 -113
  143. package/errorUtils/__tests__/NetworkError.test.ts +0 -202
  144. package/errorUtils/__tests__/getParsedResponse.test.ts +0 -188
  145. package/errorUtils/__tests__/invariant.test.ts +0 -112
  146. package/numberUtils/__tests__/toPositiveNumber.test.ts +0 -165
  147. package/reactHooks/analytics/__tests__/useSendAnalyticsOnPress.test.ts +0 -537
  148. package/reactHooks/dev/__tests__/useReRenderLog.test.ts +0 -188
  149. package/reactHooks/ui/__tests__/useFadeOutWhenBlurred.test.ts +0 -580
  150. package/rectUtils/__tests__/index.test.ts +0 -549
  151. package/screenPickerUtils/__tests__/index.test.ts +0 -333
  152. package/searchUtils/const.ts +0 -7
  153. package/searchUtils/index.ts +0 -3
  154. package/time/__tests__/BackgroundTimer.test.ts +0 -156
  155. package/time/__tests__/Timer.test.ts +0 -236
  156. package/typeGuards/__tests__/isString.test.ts +0 -21
  157. package/utils/__tests__/mergeRight.test.ts +0 -48
  158. package/utils/__tests__/selectors.test.ts +0 -124
  159. package/utils/mergeRight.ts +0 -5
  160. package/utils/selectors.ts +0 -46
@@ -50,7 +50,7 @@ describe("getAllSpecificStyles", () => {
50
50
  });
51
51
 
52
52
  expect(outStyles).toHaveProperty("default");
53
- expect(outStyles.default).toEqual({});
53
+ expect(outStyles["default"]).toEqual({});
54
54
  });
55
55
 
56
56
  it("should handle empty configuration", () => {
@@ -83,7 +83,7 @@ describe("getAllSpecificStyles", () => {
83
83
  outStyles,
84
84
  });
85
85
 
86
- expect(outStyles.default).toEqual({
86
+ expect(outStyles["default"]).toEqual({
87
87
  backgroundColor: "#FF0000",
88
88
  borderWidth: 2,
89
89
  });
@@ -104,7 +104,7 @@ describe("getAllSpecificStyles", () => {
104
104
  outStyles,
105
105
  });
106
106
 
107
- expect(outStyles.default).toEqual({
107
+ expect(outStyles["default"]).toEqual({
108
108
  backgroundColor: "#FF0000",
109
109
  textSize: 16,
110
110
  });
@@ -126,7 +126,7 @@ describe("getAllSpecificStyles", () => {
126
126
  outStyles,
127
127
  });
128
128
 
129
- expect(outStyles.default).toEqual({
129
+ expect(outStyles["default"]).toEqual({
130
130
  backgroundColor: "#FF0000",
131
131
  });
132
132
  });
@@ -148,11 +148,11 @@ describe("getAllSpecificStyles", () => {
148
148
  outStyles,
149
149
  });
150
150
 
151
- expect(outStyles.default).toEqual({
151
+ expect(outStyles["default"]).toEqual({
152
152
  backgroundColor: "#FF0000",
153
153
  });
154
154
 
155
- expect(outStyles.pressed).toEqual({
155
+ expect(outStyles["pressed"]).toEqual({
156
156
  backgroundColor: "#00FF00",
157
157
  });
158
158
  });
@@ -171,7 +171,7 @@ describe("getAllSpecificStyles", () => {
171
171
  outStyles,
172
172
  });
173
173
 
174
- expect(outStyles.focused).toEqual({
174
+ expect(outStyles["focused"]).toEqual({
175
175
  borderWidth: 3,
176
176
  });
177
177
  });
@@ -190,7 +190,7 @@ describe("getAllSpecificStyles", () => {
190
190
  outStyles,
191
191
  });
192
192
 
193
- expect(outStyles.selected).toEqual({
193
+ expect(outStyles["selected"]).toEqual({
194
194
  opacity: 0.5,
195
195
  });
196
196
  });
@@ -209,7 +209,7 @@ describe("getAllSpecificStyles", () => {
209
209
  outStyles,
210
210
  });
211
211
 
212
- expect(outStyles.focused_selected).toEqual({
212
+ expect(outStyles["focused_selected"]).toEqual({
213
213
  scale: 1.2,
214
214
  });
215
215
  });
@@ -232,21 +232,21 @@ describe("getAllSpecificStyles", () => {
232
232
  outStyles,
233
233
  });
234
234
 
235
- expect(outStyles.default).toEqual({
235
+ expect(outStyles["default"]).toEqual({
236
236
  backgroundColor: "#FF0000",
237
237
  borderWidth: 1,
238
238
  opacity: 1,
239
239
  });
240
240
 
241
241
  // Pressed should have default styles merged with its specific override
242
- expect(outStyles.pressed).toEqual({
242
+ expect(outStyles["pressed"]).toEqual({
243
243
  backgroundColor: "#00FF00", // Override
244
244
  borderWidth: 1, // From default
245
245
  opacity: 1, // From default
246
246
  });
247
247
 
248
248
  // Focused should have default styles merged with its specific override
249
- expect(outStyles.focused).toEqual({
249
+ expect(outStyles["focused"]).toEqual({
250
250
  backgroundColor: "#FF0000", // From default
251
251
  borderWidth: 1, // From default
252
252
  opacity: 0.8, // Override
@@ -270,7 +270,7 @@ describe("getAllSpecificStyles", () => {
270
270
  outStyles,
271
271
  });
272
272
 
273
- expect(outStyles.pressed).toEqual({
273
+ expect(outStyles["pressed"]).toEqual({
274
274
  existingKey: "existingValue", // Should be preserved
275
275
  backgroundColor: "#FF0000", // From default
276
276
  textColor: "#FFFFFF", // New pressed style
@@ -294,7 +294,7 @@ describe("getAllSpecificStyles", () => {
294
294
  outStyles,
295
295
  });
296
296
 
297
- expect(outStyles.default).toEqual({
297
+ expect(outStyles["default"]).toEqual({
298
298
  backgroundColor: "#FF0000", // Samsung-specific should be included
299
299
  });
300
300
  });
@@ -317,7 +317,7 @@ describe("getAllSpecificStyles", () => {
317
317
  outStyles,
318
318
  });
319
319
 
320
- expect(outStyles.default).toEqual({
320
+ expect(outStyles["default"]).toEqual({
321
321
  backgroundColor: "#FFFFFF", // Only non-platform specific
322
322
  });
323
323
  });
@@ -336,7 +336,7 @@ describe("getAllSpecificStyles", () => {
336
336
  outStyles,
337
337
  });
338
338
 
339
- expect(outStyles.default).toEqual({
339
+ expect(outStyles["default"]).toEqual({
340
340
  color: "#FF0000",
341
341
  });
342
342
  });
@@ -356,7 +356,7 @@ describe("getAllSpecificStyles", () => {
356
356
  outStyles,
357
357
  });
358
358
 
359
- expect(outStyles.pressed).toEqual({
359
+ expect(outStyles["pressed"]).toEqual({
360
360
  backgroundColor: "#FF0000", // Only samsung style
361
361
  });
362
362
  });
@@ -377,7 +377,7 @@ describe("getAllSpecificStyles", () => {
377
377
  outStyles,
378
378
  });
379
379
 
380
- expect(outStyles.default).toEqual({
380
+ expect(outStyles["default"]).toEqual({
381
381
  backgroundColor: "#00FF00", // Samsung-specific should win
382
382
  });
383
383
  });
@@ -412,14 +412,14 @@ describe("getAllSpecificStyles", () => {
412
412
  outStyles,
413
413
  });
414
414
 
415
- expect(outStyles.default).toEqual({
415
+ expect(outStyles["default"]).toEqual({
416
416
  backgroundColor: "#FFFFFF",
417
417
  textColor: "#000000",
418
418
  borderWidth: 1,
419
419
  padding: 10,
420
420
  });
421
421
 
422
- expect(outStyles.pressed).toEqual({
422
+ expect(outStyles["pressed"]).toEqual({
423
423
  backgroundColor: "#EEEEEE",
424
424
  textColor: "#000000",
425
425
  borderWidth: 1,
@@ -427,7 +427,7 @@ describe("getAllSpecificStyles", () => {
427
427
  opacity: 0.8,
428
428
  });
429
429
 
430
- expect(outStyles.focused).toEqual({
430
+ expect(outStyles["focused"]).toEqual({
431
431
  backgroundColor: "#FFFFFF",
432
432
  textColor: "#000000",
433
433
  borderWidth: 1,
@@ -453,7 +453,7 @@ describe("getAllSpecificStyles", () => {
453
453
  outStyles,
454
454
  });
455
455
 
456
- expect(outStyles.default).toEqual({
456
+ expect(outStyles["default"]).toEqual({
457
457
  validKey: "included",
458
458
  });
459
459
  });
@@ -474,11 +474,11 @@ describe("getAllSpecificStyles", () => {
474
474
  outStyles,
475
475
  });
476
476
 
477
- expect(outStyles.focused_selected).toEqual({
477
+ expect(outStyles["focused_selected"]).toEqual({
478
478
  test: "focused_selected_value",
479
479
  });
480
480
 
481
- expect(outStyles.focused).toEqual({
481
+ expect(outStyles["focused"]).toEqual({
482
482
  another: "focused_value",
483
483
  });
484
484
  });
@@ -517,7 +517,7 @@ describe("getAllSpecificStyles", () => {
517
517
  outStyles,
518
518
  });
519
519
 
520
- expect(outStyles.pressed.backgroundColor).toBe("#222222");
520
+ expect(outStyles["pressed"]["backgroundColor"]).toBe("#222222");
521
521
  });
522
522
 
523
523
  it("should handle frozen outStyles properties", () => {
@@ -537,7 +537,7 @@ describe("getAllSpecificStyles", () => {
537
537
  });
538
538
 
539
539
  // Should create new object instead of mutating frozen one
540
- expect(outStyles.default).toEqual({
540
+ expect(outStyles["default"]).toEqual({
541
541
  existingProp: "value",
542
542
  backgroundColor: "#FF0000",
543
543
  });
@@ -1,7 +1,4 @@
1
1
  import { dayjs } from "../index";
2
- import customParseFormat from "dayjs/plugin/customParseFormat";
3
-
4
- dayjs.extend(customParseFormat);
5
2
 
6
3
  describe("dayjs", () => {
7
4
  describe("basic functionality", () => {
@@ -4,12 +4,14 @@ import timezone from "dayjs/plugin/timezone";
4
4
  import isoWeek from "dayjs/plugin/isoWeek";
5
5
  import duration from "dayjs/plugin/duration";
6
6
  import relativeTime from "dayjs/plugin/relativeTime";
7
+ import customParseFormat from "dayjs/plugin/customParseFormat";
7
8
 
8
9
  // Extend dayjs with plugins
9
10
  dayjs.extend(utc);
10
11
  dayjs.extend(timezone);
11
12
  dayjs.extend(isoWeek);
12
13
  dayjs.extend(duration);
14
+ dayjs.extend(customParseFormat);
13
15
 
14
16
  dayjs.extend(relativeTime, {
15
17
  thresholds: [
@@ -49,7 +49,7 @@ export const findSelectedMenuId = (
49
49
  ) => {
50
50
  const sectionName = QUICK_BRICK_NAVBAR_SECTIONS[sectionKey];
51
51
 
52
- return pathOr<string | undefined>(
52
+ return pathOr(
53
53
  undefined,
54
54
  ["children", index, "id"],
55
55
  focusableTree.find(sectionName)
@@ -1,15 +1,6 @@
1
1
  import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
2
2
  import { getAppDataHeaders } from "../index";
3
3
 
4
- const mockUILanguage = "en-US";
5
-
6
- jest.mock(
7
- "@applicaster/zapp-react-native-utils/appUtils/localizationsHelper",
8
- () => ({
9
- getUILanguage: jest.fn(() => mockUILanguage),
10
- })
11
- );
12
-
13
4
  describe("getAppDataHeaders", () => {
14
5
  const mockAppData = {
15
6
  riversConfigurationId: "test-layout",
@@ -34,7 +25,7 @@ describe("getAppDataHeaders", () => {
34
25
  const expectedHeaders = {
35
26
  "x-applicaster-layout-id": mockAppData.riversConfigurationId,
36
27
  "x-applicaster-screen-id": screenId,
37
- "x-applicaster-language-code": mockUILanguage,
28
+ "x-applicaster-language-code": mockAppData.languageCode,
38
29
  "x-applicaster-version-number": mockAppData.version_name,
39
30
  "x-applicaster-platform": mockAppData.platform,
40
31
  "x-applicaster-country-code": mockAppData.countryCode,
@@ -42,7 +33,6 @@ describe("getAppDataHeaders", () => {
42
33
  mockAppData.signedDeviceInfoToken,
43
34
  "x-applicaster-device-make": mockAppData.deviceMake,
44
35
  "x-applicaster-device-model": mockAppData.deviceModel,
45
- "x-applicaster-uuid": undefined,
46
36
  };
47
37
 
48
38
  const headers = getAppDataHeaders(screenId);
@@ -1,7 +1,6 @@
1
1
  import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
2
2
  import { getPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
3
3
  import { utilsLogger } from "../logger";
4
- import { getUILanguage } from "../localizationUtils";
5
4
 
6
5
  const logger = utilsLogger.addSubsystem("headersUtils");
7
6
 
@@ -22,7 +21,7 @@ export const getAppDataHeaders = (screenId: string) => {
22
21
  "x-applicaster-layout-id":
23
22
  appData.riversConfigurationId || appData.rivers_configuration_id,
24
23
  "x-applicaster-screen-id": screenId,
25
- "x-applicaster-language-code": getUILanguage(),
24
+ "x-applicaster-language-code": appData.languageCode,
26
25
  "x-applicaster-version-number": appData.version_name || appData.versionName,
27
26
  "x-applicaster-platform": (platform || appData.platform).toLowerCase(),
28
27
  "x-applicaster-country-code": appData.countryCode,
@@ -123,6 +123,12 @@ function getPlayerConfiguration({ platform, version }) {
123
123
  key: "skip_button_localization_text_skip_intro",
124
124
  initial_value: "Skip Intro",
125
125
  },
126
+ {
127
+ type: "text_input",
128
+ label: "Stream error message",
129
+ key: "stream_error_message",
130
+ initial_value: "Cannot play stream",
131
+ },
126
132
  {
127
133
  type: "text_input",
128
134
  label: "Locked message",
@@ -364,20 +370,6 @@ function getPlayerConfiguration({ platform, version }) {
364
370
  };
365
371
 
366
372
  if (isTV(platform)) {
367
- localizations.fields.push({
368
- key: "back_to_live_label",
369
- label: "Back to live label",
370
- initial_value: "Back To Live",
371
- type: "text_input",
372
- });
373
-
374
- localizations.fields.push({
375
- key: "start_over_label",
376
- label: "Start over label",
377
- initial_value: "Start Over",
378
- type: "text_input",
379
- });
380
-
381
373
  styles.fields.push(
382
374
  fieldsGroup("Always Show Scrub Bar & Timestamp", "", [
383
375
  {
@@ -490,7 +482,7 @@ function getPlayerConfiguration({ platform, version }) {
490
482
  ),
491
483
  fieldsGroup(
492
484
  "Skip Button",
493
- "This section allows you to configure the skip button behaviour",
485
+ "This section allows you to configure the skip button styles for tv",
494
486
  [
495
487
  {
496
488
  type: "switch",
@@ -507,12 +499,6 @@ function getPlayerConfiguration({ platform, version }) {
507
499
  label: "Persistent Button Toggle",
508
500
  initial_value: true,
509
501
  },
510
- ]
511
- ),
512
- fieldsGroup(
513
- "Labeled Button Style",
514
- "This section allows you to configure the labeled button styles",
515
- [
516
502
  {
517
503
  type: "color_picker_rgba",
518
504
  label_tooltip: "",
@@ -668,61 +654,7 @@ function getPlayerConfiguration({ platform, version }) {
668
654
  );
669
655
  }
670
656
 
671
- if (isTV(platform)) {
672
- general.fields.push(
673
- {
674
- key: "liveSeekingEnabled",
675
- label: "Live Seeking Enabled",
676
- initial_value: false,
677
- type: "switch",
678
- label_tooltip: "Enable Live Seek",
679
- },
680
- {
681
- key: "minimumAllowedSeekableDurationInSeconds",
682
- label: "Minimum allowed seekable duration in seconds",
683
- initial_value: 300,
684
- type: "number_input",
685
- label_tooltip:
686
- "If duration less than this value, player will disable 'liveSeekingEnabled' value",
687
- },
688
- {
689
- key: "live_image",
690
- label: "Live badge",
691
- type: "uploader",
692
- label_tooltip: "Override default live badge / icon",
693
- },
694
- {
695
- key: "live_width",
696
- label: "Live badge width",
697
- type: "number_input",
698
- initial_value: 85,
699
- },
700
- {
701
- key: "live_height",
702
- label: "Live badge height",
703
- type: "number_input",
704
- initial_value: 50,
705
- }
706
- );
707
- }
708
-
709
657
  if (isMobile(platform)) {
710
- localizations.fields.push(
711
- {
712
- type: "text_input",
713
- label: "Restrict playback on mobile networks alert title",
714
- key: "mobile_connection_restricted_alert_title",
715
- initial_value: "Restricted Connection Type",
716
- },
717
- {
718
- type: "text_input",
719
- label: "Restrict playback on mobile networks alert message",
720
- key: "mobile_connection_restricted_alert_message",
721
- initial_value:
722
- "This content can only be viewed over a Wi-Fi or LAN network.",
723
- }
724
- );
725
-
726
658
  general.fields.push(
727
659
  {
728
660
  section: "Default Timestamp Type",
@@ -38,7 +38,7 @@ function tvActionButtonsContainer({ label, description, defaults }) {
38
38
  generateFieldsFromDefaultsWithoutPrefixedLabel(
39
39
  label,
40
40
  defaults,
41
- tvActionButtonContainerFields(defaults.position)
41
+ tvActionButtonContainerFields(defaults["position"])
42
42
  )
43
43
  );
44
44
 
@@ -11,16 +11,6 @@ describe("toNumber", () => {
11
11
  });
12
12
  });
13
13
 
14
- it("return number if input is BigInt", () => {
15
- const inputs = [5n, -5n];
16
- expect.assertions(inputs.length);
17
-
18
- inputs.forEach((input) => {
19
- const output = toNumber(input);
20
- expect(output).toBe(Number(input));
21
- });
22
- });
23
-
24
14
  it("return number if input is string as number", () => {
25
15
  const inputs = ["-1", "0", "1", "100", "0.2"];
26
16
  expect.assertions(inputs.length);
@@ -42,8 +32,6 @@ describe("toNumber", () => {
42
32
  { test: 1 },
43
33
  [],
44
34
  [1],
45
- "5n",
46
- "-5n",
47
35
  ];
48
36
 
49
37
  expect.assertions(inputs.length);
@@ -8,7 +8,7 @@ export const toNumber = (value: unknown): number | undefined => {
8
8
  return undefined;
9
9
  }
10
10
 
11
- if (R.is(Number, value) || R.is(BigInt, value) || R.is(String, value)) {
11
+ if (R.is(Number, value) || R.is(String, value)) {
12
12
  const numberOrNan = Number(value);
13
13
 
14
14
  return Number.isNaN(numberOrNan) ? undefined : numberOrNan;
@@ -69,24 +69,6 @@ export const isMinusZero = (value: number) => {
69
69
  return 1 / value === -Infinity;
70
70
  };
71
71
 
72
- export const toPositiveNumber = (value: unknown): number | undefined => {
73
- const possibleNumber = toNumber(value);
74
-
75
- if (R.isNil(possibleNumber)) {
76
- return undefined;
77
- }
78
-
79
- if (possibleNumber < 0) {
80
- return undefined;
81
- }
82
-
83
- if (isZero(possibleNumber)) {
84
- return undefined;
85
- }
86
-
87
- return possibleNumber;
88
- };
89
-
90
72
  export const toPositiveNumberWithDefault = (
91
73
  defaultValue: number,
92
74
  value: unknown
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "15.0.0-rc.99",
3
+ "version": "15.1.0-alpha.2915689988",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -27,13 +27,13 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/applicaster-types": "15.0.0-rc.99",
30
+ "@applicaster/applicaster-types": "15.1.0-alpha.2915689988",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",
34
- "handlebars": "4.7.8",
35
34
  "memoizee": "0.4.15",
36
- "prop-types": "^15.0.0"
35
+ "prop-types": "^15.0.0",
36
+ "react-native-handlebars": "^5.0.0-alpha.1"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@applicaster/zapp-pipes-v2-client": "*",
@@ -9,6 +9,16 @@ import { Dimensions } from "react-native";
9
9
 
10
10
  export { getPlayerActionButtons } from "./getPlayerActionButtons";
11
11
 
12
+ export const HLS_MIME_TYPES = [
13
+ "application/x-mpegURL",
14
+ "application/vnd.apple.mpegurl",
15
+ ];
16
+
17
+ export const STREAMING_VIDEO_MIME_TYPES = [
18
+ ...HLS_MIME_TYPES,
19
+ "application/dash+xml",
20
+ ];
21
+
12
22
  /**
13
23
  * Gets duration value from player manager, and from extensions
14
24
  * then checks whether the value from either is a not a valid number
@@ -27,7 +37,7 @@ export function isLiveLegacy(content) {
27
37
  ]);
28
38
 
29
39
  const durationFromExt = R.path(["extensions", "duration"], content);
30
- const durationFromMgr = playerManager.getDuration();
40
+ const durationFromMgr = playerManager.getInstanceController()?.getDuration();
31
41
  const duration = Math.floor(durationFromExt || durationFromMgr);
32
42
 
33
43
  const isLive = R.anyPass([isNotaValidNumber, R.lte(R.__, 0)])(duration);
@@ -71,7 +81,9 @@ function isLiveByManager(): boolean {
71
81
  return true;
72
82
  }
73
83
 
74
- const durationFromPlayerManager = playerManager.getDuration();
84
+ const durationFromPlayerManager = playerManager
85
+ .getInstanceController()
86
+ ?.getDuration();
75
87
 
76
88
  return isLiveByDuration(durationFromPlayerManager);
77
89
  }
@@ -80,6 +92,16 @@ export function isLive(entry: ZappEntry): boolean {
80
92
  return isEntryLive(entry) || isLiveByManager();
81
93
  }
82
94
 
95
+ export const isVideoItem = (item: Option<ZappEntry>) => {
96
+ const contentType = item?.content?.type;
97
+
98
+ return (
99
+ isString(contentType) &&
100
+ (contentType.includes("video") ||
101
+ STREAMING_VIDEO_MIME_TYPES.includes(contentType))
102
+ );
103
+ };
104
+
83
105
  export const isAudioItem = (item: Option<ZappEntry>) => {
84
106
  if (
85
107
  isString(item?.content?.type) &&
@@ -6,7 +6,6 @@ import { deprecationMessage } from "../appUtils";
6
6
 
7
7
  import { pluginUtilsLogger } from "./logger";
8
8
  import { platformSelect } from "../reactUtils";
9
- import { get } from "../utils";
10
9
 
11
10
  type PluginModule = any;
12
11
  type Plugin = {
@@ -30,10 +29,7 @@ export function getComponentModule({
30
29
  components: ComponentsMap;
31
30
  plugins: Plugin[] | QuickBrickPlugin[];
32
31
  }) {
33
- const component = R.compose(
34
- R.prop(R.__, components),
35
- toPascalCase
36
- )(componentType);
32
+ const component = components[toPascalCase(componentType)];
37
33
 
38
34
  if (component) {
39
35
  return component;
@@ -60,7 +56,9 @@ export function findComponentByType({
60
56
  ? R.compose(...R.reverse(decorators))
61
57
  : decorators;
62
58
 
63
- const component = getComponentModule({ componentType, components, plugins });
59
+ const module = getComponentModule({ componentType, components, plugins });
60
+
61
+ const component = module?.Component || module;
64
62
 
65
63
  return R.unless(R.isNil, applyDecorators)(component);
66
64
  }
@@ -255,6 +253,3 @@ const getPluginType = R.pathOr("unknown_plugin_type", [
255
253
 
256
254
  export const isPlayerPlugin = (routeState): boolean =>
257
255
  getPluginType(routeState) === "player";
258
-
259
- export const getPluginModuleUrlScheme = (plugin) =>
260
- get(plugin, ["module", "urlScheme"]);
@@ -3,7 +3,7 @@ import { View } from "react-native";
3
3
  import * as R from "ramda";
4
4
 
5
5
  import { useNavigation } from "../navigation";
6
- import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
6
+ import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
7
7
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
8
8
  import { dismissModal, openModal } from "../../modalState";
9
9
 
@@ -16,7 +16,7 @@ const ModalContainer = platformSelect({
16
16
 
17
17
  export function useAdvertisingInterstitial() {
18
18
  const { screenData, currentRoute } = useNavigation();
19
- const plugins = usePlugins();
19
+ const { plugins } = usePickFromState();
20
20
 
21
21
  return useEffect(() => {
22
22
  // TODD: typing problem: fix any type
@@ -1,5 +1,5 @@
1
1
  import EventEmitter from "events";
2
- import { renderHook, act } from "@testing-library/react-native";
2
+ import { renderHook, act } from "@testing-library/react-hooks";
3
3
  import { useAppState } from "../useAppState";
4
4
 
5
5
  const emitter = new EventEmitter();
@@ -1,4 +1,4 @@
1
- import { renderHook } from "@testing-library/react-native";
1
+ import { renderHook } from "@testing-library/react-hooks";
2
2
 
3
3
  jest.mock(
4
4
  "@applicaster/zapp-react-native-ui-components/Contexts/ScreenTrackedViewPositionsContext",
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
 
3
- import { renderHook, act, waitFor } from "@testing-library/react-native";
3
+ import { renderHook } from "@testing-library/react-hooks";
4
+ import { act, waitFor } from "@testing-library/react-native";
4
5
  import { Provider } from "react-redux";
5
6
  import configureStore from "redux-mock-store";
6
7
  import { useTrackedView } from "../useTrackedView";
@@ -0,0 +1 @@
1
+ export { useIsCasting } from "./useIsCasting";