@pulse-editor/react-api 0.1.1-beta.74 → 0.1.1-beta.75

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.
@@ -1,8 +1,8 @@
1
- import { TypedVariable } from "@pulse-editor/shared-utils";
2
1
  import { DependencyList } from "react";
3
2
  /**
4
3
  * Register an app action to listen to IMC messages from the core,
5
4
  * and pass to the action to handle.
5
+ * This will attach side effects to the action
6
6
  *
7
7
  * @param name Name of the command.
8
8
  * @param description Description of the command.
@@ -14,11 +14,11 @@ import { DependencyList } from "react";
14
14
  * Useful for actions that need to wait for some certain app state to be ready.
15
15
  *
16
16
  */
17
- export default function useRegisterAction(actionInfo: {
18
- name: string;
19
- description: string;
20
- parameters?: Record<string, TypedVariable>;
21
- returns?: Record<string, TypedVariable>;
22
- }, callbackHandler: (args: any) => Promise<any>, deps: DependencyList, isExtReady?: boolean): {
17
+ export default function useActionEffect(params: {
18
+ actionName: string;
19
+ beforeAction?: (args: any) => Promise<void>;
20
+ afterAction?: (args: any, result: any) => Promise<void>;
21
+ }, deps: DependencyList, isExtReady?: boolean): {
23
22
  isReady: boolean;
23
+ runAppAction: ((args: any) => Promise<any>) | undefined;
24
24
  };
package/dist/main.d.ts CHANGED
@@ -2,7 +2,7 @@ import useAgentTools from "./hooks/agent/use-agent-tools";
2
2
  import useAgents from "./hooks/agent/use-agents";
3
3
  import useLoading from "./hooks/editor/use-loading";
4
4
  import useNotification from "./hooks/editor/use-notification";
5
- import useRegisterAction from "./hooks/editor/use-register-action";
5
+ import useActionEffect from "./hooks/editor/use-register-action";
6
6
  import useTheme from "./hooks/editor/use-theme";
7
7
  import useFile from "./hooks/workspace/use-file";
8
8
  import useImageGen from "./hooks/ai-modality/use-image-gen";
@@ -24,4 +24,4 @@ import useTerminal from "./hooks/workspace/use-terminal";
24
24
  import useWorkspaceInfo from "./hooks/workspace/use-workspace-info";
25
25
  import ReceiveFileProvider from "./providers/receive-file-provider";
26
26
  import SnapshotProvider from "./providers/snapshot-provider";
27
- export { ReceiveFileProvider, SnapshotProvider, useAgents, useAgentTools, useArtifact, useEditorEnv, useFile, useFileSystem, useImageGen, useLLM, useLoading, useNotification, useOCR, useOpenApp, useOpenLink, useOwnedAppView, useReceiveFile, useRegisterAction, useSnapshotState, useSTT, useTerminal, useTheme, useTranslations, useTTS, useVideoGen, useWorkspaceInfo, };
27
+ export { ReceiveFileProvider, SnapshotProvider, useAgents, useAgentTools, useArtifact, useEditorEnv, useFile, useFileSystem, useImageGen, useLLM, useLoading, useNotification, useOCR, useOpenApp, useOpenLink, useOwnedAppView, useReceiveFile, useActionEffect as useRegisterAction, useSnapshotState, useSTT, useTerminal, useTheme, useTranslations, useTTS, useVideoGen, useWorkspaceInfo, };