@applicaster/zapp-react-native-utils 14.0.0-rc.9 → 14.0.0-rc.91

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 (142) hide show
  1. package/actionsExecutor/ActionExecutorContext.tsx +60 -84
  2. package/actionsExecutor/ScreenActions.ts +164 -0
  3. package/actionsExecutor/StorageActions.ts +110 -0
  4. package/actionsExecutor/feedDecorator.ts +171 -0
  5. package/actionsExecutor/screenResolver.ts +11 -0
  6. package/analyticsUtils/AnalyticPlayerListener.ts +5 -2
  7. package/analyticsUtils/AnalyticsEvents/helper.ts +81 -0
  8. package/analyticsUtils/AnalyticsEvents/sendHeaderClickEvent.ts +1 -1
  9. package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +2 -1
  10. package/analyticsUtils/AnalyticsEvents/sendOnClickEvent.ts +14 -4
  11. package/analyticsUtils/__tests__/analyticsUtils.test.js +3 -0
  12. package/analyticsUtils/events.ts +8 -0
  13. package/analyticsUtils/index.tsx +3 -4
  14. package/analyticsUtils/manager.ts +1 -1
  15. package/analyticsUtils/playerAnalyticsTracker.ts +2 -1
  16. package/appUtils/HooksManager/Hook.ts +4 -4
  17. package/appUtils/HooksManager/index.ts +11 -1
  18. package/appUtils/accessibilityManager/const.ts +13 -0
  19. package/appUtils/accessibilityManager/hooks.ts +35 -1
  20. package/appUtils/accessibilityManager/index.ts +154 -30
  21. package/appUtils/accessibilityManager/utils.ts +24 -0
  22. package/appUtils/contextKeysManager/contextResolver.ts +42 -1
  23. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +8 -0
  24. package/appUtils/focusManager/__tests__/focusManager.test.js +1 -1
  25. package/appUtils/focusManager/events.ts +2 -0
  26. package/appUtils/focusManager/index.ios.ts +27 -0
  27. package/appUtils/focusManager/index.ts +86 -11
  28. package/appUtils/focusManager/treeDataStructure/Tree/index.js +1 -1
  29. package/appUtils/focusManagerAux/utils/index.ts +112 -3
  30. package/appUtils/focusManagerAux/utils/utils.ios.ts +35 -0
  31. package/appUtils/platform/platformUtils.ts +33 -3
  32. package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +91 -16
  33. package/appUtils/playerManager/OverlayObserver/utils.ts +32 -20
  34. package/appUtils/playerManager/conts.ts +21 -0
  35. package/appUtils/playerManager/useChapterMarker.tsx +0 -1
  36. package/appUtils/playerManager/usePlayerControllerSetup.tsx +16 -0
  37. package/arrayUtils/__tests__/allTruthy.test.ts +24 -0
  38. package/arrayUtils/__tests__/anyThruthy.test.ts +24 -0
  39. package/arrayUtils/__tests__/isEmptyArray.test.ts +63 -0
  40. package/arrayUtils/__tests__/isFilledArray.test.ts +1 -1
  41. package/arrayUtils/index.ts +13 -3
  42. package/audioPlayerUtils/__tests__/getArtworkImage.test.ts +144 -0
  43. package/audioPlayerUtils/__tests__/getBackgroundImage.test.ts +72 -0
  44. package/audioPlayerUtils/__tests__/getImageFromEntry.test.ts +110 -0
  45. package/audioPlayerUtils/assets/index.ts +2 -0
  46. package/audioPlayerUtils/index.ts +242 -0
  47. package/componentsUtils/__tests__/isTabsScreen.test.ts +38 -0
  48. package/componentsUtils/index.ts +4 -1
  49. package/conf/player/__tests__/selectors.test.ts +34 -0
  50. package/conf/player/selectors.ts +10 -0
  51. package/configurationUtils/__tests__/configurationUtils.test.js +0 -31
  52. package/configurationUtils/__tests__/getMediaItems.test.ts +65 -0
  53. package/configurationUtils/__tests__/imageSrcFromMediaItem.test.ts +34 -0
  54. package/configurationUtils/__tests__/manifestKeyParser.test.ts +546 -0
  55. package/configurationUtils/index.ts +64 -35
  56. package/configurationUtils/manifestKeyParser.ts +57 -32
  57. package/focusManager/FocusManager.ts +104 -20
  58. package/focusManager/Tree.ts +25 -21
  59. package/focusManager/__tests__/FocusManager.test.ts +50 -8
  60. package/focusManager/aux/index.ts +98 -0
  61. package/focusManager/utils.ts +12 -6
  62. package/index.d.ts +1 -10
  63. package/manifestUtils/_internals/getDefaultConfiguration.js +28 -0
  64. package/manifestUtils/{_internals.js → _internals/index.js} +2 -25
  65. package/manifestUtils/createConfig.js +4 -1
  66. package/manifestUtils/defaultManifestConfigurations/player.js +2764 -1539
  67. package/manifestUtils/index.js +4 -0
  68. package/manifestUtils/keys.js +33 -0
  69. package/manifestUtils/progressBar/__tests__/mobileProgressBar.test.js +0 -30
  70. package/manifestUtils/sharedConfiguration/screenPicker/stylesFields.js +6 -0
  71. package/manifestUtils/sharedConfiguration/screenPicker/utils.js +1 -0
  72. package/navigationUtils/__tests__/mapContentTypesToRivers.test.ts +130 -0
  73. package/navigationUtils/index.ts +26 -21
  74. package/package.json +2 -3
  75. package/playerUtils/PlayerTTS/PlayerTTS.ts +359 -0
  76. package/playerUtils/PlayerTTS/index.ts +1 -0
  77. package/playerUtils/__tests__/configurationUtils.test.ts +1 -65
  78. package/playerUtils/__tests__/getPlayerActionButtons.test.ts +54 -0
  79. package/playerUtils/_internals/__tests__/utils.test.ts +71 -0
  80. package/playerUtils/_internals/index.ts +1 -0
  81. package/playerUtils/_internals/utils.ts +31 -0
  82. package/playerUtils/configurationUtils.ts +0 -44
  83. package/playerUtils/getPlayerActionButtons.ts +17 -0
  84. package/playerUtils/index.ts +53 -0
  85. package/playerUtils/usePlayerTTS.ts +21 -0
  86. package/playerUtils/useValidatePlayerConfig.tsx +22 -19
  87. package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +15 -14
  88. package/reactHooks/cell-click/__tests__/index.test.js +3 -0
  89. package/reactHooks/cell-click/index.ts +8 -1
  90. package/reactHooks/debugging/__tests__/index.test.js +0 -1
  91. package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +47 -90
  92. package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +71 -31
  93. package/reactHooks/feed/index.ts +2 -0
  94. package/reactHooks/feed/useBatchLoading.ts +17 -10
  95. package/reactHooks/feed/useFeedLoader.tsx +36 -43
  96. package/reactHooks/feed/useInflatedUrl.ts +23 -29
  97. package/reactHooks/feed/useLoadPipesDataDispatch.ts +63 -0
  98. package/reactHooks/feed/usePipesCacheReset.ts +3 -3
  99. package/reactHooks/flatList/useSequentialRenderItem.tsx +3 -3
  100. package/reactHooks/layout/__tests__/index.test.tsx +3 -1
  101. package/reactHooks/layout/index.ts +1 -1
  102. package/reactHooks/layout/isTablet/index.ts +12 -5
  103. package/reactHooks/layout/useDimensions/__tests__/useDimensions.test.ts +34 -36
  104. package/reactHooks/layout/useDimensions/useDimensions.ts +2 -3
  105. package/reactHooks/layout/useLayoutVersion.ts +5 -5
  106. package/reactHooks/navigation/index.ts +7 -5
  107. package/reactHooks/navigation/useIsScreenActive.ts +9 -5
  108. package/reactHooks/navigation/useRoute.ts +7 -2
  109. package/reactHooks/navigation/useScreenStateStore.ts +8 -0
  110. package/reactHooks/resolvers/__tests__/useCellResolver.test.tsx +4 -0
  111. package/reactHooks/screen/useScreenContext.ts +1 -1
  112. package/reactHooks/state/__tests__/ZStoreProvider.test.tsx +2 -1
  113. package/reactHooks/state/index.ts +1 -1
  114. package/reactHooks/state/useHomeRiver.ts +4 -2
  115. package/reactHooks/state/useRivers.ts +7 -8
  116. package/riverComponetsMeasurementProvider/index.tsx +1 -1
  117. package/screenPickerUtils/index.ts +13 -0
  118. package/services/js2native.ts +1 -0
  119. package/storage/ScreenSingleValueProvider.ts +204 -0
  120. package/storage/ScreenStateMultiSelectProvider.ts +293 -0
  121. package/storage/StorageMultiSelectProvider.ts +192 -0
  122. package/storage/StorageSingleSelectProvider.ts +108 -0
  123. package/testUtils/index.tsx +7 -8
  124. package/time/BackgroundTimer.ts +6 -4
  125. package/utils/__tests__/endsWith.test.ts +30 -0
  126. package/utils/__tests__/find.test.ts +36 -0
  127. package/utils/__tests__/mapAccum.test.ts +73 -0
  128. package/utils/__tests__/omit.test.ts +19 -0
  129. package/utils/__tests__/path.test.ts +33 -0
  130. package/utils/__tests__/pathOr.test.ts +37 -0
  131. package/utils/__tests__/startsWith.test.ts +30 -0
  132. package/utils/__tests__/take.test.ts +40 -0
  133. package/utils/endsWith.ts +9 -0
  134. package/utils/find.ts +3 -0
  135. package/utils/index.ts +38 -1
  136. package/utils/mapAccum.ts +23 -0
  137. package/utils/omit.ts +5 -0
  138. package/utils/path.ts +5 -0
  139. package/utils/pathOr.ts +5 -0
  140. package/utils/startsWith.ts +9 -0
  141. package/utils/take.ts +5 -0
  142. package/playerUtils/configurationGenerator.ts +0 -2572
