@applicaster/zapp-react-native-utils 16.0.0-rc.32 → 16.0.0-rc.34

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 (29) hide show
  1. package/actionsExecutor/ActionExecutor.ts +8 -10
  2. package/actionsExecutor/ActionExecutorContext.tsx +38 -345
  3. package/actionsExecutor/actions/appRestart.ts +24 -0
  4. package/actionsExecutor/actions/confirmDialog.ts +53 -0
  5. package/actionsExecutor/actions/index.ts +28 -0
  6. package/actionsExecutor/actions/localStorageRemove.ts +27 -0
  7. package/actionsExecutor/actions/localStorageSet.ts +28 -0
  8. package/actionsExecutor/actions/localStorageToggleFlag.ts +28 -0
  9. package/actionsExecutor/actions/navigateToScreen.ts +123 -0
  10. package/actionsExecutor/actions/refreshComponent.ts +94 -0
  11. package/actionsExecutor/actions/screenSetVariable.ts +35 -0
  12. package/actionsExecutor/actions/screenToggleFlag.ts +38 -0
  13. package/actionsExecutor/actions/sendCloudEvent.ts +88 -0
  14. package/actionsExecutor/actions/sessionStorageRemove.ts +19 -0
  15. package/actionsExecutor/actions/sessionStorageSet.ts +20 -0
  16. package/actionsExecutor/actions/sessionStorageToggleFlag.ts +15 -0
  17. package/actionsExecutor/actions/switchLayout.ts +40 -0
  18. package/actionsExecutor/types.ts +57 -0
  19. package/appUtils/contextKeysManager/__tests__/getKey/failure.test.ts +1 -1
  20. package/appUtils/contextKeysManager/__tests__/removeKey/failure.test.ts +1 -1
  21. package/appUtils/contextKeysManager/__tests__/setKey/failure/invalidKey.test.ts +4 -4
  22. package/appUtils/contextKeysManager/index.ts +1 -1
  23. package/manifestUtils/keys.js +8 -0
  24. package/manifestUtils/mobileAction/button/index.js +16 -0
  25. package/manifestUtils/mobileAction/container/index.js +3 -1
  26. package/manifestUtils/mobileAction/groups/defaults.js +3 -1
  27. package/package.json +2 -2
  28. package/reactHooks/actions/index.ts +51 -1
  29. package/uiActionsRegistrator/index.ts +203 -0
