@applicaster/zapp-react-native-utils 15.0.0-rc.98 → 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.
- package/actionsExecutor/ActionExecutorContext.tsx +51 -5
- package/actionsExecutor/feedDecorator.ts +6 -6
- package/adsUtils/index.ts +2 -2
- package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +2 -2
- package/analyticsUtils/PlayerAnalyticsManager.ts +11 -1
- package/analyticsUtils/README.md +1 -1
- package/analyticsUtils/__tests__/analyticsMapper.test.ts +35 -0
- package/analyticsUtils/__tests__/fixtures/analytics_mapper_testACP_events.json +1 -1
- package/analyticsUtils/__tests__/fixtures/analytics_mapper_testBlockUnlistedParams_rules.json +1 -1
- package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_events.json +4 -0
- package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_rules.json +6 -0
- package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEventRegex_events.json +3 -9
- package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_events.json +18 -0
- package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_rules.json +16 -0
- package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_events.json +4 -0
- package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_rules.json +6 -0
- package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_events.json +4 -0
- package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_rules.json +6 -0
- package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_events.json +4 -0
- package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_rules.json +6 -0
- package/analyticsUtils/__tests__/fixtures/index.js +20 -0
- package/analyticsUtils/analyticsMapper.ts +4 -1
- package/analyticsUtils/playerAnalyticsTracker.ts +26 -3
- package/appUtils/HooksManager/__tests__/__snapshots__/hooksManager.test.js.snap +188 -0
- package/appUtils/HooksManager/__tests__/hooksManager.test.js +2 -16
- package/appUtils/HooksManager/index.ts +47 -17
- package/appUtils/RiverFocusManager/{index.ts → index.js} +18 -25
- package/appUtils/accessibilityManager/const.ts +0 -4
- package/appUtils/accessibilityManager/utils.ts +1 -0
- package/appUtils/contextKeysManager/__tests__/getKeys/failure.test.ts +2 -7
- package/appUtils/contextKeysManager/__tests__/getKeys/success.test.ts +0 -48
- package/appUtils/contextKeysManager/contextResolver.ts +22 -51
- package/appUtils/contextKeysManager/index.ts +10 -65
- package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +0 -3
- package/appUtils/focusManager/index.ios.ts +4 -43
- package/appUtils/focusManagerAux/utils/index.ts +3 -5
- package/appUtils/focusManagerAux/utils/utils.ios.ts +3 -199
- package/appUtils/keyCodes/keys/keys.web.ts +4 -1
- package/appUtils/localizationsHelper.ts +4 -0
- package/appUtils/orientationHelper.ts +4 -2
- package/appUtils/platform/platformUtils.ts +1 -1
- package/appUtils/playerManager/__tests__/playerFactory.test.ts +150 -0
- package/appUtils/playerManager/index.ts +9 -0
- package/appUtils/playerManager/player.ts +1 -5
- package/appUtils/playerManager/playerFactory.ts +17 -34
- package/appUtils/playerManager/playerNative.ts +22 -30
- package/appUtils/playerManager/usePlayer.tsx +5 -3
- package/appUtils/playerManager/usePlayerState.tsx +2 -14
- package/cellUtils/__tests__/cellUtils.test.ts +39 -0
- package/cellUtils/index.ts +11 -1
- package/cloudEventsUtils/index.ts +1 -65
- package/configurationUtils/__tests__/manifestKeyParser.test.ts +26 -26
- package/dateUtils/__tests__/dayjs.test.ts +0 -3
- package/dateUtils/index.ts +2 -0
- package/focusManager/aux/index.ts +1 -1
- package/headersUtils/__tests__/headersUtils.test.js +1 -11
- package/headersUtils/index.ts +1 -2
- package/manifestUtils/defaultManifestConfigurations/player.js +7 -75
- package/manifestUtils/platformIsTV.js +13 -0
- package/manifestUtils/tvAction/container/index.js +1 -1
- package/numberUtils/__tests__/toNumber.test.ts +0 -12
- package/numberUtils/index.ts +1 -19
- package/package.json +4 -4
- package/playerUtils/index.ts +24 -2
- package/pluginUtils/index.ts +4 -9
- package/reactHooks/advertising/index.ts +2 -2
- package/reactHooks/app/__tests__/useAppState.test.ts +1 -1
- package/reactHooks/autoscrolling/__tests__/useTrackCurrentAutoScrollingElement.test.ts +1 -1
- package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +2 -1
- package/reactHooks/casting/index.ts +1 -0
- package/reactHooks/casting/useIsCasting.tsx +57 -0
- package/reactHooks/cell-click/__tests__/index.test.js +3 -1
- package/reactHooks/componentsMap/index.ts +55 -0
- package/reactHooks/configuration/__tests__/index.test.tsx +1 -1
- package/reactHooks/connection/__tests__/index.test.js +1 -1
- package/reactHooks/debugging/__tests__/index.test.js +4 -4
- package/reactHooks/device/useIsTablet.tsx +19 -14
- package/reactHooks/device/useMemoizedIsTablet.ts +3 -3
- package/reactHooks/events/index.ts +20 -0
- package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +23 -32
- package/reactHooks/feed/__tests__/useBuildPipesUrl.test.tsx +19 -19
- package/reactHooks/feed/__tests__/useEntryScreenId.test.tsx +1 -4
- package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +30 -42
- package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +1 -1
- package/reactHooks/feed/__tests__/useInflatedUrl.test.tsx +1 -1
- package/reactHooks/feed/useBatchLoading.ts +1 -7
- package/reactHooks/feed/useEntryScreenId.ts +2 -2
- package/reactHooks/feed/useInflatedUrl.ts +1 -1
- package/reactHooks/feed/usePipesCacheReset.ts +1 -3
- package/reactHooks/flatList/useLoadNextPageIfNeeded.ts +16 -13
- package/reactHooks/index.ts +2 -0
- package/reactHooks/layout/__tests__/index.test.tsx +1 -1
- package/reactHooks/layout/__tests__/useLayoutVersion.test.tsx +1 -1
- package/reactHooks/layout/useDimensions/__tests__/{useDimensions.test.tsx → useDimensions.test.ts} +25 -105
- package/reactHooks/layout/useDimensions/useDimensions.ts +2 -2
- package/reactHooks/navigation/__tests__/index.test.tsx +4 -2
- package/reactHooks/navigation/index.ts +6 -7
- package/reactHooks/navigation/useRoute.ts +6 -8
- package/reactHooks/player/TVSeekControlller/TVSeekController.ts +10 -27
- package/reactHooks/player/__tests__/useAutoSeek._test.tsx +1 -1
- package/reactHooks/player/__tests__/useTapSeek._test.ts +1 -1
- package/reactHooks/resolvers/__tests__/useCellResolver.test.tsx +1 -1
- package/reactHooks/resolvers/__tests__/useComponentResolver.test.tsx +1 -1
- package/reactHooks/resolvers/useCellResolver.ts +2 -6
- package/reactHooks/resolvers/useComponentResolver.ts +13 -9
- package/reactHooks/screen/__tests__/useCurrentScreenData.test.tsx +2 -2
- package/reactHooks/screen/__tests__/useCurrentScreenIsHook.test.ts +103 -0
- package/reactHooks/screen/__tests__/useCurrentScreenIsStartupHook.test.ts +94 -0
- package/reactHooks/screen/__tests__/useScreenBackgroundColor.test.tsx +1 -1
- package/reactHooks/screen/__tests__/useScreenData.test.tsx +1 -1
- package/reactHooks/screen/__tests__/useTargetScreenData.test.tsx +4 -12
- package/reactHooks/screen/index.ts +6 -0
- package/reactHooks/screen/useCurrentScreenIsHook.ts +9 -0
- package/reactHooks/screen/useCurrentScreenIsStartupHook.ts +8 -0
- package/reactHooks/screen/useIsStandaloneFullscreen.ts +12 -0
- package/reactHooks/screen/useTargetScreenData.ts +2 -4
- package/reactHooks/state/__tests__/useComponentScreenState.test.ts +246 -0
- package/reactHooks/state/index.ts +2 -0
- package/reactHooks/state/useComponentScreenState.ts +45 -0
- package/reactHooks/state/useRivers.ts +1 -1
- package/reactHooks/usePluginConfiguration.ts +2 -2
- package/reactHooks/utils/__tests__/index.test.js +1 -1
- package/reactHooks/videoModal/hooks/useVideoModalScreenData.tsx +22 -4
- package/rectUtils/index.ts +2 -2
- package/screenPickerUtils/index.ts +5 -0
- package/screenState/__tests__/index.test.ts +1 -1
- package/stringUtils/index.ts +1 -1
- package/testUtils/index.tsx +21 -30
- package/typeGuards/index.ts +0 -4
- package/utils/__tests__/clone.test.ts +158 -0
- package/utils/clone.ts +7 -0
- package/utils/index.ts +1 -13
- package/utils/path.ts +3 -6
- package/utils/pathOr.ts +1 -5
- package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +2 -2
- package/zappFrameworkUtils/HookCallback/hookCallbackManifestExtensions.config.js +1 -1
- package/zappFrameworkUtils/loginPluginUtils.ts +1 -1
- package/adsUtils/__tests__/createVMAP.test.ts +0 -419
- package/appDataUtils/__tests__/urlScheme.test.ts +0 -678
- package/appUtils/focusManagerAux/utils/index.ios.ts +0 -122
- package/cloudEventsUtils/__tests__/index.test.ts +0 -529
- package/enumUtils/__tests__/getEnumKeyByEnumValue.test.ts +0 -207
- package/errorUtils/__tests__/GeneralError.test.ts +0 -97
- package/errorUtils/__tests__/HttpStatusCode.test.ts +0 -344
- package/errorUtils/__tests__/MissingPluginError.test.ts +0 -113
- package/errorUtils/__tests__/NetworkError.test.ts +0 -202
- package/errorUtils/__tests__/getParsedResponse.test.ts +0 -188
- package/errorUtils/__tests__/invariant.test.ts +0 -112
- package/numberUtils/__tests__/toPositiveNumber.test.ts +0 -165
- package/reactHooks/analytics/__tests__/useSendAnalyticsOnPress.test.ts +0 -537
- package/reactHooks/dev/__tests__/useReRenderLog.test.ts +0 -188
- package/reactHooks/ui/__tests__/useFadeOutWhenBlurred.test.ts +0 -580
- package/rectUtils/__tests__/index.test.ts +0 -549
- package/screenPickerUtils/__tests__/index.test.ts +0 -333
- package/searchUtils/const.ts +0 -7
- package/searchUtils/index.ts +0 -3
- package/time/__tests__/BackgroundTimer.test.ts +0 -156
- package/time/__tests__/Timer.test.ts +0 -236
- package/typeGuards/__tests__/isString.test.ts +0 -21
- package/utils/__tests__/mergeRight.test.ts +0 -48
- package/utils/__tests__/selectors.test.ts +0 -124
- package/utils/mergeRight.ts +0 -5
- 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
151
|
+
expect(outStyles["default"]).toEqual({
|
|
152
152
|
backgroundColor: "#FF0000",
|
|
153
153
|
});
|
|
154
154
|
|
|
155
|
-
expect(outStyles
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
477
|
+
expect(outStyles["focused_selected"]).toEqual({
|
|
478
478
|
test: "focused_selected_value",
|
|
479
479
|
});
|
|
480
480
|
|
|
481
|
-
expect(outStyles
|
|
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
|
|
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
|
|
540
|
+
expect(outStyles["default"]).toEqual({
|
|
541
541
|
existingProp: "value",
|
|
542
542
|
backgroundColor: "#FF0000",
|
|
543
543
|
});
|
package/dateUtils/index.ts
CHANGED
|
@@ -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: [
|
|
@@ -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":
|
|
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);
|
package/headersUtils/index.ts
CHANGED
|
@@ -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":
|
|
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
|
|
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
|
|
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);
|
package/numberUtils/index.ts
CHANGED
|
@@ -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(
|
|
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.
|
|
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.
|
|
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": "*",
|
package/playerUtils/index.ts
CHANGED
|
@@ -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
|
|
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) &&
|
package/pluginUtils/index.ts
CHANGED
|
@@ -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 =
|
|
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
|
|
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 {
|
|
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 =
|
|
19
|
+
const { plugins } = usePickFromState();
|
|
20
20
|
|
|
21
21
|
return useEffect(() => {
|
|
22
22
|
// TODD: typing problem: fix any type
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import { renderHook
|
|
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";
|