@applicaster/zapp-react-native-utils 16.0.0-alpha.1263110541 → 16.0.0-alpha.1334507601

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 (41) hide show
  1. package/actionsExecutor/ActionExecutor.ts +10 -1
  2. package/actionsExecutor/ActionExecutorContext.tsx +13 -1
  3. package/actionsExecutor/__tests__/ActionExecutor.test.ts +71 -0
  4. package/actionsExecutor/actions/__tests__/dismissBottomSheet.test.ts +3 -0
  5. package/actionsExecutor/actions/__tests__/openBottomSheet.inlineItems.test.ts +113 -1
  6. package/actionsExecutor/actions/__tests__/presentScreen.test.ts +127 -0
  7. package/actionsExecutor/actions/__tests__/showAlert.test.ts +49 -0
  8. package/actionsExecutor/actions/__tests__/showToast.test.ts +2 -2
  9. package/actionsExecutor/actions/dismissBottomSheet.ts +2 -1
  10. package/actionsExecutor/actions/index.ts +4 -0
  11. package/actionsExecutor/actions/openBottomSheet.ts +20 -11
  12. package/actionsExecutor/actions/presentScreen.ts +78 -0
  13. package/actionsExecutor/actions/showAlert.ts +51 -0
  14. package/actionsExecutor/actions/showToast.ts +2 -2
  15. package/actionsExecutor/consts.ts +2 -0
  16. package/configurationUtils/__tests__/manifestKeyParser.test.ts +21 -0
  17. package/configurationUtils/__tests__/modalBlocksParser.test.ts +102 -1
  18. package/configurationUtils/manifestKeyParser.ts +12 -1
  19. package/configurationUtils/modalBlocksParser.ts +26 -4
  20. package/entryActions/__tests__/buildEntryActions.test.ts +97 -18
  21. package/entryActions/aliasPresentation.ts +26 -42
  22. package/entryActions/buildEntryActions.ts +1 -0
  23. package/entryActions/index.ts +0 -2
  24. package/manifestUtils/defaultManifestConfigurations/generalContent.js +6 -0
  25. package/modalState/ModalOrchestrator.ts +21 -9
  26. package/modalState/RemoteEditableCollection.ts +9 -1
  27. package/modalState/__tests__/RemoteEditableCollection.test.ts +90 -1
  28. package/modalState/__tests__/index.test.ts +30 -1
  29. package/modalState/__tests__/useModalStoreState.test.ts +142 -0
  30. package/modalState/index.ts +6 -1
  31. package/modalState/store.ts +9 -2
  32. package/modalState/types.ts +29 -2
  33. package/modalState/useBottomSheetContent.ts +24 -17
  34. package/package.json +2 -2
  35. package/reactHooks/cell-click/__tests__/index.test.js +64 -0
  36. package/reactHooks/cell-click/index.ts +21 -14
  37. package/reactHooks/navigation/__tests__/index.test.tsx +176 -1
  38. package/reactHooks/navigation/__tests__/usePresentScreen.test.ts +154 -0
  39. package/reactHooks/navigation/index.ts +2 -0
  40. package/reactHooks/navigation/usePresentScreen.ts +157 -0
  41. package/reactHooks/navigation/useRoute.ts +22 -5
@@ -0,0 +1,51 @@
1
+ /// <reference types="@applicaster/applicaster-types" />
2
+ import { showAlertDialog } from "../../alertUtils";
3
+ import { ActionResult } from "../ActionExecutor";
4
+ import { ActionHandler } from "../types";
5
+ import { createLogger } from "../../logger";
6
+
7
+ const { log_info } = createLogger({
8
+ subsystem: "ActionExecutorContext",
9
+ category: "General",
10
+ });
11
+
12
+ /**
13
+ * Options for the showAlert action.
14
+ */
15
+ export interface ShowAlertOptions {
16
+ /** Dialog title (required) */
17
+ title: string;
18
+
19
+ /** Dialog message */
20
+ message?: string;
21
+
22
+ /** Dismiss button text. Defaults to "OK" */
23
+ okButtonText?: string;
24
+ }
25
+
26
+ /**
27
+ * Tells the user something and waits for them to acknowledge it.
28
+ *
29
+ * One button, because there is nothing to decide. Use `confirmDialog` when the
30
+ * user is choosing between going on and backing out; a `confirmDialog` without
31
+ * a cancel label still renders two buttons, the second one blank.
32
+ *
33
+ * Always resolves to Success: dismissing a notice is not a cancellation, so the
34
+ * rest of the chain runs.
35
+ */
36
+ export const showAlertAction: ActionHandler<ShowAlertOptions> = async (
37
+ action
38
+ ): Promise<ActionResult> => {
39
+ log_info("handleAction: showAlert event");
40
+
41
+ const options = action.options as ShowAlertOptions;
42
+
43
+ return new Promise<ActionResult>((resolve) => {
44
+ showAlertDialog({
45
+ title: options?.title,
46
+ message: options?.message,
47
+ okButtonText: options?.okButtonText || "OK",
48
+ completion: () => resolve(ActionResult.Success),
49
+ });
50
+ });
51
+ };
@@ -5,7 +5,7 @@ import { postEvent } from "../../reactHooks/useSubscriberFor";
5
5
 
