@applicaster/zapp-react-native-ui-components 16.0.0-alpha.1535029240 → 16.0.0-alpha.1701179921

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 (92) hide show
  1. package/Components/AudioPlayer/tv/__tests__/audioPlayer.test.js +19 -0
  2. package/Components/AudioPlayer/tv/__tests__/index.test.tsx +120 -0
  3. package/Components/AudioPlayer/tv/index.tsx +5 -1
  4. package/Components/Cell/Cell.tsx +3 -6
  5. package/Components/Cell/TvOSCellComponent.tsx +0 -1
  6. package/Components/GeneralContentScreen/GeneralContentScreenHookAdapter.tsx +15 -0
  7. package/Components/GeneralContentScreen/hookAdapter/__tests__/skipExpression.test.ts +294 -0
  8. package/Components/GeneralContentScreen/hookAdapter/__tests__/validationHelper.test.ts +64 -0
  9. package/Components/GeneralContentScreen/hookAdapter/skipExpression.ts +252 -0
  10. package/Components/GeneralContentScreen/hookAdapter/validationHelper.ts +18 -0
  11. package/Components/LinkHandler/LinkHandler.tsx +2 -7
  12. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +5 -1
  13. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/ActionButtonController.tsx +19 -4
  14. package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/__tests__/ActionButtonController.test.tsx +43 -1
  15. package/Components/MasterCell/DefaultComponents/Button.tsx +1 -0
  16. package/Components/MasterCell/DefaultComponents/Image/hoc/utils/__tests__/withDimensions.test.ts +420 -125
  17. package/Components/MasterCell/DefaultComponents/Image/hoc/utils/index.ts +114 -19
  18. package/Components/MasterCell/DefaultComponents/Image/hoc/withDimensions.tsx +19 -8
  19. package/Components/MasterCell/DefaultComponents/LiveImage/executePreloadHooks.ts +2 -4
  20. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -3
  21. package/Components/MasterCell/DefaultComponents/Toggle.tsx +36 -14
  22. package/Components/MasterCell/DefaultComponents/__tests__/Toggle.test.tsx +167 -0
  23. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/factory.test.ts +32 -0
  24. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +1 -2
  25. package/Components/ModalComponent/ActionsBottomSheet/ActionButton.tsx +56 -0
  26. package/Components/ModalComponent/ActionsBottomSheet/__tests__/openActionsBottomSheet.test.ts +38 -0
  27. package/Components/ModalComponent/ActionsBottomSheet/boundActionButton.tsx +24 -0
  28. package/Components/ModalComponent/ActionsBottomSheet/index.ts +9 -0
  29. package/Components/ModalComponent/ActionsBottomSheet/openActionsBottomSheet.ts +61 -0
  30. package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +87 -97
  31. package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +87 -126
  32. package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +140 -83
  33. package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +252 -123
  34. package/Components/ModalComponent/AudioPlayer/Components/NowPlayingHeaderSection.tsx +205 -0
  35. package/Components/ModalComponent/AudioPlayer/Components/__tests__/Item.test.tsx +113 -0
  36. package/Components/ModalComponent/AudioPlayer/Components/__tests__/NowPlayingHeaderSection.test.tsx +36 -0
  37. package/Components/ModalComponent/AudioPlayer/Components/index.ts +3 -3
  38. package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +356 -0
  39. package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +521 -0
  40. package/Components/ModalComponent/BottomSheetDragArea.tsx +33 -0
  41. package/Components/ModalComponent/BottomSheetModalContent.tsx +505 -66
  42. package/Components/ModalComponent/Button/index.tsx +5 -3
  43. package/Components/ModalComponent/Header/CloseButton.tsx +12 -0
  44. package/Components/ModalComponent/Header/__tests__/CloseButton.test.tsx +72 -0
  45. package/Components/ModalComponent/Header/index.tsx +20 -7
  46. package/Components/ModalComponent/Header/utils.ts +1 -1
  47. package/Components/ModalComponent/ModalBlocksStyleContext.tsx +10 -0
  48. package/Components/ModalComponent/SortableList.tsx +156 -0
  49. package/Components/ModalComponent/SortableList.web.tsx +34 -0
  50. package/Components/ModalComponent/TextInputContent.tsx +135 -0
  51. package/Components/ModalComponent/__tests__/BottomSheetDragArea.test.tsx +74 -0
  52. package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +343 -0
  53. package/Components/ModalComponent/__tests__/SortableList.web.test.tsx +16 -0
  54. package/Components/ModalComponent/__tests__/TextInputContent.test.tsx +169 -0
  55. package/Components/ModalComponent/__tests__/showTextInput.test.ts +95 -0
  56. package/Components/ModalComponent/index.tsx +18 -9
  57. package/Components/ModalComponent/presets/__tests__/getCell.test.ts +90 -0
  58. package/Components/ModalComponent/presets/dynamicCollectionCell.tsx +78 -0
  59. package/Components/ModalComponent/presets/index.ts +27 -0
  60. package/Components/ModalComponent/presets/selectableCell.tsx +28 -0
  61. package/Components/ModalComponent/presets/standardCell.tsx +41 -0
  62. package/Components/ModalComponent/presets/types.ts +35 -0
  63. package/Components/ModalComponent/showTextInput.ts +52 -0
  64. package/Components/ModalComponent/utils.ts +82 -21
  65. package/Components/OfflineHandler/hooks.ts +0 -12
  66. package/Components/PlayerContainer/PlayerContainer.tsx +19 -8
  67. package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -4
  68. package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +66 -13
  69. package/Components/River/ComponentsMap/ComponentsMap.tsx +85 -59
  70. package/Components/River/River.tsx +4 -0
  71. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +138 -75
  72. package/Components/River/__tests__/componentsMap.test.js +8 -3
  73. package/Components/River/__tests__/resultCallback.test.tsx +47 -0
  74. package/Components/Screen/__tests__/Screen.test.tsx +24 -0
  75. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -0
  76. package/Components/Screen/index.tsx +5 -0
  77. package/Components/Screen/navigationHandler.ts +8 -8
  78. package/Components/ScreenRevealManager/ScreenRevealManager.ts +18 -2
  79. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +36 -0
  80. package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +56 -0
  81. package/Components/ScreenRevealManager/withScreenRevealManager.tsx +21 -4
  82. package/Components/Transitioner/Transitioner.tsx +2 -3
  83. package/Components/Transitioner/__tests__/transitioner.test.js +83 -2
  84. package/Components/VideoLive/LiveImageManager.ts +9 -3
  85. package/Components/VideoLive/__tests__/LiveImageManager.test.ts +59 -0
  86. package/Contexts/ModalNavigationContext/__tests__/index.test.tsx +15 -0
  87. package/Contexts/ModalNavigationContext/index.tsx +2 -2
  88. package/Hooks/useEntryActionsExpander.ts +63 -0
  89. package/assets/empty-Info.png +0 -0
  90. package/package.json +6 -5
  91. package/Components/ModalComponent/AudioPlayer/Components/Action.tsx +0 -332
  92. /package/Decorators/ZappPipesDataConnector/__tests__/{Hero.js → Hero.tsx} +0 -0
