@applicaster/zapp-react-native-utils 12.0.0-alpha.7855034103 → 12.0.0-alpha.8024419438

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 (40) hide show
  1. package/analyticsUtils/AnalyticsEvents/index.ts +7 -0
  2. package/analyticsUtils/AnalyticsEvents/sendShareEvent.ts +21 -0
  3. package/analyticsUtils/events.ts +6 -0
  4. package/analyticsUtils/index.tsx +6 -0
  5. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +2 -3
  6. package/appUtils/focusManager/__tests__/focusManager.test.js +4 -24
  7. package/appUtils/focusManager/__tests__/index.test.ts +2 -3
  8. package/appUtils/focusManager/index.ts +76 -56
  9. package/appUtils/focusManager/treeDataStructure/Utils/index.js +74 -43
  10. package/appUtils/focusManager/utils/index.ts +100 -0
  11. package/appUtils/focusManagerAux/index.ts +76 -0
  12. package/appUtils/focusManagerAux/utils/index.ts +100 -0
  13. package/appUtils/keyCodes/keys.web.js +8 -0
  14. package/appUtils/keyCodes/keysByPlatform.js +11 -1
  15. package/appUtils/platform/const.ts +25 -0
  16. package/appUtils/platform/index.ts +3 -0
  17. package/appUtils/platform/platformUtils.ts +223 -0
  18. package/appUtils/playerManager/index.ts +10 -5
  19. package/appUtils/playerManager/nativePlayerManager.ts +12 -0
  20. package/appUtils/playerManager/player.ts +0 -3
  21. package/appUtils/playerManager/playerNative.ts +5 -15
  22. package/arrayUtils/__tests__/isFilledArray.test.ts +63 -0
  23. package/arrayUtils/index.ts +5 -0
  24. package/booleanUtils/index.ts +4 -4
  25. package/keyboardState/index.ts +0 -0
  26. package/numberUtils/__tests__/isLikeNumber.test.ts +18 -0
  27. package/numberUtils/index.ts +5 -18
  28. package/package.json +2 -2
  29. package/reactHooks/cell-click/__tests__/index.test.js +9 -5
  30. package/reactHooks/cell-click/index.ts +11 -11
  31. package/reactHooks/feed/__tests__/useBuildPipesUrl.test.tsx +30 -70
  32. package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +6 -2
  33. package/reactHooks/feed/useBuildPipesUrl.ts +7 -10
  34. package/reactHooks/feed/useFeedRefresh.tsx +9 -7
  35. package/reactHooks/navigation/index.ts +40 -7
  36. package/reactHooks/screen/__tests__/useCurrentScreenData.test.tsx +21 -23
  37. package/reactHooks/screen/index.ts +2 -0
  38. package/reactHooks/screen/useScreenBackgroundColor.ts +23 -0
  39. package/reactHooks/screen/useScreenContext.ts +1 -2
  40. package/reactUtils/index.ts +102 -0
@@ -108,3 +108,105 @@ 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
+ declare global {
113
+ interface Window {
114
+ VIZIO?: {
115
+ exitApplication: () => void;
116
+ setClosedCaptionHandler: (
117
+ callback: (isCCEnabled: boolean) => void
118
+ ) => void;
119
+ };
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Platforms found in userAgent string, please note that simulators
125
+ * might not have the same agents that the devices have
126
+ */
127
+ export const PLATFORMS = {
128
+ webos: "Web0S",
129
+ tizen: "Tizen",
130
+ samsung: "SMART-TV",
131
+ mac: "Mac",
132
+ win: "Win",
133
+ linux: "Linux",
134
+ iphone: "iPhone",
135
+ android: "Android",
136
+ mobile: "Mobile",
137
+ vizio: "VIZIO",
138
+ smartcast: "SmartCast",
139
+ conjure: "Conjure",
140
+ };
141
+
142
+ /**
143
+ * Simple way of identifying if we have access to the tizen APIs
144
+ */
145
+ export const hasTizen = typeof window?.tizen !== "undefined";
146
+
147
+ /**
148
+ * Simple way of identifying if we have access to the webOS APIs
149
+ */
150
+ export const hasWebOS = typeof window?.webOS !== "undefined";
151
+
152
+ export const getUserAgent = () =>
153
+ window?.navigator?.userAgent || global?.navigator?.userAgent;
154
+
155
+ export const isLgPlatform = () => {
156
+ const userAgent = getUserAgent();
157
+
158
+ if (!userAgent) {
159
+ return false;
160
+ }
161
+
162
+ // Note: LG uses the number 0 in their userAgent, possibly because of Palm WebOS
163
+ return hasWebOS || userAgent.includes(PLATFORMS.webos);
164
+ };
165
+
166
+ export const isSamsungPlatform = () => {
167
+ const userAgent = getUserAgent();
168
+
169
+ if (!userAgent) {
170
+ return false;
171
+ }
172
+
173
+ return (
174
+ hasTizen ||
175
+ userAgent.includes(PLATFORMS.samsung) ||
176
+ userAgent.includes(PLATFORMS.tizen)
177
+ );
178
+ };
179
+
180
+ /**
181
+ * Checks if we are on the Vizio platform by using the userAgent string
182
+ *
183
+ * Use this method when you need to identify the platform on runtime
184
+ * before the VIZIO Companion Library has loaded
185
+ */
186
+ export const isVizioPlatform = () => {
187
+ const userAgent = getUserAgent();
188
+
189
+ if (!userAgent) {
190
+ return false;
191
+ }
192
+
193
+ const isVizioAgent =
194
+ userAgent.includes(PLATFORMS.vizio) ||
195
+ userAgent.includes(PLATFORMS.smartcast) ||
196
+ userAgent.includes(PLATFORMS.conjure);
197
+
198
+ return isVizioAgent;
199
+ };
200
+
201
+ /**
202
+ * Checks if we are on the Vizio platform by checking for the global VIZIO object
203
+ * and the VIZIO Companion Library. This method does not use the userAgent string,
204
+ * because it mainly checks whether we have access to apis, which may not be available yet
205
+ */
206
+ export const hasVizioAPIs = () => {
207
+ const hasAPIs =
208
+ typeof window.VIZIO !== "undefined" &&
209
+ window?.applicaster?.vizioLibraryDidLoad;
210
+
211
+ return hasAPIs;
212
+ };