@@ -29,6 +29,9 @@ const {
29
29
  getUpdatedSecondaryImageKeys,
30
30
  } = require("./secondaryImage");
31
31
 
32
+ const DEFAULT_GRADIENT_IMAGE =
33
+ "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABQAAAACFCAQAAACuqJ2wAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfpCBMILTZuwM2UAAAKeElEQVR42u3da47cRgyFUSnTCLL/7SY9lR9BDDjzSFsqqfg43IB1v8tikRypvW9/bRFi30T24KFYlQdD9gkhxK8W6z+1DoKHQh4IHgrRKR7bCPAUVz2DQpbfQy5WyAMeVjjLXBSyQAMoxI3lRobyUHBRyAIxuYWv3QDaLPKQh3U95CIXRYws4GFKD20AzUBCOImCi4KHzeKxvYdJIZMwD7hokl7vIQ+4KGJUUy5e3ADGuAhNEDwQQgjVTHCxWQNoq8YDHlR2gQc84GE3F6K6yINgDaAQQghRO+y0eBCqAXxvZr1JtN8MxQMe8MCOnwc84MF/GsBevfBIV7SRFEKI7649Gx0eiAMeVNgA/noTIlVnTW9IrpyE0V/Hvr4HNjo84EFxDypsAEdawzCsyxLBlXmMvjyu0HoY8XhwacTdAB4vPA7NeZYY9psf5S+CSEY609ivr6ajNs24G0A7qfksMcQ+M0Mk511jKJ6liaBqmp6mr4BNUeIOhqb5WXmI5AySKKqneRnK3klZ2PMr4N6Hd8RIPQwxdI1OJYnhOvrYq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6 @@ module.exports = {
47
50
  tvProgressBar,
