@applicaster/zapp-react-native-utils 15.1.0-rc.8 → 16.0.0-alpha.1480443100

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 (165) hide show
  1. package/README.md +0 -6
  2. package/actionUtils/index.ts +7 -0
  3. package/actionsExecutor/ActionExecutorContext.tsx +44 -12
  4. package/actionsExecutor/feedDecorator.ts +6 -6
  5. package/adsUtils/__tests__/createVMAP.test.ts +419 -0
  6. package/adsUtils/index.ts +2 -2
  7. package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +2 -2
  8. package/analyticsUtils/PlayerAnalyticsManager.ts +11 -1
  9. package/analyticsUtils/README.md +1 -1
  10. package/analyticsUtils/__tests__/analyticsMapper.test.ts +35 -0
  11. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testACP_events.json +1 -1
  12. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testBlockUnlistedParams_rules.json +1 -1
  13. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_events.json +4 -0
  14. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_rules.json +6 -0
  15. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEventRegex_events.json +3 -9
  16. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_events.json +18 -0
  17. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_rules.json +16 -0
  18. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_events.json +4 -0
  19. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_rules.json +6 -0
  20. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_events.json +4 -0
  21. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_rules.json +6 -0
  22. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_events.json +4 -0
  23. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_rules.json +6 -0
  24. package/analyticsUtils/__tests__/fixtures/index.js +20 -0
  25. package/analyticsUtils/analyticsMapper.ts +4 -1
  26. package/analyticsUtils/playerAnalyticsTracker.ts +26 -3
  27. package/appDataUtils/__tests__/urlScheme.test.ts +678 -0
  28. package/appUtils/HooksManager/__tests__/__snapshots__/hooksManager.test.js.snap +0 -188
  29. package/appUtils/HooksManager/__tests__/hooksManager.test.js +16 -2
  30. package/appUtils/HooksManager/index.ts +15 -26
  31. package/appUtils/RiverFocusManager/{index.js → index.ts} +25 -18
  32. package/appUtils/accessibilityManager/const.ts +4 -0
  33. package/appUtils/accessibilityManager/utils.ts +0 -1
  34. package/appUtils/contextKeysManager/__tests__/getKeys/failure.test.ts +7 -2
  35. package/appUtils/contextKeysManager/__tests__/getKeys/success.test.ts +48 -0
  36. package/appUtils/contextKeysManager/contextResolver.ts +51 -22
  37. package/appUtils/contextKeysManager/index.ts +65 -10
  38. package/appUtils/contextKeysManager/utils/index.ts +38 -25
  39. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +3 -0
  40. package/appUtils/focusManager/index.ios.ts +43 -4
  41. package/appUtils/focusManager/treeDataStructure/Tree/__tests__/Tree.test.js +46 -0
  42. package/appUtils/focusManager/treeDataStructure/Tree/index.js +18 -18
  43. package/appUtils/focusManagerAux/utils/index.ios.ts +122 -0
  44. package/appUtils/focusManagerAux/utils/index.ts +11 -3
  45. package/appUtils/focusManagerAux/utils/utils.ios.ts +202 -3
  46. package/appUtils/keyCodes/keys/keys.web.ts +1 -4
  47. package/appUtils/orientationHelper.ts +2 -4
  48. package/appUtils/platform/platformUtils.ts +12 -1
  49. package/appUtils/playerManager/player.ts +4 -0
  50. package/appUtils/playerManager/playerNative.ts +30 -21
  51. package/appUtils/playerManager/usePlayerState.tsx +14 -2
  52. package/cloudEventsUtils/__tests__/index.test.ts +529 -0
  53. package/cloudEventsUtils/index.ts +65 -1
  54. package/componentsUtils/index.ts +8 -0
  55. package/configurationUtils/__tests__/manifestKeyParser.test.ts +26 -26
  56. package/enumUtils/__tests__/getEnumKeyByEnumValue.test.ts +207 -0
  57. package/errorUtils/__tests__/GeneralError.test.ts +97 -0
  58. package/errorUtils/__tests__/HttpStatusCode.test.ts +344 -0
  59. package/errorUtils/__tests__/MissingPluginError.test.ts +113 -0
  60. package/errorUtils/__tests__/NetworkError.test.ts +202 -0
  61. package/errorUtils/__tests__/getParsedResponse.test.ts +188 -0
  62. package/errorUtils/__tests__/invariant.test.ts +112 -0
  63. package/focusManager/aux/index.ts +1 -1
  64. package/headersUtils/__tests__/headersUtils.test.js +11 -1
  65. package/headersUtils/index.ts +2 -1
  66. package/manifestUtils/_internals/__tests__/index.test.js +41 -0
  67. package/manifestUtils/_internals/index.js +33 -0
  68. package/manifestUtils/defaultManifestConfigurations/generalContent.js +35 -0
  69. package/manifestUtils/defaultManifestConfigurations/player.js +59 -1
  70. package/manifestUtils/fieldUtils/__tests__/fieldUtils.test.js +49 -0
  71. package/manifestUtils/fieldUtils/index.js +54 -0
  72. package/manifestUtils/index.js +3 -1
  73. package/manifestUtils/keys.js +228 -0
  74. package/manifestUtils/mobileAction/button/__tests__/mobileActionButton.test.js +168 -0
  75. package/manifestUtils/mobileAction/button/index.js +140 -0
  76. package/manifestUtils/mobileAction/container/__tests__/mobileActionButtonsContainer.test.js +102 -0
  77. package/manifestUtils/mobileAction/container/index.js +73 -0
  78. package/manifestUtils/mobileAction/groups/__tests__/buildMobileActionButtonGroups.test.js +127 -0
  79. package/manifestUtils/mobileAction/groups/defaults.js +76 -0
  80. package/manifestUtils/mobileAction/groups/index.js +80 -0
  81. package/manifestUtils/tvAction/container/index.js +1 -1
  82. package/numberUtils/__tests__/toNumber.test.ts +27 -0
  83. package/numberUtils/__tests__/toPositiveNumber.test.ts +193 -0
  84. package/numberUtils/index.ts +23 -1
  85. package/package.json +4 -4
  86. package/playerUtils/index.ts +4 -2
  87. package/pluginUtils/index.ts +4 -0
  88. package/reactHooks/advertising/index.ts +2 -2
  89. package/reactHooks/analytics/__tests__/useSendAnalyticsOnPress.test.ts +537 -0
  90. package/reactHooks/app/__tests__/useAppState.test.ts +1 -1
  91. package/reactHooks/autoscrolling/__tests__/useTrackCurrentAutoScrollingElement.test.ts +1 -1
  92. package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +1 -2
  93. package/reactHooks/cell-click/__tests__/index.test.js +1 -3
  94. package/reactHooks/cell-click/index.ts +15 -6
  95. package/reactHooks/configuration/__tests__/index.test.tsx +1 -1
  96. package/reactHooks/connection/__tests__/index.test.js +1 -1
  97. package/reactHooks/debugging/__tests__/index.test.js +4 -4
  98. package/reactHooks/dev/__tests__/useReRenderLog.test.ts +188 -0
  99. package/reactHooks/device/useIsTablet.tsx +14 -19
  100. package/reactHooks/device/useMemoizedIsTablet.ts +3 -3
  101. package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +32 -23
  102. package/reactHooks/feed/__tests__/useBuildPipesUrl.test.tsx +19 -19
  103. package/reactHooks/feed/__tests__/useEntryScreenId.test.tsx +4 -1
  104. package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +42 -30
  105. package/reactHooks/feed/__tests__/useInflatedUrl.test.tsx +1 -1
  106. package/reactHooks/feed/index.ts +0 -2
  107. package/reactHooks/feed/useBatchLoading.ts +7 -1
  108. package/reactHooks/feed/useEntryScreenId.ts +2 -2
  109. package/reactHooks/feed/usePipesCacheReset.ts +3 -1
  110. package/reactHooks/flatList/useLoadNextPageIfNeeded.ts +13 -16
  111. package/reactHooks/layout/__tests__/index.test.tsx +1 -1
  112. package/reactHooks/layout/__tests__/useLayoutVersion.test.tsx +1 -1
  113. package/reactHooks/layout/useDimensions/__tests__/{useDimensions.test.ts → useDimensions.test.tsx} +105 -25
  114. package/reactHooks/layout/useDimensions/useDimensions.ts +2 -2
  115. package/reactHooks/navigation/__tests__/index.test.tsx +2 -4
  116. package/reactHooks/navigation/index.ts +7 -6
  117. package/reactHooks/navigation/useRoute.ts +8 -6
  118. package/reactHooks/player/TVSeekControlller/TVSeekController.ts +27 -10
  119. package/reactHooks/player/__tests__/useAutoSeek._test.tsx +1 -1
  120. package/reactHooks/player/__tests__/useTapSeek._test.ts +1 -1
  121. package/reactHooks/resolvers/__tests__/useCellResolver.test.tsx +1 -1
  122. package/reactHooks/resolvers/__tests__/useComponentResolver.test.tsx +1 -1
  123. package/reactHooks/resolvers/useCellResolver.ts +6 -2
  124. package/reactHooks/resolvers/useComponentResolver.ts +8 -2
  125. package/reactHooks/screen/__tests__/useCurrentScreenData.test.tsx +2 -2
  126. package/reactHooks/screen/__tests__/useIsStandaloneFullscreen.test.ts +114 -0
  127. package/reactHooks/screen/__tests__/useScreenBackgroundColor.test.tsx +1 -1
  128. package/reactHooks/screen/__tests__/useScreenData.test.tsx +1 -1
  129. package/reactHooks/screen/__tests__/useTargetScreenData.test.tsx +12 -4
  130. package/reactHooks/screen/useTargetScreenData.ts +4 -2
  131. package/reactHooks/state/useRivers.ts +1 -1
  132. package/reactHooks/ui/__tests__/useFadeOutWhenBlurred.test.ts +580 -0
  133. package/reactHooks/usePluginConfiguration.ts +2 -2
  134. package/reactHooks/utils/__tests__/index.test.js +1 -1
  135. package/rectUtils/__tests__/index.test.ts +549 -0
  136. package/rectUtils/index.ts +2 -2
  137. package/refreshUtils/RefreshCoordinator/__tests__/refreshCoordinator.test.ts +206 -0
  138. package/refreshUtils/RefreshCoordinator/index.ts +245 -0
  139. package/refreshUtils/RefreshCoordinator/utils/__tests__/getDataRefreshConfig.test.ts +104 -0
  140. package/refreshUtils/RefreshCoordinator/utils/index.ts +29 -0
  141. package/screenPickerUtils/__tests__/index.test.ts +333 -0
  142. package/screenState/__tests__/index.test.ts +1 -1
  143. package/screenUtils/index.ts +3 -0
  144. package/searchUtils/const.ts +7 -0
  145. package/searchUtils/index.ts +3 -0
  146. package/stringUtils/index.ts +1 -1
  147. package/testUtils/index.tsx +30 -21
  148. package/time/__tests__/BackgroundTimer.test.ts +156 -0
  149. package/time/__tests__/Timer.test.ts +236 -0
  150. package/typeGuards/__tests__/isString.test.ts +21 -0
  151. package/typeGuards/index.ts +4 -0
  152. package/utils/__tests__/mergeRight.test.ts +48 -0
  153. package/utils/__tests__/path.test.ts +7 -0
  154. package/utils/__tests__/selectors.test.ts +124 -0
  155. package/utils/index.ts +13 -0
  156. package/utils/mergeRight.ts +5 -0
  157. package/utils/path.ts +6 -3
  158. package/utils/pathOr.ts +5 -1
  159. package/utils/selectors.ts +46 -0
  160. package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +1 -1
  161. package/zappFrameworkUtils/HookCallback/hookCallbackManifestExtensions.config.js +1 -1
  162. package/zappFrameworkUtils/loginPluginUtils.ts +1 -1
  163. package/reactHooks/componentsMap/index.ts +0 -55
  164. package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +0 -75
  165. package/reactHooks/feed/useFeedRefresh.tsx +0 -65
