@applicaster/zapp-react-native-utils 12.0.0-alpha.4337072244 → 12.0.0-alpha.4354608902

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 (65) hide show
  1. package/analyticsUtils/AnalyticsEvents/index.ts +7 -0
  2. package/analyticsUtils/AnalyticsEvents/sendShareEvent.ts +21 -0
  3. package/analyticsUtils/analyticsPlugins.ts +25 -0
  4. package/analyticsUtils/events.ts +6 -0
  5. package/analyticsUtils/index.tsx +6 -0
  6. package/appUtils/HooksManager/{Hook.js → Hook.ts} +35 -23
  7. package/appUtils/HooksManager/{constants.js → constants.ts} +1 -1
  8. package/appUtils/HooksManager/{index.js → index.ts} +118 -111
  9. package/appUtils/HooksManager/types.ts +116 -0
  10. package/appUtils/RiverFocusManager/index.js +17 -12
  11. package/appUtils/accessibilityManager/const.ts +50 -0
  12. package/appUtils/accessibilityManager/hooks.ts +31 -0
  13. package/appUtils/accessibilityManager/index.ts +150 -0
  14. package/appUtils/accessibilityManager/logger.ts +5 -0
  15. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +1 -2
  16. package/appUtils/focusManager/__tests__/index.test.ts +1 -2
  17. package/appUtils/focusManager/index.ts +7 -73
  18. package/appUtils/focusManager/treeDataStructure/Tree/index.js +2 -3
  19. package/appUtils/focusManager/treeDataStructure/Utils/index.js +7 -8
  20. package/appUtils/focusManager/utils/index.ts +8 -2
  21. package/appUtils/focusManagerAux/index.ts +76 -0
  22. package/appUtils/focusManagerAux/utils/index.ts +100 -0
  23. package/appUtils/{index.js → index.ts} +2 -0
  24. package/appUtils/keyCodes/{index.js → index.ts} +2 -0
  25. package/appUtils/keyCodes/keys/index.ts +3 -0
  26. package/appUtils/keyCodes/{keys.android.js → keys/keyEventMapper.ts} +0 -19
  27. package/appUtils/keyCodes/keys/keys.android.ts +18 -0
  28. package/appUtils/keyCodes/keys/keys.ios.ts +25 -0
  29. package/appUtils/keyCodes/keys/keys.ts +15 -0
  30. package/appUtils/keyCodes/{keys.web.js → keys/keys.web.ts} +8 -0
  31. package/appUtils/keyCodes/{keysByPlatform.js → keys/keysByPlatform.ts} +11 -1
  32. package/appUtils/platform/const.ts +25 -0
  33. package/appUtils/platform/index.ts +3 -0
  34. package/appUtils/platform/platformUtils.ts +171 -0
  35. package/appUtils/playerManager/conts.ts +1 -0
  36. package/appUtils/playerManager/index.ts +11 -5
  37. package/appUtils/playerManager/nativePlayerManager.ts +12 -0
  38. package/appUtils/playerManager/player.ts +9 -3
  39. package/appUtils/playerManager/playerNative.ts +5 -14
  40. package/appUtils/playerManager/usePlayerControllerSetup.tsx +7 -1
  41. package/booleanUtils/index.ts +4 -4
  42. package/domUtils/{cookieManager.js → cookieManager.ts} +1 -2
  43. package/functionUtils/index.ts +15 -11
  44. package/keyboardState/index.ts +0 -0
  45. package/modalState/index.ts +1 -5
  46. package/navigationUtils/index.ts +62 -5
  47. package/package.json +2 -2
  48. package/pluginUtils/index.ts +9 -0
  49. package/reactHooks/cell-click/__tests__/index.test.js +2 -1
  50. package/reactHooks/cell-click/index.ts +1 -1
  51. package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +6 -2
  52. package/reactHooks/feed/useFeedRefresh.tsx +9 -7
  53. package/reactHooks/navigation/__tests__/index.test.tsx +11 -8
  54. package/reactHooks/navigation/index.ts +53 -72
  55. package/reactHooks/screen/useScreenContext.ts +1 -2
  56. package/reactUtils/index.ts +91 -0
  57. package/appUtils/focusManager/FocusableEvents.ts +0 -8
  58. package/appUtils/focusManager/treeDataStructure/Utils/__tests__/Utils_android.test.js +0 -1094
  59. package/appUtils/focusManager/treeDataStructure/Utils/index.android.js +0 -261
  60. package/appUtils/keyCodes/keys.ios.js +0 -46
  61. /package/appUtils/HooksManager/{logger.js → logger.ts} +0 -0
  62. /package/appUtils/{directionHelper.js → directionHelper.ts} +0 -0
  63. /package/appUtils/keyCodes/{androidTVKeys.js → androidTVKeys.ts} +0 -0
  64. /package/appUtils/{localizationsHelper.js → localizationsHelper.ts} +0 -0
  65. /package/domUtils/{logger.js → logger.ts} +0 -0
