webim-adapter 0.1.0
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 +126 -0
- package/build/webim-adapter.js +1770 -0
- package/build/webim-embed.js +12 -0
- package/build/webim-ssr.js +1766 -0
- package/package.json +46 -0
- package/ssr.d.ts +38 -0
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "webim-adapter",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Render WebIM builder pages inside any React app",
|
|
5
|
+
"author": "Orhan POLAT",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./build/webim-adapter.js",
|
|
9
|
+
"module": "./build/webim-adapter.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./build/webim-adapter.js",
|
|
12
|
+
"./embed": "./build/webim-embed.js",
|
|
13
|
+
"./ssr": {
|
|
14
|
+
"types": "./ssr.d.ts",
|
|
15
|
+
"default": "./build/webim-ssr.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"build",
|
|
20
|
+
"ssr.d.ts",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "vite build && vite build -c vite.embed.config.js && vite build -c vite.ssr.config.js",
|
|
26
|
+
"watch": "vite build --watch",
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"react": ">=19",
|
|
31
|
+
"react-dom": ">=19"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
35
|
+
"react": "^19.2.5",
|
|
36
|
+
"react-dom": "^19.2.5",
|
|
37
|
+
"vite": "^8.0.8"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"webim",
|
|
41
|
+
"page-builder",
|
|
42
|
+
"cms",
|
|
43
|
+
"embed",
|
|
44
|
+
"react"
|
|
45
|
+
]
|
|
46
|
+
}
|
package/ssr.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface WebimBundle {
|
|
2
|
+
schema: number;
|
|
3
|
+
title?: string;
|
|
4
|
+
slug?: string;
|
|
5
|
+
blocks: Record<string, unknown>;
|
|
6
|
+
theme?: unknown;
|
|
7
|
+
components?: Record<string, unknown>;
|
|
8
|
+
custom?: { css?: string; js?: string };
|
|
9
|
+
seo?: { title?: string; description?: string; image?: string; noindex?: boolean };
|
|
10
|
+
locales?: unknown;
|
|
11
|
+
tenant?: string;
|
|
12
|
+
apiUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface RenderOptions {
|
|
16
|
+
mode?: 'auto' | 'light' | 'dark';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function assembleBundle(input: {
|
|
20
|
+
page: { title?: string; slug?: string; blocks: Record<string, unknown>; meta?: Record<string, any> };
|
|
21
|
+
settings?: { global?: Record<string, unknown>; tenant?: Record<string, unknown> };
|
|
22
|
+
tenant?: string;
|
|
23
|
+
apiUrl?: string;
|
|
24
|
+
locale?: string;
|
|
25
|
+
}): WebimBundle;
|
|
26
|
+
|
|
27
|
+
export function fetchPage(options: {
|
|
28
|
+
apiUrl: string;
|
|
29
|
+
tenant?: string;
|
|
30
|
+
slug: string;
|
|
31
|
+
locale?: string;
|
|
32
|
+
preview?: string;
|
|
33
|
+
fetch?: typeof fetch;
|
|
34
|
+
}): Promise<WebimBundle>;
|
|
35
|
+
|
|
36
|
+
export function renderBundleHtml(bundle: WebimBundle, options?: RenderOptions & { style?: object }): string;
|
|
37
|
+
|
|
38
|
+
export function renderPageDocument(bundle: WebimBundle, options?: RenderOptions & { lang?: string }): string;
|