@applicaster/zapp-react-native-utils 16.0.0-alpha.5402127570 → 16.0.0-alpha.5530459253

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 (147) hide show
  1. package/actionsExecutor/ActionExecutor.ts +47 -11
  2. package/actionsExecutor/ActionExecutorContext.tsx +85 -315
  3. package/actionsExecutor/__tests__/feedDecorator.test.ts +61 -0
  4. package/actionsExecutor/actions/__tests__/dismissBottomSheet.test.ts +22 -0
  5. package/actionsExecutor/actions/__tests__/loadItemsFromSource.test.ts +88 -0
  6. package/actionsExecutor/actions/__tests__/navigateToScreen.test.ts +133 -0
  7. package/actionsExecutor/actions/__tests__/openBottomSheet.customContent.test.ts +76 -0
  8. package/actionsExecutor/actions/__tests__/openBottomSheet.inlineItems.test.ts +100 -0
  9. package/actionsExecutor/actions/__tests__/showToast.test.ts +88 -0
  10. package/actionsExecutor/actions/appRestart.ts +24 -0
  11. package/actionsExecutor/actions/confirmDialog.ts +53 -0
  12. package/actionsExecutor/actions/dismissBottomSheet.ts +22 -0
  13. package/actionsExecutor/actions/index.ts +34 -0
  14. package/actionsExecutor/actions/localStorageRemove.ts +27 -0
  15. package/actionsExecutor/actions/localStorageSet.ts +28 -0
  16. package/actionsExecutor/actions/localStorageToggleFlag.ts +28 -0
  17. package/actionsExecutor/actions/navigateToScreen.ts +137 -0
  18. package/actionsExecutor/actions/openBottomSheet.ts +320 -0
  19. package/actionsExecutor/actions/refreshComponent.ts +85 -0
  20. package/actionsExecutor/actions/screenSetVariable.ts +35 -0
  21. package/actionsExecutor/actions/screenToggleFlag.ts +38 -0
  22. package/actionsExecutor/actions/sendCloudEvent.ts +93 -0
  23. package/actionsExecutor/actions/sessionStorageRemove.ts +19 -0
  24. package/actionsExecutor/actions/sessionStorageSet.ts +20 -0
  25. package/actionsExecutor/actions/sessionStorageToggleFlag.ts +15 -0
  26. package/actionsExecutor/actions/showToast.ts +87 -0
  27. package/actionsExecutor/actions/switchLayout.ts +40 -0
  28. package/actionsExecutor/consts.ts +23 -0
  29. package/actionsExecutor/feedDecorator.ts +6 -6
  30. package/actionsExecutor/types.ts +59 -0
  31. package/analyticsUtils/PlayerAnalyticsManager.ts +1 -1
  32. package/appUtils/HooksManager/index.ts +9 -0
  33. package/appUtils/contextKeysManager/__tests__/getKey/failure.test.ts +1 -1
  34. package/appUtils/contextKeysManager/__tests__/removeKey/failure.test.ts +1 -1
  35. package/appUtils/contextKeysManager/__tests__/setKey/failure/invalidKey.test.ts +4 -4
  36. package/appUtils/contextKeysManager/index.ts +1 -1
  37. package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +143 -53
  38. package/appUtils/playerManager/OverlayObserver/__tests__/liveContent.test.ts +205 -0
  39. package/appUtils/playerManager/OverlayObserver/__tests__/utils.test.ts +49 -0
  40. package/appUtils/playerManager/OverlayObserver/getUpcomingQueue.android.tv.ts +4 -0
  41. package/appUtils/playerManager/OverlayObserver/getUpcomingQueue.ios.tv.ts +4 -0
  42. package/appUtils/playerManager/OverlayObserver/getUpcomingQueue.ts +11 -0
  43. package/appUtils/playerManager/OverlayObserver/getUpcomingQueue.web.ts +4 -0
  44. package/appUtils/playerManager/OverlayObserver/utils.ts +54 -20
  45. package/appUtils/playerManager/__tests__/playerContent.test.ts +403 -0
  46. package/appUtils/playerManager/__tests__/playerFactory.test.ts +1 -1
  47. package/appUtils/playerManager/__tests__/usePlayerContent.test.tsx +64 -0
  48. package/appUtils/playerManager/{conts.ts → const.ts} +20 -0
  49. package/appUtils/playerManager/index.ts +1 -1
  50. package/appUtils/playerManager/player.ts +115 -3
  51. package/appUtils/playerManager/playerFactory.ts +1 -1
  52. package/appUtils/playerManager/playerNative.ts +1 -1
  53. package/appUtils/playerManager/usePlayerContent.tsx +43 -0
  54. package/appUtils/playerManager/usePlayerControllerSetup.tsx +1 -1
  55. package/appUtils/playerManager/userLanguagePreference.ts +1 -1
  56. package/arrayUtils/__tests__/{anyThruthy.test.ts → anyTruthy.test.ts} +8 -0
  57. package/arrayUtils/__tests__/arrayUtils.test.ts +165 -108
  58. package/arrayUtils/__tests__/isEmptyArray.test.ts +11 -0
  59. package/arrayUtils/__tests__/isFilledArray.test.ts +12 -0
  60. package/arrayUtils/__tests__/isFirst.test.ts +17 -0
  61. package/arrayUtils/__tests__/isIndexInRange.test.ts +14 -0
  62. package/arrayUtils/__tests__/isLast.test.ts +31 -0
  63. package/arrayUtils/__tests__/makeListOf.test.ts +31 -0
  64. package/arrayUtils/__tests__/makeListOfIndexes.test.ts +20 -0
  65. package/arrayUtils/__tests__/reorderByIds.test.ts +50 -0
  66. package/arrayUtils/__tests__/sample.test.ts +61 -0
  67. package/arrayUtils/index.ts +136 -20
  68. package/bottomSheet/__tests__/scrollContext.test.tsx +35 -0
  69. package/bottomSheet/index.ts +17 -0
  70. package/cellUtils/index.ts +33 -8
  71. package/colorUtils/__tests__/isTransparentColor.test.ts +76 -0
  72. package/colorUtils/__tests__/isValidColor.test.ts +70 -0
  73. package/colorUtils/index.ts +50 -0
  74. package/configurationUtils/__tests__/modalBlocksParser.test.ts +107 -0
  75. package/configurationUtils/manifestKeyParser.ts +38 -9
  76. package/configurationUtils/modalBlocksParser.ts +178 -0
  77. package/manifestUtils/__tests__/player.audioControls.test.js +158 -0
  78. package/manifestUtils/_internals/index.js +6 -0
  79. package/manifestUtils/defaultManifestConfigurations/player.js +327 -19
  80. package/manifestUtils/fieldUtils/__tests__/fieldUtils.test.js +84 -0
  81. package/manifestUtils/fieldUtils/index.js +125 -0
  82. package/manifestUtils/index.js +3 -0
  83. package/manifestUtils/keys.js +9 -0
  84. package/manifestUtils/mobileAction/button/index.js +16 -0
  85. package/manifestUtils/mobileAction/container/index.js +3 -1
  86. package/manifestUtils/mobileAction/groups/defaults.js +3 -1
  87. package/manifestUtils/modalBlocks.js +304 -0
  88. package/manifestUtils/platformIsTV.js +1 -0
  89. package/modalState/ContentViewModel.ts +113 -0
  90. package/modalState/EditableCollection.ts +17 -0
  91. package/modalState/EditableCollectionRegistry.ts +51 -0
  92. package/modalState/ModalOrchestrator.ts +199 -0
  93. package/modalState/RemoteEditableCollection.ts +227 -0
  94. package/modalState/__tests__/ContentViewModel.editable.test.ts +69 -0
  95. package/modalState/__tests__/ContentViewModel.test.ts +165 -0
  96. package/modalState/__tests__/EditableCollectionRegistry.test.ts +112 -0
  97. package/modalState/__tests__/ModalOrchestrator.phase3.test.ts +47 -0
  98. package/modalState/__tests__/RemoteEditableCollection.test.ts +326 -0
  99. package/modalState/__tests__/useBottomSheetContent.test.ts +349 -0
  100. package/modalState/index.ts +30 -83
  101. package/modalState/store.ts +102 -0
  102. package/modalState/types.ts +133 -0
  103. package/modalState/useBottomSheetContent.ts +102 -0
  104. package/numberUtils/__tests__/isMinusZero.test.ts +20 -0
  105. package/numberUtils/__tests__/isZero.test.ts +27 -0
  106. package/numberUtils/__tests__/requireNumber.test.ts +50 -0
  107. package/numberUtils/__tests__/toNumber.test.ts +27 -0
  108. package/numberUtils/__tests__/toNumberWithDefault.test.ts +64 -0
  109. package/numberUtils/__tests__/toNumberWithDefaultZero.test.ts +48 -0
  110. package/numberUtils/index.ts +27 -8
  111. package/package.json +2 -2
  112. package/pipesUtils/__tests__/buildUrlWithQuery.test.ts +33 -0
  113. package/pipesUtils/__tests__/withPipesEndpoint.test.tsx +56 -0
  114. package/pipesUtils/index.ts +1 -0
  115. package/pipesUtils/withPipesEndpoint.tsx +54 -0
  116. package/playerUtils/__tests__/contentDataKeys.test.ts +297 -0
  117. package/playerUtils/__tests__/resolvePlayerTitleSubtitle.test.ts +180 -0
  118. package/playerUtils/contentDataKeys.ts +134 -0
  119. package/playerUtils/index.ts +20 -15
  120. package/playerUtils/isAudioItem.ts +26 -0
  121. package/playerUtils/resolvePlayerTitleSubtitle.ts +76 -0
  122. package/reactHooks/actions/index.ts +51 -1
  123. package/reactHooks/cell-click/index.ts +3 -3
  124. package/reactHooks/feed/__mocks__/useMarkPipesDataStale.ts +4 -0
  125. package/reactHooks/feed/__tests__/useInflatedUrl.test.tsx +25 -0
  126. package/reactHooks/feed/index.ts +5 -1
  127. package/reactHooks/feed/useBatchLoading.ts +9 -1
  128. package/reactHooks/feed/{usePipesCacheReset.ts → useMarkPipesDataStale.ts} +12 -4
  129. package/reactHooks/index.ts +2 -0
  130. package/reactHooks/layout/index.ts +1 -1
  131. package/reactHooks/navigation/__mocks__/index.ts +4 -0
  132. package/reactHooks/navigation/__tests__/useIsScreenActive.test.ts +42 -0
  133. package/reactHooks/navigation/index.ts +1 -1
  134. package/reactHooks/navigation/useIsScreenActive.ts +29 -8
  135. package/reactHooks/state/useComponentScreenState.ts +1 -1
  136. package/reactHooks/usePluginConfiguration.ts +4 -1
  137. package/reactHooks/utils/__tests__/index.test.js +22 -2
  138. package/reactHooks/utils/index.ts +13 -2
  139. package/riverComponetsMeasurementProvider/index.tsx +12 -8
  140. package/stringUtils/__tests__/stringUtils.test.js +42 -0
  141. package/stringUtils/index.ts +2 -2
  142. package/uiActionsRegistrator/index.ts +203 -0
  143. package/zappFrameworkUtils/__tests__/localStorageHelper.test.ts +146 -0
  144. package/zappFrameworkUtils/localStorageHelper.ts +19 -15
  145. package/appUtils/playerManager/usePlayerTitleSummaryOverlay.tsx +0 -56
  146. package/reactHooks/feed/__mocks__/usePipesCacheReset.ts +0 -1
  147. /package/reactHooks/actions/__tests__/{index.test.js → index.test.tsx} +0 -0
