@applicaster/zapp-react-native-ui-components 16.0.0-rc.99 → 17.0.0-rc.1

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 (83) hide show
  1. package/Components/CellRendererResolver/index.ts +2 -2
  2. package/Components/ComponentResolver/ComponentResolver.ts +2 -2
  3. package/Components/ComponentResolver/__tests__/componentResolver.test.js +13 -5
  4. package/Components/ContentScreen/index.js +2 -2
  5. package/Components/FocusableList/hooks/useCheckItemIdsForUnique.ts +2 -7
  6. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +1 -1
  7. package/Components/GeneralContentScreen/hookAdapter/logger.ts +1 -1
  8. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +158 -1
  9. package/Components/GeneralContentScreen/utils/index.ts +2 -2
  10. package/Components/GeneralContentScreen/utils/logger.ts +3 -4
  11. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +32 -10
  12. package/Components/HandlePlayable/utils.ts +2 -7
  13. package/Components/HookRenderer/HookRenderer.tsx +2 -2
  14. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +13 -0
  15. package/Components/MasterCell/DefaultComponents/Image/hoc/utils/__tests__/withDimensions.test.ts +1 -1
  16. package/Components/MasterCell/DefaultComponents/Image/hoc/utils/index.ts +2 -4
  17. package/Components/MasterCell/DefaultComponents/Image/hooks/checkTooBigImageSize.ts +2 -7
  18. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +12 -3
  19. package/Components/MasterCell/DefaultComponents/PressableView.tsx +3 -0
  20. package/Components/MasterCell/DefaultComponents/Text/hooks/useText.ts +2 -7
  21. package/Components/MasterCell/DefaultComponents/__tests__/ActionButton.test.tsx +288 -0
  22. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/ActionButton.tsx +2 -1
  23. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/PressableView.test.tsx +4 -2
  24. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/factory.test.ts +2 -2
  25. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +2 -1
  26. package/Components/MasterCell/__tests__/masterCell.test.js +60 -0
  27. package/Components/MasterCell/index.tsx +28 -4
  28. package/Components/MasterCell/logger.ts +2 -2
  29. package/Components/MasterCell/utils/__tests__/useIsCellSelected.test.ts +91 -0
  30. package/Components/MasterCell/utils/__tests__/withoutFocusedState.test.js +20 -0
  31. package/Components/MasterCell/utils/behaviorProvider.ts +57 -38
  32. package/Components/MasterCell/utils/index.ts +21 -18
  33. package/Components/ModalComponent/ActionsBottomSheet/openActionsBottomSheet.ts +1 -1
  34. package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +7 -3
  35. package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +22 -1
  36. package/Components/ModalComponent/AudioPlayer/Components/__tests__/Item.test.tsx +52 -1
  37. package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +77 -0
  38. package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +58 -16
  39. package/Components/ModalComponent/BottomSheetDragArea.web.tsx +15 -0
  40. package/Components/ModalComponent/BottomSheetModalContent.tsx +51 -82
  41. package/Components/ModalComponent/SortableList.tsx +2 -3
  42. package/Components/ModalComponent/__tests__/BottomSheetDragArea.test.tsx +30 -0
  43. package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +237 -17
  44. package/Components/ModalComponent/__tests__/showTextInput.test.ts +25 -0
  45. package/Components/ModalComponent/showTextInput.ts +2 -0
  46. package/Components/OfflineHandler/__tests__/index.test.tsx +136 -0
  47. package/Components/OfflineHandler/index.tsx +45 -6
  48. package/Components/PlayerContainer/PlayerContainer.tsx +30 -6
  49. package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +51 -0
  50. package/Components/PlayerContainer/logger.ts +9 -5
  51. package/Components/River/ComponentsMap/ComponentsMap.tsx +4 -1
  52. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
  53. package/Components/ScreenFeedLoader/ScreenFeedLoader.tsx +2 -2
  54. package/Components/ScreenResolver/index.tsx +2 -3
  55. package/Components/Transitioner/AnimationManager.js +1 -1
  56. package/Components/Transitioner/Scene.tsx +4 -3
  57. package/Components/Transitioner/Transitioner.tsx +71 -33
  58. package/Components/Transitioner/__tests__/transitioner.test.js +372 -3
  59. package/Components/VideoLive/LiveImageManager.ts +126 -12
  60. package/Components/VideoLive/MuteUnmuteController.ts +135 -0
  61. package/Components/VideoLive/PlayerLiveImageComponent.tsx +15 -19
  62. package/Components/VideoLive/__tests__/LiveImageMuteState.test.ts +311 -0
  63. package/Components/VideoLive/__tests__/MuteUnmuteController.test.ts +135 -0
  64. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -1
  65. package/Components/VideoLive/loggerHelper.ts +2 -2
  66. package/Components/VideoModal/PlayerWrapper.tsx +4 -1
  67. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -0
  68. package/Components/VideoModal/__tests__/playerWrapperStyle.test.ts +58 -0
  69. package/Components/VideoModal/__tests__/playerWrapperUtils.test.ts +16 -0
  70. package/Components/VideoModal/hooks/useModalSize.ts +2 -7
  71. package/Components/VideoModal/playerWrapperStyle.ts +21 -3
  72. package/Components/VideoModal/playerWrapperUtils.ts +7 -1
  73. package/Contexts/ZappPipesContext/ZappPipesContextFactory.tsx +3 -5
  74. package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +4 -3
  75. package/Decorators/ZappPipesDataConnector/__tests__/screenToolbox.test.ts +347 -0
  76. package/Decorators/ZappPipesDataConnector/__tests__/screenToolboxUnavailable.test.ts +53 -0
  77. package/Decorators/ZappPipesDataConnector/index.tsx +19 -4
  78. package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +2 -21
  79. package/Decorators/ZappPipesDataConnector/screenToolbox.ts +384 -0
  80. package/Decorators/ZappPipesDataConnector/utils/mongoFilter.ts +1 -1
  81. package/Decorators/ZappPipesDataConnector/utils/useFilter.tsx +1 -1
  82. package/Helpers/logger.js +2 -2
  83. package/package.json +5 -5