6
6
  export const CONFIRMATION_TOAST_SOURCE = "confirmation";
7
7
 
8
- export const CONFIRMATION_TOAST_DEFAULT_TIMEOUT = 1000;
8
+ export const CONFIRMATION_TOAST_DEFAULT_TIMEOUT = 5000;
9
9
 
10
10
  /**
11
11
  * Shows a mobile confirmation toast with Theme defaults from
@@ -13,7 +13,7 @@ export const CONFIRMATION_TOAST_DEFAULT_TIMEOUT = 1000;
13
13
  *
14
14
  * This action is confirmation-only by design: it always stamps
15
15
  * `source: "confirmation"` (so Theme confirmation styles apply) and defaults
16
- * `timeout` to 1000 ms. Non-confirmation toasts (e.g. Offline Experience)
16
+ * `timeout` to 5000 ms. Non-confirmation toasts (e.g. Offline Experience)
17
17
  * must post on the shared `"showToast"` event bus directly and omit `source`.
18
18
  * Callers may override individual style fields; Theme supplies the rest.
19
19
  *
@@ -9,6 +9,7 @@ export const ACTION_TYPES = {
9
9
  PRESENT_SUB_MENU: "presentSubMenu",
10
10
  SEND_CLOUD_EVENT: "sendCloudEvent",
11
11
  NAVIGATE_TO_SCREEN: "navigateToScreen",
12
+ PRESENT_SCREEN: "presentScreen",
12
13
  GO_BACK: "goBack",
13
14
  GO_HOME: "goHome",
14
15
  SHOW_TOAST: "showToast",
@@ -22,6 +23,7 @@ export const ACTION_TYPES = {
22
23
  SWITCH_LAYOUT: "switchLayout",
23
24
  APP_RESTART: "appRestart",
24
25
  CONFIRM_DIALOG: "confirmDialog",
26
+ SHOW_ALERT: "showAlert",
25
27
  SCREEN_SET_VARIABLE: "screenSetVariable",
26
28
  SCREEN_TOGGLE_FLAG: "screenToggleFlag",
27
29
  } as const;
@@ -176,6 +176,27 @@ describe("getAllSpecificStyles", () => {
176
176
  });
177
177
  });
178
178
 
179
+ it("should normalize Studio focus alias onto focused state", () => {
180
+ const outStyles = {};
181
+
182
+ const configuration = {
183
+ button_style_focus_background_color: "#FF3B30",
184
+ };
185
+
186
+ getAllSpecificStyles({
187
+ componentName: "button",
188
+ subComponentName: "",
189
+ configuration,
190
+ outStyles,
191
+ });
192
+
193
+ expect(outStyles.focused).toEqual({
194
+ backgroundColor: "#FF3B30",
195
+ });
196
+
197
+ expect(outStyles.focus).toBeUndefined();
198
+ });
199
+
179
200
  it("should handle selected state", () => {
180
201
  const outStyles = {};
181
202
 
@@ -1,4 +1,7 @@
1
- import { parseModalBlocksConfiguration } from "../modalBlocksParser";
1
+ import {
2
+ getEmptyModalBlocksStructure,
3
+ parseModalBlocksConfiguration,
4
+ } from "../modalBlocksParser";
2
5
 
3
6
  // Mock the platform selection logic so it's consistent
4
7
  jest.mock("../../reactUtils", () => ({
@@ -104,4 +107,102 @@ describe("parseModalBlocksConfiguration", () => {
104
107
  expect(result.button.title).toEqual({ default: {} });
105
108
  expect(result.action.leadingIcon).toEqual({ default: {} });
106
109
  });
110
+
111
+ it("should map Studio item.background.focus.* onto focused state", () => {
112
+ const result = parseModalBlocksConfiguration(
113
+ {
114
+ "item.background.default.background_color": "transparent",
115
+ "item.background.focus.background_color": "#FF3B30",
116
+ },
117
+ "playlist-experience"
118
+ );
119
+
120
+ expect(result.item.background.default).toEqual(
121
+ expect.objectContaining({
122
+ backgroundColor: "transparent",
123
+ })
124
+ );
125
+
126
+ expect(result.item.background.focused).toEqual(
127
+ expect.objectContaining({
128
+ backgroundColor: "#FF3B30",
129
+ })
130
+ );
131
+ });
132
+
133
+ it("should accept Studio text_label1 keys without underscore before digit", () => {
134
+ const result = parseModalBlocksConfiguration(
135
+ {
136
+ "item.text_label1.font_color": "#00FF00",
137
+ "item.text_label1.font_size": 28,
138
+ "item.text_label2.font_color": "#00FFFF",
139
+ },
140
+ "playlist-experience"
141
+ );
142
+
143
+ expect(result.item.textLabel1.default).toEqual(
144
+ expect.objectContaining({
145
+ fontColor: "#00FF00",
146
+ fontSize: 28,
147
+ })
148
+ );
149
+
150
+ expect(result.item.textLabel2.default).toEqual(
151
+ expect.objectContaining({
152
+ fontColor: "#00FFFF",
153
+ })
154
+ );
155
+ });
156
+
157
+ it("should ignore keys that do not map to a known block sub-component", () => {
158
+ const result = parseModalBlocksConfiguration(
159
+ {
160
+ "button.create_new_playlist_asset":
161
+ "https://placehold.co/24x24/FF00FF/FFFFFF/png?text=CN",
162
+ "item.checkbox_asset":
163
+ "https://placehold.co/24x24/FF3B30/FFFFFF/png?text=CB",
164
+ "reorder_playlist_item.reorder_handle_asset":
165
+ "https://placehold.co/24x24/FF3B30/FFFFFF/png?text=RH",
166
+ },
167
+ "playlist-experience"
168
+ );
169
+
170
+ expect(result.button.leadingIcon.default?.asset).toBeUndefined();
171
+ expect(result.item.checkbox.default).toBeUndefined();
172
+ expect(result.item.actionButtons.default).toBeUndefined();
173
+ });
174
+ });
175
+
176
+ describe("getEmptyModalBlocksStructure", () => {
177
+ it("should return every block with empty containers and no state entries", () => {
178
+ const result = getEmptyModalBlocksStructure();
179
+
180
+ expect(result.header.container).toEqual({});
181
+ expect(result.item.background).toEqual({});
182
+ expect(result.button.background).toEqual({});
183
+ expect(result.action.background).toEqual({});
184
+
185
+ expect(result.button.leadingIcon.default).toBeUndefined();
186
+ expect(result.item.checkbox.default).toBeUndefined();
187
+ expect(result.item.actionButtons.default).toBeUndefined();
188
+ });
189
+
190
+ it("should return a fresh object on every call", () => {
191
+ const first = getEmptyModalBlocksStructure();
192
+ const second = getEmptyModalBlocksStructure();
193
+
194
+ expect(first).not.toBe(second);
195
+ expect(first.header).not.toBe(second.header);
196
+ expect(first).toEqual(second);
197
+ });
198
+
199
+ it("should be what the parser returns when config or componentName is missing", () => {
200
+ expect(
201
+ parseModalBlocksConfiguration(undefined as any, "queue_action")
202
+ ).toEqual(getEmptyModalBlocksStructure());
203
+
204
+ expect(parseModalBlocksConfiguration({ foo: "bar" }, "")).toEqual(
205
+ getEmptyModalBlocksStructure()
206
+ );
207
+ });
107
208
  });
@@ -11,11 +11,17 @@ const currentPlatform = platformSelect({
11
11
  android_tv: "android",
12
12
  });
13
13
 
14
- // Do not change the order, focused_selected should be first
14
+ // Do not change the order: focused_selected must be first, and "focus" must
15
+ // come *after* "focused". Matching uses startsWith(state + "_"), so putting
16
+ // "focus" first would steal focused_* / focused_selected_* keys. Adding
17
+ // "focus" here affects every getAllSpecificStyles consumer (not only modals);
18
+ // property names that themselves start with focus_ (e.g. focus_font_color as
19
+ // a non-state style) would also be classified as the focus state.
15
20
  const states = [
16
21
  "focused_selected",
17
22
  "pressed",
18
23
  "focused",
24
+ "focus",
19
25
  "selected",
20
26
  "default",
21
27
  ];
@@ -112,6 +118,11 @@ export const getAllSpecificStyles = ({
112
118
  state = defaultKey;
113
119
  }
114
120
 
121
+ // Normalize Studio "focus" keys onto the runtime "focused" state bucket.
122
+ if (state === "focus") {
123
+ state = "focused";
124
+ }
125
+
115
126
  if (!styleName) return;
116
127
 
117
128
  const camelCaseKey = toCamelCase(styleName);
@@ -25,6 +25,10 @@ export type ModalBlocksConfig = {
25
25
  buttonsContainer: Record<string, any>;
26
26
  button1: Record<string, any>;
27
27
  button2: Record<string, any>;
28
+ /** Studio item.checkbox_asset / item.checked_checkbox_asset */
29
+ checkbox?: Record<string, any>;
30
+ /** Studio reorder/remove icons for Edit Order rows */
31
+ actionButtons?: Record<string, any>;
28
32
  };