@@ -23,7 +23,7 @@
23
23
  "second": {
24
24
  "name": "EventName",
25
25
  "params": {
26
- "acp": 1
26
+ "acp": "1"
27
27
  }
28
28
  }
29
29
  }
@@ -12,4 +12,4 @@
12
12
  }
13
13
  ],
14
14
  "strategy": "allowUnlisted"
15
- }
15
+ }
@@ -0,0 +1,4 @@
1
+ [
2
+ { "first": { "name": "keep_me", "params": {} },
3
+ "second": { "name": "keep_me", "params": {} } }
4
+ ]
@@ -0,0 +1,6 @@
1
+ {
2
+ "rules": [
3
+ { "event": "keep_me", "ignore": false, "rename": "", "strategy": "allowUnlisted" }
4
+ ],
5
+ "strategy": "allowUnlisted"
6
+ }
@@ -2,17 +2,11 @@
2
2
  {
3
3
  "first": {
4
4
  "name": "Screen viewed: Ads & redirects",
5
- "params": {
6
- "ignored_param": "removed_value",
7
- "kept_param": "kept_value"
8
- }
5
+ "params": {}
9
6
  },
10
7
  "second": {
11
8
  "name": "Screen Ads & redirects",
12
- "params": {
13
- "ignored_param": "removed_value",
14
- "kept_param": "kept_value"
15
- }
9
+ "params": {}
16
10
  }
17
11
  }
