@applicaster/zapp-react-native-utils 16.0.0-rc.6 → 16.0.0-rc.60

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 (161) hide show
  1. package/actionsExecutor/ActionExecutor.ts +47 -11
  2. package/actionsExecutor/ActionExecutorContext.tsx +87 -316
  3. package/actionsExecutor/actions/__tests__/dismissBottomSheet.test.ts +22 -0
  4. package/actionsExecutor/actions/__tests__/loadItemsFromSource.test.ts +88 -0
  5. package/actionsExecutor/actions/__tests__/openBottomSheet.customContent.test.ts +76 -0
  6. package/actionsExecutor/actions/__tests__/openBottomSheet.inlineItems.test.ts +130 -0
  7. package/actionsExecutor/actions/__tests__/showToast.test.ts +88 -0
  8. package/actionsExecutor/actions/appRestart.ts +24 -0
  9. package/actionsExecutor/actions/confirmDialog.ts +53 -0
  10. package/actionsExecutor/actions/dismissBottomSheet.ts +22 -0
  11. package/actionsExecutor/actions/index.ts +34 -0
  12. package/actionsExecutor/actions/localStorageRemove.ts +27 -0
  13. package/actionsExecutor/actions/localStorageSet.ts +28 -0
  14. package/actionsExecutor/actions/localStorageToggleFlag.ts +28 -0
  15. package/actionsExecutor/actions/navigateToScreen.ts +123 -0
  16. package/actionsExecutor/actions/openBottomSheet.ts +322 -0
  17. package/actionsExecutor/actions/refreshComponent.ts +85 -0
  18. package/actionsExecutor/actions/screenSetVariable.ts +35 -0
  19. package/actionsExecutor/actions/screenToggleFlag.ts +38 -0
  20. package/actionsExecutor/actions/sendCloudEvent.ts +93 -0
  21. package/actionsExecutor/actions/sessionStorageRemove.ts +19 -0
  22. package/actionsExecutor/actions/sessionStorageSet.ts +20 -0
  23. package/actionsExecutor/actions/sessionStorageToggleFlag.ts +15 -0
  24. package/actionsExecutor/actions/showToast.ts +87 -0
  25. package/actionsExecutor/actions/switchLayout.ts +40 -0
  26. package/actionsExecutor/consts.ts +23 -0
  27. package/actionsExecutor/types.ts +59 -0
  28. package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +2 -2
  29. package/analyticsUtils/PlayerAnalyticsManager.ts +12 -2
  30. package/analyticsUtils/__tests__/analyticsMapper.test.ts +35 -0
  31. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testACP_events.json +1 -1
  32. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testBlockUnlistedParams_rules.json +1 -1
  33. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_events.json +4 -0
  34. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_rules.json +6 -0
  35. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEventRegex_events.json +3 -9
  36. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_events.json +18 -0
  37. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_rules.json +16 -0
  38. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_events.json +4 -0
  39. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_rules.json +6 -0
  40. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_events.json +4 -0
  41. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_rules.json +6 -0
  42. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_events.json +4 -0
  43. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_rules.json +6 -0
  44. package/analyticsUtils/__tests__/fixtures/index.js +20 -0
  45. package/analyticsUtils/analyticsMapper.ts +4 -1
  46. package/analyticsUtils/playerAnalyticsTracker.ts +26 -3
  47. package/appUtils/HooksManager/index.ts +12 -8
  48. package/appUtils/contextKeysManager/__tests__/getKey/failure.test.ts +1 -1
  49. package/appUtils/contextKeysManager/__tests__/removeKey/failure.test.ts +1 -1
  50. package/appUtils/contextKeysManager/__tests__/setKey/failure/invalidKey.test.ts +4 -4
  51. package/appUtils/contextKeysManager/index.ts +1 -1
  52. package/appUtils/contextKeysManager/utils/index.ts +38 -25
  53. package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +143 -53
  54. package/appUtils/playerManager/OverlayObserver/__tests__/liveContent.test.ts +205 -0
  55. package/appUtils/playerManager/OverlayObserver/__tests__/utils.test.ts +49 -0
  56. package/appUtils/playerManager/OverlayObserver/utils.ts +49 -20
  57. package/appUtils/playerManager/__tests__/playerContent.test.ts +403 -0
  58. package/appUtils/playerManager/__tests__/playerFactory.test.ts +150 -0
  59. package/appUtils/playerManager/__tests__/usePlayerContent.test.tsx +64 -0
  60. package/appUtils/playerManager/{conts.ts → const.ts} +20 -0
  61. package/appUtils/playerManager/index.ts +1 -1
  62. package/appUtils/playerManager/player.ts +115 -3
  63. package/appUtils/playerManager/playerFactory.ts +18 -35
  64. package/appUtils/playerManager/playerNative.ts +1 -1
  65. package/appUtils/playerManager/usePlayerContent.tsx +43 -0
  66. package/appUtils/playerManager/usePlayerControllerSetup.tsx +1 -1
  67. package/appUtils/playerManager/userLanguagePreference.ts +1 -1
  68. package/arrayUtils/__tests__/{anyThruthy.test.ts → anyTruthy.test.ts} +8 -0
  69. package/arrayUtils/__tests__/arrayUtils.test.ts +165 -108
  70. package/arrayUtils/__tests__/isEmptyArray.test.ts +11 -0
  71. package/arrayUtils/__tests__/isFilledArray.test.ts +12 -0
  72. package/arrayUtils/__tests__/isFirst.test.ts +17 -0
  73. package/arrayUtils/__tests__/isIndexInRange.test.ts +14 -0
  74. package/arrayUtils/__tests__/isLast.test.ts +31 -0
  75. package/arrayUtils/__tests__/makeListOf.test.ts +31 -0
  76. package/arrayUtils/__tests__/makeListOfIndexes.test.ts +20 -0
  77. package/arrayUtils/__tests__/reorderByIds.test.ts +50 -0
  78. package/arrayUtils/__tests__/sample.test.ts +61 -0
  79. package/arrayUtils/index.ts +136 -20
  80. package/bottomSheet/__tests__/scrollContext.test.tsx +35 -0
  81. package/bottomSheet/index.ts +17 -0
  82. package/cellUtils/index.ts +3 -5
  83. package/colorUtils/__tests__/isTransparentColor.test.ts +76 -0
  84. package/colorUtils/__tests__/isValidColor.test.ts +70 -0
  85. package/colorUtils/index.ts +50 -0
  86. package/configurationUtils/__tests__/modalBlocksParser.test.ts +107 -0
  87. package/configurationUtils/manifestKeyParser.ts +38 -9
  88. package/configurationUtils/modalBlocksParser.ts +178 -0
  89. package/manifestUtils/__tests__/player.audioControls.test.js +158 -0
  90. package/manifestUtils/_internals/index.js +6 -0
  91. package/manifestUtils/defaultManifestConfigurations/generalContent.js +35 -0
  92. package/manifestUtils/defaultManifestConfigurations/player.js +327 -19
  93. package/manifestUtils/fieldUtils/__tests__/fieldUtils.test.js +84 -0
  94. package/manifestUtils/fieldUtils/index.js +125 -0
  95. package/manifestUtils/index.js +3 -0
  96. package/manifestUtils/keys.js +9 -0
  97. package/manifestUtils/mobileAction/button/index.js +16 -0
  98. package/manifestUtils/mobileAction/container/index.js +3 -1
  99. package/manifestUtils/mobileAction/groups/defaults.js +3 -1
  100. package/manifestUtils/modalBlocks.js +304 -0
  101. package/manifestUtils/platformIsTV.js +1 -0
  102. package/modalState/ContentViewModel.ts +113 -0
  103. package/modalState/EditableCollection.ts +17 -0
  104. package/modalState/EditableCollectionRegistry.ts +51 -0
  105. package/modalState/ModalOrchestrator.ts +201 -0
  106. package/modalState/RemoteEditableCollection.ts +227 -0
  107. package/modalState/__tests__/ContentViewModel.editable.test.ts +69 -0
  108. package/modalState/__tests__/ContentViewModel.test.ts +165 -0
  109. package/modalState/__tests__/EditableCollectionRegistry.test.ts +112 -0
  110. package/modalState/__tests__/ModalOrchestrator.phase3.test.ts +55 -0
  111. package/modalState/__tests__/RemoteEditableCollection.test.ts +326 -0
  112. package/modalState/__tests__/useBottomSheetContent.test.ts +349 -0
  113. package/modalState/index.ts +30 -83
  114. package/modalState/store.ts +102 -0
  115. package/modalState/types.ts +137 -0
  116. package/modalState/useBottomSheetContent.ts +102 -0
  117. package/numberUtils/__tests__/isMinusZero.test.ts +20 -0
  118. package/numberUtils/__tests__/isZero.test.ts +27 -0
  119. package/numberUtils/__tests__/requireNumber.test.ts +50 -0
  120. package/numberUtils/__tests__/toNumber.test.ts +27 -0
  121. package/numberUtils/__tests__/toNumberWithDefault.test.ts +64 -0
  122. package/numberUtils/__tests__/toNumberWithDefaultZero.test.ts +48 -0
  123. package/numberUtils/index.ts +27 -8
  124. package/package.json +2 -2
  125. package/pipesUtils/__tests__/buildUrlWithQuery.test.ts +33 -0
  126. package/pipesUtils/__tests__/withPipesEndpoint.test.tsx +56 -0
  127. package/pipesUtils/index.ts +1 -0
  128. package/pipesUtils/withPipesEndpoint.tsx +54 -0
  129. package/playerUtils/__tests__/contentDataKeys.test.ts +297 -0
  130. package/playerUtils/__tests__/resolvePlayerTitleSubtitle.test.ts +180 -0
  131. package/playerUtils/contentDataKeys.ts +134 -0
  132. package/playerUtils/index.ts +41 -14
  133. package/playerUtils/isAudioItem.ts +26 -0
  134. package/playerUtils/resolvePlayerTitleSubtitle.ts +76 -0
  135. package/reactHooks/actions/index.ts +51 -1
  136. package/reactHooks/cell-click/index.ts +18 -10
  137. package/reactHooks/feed/__mocks__/useMarkPipesDataStale.ts +4 -0
  138. package/reactHooks/feed/__tests__/useInflatedUrl.test.tsx +25 -0
  139. package/reactHooks/feed/index.ts +5 -1
  140. package/reactHooks/feed/useBatchLoading.ts +9 -1
  141. package/reactHooks/feed/{usePipesCacheReset.ts → useMarkPipesDataStale.ts} +12 -4
  142. package/reactHooks/index.ts +2 -0
  143. package/reactHooks/layout/index.ts +1 -1
  144. package/reactHooks/navigation/__mocks__/index.ts +4 -0
  145. package/reactHooks/navigation/__tests__/useIsScreenActive.test.ts +42 -0
  146. package/reactHooks/navigation/index.ts +1 -1
  147. package/reactHooks/navigation/useIsScreenActive.ts +29 -8
  148. package/reactHooks/state/useComponentScreenState.ts +1 -1
  149. package/reactHooks/usePluginConfiguration.ts +4 -1
  150. package/reactHooks/utils/__tests__/index.test.js +22 -2
  151. package/reactHooks/utils/index.ts +13 -2
  152. package/reactHooks/videoModal/hooks/useVideoModalScreenData.tsx +22 -4
  153. package/riverComponetsMeasurementProvider/index.tsx +12 -8
  154. package/stringUtils/__tests__/stringUtils.test.js +42 -0
  155. package/stringUtils/index.ts +2 -2
  156. package/uiActionsRegistrator/index.ts +203 -0
  157. package/zappFrameworkUtils/__tests__/localStorageHelper.test.ts +146 -0
  158. package/zappFrameworkUtils/localStorageHelper.ts +19 -15
  159. package/appUtils/playerManager/usePlayerTitleSummaryOverlay.tsx +0 -56
  160. package/reactHooks/feed/__mocks__/usePipesCacheReset.ts +0 -1
  161. /package/reactHooks/actions/__tests__/{index.test.js → index.test.tsx} +0 -0