48
51
  secondaryImage,
49
52
  getUpdatedSecondaryImageKeys,
53
+ DEFAULT_GRADIENT_IMAGE,
50
54
  compact,
51
55
  };
@@ -485,6 +485,18 @@ const TV_MENU_LABEL_FIELDS = [
485
485
  type: ZAPPIFEST_FIELDS.number_input,
486
486
  suffix: "LG letter spacing",
487
487
  },
488
+ {
489
+ type: ZAPPIFEST_FIELDS.font_selector.roku,
490
+ suffix: "Roku font family",
491
+ },
492
+ {
493
+ type: ZAPPIFEST_FIELDS.number_input,
494
+ suffix: "Roku font size",
495
+ },
496
+ {
497
+ type: ZAPPIFEST_FIELDS.number_input,
498
+ suffix: "Roku line height",
499
+ },
488
500
  {
489
501
  type: ZAPPIFEST_FIELDS.select,
490
502
  suffix: "text transform",
@@ -947,6 +959,27 @@ const TV_CELL_LABEL_FIELDS = [
947
959
  rules: "conditional",
948
960
  conditions: [{ key: "switch", section: "styles", value: true }],
949
961
  },
962
+ {
963
+ type: ZAPPIFEST_FIELDS.font_selector.roku,
964
+ suffix: "roku font family",
965
+ tooltip: "",
966
+ rules: "conditional",
967
+ conditions: [{ key: "switch", section: "styles", value: true }],
968
+ },
969
+ {
970
+ type: ZAPPIFEST_FIELDS.number_input,
971
+ suffix: "roku font size",
972
+ tooltip: "",
973
+ rules: "conditional",
974
+ conditions: [{ key: "switch", section: "styles", value: true }],
975
+ },
976
+ {
977
+ type: ZAPPIFEST_FIELDS.number_input,
978
+ suffix: "roku line height",
979
+ tooltip: "",
980
+ rules: "conditional",
981
+ conditions: [{ key: "switch", section: "styles", value: true }],
982
+ },
950
983
  {
951
984
  type: ZAPPIFEST_FIELDS.select,
952
985
  suffix: "text alignment",
@@ -18,36 +18,6 @@ describe("mobileProgressBar", () => {
18
18
  ]),
19
19
  });