@@ -0,0 +1,93 @@
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: sending sendCloudEvent to URL", {
66
+ url: options.url,
67
+ cloudEvent,
68
+ });
69
+
70
+ const { error, code } = await sendCloudEvent(cloudEvent, options.url);
71
+
72
+ log_info("handleAction: sendCloudEvent result", { code, error });
73
+
74
+ if (error) {
75
+ log_error("sendCloudEvent: error sending cloud event", { error });
76
+
77
+ return ActionResult.Error;
78
+ }
79
+
80
+ if (code && code >= 200 && code < 300 && !error) {
81
+ log_info("sendCloudEvent: cloud event sent successfully");
82
+
83
+ return ActionResult.Success;
84
+ }
85
+ } catch (error) {
86
+ log_error("sendCloudEvent: error sending cloud event", {
87
+ action,
88
+ error,
89
+ });
90
+ }
91
+
92
+ return ActionResult.Error;
93
+ };
@@ -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,87 @@
1
+ /// <reference types="@applicaster/applicaster-types" />
2
+ import { ActionResult } from "../ActionExecutor";
3
+ import { ActionHandler } from "../types";
4
+ import { postEvent } from "../../reactHooks/useSubscriberFor";
5
+
6
+ export const CONFIRMATION_TOAST_SOURCE = "confirmation";
7
+
8
+ export const CONFIRMATION_TOAST_DEFAULT_TIMEOUT = 1000;
9
+
10
+ /**
11
+ * Shows a mobile confirmation toast with Theme defaults from
12
+ * `Confirmation Toast / Message` in the base theme plugin.
13
+ *
14
+ * This action is confirmation-only by design: it always stamps
15
+ * `source: "confirmation"` (so Theme confirmation styles apply) and defaults
16
+ * `timeout` to 1000 ms. Non-confirmation toasts (e.g. Offline Experience)
17
+ * must post on the shared `"showToast"` event bus directly and omit `source`.
18
+ * Callers may override individual style fields; Theme supplies the rest.
19
+ *
20
+ * @example From React via ActionExecutorContext
21
+ * ```tsx
22
+ * import React, { useContext } from "react";
23
+ * import { ActionExecutorContext } from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutorContext";
24
+ *
25
+ * function QueueButton() {
26
+ * const { handleAction } = useContext(ActionExecutorContext);
27
+ *
28
+ * const onPress = () => {
29
+ * void handleAction({
30
+ * type: "showToast",
31
+ * options: { message: "Added to queue" },
32
+ * });
33
+ * };
34
+ *
35
+ * return <Button onPress={onPress} title="Add to queue" />;
36
+ * }
37
+ * ```
38
+ *
39
+ * @example From code via the actionExecutor singleton
40
+ * ```ts
41
+ * import { actionExecutor } from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutor";
42
+ *
43
+ * await actionExecutor.handleAction({
44
+ * type: "showToast",
45
+ * options: {
46
+ * message: "Playlist created",
47
+ * style: { backgroundColor: "#00AA55" }, // optional partial override
48
+ * },
49
+ * });
50
+ * ```
51
+ *
52
+ * @example From entry / pipes actions JSON
53
+ * ```json
54
+ * {
55
+ * "type": "showToast",
56
+ * "options": {
57
+ * "message": "Item removed from playlist"
58
+ * }
59
+ * }
60
+ * ```
61
+ */
62
+ export interface ShowToastActionOptions {
63
+ id?: string;
64
+ message?: string;
65
+ extraMessage?: string;
66
+ style?: any;
67
+ timeout?: number;
68
+ }
69
+
70
+ export const showToastAction: ActionHandler<ShowToastActionOptions> = async (
71
+ action
72
+ ): Promise<ActionResult> => {
73
+ const options = action?.options;
74
+
75
+ postEvent("showToast", [
76
+ {
77
+ id: options?.id,
78
+ message: options?.message,
79
+ extraMessage: options?.extraMessage,
80
+ style: options?.style,
81
+ timeout: options?.timeout ?? CONFIRMATION_TOAST_DEFAULT_TIMEOUT,
82
+ source: CONFIRMATION_TOAST_SOURCE,
83
+ },
84
+ ]);
85
+
86
+ return ActionResult.Success;
87
+ };
@@ -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
+ };
@@ -2,3 +2,26 @@ export const TOGGLE_FLAG_MAX_ITEMS_REACHED_EVENT =
2
2
  "action.localStorageToggleFlag.maxItemsReached";
