@elementor/angie-sdk 1.4.8 → 1.4.9-beta.12
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/README.md +6 -0
- package/dist/angie-mcp-sdk.d.ts +2 -0
- package/dist/iframe.d.ts +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/load-sidebar-v2/boot-sidebar.d.ts +2 -0
- package/dist/load-sidebar-v2/chat-toggle/chat-shell.d.ts +15 -0
- package/dist/load-sidebar-v2/chat-toggle/constants.d.ts +7 -0
- package/dist/load-sidebar-v2/chat-toggle/init-floating-chat-layout.d.ts +9 -0
- package/dist/load-sidebar-v2/chat-toggle/toggle-button-element.d.ts +2 -0
- package/dist/load-sidebar-v2/chat-toggle/widget-ui.d.ts +4 -0
- package/dist/load-sidebar-v2/config.d.ts +64 -0
- package/dist/load-sidebar-v2/container.d.ts +1 -0
- package/dist/load-sidebar-v2/defaults.d.ts +24 -0
- package/dist/load-sidebar-v2/embedded-handshake.d.ts +3 -0
- package/dist/load-sidebar-v2/env.d.ts +6 -0
- package/dist/load-sidebar-v2/host-api-bridge.d.ts +29 -0
- package/dist/load-sidebar-v2/host-message-router.d.ts +4 -0
- package/dist/load-sidebar-v2/inject-style-theme.d.ts +2 -0
- package/dist/load-sidebar-v2/layouts/index.d.ts +15 -0
- package/dist/load-sidebar-v2/open-embedded-iframe.d.ts +8 -0
- package/dist/load-sidebar-v2/presets/floating-chat.d.ts +7 -0
- package/dist/load-sidebar-v2/presets/sidebar.d.ts +7 -0
- package/dist/load-sidebar-v2/resolve-config.d.ts +4 -0
- package/dist/load-sidebar-v2/shell.d.ts +4 -0
- package/dist/load-sidebar-v2/sidebar-toggle.d.ts +6 -0
- package/dist/load-sidebar-v2/toggle-button.d.ts +8 -0
- package/dist/load-sidebar-v2/widget-config.d.ts +3 -0
- package/dist/openSaaSPage.d.ts +2 -0
- package/dist/sidebar.d.ts +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type InitChatShellArgs = {
|
|
2
|
+
containerId: string;
|
|
3
|
+
iframeOrigin: string;
|
|
4
|
+
toggleButtonSelector: string;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
};
|
|
7
|
+
type SetChatWidgetOpenArgs = {
|
|
8
|
+
containerId: string;
|
|
9
|
+
toggleButtonSelector: string;
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const setChatWidgetOpen: (args: SetChatWidgetOpenArgs) => void;
|
|
13
|
+
export declare const initChatShell: (args: InitChatShellArgs) => void;
|
|
14
|
+
export declare const resetChatShellForTests: () => void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const CHAT_TOGGLE_BUTTON_CLASS = "angie-widget-toggle";
|
|
2
|
+
export declare const DEFAULT_CHAT_TOGGLE_BUTTON_SELECTOR = "#angie-widget-toggle";
|
|
3
|
+
export declare const CHAT_WIDGET_HIDDEN_CLASS = "angie-widget-hidden";
|
|
4
|
+
export declare const CHAT_WIDGET_FULLSCREEN_CLASS = "angie-widget-fullscreen";
|
|
5
|
+
export declare const CHAT_WIDGET_CONTAINER_CLASS = "angie-widget-container";
|
|
6
|
+
export declare const CHAT_WIDGET_STYLES_ID = "angie-chat-widget-styles";
|
|
7
|
+
export declare const CHAT_TOGGLE_STYLES_ID = "angie-chat-toggle-styles";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type InitFloatingChatLayoutArgs = {
|
|
2
|
+
containerId: string;
|
|
3
|
+
iframeOrigin: string;
|
|
4
|
+
toggleButtonSelector: string;
|
|
5
|
+
injectToggleButton: boolean;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const initFloatingChatLayout: (args: InitFloatingChatLayoutArgs) => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const injectChatToggleButtonStyles: () => void;
|
|
2
|
+
export declare const injectChatWidgetStyles: (containerId: string) => void;
|
|
3
|
+
export declare const prepareChatWidgetContainer: (containerId: string) => void;
|
|
4
|
+
export declare const injectChatToggleButton: (toggleButtonSelector: string) => void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { WidgetConfig } from '../angie-mcp-sdk';
|
|
2
|
+
export declare const LOAD_SIDEBAR_V2_CONFIG_VERSION: 2;
|
|
3
|
+
export declare const LAYOUT_SIDEBAR: "sidebar";
|
|
4
|
+
export declare const LAYOUT_FLOATING_CHAT: "floatingChat";
|
|
5
|
+
export type LoadSidebarV2Layout = typeof LAYOUT_SIDEBAR | typeof LAYOUT_FLOATING_CHAT;
|
|
6
|
+
export type LoadSidebarV2ContainerStyleTheme = 'wordpress' | '';
|
|
7
|
+
export type HostConfig = {
|
|
8
|
+
appId: string;
|
|
9
|
+
aiContext?: Record<string, unknown>;
|
|
10
|
+
website?: Record<string, unknown>;
|
|
11
|
+
analytics?: Record<string, unknown>;
|
|
12
|
+
};
|
|
13
|
+
export type BootConfig = {
|
|
14
|
+
allowInIframe: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type BootOptions = Partial<BootConfig>;
|
|
17
|
+
export type ContainerConfig = {
|
|
18
|
+
id: string;
|
|
19
|
+
layout: LoadSidebarV2Layout;
|
|
20
|
+
styleTheme: LoadSidebarV2ContainerStyleTheme;
|
|
21
|
+
persistOpenState: boolean;
|
|
22
|
+
resizable: boolean;
|
|
23
|
+
chatToggleButton: {
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
selector: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type ContainerOptions = Partial<ContainerConfig>;
|
|
29
|
+
export type IframeConfig = {
|
|
30
|
+
origin: string;
|
|
31
|
+
path: string;
|
|
32
|
+
uiTheme: string;
|
|
33
|
+
isRTL: boolean;
|
|
34
|
+
};
|
|
35
|
+
export type IframeOptions = Partial<IframeConfig>;
|
|
36
|
+
export type ExternalHeadersCallback = () => Record<string, string | undefined> | Promise<Record<string, string | undefined>>;
|
|
37
|
+
export type CallbacksConfig = {
|
|
38
|
+
onClose?: () => void;
|
|
39
|
+
getExternalHeaders?: ExternalHeadersCallback;
|
|
40
|
+
};
|
|
41
|
+
export type LoadSidebarV2Options = {
|
|
42
|
+
host: HostConfig;
|
|
43
|
+
boot?: BootOptions;
|
|
44
|
+
container?: ContainerOptions;
|
|
45
|
+
iframe?: IframeOptions;
|
|
46
|
+
callbacks?: CallbacksConfig;
|
|
47
|
+
widgetConfig?: WidgetConfig;
|
|
48
|
+
};
|
|
49
|
+
export type ResolvedConfigV2 = {
|
|
50
|
+
host: HostConfig;
|
|
51
|
+
boot: BootConfig;
|
|
52
|
+
container: ContainerConfig;
|
|
53
|
+
iframe: IframeConfig;
|
|
54
|
+
callbacks: CallbacksConfig;
|
|
55
|
+
widgetConfig?: WidgetConfig;
|
|
56
|
+
};
|
|
57
|
+
export type HostEmbeddedConfigPayload = {
|
|
58
|
+
aiContext?: Record<string, unknown>;
|
|
59
|
+
appId?: string;
|
|
60
|
+
configVersion: typeof LOAD_SIDEBAR_V2_CONFIG_VERSION;
|
|
61
|
+
telemetry?: Record<string, unknown>;
|
|
62
|
+
website?: Record<string, unknown>;
|
|
63
|
+
};
|
|
64
|
+
export declare const buildHostEmbeddedConfigPayload: (host: ResolvedConfigV2["host"]) => HostEmbeddedConfigPayload;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ensureSidebarContainer: (containerId: string, isRTL: boolean) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DEFAULT_CONTAINER_ID } from '../config';
|
|
2
|
+
import { SIDEBAR_PRESET_DEFAULTS } from './presets/sidebar';
|
|
3
|
+
export { SIDEBAR_PRESET_DEFAULTS };
|
|
4
|
+
export { DEFAULT_CONTAINER_ID };
|
|
5
|
+
export declare const DEFAULT_CHAT_TOGGLE_BUTTON_SELECTOR = "#angie-widget-toggle";
|
|
6
|
+
export declare const DEFAULTS: {
|
|
7
|
+
readonly boot: {
|
|
8
|
+
readonly allowInIframe: false;
|
|
9
|
+
};
|
|
10
|
+
readonly container: {
|
|
11
|
+
readonly layout: "sidebar";
|
|
12
|
+
readonly styleTheme: "";
|
|
13
|
+
readonly persistOpenState: true;
|
|
14
|
+
readonly resizable: true;
|
|
15
|
+
readonly chatToggleButtonSelector: "#angie-widget-toggle";
|
|
16
|
+
};
|
|
17
|
+
readonly iframe: {
|
|
18
|
+
readonly origin: "https://angie.elementor.com";
|
|
19
|
+
readonly path: "angie/embedded";
|
|
20
|
+
readonly uiTheme: "light";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export declare const SIDEBAR_LOADING_ID = "angie-sidebar-loading";
|
|
24
|
+
export declare const EMBEDDED_CONFIG_MESSAGE_TYPE = "sdk-embedded-config";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { HostEmbeddedConfigPayload, ResolvedConfigV2 } from './config';
|
|
2
|
+
export declare const sendEmbeddedConfig: (payload: HostEmbeddedConfigPayload) => void;
|
|
3
|
+
export declare const sendWidgetConfig: (widgetConfig: NonNullable<ResolvedConfigV2["widgetConfig"]>) => void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ExternalHeadersCallback, HostConfig } from './config';
|
|
2
|
+
export declare const GET_EXTERNAL_HEADERS_MESSAGE_TYPE = "GET_EXTERNAL_HEADERS";
|
|
3
|
+
export declare const GET_WEBSITE_CONTEXT_MESSAGE_TYPE = "angie/context/get-website-context";
|
|
4
|
+
export declare const GET_ANALYTICS_CONTEXT_MESSAGE_TYPE = "angie/context/get-analytics-context";
|
|
5
|
+
type InitHostApiBridgeArgs = {
|
|
6
|
+
iframeOrigin: string;
|
|
7
|
+
host?: HostConfig;
|
|
8
|
+
getExternalHeaders?: ExternalHeadersCallback;
|
|
9
|
+
};
|
|
10
|
+
export declare const buildWebsiteContextResponse: (host?: HostConfig) => {
|
|
11
|
+
payload: {
|
|
12
|
+
timezone: string;
|
|
13
|
+
today: string;
|
|
14
|
+
name: string;
|
|
15
|
+
tagline: string;
|
|
16
|
+
homeUrl: string;
|
|
17
|
+
siteLang: string;
|
|
18
|
+
docTitle: string;
|
|
19
|
+
platform: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const buildAnalyticsContextResponse: (host?: HostConfig) => {
|
|
23
|
+
payload: {
|
|
24
|
+
screenPath: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare const initHostApiBridge: (args: InitHostApiBridgeArgs) => void;
|
|
28
|
+
export declare const resetHostApiBridgeForTests: () => void;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ResolvedConfigV2 } from '../config';
|
|
2
|
+
import type { Env } from '../env';
|
|
3
|
+
export type LayoutBootContext = {
|
|
4
|
+
config: ResolvedConfigV2;
|
|
5
|
+
env: Env;
|
|
6
|
+
};
|
|
7
|
+
export type LayoutStrategy = {
|
|
8
|
+
initShell: (ctx: LayoutBootContext) => void;
|
|
9
|
+
beforeOpenIframe?: (ctx: LayoutBootContext) => void;
|
|
10
|
+
afterOpenIframe?: (ctx: LayoutBootContext) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const LAYOUT_STRATEGIES: {
|
|
13
|
+
sidebar: LayoutStrategy;
|
|
14
|
+
floatingChat: LayoutStrategy;
|
|
15
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type HostEmbeddedConfigPayload, type ResolvedConfigV2 } from './config';
|
|
2
|
+
type OpenEmbeddedIframeArgs = {
|
|
3
|
+
container: ResolvedConfigV2['container'];
|
|
4
|
+
iframe: ResolvedConfigV2['iframe'];
|
|
5
|
+
embeddedConfig?: HostEmbeddedConfigPayload;
|
|
6
|
+
};
|
|
7
|
+
export declare const openEmbeddedIframe: (args: OpenEmbeddedIframeArgs) => Promise<void>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Env } from './env';
|
|
2
|
+
import { type LoadSidebarV2Options, type ResolvedConfigV2 } from './config';
|
|
3
|
+
export declare const shouldBoot: (config: ResolvedConfigV2, env: Env) => boolean;
|
|
4
|
+
export declare const resolveConfig: (options: LoadSidebarV2Options, env: Env) => ResolvedConfigV2;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ContainerConfig, ResolvedConfigV2 } from './config';
|
|
2
|
+
export declare const initSidebarShell: (container: ContainerConfig, callbacks: ResolvedConfigV2["callbacks"]) => void;
|
|
3
|
+
export declare const applyInitialSidebarShellState: (container: ContainerConfig) => void;
|
|
4
|
+
export declare const finalizeSidebarShellState: (container: ContainerConfig) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type WireSidebarToggleButtonArgs = {
|
|
2
|
+
toggleButtonSelector: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const syncSidebarToggleButton: (toggleButtonSelector: string, isOpen: boolean) => void;
|
|
5
|
+
export declare const wireSidebarToggleButton: (args: WireSidebarToggleButtonArgs) => void;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const TOGGLE_BUTTON_WIRED_ATTR = "data-angie-toggle-wired";
|
|
2
|
+
export declare const syncToggleButton: (toggleButtonSelector: string, isOpen: boolean) => void;
|
|
3
|
+
type WireToggleButtonArgs = {
|
|
4
|
+
toggleButtonSelector: string;
|
|
5
|
+
onClick: (event: Event) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const wireToggleButton: (args: WireToggleButtonArgs) => void;
|
|
8
|
+
export {};
|
package/dist/openSaaSPage.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { HostEmbeddedConfigPayload } from "./load-sidebar-v2/config";
|
|
1
2
|
type OpenSaaSPageInput = {
|
|
2
3
|
origin: string;
|
|
3
4
|
path: string;
|
|
4
5
|
parent?: Document;
|
|
5
6
|
insertCallback?: (iframe: HTMLIFrameElement) => void;
|
|
7
|
+
embeddedConfig?: HostEmbeddedConfigPayload;
|
|
6
8
|
css: {
|
|
7
9
|
[key: string]: string | number;
|
|
8
10
|
};
|
package/dist/sidebar.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare function saveState(state: string): void;
|
|
|
13
13
|
export declare function saveWidth(width: number): void;
|
|
14
14
|
export declare function applyWidth(width: number): void;
|
|
15
15
|
export declare function forceSidebarClosedDuringOAuth(): void;
|
|
16
|
-
export declare function loadState(): void;
|
|
16
|
+
export declare function loadState(defaultState?: AngieSidebarState): void;
|
|
17
17
|
export declare function applyState(state: AngieSidebarState): void;
|
|
18
18
|
export declare function initializeResize(): void;
|
|
19
19
|
export declare function createToggleSidebarFunction(onToggle?: (isOpen: boolean, sidebar: HTMLElement, skipTransition?: boolean) => void): (force?: boolean, skipTransition?: boolean) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/angie-sdk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9-beta.12",
|
|
4
4
|
"description": "TypeScript SDK for Angie AI assistant",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"dev": "tsc --watch",
|
|
22
22
|
"test": "jest",
|
|
23
23
|
"lint": "eslint src/**/*.ts",
|
|
24
|
-
"lint:fix": "eslint src/**/*.ts --fix"
|
|
24
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
25
|
+
"demo": "npm run build && npx --yes serve . -l 8080"
|
|
25
26
|
},
|
|
26
27
|
"keywords": [
|
|
27
28
|
"mcp",
|