18
- ]
12
+ ]
@@ -0,0 +1,18 @@
1
+ [
2
+ {
3
+ "first": {
4
+ "name": "screen_view",
5
+ "params": {}
6
+ },
7
+ "second": {
8
+ "name": "page_view",
9
+ "params": {}
10
+ }
11
+ },
12
+ {
13
+ "first": {
14
+ "name": "player_presented",
15
+ "params": {}
16
+ }
17
+ }
18
+ ]
@@ -0,0 +1,16 @@
1
+ {
2
+ "rules": [
3
+ {
4
+ "event": "player_presented",
5
+ "ignore": true,
6
+ "strategy": "allowUnlisted"
7
+ },
8
+ {
9
+ "event": "screen_view",
10
+ "ignore": false,
11
+ "rename": "page_view",
12
+ "strategy": "allowUnlisted"
13
+ }
14
+ ],
15
+ "strategy": "allowUnlisted"
16
+ }
@@ -0,0 +1,4 @@
1
+ [
2
+ { "first": { "name": "my_event", "params": {} },
3
+ "second": { "name": "my_event", "params": {} } }
4
+ ]
@@ -0,0 +1,6 @@
1
+ {
2
+ "rules": [
3
+ { "event": "my_event", "ignore": false, "rename": "should_not_apply", "regex": "wont_match_.*", "strategy": "allowUnlisted" }
4
+ ],
5
+ "strategy": "allowUnlisted"
6
+ }
@@ -0,0 +1,4 @@
1
+ [
2
+ { "first": { "name": "play-video", "params": {} },
3
+ "second": { "name": "play_video", "params": {} } }
4
+ ]
@@ -0,0 +1,6 @@
1
+ {
2
+ "rules": [
3
+ { "ignore": false, "rename": "$<first>_$<second>", "regex": "(?<first>[a-z]+)-(?<second>[a-z]+)", "strategy": "allowUnlisted" }
4
+ ],
5
+ "strategy": "allowUnlisted"
6
+ }
@@ -0,0 +1,4 @@
1
+ [
2
+ { "first": { "name": "screen_view", "params": {} },
3
+ "second": { "name": "renamed", "params": {} } }
4
+ ]
@@ -0,0 +1,6 @@
1
+ {
2
+ "rules": [
3
+ { "ignore": false, "rename": "renamed", "regex": "screen_view", "strategy": "allowUnlisted" }
4
+ ],
5
+ "strategy": "allowUnlisted"
6
+ }
@@ -14,6 +14,16 @@ import blockUnlistedEventEvents from "./analytics_mapper_testBlockUnlistedEvents
14
14
  import blockUnlistedEventRules from "./analytics_mapper_testBlockUnlistedEvents_rules.json";