3
3
 
4
4
  export const ACTION_EXECUTOR_EVENT_SOURCE = "ActionExecutor";
5
+
6
+ export const ACTION_TYPES = {
7
+ OPEN_BOTTOM_SHEET: "openBottomSheet",
8
+ DISMISS_BOTTOM_SHEET: "dismissBottomSheet",
9
+ PRESENT_SUB_MENU: "presentSubMenu",
10
+ SEND_CLOUD_EVENT: "sendCloudEvent",
11
+ NAVIGATE_TO_SCREEN: "navigateToScreen",
12
+ SHOW_TOAST: "showToast",
13
+ LOCAL_STORAGE_SET: "localStorageSet",
14
+ LOCAL_STORAGE_REMOVE: "localStorageRemove",
15
+ LOCAL_STORAGE_TOGGLE_FLAG: "localStorageToggleFlag",
16
+ SESSION_STORAGE_SET: "sessionStorageSet",
17
+ SESSION_STORAGE_REMOVE: "sessionStorageRemove",
18
+ SESSION_STORAGE_TOGGLE_FLAG: "sessionStorageToggleFlag",
19
+ REFRESH_COMPONENT: "refreshComponent",
20
+ SWITCH_LAYOUT: "switchLayout",
21
+ APP_RESTART: "appRestart",
22
+ CONFIRM_DIALOG: "confirmDialog",
23
+ SCREEN_SET_VARIABLE: "screenSetVariable",
24
+ SCREEN_TOGGLE_FLAG: "screenToggleFlag",
25
+ } as const;
26
+
27
+ export type KnownActionType = (typeof ACTION_TYPES)[keyof typeof ACTION_TYPES];
@@ -159,13 +159,13 @@ export const decorateFeed = (feed: ZappFeed) => {
159
159
 
160
160
  const decoratedFeed = R.clone(feed);
161
161
 
162
- const isSingleSelect =
163
- (feed.extensions?.preference_editor_options?.select_mode ||
164
- feed.extensions?.behavior?.select_mode) === "single";
162
+ const selectMode =
163
+ feed.extensions?.preference_editor_options?.select_mode ||
164
+ feed.extensions?.behavior?.select_mode;
165
165
 
166
- if (isSingleSelect) {
166
+ if (selectMode === "single") {
167
167
  return makeSingleSelect(feed, key, decoratedFeed);
168
- } else {
169
- return makeMultiSelect(feed, key, decoratedFeed);
170
168
  }
169
+
170
+ return makeMultiSelect(feed, key, decoratedFeed);
171
171
  };
@@ -0,0 +1,59 @@
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
+ * From UIComponentContext as `{ ...component, parent }`.
21
+ */
22
+ component?: ZappUIComponent & { parent?: ZappUIComponent };
23
+
24
+ /** The route identifier for the current screen */
25
+ screenRoute?: string;
26
+
27
+ /** The screen state store for managing screen-level state (Zustand store) */
28
+ screenStateStore?: ReturnType<typeof useScreenStateStore>;
29
+
30
+ /** Context entry for additional data */
31
+ entryContext?: ZappEntry;
32
+
33
+ /** Callback function for action completion */
34
+ callback?: (result: { success: boolean; error: any; abort: boolean }) => void;
35
+
36
+ screenState?: Record<any, any>;
37
+ }
38
+
39
+ /**
40
+ * Type for action handler functions.
41
+ * Handlers receive the action (which may have typed options) and execution context.
42
+ *
43
+ * @template _TOptions - Optional type hint for the action's options object (for documentation/intellisense)
44
+ * @param action - The action to execute
45
+ * @param context - The execution context
46
+ * @returns A promise that resolves to the action result
47
+ */
48
+ export type ActionHandler<_TOptions = any> = (
49
+ action: ActionType,
50
+ context?: ActionExecutionContext
51
+ ) => Promise<ActionResult>;
52
+
53
+ /**
54
+ * Factory function that creates an action handler.
55
+ * Used for actions that need to capture dependencies at registration time.
56
+ */
57
+ export type ActionHandlerFactory<_TOptions = any> = (
58
+ ...dependencies: any[]
59
+ ) => ActionHandler<_TOptions>;
@@ -8,7 +8,7 @@ import {
8
8
  } from "../appUtils/playerManager";
9
9
  import { Player } from "../appUtils/playerManager/player";
10
10
  import { AnalyticPlayerListener } from "./AnalyticPlayerListener";
11
- import { PlayerRole } from "../appUtils/playerManager/conts";
11
+ import { PlayerRole } from "../appUtils/playerManager/const";
12
12
 
13
13
  enum PlayerAnalyticsTrackerType {
14
14
  PlayerAnalyticsTracker = "PlayerAnalyticsTracker",
@@ -498,6 +498,15 @@ export function HooksManager({
498
498
  presentUI
499
499
  );
500
500
  } catch (e) {
501
+ // Without this the failure is invisible: the hook stops right after the
502
+ // "Executing hook" line, with nothing in the log explaining why and no
503
+ // remaining hook ever running.
504
+ logHookEvent(
505
+ hooksManagerLogger.error,
506
+ `runInBackground: hook ${hookPlugin.identifier} threw: ${e?.message}`,
507
+ { hook: hookPlugin, payload, error: e, stack: e?.stack }
508
+ );
509
+
501
510
  hookPlugin.setStateAndNotify(HOOKS_EVENTS.ERROR, {
502
511
  error: e,
503
512
  hookPlugin,
@@ -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