@@ -383,7 +383,45 @@ function getPlayerConfiguration({ platform, version }) {
383
383
  initial_value: "Start Over",
384
384
  type: "text_input",
385
385
  });
386
+ }
387
+
388
+ if (isMobile(platform)) {
389
+ // Screen reader strings for the audio player's playlist controls. Mobile
390
+ // only, because the audio player layout itself is mobile only.
391
+ localizations.fields.push({
392
+ key: "accessibility_previous_track_label",
393
+ label: "Accessibility previous track label",
394
+ initial_value: "Previous track button",
395
+ label_tooltip: "Label for previous track button accessibility",
396
+ type: "text_input",
397
+ });
398
+
399
+ localizations.fields.push({
400
+ key: "accessibility_previous_track_hint",
401
+ label: "Accessibility previous track hint",
402
+ initial_value: "Press to play the previous track",
403
+ label_tooltip: "Hint for previous track button accessibility",
404
+ type: "text_input",
405
+ });
406
+
407
+ localizations.fields.push({
408
+ key: "accessibility_next_track_label",
409
+ label: "Accessibility next track label",
410
+ initial_value: "Next track button",
411
+ label_tooltip: "Label for next track button accessibility",
412
+ type: "text_input",
413
+ });
386
414
 
415
+ localizations.fields.push({
416
+ key: "accessibility_next_track_hint",
417
+ label: "Accessibility next track hint",
418
+ initial_value: "Press to play the next track",
419
+ label_tooltip: "Hint for next track button accessibility",
420
+ type: "text_input",
421
+ });
422
+ }
423
+
424
+ if (isTV(platform)) {
387
425
  styles.fields.push(
388
426
  fieldsGroup("Always Show Scrub Bar & Timestamp", "", [
389
427
  {
@@ -781,21 +819,6 @@ function getPlayerConfiguration({ platform, version }) {
781
819
  }
782
820
  );
783
821
 
784
- if (
785
- platform.includes("android") ||
786
- platform.includes("amazon") ||
787
- platform.includes("ios") ||
788
- platform.includes("tvos")
789
- ) {
790
- general.fields.push({
791
- key: "user_agent",
792
- label: "User agent",
793
- initial_value: "",
794
- type: "text_input",
795
- label_tooltip: "Override default user agent string",
796
- });
797
- }
798
-
799
822
  if (platform === "android_for_quickbrick") {
800
823
  general.fields.push({
801
824
  key: "stop_playback_on_task_removal",
@@ -1236,6 +1259,13 @@ function getPlayerConfiguration({ platform, version }) {
1236
1259
  type: "uploader",
1237
1260
  label_tooltip: "Playback Speed 0.8x",
1238
1261
  initial_value: null,
1262
+ rules: "conditional",
1263
+ conditional_fields: [
1264
+ {
1265
+ key: "styles/player_controls_layout",
1266
+ condition_value: "playback_speed_and_sleep_timer",
1267
+ },
1268
+ ],
1239
1269
  },
1240
1270
  {
1241
1271
  key: "speed_1",
@@ -1243,6 +1273,13 @@ function getPlayerConfiguration({ platform, version }) {
1243
1273
  type: "uploader",
1244
1274
  label_tooltip: "Playback Speed 1x",
1245
1275
  initial_value: null,
1276
+ rules: "conditional",
1277
+ conditional_fields: [
1278
+ {
1279
+ key: "styles/player_controls_layout",
1280
+ condition_value: "playback_speed_and_sleep_timer",
1281
+ },
1282
+ ],
1246
1283
  },
1247
1284
  {
1248
1285
  key: "speed_1_2",
@@ -1250,6 +1287,13 @@ function getPlayerConfiguration({ platform, version }) {
1250
1287
  type: "uploader",
1251
1288
  label_tooltip: "Playback Speed 1.2x",
1252
1289
  initial_value: null,
1290
+ rules: "conditional",
1291
+ conditional_fields: [
1292
+ {
1293
+ key: "styles/player_controls_layout",
1294
+ condition_value: "playback_speed_and_sleep_timer",
1295
+ },
1296
+ ],
1253
1297
  },
1254
1298
  {
1255
1299
  key: "speed_1_5",
@@ -1257,6 +1301,13 @@ function getPlayerConfiguration({ platform, version }) {
1257
1301
  type: "uploader",
1258
1302
  label_tooltip: "Playback Speed 1.5x",
1259
1303
  initial_value: null,
1304
+ rules: "conditional",
1305
+ conditional_fields: [
1306
+ {
1307
+ key: "styles/player_controls_layout",
1308
+ condition_value: "playback_speed_and_sleep_timer",
1309
+ },
1310
+ ],
1260
1311
  },
1261
1312
  {
1262
1313
  key: "speed_2",
@@ -1264,6 +1315,13 @@ function getPlayerConfiguration({ platform, version }) {
1264
1315
  type: "uploader",
1265
1316
  label_tooltip: "Playback Speed 2x",
1266
1317
  initial_value: null,
1318
+ rules: "conditional",
1319
+ conditional_fields: [
1320
+ {
1321
+ key: "styles/player_controls_layout",
1322
+ condition_value: "playback_speed_and_sleep_timer",
1323
+ },
1324
+ ],
1267
1325
  },
1268
1326
  {
1269
1327
  key: "sleep_timer",
@@ -1271,6 +1329,13 @@ function getPlayerConfiguration({ platform, version }) {
1271
1329
  type: "uploader",
1272
1330
  label_tooltip: "Sleep Timer Default",
1273
1331
  initial_value: null,
1332
+ rules: "conditional",
1333
+ conditional_fields: [
1334
+ {
1335
+ key: "styles/player_controls_layout",
1336
+ condition_value: "playback_speed_and_sleep_timer",
1337
+ },
1338
+ ],
1274
1339
  },
1275
1340
  {
1276
1341
  key: "sleep_timer_active",
@@ -1278,6 +1343,43 @@ function getPlayerConfiguration({ platform, version }) {
1278
1343
  type: "uploader",
1279
1344
  label_tooltip: "Sleep Timer Active",
1280
1345
  initial_value: null,
1346
+ rules: "conditional",
1347
+ conditional_fields: [
1348
+ {
1349
+ key: "styles/player_controls_layout",
1350
+ condition_value: "playback_speed_and_sleep_timer",
1351
+ },
1352
+ ],
1353
+ },
1354
+ {
1355
+ key: "previous_track",
1356
+ label: "Previous Track Control Icon",
1357
+ type: "uploader",
1358
+ label_tooltip:
1359
+ "Override the default Previous Track icon. Recommended size 120x120px (@3x).",
1360
+ initial_value: null,
1361
+ rules: "conditional",
1362
+ conditional_fields: [
1363
+ {
1364
+ key: "styles/player_controls_layout",
1365
+ condition_value: "playlist_controls",
1366
+ },
1367
+ ],
1368
+ },
1369
+ {
1370
+ key: "next_track",
1371
+ label: "Next Track Control Icon",
1372
+ type: "uploader",
1373
+ label_tooltip:
1374
+ "Override the default Next Track icon. Recommended size 120x120px (@3x).",
1375
+ initial_value: null,
1376
+ rules: "conditional",
1377
+ conditional_fields: [
1378
+ {
1379
+ key: "styles/player_controls_layout",
1380
+ condition_value: "playlist_controls",
1381
+ },
1382
+ ],
1281
1383
  },
1282
1384
  ]
1283
1385
  ),
@@ -1294,6 +1396,35 @@ function getPlayerConfiguration({ platform, version }) {
1294
1396
  type: "switch",
1295
1397
  label_tooltip: "Select whether you want to display title in player",
1296
1398
  },
1399
+ {
1400
+ section: "title",
1401
+ key: "title_data_key_source",
1402
+ label: "Title data key",
1403
+ initial_value: "title",
1404
+ type: "select",
1405
+ options: [
1406
+ { text: "Title", value: "title" },
1407
+ { text: "Other", value: "other" },
1408
+ ],
1409
+ label_tooltip:
1410
+ "Select which feed data key provides the player content title. Keep 'Title' to use the entry title",
1411
+ },
1412
+ {
1413
+ section: "title",
1414
+ key: "title_custom_data_key",
1415
+ label: "Custom title data key",
1416
+ initial_value: "",
1417
+ type: "text_input",
1418
+ rules: "conditional",
1419
+ conditional_fields: [
1420
+ {
1421
+ key: "styles/title_data_key_source",
1422
+ condition_value: "other",
1423
+ },
1424
+ ],
1425
+ label_tooltip:
1426
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_name. Falls back to the entry title if the key is empty or missing",
1427
+ },
1297
1428
  {
1298
1429
  section: "title",
1299
1430
  key: "title_font_android",
@@ -1701,6 +1832,35 @@ function getPlayerConfiguration({ platform, version }) {
1701
1832
  label_tooltip:
1702
1833
  "Select whether you want to display subtitle in player",
1703
1834
  },
1835
+ {
1836
+ section: "subtitle",
1837
+ key: "subtitle_data_key_source",
1838
+ label: "Subtitle data key",
1839
+ initial_value: "summary",
1840
+ type: "select",
1841
+ options: [
1842
+ { text: "Subtitle", value: "summary" },
1843
+ { text: "Other", value: "other" },
1844
+ ],
1845
+ label_tooltip:
1846
+ "Select which feed data key provides the player content subtitle. Keep 'Subtitle' to use the entry summary",
1847
+ },
1848
+ {
1849
+ section: "subtitle",
1850
+ key: "subtitle_custom_data_key",
1851
+ label: "Custom subtitle data key",
1852
+ initial_value: "",
1853
+ type: "text_input",
1854
+ rules: "conditional",
1855
+ conditional_fields: [
1856
+ {
1857
+ key: "styles/subtitle_data_key_source",
1858
+ condition_value: "other",
1859
+ },
1860
+ ],
1861
+ label_tooltip:
1862
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_subtitle. Falls back to the entry summary if the key is empty or missing",
1863
+ },
1704
1864
  {
1705
1865
  section: "subtitle",
1706
1866
  key: "subtitle_font_android",
@@ -2415,6 +2575,21 @@ function getPlayerConfiguration({ platform, version }) {
2415
2575
  );
2416
2576
  }
2417
2577
 
2578
+ if (
2579
+ platform.includes("android") ||
2580
+ platform.includes("amazon") ||
2581
+ platform.includes("ios") ||
2582
+ platform.includes("tvos")
2583
+ ) {
2584
+ general.fields.push({
2585
+ key: "user_agent",
2586
+ label: "User agent",
2587
+ initial_value: "",
2588
+ type: "text_input",
2589
+ label_tooltip: "Override default user agent string",
2590
+ });
2591
+ }
2592
+
2418
2593
  compact([
2419
2594
  {
2420
2595
  key: "liveCatchUpEnabled",
@@ -2850,6 +3025,33 @@ function getPlayerConfiguration({ platform, version }) {
2850
3025
  "Video Player - Title Text",
2851
3026
  "Video Player Title Text Label Styles",
2852
3027
  [
3028
+ {
3029
+ key: "video_player_title_data_key_source",
3030
+ label: "Video title data key",
3031
+ initial_value: "title",
3032
+ type: "select",
3033
+ options: [
3034
+ { text: "Title", value: "title" },
3035
+ { text: "Other", value: "other" },
3036
+ ],
3037
+ label_tooltip:
3038
+ "Select which feed data key provides the video player title. Keep 'Title' to use the entry title",
3039
+ },
3040
+ {
3041
+ key: "video_player_title_custom_data_key",
3042
+ label: "Custom video title data key",
3043
+ initial_value: "",
3044
+ type: "text_input",
3045
+ rules: "conditional",
3046
+ conditional_fields: [
3047
+ {
3048
+ key: "styles/video_player_title_data_key_source",
3049
+ condition_value: "other",
3050
+ },
3051
+ ],
3052
+ label_tooltip:
3053
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_name. Falls back to the entry title if the key is empty or missing",
3054
+ },
2853
3055
  {
2854
3056
  key: "player_title_color",
2855
3057
  label: "Font color",
@@ -2935,6 +3137,33 @@ function getPlayerConfiguration({ platform, version }) {
2935
3137
  "Video Player - Summary Text",
2936
3138
  "Video Player Summary Text Label Styles",
2937
3139
  [
3140
+ {
3141
+ key: "video_player_summary_data_key_source",
3142
+ label: "Video summary data key",
3143
+ initial_value: "summary",
3144
+ type: "select",
3145
+ options: [
3146
+ { text: "Summary", value: "summary" },
3147
+ { text: "Other", value: "other" },
3148
+ ],
3149
+ label_tooltip:
3150
+ "Select which feed data key provides the video player summary. Keep 'Summary' to use the entry summary",
3151
+ },
3152
+ {
3153
+ key: "video_player_summary_custom_data_key",
3154
+ label: "Custom video summary data key",
3155
+ initial_value: "",
3156
+ type: "text_input",
3157
+ rules: "conditional",
3158
+ conditional_fields: [
3159
+ {
3160
+ key: "styles/video_player_summary_data_key_source",
3161
+ condition_value: "other",
3162
+ },
3163
+ ],
3164
+ label_tooltip:
3165
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_subtitle. Falls back to the entry summary if the key is empty or missing",
3166
+ },
2938
3167
  {
2939
3168
  key: "player_summary_color",
2940
3169
  label: "Font color",
@@ -3020,6 +3249,33 @@ function getPlayerConfiguration({ platform, version }) {
3020
3249
  "Audio Player - Title Text",
3021
3250
  "Audio Player Title Text Label Styles",
3022
3251
  [
3252
+ {
3253
+ key: "audio_player_title_data_key_source",
3254
+ label: "Audio title data key",
3255
+ initial_value: "title",
3256
+ type: "select",
3257
+ options: [
3258
+ { text: "Title", value: "title" },
3259
+ { text: "Other", value: "other" },
3260
+ ],
3261
+ label_tooltip:
3262
+ "Select which feed data key provides the audio player title. Keep 'Title' to use the entry title",
3263
+ },
3264
+ {
3265
+ key: "audio_player_title_custom_data_key",
3266
+ label: "Custom audio title data key",
3267
+ initial_value: "",
3268
+ type: "text_input",
3269
+ rules: "conditional",
3270
+ conditional_fields: [
3271
+ {
3272
+ key: "styles/audio_player_title_data_key_source",
3273
+ condition_value: "other",
3274
+ },
3275
+ ],
3276
+ label_tooltip:
3277
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_name. Falls back to the entry title if the key is empty or missing",
3278
+ },
3023
3279
  {
3024
3280
  key: "audio_player_title_color",
3025
3281
  label: "Audio player title color",
@@ -3105,6 +3361,33 @@ function getPlayerConfiguration({ platform, version }) {
3105
3361
  "Audio Player - Summary Text",
3106
3362
  "Audio Player Summary Text Label Styles",
3107
3363
  [
3364
+ {
3365
+ key: "audio_player_summary_data_key_source",
3366
+ label: "Audio summary data key",
3367
+ initial_value: "summary",
3368
+ type: "select",
3369
+ options: [
3370
+ { text: "Summary", value: "summary" },
3371
+ { text: "Other", value: "other" },
3372
+ ],
3373
+ label_tooltip:
3374
+ "Select which feed data key provides the audio player summary. Keep 'Summary' to use the entry summary",
3375
+ },
3376
+ {
3377
+ key: "audio_player_summary_custom_data_key",
3378
+ label: "Custom audio summary data key",
3379
+ initial_value: "",
3380
+ type: "text_input",
3381
+ rules: "conditional",
3382
+ conditional_fields: [
3383
+ {
3384
+ key: "styles/audio_player_summary_data_key_source",
3385
+ condition_value: "other",
3386
+ },
3387
+ ],
3388
+ label_tooltip:
3389
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_subtitle. Falls back to the entry summary if the key is empty or missing",
3390
+ },
3108
3391
  {
3109
3392
  key: "audio_player_summary_color",
3110
3393
  label: "Audio player summary color",
@@ -3451,6 +3734,31 @@ function getPlayerConfiguration({ platform, version }) {
3451
3734
  },
3452
3735
  ],
3453
3736
  },
3737
+ {
3738
+ key: "player_controls_layout",
3739
+ label: "Player Controls Layout",
3740
+ type: "select",
3741
+ initial_value: "playback_speed_and_sleep_timer",
3742
+ label_tooltip:
3743
+ "Choose which secondary controls appear in the audio player transport row.",
3744
+ rules: "conditional",
3745
+ conditional_fields: [
3746
+ {
3747
+ key: "styles/full_screen_audio_player",
3748
+ condition_value: true,
3749
+ },
3750
+ ],
3751
+ options: [
3752
+ {
3753
+ text: "Playback Speed & Sleep Timer (Default)",
3754
+ value: "playback_speed_and_sleep_timer",
3755
+ },
3756
+ {
3757
+ text: "Playlist Controls (Previous & Next)",
3758
+ value: "playlist_controls",
3759
+ },
3760
+ ],
3761
+ },
3454
3762
  {
3455
3763
  key: "audio_player_artwork_shadow_enabled",
3456
3764
  label: "Image Shadow Enabled",
@@ -3522,13 +3830,13 @@ function getPlayerConfiguration({ platform, version }) {
3522
3830
  label: "Advanced Player Styles",
3523
3831
  type: "text_input",
3524
3832
  multiline: true,
3525
- initial_value: `.vjs-text-track-cue {
3526
- inset: unset !important;
3527
- top: 94% !important;
3833
+ initial_value: `.vjs-text-track-cue {
3834
+ top: auto !important;
3528
3835
  bottom: 0 !important;
3529
3836
  left: 0 !important;
3530
- right: 0 !important;
3837
+ right: auto !important;
3531
3838
  width: 100% !important;
3839
+ height: auto !important;
3532
3840
  }`,
3533
3841
  label_tooltip:
3534
3842
  "This field allows you to inject custom CSS styles to override default player styles. The styles will be injected into the document head and can be used to customize the appearance of the player. Leave empty to use only default styles.",
@@ -1,9 +1,93 @@
1
1
  const {
2
+ parseShorthand,
3
+ margin,
4
+ padding,
2
5
  withConditional,
3
6
  getConditionalKey,
4
7
  createConditionalField,
5
8
  } = require("..");
6
9
 
10
+ describe("parseShorthand", () => {
11
+ it("1 value → all four sides equal", () => {
12
+ expect(parseShorthand("8")).toEqual([8, 8, 8, 8]);
13
+ });
14
+
15
+ it("2 values → top/bottom, right/left", () => {
16
+ expect(parseShorthand("0 20")).toEqual([0, 20, 0, 20]);
17
+ });
18
+
19
+ it("3 values → top, right/left, bottom", () => {
20
+ expect(parseShorthand("0 0 20")).toEqual([0, 0, 20, 0]);
21
+ });
22
+
23
+ it("4 values → top right bottom left", () => {
24
+ expect(parseShorthand("1 2 3 4")).toEqual([1, 2, 3, 4]);
25
+ });
26
+
27
+ it("throws on invalid count", () => {
28
+ expect(() => parseShorthand("1 2 3 4 5")).toThrow();
29
+ });
30
+ });
31
+
32
+ describe("margin", () => {
33
+ it("returns 4 field descriptors with correct suffixes", () => {
34
+ const fields = margin("margin", { mobile: "0" });
35
+
36
+ expect(fields.map((f) => f.suffix)).toEqual([
37
+ "margin top",
38
+ "margin right",
39
+ "margin bottom",
40
+ "margin left",
41
+ ]);
42
+ });
43
+
44
+ it("sets type to number_input", () => {
45
+ margin("margin", { mobile: "0" }).forEach((f) => {
46
+ expect(f.type).toBe("number_input");
47
+ });
48
+ });
49
+
50
+ it("expands shorthand per platform", () => {
51
+ const fields = margin("margin", { mobile: "0 0 20", tv: "0 0 90" });
52
+ const byKey = Object.fromEntries(fields.map((f) => [f.suffix, f]));
53
+ expect(byKey["margin top"].initialValue).toEqual({ mobile: 0, tv: 0 });
54
+ expect(byKey["margin bottom"].initialValue).toEqual({ mobile: 20, tv: 90 });
55
+ expect(byKey["margin left"].initialValue).toEqual({ mobile: 0, tv: 0 });
56
+ });
57
+
58
+ it("supports a custom suffix prefix", () => {
59
+ const fields = margin("input margin", { mobile: "4" });
60
+ expect(fields[0].suffix).toBe("input margin top");
61
+ });
62
+ });
63
+
64
+ describe("padding", () => {
65
+ it("returns 4 field descriptors with correct suffixes", () => {
66
+ const fields = padding("padding", { mobile: "0" });
67
+
68
+ expect(fields.map((f) => f.suffix)).toEqual([
69
+ "padding top",
70
+ "padding right",
71
+ "padding bottom",
72
+ "padding left",
73
+ ]);
74
+ });
75
+
76
+ it("expands 2-value shorthand symmetrically", () => {
77
+ const fields = padding("padding", { mobile: "0 20", tv: "0 124" });
78
+ const byKey = Object.fromEntries(fields.map((f) => [f.suffix, f]));
79
+
80
+ expect(byKey["padding right"].initialValue).toEqual({
81
+ mobile: 20,
82
+ tv: 124,
83
+ });
84
+
85
+ expect(byKey["padding left"].initialValue).toEqual({ mobile: 20, tv: 124 });
86
+ expect(byKey["padding top"].initialValue).toEqual({ mobile: 0, tv: 0 });
87
+ expect(byKey["padding bottom"].initialValue).toEqual({ mobile: 0, tv: 0 });
88
+ });
89
+ });
90
+
7
91
  describe("manifestUtils/fieldUtils", () => {
8
92
  it("appends conditions and adds all_conditions when there is more than one condition", () => {
9
93
  const config = {
@@ -1,3 +1,121 @@
1
+ const { ZAPPIFEST_FIELDS } = require("../keys");
2
+ const { toCamelCase } = require("../_internals");
3
+
4
+ const SIDES = ["top", "right", "bottom", "left"];
5
+
6
+ /**
7
+ * Parses a CSS margin/padding shorthand string into [top, right, bottom, left].
8
+ *
9
+ * 1 value → all four sides
10
+ * 2 values → top/bottom, right/left
11
+ * 3 values → top, right/left, bottom
12
+ * 4 values → top, right, bottom, left
13
+ *
14
+ * @param {string} str
15
+ * @returns {[number, number, number, number]}
16
+ */
17
+ function parseShorthand(str) {
18
+ const parts = String(str).trim().split(/\s+/).map(Number);
19
+
20
+ switch (parts.length) {
21
+ case 1:
22
+ return [parts[0], parts[0], parts[0], parts[0]];
23
+ case 2:
24
+ return [parts[0], parts[1], parts[0], parts[1]];
25
+ case 3:
26
+ return [parts[0], parts[1], parts[2], parts[1]];
27
+ case 4:
28
+ return parts;
29
+ default:
30
+ throw new Error(
31
+ `Shorthand expects 1–4 space-separated values, got ${parts.length}: "${str}"`
32
+ );
33
+ }
34
+ }
35
+
36
+ function spacingFields(prefix, initialValues) {
37
+ const platforms = Object.keys(initialValues);
38
+
39
+ const parsed = Object.fromEntries(
40
+ platforms.map((p) => [p, parseShorthand(initialValues[p])])
41
+ );
42
+
43
+ return SIDES.map((side, i) => ({
44
+ suffix: `${prefix} ${side}`,
45
+ type: ZAPPIFEST_FIELDS.number_input,
46
+ initialValue: Object.fromEntries(platforms.map((p) => [p, parsed[p][i]])),
47
+ }));
48
+ }
49
+
50
+ /**
51
+ * Generates four margin field descriptors (top/right/bottom/left) from a
52
+ * per-platform CSS shorthand string.
53
+ *
54
+ * @param {string} suffix - prefix word for generated field names, e.g. "margin"
55
+ * @param {Record<string, string>} initialValues - e.g. { mobile: "0 0 20", tv: "0 0 90" }
56
+ * @returns {object[]}
57
+ */
58
+ function margin(suffix, initialValues) {
59
+ return spacingFields(suffix, initialValues);
60
+ }
61
+
62
+ /**
63
+ * Generates four padding field descriptors (top/right/bottom/left) from a
64
+ * per-platform CSS shorthand string.
65
+ *
66
+ * @param {string} suffix - prefix word for generated field names, e.g. "padding"
67
+ * @param {Record<string, string>} initialValues - e.g. { mobile: "0 20", tv: "0 124" }
68
+ * @returns {object[]}
69
+ */
70
+ function padding(suffix, initialValues) {
71
+ return spacingFields(suffix, initialValues);
72
+ }
73
+
74
+ /**
75
+ * Returns a flat camelCase defaults object for a spacing shorthand.
76
+ * e.g. marginDefaults("margin", "0 0 20") → { marginTop: 0, marginRight: 0, marginBottom: 20, marginLeft: 0 }
77
+ *
78
+ * @param {string} suffix - e.g. "margin" or "padding"
79
+ * @param {string} shorthand - CSS-like shorthand string
80
+ * @returns {Record<string, number>}
81
+ */
82
+ function spacingDefaults(suffix, shorthand) {
83
+ const values = parseShorthand(shorthand);
84
+
85
+ return Object.fromEntries(
86
+ SIDES.map((side, i) => [toCamelCase(`${suffix} ${side}`), values[i]])
87
+ );
88
+ }
89
+
90
+ function marginDefaults(suffix, shorthand) {
91
+ return spacingDefaults(suffix, shorthand);
92
+ }
93
+
94
+ function paddingDefaults(suffix, shorthand) {
95
+ return spacingDefaults(suffix, shorthand);
96
+ }
97
+
98
+ /**
99
+ * Returns four field descriptors (top/right/bottom/left) with only suffix and type — no initialValue.
100
+ * Used when defaults are stored separately in the subgroup spec.
101
+ *
102
+ * @param {string} prefix - e.g. "margin" or "padding"
103
+ * @returns {object[]}
104
+ */
105
+ function marginFields(prefix) {
106
+ return SIDES.map((side) => ({
107
+ suffix: `${prefix} ${side}`,
108
+ type: ZAPPIFEST_FIELDS.number_input,
109
+ }));
110
+ }
111
+
112
+ function paddingFields(prefix) {
113
+ return SIDES.map((side) => ({
114
+ suffix: `${prefix} ${side}`,
115
+ type: ZAPPIFEST_FIELDS.number_input,
116
+ }));
117
+ }
118
+
1
119
  /**
2
120
  * Appends new conditional_fields from conditions array
3
121
  * to config.conditional_fields
@@ -48,6 +166,13 @@ function createConditionalField(key, condition_value, category = "styles") {
48
166
  }
49
167
 
50
168
  module.exports = {
169
+ parseShorthand,
170
+ margin,
171
+ padding,
172
+ marginDefaults,
173
+ paddingDefaults,
174
+ marginFields,
175
+ paddingFields,
51
176
  withConditional,
52
177
  getConditionalKey,
53
178
  createConditionalField,