29
33
  nowPlayingItem?: {
30
34
  background: Record<string, any>;
@@ -37,6 +41,8 @@ export type ModalBlocksConfig = {
37
41
  buttonsContainer: Record<string, any>;
38
42
  button1: Record<string, any>;
39
43
  button2: Record<string, any>;
44
+ checkbox?: Record<string, any>;
45
+ actionButtons?: Record<string, any>;
40
46
  };
41
47
  button: {
42
48
  background: Record<string, any>;
@@ -46,10 +52,7 @@ export type ModalBlocksConfig = {
46
52
  };
47
53
  };
48
54
 
49
- export const parseModalBlocksConfiguration = (
50
- configuration: Record<string, any>,
51
- componentName: string
52
- ): ModalBlocksConfig => {
55
+ export const getEmptyModalBlocksStructure = (): ModalBlocksConfig => {
53
56
  const result: ModalBlocksConfig = {
54
57
  header: {
55
58
  container: {},
@@ -75,6 +78,8 @@ export const parseModalBlocksConfiguration = (
75
78
  buttonsContainer: {},
76
79
  button1: {},
77
80
  button2: {},
81
+ checkbox: {},
82
+ actionButtons: {},
78
83
  },
79
84
  nowPlayingItem: {
80
85
  background: {},
@@ -87,6 +92,8 @@ export const parseModalBlocksConfiguration = (
87
92
  buttonsContainer: {},
88
93
  button1: {},
89
94
  button2: {},
95
+ checkbox: {},
96
+ actionButtons: {},
90
97
  },
91
98
  button: {
92
99
  background: {},
@@ -96,6 +103,15 @@ export const parseModalBlocksConfiguration = (
96
103
  },
97
104
  };
98
105
 
106
+ return result;
107
+ };
108
+
109
+ export const parseModalBlocksConfiguration = (
110
+ configuration: Record<string, any>,
111
+ componentName: string
112
+ ): ModalBlocksConfig => {
113
+ const result = getEmptyModalBlocksStructure();
114
+
99
115
  if (!configuration || !componentName) {
100
116
  return result;
101
117
  }
@@ -152,8 +168,12 @@ export const parseModalBlocksConfiguration = (
152
168
  "now_playing_container",
153
169
  "now_playing_asset",
154
170
  "now_playing_label",
171
+ // Underscored form (QB convention) and Studio/manifest-generator form
172
+ // without the underscore before the digit (text_label1).
155
173
  "text_label_1",
156
174
  "text_label_2",
175
+ "text_label1",
176
+ "text_label2",
157
177
  "buttons_container",
158
178
  "button_1",
159
179
  "button_2",
@@ -167,6 +187,8 @@ export const parseModalBlocksConfiguration = (
167
187
  "now_playing_label",
168
188
  "text_label_1",
169
189
  "text_label_2",
190
+ "text_label1",
191
+ "text_label2",
170
192
  "buttons_container",
171
193
  "button_1",
172
194
  "button_2",
@@ -60,7 +60,7 @@ describe("buildEntryActions - alias & label resolution", () => {
60
60
  expect(state.label).toBe("Label Property Action");
61
61
  });
62
62
 
63
- it("resolves entry action with known backend button alias (e.g. add_all_to_queue)", () => {
63
+ it("humanizes an un-overridden alias and falls back to the placeholder asset", () => {
64
64
  const entry = {
65
65
  id: "entry-3",
66
66
  extensions: {
@@ -71,11 +71,7 @@ describe("buildEntryActions - alias & label resolution", () => {
71
71
  dismiss_on_action: true,
72
72
  },
73
73
  {
74
- button: { alias: "add_to_playlist" },
75
- actions: [{ type: "test" }],
76
- },
77
- {
78
- button: { alias: "delete_collection" },
74
+ button: { alias: "custom_unknown_action" },
79
75
  actions: [{ type: "test" }],
80
76
  },
81
77
  ],
@@ -84,42 +80,86 @@ describe("buildEntryActions - alias & label resolution", () => {
84
80
 
85
81
  const actions = resolveEntryActions(entry as any);
86
82
 
87
- expect(actions).toHaveLength(3);
83
+ expect(actions).toHaveLength(2);
88
84
 
85
+ // No built-in alias vocabulary any more: underscores become spaces and
86
+ // only the first letter is capitalized, so "queue" stays lowercase.
89
87
  expect(actions[0].action.initialEntryState(entry as any)).toMatchObject({
90
88
  state: 0,
91
- label: "Add all to Queue",
89
+ label: "Add all to queue",
92
90
  });
93
91
 
94
92
  expect(actions[1].action.initialEntryState(entry as any)).toMatchObject({
95
93
  state: 0,
96
- label: "Add to Playlist",
94
+ label: "Custom unknown action",
97
95
  });
98
96
 
99
- expect(actions[2].action.initialEntryState(entry as any)).toMatchObject({
100
- state: 0,
101
- label: "Delete collection",
102
- });
97
+ // The asset has no such fallback: without an override it is the red-box
98
+ // placeholder, so a missing Studio icon is visible rather than absent.
99
+ for (const action of actions) {
100
+ expect(action.action.initialEntryState(entry as any)).toMatchObject({
101
+ asset: expect.stringMatching(/^data:image\/png;base64,/),
102
+ });
103
+ }
103
104
  });
104
105
 
105
- it("formats unknown alias nicely as fallback", () => {
106
+ it("prefers aliasPresentation overrides over the humanized fallbacks", () => {
107
+ const deps = {
108
+ actionExecutor: { handleActions: jest.fn() } as any,
109
+ actionContext: {},
110
+ aliasPresentation: {
111
+ labels: { add_all_to_queue: "Add all to Queue" },
112
+ assets: { add_all_to_queue: "http://example.com/queue.png" },
113
+ },
114
+ };
115
+
106
116
  const entry = {
107
117
  id: "entry-4",
108
118
  extensions: {
109
119
  entry_action: [
110
120
  {
111
- button: { alias: "custom_unknown_action" },
121
+ button: { alias: "add_all_to_queue" },
122
+ actions: [{ type: "test" }],
123
+ },
124
+ {
125
+ button: { alias: "not_overridden" },
112
126
  actions: [{ type: "test" }],
113
127
  },
114
128
  ],
115
129
  },
116
130
  };
117
131
 
118
- const actions = resolveEntryActions(entry as any);
132
+ const actions = buildEntryActions(entry as any, deps);
119
133
 
120
- expect(actions).toHaveLength(1);
134
+ expect(actions[0].action.initialEntryState(entry as any)).toMatchObject({
135
+ label: "Add all to Queue",
136
+ asset: "http://example.com/queue.png",
137
+ });
138
+
139
+ // Overrides are per-alias, so an alias absent from the map still humanizes.
140
+ expect(actions[1].action.initialEntryState(entry as any)).toMatchObject({
141
+ label: "Not overridden",
142
+ });
143
+ });
144
+
145
+ it("returns no asset when the button has neither iconURL nor alias", () => {
146
+ const entry = {
147
+ id: "entry-5",
148
+ extensions: {
149
+ entry_action: [
150
+ {
151
+ button: { label: "Plain Label" },
152
+ actions: [{ type: "test" }],
153
+ },
154
+ ],
155
+ },
156
+ };
157
+
158
+ const actions = resolveEntryActions(entry as any);
121
159
  const state = actions[0].action.initialEntryState(entry as any);
122
- expect(state.label).toBe("Custom unknown action");
160
+
161
+ expect(state.label).toBe("Plain Label");
162
+ expect(state.asset).toBeUndefined();
123
163
  });
124
164
 
125
165
  it("uses actionExecutor.getActionState for plugin-provided label and asset", () => {
@@ -154,3 +194,42 @@ describe("buildEntryActions - alias & label resolution", () => {
154
194
  });
155
195
  });
156
196
  });
197
+
198
+ describe("buildEntryActions - invokeAction execution context", () => {
199
+ it("forwards the List component from invoke options into handleActions", async () => {
200
+ const handleActions = jest.fn();
201
+
202
+ const component = {
203
+ id: "list-1",
204
+ data: { source: "https://example.com/user/collections/abc" },
205
+ };
206
+
207
+ const deps = {
208
+ actionExecutor: { handleActions } as any,
209
+ actionContext: { screenData: { id: "playlist-screen" } },
210
+ };
211
+
212
+ const entry = {
213
+ id: "entry-1",
214
+ extensions: {
215
+ entry_action: [
216
+ {
217
+ button: { title: "Edit Name" },
218
+ actions: [{ type: "refreshComponent" }],
219
+ },
220
+ ],
221
+ },
222
+ };
223
+
224
+ const [action] = buildEntryActions(entry as any, deps);
225
+
226
+ await action.action.invokeAction(entry as any, { component });
227
+
228
+ expect(handleActions).toHaveBeenCalledWith([{ type: "refreshComponent" }], {
229
+ entry,
230
+ entryContext: entry,
231
+ screenData: { id: "playlist-screen" },
232
+ component,
233
+ });
234
+ });
235
+ });
@@ -1,52 +1,29 @@
1
1
  /**
2
- * Presentation defaults for backend action aliases.
2
+ * Presentation fallbacks for backend action aliases.
3
3
  *
4
4
  * Entries may declare an action by `alias` alone, without a label or an icon.
5
- * These maps are the last-resort labels/icons for the aliases we know about; an
6
- * unknown alias falls back to a humanized version of the alias itself.
5
+ * There is no built-in alias vocabulary: a label falls back to a humanized
6
+ * version of the alias itself, and an icon falls back to an inline placeholder
7
+ * that is deliberately conspicuous, so a missing asset reads as unconfigured
8
+ * rather than as a deliberate blank.
7
9
  *
8
- * They are defaults, not a framework guarantee: an app that speaks a different
9
- * alias vocabulary, needs other languages, or does not want to depend on these
10
- * icon hosts passes its own through `EntryActionDeps.aliasPresentation`.
10
+ * Both are last resorts, not a framework guarantee: an app that speaks its own
11
+ * alias vocabulary or needs other languages passes labels and assets through
12
+ * `EntryActionDeps.aliasPresentation`, which is consulted per alias.
11
13
  */
12
14
 
13
15
  import { EntryAction } from "./types";
14
16
 
15
- const ADD_TO_PLAYLIST_ICON =
16
- "https://assets-secure.applicaster.com/zapp/assets/app_family/1710/906728572617/playlist_add_24dp_FFFFFF_FILL0_wght400_GRAD0_opsz24.png";
17
-
18
- const REMOVE_ICON =
19
- "https://assets-secure.applicaster.com/zapp/assets/app_family/1710/372097240191/remove_24dp_EA3323_FILL0_wght400_GRAD0_opsz24.png";
20
-
21
- const EDIT_ICON =
22
- "https://upload.wikimedia.org/wikipedia/commons/b/b6/Edit-icon.png";
23
-
24
- /** Known backend action alias labels. */
25
- export const ALIAS_LABELS: Record<string, string> = {
26
- add_to_playlist: "Add to Playlist",
27
- add_to_queue: "Add to Queue",
28
- add_all_to_queue: "Add all to Queue",
29
- play_all: "Play All",
30
- remove_item: "Remove item",
31
- delete_collection: "Delete collection",
32
- create_collection: "Create collection",
33
- edit: "Edit",
34
- edit_name: "Edit Name & Details",
35
- };
17
+ import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
36
18
 
37
- /** Known backend action alias image assets. */
38
- export const ALIAS_ASSETS: Record<string, string> = {
39
- add_to_playlist: ADD_TO_PLAYLIST_ICON,
40
- add_to_queue: ADD_TO_PLAYLIST_ICON,
41
- add_all_to_queue: ADD_TO_PLAYLIST_ICON,
42
- play_all: ADD_TO_PLAYLIST_ICON,
43
- remove_item: REMOVE_ICON,
44
- delete_collection: REMOVE_ICON,
45
- edit: EDIT_ICON,
46
- edit_name: EDIT_ICON,
47
- };
19
+ const logger = createLogger({
20
+ category: "zapp-react-native-utils:aliasPresentation",
21
+ });
22
+
23
+ const PLACEHOLDER_RED_BOX =
24
+ "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAJ0lEQVR4nO3NMQEAAAjDsIF/z2ACvlRAU5NMHuvPOQAAAAAAAMBdC/07Ai5sNw+CAAAAAElFTkSuQmCC";
48
25
 
49
- /** Per-app overrides for the maps above. */
26
+ /** Per-app labels and icons, keyed by alias, that outrank the fallbacks. */
50
27
  export type AliasPresentation = {
51
28
  labels?: Record<string, string>;
52
29
  assets?: Record<string, string>;
@@ -56,7 +33,7 @@ function formatAliasLabel(
56
33
  alias: string,
57
34
  overrides?: AliasPresentation
58
35
  ): string {
59
- const label = overrides?.labels?.[alias] ?? ALIAS_LABELS[alias];
36
+ const label = overrides?.labels?.[alias];
60
37
 
61
38
  if (label) {
62
39
  return label;
@@ -107,7 +84,7 @@ export function resolveButtonLabel(
107
84
  return "";
108
85
  }
109
86
 
110
- /** Icon to show for an entry action: explicit iconURL, else the alias default. */
87
+ /** Icon to show for an entry action: explicit iconURL, matching alias asset or fallback to red box. */
111
88
  export function resolveButtonAsset(
112
89
  button: EntryAction["button"],
113
90
  overrides?: AliasPresentation
@@ -120,5 +97,12 @@ export function resolveButtonAsset(
120
97
  return undefined;
121
98
  }
122
99
 
123
- return overrides?.assets?.[button.alias] ?? ALIAS_ASSETS[button.alias];
100
+ if (!overrides?.assets?.[button.alias]) {
101
+ logger.log_warning(
102
+ `Entry action alias '${button.alias}' was not resolved by any plugin feedDecorator or app override. Falling back to placeholder red box.`,
103
+ { data: { button } }
104
+ );
105
+ }
106
+
107
+ return overrides?.assets?.[button.alias] ?? PLACEHOLDER_RED_BOX;
124
108
  }
@@ -105,6 +105,7 @@ function createEntryAction(
105
105
  entry: invokedEntry,
106
106
  entryContext: invokedEntry,
107
107
  ...deps.actionContext,
108
+ ...(options.component ? { component: options.component } : {}),
108
109
  } as ActionExecutionContext);
109
110
  } catch (error) {
110
111
  log_error(
@@ -1,8 +1,6 @@
1
1
  export { buildEntryActions, isEntryAction } from "./buildEntryActions";
2
2
 
3
3
  export {
4
- ALIAS_ASSETS,
5
- ALIAS_LABELS,
6
4
  resolveButtonAsset,
7
5
  resolveButtonLabel,
8
6
  resolveExplicitLabel,
@@ -12,6 +12,12 @@ const generalContent = () => ({
12
12
  label: "Navigation Bar",
13
13
  placeholder: "Choose Nav Bar",
14
14
  },
15
+ {
16
+ key: "hide_menu",
17
+ type: "switch",
18
+ label: "Hide Menu",
19
+ initial_value: false,
20
+ },
15
21
  ],
16
22
  },
17
23
  styles: {