@@ -0,0 +1,61 @@
1
+ import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
2
+ import { openBottomSheetModal } from "@applicaster/zapp-react-native-utils/modalState";
3
+ import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
4
+ import { RegisteredAction } from "@applicaster/zapp-react-native-utils/uiActionsRegistrator";
5
+
6
+ import { boundActionButton } from "./boundActionButton";
7
+
8
+ const { log_warning } = createLogger({
9
+ subsystem: "ActionsBottomSheet",
10
+ category: "Presentation",
11
+ });
12
+
13
+ export type OpenActionsBottomSheetArgs = {
14
+ /** Entry the actions act on; bound into every row button. */
15
+ entry: ZappEntry | ZappFeed;
16
+ /** Already resolved and merged actions, in the order they should appear. */
17
+ actions: RegisteredAction[];
18
+ title?: string;
19
+ summary?: string;
20
+ /** List that opened the sheet; forwarded into row invokeAction context. */
21
+ component?: ZappUIComponent & { parent?: ZappUIComponent };
22
+ };
23
+
24
+ /**
25
+ * Presents a list of resolved actions in the shared bottom sheet.
26
+ *
27
+ * This is the core entry point for "show these actions in a sheet": the
28
+ * open-modal-bottom-sheet plugin uses it for its configured list, and the
29
+ * player overflow uses it for the actions that did not fit on the overlay.
30
+ * Neither has to know about the other, and neither needs the plugin installed.
31
+ */
32
+ export function openActionsBottomSheet({
33
+ entry,
34
+ actions,
35
+ title,
36
+ summary,
37
+ component,
38
+ }: OpenActionsBottomSheetArgs): void {
39
+ if (!actions?.length) {
40
+ // Every action resolved away - unavailable for this entry, or not
41
+ // invokable. An empty sheet looks broken, so say why and stay put.
42
+ log_warning(
43
+ "openActionsBottomSheet: nothing to present - not opening the sheet",
44
+ { entryId: (entry as ZappEntry)?.id }
45
+ );
46
+
47
+ return;
48
+ }
49
+
50
+ openBottomSheetModal({
51
+ modalBottomSheetContentProps: {
52
+ // TODO: should be optional - the button handles its own tap, but
53
+ // BottomSheetModalContent still requires an onPress.
54
+ onPress: noop,
55
+ items: actions,
56
+ buttonComponent: boundActionButton(entry, component),
57
+ title,
58
+ summary,
59
+ },
60
+ });
61
+ }
@@ -17,6 +17,9 @@ import {
17
17
  Text,
18
18
  View,
19
19
  } from "react-native";