@@ -108,3 +108,94 @@ export const isAndroidPlatform = () => Platform.OS === "android";
108
108
  export const isTvOSPlatform = () => getPlatform() === "tvos";
109
109
 
110
110
  export const isAndroidTVPlatform = () => getPlatform() === "android_tv";
111
+
112
+ /**
113
+ * Platforms found in userAgent string, please note that simulators
114
+ * might not have the same agents that the devices have
115
+ */
116
+ export const PLATFORMS = {
117
+ webos: "Web0S",
118
+ tizen: "Tizen",
119
+ samsung: "SMART-TV",
120
+ mac: "Mac",
121
+ win: "Win",
122
+ linux: "Linux",
123
+ iphone: "iPhone",
124
+ android: "Android",
125
+ mobile: "Mobile",
126
+ vizio: "VIZIO",
127
+ smartcast: "SmartCast",
128
+ conjure: "Conjure",
129
+ };
130
+
131
+ /**
132
+ * Simple way of identifying if we have access to the tizen APIs
133
+ */
134
+ export const hasTizen = typeof window?.tizen !== "undefined";
135
+
136
+ /**
137
+ * Simple way of identifying if we have access to the webOS APIs
138
+ */
139
+ export const hasWebOS = typeof window?.webOS !== "undefined";
140
+
141
+ export const getUserAgent = () =>
142
+ window?.navigator?.userAgent || global?.navigator?.userAgent;
143
+
144
+ export const isLgPlatform = () => {
145
+ const userAgent = getUserAgent();
146
+
147
+ if (!userAgent) {
148
+ return false;
149
+ }
150
+
151
+ // Note: LG uses the number 0 in their userAgent, possibly because of Palm WebOS
152
+ return hasWebOS || userAgent.includes(PLATFORMS.webos);
153
+ };
154
+
155
+ export const isSamsungPlatform = () => {
156
+ const userAgent = getUserAgent();
157
+
158
+ if (!userAgent) {
159
+ return false;
160
+ }
161
+
162
+ return (
163
+ hasTizen ||
164
+ userAgent.includes(PLATFORMS.samsung) ||
165
+ userAgent.includes(PLATFORMS.tizen)
166
+ );
167
+ };
168
+
169
+ /**
170
+ * Checks if we are on the Vizio platform by using the userAgent string
171
+ *
172
+ * Use this method when you need to identify the platform on runtime
173
+ * before the VIZIO Companion Library has loaded
174
+ */
175
+ export const isVizioPlatform = () => {
176
+ const userAgent = getUserAgent();
177
+
178
+ if (!userAgent) {
179
+ return false;
180
+ }
181
+
182
+ const isVizioAgent =
183
+ userAgent.includes(PLATFORMS.vizio) ||
184
+ userAgent.includes(PLATFORMS.smartcast) ||
185
+ userAgent.includes(PLATFORMS.conjure);
186
+
187
+ return isVizioAgent;
188
+ };
189
+
190
+ /**
191
+ * Checks if we are on the Vizio platform by checking for the global VIZIO object
192
+ * and the VIZIO Companion Library. This method does not use the userAgent string,
193
+ * because it mainly checks whether we have access to apis, which may not be available yet
194
+ */
195
+ export const hasVizioAPIs = () => {
196
+ const hasAPIs =
197
+ typeof window.VIZIO !== "undefined" &&
198
+ window?.applicaster?.vizioLibraryDidLoad;
199
+
200
+ return hasAPIs;
201
+ };
@@ -1,8 +0,0 @@
1
- export const FOCUSABLE_EVENTS = {
2
- IS_REGISTERED: "isRegistered",
3
- WILL_RECEIVE_FOCUS: "willReceiveFocus",
4
- HAS_RECEIVED_FOCUS: "hasReceivedFocus",
5
- WILL_LOSE_FOCUS: "willLoseFocus",
6
- HAS_LOST_FOCUS: "hasLostFocus",
7
- WILL_UNREGISTER: "willUnregister",
8
- };