20
20
 
21
- // const timeRemainingLabelConditions = (condition) => ({
22
- // rules: "all_conditions",
23
- // conditional_fields: compact([
24
- // {
25
- // key: "assets/progress_bar_switch",
26
- // condition_value: true,
27
- // },
28
- // {
29
- // key: "assets/progress_bar_time_remaining_label_enable",
30
- // condition_value: true,
31
- // },
32
- // condition,
33
- // ]),
34
- // });
35
-
36
- // const watchedLabelConditions = (condition) => ({
37
- // rules: "all_conditions",
38
- // conditional_fields: compact([
39
- // {
40
- // key: "assets/progress_bar_switch",
41
- // condition_value: true,
42
- // },
43
- // {
44
- // key: "assets/progress_bar_watched_label_enable",
45
- // condition_value: true,
46
- // },
47
- // condition,
48
- // ]),
49
- // });
50
-
51
21
  it("generate progress-bar configuration - enabled and with bottom_of_cell", () => {
52
22
  const enable = true;
53
23
  const hideUnwatched = true;
@@ -424,6 +424,12 @@ const titleFields = [
424
424
  key: "vizio_font_family",
425
425
  initial_value: fontFamily,
426
426
  },
427
+ {
428
+ type: "roku_font_selector",
429
+ label: "Roku TV Font Family",
430
+ key: "roku_font_family",
431
+ initial_value: fontFamily,
432
+ },
427
433
  ...generateFontConfiguration(),
428
434
  // text transform
429
435
  {
@@ -3,6 +3,7 @@ const defaultPlatforms = {
3
3
  android_tv: "Android TV",
4
4
  lg_tv: "LG TV",
5
5
  samsung_tv: "Samsung TV",
6
+ roku: "Roku TV",
6
7
  };
7
8
 
8
9
  const global_defaults = {
@@ -0,0 +1,130 @@
1
+ import { mapContentTypesToRivers } from "../index";
2
+
3
+ describe("mapContentTypesToRivers", () => {
4
+ it("should return the correct content types mapped to rivers", () => {
5
+ const state = {
6
+ rivers: {
7
+ "river-1": {
8
+ plugin_type: "river",
9
+ },
10
+ },
11
+ contentTypes: {
12
+ "content-type-1": {
13
+ screen_id: "river-1",
14
+ },
15
+ },
16
+ };
17
+
18
+ const result = mapContentTypesToRivers(state);
19
+
20
+ expect(result).toEqual({
21
+ "content-type-1": {
22
+ screenType: "river",
23
+ screen_id: "river-1",
24
+ },
25
+ });
26
+ });
27
+
28
+ it("should return null if contentTypes is undefined", () => {
29
+ const state = {
30
+ rivers: {
31
+ "river-1": {
32
+ plugin_type: "river",
33
+ },
34
+ },
35
+ // contentTypes is missing
36
+ };
37
+
38
+ const result = mapContentTypesToRivers(state);
39
+
40
+ expect(result).toBeNull();
41
+ });
42
+
43
+ it("should skip content types whose screen does not exist in rivers", () => {
44
+ const state = {
45
+ rivers: {
46
+ "river-1": {
47
+ plugin_type: "river",
48
+ },
49
+ },
50
+ contentTypes: {
51
+ "content-type-1": {
52
+ screen_id: "river-1",
53
+ },
54
+ "content-type-2": {
55
+ screen_id: "river-2", // river-2 does not exist
56
+ },
57
+ },
58
+ };
59
+
60
+ const result = mapContentTypesToRivers(state);
61
+
62
+ expect(result).toEqual({
63
+ "content-type-1": {
64
+ screenType: "river",
65
+ screen_id: "river-1",
66
+ },
67
+ });
68
+
69
+ // result is not null, but may be undefined for missing keys
70
+ expect(result && result["content-type-2"]).toBeUndefined();
71
+ });
72
+
73
+ it("should use 'type' if 'plugin_type' is not present in river", () => {
74
+ const state = {
75
+ rivers: {
76
+ "river-1": {
77
+ type: "custom-type",
78
+ },
79
+ },
80
+ contentTypes: {
81
+ "content-type-1": {
82
+ screen_id: "river-1",
83
+ },
84
+ },
85
+ };
86
+
87
+ const result = mapContentTypesToRivers(state);
88
+
89
+ expect(result).toEqual({
90
+ "content-type-1": {
91
+ screenType: "custom-type",
92
+ screen_id: "river-1",
93
+ },
94
+ });
95
+ });
96
+
97
+ it("should skip content types if neither plugin_type nor type is present in river", () => {
98
+ const state = {
99
+ rivers: {
100
+ "river-1": {
101
+ // no plugin_type or type
102
+ },
103
+ },
104
+ contentTypes: {
105
+ "content-type-1": {
106
+ screen_id: "river-1",
107
+ },
108
+ },
109
+ };
110
+
111
+ const result = mapContentTypesToRivers(state);
112
+
113
+ expect(result).toEqual({});
114
+ });
115
+
116
+ it("should handle empty contentTypes object", () => {
117
+ const state = {
118
+ rivers: {
119
+ "river-1": {
120
+ plugin_type: "river",
121
+ },
122
+ },
123
+ contentTypes: {},
124
+ };
125
+
126
+ const result = mapContentTypesToRivers(state);
127
+
128
+ expect(result).toEqual({});
129
+ });
130
+ });
@@ -13,6 +13,7 @@ import {
13
13
  isPlayable,
14
14
  isV2River,
15
15
  } from "./itemTypeMatchers";
16
+ import { RootState } from "@applicaster/zapp-react-native-redux/store";
16
17
 
17
18
  type PathAttribute = {
18
19
  screenType: string;
@@ -41,7 +42,7 @@ export function getNavigationType(
41
42
  R.unless(R.isNil, R.prop("navigation_type")),
42
43
  R.defaultTo(undefined),
43
44
  R.find(R.propEq("category", category))
44
- )(navigations);
45
+ )(navigations || []);
45
46
  }
46
47
 
47
48
  /**
@@ -377,10 +378,11 @@ export const usesVideoModal = (
377
378
  return targetScreenConfiguration?.styles?.use_video_modal;
378
379
  };
379
380
 
380
- export const mapContentTypesToRivers = ({
381
- rivers,
382
- contentTypes,
383
- }): ZappContentTypesMapped | null => {
381
+ export const mapContentTypesToRivers = (
382
+ state: Partial<RootState>
383
+ ): ZappContentTypesMapped | null => {
384
+ const { rivers, contentTypes } = state;
385
+
384
386
  if (!contentTypes) {
385
387
  return null;
386
388
  }
@@ -573,24 +575,27 @@ export function routeIsPlayerScreen(currentRoute) {
573
575
  return currentRoute?.includes("/playable");
574
576
  }
575
577
 
576
- export const getNavBarProps =
577
- (currentRiver: ZappRiver, pathname: string, title: string) => () => {
578
- const props = getNavigationPropsV2({
579
- currentRiver,
580
- title,
581
- category: "nav_bar",
582
- });
578
+ export const getNavBarProps = (
579
+ currentRiver: ZappRiver,
580
+ pathname: string,
581
+ title: string
582
+ ) => {
583
+ const props = getNavigationPropsV2({
584
+ currentRiver,
585
+ title,
586
+ category: "nav_bar",
587
+ });
583
588
 
584
- if (props) {
585
- return {
586
- ...props,
587
- id: pathname,
588
- pathname: pathname,
589
- };
590
- }
589
+ if (props) {
590
+ return {
591
+ ...props,
592
+ id: pathname,
593
+ pathname: pathname,
594
+ };
595
+ }
591
596
 
592
- return null;
593
- };
597
+ return null;
598
+ };
594
599
 
595
600
  export const findMenuPlugin = (
596
601
  navigations: ZappNavigation[],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "14.0.0-rc.9",
3
+ "version": "14.0.0-rc.91",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/applicaster-types": "14.0.0-rc.9",
30
+ "@applicaster/applicaster-types": "14.0.0-rc.91",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",
@@ -38,7 +38,6 @@
38
38
  "peerDependencies": {
39
39
  "@applicaster/zapp-pipes-v2-client": "*",
40
40
  "@react-native-community/netinfo": "*",
41
- "immer": "*",
42
41
  "react": "*",
43
42
  "react-native": "*",
44
43
  "uglify-js": "*",