@@ -22,6 +22,7 @@ import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
22
22
  import {
23
23
  ContentViewModel,
24
24
  OPERATIONS,
25
+ type OperationButtons,
25
26
  hasOperation,
26
27
  useBottomSheetContent,
27
28
  } from "@applicaster/zapp-react-native-utils/modalState";
@@ -42,6 +43,7 @@ import {
42
43
  parseModalBlocksConfiguration,
43
44
  } from "@applicaster/zapp-react-native-utils/configurationUtils/modalBlocksParser";
44
45
  import { useLocalizedStrings } from "@applicaster/zapp-react-native-utils/localizationUtils";
46
+ import { VARIANT_TEXT_ONLY } from "./AudioPlayer/Components/Button";
45
47
 
46
48
  const styles = StyleSheet.create({
47
49
  centered: {
@@ -90,10 +92,13 @@ type ModalComponentProps = {
90
92
  /** Optional body that replaces the items list (header stays DefaultModalHeader). */
91
93
  contentComponent?: React.ComponentType<any>;
92
94
  contentComponentProps?: Record<string, any>;
95
+ themePluginId?: string;
93
96
  styleOverrides?: ModalBlocksConfig | Record<string, any>;
94
97
  measurementPhase?: boolean;
95
98
  /** Copy under Next Up when the queue has no upcoming items. */
96
99
  emptyMessage?: string;
100
+ /** Producer-owned title/iconURL for sheet-synthesized operation controls. */
101
+ operationButtons?: OperationButtons;
97
102
  };
98
103
 
99
104
  function _BottomSheetModalContent(props: ModalComponentProps) {
@@ -115,9 +120,10 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
115
120
  iconPlacement,
116
121
  contentComponent: ContentComponent,
117
122
  contentComponentProps = {},
118
- styleOverrides: propStyleOverrides,
123
+ themePluginId: themePluginIdProp,
119
124
  measurementPhase = false,
120
125
  emptyMessage,
126
+ operationButtons,
121
127
  } = props;
122
128
 
123
129
  const route = useRef(currentRoute);
@@ -140,12 +146,14 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
140
146
  role,
141
147
  behavior,
142
148
  editableCollection,
143
- themePluginId,
149
+ themePluginId: themePluginIdFromSheet,
144
150
  } = useBottomSheetContent({
145
151
  onPress,
146
152
  viewModel,
147
153
  });
148
154
 
155
+ const themePluginId = themePluginIdFromSheet || themePluginIdProp;
156
+
149
157
  const plugins = usePlugins();
150
158
 
151
159
  const plugin = useMemo(
@@ -157,78 +165,10 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
157
165
  const configuration =
158
166
  plugin?.configuration || (plugin as any)?.configuration_json;
159
167
 
160
- const parsed =
161
- configuration && themePluginId
162
- ? parseModalBlocksConfiguration(configuration, themePluginId)
163
- : null;
164
-
165
- if (!propStyleOverrides) {
166
- return parsed;
167
- }
168
-
169
- // hydrate(QueueStyles) only emits sectionHeader after the plugin class
170
- // includes it. Until then, Studio/local keys in configuration_json still
171
- // apply via the parser.
172
- const hydratedSection = propStyleOverrides.sectionHeader;
173
-
174
- const hasTitleStyle = (style?: Record<string, any>) =>
175
- Boolean(
176
- style &&
177
- (style.fontColor ||
178
- style.fontSize !== undefined ||
179
- style.lineHeight !== undefined ||
180
- style.fontFamily ||
181
- style.iosFontFamily ||
182
- style.androidFontFamily ||
183
- style.letterSpacing !== undefined ||
184
- style.iosLetterSpacing !== undefined ||
185
- style.androidLetterSpacing !== undefined ||
186
- style.textTransform ||
187
- style.alignment)
188
- );
189
-
190
- const hasActionStyle = (style?: Record<string, any>) =>
191
- Boolean(
192
- style &&
193
- (style.backgroundColor ||
194
- style.fontColor ||
195
- style.fontSize !== undefined ||
196
- style.lineHeight !== undefined ||
197
- style.fontFamily ||
198
- style.iosFontFamily ||
199
- style.androidFontFamily ||
200
- style.letterSpacing !== undefined ||
201
- style.iosLetterSpacing !== undefined ||
202
- style.androidLetterSpacing !== undefined ||
203
- style.textTransform ||
204
- style.borderRadius !== undefined ||
205
- style.cornerRadius !== undefined ||
206
- style.paddingTop !== undefined ||
207
- style.paddingRight !== undefined ||
208
- style.paddingBottom !== undefined ||
209
- style.paddingLeft !== undefined)
210
- );
211
-
212
- const actionNode = hydratedSection?.actionButtons;
213
-
214
- // An empty `default: {}` is truthy and would hide fields set on the flat
215
- // object or on the focused bucket.
216
- const hasHydratedSection =
217
- hasTitleStyle(hydratedSection?.title?.default) ||
218
- hasTitleStyle(hydratedSection?.title) ||
219
- hasActionStyle(actionNode?.default) ||
220
- hasActionStyle(actionNode?.focused) ||
221
- hasActionStyle(actionNode?.focus) ||
222
- hasActionStyle(actionNode);
223
-
224
- return {
225
- ...parsed,
226
- ...propStyleOverrides,
227
- sectionHeader: hasHydratedSection
228
- ? hydratedSection
229
- : parsed?.sectionHeader,
230
- };
231
- }, [propStyleOverrides, plugin, themePluginId]);
168
+ return configuration && themePluginId
169
+ ? parseModalBlocksConfiguration(configuration, themePluginId)
170
+ : null;
171
+ }, [plugin, themePluginId]);
232
172
 
