skybridge 0.0.0-dev.6ca41d7 → 0.0.0-dev.6d0958c
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/LICENSE +21 -674
- package/README.md +74 -147
- package/dist/src/server/devtoolsStaticServer.d.ts +15 -0
- package/dist/src/server/devtoolsStaticServer.js +38 -0
- package/dist/src/server/devtoolsStaticServer.js.map +1 -0
- package/dist/src/server/index.d.ts +3 -0
- package/dist/src/server/index.js +1 -0
- package/dist/src/server/index.js.map +1 -1
- package/dist/src/server/inferUtilityTypes.d.ts +64 -0
- package/dist/src/server/inferUtilityTypes.js +2 -0
- package/dist/src/server/inferUtilityTypes.js.map +1 -0
- package/dist/src/server/server.d.ts +70 -9
- package/dist/src/server/server.js +55 -30
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/templateHelper.d.ts +3 -0
- package/dist/src/server/templateHelper.js +5 -4
- package/dist/src/server/templateHelper.js.map +1 -1
- package/dist/src/server/templates/development.hbs +3 -2
- package/dist/src/server/templates/production.hbs +1 -0
- package/dist/src/server/widgetsDevServer.js +3 -3
- package/dist/src/server/widgetsDevServer.js.map +1 -1
- package/dist/src/test/utils.d.ts +108 -1
- package/dist/src/test/utils.js +202 -3
- package/dist/src/test/utils.js.map +1 -1
- package/dist/src/test/widget.test.js +83 -27
- package/dist/src/test/widget.test.js.map +1 -1
- package/dist/src/web/bridges/apps-sdk-bridge.d.ts +14 -0
- package/dist/src/web/bridges/apps-sdk-bridge.js +44 -0
- package/dist/src/web/bridges/apps-sdk-bridge.js.map +1 -0
- package/dist/src/web/bridges/get-bridge-methods.d.ts +2 -0
- package/dist/src/web/bridges/get-bridge-methods.js +11 -0
- package/dist/src/web/bridges/get-bridge-methods.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.d.ts +2 -0
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js +7 -0
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-bridge.d.ts +3 -0
- package/dist/src/web/bridges/hooks/use-bridge.js +28 -0
- package/dist/src/web/bridges/hooks/use-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.d.ts +4 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js +7 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js +58 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js.map +1 -0
- package/dist/src/web/bridges/index.d.ts +3 -0
- package/dist/src/web/bridges/index.js +4 -0
- package/dist/src/web/bridges/index.js.map +1 -0
- package/dist/src/web/bridges/mcp-app-bridge.d.ts +30 -0
- package/dist/src/web/bridges/mcp-app-bridge.js +136 -0
- package/dist/src/web/bridges/mcp-app-bridge.js.map +1 -0
- package/dist/src/web/bridges/types.d.ts +8 -0
- package/dist/src/web/bridges/types.js +2 -0
- package/dist/src/web/bridges/types.js.map +1 -0
- package/dist/src/web/create-store.d.ts +3 -0
- package/dist/src/web/create-store.js +25 -0
- package/dist/src/web/create-store.js.map +1 -0
- package/dist/src/web/create-store.test.js +70 -0
- package/dist/src/web/create-store.test.js.map +1 -0
- package/dist/src/web/data-llm.d.ts +14 -0
- package/dist/src/web/data-llm.js +68 -0
- package/dist/src/web/data-llm.js.map +1 -0
- package/dist/src/web/data-llm.test.js +76 -0
- package/dist/src/web/data-llm.test.js.map +1 -0
- package/dist/src/web/generate-helpers.d.ts +115 -0
- package/dist/src/web/generate-helpers.js +111 -0
- package/dist/src/web/generate-helpers.js.map +1 -0
- package/dist/src/web/generate-helpers.test-d.d.ts +1 -0
- package/dist/src/web/generate-helpers.test-d.js +206 -0
- package/dist/src/web/generate-helpers.test-d.js.map +1 -0
- package/dist/src/web/generate-helpers.test.d.ts +1 -0
- package/dist/src/web/generate-helpers.test.js +17 -0
- package/dist/src/web/generate-helpers.test.js.map +1 -0
- package/dist/src/web/helpers/state.d.ts +7 -0
- package/dist/src/web/helpers/state.js +40 -0
- package/dist/src/web/helpers/state.js.map +1 -0
- package/dist/src/web/helpers/state.test.d.ts +1 -0
- package/dist/src/web/helpers/state.test.js +53 -0
- package/dist/src/web/helpers/state.test.js.map +1 -0
- package/dist/src/web/hooks/index.d.ts +4 -6
- package/dist/src/web/hooks/index.js +4 -6
- package/dist/src/web/hooks/index.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.d.ts +59 -21
- package/dist/src/web/hooks/use-call-tool.js +14 -20
- package/dist/src/web/hooks/use-call-tool.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.test-d.d.ts +1 -0
- package/dist/src/web/hooks/use-call-tool.test-d.js +104 -0
- package/dist/src/web/hooks/use-call-tool.test-d.js.map +1 -0
- package/dist/src/web/hooks/use-call-tool.test.js +14 -12
- package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.d.ts +2 -2
- package/dist/src/web/hooks/use-display-mode.js +6 -3
- package/dist/src/web/hooks/use-display-mode.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.test.js +3 -2
- package/dist/src/web/hooks/use-display-mode.test.js.map +1 -1
- package/dist/src/web/hooks/use-files.d.ts +10 -0
- package/dist/src/web/hooks/use-files.js +7 -0
- package/dist/src/web/hooks/use-files.js.map +1 -0
- package/dist/src/web/hooks/use-files.test.d.ts +1 -0
- package/dist/src/web/hooks/use-files.test.js +29 -0
- package/dist/src/web/hooks/use-files.test.js.map +1 -0
- package/dist/src/web/hooks/use-layout.d.ts +22 -0
- package/dist/src/web/hooks/use-layout.js +23 -0
- package/dist/src/web/hooks/use-layout.js.map +1 -0
- package/dist/src/web/hooks/use-layout.test.d.ts +1 -0
- package/dist/src/web/hooks/use-layout.test.js +46 -0
- package/dist/src/web/hooks/use-layout.test.js.map +1 -0
- package/dist/src/web/hooks/use-open-external.test.js +2 -2
- package/dist/src/web/hooks/use-open-external.test.js.map +1 -1
- package/dist/src/web/hooks/use-openai-global.d.ts +3 -2
- package/dist/src/web/hooks/use-openai-global.js +3 -20
- package/dist/src/web/hooks/use-openai-global.js.map +1 -1
- package/dist/src/web/hooks/use-request-modal.d.ts +3 -2
- package/dist/src/web/hooks/use-request-modal.js.map +1 -1
- package/dist/src/web/hooks/use-request-modal.test.js +2 -2
- package/dist/src/web/hooks/use-request-modal.test.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.d.ts +5 -3
- package/dist/src/web/hooks/use-tool-info.js +5 -7
- package/dist/src/web/hooks/use-tool-info.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.test-d.d.ts +1 -0
- package/dist/src/web/hooks/use-tool-info.test-d.js +73 -0
- package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -0
- package/dist/src/web/hooks/use-tool-info.test.js +4 -77
- package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/src/web/hooks/use-user.d.ts +18 -0
- package/dist/src/web/hooks/use-user.js +19 -0
- package/dist/src/web/hooks/use-user.js.map +1 -0
- package/dist/src/web/hooks/use-user.test.d.ts +1 -0
- package/dist/src/web/hooks/use-user.test.js +44 -0
- package/dist/src/web/hooks/use-user.test.js.map +1 -0
- package/dist/src/web/hooks/use-widget-state.js +11 -9
- package/dist/src/web/hooks/use-widget-state.js.map +1 -1
- package/dist/src/web/hooks/use-widget-state.test.js +3 -2
- package/dist/src/web/hooks/use-widget-state.test.js.map +1 -1
- package/dist/src/web/index.d.ts +7 -3
- package/dist/src/web/index.js +7 -3
- package/dist/src/web/index.js.map +1 -1
- package/dist/src/web/mount-widget.js +5 -0
- package/dist/src/web/mount-widget.js.map +1 -1
- package/dist/src/web/plugin/data-llm.test.d.ts +1 -0
- package/dist/src/web/plugin/data-llm.test.js +81 -0
- package/dist/src/web/plugin/data-llm.test.js.map +1 -0
- package/dist/src/web/plugin/plugin.js +39 -0
- package/dist/src/web/plugin/plugin.js.map +1 -0
- package/dist/src/web/plugin/transform-data-llm.d.ts +12 -0
- package/dist/src/web/plugin/transform-data-llm.js +93 -0
- package/dist/src/web/plugin/transform-data-llm.js.map +1 -0
- package/dist/src/web/plugin/transform-data-llm.test.d.ts +1 -0
- package/dist/src/web/plugin/transform-data-llm.test.js +81 -0
- package/dist/src/web/plugin/transform-data-llm.test.js.map +1 -0
- package/dist/src/web/proxy.d.ts +1 -0
- package/dist/src/web/proxy.js +53 -0
- package/dist/src/web/proxy.js.map +1 -0
- package/dist/src/web/types.d.ts +51 -22
- package/dist/src/web/types.js +1 -0
- package/dist/src/web/types.js.map +1 -1
- package/package.json +15 -6
- package/dist/src/web/hooks/use-locale.d.ts +0 -1
- package/dist/src/web/hooks/use-locale.js +0 -5
- package/dist/src/web/hooks/use-locale.js.map +0 -1
- package/dist/src/web/hooks/use-locale.test.js +0 -21
- package/dist/src/web/hooks/use-locale.test.js.map +0 -1
- package/dist/src/web/hooks/use-theme.d.ts +0 -1
- package/dist/src/web/hooks/use-theme.js +0 -5
- package/dist/src/web/hooks/use-theme.js.map +0 -1
- package/dist/src/web/hooks/use-theme.test.js +0 -26
- package/dist/src/web/hooks/use-theme.test.js.map +0 -1
- package/dist/src/web/hooks/use-tool-output.d.ts +0 -4
- package/dist/src/web/hooks/use-tool-output.js +0 -9
- package/dist/src/web/hooks/use-tool-output.js.map +0 -1
- package/dist/src/web/hooks/use-tool-response-metadata.d.ts +0 -4
- package/dist/src/web/hooks/use-tool-response-metadata.js +0 -8
- package/dist/src/web/hooks/use-tool-response-metadata.js.map +0 -1
- package/dist/src/web/hooks/use-user-agent.d.ts +0 -1
- package/dist/src/web/hooks/use-user-agent.js +0 -5
- package/dist/src/web/hooks/use-user-agent.js.map +0 -1
- package/dist/src/web/hooks/use-user-agent.test.js +0 -31
- package/dist/src/web/hooks/use-user-agent.test.js.map +0 -1
- package/dist/src/web/plugin.js +0 -28
- package/dist/src/web/plugin.js.map +0 -1
- /package/dist/src/web/{hooks/use-locale.test.d.ts → bridges/hooks/use-mcp-app-bridge.test.d.ts} +0 -0
- /package/dist/src/web/{hooks/use-theme.test.d.ts → create-store.test.d.ts} +0 -0
- /package/dist/src/web/{hooks/use-user-agent.test.d.ts → data-llm.test.d.ts} +0 -0
- /package/dist/src/web/{plugin.d.ts → plugin/plugin.d.ts} +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SafeArea, Theme } from "../types.js";
|
|
2
|
+
export type LayoutState = {
|
|
3
|
+
theme: Theme;
|
|
4
|
+
maxHeight: number;
|
|
5
|
+
safeArea: SafeArea;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Hook for accessing layout and visual environment information.
|
|
9
|
+
* These values may change on resize or theme toggle.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const { theme, maxHeight, safeArea } = useLayout();
|
|
14
|
+
*
|
|
15
|
+
* // Apply theme-aware styling
|
|
16
|
+
* const backgroundColor = theme === "dark" ? "#1a1a1a" : "#ffffff";
|
|
17
|
+
*
|
|
18
|
+
* // Respect safe area insets
|
|
19
|
+
* const paddingTop = safeArea.insets.top;
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function useLayout(): LayoutState;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useAppsSdkBridge, useBridge } from "../bridges/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Hook for accessing layout and visual environment information.
|
|
4
|
+
* These values may change on resize or theme toggle.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const { theme, maxHeight, safeArea } = useLayout();
|
|
9
|
+
*
|
|
10
|
+
* // Apply theme-aware styling
|
|
11
|
+
* const backgroundColor = theme === "dark" ? "#1a1a1a" : "#ffffff";
|
|
12
|
+
*
|
|
13
|
+
* // Respect safe area insets
|
|
14
|
+
* const paddingTop = safeArea.insets.top;
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export function useLayout() {
|
|
18
|
+
const theme = useBridge("theme");
|
|
19
|
+
const maxHeight = useAppsSdkBridge("maxHeight");
|
|
20
|
+
const safeArea = useAppsSdkBridge("safeArea");
|
|
21
|
+
return { theme, maxHeight, safeArea };
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=use-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-layout.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AASlE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IACjC,MAAM,SAAS,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAE9C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { renderHook } from "@testing-library/react";
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { useLayout } from "./use-layout.js";
|
|
4
|
+
describe("useLayout", () => {
|
|
5
|
+
let OpenaiMock;
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
OpenaiMock = {
|
|
8
|
+
theme: "light",
|
|
9
|
+
maxHeight: 500,
|
|
10
|
+
safeArea: { insets: { top: 0, bottom: 0, left: 0, right: 0 } },
|
|
11
|
+
};
|
|
12
|
+
vi.stubGlobal("openai", OpenaiMock);
|
|
13
|
+
vi.stubGlobal("skybridge", { hostType: "apps-sdk" });
|
|
14
|
+
});
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
vi.unstubAllGlobals();
|
|
17
|
+
vi.resetAllMocks();
|
|
18
|
+
});
|
|
19
|
+
it("should return theme, maxHeight, and safeArea from window.openai", () => {
|
|
20
|
+
const { result } = renderHook(() => useLayout());
|
|
21
|
+
expect(result.current.theme).toBe("light");
|
|
22
|
+
expect(result.current.maxHeight).toBe(500);
|
|
23
|
+
expect(result.current.safeArea).toEqual({
|
|
24
|
+
insets: { top: 0, bottom: 0, left: 0, right: 0 },
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
it("should return dark theme when set to dark", () => {
|
|
28
|
+
OpenaiMock.theme = "dark";
|
|
29
|
+
const { result } = renderHook(() => useLayout());
|
|
30
|
+
expect(result.current.theme).toBe("dark");
|
|
31
|
+
});
|
|
32
|
+
it("should return different maxHeight when set", () => {
|
|
33
|
+
OpenaiMock.maxHeight = 800;
|
|
34
|
+
const { result } = renderHook(() => useLayout());
|
|
35
|
+
expect(result.current.maxHeight).toBe(800);
|
|
36
|
+
});
|
|
37
|
+
it("should return safeArea with insets when set", () => {
|
|
38
|
+
OpenaiMock.safeArea = {
|
|
39
|
+
insets: { top: 44, bottom: 34, left: 0, right: 0 },
|
|
40
|
+
};
|
|
41
|
+
const { result } = renderHook(() => useLayout());
|
|
42
|
+
expect(result.current.safeArea.insets.top).toBe(44);
|
|
43
|
+
expect(result.current.safeArea.insets.bottom).toBe(34);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=use-layout.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-layout.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-layout.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC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
import { renderHook } from "@testing-library/react";
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { useOpenExternal } from "./use-open-external.js";
|
|
4
4
|
describe("useOpenExternal", () => {
|
|
5
5
|
let openExternalMock;
|
|
6
6
|
beforeEach(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-open-external.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-open-external.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-open-external.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-open-external.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,gBAA0C,CAAC;IAE/C,UAAU,CAAC,GAAG,EAAE;QACd,gBAAgB,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE;YACtB,YAAY,EAAE,gBAAgB;SAC/B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACtB,EAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8EAA8E,EAAE,GAAG,EAAE;QACtF,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,eAAe,EAAE,CAAC,CAAC;QAEvD,MAAM,IAAI,GAAG,qBAAqB,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAErB,MAAM,CAAC,gBAAgB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAClD,MAAM,CAAC,gBAAgB,CAAC,CAAC,oBAAoB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { OpenAiProperties } from "../types.js";
|
|
2
|
+
/** @deprecated Use `useAppsSdkBridge` instead */
|
|
3
|
+
export declare function useOpenAiGlobal<K extends keyof OpenAiProperties>(key: K): OpenAiProperties[K];
|
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { useAppsSdkBridge } from "../bridges/index.js";
|
|
2
|
+
/** @deprecated Use `useAppsSdkBridge` instead */
|
|
3
3
|
export function useOpenAiGlobal(key) {
|
|
4
|
-
|
|
5
|
-
console.warn("openai is not defined on window. Please make sure to only call this hook inside the OpenAI iFrame skybridge runtime.");
|
|
6
|
-
}
|
|
7
|
-
return useSyncExternalStore((onChange) => {
|
|
8
|
-
const handleSetGlobal = (event) => {
|
|
9
|
-
const value = event.detail.globals[key];
|
|
10
|
-
if (value === undefined) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
onChange();
|
|
14
|
-
};
|
|
15
|
-
window.addEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobal, {
|
|
16
|
-
passive: true,
|
|
17
|
-
});
|
|
18
|
-
return () => {
|
|
19
|
-
window.removeEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobal);
|
|
20
|
-
};
|
|
21
|
-
}, () => window.openai?.[key]);
|
|
4
|
+
return useAppsSdkBridge(key);
|
|
22
5
|
}
|
|
23
6
|
//# sourceMappingURL=use-openai-global.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-openai-global.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-openai-global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-openai-global.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-openai-global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,iDAAiD;AACjD,MAAM,UAAU,eAAe,CAC7B,GAAM;IAEN,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { RequestModalOptions } from "../types.js";
|
|
2
1
|
/**
|
|
3
2
|
* Triggers a modal containing the widget rendered in display mode "modal"
|
|
4
3
|
*/
|
|
5
|
-
export declare function useRequestModal(): (options:
|
|
4
|
+
export declare function useRequestModal(): (options: {
|
|
5
|
+
title: string;
|
|
6
|
+
}) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-request-modal.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-request-modal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-request-modal.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-request-modal.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,OAA0B,EAAE,EAAE;QACpC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useRequestModal } from "./use-request-modal.js";
|
|
2
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
3
1
|
import { renderHook } from "@testing-library/react";
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { useRequestModal } from "./use-request-modal.js";
|
|
4
4
|
describe("useRequestModal", () => {
|
|
5
5
|
let requestModalMock;
|
|
6
6
|
beforeEach(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-request-modal.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-request-modal.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-request-modal.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-request-modal.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,gBAA0C,CAAC;IAE/C,UAAU,CAAC,GAAG,EAAE;QACd,gBAAgB,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE;YACtB,YAAY,EAAE,gBAAgB;SAC/B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACtB,EAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iFAAiF,EAAE,GAAG,EAAE;QACzF,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,eAAe,EAAE,CAAC,CAAC;QAEvD,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QACxC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAExB,MAAM,CAAC,gBAAgB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAClD,MAAM,CAAC,gBAAgB,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { UnknownObject } from "../types.js";
|
|
2
|
-
type
|
|
2
|
+
export type ToolPendingState<ToolInput extends UnknownObject> = {
|
|
3
3
|
status: "pending";
|
|
4
4
|
isPending: true;
|
|
5
5
|
isSuccess: false;
|
|
6
6
|
input: ToolInput;
|
|
7
7
|
output: undefined;
|
|
8
8
|
responseMetadata: undefined;
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
|
+
export type ToolSuccessState<ToolInput extends UnknownObject, ToolOutput extends UnknownObject, ToolResponseMetadata extends UnknownObject> = {
|
|
10
11
|
status: "success";
|
|
11
12
|
isPending: false;
|
|
12
13
|
isSuccess: true;
|
|
@@ -14,10 +15,11 @@ type ToolState<ToolInput extends UnknownObject, ToolOutput extends UnknownObject
|
|
|
14
15
|
output: ToolOutput;
|
|
15
16
|
responseMetadata: ToolResponseMetadata;
|
|
16
17
|
};
|
|
18
|
+
export type ToolState<ToolInput extends UnknownObject, ToolOutput extends UnknownObject, ToolResponseMetadata extends UnknownObject> = ToolPendingState<ToolInput> | ToolSuccessState<ToolInput, ToolOutput, ToolResponseMetadata>;
|
|
17
19
|
type ToolSignature = {
|
|
18
20
|
input: UnknownObject;
|
|
19
21
|
output: UnknownObject;
|
|
20
22
|
responseMetadata: UnknownObject;
|
|
21
23
|
};
|
|
22
|
-
export declare function useToolInfo<TS extends Partial<ToolSignature> =
|
|
24
|
+
export declare function useToolInfo<TS extends Partial<ToolSignature> = Record<string, never>>(): ToolState<UnknownObject & TS["input"], UnknownObject & TS["output"], UnknownObject & TS["responseMetadata"]>;
|
|
23
25
|
export {};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { useOpenAiGlobal } from "./use-openai-global.js";
|
|
2
1
|
import { useEffect, useState } from "react";
|
|
2
|
+
import { useAppsSdkBridge } from "../bridges/index.js";
|
|
3
3
|
export function useToolInfo() {
|
|
4
4
|
const [status, setStatus] = useState("pending");
|
|
5
|
-
const input =
|
|
6
|
-
const output =
|
|
7
|
-
const responseMetadata =
|
|
5
|
+
const input = useAppsSdkBridge("toolInput");
|
|
6
|
+
const output = useAppsSdkBridge("toolOutput");
|
|
7
|
+
const responseMetadata = useAppsSdkBridge("toolResponseMetadata");
|
|
8
8
|
useEffect(() => {
|
|
9
|
-
setStatus(output ===
|
|
10
|
-
? "pending"
|
|
11
|
-
: "success");
|
|
9
|
+
setStatus(output === null && responseMetadata === null ? "pending" : "success");
|
|
12
10
|
}, [output, responseMetadata]);
|
|
13
11
|
return {
|
|
14
12
|
input,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tool-info.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-tool-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-tool-info.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-tool-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAuCvD,MAAM,UAAU,WAAW;IAGzB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAwB,SAAS,CAAC,CAAC;IACvE,MAAM,KAAK,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC9C,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IAElE,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,CACP,MAAM,KAAK,IAAI,IAAI,gBAAgB,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CACrE,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAM/B,OAAO;QACL,KAAK;QACL,MAAM;QACN,SAAS,EAAE,MAAM,KAAK,SAAS;QAC/B,SAAS,EAAE,MAAM,KAAK,SAAS;QAC/B,MAAM;QACN,gBAAgB;KACqB,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { expectTypeOf, test } from "vitest";
|
|
2
|
+
import { useToolInfo } from "./use-tool-info.js";
|
|
3
|
+
test("useToolInfo - TypeScript typing", () => {
|
|
4
|
+
test("should have correct types when no generic parameter is provided", () => {
|
|
5
|
+
const result = useToolInfo();
|
|
6
|
+
expectTypeOf(result.status);
|
|
7
|
+
expectTypeOf(result.isPending);
|
|
8
|
+
expectTypeOf(result.isSuccess);
|
|
9
|
+
expectTypeOf(result.input);
|
|
10
|
+
});
|
|
11
|
+
test("should correctly type input, output, and responseMetadata with explicit ToolSignature", () => {
|
|
12
|
+
const result = useToolInfo();
|
|
13
|
+
expectTypeOf(result.input);
|
|
14
|
+
// When pending, output and responseMetadata should be undefined
|
|
15
|
+
if (result.status === "pending") {
|
|
16
|
+
expectTypeOf(result.output);
|
|
17
|
+
expectTypeOf(result.responseMetadata);
|
|
18
|
+
}
|
|
19
|
+
// When success, output and responseMetadata should be defined
|
|
20
|
+
if (result.status === "success") {
|
|
21
|
+
expectTypeOf(result.output);
|
|
22
|
+
expectTypeOf(result.responseMetadata);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
test("should correctly narrow types based on status discriminated union", () => {
|
|
26
|
+
const result = useToolInfo();
|
|
27
|
+
// Test type narrowing
|
|
28
|
+
if (result.isPending) {
|
|
29
|
+
expectTypeOf(result.status);
|
|
30
|
+
expectTypeOf(result.isPending);
|
|
31
|
+
expectTypeOf(result.isSuccess);
|
|
32
|
+
expectTypeOf(result.output);
|
|
33
|
+
expectTypeOf(result.responseMetadata);
|
|
34
|
+
}
|
|
35
|
+
if (result.isSuccess) {
|
|
36
|
+
expectTypeOf(result.status);
|
|
37
|
+
expectTypeOf(result.isPending);
|
|
38
|
+
expectTypeOf(result.isSuccess);
|
|
39
|
+
expectTypeOf(result.output);
|
|
40
|
+
expectTypeOf(result.responseMetadata);
|
|
41
|
+
}
|
|
42
|
+
if (result.status === "pending") {
|
|
43
|
+
expectTypeOf(result.input);
|
|
44
|
+
expectTypeOf(result.isPending);
|
|
45
|
+
expectTypeOf(result.isSuccess);
|
|
46
|
+
expectTypeOf(result.output);
|
|
47
|
+
expectTypeOf(result.responseMetadata);
|
|
48
|
+
}
|
|
49
|
+
if (result.status === "success") {
|
|
50
|
+
expectTypeOf(result.input);
|
|
51
|
+
expectTypeOf(result.isPending);
|
|
52
|
+
expectTypeOf(result.isSuccess);
|
|
53
|
+
expectTypeOf(result.output);
|
|
54
|
+
expectTypeOf(result.responseMetadata);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
test("should handle partial ToolSignature with only input specified", () => {
|
|
58
|
+
const result = useToolInfo();
|
|
59
|
+
expectTypeOf(result.input);
|
|
60
|
+
if (result.status === "success") {
|
|
61
|
+
expectTypeOf(result.output);
|
|
62
|
+
expectTypeOf(result.responseMetadata);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
test("should handle ToolSignature with only output specified", () => {
|
|
66
|
+
const result = useToolInfo();
|
|
67
|
+
expectTypeOf(result.input);
|
|
68
|
+
if (result.status === "success") {
|
|
69
|
+
expectTypeOf(result.output);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=use-tool-info.test-d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-tool-info.test-d.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-tool-info.test-d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oB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C;YACrD,YAAY,CAA0B,MAAM,CAAC,gBAAgB,CAAC,CAAC;QACjE,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAGlE,MAAM,MAAM,GAAG,WAAW,EAEtB,CAAC;QAEL,YAAY,CAA0B,MAAM,CAAC,KAAK,CAAC,CAAC;QAEpD,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAChC,YAAY,CAAa,MAAM,CAAC,MAAM,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { fireEvent, renderHook, waitFor
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, it, vi
|
|
3
|
-
import { useToolInfo } from "./use-tool-info.js";
|
|
1
|
+
import { act, fireEvent, renderHook, waitFor } from "@testing-library/react";
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
3
|
import { SET_GLOBALS_EVENT_TYPE, SetGlobalsEvent, } from "../types.js";
|
|
4
|
+
import { useToolInfo } from "./use-tool-info.js";
|
|
5
5
|
describe("useToolInfo", () => {
|
|
6
6
|
let OpenaiMock;
|
|
7
7
|
beforeEach(() => {
|
|
@@ -11,6 +11,7 @@ describe("useToolInfo", () => {
|
|
|
11
11
|
toolResponseMetadata: null,
|
|
12
12
|
};
|
|
13
13
|
vi.stubGlobal("openai", OpenaiMock);
|
|
14
|
+
vi.stubGlobal("skybridge", { hostType: "apps-sdk" });
|
|
14
15
|
});
|
|
15
16
|
afterEach(() => {
|
|
16
17
|
vi.unstubAllGlobals();
|
|
@@ -56,78 +57,4 @@ describe("useToolInfo", () => {
|
|
|
56
57
|
});
|
|
57
58
|
});
|
|
58
59
|
});
|
|
59
|
-
describe("useToolInfo - TypeScript typing", () => {
|
|
60
|
-
it("should have correct types when no generic parameter is provided", () => {
|
|
61
|
-
const { result } = renderHook(() => useToolInfo());
|
|
62
|
-
expectTypeOf(result.current.status);
|
|
63
|
-
expectTypeOf(result.current.isPending);
|
|
64
|
-
expectTypeOf(result.current.isSuccess);
|
|
65
|
-
expectTypeOf(result.current.input);
|
|
66
|
-
});
|
|
67
|
-
it("should correctly type input, output, and responseMetadata with explicit ToolSignature", () => {
|
|
68
|
-
const { result } = renderHook(() => useToolInfo());
|
|
69
|
-
expectTypeOf(result.current.input);
|
|
70
|
-
// When pending, output and responseMetadata should be undefined
|
|
71
|
-
if (result.current.status === "pending") {
|
|
72
|
-
expectTypeOf(result.current.output);
|
|
73
|
-
expectTypeOf(result.current.responseMetadata);
|
|
74
|
-
expectTypeOf(result.current.isPending);
|
|
75
|
-
expectTypeOf(result.current.isSuccess);
|
|
76
|
-
}
|
|
77
|
-
// When success, output and responseMetadata should be defined
|
|
78
|
-
if (result.current.status === "success") {
|
|
79
|
-
expectTypeOf(result.current.output);
|
|
80
|
-
expectTypeOf(result.current.responseMetadata);
|
|
81
|
-
expectTypeOf(result.current.isPending);
|
|
82
|
-
expectTypeOf(result.current.isSuccess);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
it("should correctly narrow types based on status discriminated union", () => {
|
|
86
|
-
const { result } = renderHook(() => useToolInfo());
|
|
87
|
-
// Test type narrowing
|
|
88
|
-
if (result.current.isPending) {
|
|
89
|
-
expectTypeOf(result.current.status);
|
|
90
|
-
expectTypeOf(result.current.isPending);
|
|
91
|
-
expectTypeOf(result.current.isSuccess);
|
|
92
|
-
expectTypeOf(result.current.output);
|
|
93
|
-
expectTypeOf(result.current.responseMetadata);
|
|
94
|
-
}
|
|
95
|
-
if (result.current.isSuccess) {
|
|
96
|
-
expectTypeOf(result.current.status);
|
|
97
|
-
expectTypeOf(result.current.isPending);
|
|
98
|
-
expectTypeOf(result.current.isSuccess);
|
|
99
|
-
expectTypeOf(result.current.output);
|
|
100
|
-
expectTypeOf(result.current.responseMetadata);
|
|
101
|
-
}
|
|
102
|
-
if (result.current.status === "pending") {
|
|
103
|
-
expectTypeOf(result.current.input);
|
|
104
|
-
expectTypeOf(result.current.isPending);
|
|
105
|
-
expectTypeOf(result.current.isSuccess);
|
|
106
|
-
expectTypeOf(result.current.output);
|
|
107
|
-
expectTypeOf(result.current.responseMetadata);
|
|
108
|
-
}
|
|
109
|
-
if (result.current.status === "success") {
|
|
110
|
-
expectTypeOf(result.current.input);
|
|
111
|
-
expectTypeOf(result.current.isPending);
|
|
112
|
-
expectTypeOf(result.current.isSuccess);
|
|
113
|
-
expectTypeOf(result.current.output);
|
|
114
|
-
expectTypeOf(result.current.responseMetadata);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
it("should handle partial ToolSignature with only input specified", () => {
|
|
118
|
-
const { result } = renderHook(() => useToolInfo());
|
|
119
|
-
expectTypeOf(result.current.input);
|
|
120
|
-
if (result.current.status === "success") {
|
|
121
|
-
expectTypeOf(result.current.output);
|
|
122
|
-
expectTypeOf(result.current.responseMetadata);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
it("should handle ToolSignature with only output specified", () => {
|
|
126
|
-
const { result } = renderHook(() => useToolInfo());
|
|
127
|
-
expectTypeOf(result.current.input);
|
|
128
|
-
if (result.current.status === "success") {
|
|
129
|
-
expectTypeOf(result.current.output);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
60
|
//# sourceMappingURL=use-tool-info.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tool-info.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-tool-info.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-tool-info.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-tool-info.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,wB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qFAAqF,EAAE,KAAK,IAAI,EAAE;QACnG,MAAM,UAAU,GAAG;YACjB,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,QAAQ;YACf,WAAW,EACT,kGAAkG;SACrG,CAAC;QACF,MAAM,oBAAoB,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;QACxC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;QAEnD,GAAG,CAAC,GAAG,EAAE;YACP,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC;YACnC,UAAU,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;YACvD,SAAS,CACP,MAAM,EACN,IAAI,eAAe,CAAC,sBAAsB,EAAE;gBAC1C,MAAM,EAAE;oBACN,OAAO,EAAE;wBACP,UAAU;wBACV,oBAAoB;qBACrB;iBACF;aACF,CAAC,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,GAAG,EAAE;YACjB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC;gBACnC,MAAM,EAAE,SAAS;gBACjB,SAAS,EAAE,KAAK;gBAChB,SAAS,EAAE,IAAI;gBACf,MAAM,EAAE,UAAU;gBAClB,gBAAgB,EAAE,oBAAoB;aACvC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { UserAgent } from "../types.js";
|
|
2
|
+
export type UserState = {
|
|
3
|
+
locale: string;
|
|
4
|
+
userAgent: UserAgent;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Hook for accessing session-stable user information.
|
|
8
|
+
* These values are set once at initialization and do not change during the session.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const { locale, userAgent } = useUser();
|
|
13
|
+
*
|
|
14
|
+
* // Access device type
|
|
15
|
+
* const isMobile = userAgent.device.type === "mobile";
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function useUser(): UserState;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useAppsSdkBridge, useBridge } from "../bridges/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Hook for accessing session-stable user information.
|
|
4
|
+
* These values are set once at initialization and do not change during the session.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const { locale, userAgent } = useUser();
|
|
9
|
+
*
|
|
10
|
+
* // Access device type
|
|
11
|
+
* const isMobile = userAgent.device.type === "mobile";
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export function useUser() {
|
|
15
|
+
const locale = useBridge("locale");
|
|
16
|
+
const userAgent = useAppsSdkBridge("userAgent");
|
|
17
|
+
return { locale, userAgent };
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=use-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-user.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQlE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,OAAO;IACrB,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAEhD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { renderHook } from "@testing-library/react";
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { useUser } from "./use-user.js";
|
|
4
|
+
describe("useUser", () => {
|
|
5
|
+
let OpenaiMock;
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
OpenaiMock = {
|
|
8
|
+
locale: "en-US",
|
|
9
|
+
userAgent: {
|
|
10
|
+
device: { type: "desktop" },
|
|
11
|
+
capabilities: { hover: true, touch: false },
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
vi.stubGlobal("openai", OpenaiMock);
|
|
15
|
+
vi.stubGlobal("skybridge", { hostType: "apps-sdk" });
|
|
16
|
+
});
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
vi.unstubAllGlobals();
|
|
19
|
+
vi.resetAllMocks();
|
|
20
|
+
});
|
|
21
|
+
it("should return locale and userAgent from window.openai", () => {
|
|
22
|
+
const { result } = renderHook(() => useUser());
|
|
23
|
+
expect(result.current.locale).toBe("en-US");
|
|
24
|
+
expect(result.current.userAgent).toEqual({
|
|
25
|
+
device: { type: "desktop" },
|
|
26
|
+
capabilities: { hover: true, touch: false },
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
it("should return mobile userAgent when set to mobile", () => {
|
|
30
|
+
OpenaiMock.userAgent = {
|
|
31
|
+
device: { type: "mobile" },
|
|
32
|
+
capabilities: { hover: false, touch: true },
|
|
33
|
+
};
|
|
34
|
+
const { result } = renderHook(() => useUser());
|
|
35
|
+
expect(result.current.userAgent.device.type).toBe("mobile");
|
|
36
|
+
expect(result.current.userAgent.capabilities.touch).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
it("should return different locale when set", () => {
|
|
39
|
+
OpenaiMock.locale = "es-ES";
|
|
40
|
+
const { result } = renderHook(() => useUser());
|
|
41
|
+
expect(result.current.locale).toBe("es-ES");
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=use-user.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-user.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-user.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,U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AC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,UAAU,CAAC,SAAS,GAAG;YACrB,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;SAC5C,CAAC;QACF,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAE/C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5D,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC;QAC5B,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAE/C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useAppsSdkBridge } from "../bridges/index.js";
|
|
3
|
+
import { filterWidgetContext, injectWidgetContext } from "../helpers/state.js";
|
|
3
4
|
export function useWidgetState(defaultState) {
|
|
4
|
-
const widgetStateFromWindow =
|
|
5
|
+
const widgetStateFromWindow = useAppsSdkBridge("widgetState");
|
|
5
6
|
const [widgetState, _setWidgetState] = useState(() => {
|
|
6
7
|
if (widgetStateFromWindow !== null) {
|
|
7
|
-
return widgetStateFromWindow;
|
|
8
|
+
return filterWidgetContext(widgetStateFromWindow);
|
|
8
9
|
}
|
|
9
10
|
return typeof defaultState === "function"
|
|
10
11
|
? defaultState()
|
|
11
|
-
: defaultState ?? null;
|
|
12
|
+
: (defaultState ?? null);
|
|
12
13
|
});
|
|
13
14
|
useEffect(() => {
|
|
14
15
|
// Fixes openai implementation bug
|
|
15
16
|
if (widgetStateFromWindow !== null) {
|
|
16
|
-
_setWidgetState(widgetStateFromWindow);
|
|
17
|
+
_setWidgetState(filterWidgetContext(widgetStateFromWindow));
|
|
17
18
|
}
|
|
18
19
|
}, [widgetStateFromWindow]);
|
|
19
20
|
const setWidgetState = useCallback((state) => {
|
|
20
21
|
_setWidgetState((prevState) => {
|
|
21
22
|
const newState = typeof state === "function" ? state(prevState) : state;
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const stateToSet = injectWidgetContext(newState);
|
|
24
|
+
if (stateToSet !== null) {
|
|
25
|
+
window.openai.setWidgetState(stateToSet);
|
|
24
26
|
}
|
|
25
|
-
return
|
|
27
|
+
return filterWidgetContext(stateToSet);
|
|
26
28
|
});
|
|
27
|
-
}, [
|
|
29
|
+
}, []);
|
|
28
30
|
return [widgetState, setWidgetState];
|
|
29
31
|
}
|
|
30
32
|
//# sourceMappingURL=use-widget-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-widget-state.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-widget-state.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-widget-state.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-widget-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE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