20
+ import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
21
+
22
+ const logger = createLogger({ category: "ModalComponent:AudioPlayerButton" });
20
23
 
21
24
  const styles = StyleSheet.create({
22
25
  container: {
@@ -32,24 +35,6 @@ const styles = StyleSheet.create({
32
35
  title: {
33
36
  textAlign: "center",
34
37
  },
35
- demoScreen: {
36
- flex: 1,
37
- backgroundColor: "#1C1C1E",
38
- paddingTop: 64,
39
- paddingHorizontal: 24,
40
- gap: 12,
41
- },
42
- demoHeading: {
43
- color: "#FFFFFF",
44
- fontSize: 20,
45
- fontWeight: "600",
46
- marginBottom: 8,
47
- },
48
- demoLabel: {
49
- color: "#999999",
50
- fontSize: 13,
51
- marginTop: 8,
52
- },
53
38
  });
54
39
 
55
40
  // ---------------------------------------------------------------------------
@@ -99,6 +84,8 @@ export type LeadingIconConfiguration = {
99
84
  enabled: boolean;
100
85
  /** Decides which icon will be displayed when enabled */
101
86
  actionType?: ButtonActionType;
87
+ /** Optional Studio / modal-blocks asset URI (overrides actionType mapping) */
88
+ asset?: string;
102
89
  };
103
90
 
104
91
  export type IconsConfiguration = {
@@ -146,6 +133,28 @@ export const DEFAULT_ICONS_CONFIGURATION: IconsConfiguration = {
146
133
  },
147
134
  };
148
135
 
136
+ // ---------------------------------------------------------------------------
137
+ // Variant configurations
138
+ // ---------------------------------------------------------------------------
139
+
140
+ export const VARIANT_TEXT_ONLY: ButtonConfiguration = {
141
+ background: DEFAULT_BACKGROUND_CONFIGURATION,
142
+ title: DEFAULT_TITLE_CONFIGURATION,
143
+ icons: DEFAULT_ICONS_CONFIGURATION,
144
+ };
145
+
146
+ export const VARIANT_WITH_ICON: ButtonConfiguration = {
147
+ background: DEFAULT_BACKGROUND_CONFIGURATION,
148
+ title: DEFAULT_TITLE_CONFIGURATION,
149
+ icons: {
150
+ ...DEFAULT_ICONS_CONFIGURATION,
151
+ leadingIcon: {
152
+ enabled: true,
153
+ actionType: "addToPlaylist",
154
+ },
155
+ },
156
+ };
157
+
149
158
  // ---------------------------------------------------------------------------
150
159
  // Data (runtime / localization — not styling config)
151
160
  // ---------------------------------------------------------------------------
@@ -156,30 +165,15 @@ export type ButtonData = {
156
165
  };
157
166
 
158
167
  export type AudioPlayerButtonProps = {
159
- configuration: ButtonConfiguration;
160
- data: ButtonData;
168
+ configuration?: ButtonConfiguration;
169
+ data?: ButtonData;
161
170
  disabled?: boolean;
162
171
  focused?: boolean;
163
172
  onPress?: () => void;
164
173
  };
165
174
 
166
- // ---------------------------------------------------------------------------
167
- // Hardcoded spec values (black fields)
168
- // ---------------------------------------------------------------------------
169
-
170
- // Hardcoded: action type → icon asset mapping (base64 PNG)
171
- const ACTION_ICON_ASSETS: Record<ButtonActionType, string> = {
172
- addToQueue:
173
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAKUlEQVR42mNgGAVDCfxHw6MWjFpAvEGk4lELKLdgNJmOWkA7C0YBbQAAwiZvkR9eFgQAAAAASUVORK5CYII=",
174
- addToPlaylist:
175
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAJklEQVR42mNgGAUjFvzHgmluATF4cFswGsmjkTwayaORPAqGLwAA6Jpxj9Ms9QMAAAAASUVORK5CYII=",
176
- goToPlaylist:
177
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAALklEQVR42mNgGAWjYNiD/7Q2/D8tLflPiSX/ycQ0t+D/yLGAEkeMWjAKRgG9AQB4zlSshwSzWwAAAABJRU5ErkJggg==",
178
- confirm:
179
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAJElEQVR42mNgGAWjYBSQCv4TwKMWDHELho/hNE/3o2AUDDcAAPv0QMAyy1CtAAAAAElFTkSuQmCC",
180
- cancel:
181
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAASElEQVR42mNgGAWjGvynkVoUTf+pqA6nxv8UqiHbEooNx2cQ1QzHZiDVDcdlCcOQsoCmQUTTSKZpMqV5RqNLUUHTwm4UDBMAALBLQ73LTvoyAAAAAElFTkSuQmCC",
182
- };
175
+ const PLACEHOLDER_RED_BOX =
176
+ "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAJ0lEQVR4nO3NMQEAAAjDsIF/z2ACvlRAU5NMHuvPOQAAAAAAAMBdC/07Ai5sNw+CAAAAAElFTkSuQmCC";
183
177
 
184
178
  function getTextTransformStyle(
185
179
  textTransform: TextTransform
@@ -188,7 +182,9 @@ function getTextTransformStyle(
188
182
  }
189
183
 
190
184
  function shouldShowLeadingIcon(leadingIcon: LeadingIconConfiguration) {
191
- return leadingIcon.enabled && !!leadingIcon.actionType;
185
+ return (
186
+ leadingIcon.enabled && (!!leadingIcon.actionType || !!leadingIcon.asset)
187
+ );
192
188
  }
193
189
 
194
190
  // ---------------------------------------------------------------------------
@@ -286,17 +282,31 @@ function ButtonTitle({
286
282
  }
287
283
 
288
284
  type ButtonLeadingIconProps = {
289
- actionType: ButtonActionType;
285
+ actionType?: ButtonActionType;
290
286
  configuration: IconsConfiguration;
291
287
  };
292
288
 
293
- function ButtonLeadingIcon({
294
- actionType,
295
- configuration,
296
- }: ButtonLeadingIconProps) {
289
+ function ButtonLeadingIcon({ configuration }: ButtonLeadingIconProps) {
290
+ const asset = configuration.leadingIcon.asset || PLACEHOLDER_RED_BOX;
291
+
292
+ React.useEffect(() => {
293
+ if (!configuration.leadingIcon.asset) {
294
+ logger.log_warning(
295
+ "AudioPlayerButton has leadingIcon enabled but no asset was provided. Falling back to placeholder red box. Ensure the relevant plugin (e.g. playlist-experience) provides leadingIcon.asset in styleOverrides.",
296
+ {
297
+ leadingIcon: configuration.leadingIcon,
298
+ }
299
+ );
300
+ }
301
+ }, [configuration.leadingIcon.asset]);
302
+
303
+ if (!asset) {
304
+ return null;
305
+ }
306
+
297
307
  return (
298
308
  <Image
299
- source={{ uri: ACTION_ICON_ASSETS[actionType] }}
309
+ source={{ uri: asset }}
300
310
  style={{
301
311
  width: configuration.width,
302
312
  height: configuration.height,
@@ -310,22 +320,46 @@ function ButtonLeadingIcon({
310
320
  // AudioPlayerButton — single building block driven by configuration + data
311
321
  // ---------------------------------------------------------------------------
312
322
 
323
+ import { useModalBlocksStyle } from "../../ModalBlocksStyleContext";
324
+ import { mergeButtonConfiguration } from "../utils/mergeStyles";
325
+
313
326
  export function AudioPlayerButton({
314
- configuration,
315
- data,
327
+ configuration = VARIANT_WITH_ICON,
328
+ data = { title: undefined },
316
329
  disabled,
317
330
  focused = false,
318
331
  onPress,
319
332
  }: AudioPlayerButtonProps) {
333
+ const modalBlocksStyle = useModalBlocksStyle();
334
+
335
+ const buttonBlock = modalBlocksStyle?.button;
336
+ const actionBlock = modalBlocksStyle?.action;
337
+
338
+ const effectiveConfig = React.useMemo(() => {
339
+ return mergeButtonConfiguration(configuration, buttonBlock, actionBlock);
340
+ }, [configuration, buttonBlock, actionBlock]);
341
+
320
342
  const {
321
- background: backgroundConfiguration,
322
- title: titleConfiguration,
343
+ background: effectiveBgConfig,
344
+ title: effectiveTitleConfig,
323
345
  icons: iconsConfiguration,
324
- } = configuration;
346
+ } = effectiveConfig;
325
347
 
326
- const { title } = data;
348
+ const title = data?.title || buttonBlock?.title.default;
327
349
  const isDisabled = disabled ?? data.disabled ?? false;
328
350
 
351
+ React.useEffect(() => {
352
+ if (!title) {
353
+ logger.log_warning(
354
+ "Create New Playlist button rendering with empty title. Ensure data.title is set for AudioPlayerButton or styleOverrides providing button title.",
355
+ {
356
+ leadingIcon: iconsConfiguration.leadingIcon,
357
+ modalBlocksStyle: modalBlocksStyle,
358
+ }
359
+ );
360
+ }
361
+ }, [title]);
362
+
329
363
  const { leadingIcon } = iconsConfiguration;
330
364
  const showIcon = shouldShowLeadingIcon(leadingIcon);
331
365
 
@@ -333,7 +367,7 @@ export function AudioPlayerButton({
333
367
  <ButtonContainer
334
368
  focused={focused}
335
369
  disabled={isDisabled}
336
- configuration={backgroundConfiguration}
370
+ configuration={effectiveBgConfig}
337
371
  onPress={onPress}
338
372
  >
339
373
  <View style={styles.contentRow}>
@@ -343,60 +377,16 @@ export function AudioPlayerButton({
343
377
  actionType={leadingIcon.actionType}
344
378
  configuration={iconsConfiguration}
345
379
  />
346
- <View style={{ width: backgroundConfiguration.horizontalGutter }} />
380
+ <View style={{ width: effectiveBgConfig.horizontalGutter }} />
347
381
  </>
348
382
  ) : null}
349
383
  <ButtonTitle
350
384
  title={title}
351
385
  focused={focused}
352
386
  disabled={isDisabled}
353
- configuration={titleConfiguration}
387
+ configuration={effectiveTitleConfig}
354
388
  />
355
389
  </View>
356
390
  </ButtonContainer>
357
391
  );
358
392
  }
359
-
360
- // ---------------------------------------------------------------------------
361
- // Snack demo — two Button variants from configuration only
362
- // ---------------------------------------------------------------------------
363
-
364
- export const VARIANT_TEXT_ONLY: ButtonConfiguration = {
365
- background: DEFAULT_BACKGROUND_CONFIGURATION,
366
- title: DEFAULT_TITLE_CONFIGURATION,
367
- icons: DEFAULT_ICONS_CONFIGURATION,
368
- };
369
-
370
- export const VARIANT_WITH_ICON: ButtonConfiguration = {
371
- background: DEFAULT_BACKGROUND_CONFIGURATION,
372
- title: DEFAULT_TITLE_CONFIGURATION,
373
- icons: {
374
- ...DEFAULT_ICONS_CONFIGURATION,
375
- leadingIcon: {
376
- enabled: true,
377
- actionType: "addToPlaylist",
378
- },
379
- },
380
- };
381
-
382
- export const VARIANT_UPPERCASE_TITLE: ButtonConfiguration = {
383
- background: DEFAULT_BACKGROUND_CONFIGURATION,
384
- title: {
385
- ...DEFAULT_TITLE_CONFIGURATION,
386
- textTransform: "uppercase",
387
- },
388
- icons: DEFAULT_ICONS_CONFIGURATION,
389
- };
390
-
391
- export const VARIANT_LARGE_ICON: ButtonConfiguration = {
392
- background: DEFAULT_BACKGROUND_CONFIGURATION,
393
- title: DEFAULT_TITLE_CONFIGURATION,
394
- icons: {
395
- width: 32,
396
- height: 32,
397
- leadingIcon: {
398
- enabled: true,
399
- actionType: "addToQueue",
400
- },
401
- },
402
- };