233
173
  const pluginLocalizations = useLocalizedStrings({
234
174
  localizations:
@@ -238,6 +178,28 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
238
178
 
239
179
  const normalizedPluginId = themePluginId?.replace(/-/g, "_");
240
180
 
181
+ const addLabel = operationButtons?.add?.title || "Create New";
182
+ const addIcon = operationButtons?.add?.iconURL;
183
+
184
+ const addButtonConfiguration = useMemo(() => {
185
+ const leadingIcon =
186
+ styleOverrides?.button?.leadingIcon ||
187
+ styleOverrides?.action?.leadingIcon;
188
+
189
+ const configuredIcon = leadingIcon?.default?.asset;
190
+
191
+ return {
192
+ ...VARIANT_TEXT_ONLY,
193
+ icons: {
194
+ ...VARIANT_TEXT_ONLY.icons,
195
+ leadingIcon: {
196
+ enabled: !!(addIcon || configuredIcon),
197
+ asset: addIcon,
198
+ },
199
+ },
200
+ };
201
+ }, [addIcon, styleOverrides]);
202
+
241
203
  const localizedHeaderTitle = normalizedPluginId
242
204
  ? pluginLocalizations?.[`${normalizedPluginId}_header_title`]
243
205
  : undefined;
@@ -394,11 +356,8 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
394
356
  editableCollection?.deleteCollection?.();
395
357
  }, [editableCollection]);