15
15
  import ACPEventEvents from "./analytics_mapper_testACP_events.json";
16
16
  import ACPEventRules from "./analytics_mapper_testACP_rules.json";
17
+ import emptyRenameRules from "./analytics_mapper_testEmptyRenameKeepsName_rules.json";
18
+ import emptyRenameEvents from "./analytics_mapper_testEmptyRenameKeepsName_events.json";
19
+ import ignoreOrderingRules from "./analytics_mapper_testIgnoreOrdering_rules.json";
20
+ import ignoreOrderingEvents from "./analytics_mapper_testIgnoreOrdering_events.json";
21
+ import regexEventNoFallbackRules from "./analytics_mapper_testRegexEventNoFallback_rules.json";
22
+ import regexEventNoFallbackEvents from "./analytics_mapper_testRegexEventNoFallback_events.json";
23
+ import regexMultiGroupRenameRules from "./analytics_mapper_testRegexMultiGroupRename_rules.json";
24
+ import regexMultiGroupRenameEvents from "./analytics_mapper_testRegexMultiGroupRename_events.json";
25
+ import regexNonNamedFullMatchRules from "./analytics_mapper_testRegexNonNamedFullMatch_rules.json";
26
+ import regexNonNamedFullMatchEvents from "./analytics_mapper_testRegexNonNamedFullMatch_events.json";
17
27
 
