@charisol/plexo-sdk 1.0.6 → 1.0.8
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 +49 -9
- package/dist/PlexoRenderer.d.ts +27 -0
- package/dist/components/AIResponseBubble.d.ts +17 -0
- package/dist/components/sidebarTabs/AiConfigSection.d.ts +10 -0
- package/dist/components/sidebarTabs/BodyGlobalSettingsTab.d.ts +4 -1
- package/dist/components/sidebarTabs/ImagesTab.d.ts +5 -0
- package/dist/components/sidebarTabs/PublishTab.d.ts +2 -6
- package/dist/components/sidebarTabs/SettingsTab.d.ts +18 -0
- package/dist/components/sidebarTabs/SidebarTabsRail.d.ts +0 -1
- package/dist/components/sidebarTabs/StrataTab.d.ts +0 -3
- package/dist/components/sidebarTabs/UploadsTab.d.ts +3 -0
- package/dist/index.js +13900 -12844
- package/dist/plexo-sdk.css +1 -1
- package/dist/utilities/aiHelper.d.ts +20 -19
- package/dist/utilities/apiConfig.d.ts +31 -0
- package/dist/utilities/colorUtils.d.ts +6 -0
- package/dist/utilities/playground.interfaces.d.ts +7 -7
- package/dist/utilities/plexoBuilderRuntime.d.ts +2 -2
- package/dist/utilities/types.d.ts +15 -0
- package/dist/utilities/useAIAction.d.ts +24 -0
- package/dist/utilities/useApiKeyValidation.d.ts +2 -0
- package/dist/utilities/usePublishConfigOverride.d.ts +15 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
- 🎨 **Visual drag-and-drop builder** — rows, columns, and elements with live editing
|
|
13
13
|
- 📧 **Email & Landing Page modes** — export clean, production-ready HTML for both
|
|
14
|
-
- 🤖 **AI content generation** —
|
|
14
|
+
- 🤖 **AI content generation** — edit a single element, edit the whole layout, or generate a fresh layout from a prompt, with support for OpenAI, Gemini, and Claude
|
|
15
|
+
- 🔒 **Server-proxied AI, no exposed keys** — your provider API key is never sent to or stored in the browser; every AI request is authenticated with your Plexo API key and resolved against your account's server-side configuration
|
|
16
|
+
- 💬 **Claude-Code-style AI feedback** — a loading bubble followed by a one-line summary of what changed, for both the per-element editor and the layout prompt bar
|
|
15
17
|
- 🖼️ **Stock image search** — Unsplash, Pexels, Pixabay integrations
|
|
16
18
|
- 🎨 **Design token system** — Strata token support for consistent brand theming
|
|
17
|
-
- 📦 **ESM-only, pure client-side** —
|
|
19
|
+
- 📦 **ESM-only, pure client-side component** — nothing to self-host; the SDK talks directly to Plexo's hosted API for AI/publish/compile using your Plexo API key
|
|
18
20
|
|
|
19
21
|
---
|
|
20
22
|
|
|
@@ -152,20 +154,50 @@ export default function EditorPage() {
|
|
|
152
154
|
| `autoSave` | `boolean` | `false` | Auto-save periodically |
|
|
153
155
|
| `autoSaveDuration` | `number` | `3000` | Auto-save interval in ms |
|
|
154
156
|
| `onUpload` | `(file: File) => Promise<string> \| string` | — | Custom image upload handler, returns URL |
|
|
155
|
-
| `backgroundColor` | `string` | `'#
|
|
156
|
-
| `themeBgColor` | `string` | `'#
|
|
157
|
+
| `backgroundColor` | `string` | `'#0e1526'` | Canvas background colour |
|
|
158
|
+
| `themeBgColor` | `string` | `'#4f46e5'` | Primary brand/accent colour |
|
|
157
159
|
| `themeFgColor` | `string` | `'#ffffff'` | Foreground colour on brand elements |
|
|
158
|
-
| `textColor` | `string` | `'#
|
|
159
|
-
| `useAi` | `boolean` | `false` | Enable AI content generation |
|
|
160
|
-
| `aiProvider` | `'openai' \| 'gemini' \| 'claude'` | `'openai'` |
|
|
161
|
-
| `
|
|
162
|
-
| `aiTier` | `'AUTO' \| 'BASIC' \| 'MEDIUM' \| 'HIGH'` | `'AUTO'` | AI model tier |
|
|
160
|
+
| `textColor` | `string` | `'#e2e8f0'` | Default body text colour |
|
|
161
|
+
| `useAi` | `boolean` | `false` | Enable AI content generation. Also gates locally — if `false`, AI UI is hidden/disabled without a round trip |
|
|
162
|
+
| `aiProvider` | `'openai' \| 'gemini' \| 'claude' \| string` | `'openai'` | **Display/label only.** The provider actually used is resolved server-side from your Plexo account's configuration — this prop does not select or override it |
|
|
163
|
+
| `aiTier` | `'AUTO' \| 'BASIC' \| 'MEDIUM' \| 'HIGH' \| string` | `'AUTO'` | Requested model tier, sent with each AI request as an override of your account's default tier. `AUTO` lets the server pick BASIC/MEDIUM/HIGH per-request based on prompt complexity |
|
|
163
164
|
| `unsplashKey` | `string` | — | Unsplash API key for stock images |
|
|
164
165
|
| `pexelsKey` | `string` | — | Pexels API key for stock images |
|
|
165
166
|
| `pixabayKey` | `string` | — | Pixabay API key for stock images |
|
|
166
167
|
|
|
167
168
|
---
|
|
168
169
|
|
|
170
|
+
## AI Configuration
|
|
171
|
+
|
|
172
|
+
AI generation (per-element editing, whole-layout editing, and generating a brand-new layout when the canvas is empty) runs entirely **server-side**. There is no `aiApiKey` prop and never will be — a provider API key (OpenAI, Anthropic, or Gemini) is configured once against your Plexo account and stays there, encrypted at rest. The SDK authenticates AI requests with the same `apiKey` you already pass to `PlexoBuilder`; the server resolves your account's provider, key, and default tier from that.
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
<PlexoBuilder
|
|
176
|
+
apiKey="your-plexo-api-key"
|
|
177
|
+
useAi
|
|
178
|
+
aiTier="AUTO" // optional override: 'AUTO' | 'BASIC' | 'MEDIUM' | 'HIGH'
|
|
179
|
+
// no aiApiKey, no aiProvider selection — both are account-level, not props
|
|
180
|
+
...
|
|
181
|
+
/>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Tiers**, from cheapest/fastest to most capable: `BASIC` → `MEDIUM` → `HIGH`. `AUTO` (the default) classifies each prompt's complexity server-side and picks the right tier automatically — a quick "change the button color" won't spend the same budget as "redesign this whole landing page."
|
|
185
|
+
|
|
186
|
+
**Per-template override:** `TemplateJSON.body.aiConfig` can override `useAi`/`tier` for a single template:
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
aiConfig?: {
|
|
190
|
+
useAi?: boolean;
|
|
191
|
+
tier?: string;
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Notice there's no `apiKey`/`provider` field here either — a template's JSON is loaded into the browser wholesale for editing, so a secret stored inside it could never actually be kept safe. The real key always comes from your account's server-side configuration, never from the template.
|
|
196
|
+
|
|
197
|
+
**Where AI requests actually go:** if `apiKey` is `"workspace-internal"` (the sentinel used when the SDK is rendered by Plexo's own dashboard), requests stay same-origin. For every real Plexo API key — i.e. any third-party integration — requests are routed automatically to Plexo's hosted production API. There's nothing to configure. If a request ever fails with a 404 here, it means this package version is out of date; update with `npm install @charisol/plexo-sdk@latest`.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
169
201
|
## `PlexoBuilderRef` — Imperative API
|
|
170
202
|
|
|
171
203
|
Access via `ref` on the component:
|
|
@@ -228,6 +260,14 @@ const PlexoBuilder = lazy(() =>
|
|
|
228
260
|
|
|
229
261
|
## Changelog
|
|
230
262
|
|
|
263
|
+
### Unreleased
|
|
264
|
+
- **Breaking:** Removed the `aiApiKey` prop. AI generation now runs server-side — your provider key is configured once against your Plexo account (encrypted at rest) instead of being passed to the browser on every render.
|
|
265
|
+
- **Breaking:** `TemplateJSON.body.aiConfig` no longer accepts `apiKey`/`provider` — only `useAi`/`tier` remain, for the same reason (a template's JSON is loaded client-side, so it can't hold a secret safely).
|
|
266
|
+
- `aiProvider` is now display/label-only; the effective provider comes from your account configuration, not this prop.
|
|
267
|
+
- New Claude-Code-style AI feedback: a loading bubble followed by a one-line summary of what changed, for both the per-element "Edit with AI" popup and the layout AI prompt bar.
|
|
268
|
+
- The layout AI prompt bar now generates a brand-new layout automatically when the canvas is empty, instead of only editing existing content.
|
|
269
|
+
- AI requests (and publish/validate-key requests, when using a real Plexo API key rather than the dashboard's internal session) now route automatically to Plexo's hosted production API — nothing to configure. A 404 here means the installed package version is stale; update to the latest.
|
|
270
|
+
|
|
231
271
|
### 1.0.1
|
|
232
272
|
- Fixed: Removed Rolldown CJS interop shim (`require()`) from ESM output — resolves compatibility issues with Turbopack (Next.js 15+/16+) and strict ESM environments
|
|
233
273
|
- All React sub-paths (`react/jsx-runtime`, etc.) are now properly externalized
|
package/dist/PlexoRenderer.d.ts
CHANGED
|
@@ -65,6 +65,15 @@ export declare const UploadedImageSchema: z.ZodObject<{
|
|
|
65
65
|
name: z.ZodString;
|
|
66
66
|
src: z.ZodString;
|
|
67
67
|
}, z.core.$strip>;
|
|
68
|
+
export declare const PublishConfigSchema: z.ZodObject<{
|
|
69
|
+
apiKeyOverride: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
export declare const AiConfigSchema: z.ZodObject<{
|
|
72
|
+
useAi: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
74
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
75
|
+
tier: z.ZodOptional<z.ZodString>;
|
|
76
|
+
}, z.core.$strip>;
|
|
68
77
|
export declare const BodyJSONSchema: z.ZodObject<{
|
|
69
78
|
style: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
70
79
|
rows: z.ZodArray<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>;
|
|
@@ -84,6 +93,15 @@ export declare const BodyJSONSchema: z.ZodObject<{
|
|
|
84
93
|
CUSTOM: "CUSTOM";
|
|
85
94
|
}>;
|
|
86
95
|
}, z.core.$strip>>;
|
|
96
|
+
publishConfig: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
apiKeyOverride: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>>;
|
|
99
|
+
aiConfig: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
useAi: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
102
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
103
|
+
tier: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>>;
|
|
87
105
|
}, z.core.$strip>;
|
|
88
106
|
export declare const TemplateJSONSchema: z.ZodObject<{
|
|
89
107
|
body: z.ZodObject<{
|
|
@@ -105,6 +123,15 @@ export declare const TemplateJSONSchema: z.ZodObject<{
|
|
|
105
123
|
CUSTOM: "CUSTOM";
|
|
106
124
|
}>;
|
|
107
125
|
}, z.core.$strip>>;
|
|
126
|
+
publishConfig: z.ZodOptional<z.ZodObject<{
|
|
127
|
+
apiKeyOverride: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, z.core.$strip>>;
|
|
129
|
+
aiConfig: z.ZodOptional<z.ZodObject<{
|
|
130
|
+
useAi: z.ZodOptional<z.ZodBoolean>;
|
|
131
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
132
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
133
|
+
tier: z.ZodOptional<z.ZodString>;
|
|
134
|
+
}, z.core.$strip>>;
|
|
108
135
|
}, z.core.$strip>;
|
|
109
136
|
}, z.core.$strip>;
|
|
110
137
|
/**
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AIActionStatus } from '../utilities/useAIAction';
|
|
3
|
+
interface AIResponseBubbleProps {
|
|
4
|
+
status: AIActionStatus;
|
|
5
|
+
summary?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
onRetry?: () => void;
|
|
8
|
+
onDismiss?: () => void;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Claude-Code-style loading/result bubble shared by the per-element "Edit with AI"
|
|
13
|
+
* popup and the whole-layout prompt bar: pulsing-dots loader with a rotating status
|
|
14
|
+
* label, a checkmark + summary on success, or a retry affordance on error.
|
|
15
|
+
*/
|
|
16
|
+
export declare const AIResponseBubble: React.FC<AIResponseBubbleProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AiConfigSectionProps {
|
|
3
|
+
/** Host's Plexo API key — used to resolve/clear the personal override key, same as the Publish tab. */
|
|
4
|
+
hostApiKey: string;
|
|
5
|
+
hostUseAi?: boolean;
|
|
6
|
+
hostAiProvider?: string;
|
|
7
|
+
hostAiTier?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const AiConfigSection: React.FC<AiConfigSectionProps>;
|
|
10
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface BodyGlobalSettingsTabProps {
|
|
3
3
|
template: any;
|
|
4
|
-
hydrateTemplate
|
|
4
|
+
/** Patches template.body.style without touching selection/undo state the way a full hydrateTemplate() would. */
|
|
5
|
+
updateBodyStyle: (style: Record<string, any>) => void;
|
|
5
6
|
openAccordions: Record<string, boolean>;
|
|
6
7
|
toggleAccordion: (key: string) => void;
|
|
7
8
|
notify?: (message: string) => void;
|
|
@@ -13,6 +14,8 @@ interface BodyGlobalSettingsTabProps {
|
|
|
13
14
|
Toggle: React.ComponentType<any>;
|
|
14
15
|
InlineTextInput: React.ComponentType<any>;
|
|
15
16
|
InlineTextArea: React.ComponentType<any>;
|
|
17
|
+
disableImageUpload?: boolean;
|
|
18
|
+
onOpenImageLibrary?: (tab: 'images' | 'uploads', target: any) => void;
|
|
16
19
|
}
|
|
17
20
|
export declare const BodyGlobalSettingsTab: React.FC<BodyGlobalSettingsTabProps>;
|
|
18
21
|
export {};
|
|
@@ -14,6 +14,11 @@ interface ImagesTabProps {
|
|
|
14
14
|
alt?: string;
|
|
15
15
|
}) => void;
|
|
16
16
|
ICONS: Record<string, React.ReactNode>;
|
|
17
|
+
panelBackgroundColor?: string;
|
|
17
18
|
}
|
|
19
|
+
export declare const chunkArray: <T>(arr: T[]) => Array<{
|
|
20
|
+
type: "cols-2" | "cols-3";
|
|
21
|
+
items: T[];
|
|
22
|
+
}>;
|
|
18
23
|
export declare const ImagesTab: React.FC<ImagesTabProps>;
|
|
19
24
|
export {};
|
|
@@ -2,12 +2,8 @@ import React from 'react';
|
|
|
2
2
|
interface PublishTabProps {
|
|
3
3
|
apiKey: string;
|
|
4
4
|
templateId?: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
backgroundColor: string;
|
|
8
|
-
borderColor: string;
|
|
9
|
-
mutedTextColor: string;
|
|
10
|
-
};
|
|
5
|
+
/** Server-resolved (Ultra-gated) — when false, the user must supply their own API key before they can publish. */
|
|
6
|
+
manageLandingPagePublishing?: boolean;
|
|
11
7
|
}
|
|
12
8
|
export declare const PublishTab: React.FC<PublishTabProps>;
|
|
13
9
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SettingsTabProps {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
templateId?: string;
|
|
5
|
+
theme?: {
|
|
6
|
+
textColor: string;
|
|
7
|
+
backgroundColor: string;
|
|
8
|
+
borderColor: string;
|
|
9
|
+
mutedTextColor: string;
|
|
10
|
+
};
|
|
11
|
+
/** Server-resolved (Ultra-gated) — see PlexoBuilder.tsx's resolvedManageLandingPagePublishing. */
|
|
12
|
+
manageLandingPagePublishing?: boolean;
|
|
13
|
+
useAi?: boolean;
|
|
14
|
+
aiProvider?: string;
|
|
15
|
+
aiTier?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const SettingsTab: React.FC<SettingsTabProps>;
|
|
18
|
+
export {};
|
|
@@ -3,7 +3,6 @@ interface SidebarTabsRailProps {
|
|
|
3
3
|
activeSidebarTab: string;
|
|
4
4
|
auditTotal: number;
|
|
5
5
|
ICONS: Record<string, React.ReactNode>;
|
|
6
|
-
allowPublishLandingPage?: boolean;
|
|
7
6
|
onSelect: (id: string) => void;
|
|
8
7
|
}
|
|
9
8
|
export declare const SidebarTabsRail: React.FC<SidebarTabsRailProps>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface UploadsTabProps {
|
|
3
3
|
handleUploadMock: () => void;
|
|
4
|
+
disableImageUpload?: boolean;
|
|
4
5
|
searchUploadQuery: string;
|
|
5
6
|
setSearchUploadQuery: (value: string) => void;
|
|
6
7
|
filteredUploadedImages: Array<{
|
|
@@ -12,7 +13,9 @@ interface UploadsTabProps {
|
|
|
12
13
|
src: string;
|
|
13
14
|
alt?: string;
|
|
14
15
|
}) => void;
|
|
16
|
+
onDeleteUploadedImage?: (id: string) => void;
|
|
15
17
|
ICONS: Record<string, React.ReactNode>;
|
|
18
|
+
panelBackgroundColor?: string;
|
|
16
19
|
}
|
|
17
20
|
export declare const UploadsTab: React.FC<UploadsTabProps>;
|
|
18
21
|
export {};
|