396
358
 
397
- const handleCreatePlaylist = useCallback(() => {
398
- editableCollection?.add?.({
399
- id: "create_new_playlist",
400
- title: "unknown title",
401
- });
359
+ const handleAdd = useCallback(() => {
360
+ editableCollection?.add?.();
402
361
  }, [editableCollection]);
403
362
 
404
363
  const headers = useMemo(() => {
@@ -428,7 +387,11 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
428
387
  <View
429
388
  style={{ paddingHorizontal: 20, paddingTop: 8, paddingBottom: 12 }}
430
389
  >
431
- <AudioPlayerButton onPress={handleCreatePlaylist} />
390
+ <AudioPlayerButton
391
+ configuration={addButtonConfiguration}
392
+ data={{ title: addLabel }}
393
+ onPress={handleAdd}
394
+ />
432
395
  </View>
433
396
  ),
434
397
  });
@@ -445,7 +408,9 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
445
408
  emptyMessage,
446
409
  clearLabel,
447
410
  hasAdd,
448
- handleCreatePlaylist,
411
+ addLabel,
412
+ addButtonConfiguration,
413
+ handleAdd,
449
414
  ]);
450
415
 
451
416
  const _items = useMemo(() => {
@@ -560,7 +525,11 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
560
525
  ) : null}
561
526
  {hasAdd ? (
562
527
  <View style={styles.someStyles}>
563
- <AudioPlayerButton onPress={handleCreatePlaylist} />
528
+ <AudioPlayerButton
529
+ configuration={addButtonConfiguration}
530
+ data={{ title: addLabel }}
531
+ onPress={handleAdd}
532
+ />
564
533
  </View>
565
534
  ) : null}
566
535
  {_items}