18
28
  export const fixtures = {
19
29
  renameRules,
@@ -32,4 +42,14 @@ export const fixtures = {
32
42
  blockUnlistedEventRules,
33
43
  ACPEventEvents,
34
44
  ACPEventRules,
45
+ emptyRenameRules,
46
+ emptyRenameEvents,
47
+ ignoreOrderingRules,
48
+ ignoreOrderingEvents,
49
+ regexEventNoFallbackRules,
50
+ regexEventNoFallbackEvents,
51
+ regexMultiGroupRenameRules,
52
+ regexMultiGroupRenameEvents,
53
+ regexNonNamedFullMatchRules,
54
+ regexNonNamedFullMatchEvents,
35
55
  };
@@ -76,7 +76,10 @@ class StateHolder {
76
76
  delete this.pluckedParams[prefix];
77
77
  }
78
78
 
79
- return this._cap?.[suffix];
79
+ // Stringify so values match the native iOS/Android mappers (which coerce
80
+ // analyticsCustomProperties values to strings) — keeps GA4 data consistent
81
+ // across web/LG/Samsung and native platforms.
82
+ return this._cap?.[suffix]?.toString() ?? null;
80
83
  }
81
84
 
82
85
  private async getFromLocalAndSession(
@@ -4,8 +4,14 @@ import { isTrue } from "@applicaster/zapp-react-native-utils/booleanUtils";
4
4
  import { postAnalyticEvent } from "./manager";
5
5
  import { isLive } from "../playerUtils";
6
6
  import { extensionsEvents } from "./AnalyticsEvents/helper";
7
- import { AD_EVENT, EVENT_TYPES, PLAYER_DISPLAY_STATES } from "./events";
7
+ import {
8
+ AD_EVENT,
9
+ EVENT_TYPES,
10
+ GENERAL_EVENT,
11
+ PLAYER_DISPLAY_STATES,
12
+ } from "./events";
8
13
  import { Player } from "../appUtils/playerManager/player";
14
+ import { isNil } from "@applicaster/zapp-react-native-utils/utils";
9
15
 
10
16
  export interface PlayerAnalyticsTrackerI {
11
17
  handleAnalyticEvent(
@@ -13,6 +19,8 @@ export interface PlayerAnalyticsTrackerI {
13
19
  eventData?: QuickBrickPlayer.EventData
14
20
  ): void;
15
21
  setPlayer(player: Player): void;
22
+ onPlayerPresented(): void;
23
+ onPlayerClosed(): void;
16
24
  }
17
25
 
18
26
  export class PlayerAnalyticsTracker implements PlayerAnalyticsTrackerI {
@@ -26,6 +34,15 @@ export class PlayerAnalyticsTracker implements PlayerAnalyticsTrackerI {
26
34
  this.player = player;
27
35
  }
28
36
 
37
+ onPlayerPresented() {
38
+ this.handleAnalyticEvent(GENERAL_EVENT.player_presented);
39
+ }
40
+
41
+ onPlayerClosed() {
42
+ this.handleAnalyticEvent(GENERAL_EVENT.session_end);
43
+ this.handleAnalyticEvent(GENERAL_EVENT.player_closed);
44
+ }
45
+
29
46
  isAdBreak(event: string): boolean {
30
47
  const adBreakEvents = [
31
48
  AD_EVENT.ad_break_start,
@@ -180,7 +197,8 @@ export class PlayerAnalyticsTracker implements PlayerAnalyticsTrackerI {
180
197
  this.entry?.extensions?.free || this.entry?.extensions?.isFree;
181
198
 
182
199
  const title = this.entry?.title;
183
- const streamType = isLive(this.entry) ? "live" : "vod"; // Todo: determine other types, channel, podcast, aod
200
+ const isStreamLive = isLive(this.entry);
201
+ const streamType = isStreamLive ? "live" : "vod"; // Todo: determine other types, channel, podcast, aod
184
202
 
185
203
  const currentPosition = this.getCurrentPosition(
186
204
  event,
@@ -201,6 +219,7 @@ export class PlayerAnalyticsTracker implements PlayerAnalyticsTrackerI {
201
219
  );
202
220
 
203
221
  const playerState = this.getPlayerState();
222
+ const playerType = this.player?.playerPluginId;
204
223
 
205
224
  const analyticsCustomProperties = extensionsEvents(this.entry?.extensions);
206
225
 
@@ -210,7 +229,11 @@ export class PlayerAnalyticsTracker implements PlayerAnalyticsTrackerI {
210
229
  name: title,
211
230
  media_type: mediaType,
212
231
  stream_type: streamType,
213
- duration: mediaDuration,
232
+ player_type: playerType,
233
+ // We do not pass duration for live streams anymore (it's now seekableDuration),
234
+ // but we can't mark it as optional in Analytics Mapper yet,
235
+ // so we set it to -1 for live streams
236
+ duration: isStreamLive && isNil(mediaDuration) ? -1 : mediaDuration,
214
237
  current_position: currentPosition,
215
238
  player_state: playerState,
216
239
  stream_format: contentType,