@@ -0,0 +1,123 @@
1
+ /// <reference types="@applicaster/applicaster-types" />
2
+ import { ActionResult } from "../ActionExecutor";
3
+ import { ActionHandler, ActionExecutionContext } from "../types";
4
+ import { createLogger } from "../../logger";
5
+
6
+ const { log_info, log_error } = createLogger({
7
+ subsystem: "ActionExecutorContext",
8
+ category: "General",
9
+ });
10
+
11
+ /**
12
+ * Options for the navigateToScreen action.
13
+ */
14
+ export interface NavigateToScreenOptions {
15
+ /** The screen type to navigate to (from content types mapping) */
16
+ typeMapping: string;
17
+
18
+ /** Navigation action: push adds to history, replace replaces current screen */
19
+ navigationAction?: "push" | "replace";
20
+
21
+ /**
22
+ * Entry to navigate with. Can be:
23
+ * - "@{entry/}" to use the context entry
24
+ * - A ZappEntry object
25
+ * - undefined to navigate to screen without entry
26
+ */
27
+ entry?: "@{entry/}" | ZappEntry;
28
+ }
29
+
30
+ /**
31
+ * Creates a navigation action handler with the provided dependencies.
32
+ * This factory pattern allows the action to access navigation state at runtime.
33
+ *
34
+ * @param navigator - The app navigator for push/replace operations
35
+ * @param rivers - Map of screen IDs to river definitions
36
+ * @param contentTypes - Map of content type names to screen configurations
37
+ * @returns An action handler that performs screen navigation
38
+ */
39
+ export function createNavigateToScreenAction(
40
+ navigator: QuickBrickAppNavigator,
41
+ rivers: Record<string, ZappRiver>,
42
+ contentTypes: ZappContentTypes
43
+ ): ActionHandler<NavigateToScreenOptions> {
44
+ return async function navigateToScreenAction(
45
+ action,
46
+ context?: ActionExecutionContext
47
+ ): Promise<ActionResult> {
48
+ const screenType = action.options?.typeMapping;
49
+
50
+ if (!screenType) {
51
+ log_error("navigateToScreen: typeMapping option is missing");
52
+
53
+ return ActionResult.Error;
54
+ }
55
+
56
+ const navigationAction = action.options?.navigationAction;
57
+ const entrySource = action.options?.entry;
58
+
59
+ const entry = entrySource
60
+ ? entrySource === "@{entry/}"
61
+ ? context?.entry
62
+ : entrySource
63
+ : null;
64
+
65
+ if (entry) {
66
+ if (typeof entry !== "object") {
67
+ log_error(
68
+ `navigateToScreen: entry option is not an object, entry: ${entry}`
69
+ );
70
+
71
+ return ActionResult.Error;
72
+ }
73
+
74
+ log_info(
75
+ `navigateToScreen: navigating to screen type: ${screenType} with entry id: ${entry.id}`
76
+ );
77
+
78
+ const overriddenEntry: ZappEntry = {
79
+ ...entry,
80
+ type: {
81
+ value: screenType,
82
+ },
83
+ };
84
+
85
+ if (navigationAction === "push") {
86
+ navigator.push(overriddenEntry);
87
+ } else {
88
+ // Use replaceTop for entries since replace() only accepts ZappRiver
89
+ navigator.replaceTop(overriddenEntry);
90
+ }
91
+
92
+ return ActionResult.Success;
93
+ }
94
+
95
+ const screenId = contentTypes?.[screenType]?.screen_id || null;
96
+
97
+ if (!screenId) {
98
+ log_error(
99
+ `navigateToScreen: can not resolve screen type mapping: ${screenType}`
100
+ );
101
+
102
+ return ActionResult.Error;
103
+ }
104
+
105
+ const river = rivers[screenId];
106
+
107
+ if (!river) {
108
+ log_error("navigateToScreen: can not resolve river");
109
+
110
+ return ActionResult.Error;
111
+ }
112
+
113
+ context?.callback?.({ success: false, error: null, abort: true });
114
+
115
+ if (navigationAction === "push") {
116
+ navigator.push(river);
117
+ } else {
118
+ navigator.replace(river);
119
+ }
120
+
121
+ return ActionResult.Success;
122
+ };
123
+ }
@@ -0,0 +1,94 @@
1
+ /// <reference types="@applicaster/applicaster-types" />
2
+ import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
3
+ import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
4
+ import {
5
+ getInflatedDataSourceUrl,
6
+ getSearchContext,
7
+ } from "../../reactHooks/feed/useInflatedUrl";
8
+ import { ActionResult } from "../ActionExecutor";
9
+ import { ActionHandler, ActionExecutionContext } from "../types";
10
+ import { createLogger } from "../../logger";
11
+
12
+ const { log_info } = createLogger({
13
+ subsystem: "ActionExecutorContext",
14
+ category: "General",
15
+ });
16
+
17
+ /**
18
+ * Helper function to find the parent component in a component tree.
19
+ */
20
+ function findParentComponent(
21
+ childId: string,
22
+ parent: ZappRiver | ZappUIComponent
23
+ ): ZappRiver | ZappUIComponent | null {
24
+ for (const child of parent.ui_components) {
25
+ if (child.id === childId) return parent;
26
+
27
+ if (child.ui_components) {
28
+ const found = findParentComponent(childId, child);
29
+ if (found) return found;
30
+ }
31
+ }
32
+
33
+ return null;
34
+ }
35
+
36
+ /**
37
+ * Refreshes a component's data by reloading its data source.
38
+ * Supports URL inflation with context variables.
39
+ */
40
+ export const refreshComponentAction: ActionHandler = async (
41
+ _action,
42
+ context?: ActionExecutionContext
43
+ ): Promise<ActionResult> => {
44
+ const dispatch = appStore.getDispatch();
45
+
46
+ const parentComponent = findParentComponent(
47
+ context?.component?.id,
48
+ context?.screenData
49
+ );
50
+
51
+ const componentSource = context?.component?.data?.source;
52
+
53
+ const componentData = componentSource
54
+ ? context.component.data
55
+ : parentComponent?.data;
56
+
57
+ const source = componentData?.source;
58
+ const mapping = componentData?.mapping;
59
+
60
+ let dataSource = source;
61
+
62
+ if (source && mapping) {
63
+ dataSource =
64
+ getInflatedDataSourceUrl({
65
+ source,
66
+ contexts: {
67
+ entry: context?.screenEntry,
68
+ screen: context?.screenData,
69
+ search: getSearchContext(null, mapping),
70
+ },
71
+ mapping,
72
+ }) || source;
73
+ }
74
+
75
+ log_info(`handleAction: refreshComponent for dataSource:${dataSource}`, {
76
+ source,
77
+ inflatedUrl: dataSource,
78
+ mapping,
79
+ entryContextId: context?.entryContext?.id,
80
+ entryId: context?.entry?.id,
81
+ });
82
+
83
+ // TODO: In theory we should wait callback to complete, before completing the action, but now it's not needed
84
+ // TODO: handle focused item removal
85
+ dispatch(
86
+ loadPipesData(dataSource, {
87
+ silentRefresh: false,
88
+ clearCache: true,
89
+ riverId: context?.screenData?.id,
90
+ })
91
+ );
92
+
93
+ return ActionResult.Success;
94
+ };
@@ -0,0 +1,35 @@
1
+ /// <reference types="@applicaster/applicaster-types" />
2
+ import { screenSetVariable } from "../ScreenActions";
3
+ import { ActionResult } from "../ActionExecutor";
4
+ import { ActionHandler, ActionExecutionContext } from "../types";
5
+
6
+ /**
7
+ * Options for screenSetVariable action.
8
+ */
9
+ export interface ScreenSetVariableOptions {
10
+ /** The key/namespace for storing the variable */
11
+ key: string;
12
+
13
+ /** Path to extract the value from entry */
14
+ selector?: string;
15
+ }
16
+
17
+ /**
18
+ * Sets a variable in screen state storage.
19
+ * The value is extracted from the entry using the selector option.
20
+ */
21
+ export const screenSetVariableAction: ActionHandler<
22
+ ScreenSetVariableOptions
23
+ > = async (action, context?: ActionExecutionContext): Promise<ActionResult> => {
24
+ const route = context?.screenRoute;
25
+ const screenStateStore = context?.screenStateStore;
26
+
27
+ await screenSetVariable(
28
+ route,
29
+ screenStateStore,
30
+ { entry: context?.entry, options: action.options },
31
+ action
32
+ );
33
+
34
+ return ActionResult.Success;
35
+ };
@@ -0,0 +1,38 @@
1
+ /// <reference types="@applicaster/applicaster-types" />
2
+ import { screenToggleFlag } from "../ScreenActions";
3
+ import { ActionResult } from "../ActionExecutor";
4
+ import { ActionHandler, ActionExecutionContext } from "../types";
5
+
6
+ /**
7
+ * Options for screenToggleFlag action.
8
+ */
9
+ export interface ScreenToggleFlagOptions {
10
+ /** The key/namespace for storing the flag */
11
+ key: string;
12
+
13
+ /** Path to extract the tag from entry (e.g., "extensions.tag") */
14
+ selector?: string;
15
+
16
+ /** Maximum number of items that can be selected */
17
+ max_items?: number;
18
+ }
19
+
20
+ /**
21
+ * Toggles a flag in screen state storage (adds or removes an item from a collection).
22
+ * Useful for screen-level multi-select functionality.
23
+ */
24
+ export const screenToggleFlagAction: ActionHandler<
25
+ ScreenToggleFlagOptions
26
+ > = async (action, context?: ActionExecutionContext): Promise<ActionResult> => {
27
+ const screenRoute = context?.screenRoute;
28
+ const screenStateStore = context?.screenStateStore;
29
+
30
+ await screenToggleFlag(
31
+ screenRoute,
32
+ screenStateStore,
33
+ { entry: context?.entry, options: action.options },
34
+ action
35
+ );
36
+
37
+ return ActionResult.Success;
38
+ };
@@ -0,0 +1,88 @@
1
+ /// <reference types="@applicaster/applicaster-types" />
2
+ import { createCloudEvent, sendCloudEvent } from "../../cloudEventsUtils";
3
+ import {
4
+ EntryResolver,
5
+ resolveObjectValues,
6
+ } from "../../appUtils/contextKeysManager/contextResolver";
7
+ import { ActionResult } from "../ActionExecutor";
8
+ import { ActionHandler, ActionExecutionContext } from "../types";
9
+ import { createLogger } from "../../logger";
10
+
11
+ const { log_info, log_error } = createLogger({
12
+ subsystem: "ActionExecutorContext",
13
+ category: "General",
14
+ });
15
+
16
+ /**
17
+ * Options for the sendCloudEvent action.
18
+ */
19
+ export interface SendCloudEventOptions {
20
+ /** The cloud event type (defaults to "com.applicaster.selector.action.v1") */
21
+ type?: string;
22
+
23
+ /** The event data payload */
24
+ data?: Record<string, any>;
25
+
26
+ /** The event subject (defaults to entry.id) */
27
+ subject?: string;
28
+
29
+ /** The URL endpoint to send the event to */
30
+ url: string;
31
+
32
+ /** Whether to inflate data with context variables */
33
+ inflateData?: boolean;
34
+ }
35
+
36
+ /**
37
+ * Sends a cloud event to a remote endpoint.
38
+ * Supports data inflation using context variables from entry and screen.
39
+ */
40
+ export const sendCloudEventAction: ActionHandler<
41
+ SendCloudEventOptions
42
+ > = async (action, context?: ActionExecutionContext): Promise<ActionResult> => {
43
+ try {
44
+ const options = action.options as SendCloudEventOptions;
45
+
46
+ const entry = context?.entry || {};
47
+ const entryResolver = new EntryResolver(entry as ZappEntry);
48
+ const screenData = context?.screenStateStore?.getState?.()?.data || {};
49
+ const screenResolver = new EntryResolver(screenData as ZappEntry);
50
+
51
+ const data =
52
+ options?.data && options.inflateData
53
+ ? await resolveObjectValues(options.data, {
54
+ entry: entryResolver,
55
+ screen: screenResolver,
56
+ })
57
+ : options?.data || entry;
58
+
59
+ const cloudEvent = await createCloudEvent({
60
+ type: options.type || "com.applicaster.selector.action.v1",
61
+ data,
62
+ subject: options.subject || String((entry as ZappEntry)?.id || ""),
63
+ });
64
+
65
+ log_info("handleAction: sendCloudEvent event", { cloudEvent });
66
+
67
+ const { error, code } = await sendCloudEvent(cloudEvent, options.url);
68
+
69
+ if (error) {
70
+ log_error("sendCloudEvent: error sending cloud event", { error });
71
+
72
+ return ActionResult.Error;
73
+ }
74
+
75
+ if (code && code >= 200 && code < 300 && !error) {
76
+ log_info("sendCloudEvent: cloud event sent successfully");
77
+
78
+ return ActionResult.Success;
79
+ }
80
+ } catch (error) {
81
+ log_error("sendCloudEvent: error sending cloud event", {
82
+ action,
83
+ error,
84
+ });
85
+ }
86
+
87
+ return ActionResult.Error;
88
+ };
@@ -0,0 +1,19 @@
1
+ /// <reference types="@applicaster/applicaster-types" />
2
+ import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
3
+ import { batchRemoveFromStorage } from "../../zappFrameworkUtils/localStorageHelper";
4
+ import { ActionResult } from "../ActionExecutor";
5
+ import { ActionHandler } from "../types";
6
+ import { StorageRemoveOptions } from "./localStorageRemove";
7
+
8
+ /**
9
+ * Removes values from session storage organized by namespaces.
10
+ */
11
+ export const sessionStorageRemoveAction: ActionHandler<
12
+ StorageRemoveOptions
13
+ > = async (action): Promise<ActionResult> => {
14
+ const namespaces = action.options.content;
15
+ await batchRemoveFromStorage(namespaces, sessionStorage);
16
+ // TODO: Add support for ownershipKey and ownershipNamespace
17
+
18
+ return ActionResult.Success;
19
+ };
@@ -0,0 +1,20 @@
1
+ /// <reference types="@applicaster/applicaster-types" />
2
+ import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
3
+ import { batchSave } from "../../zappFrameworkUtils/localStorageHelper";
4
+ import { ActionResult } from "../ActionExecutor";
5
+ import { ActionHandler } from "../types";
6
+ import { StorageSetOptions } from "./localStorageSet";
7
+
8
+ /**
9
+ * Saves values to session storage organized by namespaces.
10
+ * The values persist only for the current app session.
11
+ */
12
+ export const sessionStorageSetAction: ActionHandler<StorageSetOptions> = async (
13
+ action
14
+ ): Promise<ActionResult> => {
15
+ const namespaces = (action.options as StorageSetOptions).content;
16
+ await batchSave(namespaces, sessionStorage);
17
+ // TODO: Add support for ownershipKey and ownershipNamespace
18
+
19
+ return ActionResult.Success;
20
+ };
@@ -0,0 +1,15 @@
1
+ /// <reference types="@applicaster/applicaster-types" />
2
+ import { sessionStorageToggleFlag } from "../StorageActions";
3
+ import { ActionResult } from "../ActionExecutor";
4
+ import { ActionHandler, ActionExecutionContext } from "../types";
5
+ import { StorageToggleFlagOptions } from "./localStorageToggleFlag";
6
+
7
+ /**
8
+ * Toggles a flag in session storage (adds or removes an item from a collection).
9
+ * Values persist only for the current app session.
10
+ */
11
+ export const sessionStorageToggleFlagAction: ActionHandler<
12
+ StorageToggleFlagOptions
13
+ > = async (action, context?: ActionExecutionContext): Promise<ActionResult> => {
14
+ return await sessionStorageToggleFlag(context, action);
15
+ };
@@ -0,0 +1,40 @@
1
+ /// <reference types="@applicaster/applicaster-types" />
2
+ import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
3
+ import * as QuickBrickManager from "@applicaster/zapp-react-native-bridge/QuickBrick";
4
+ import { QUICK_BRICK_EVENTS } from "@applicaster/zapp-react-native-bridge/QuickBrick";
5
+ import { ACTIVE_LAYOUT_ID_STORAGE_KEY } from "@applicaster/quick-brick-core/App/remoteContextReloader/consts";
6
+ import { ActionResult } from "../ActionExecutor";
7
+ import { ActionHandler } from "../types";
8
+ import { createLogger } from "../../logger";
9
+
10
+ const { log_info } = createLogger({
11
+ subsystem: "ActionExecutorContext",
12
+ category: "General",
13
+ });
14
+
15
+ /**
16
+ * Options for the switchLayout action.
17
+ */
18
+ export interface SwitchLayoutOptions {
19
+ /** The ID of the layout to switch to */
20
+ layoutId: string;
21
+ }
22
+
23
+ /**
24
+ * Switches the active layout and triggers an app reload.
25
+ * Saves the new layout ID to local storage before reloading.
26
+ */
27
+ export const switchLayoutAction: ActionHandler<SwitchLayoutOptions> = async (
28
+ action
29
+ ): Promise<ActionResult> => {
30
+ log_info("handleAction: switchLayout event");
31
+
32
+ await localStorage.setItem(
33
+ ACTIVE_LAYOUT_ID_STORAGE_KEY,
34
+ action.options.layoutId
35
+ );
36
+
37
+ QuickBrickManager.sendQuickBrickEvent(QUICK_BRICK_EVENTS.FORCE_APP_RELOAD);
38
+
39
+ return ActionResult.Success;
40
+ };
@@ -0,0 +1,57 @@
1
+ /// <reference types="@applicaster/applicaster-types" />
2
+ import { ActionResult } from "./ActionExecutor";
3
+ import { useScreenStateStore } from "../reactHooks/navigation/useScreenStateStore";
4
+
5
+ /**
6
+ * Base context object passed to action handlers during execution.
7
+ * Contains references to the current entry, screen, and other execution state.
8
+ */
9
+ export interface ActionExecutionContext {
10
+ /** The entry associated with this action (e.g., the item that was tapped) */
11
+ entry?: ZappEntry;
12
+
13
+ /** The current screen/river data */
14
+ screenData?: ZappRiver;
15
+
16
+ /** The entry that defines the screen (if screen was opened from an entry) */
17
+ screenEntry?: ZappEntry;
18
+
19
+ /** The UI component that triggered the action */
20
+ component?: ZappUIComponent;
21
+
22
+ /** The route identifier for the current screen */
23
+ screenRoute?: string;
24
+
25
+ /** The screen state store for managing screen-level state (Zustand store) */
26
+ screenStateStore?: ReturnType<typeof useScreenStateStore>;
27
+
28
+ /** Context entry for additional data */
29
+ entryContext?: ZappEntry;
30
+
31
+ /** Callback function for action completion */
32
+ callback?: (result: { success: boolean; error: any; abort: boolean }) => void;
33
+
34
+ screenState: Record<any, any>;
35
+ }
36
+
37
+ /**
38
+ * Type for action handler functions.
39
+ * Handlers receive the action (which may have typed options) and execution context.
40
+ *
41
+ * @template _TOptions - Optional type hint for the action's options object (for documentation/intellisense)
42
+ * @param action - The action to execute
43
+ * @param context - The execution context
44
+ * @returns A promise that resolves to the action result
45
+ */
46
+ export type ActionHandler<_TOptions = any> = (
47
+ action: ActionType,
48
+ context?: ActionExecutionContext
49
+ ) => Promise<ActionResult>;
50
+
51
+ /**
52
+ * Factory function that creates an action handler.
53
+ * Used for actions that need to capture dependencies at registration time.
54
+ */
55
+ export type ActionHandlerFactory<_TOptions = any> = (
56
+ ...dependencies: any[]
57
+ ) => ActionHandler<_TOptions>;
@@ -46,7 +46,7 @@ describe("Context Keys Manager - getKey", () => {
46
46
 
47
47
  expect(mockedLogger.warn).toHaveBeenCalledWith({
48
48
  message:
49
- "Provided key is not valid - expecing an object with namespace and key properties",
49
+ "Provided key is not valid - expecting an object with namespace and key properties",
50
50
  data: { key: invalidKey },
51
51
  });
52
52
 
@@ -47,7 +47,7 @@ describe("Context Keys Manager - removeKey", () => {
47
47
 
48
48
  expect(mockedLogger.warn).toHaveBeenCalledWith({
49
49
  message:
50
- "Provided key is not valid - expecing an object with namespace and key properties",
50
+ "Provided key is not valid - expecting an object with namespace and key properties",
51
51
  data: { key },
52
52
  });
53
53
 
@@ -48,7 +48,7 @@ describe("Context Keys Manager - setKey", () => {
48
48
 
49
49
  expect(mockedLogger.warn).toHaveBeenCalledWith({
50
50
  message:
51
- "Provided key is not valid - expecing an object with namespace and key properties",
51
+ "Provided key is not valid - expecting an object with namespace and key properties",
52
52
  data: { key },
53
53
  });
54
54
 
@@ -105,7 +105,7 @@ describe("Context Keys Manager - setKey", () => {
105
105
 
106
106
  expect(mockedLogger.warn).toHaveBeenCalledWith({
107
107
  message:
108
- "Provided key is not valid - expecing an object with namespace and key properties",
108
+ "Provided key is not valid - expecting an object with namespace and key properties",
109
109
  data: { key },
110
110
  });
111
111
 
@@ -162,7 +162,7 @@ describe("Context Keys Manager - setKey", () => {
162
162
 
163
163
  expect(mockedLogger.warn).toHaveBeenCalledWith({
164
164
  message:
165
- "Provided key is not valid - expecing an object with namespace and key properties",
165
+ "Provided key is not valid - expecting an object with namespace and key properties",
166
166
  data: { key },
167
167
  });
168
168
 
@@ -217,7 +217,7 @@ describe("Context Keys Manager - setKey", () => {
217
217
 
218
218
  expect(mockedLogger.warn).toHaveBeenCalledWith({
219
219
  message:
220
- "Provided key is not valid - expecing an object with namespace and key properties",
220
+ "Provided key is not valid - expecting an object with namespace and key properties",
221
221
  data: { key },
222
222
  });
223
223
 
@@ -109,7 +109,7 @@ export class ContextKeysManager {
109
109
  if (!keyIsValid(parsedKey)) {
110
110
  this._logger.warn({
111
111
  message:
112
- "Provided key is not valid - expecing an object with namespace and key properties",
112
+ "Provided key is not valid - expecting an object with namespace and key properties",
113
113
  data: { key },
114
114
  });
115
115
 
@@ -631,6 +631,14 @@ const MOBILE_ACTION_BUTTON_FIELDS = [
631
631
  type: ZAPPIFEST_FIELDS.number_input,
632
632
  suffix: "margin left",
633
633
  },
634
+ {
635
+ type: ZAPPIFEST_FIELDS.number_input,
636
+ suffix: "horizontal gutter",
637
+ },
638
+ {
639
+ type: ZAPPIFEST_FIELDS.number_input,
640
+ suffix: "vertical gutter",
641
+ },
634
642
  ];
635
643
 
636
644
  const TV_MENU_LABEL_FIELDS = [
@@ -129,6 +129,22 @@ function mobileActionButton({ label, description, defaults, isFirstButton }) {
129
129
  conditions.push(createConditionalField(labelEnabledKey, true));
130
130
  }
131
131
 
132
+ const assetAlignmentKey = keyPrefixGenerator("asset_alignment");
133
+
134
+ // horizontal_gutter fields depends on [asset_alignment: left or asset_alignment: right]
135
+ if (isKeyHasSuffix("horizontal_gutter", key)) {
136
+ conditions.push(
137
+ createConditionalField(assetAlignmentKey, ["left", "right"])
138
+ );
139
+ }
140
+
141
+ // vertical_gutter fields depends on [asset_alignment: above or asset_alignment: below]
142
+ if (isKeyHasSuffix("vertical_gutter", key)) {
143
+ conditions.push(
144
+ createConditionalField(assetAlignmentKey, ["above", "below"])
145
+ );
146
+ }
147
+
132
148
  return withConditional(conditions)(field);
133
149
  });
134
150
 
@@ -49,7 +49,9 @@ function mobileActionButtonsContainer({ label, description, defaults }) {
49
49
 
50
50
  // over_image_position depends on [positionKey: over_image]
51
51
  if (isKeyHasSuffix("over_image_position", key)) {
52
- conditions.push(createConditionalField(positionKey, "over_image"));
52
+ conditions.push(
53
+ createConditionalField(positionKey, defaults.position[0])
54
+ );
53
55
  }
54
56
 
55
57
  // horizontal_gutter depends on [stackingKey: horizontal]
@@ -33,7 +33,7 @@ const DEFAULT_MOBILE_ACTION_BUTTON_SHARED_DEFAULTS = {
33
33
  assetHeight: 24,
34
34
  assetWidth: 24,
35
35
  assetMarginTop: 0,
36
- assetMarginRight: 6,
36
+ assetMarginRight: 0,
37
37
  assetMarginBottom: 0,
38
38
  assetMarginLeft: 0,
39
39
  labelEnabled: true,
@@ -50,6 +50,8 @@ const DEFAULT_MOBILE_ACTION_BUTTON_SHARED_DEFAULTS = {
50
50
  marginRight: 0,
51
51
  marginBottom: 0,
52
52
  marginLeft: 0,
53
+ horizontalGutter: 8,
54
+ verticalGutter: 8,
53
55
  };
54
56
 
55
57
  const DEFAULT_MOBILE_ACTION_BUTTON_PRESETS = {