@@ -87,9 +87,7 @@ export const SortableList = ({
87
87
  const [localData, setLocalData] = useState(sortableData);
88
88
 
89
89
  useEffect(() => {
90
- setLocalData((localData) =>
91
- localData !== sortableData ? sortableData : localData
92
- );
90
+ setLocalData(sortableData);
93
91
  }, [sortableData]);
94
92
 
95
93
  const handleDragEnd = useCallback(
@@ -142,6 +140,7 @@ export const SortableList = ({
142
140
  >
143
141
  {renderHeader}
144
142
  <Sortable.Grid
143
+ key={`sortable-grid-${localData.length}`}
145
144
  scrollableRef={scrollableRef}
146
145
  customHandle
147
146
  columns={columns}
@@ -72,3 +72,33 @@ describe("BottomSheetDragArea", () => {
72
72
  expect(screen.getByTestId("child")).toBeTruthy();
73
73
  });
74
74
  });
75
+
76
+ describe("BottomSheetDragArea.web", () => {
77
+ it("renders children bare, matching the no-sheet path web always takes", () => {
78
+ const {
79
+ BottomSheetDragArea: WebDragArea,
80
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
81
+ } = require("../BottomSheetDragArea.web");
82
+
83
+ render(
84
+ <WebDragArea>
85
+ <Text testID="child">hi</Text>
86
+ </WebDragArea>
87
+ );
88
+
89
+ expect(screen.queryByTestId("drag-pan")).toBeNull();
90
+ expect(screen.getByTestId("child")).toBeTruthy();
91
+ });
92
+
93
+ it("does not pull react-native-gesture-handler into web bundles", () => {
94
+ jest.isolateModules(() => {
95
+ jest.doMock("react-native-gesture-handler", () => {
96
+ throw new Error(
97
+ "react-native-gesture-handler must stay out of web bundles"
98
+ );
99
+ });
100
+
101
+ expect(() => require("../BottomSheetDragArea.web")).not.toThrow();
102
+ });
103
+ });
104
+ });
@@ -1,7 +1,17 @@
1
1
  import React from "react";
2
2
  import { render, screen } from "@testing-library/react-native";
3
3
  import { BottomSheetModalContent } from "../BottomSheetModalContent";
4
- import { ContentViewModel } from "@applicaster/zapp-react-native-utils/modalState";
4
+ import {
5
+ ContentViewModel,
6
+ OPERATIONS,
7
+ } from "@applicaster/zapp-react-native-utils/modalState";
8
+ import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
9
+ import { Image, StyleSheet } from "react-native";
10
+ import {
11
+ AudioPlayerButton,
12
+ VARIANT_TEXT_ONLY,
13
+ } from "../AudioPlayer/Components/Button";
14
+ import { ModalBlocksStyleContext } from "../ModalBlocksStyleContext";
5
15
 
6
16
  jest.mock("react-native-sortables", () => {
7
17
  const { View } = require("react-native");
@@ -45,11 +55,11 @@ jest.mock("@applicaster/zapp-react-native-utils/theme", () => ({
45
55
  }));
46
56
 
47
57
  jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
48
- usePlugins: () => [],
58
+ usePlugins: jest.fn(() => []),
49
59
  }));
50
60
 
51
61
  jest.mock("@applicaster/zapp-react-native-utils/localizationUtils", () => ({
52
- useLocalizedStrings: () => ({}),
62
+ useLocalizedStrings: ({ localizations }: any) => localizations || {},
53
63
  }));
54
64
 
55
65
  jest.mock("react-native-safe-area-context", () => ({
@@ -92,15 +102,13 @@ jest.mock("../AudioPlayer/Components", () => ({
92
102
  return null;
93
103
  },
94
104
  AudioPlayerButton: (props: any) => {
95
- const { Text } = require("react-native");
105
+ const { AudioPlayerButton } = jest.requireActual(
106
+ "../AudioPlayer/Components/Button"
107
+ );
96
108
 
97
109
  mockAudioPlayerButtonProps.push(props);
98
110
 
99
- return (
100
- <Text testID="create-playlist-button" onPress={props.onPress}>
101
- {props.data?.title}
102
- </Text>
103
- );
111
+ return <AudioPlayerButton {...props} />;
104
112
  },
105
113
  }));
106
114
 
@@ -115,6 +123,10 @@ const baseProps = {
115
123
  };
116
124
 
117
125
  describe("BottomSheetModalContent role/behavior cells", () => {
126
+ beforeEach(() => {
127
+ jest.mocked(usePlugins).mockReturnValue([]);
128
+ });
129
+
118
130
  it("renders standard Button rows and default header when no viewModel/role", () => {
119
131
  render(<BottomSheetModalContent {...baseProps} />);
120
132
 
@@ -199,26 +211,234 @@ describe("BottomSheetModalContent role/behavior cells", () => {
199
211
 
200
212
  render(<BottomSheetModalContent {...baseProps} viewModel={viewModel} />);
201
213
 
202
- const createBtn = screen.getByTestId("create-playlist-button");
214
+ const createBtn = screen.getByText("Create New");
203
215
  expect(createBtn).toBeTruthy();
204
216
 
205
- // The button is rendered bare: styling comes from the modal blocks theme
206
- // and the title from the button block, so no configuration/data is passed.
207
217
  expect(mockAudioPlayerButtonProps.length).toBeGreaterThan(0);
208
218
 
209
219
  for (const props of mockAudioPlayerButtonProps) {
210
- expect(props.configuration).toBeUndefined();
211
- expect(props.data).toBeUndefined();
220
+ expect(props.configuration.icons.leadingIcon.enabled).toBe(false);
221
+ expect(props.data).toEqual({ title: "Create New" });
212
222
  expect(typeof props.onPress).toBe("function");
213
223
  }
214
224
 
215
225
  const { fireEvent } = require("@testing-library/react-native");
216
226
  fireEvent.press(createBtn);
217
227
 
218
- expect(addMock).toHaveBeenCalledWith({
219
- id: "create_new_playlist",
220
- title: "unknown title",
228
+ expect(addMock).toHaveBeenCalledWith();
229
+ });
230
+
231
+ it.each([["add"], ["add", "reorder"]])(
232
+ "renders operationButtons.add.title with plugin typography and icon for %j",
233
+ (...operations: string[]) => {
234
+ const { BehaviorSubject } = require("rxjs");
235
+
236
+ const configuration = {
237
+ "button.title.font_color": "#123456",
238
+ "button.title.font_size": 19,
239
+ "button.title.line_height": 27,
240
+ "button.background.background_color": "#ff9900",
241
+ "button.leading_icon.asset": "https://example.com/create.png",
242
+ localizations: {
243
+ playlist_experience_button_create_new: "Plugin key label",
244
+ },
245
+ };
246
+
247
+ jest
248
+ .mocked(usePlugins)
249
+ .mockReturnValue([
250
+ { identifier: "playlist-experience", configuration },
251
+ ]);
252
+
253
+ const viewModel = new ContentViewModel({
254
+ title: "Playlists",
255
+ items: [],
256
+ role: "collection_selector",
257
+ themePluginId: "playlist-experience",
258
+ dynamicCollection: { operations },
259
+ });
260
+
261
+ viewModel.editableCollection = {
262
+ items$: new BehaviorSubject([]),
263
+ operations,
264
+ add: jest.fn(),
265
+ move: jest.fn(),
266
+ };
267
+
268
+ const styleOverrides = {
269
+ button: {
270
+ title: { default: "Wrong decorator label" },
271
+ leadingIcon: { default: { asset: "https://example.com/wrong.png" } },
272
+ },
273
+ };
274
+
275
+ render(
276
+ <BottomSheetModalContent
277
+ {...baseProps}
278
+ viewModel={viewModel}
279
+ styleOverrides={styleOverrides}
280
+ operationButtons={{ add: { title: "Neue Playlist" } }}
281
+ />
282
+ );
283
+
284
+ expect(
285
+ StyleSheet.flatten(screen.getByText("Neue Playlist").props.style)
286
+ ).toMatchObject({ color: "#123456", fontSize: 19, lineHeight: 27 });
287
+
288
+ expect(screen.UNSAFE_getByType(Image).props.source).toEqual({
289
+ uri: "https://example.com/create.png",
290
+ });
291
+
292
+ expect(screen.queryByText("Wrong decorator label")).toBeNull();
293
+ expect(screen.queryByText("Plugin key label")).toBeNull();
294
+ expect(styleOverrides.button.title.default).toBe("Wrong decorator label");
295
+ expect(configuration["button.title.font_size"]).toBe(19);
296
+ }
297
+ );
298
+
299
+ it("does not read the playlist-specific Add icon key", () => {
300
+ const { BehaviorSubject } = require("rxjs");
301
+
302
+ jest.mocked(usePlugins).mockReturnValue([
303
+ {
304
+ identifier: "playlist-experience",
305
+ configuration: {
306
+ "button.create_new_playlist_asset": "https://example.com/legacy.png",
307
+ },
308
+ },
309
+ ]);
310
+
311
+ const viewModel = new ContentViewModel({
312
+ title: "Playlists",
313
+ items: [],
314
+ role: "collection_selector",
315
+ themePluginId: "playlist-experience",
316
+ dynamicCollection: { operations: ["add"] },
221
317
  });
318
+
319
+ viewModel.editableCollection = {
320
+ items$: new BehaviorSubject([]),
321
+ operations: ["add"],
322
+ add: jest.fn(),
323
+ };
324
+
325
+ render(<BottomSheetModalContent {...baseProps} viewModel={viewModel} />);
326
+
327
+ expect(screen.UNSAFE_queryAllByType(Image)).toHaveLength(0);
328
+ });
329
+
330
+ it.each(
331
+ [false, true].flatMap((sortable) =>
332
+ [
333
+ { iconURL: undefined, themeIcon: undefined, expected: undefined },
334
+ {
335
+ iconURL: "file:///bundled-add.png",
336
+ themeIcon: undefined,
337
+ expected: "file:///bundled-add.png",
338
+ },
339
+ {
340
+ iconURL: "https://example.com/upload.png",
341
+ themeIcon: undefined,
342
+ expected: "https://example.com/upload.png",
343
+ },
344
+ {
345
+ iconURL: undefined,
346
+ themeIcon: "https://example.com/theme.png",
347
+ expected: "https://example.com/theme.png",
348
+ },
349
+ {
350
+ iconURL: "file:///bundled-add.png",
351
+ themeIcon: "https://example.com/theme.png",
352
+ expected: "https://example.com/theme.png",
353
+ },
354
+ {
355
+ iconURL: "file:///bundled-add.png",
356
+ themeIcon: "https://example.com/theme.png",
357
+ themeEnabled: false,
358
+ expected: undefined,
359
+ },
360
+ ].map((scenario) => ({ ...scenario, sortable }))
361
+ )
362
+ )(
363
+ "resolves Add icon presentation for %j",
364
+ ({ sortable, iconURL, themeIcon, themeEnabled, expected }) => {
365
+ const { BehaviorSubject } = require("rxjs");
366
+
367
+ const operations = sortable
368
+ ? [OPERATIONS.ADD, OPERATIONS.REORDER]
369
+ : [OPERATIONS.ADD];
370
+
371
+ jest.mocked(usePlugins).mockReturnValue([
372
+ {
373
+ identifier: "generic-theme",
374
+ configuration: themeIcon
375
+ ? {
376
+ "button.leading_icon.asset": themeIcon,
377
+ "button.leading_icon.enabled": themeEnabled,
378
+ }
379
+ : {},
380
+ },
381
+ ]);
382
+
383
+ const viewModel = new ContentViewModel({
384
+ title: "Collections",
385
+ items: [],
386
+ themePluginId: "generic-theme",
387
+ dynamicCollection: { operations },
388
+ });
389
+
390
+ viewModel.editableCollection = {
391
+ items$: new BehaviorSubject([]),
392
+ operations,
393
+ add: jest.fn(),
394
+ move: jest.fn(),
395
+ };
396
+
397
+ render(
398
+ <BottomSheetModalContent
399
+ {...baseProps}
400
+ viewModel={viewModel}
401
+ operationButtons={{ add: { iconURL } }}
402
+ />
403
+ );
404
+
405
+ if (expected) {
406
+ expect(screen.UNSAFE_getByType(Image).props.source).toEqual({
407
+ uri: expected,
408
+ });
409
+ } else {
410
+ expect(screen.UNSAFE_queryAllByType(Image)).toHaveLength(0);
411
+ }
412
+ }
413
+ );
414
+
415
+ it("does not render a typography object as a button label", () => {
416
+ render(
417
+ <ModalBlocksStyleContext.Provider
418
+ value={{ button: { title: { default: { fontSize: 19 } } } }}
419
+ >
420
+ <AudioPlayerButton configuration={VARIANT_TEXT_ONLY} />
421
+ </ModalBlocksStyleContext.Provider>
422
+ );
423
+
424
+ expect(screen.toJSON()).toBeTruthy();
425
+ });
426
+
427
+ it("renders explicit button data separately from typography", () => {
428
+ render(
429
+ <ModalBlocksStyleContext.Provider
430
+ value={{ button: { title: { default: { fontSize: 19 } } } }}
431
+ >
432
+ <AudioPlayerButton
433
+ configuration={VARIANT_TEXT_ONLY}
434
+ data={{ title: "Create Playlist" }}
435
+ />
436
+ </ModalBlocksStyleContext.Provider>
437
+ );
438
+
439
+ expect(
440
+ StyleSheet.flatten(screen.getByText("Create Playlist").props.style)
441
+ ).toMatchObject({ fontSize: 19 });
222
442
  });
223
443
 
224
444
  it("shows the empty Next Up message only when now playing is on and the list is empty", () => {
@@ -92,4 +92,29 @@ describe("showTextInputAction", () => {
92
92
  expect(result).toBe(ActionResult.Error);
93
93
  expect(actionExecutor.handleAction).not.toHaveBeenCalled();
94
94
  });
95
+
96
+ it("forwards themePluginId so the sheet can read plugin button styles", async () => {
97
+ const action = {
98
+ type: "showTextInput",
99
+ options: {
100
+ headerTitle: "Create New Playlist",
101
+ inputLabel: "Name your playlist",
102
+ buttonLabel: "Create",
103
+ themePluginId: "playlist-experience",
104
+ actions: [{ type: "sendCloudEvent", options: {} }],
105
+ },
106
+ };
107
+
108
+ await showTextInputAction(action as any);
109
+
110
+ expect(actionExecutor.handleAction).toHaveBeenCalledWith(
111
+ expect.objectContaining({
112
+ type: "openBottomSheet",
113
+ options: expect.objectContaining({
114
+ themePluginId: "playlist-experience",
115
+ }),
116
+ }),
117
+ undefined
118
+ );
119
+ });
95
120
  });
@@ -21,6 +21,7 @@ export async function showTextInputAction(
21
21
  validationLabel,
22
22
  actions,
23
23
  maxLength,
24
+ themePluginId,
24
25
  } = action.options || {};
25
26
 
26
27
  if (!headerTitle || !buttonLabel || !actions || !actions.length) {
@@ -34,6 +35,7 @@ export async function showTextInputAction(
34
35
  header: {
35
36
  title: headerTitle,
36
37
  },
38
+ ...(themePluginId ? { themePluginId } : {}),
37
39
  content: {
38
40
  component: TextInputContent,
39
41
  props: {