@pulse-editor/react-api 0.1.1-beta.82 → 0.1.1-beta.84
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.
- package/dist/hooks/editor/use-app-settings.d.ts +13 -0
- package/dist/hooks/editor/use-oauth.d.ts +36 -0
- package/dist/hooks/editor/use-snapshot-state.d.ts +9 -1
- package/dist/main.d.ts +5 -2
- package/dist/main.js +1122 -682
- package/dist/main.js.map +1 -1
- package/dist/pulse-editor-react-api-0.1.1-beta.84.tgz +0 -0
- package/package.json +2 -2
- package/dist/pulse-editor-react-api-0.1.1-beta.82.tgz +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to access and update persisted settings for a specific app in the editor.
|
|
3
|
+
* @param appId The ID of the app whose settings should be retrieved and updated.
|
|
4
|
+
* @returns `isReady`, the current `settings` object, and an `updateSettings` function.
|
|
5
|
+
*/
|
|
6
|
+
export default function useAppSettings(appId: string): {
|
|
7
|
+
isReady: boolean;
|
|
8
|
+
isLoaded: boolean;
|
|
9
|
+
settings: Record<string, any>;
|
|
10
|
+
refetch: () => Promise<void>;
|
|
11
|
+
updateSettings: (newSettings: Record<string, any>) => Promise<void>;
|
|
12
|
+
deleteSetting: (key: string) => Promise<void>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { OAuthConnectConfig } from "@pulse-editor/shared-utils";
|
|
2
|
+
export type OAuthState = {
|
|
3
|
+
accessToken?: string;
|
|
4
|
+
refreshToken?: string;
|
|
5
|
+
tokenType?: string;
|
|
6
|
+
scope?: string;
|
|
7
|
+
expiresAt?: string | number;
|
|
8
|
+
idToken?: string;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Hook to manage OAuth credentials for a Pulse App.
|
|
13
|
+
*
|
|
14
|
+
* Handles the full OAuth flow automatically:
|
|
15
|
+
* - Dynamic client registration (RFC 7591) when `registrationEndpoint` is provided
|
|
16
|
+
* - PKCE code challenge generation
|
|
17
|
+
* - Opening the authorization modal
|
|
18
|
+
* - Token exchange and storage (via the Pulse Editor backend)
|
|
19
|
+
*
|
|
20
|
+
* @param appId The ID of the app.
|
|
21
|
+
* @param provider A provider identifier used to namespace the OAuth state.
|
|
22
|
+
*/
|
|
23
|
+
export default function useOAuth(appId: string, provider?: string): {
|
|
24
|
+
isReady: boolean;
|
|
25
|
+
isLoading: boolean;
|
|
26
|
+
oauth: OAuthState | null;
|
|
27
|
+
isAuthenticated: boolean;
|
|
28
|
+
connect: (config: OAuthConnectConfig) => Promise<void>;
|
|
29
|
+
disconnect: () => Promise<void>;
|
|
30
|
+
refetchOAuth: () => Promise<void>;
|
|
31
|
+
refreshToken: (params: {
|
|
32
|
+
tokenEndpoint: string;
|
|
33
|
+
clientId: string;
|
|
34
|
+
clientSecret?: string;
|
|
35
|
+
}) => Promise<OAuthState | null>;
|
|
36
|
+
};
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A hook that syncs state with a snapshot context,
|
|
3
|
+
* allowing for state restoration across component unmounts and remounts.
|
|
4
|
+
* @param key
|
|
5
|
+
* @param initialValue
|
|
6
|
+
* @param onRestore
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export default function useSnapshotState<T>(key: string, initialValue?: T, onRestore?: (value: T) => void): readonly [T, import("react").Dispatch<import("react").SetStateAction<T>>];
|
package/dist/main.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import useAgentTools from "./hooks/agent/use-agent-tools";
|
|
2
2
|
import useAgents from "./hooks/agent/use-agents";
|
|
3
|
+
import useActionEffect from "./hooks/editor/use-action-effect";
|
|
3
4
|
import useLoading from "./hooks/editor/use-loading";
|
|
4
5
|
import useNotification from "./hooks/editor/use-notification";
|
|
5
|
-
import useActionEffect from "./hooks/editor/use-action-effect";
|
|
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";
|
|
@@ -11,11 +11,14 @@ import useOCR from "./hooks/ai-modality/use-ocr";
|
|
|
11
11
|
import useSTT from "./hooks/ai-modality/use-stt";
|
|
12
12
|
import useTTS from "./hooks/ai-modality/use-tts";
|
|
13
13
|
import useVideoGen from "./hooks/ai-modality/use-video-gen";
|
|
14
|
+
import useAppSettings from "./hooks/editor/use-app-settings";
|
|
14
15
|
import { useArtifact } from "./hooks/editor/use-artifact";
|
|
15
16
|
import useEditorEnv from "./hooks/editor/use-editor-env";
|
|
16
17
|
import useOpenApp from "./hooks/editor/use-open-app";
|
|
17
18
|
import useOpenLink from "./hooks/editor/use-open-link";
|
|
18
19
|
import useOwnedAppView from "./hooks/editor/use-owned-app-view";
|
|
20
|
+
import useOAuth from "./hooks/editor/use-oauth";
|
|
21
|
+
export type { OAuthState } from "./hooks/editor/use-oauth";
|
|
19
22
|
import useSnapshotState from "./hooks/editor/use-snapshot-state";
|
|
20
23
|
import { useTranslations } from "./hooks/editor/use-translations";
|
|
21
24
|
import useFileSystem from "./hooks/workspace/use-file-system";
|
|
@@ -24,4 +27,4 @@ import useTerminal from "./hooks/workspace/use-terminal";
|
|
|
24
27
|
import useWorkspaceInfo from "./hooks/workspace/use-workspace-info";
|
|
25
28
|
import ReceiveFileProvider from "./providers/receive-file-provider";
|
|
26
29
|
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,
|
|
30
|
+
export { ReceiveFileProvider, SnapshotProvider, useActionEffect, useAgents, useAgentTools, useAppSettings, useArtifact, useEditorEnv, useFile, useFileSystem, useImageGen, useLLM, useLoading, useNotification, useOCR, useOpenApp, useOpenLink, useOAuth, useOwnedAppView, useReceiveFile, useSnapshotState, useSTT, useTerminal, useTheme, useTranslations, useTTS, useVideoGen, useWorkspaceInfo, };
|