@charisol/plexo-sdk 1.0.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 +242 -0
- package/dist/components/CodeViewer.d.ts +18 -0
- package/dist/components/InternalAlert.d.ts +7 -0
- package/dist/components/PlexoBuilder.d.ts +4 -0
- package/dist/components/PropertyAccordions.d.ts +10 -0
- package/dist/components/SidebarContainer.d.ts +16 -0
- package/dist/components/SidebarMenu.d.ts +6 -0
- package/dist/components/SidebarProperties.d.ts +12 -0
- package/dist/components/TopHeader.d.ts +25 -0
- package/dist/components/VisualCanvas.d.ts +10 -0
- package/dist/components/editor/CanvasDndComponents.d.ts +6 -0
- package/dist/components/editor/dnd/DraggablePaletteItem.d.ts +3 -0
- package/dist/components/editor/dnd/DroppableCanvas.d.ts +3 -0
- package/dist/components/editor/dnd/DroppableColumn.d.ts +3 -0
- package/dist/components/editor/dnd/LayoutPreview.d.ts +5 -0
- package/dist/components/editor/dnd/SortableElement.d.ts +15 -0
- package/dist/components/editor/dnd/SortableRow.d.ts +3 -0
- package/dist/components/icons.d.ts +61 -0
- package/dist/components/inlineControls/AccordionSection.d.ts +3 -0
- package/dist/components/inlineControls/BorderRadiusControls.d.ts +3 -0
- package/dist/components/inlineControls/ColumnsSelector.d.ts +3 -0
- package/dist/components/inlineControls/CustomSelect.d.ts +3 -0
- package/dist/components/inlineControls/InlineAlignment.d.ts +3 -0
- package/dist/components/inlineControls/InlineColorPicker.d.ts +3 -0
- package/dist/components/inlineControls/InlineCounter.d.ts +3 -0
- package/dist/components/inlineControls/InlineSelect.d.ts +3 -0
- package/dist/components/inlineControls/InlineTextArea.d.ts +3 -0
- package/dist/components/inlineControls/InlineTextInput.d.ts +3 -0
- package/dist/components/inlineControls/SpacingControls.d.ts +3 -0
- package/dist/components/inlineControls/StrataTokenPicker.d.ts +12 -0
- package/dist/components/inlineControls/Toggle.d.ts +3 -0
- package/dist/components/inlineControls/UploadZone.d.ts +3 -0
- package/dist/components/inlineControls/index.d.ts +14 -0
- package/dist/components/properties/ElementPropertyAccordions.d.ts +1 -0
- package/dist/components/properties/accordionSections/AdditionalSettingsAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/ButtonPropertiesAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/CarouselPropertiesAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/FormContainerPropertiesAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/HeadingPropertiesAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/HtmlPropertiesAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/IconPropertiesAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/ImagePropertiesAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/LayoutSpacingAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/MenuPropertiesAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/ParagraphPropertiesAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/ResponsiveDesignAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/SocialPropertiesAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/SpacerPropertiesAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/TablePropertiesAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/TimerPropertiesAccordion.d.ts +2 -0
- package/dist/components/properties/accordionSections/VideoPropertiesAccordion.d.ts +2 -0
- package/dist/components/sidebarTabs/AuditTab.d.ts +12 -0
- package/dist/components/sidebarTabs/BlocksTab.d.ts +12 -0
- package/dist/components/sidebarTabs/BodyGlobalSettingsTab.d.ts +18 -0
- package/dist/components/sidebarTabs/ContentTab.d.ts +10 -0
- package/dist/components/sidebarTabs/ImagesTab.d.ts +19 -0
- package/dist/components/sidebarTabs/SidebarTabsRail.d.ts +9 -0
- package/dist/components/sidebarTabs/StrataTab.d.ts +12 -0
- package/dist/components/sidebarTabs/UploadsTab.d.ts +18 -0
- package/dist/favicon.svg +1 -0
- package/dist/icons.svg +24 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +50846 -0
- package/dist/playground.d.ts +5 -0
- package/dist/plexo-sdk.css +2 -0
- package/dist/store.d.ts +59 -0
- package/dist/utilities/aiHelper.d.ts +21 -0
- package/dist/utilities/compiler.d.ts +17 -0
- package/dist/utilities/compilerClient.d.ts +3 -0
- package/dist/utilities/initialDemoTemplate.d.ts +2 -0
- package/dist/utilities/playground.constants.d.ts +31 -0
- package/dist/utilities/playground.helpers.d.ts +936 -0
- package/dist/utilities/playground.interfaces.d.ts +256 -0
- package/dist/utilities/plexoBuilderRuntime.d.ts +23 -0
- package/dist/utilities/strataTokenMapping.d.ts +42 -0
- package/dist/utilities/tierFeatures.d.ts +26 -0
- package/dist/utilities/types.d.ts +78 -0
- package/dist/utilities/useApiKeyValidation.d.ts +18 -0
- package/package.json +63 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ColumnJSON, ElementJSON, RowJSON, TemplateJSON } from './types';
|
|
3
|
+
export type StockProvider = 'all' | 'unsplash' | 'pexels' | 'pixabay';
|
|
4
|
+
export type FormFieldKind = 'text' | 'email' | 'textarea' | 'select' | 'radio' | 'checkbox';
|
|
5
|
+
export interface StockImageResult {
|
|
6
|
+
id: string;
|
|
7
|
+
src: string;
|
|
8
|
+
alt: string;
|
|
9
|
+
provider: Exclude<StockProvider, 'all'>;
|
|
10
|
+
credit?: string;
|
|
11
|
+
source?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface FormFieldOption {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}
|
|
17
|
+
export interface FormFieldConfig {
|
|
18
|
+
id: string;
|
|
19
|
+
kind: FormFieldKind;
|
|
20
|
+
name: string;
|
|
21
|
+
label: string;
|
|
22
|
+
showLabel?: boolean;
|
|
23
|
+
inheritStylesFromPrevious?: boolean;
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
options?: FormFieldOption[];
|
|
27
|
+
fontSize?: string;
|
|
28
|
+
labelFontWeight?: string;
|
|
29
|
+
borderRadius?: string;
|
|
30
|
+
borderWidth?: string;
|
|
31
|
+
borderColor?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface SocialLinkConfig {
|
|
34
|
+
provider: string;
|
|
35
|
+
url: string;
|
|
36
|
+
color?: string;
|
|
37
|
+
backgroundColor?: string;
|
|
38
|
+
iconType?: 'circle' | 'square';
|
|
39
|
+
size?: string;
|
|
40
|
+
}
|
|
41
|
+
export type PlexoTargetType = 'landing_page' | 'email';
|
|
42
|
+
export interface PlexoBuilderRef {
|
|
43
|
+
exportDesign: (targetType: PlexoTargetType) => Promise<{
|
|
44
|
+
json: TemplateJSON;
|
|
45
|
+
html: string;
|
|
46
|
+
}>;
|
|
47
|
+
getJson: () => TemplateJSON;
|
|
48
|
+
}
|
|
49
|
+
export interface PlexoBuilderProps {
|
|
50
|
+
showSaveButton?: boolean;
|
|
51
|
+
mode: PlexoTargetType;
|
|
52
|
+
apiKey: string;
|
|
53
|
+
backgroundColor?: string;
|
|
54
|
+
themeBgColor?: string;
|
|
55
|
+
themeFgColor?: string;
|
|
56
|
+
textColor?: string;
|
|
57
|
+
initialTemplate?: TemplateJSON;
|
|
58
|
+
initialHtml?: string;
|
|
59
|
+
initialCss?: string;
|
|
60
|
+
initialJs?: string;
|
|
61
|
+
onSave?: (data: {
|
|
62
|
+
json: TemplateJSON;
|
|
63
|
+
html: string;
|
|
64
|
+
}) => void;
|
|
65
|
+
useAi?: boolean;
|
|
66
|
+
aiProvider?: 'gemini' | 'openai' | 'claude' | string;
|
|
67
|
+
aiApiKey?: string;
|
|
68
|
+
aiTier?: 'AUTO' | 'BASIC' | 'MEDIUM' | 'HIGH' | string;
|
|
69
|
+
/**
|
|
70
|
+
* Subscription plan is resolved server-side from the apiKey.
|
|
71
|
+
* External consumers should NOT pass this prop — it will be ignored.
|
|
72
|
+
* The SDK always fetches the active plan for the authenticated apiKey.
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
/**
|
|
76
|
+
* Custom upload handler.
|
|
77
|
+
* Fired when the user uploads an image/file within the editor.
|
|
78
|
+
* Should return the public URL of the uploaded asset.
|
|
79
|
+
*/
|
|
80
|
+
onUpload?: (file: File) => Promise<string> | string;
|
|
81
|
+
/**
|
|
82
|
+
* Enables auto save mode.
|
|
83
|
+
* If true, calls onSave/export periodically.
|
|
84
|
+
*/
|
|
85
|
+
autoSave?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Interval for auto saving in milliseconds.
|
|
88
|
+
* Defaults to 3000ms.
|
|
89
|
+
*/
|
|
90
|
+
autoSaveDuration?: number;
|
|
91
|
+
unsplashKey?: string;
|
|
92
|
+
pexelsKey?: string;
|
|
93
|
+
pixabayKey?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface ColumnLayoutOption {
|
|
96
|
+
label: string;
|
|
97
|
+
widths: string[];
|
|
98
|
+
percentages: string[];
|
|
99
|
+
}
|
|
100
|
+
export interface InlineCounterProps {
|
|
101
|
+
label: string;
|
|
102
|
+
value: string;
|
|
103
|
+
unit?: string;
|
|
104
|
+
units?: string[];
|
|
105
|
+
min?: number;
|
|
106
|
+
max?: number;
|
|
107
|
+
step?: number;
|
|
108
|
+
onChange: (val: string) => void;
|
|
109
|
+
/** Optional: CSS property keyword to filter Strata tokens (e.g. 'font-size', 'border-radius') */
|
|
110
|
+
strataTokenKey?: string;
|
|
111
|
+
}
|
|
112
|
+
export interface InlineSelectProps {
|
|
113
|
+
label: string;
|
|
114
|
+
value: string;
|
|
115
|
+
options: Array<{
|
|
116
|
+
label: string;
|
|
117
|
+
value: string;
|
|
118
|
+
}>;
|
|
119
|
+
onChange: (val: string) => void;
|
|
120
|
+
}
|
|
121
|
+
export interface CustomSelectOption {
|
|
122
|
+
value: string;
|
|
123
|
+
label: string;
|
|
124
|
+
secondaryLabel?: string;
|
|
125
|
+
group?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface CustomSelectProps {
|
|
128
|
+
value: string;
|
|
129
|
+
options: CustomSelectOption[];
|
|
130
|
+
onChange: (nextValue: string) => void;
|
|
131
|
+
onTriggerClick?: () => void;
|
|
132
|
+
renderOption?: (option: CustomSelectOption, isSelected: boolean) => ReactNode;
|
|
133
|
+
renderGroupHeader?: (groupLabel: string) => ReactNode;
|
|
134
|
+
renderTrigger?: (selectedOption?: CustomSelectOption, open?: boolean) => ReactNode;
|
|
135
|
+
menuHeader?: ReactNode;
|
|
136
|
+
triggerClassName?: string;
|
|
137
|
+
menuClassName?: string;
|
|
138
|
+
menuPositionClassName?: string;
|
|
139
|
+
optionsContainerClassName?: string;
|
|
140
|
+
align?: 'left' | 'right';
|
|
141
|
+
closeOnSelect?: boolean;
|
|
142
|
+
}
|
|
143
|
+
export interface InlineColorPickerProps {
|
|
144
|
+
label: string;
|
|
145
|
+
value: string;
|
|
146
|
+
onChange: (val: string) => void;
|
|
147
|
+
textColor?: string;
|
|
148
|
+
backgroundColor?: string;
|
|
149
|
+
}
|
|
150
|
+
export interface InlineAlignmentProps {
|
|
151
|
+
label: string;
|
|
152
|
+
value: string;
|
|
153
|
+
onChange: (val: string) => void;
|
|
154
|
+
}
|
|
155
|
+
export interface InlineTextInputProps {
|
|
156
|
+
label: string;
|
|
157
|
+
value: string;
|
|
158
|
+
onChange: (val: string) => void;
|
|
159
|
+
}
|
|
160
|
+
export interface InlineTextAreaProps {
|
|
161
|
+
label: string;
|
|
162
|
+
value: string;
|
|
163
|
+
rows?: number;
|
|
164
|
+
onChange: (val: string) => void;
|
|
165
|
+
codeMode?: boolean;
|
|
166
|
+
}
|
|
167
|
+
export interface ToggleProps {
|
|
168
|
+
label: string;
|
|
169
|
+
checked: boolean;
|
|
170
|
+
onChange: (checked: boolean) => void;
|
|
171
|
+
}
|
|
172
|
+
export interface BorderRadiusControlsProps {
|
|
173
|
+
styles: Record<string, any>;
|
|
174
|
+
onChange: (key: string, value: string) => void;
|
|
175
|
+
}
|
|
176
|
+
export interface AccordionSectionProps {
|
|
177
|
+
title: string;
|
|
178
|
+
icon?: ReactNode;
|
|
179
|
+
isOpen: boolean;
|
|
180
|
+
onToggle: () => void;
|
|
181
|
+
children: ReactNode;
|
|
182
|
+
contentClassName?: string;
|
|
183
|
+
}
|
|
184
|
+
export interface PaletteItemProps {
|
|
185
|
+
id: string;
|
|
186
|
+
label: string;
|
|
187
|
+
icon?: ReactNode;
|
|
188
|
+
data: any;
|
|
189
|
+
variant?: 'default' | 'layout';
|
|
190
|
+
className?: string;
|
|
191
|
+
iconClassName?: string;
|
|
192
|
+
}
|
|
193
|
+
export interface CanvasProps {
|
|
194
|
+
rowIds: string[];
|
|
195
|
+
children: ReactNode;
|
|
196
|
+
disabled?: boolean;
|
|
197
|
+
}
|
|
198
|
+
export interface RowProps {
|
|
199
|
+
row: RowJSON;
|
|
200
|
+
selectedRowId: string | null;
|
|
201
|
+
selectRow: (id: string | null) => void;
|
|
202
|
+
previewMode?: boolean;
|
|
203
|
+
children: ReactNode;
|
|
204
|
+
/** Present when this row is nested inside a column */
|
|
205
|
+
parentRowId?: string;
|
|
206
|
+
parentColId?: string;
|
|
207
|
+
deviceView?: 'desktop' | 'tablet' | 'mobile' | 'custom';
|
|
208
|
+
selectedElementId?: string | null;
|
|
209
|
+
}
|
|
210
|
+
export interface ColumnProps {
|
|
211
|
+
col: ColumnJSON;
|
|
212
|
+
rowId: string;
|
|
213
|
+
selectedColumnId: string | null;
|
|
214
|
+
selectColumn: (id: string | null) => void;
|
|
215
|
+
previewMode?: boolean;
|
|
216
|
+
children: ReactNode;
|
|
217
|
+
/** Present when this column belongs to a nested row */
|
|
218
|
+
parentRowId?: string;
|
|
219
|
+
parentColId?: string;
|
|
220
|
+
deviceView?: 'desktop' | 'tablet' | 'mobile' | 'custom';
|
|
221
|
+
}
|
|
222
|
+
export interface ElementProps {
|
|
223
|
+
elem: ElementJSON;
|
|
224
|
+
columnId: string;
|
|
225
|
+
rowId: string;
|
|
226
|
+
deviceView: 'desktop' | 'tablet' | 'mobile' | 'custom';
|
|
227
|
+
selectedElementId: string | null;
|
|
228
|
+
selectElement: (id: string | null) => void;
|
|
229
|
+
transientStyle: Record<string, any> | null;
|
|
230
|
+
transientAttr: Record<string, any> | null;
|
|
231
|
+
updateElement: (elementId: string, updates: Partial<Omit<ElementJSON, 'id' | 'type'>>) => void;
|
|
232
|
+
onTransientStyleChange: (key: string, value: any) => void;
|
|
233
|
+
onTransientAttrChange: (key: string, value: any) => void;
|
|
234
|
+
duplicateElement: (id: string) => void;
|
|
235
|
+
deleteElement: (id: string) => void;
|
|
236
|
+
previewMode?: boolean;
|
|
237
|
+
useAi?: boolean;
|
|
238
|
+
aiProvider?: string;
|
|
239
|
+
aiApiKey?: string;
|
|
240
|
+
aiTier?: string;
|
|
241
|
+
}
|
|
242
|
+
export interface ColumnsSelectorProps {
|
|
243
|
+
onSelect: (widths: string[]) => void;
|
|
244
|
+
}
|
|
245
|
+
export interface SpacingControlsProps {
|
|
246
|
+
label: string;
|
|
247
|
+
stylePrefix: 'padding' | 'margin';
|
|
248
|
+
styles: Record<string, any>;
|
|
249
|
+
onChange: (key: string, val: string) => void;
|
|
250
|
+
/** Allow negative values — useful for margin */
|
|
251
|
+
allowNegative?: boolean;
|
|
252
|
+
}
|
|
253
|
+
export interface UploadZoneProps {
|
|
254
|
+
label: string;
|
|
255
|
+
onUploadMock: () => void;
|
|
256
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TemplateJSON } from './types';
|
|
2
|
+
import type { PlexoTargetType } from './playground.interfaces';
|
|
3
|
+
interface RuntimeArgs {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
mode: PlexoTargetType;
|
|
6
|
+
onSave?: (data: {
|
|
7
|
+
json: TemplateJSON;
|
|
8
|
+
html: string;
|
|
9
|
+
}) => void;
|
|
10
|
+
isSavingLayout: boolean;
|
|
11
|
+
setIsSavingLayout: React.Dispatch<React.SetStateAction<boolean>>;
|
|
12
|
+
normalizeTemplateWithDefaults: (data: TemplateJSON) => TemplateJSON;
|
|
13
|
+
}
|
|
14
|
+
export declare const usePlexoBuilderRuntime: ({ mode, onSave, isSavingLayout, setIsSavingLayout, normalizeTemplateWithDefaults, }: RuntimeArgs) => {
|
|
15
|
+
sensors: import("@dnd-kit/core").SensorDescriptor<import("@dnd-kit/core").SensorOptions>[];
|
|
16
|
+
getJson: () => TemplateJSON;
|
|
17
|
+
exportDesign: (targetType: PlexoTargetType) => Promise<{
|
|
18
|
+
json: TemplateJSON;
|
|
19
|
+
html: string;
|
|
20
|
+
}>;
|
|
21
|
+
handleBuiltInSave: () => Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ElementJSON } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Strata Token Mapping Engine
|
|
4
|
+
* Maps design system tokens to element properties
|
|
5
|
+
*/
|
|
6
|
+
export interface StrataToken {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
value: string;
|
|
10
|
+
category: 'color' | 'typography' | 'spacing' | 'sizing' | 'shadow' | 'border-radius';
|
|
11
|
+
cssVariableName: string;
|
|
12
|
+
}
|
|
13
|
+
export interface StrataTokenSet {
|
|
14
|
+
projectId: string;
|
|
15
|
+
tokens: StrataToken[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Parse Strata tokens and create a mapping for element properties
|
|
19
|
+
*/
|
|
20
|
+
export declare const createTokenMapping: (tokenSet: StrataTokenSet) => Record<string, StrataToken>;
|
|
21
|
+
/**
|
|
22
|
+
* Apply Strata tokens to element styles
|
|
23
|
+
* Replaces literal values with CSS variable references
|
|
24
|
+
*/
|
|
25
|
+
export declare const applyTokensToElement: (element: ElementJSON, tokenMapping: Record<string, StrataToken>) => ElementJSON;
|
|
26
|
+
/**
|
|
27
|
+
* Extract available tokens by category for property pickers
|
|
28
|
+
*/
|
|
29
|
+
export declare const getTokensByCategory: (tokenSet: StrataTokenSet, category: StrataToken["category"]) => StrataToken[];
|
|
30
|
+
/**
|
|
31
|
+
* Generate CSS variable declarations from Strata tokens
|
|
32
|
+
*/
|
|
33
|
+
export declare const generateTokenCSS: (tokenSet: StrataTokenSet) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Resolve token value to actual CSS value
|
|
36
|
+
*/
|
|
37
|
+
export declare const resolveTokenValue: (value: string | undefined, tokenMapping: Record<string, StrataToken>) => string;
|
|
38
|
+
/**
|
|
39
|
+
* Create a swatch display for token values
|
|
40
|
+
*/
|
|
41
|
+
export declare const createTokenSwatch: (token: StrataToken, className?: string) => string;
|
|
42
|
+
export declare function fetchAndInitStrataTokens(projectId: string, setStrataTokens: (tokens: any[]) => void): Promise<boolean>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plexo SDK – Subscription Tier Feature Gates
|
|
3
|
+
*
|
|
4
|
+
* This mirrors the plan definitions in plexo-web/lib/subscription.ts
|
|
5
|
+
* so the SDK can gate features without a network call.
|
|
6
|
+
*
|
|
7
|
+
* Tiers: FREE → PRO → ULTRA
|
|
8
|
+
*/
|
|
9
|
+
export type SdkPlan = 'FREE' | 'PRO' | 'ULTRA';
|
|
10
|
+
export interface SdkTierFeatures {
|
|
11
|
+
/** AI layout editing & generation */
|
|
12
|
+
aiEnabled: boolean;
|
|
13
|
+
/** Strata design system token picker */
|
|
14
|
+
strataEnabled: boolean;
|
|
15
|
+
/** Landing page mode and landing-page-only blocks */
|
|
16
|
+
landingPagesEnabled: boolean;
|
|
17
|
+
/** Advanced blocks: carousel, video, timer, form, table */
|
|
18
|
+
advancedBlocksEnabled: boolean;
|
|
19
|
+
/** Stock image search */
|
|
20
|
+
stockImagesEnabled: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns the feature set for a given plan string.
|
|
24
|
+
* Unknown / undefined plans default to ULTRA (fail-open for internal / workspace use).
|
|
25
|
+
*/
|
|
26
|
+
export declare function getSdkTierFeatures(plan: string | null | undefined): SdkTierFeatures;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export interface TemplateStyles {
|
|
2
|
+
background?: string;
|
|
3
|
+
padding?: string;
|
|
4
|
+
[key: string]: string | number | undefined;
|
|
5
|
+
}
|
|
6
|
+
export interface RowStyles {
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
padding?: string;
|
|
9
|
+
margin?: string;
|
|
10
|
+
[key: string]: string | number | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface ElementStyles {
|
|
13
|
+
fontSize?: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
padding?: string;
|
|
16
|
+
margin?: string;
|
|
17
|
+
textAlign?: string;
|
|
18
|
+
backgroundColor?: string;
|
|
19
|
+
borderRadius?: string;
|
|
20
|
+
borderColor?: string;
|
|
21
|
+
borderWidth?: string;
|
|
22
|
+
borderStyle?: string;
|
|
23
|
+
width?: string;
|
|
24
|
+
height?: string;
|
|
25
|
+
[key: string]: string | number | undefined;
|
|
26
|
+
}
|
|
27
|
+
export interface ElementAttributes {
|
|
28
|
+
href?: string;
|
|
29
|
+
src?: string;
|
|
30
|
+
alt?: string;
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
text?: string;
|
|
33
|
+
options?: Array<{
|
|
34
|
+
label: string;
|
|
35
|
+
value: string;
|
|
36
|
+
}>;
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
}
|
|
39
|
+
export type ElementType = 'text' | 'button' | 'image' | 'spacer' | 'divider' | 'card' | 'form_container' | 'input' | 'textarea' | 'select' | 'heading' | 'paragraph' | 'carousel' | 'video' | 'social' | 'menu' | 'html' | 'table' | 'timer' | 'icon';
|
|
40
|
+
export interface ElementJSON {
|
|
41
|
+
id: string;
|
|
42
|
+
type: ElementType;
|
|
43
|
+
style: ElementStyles;
|
|
44
|
+
attributes: ElementAttributes;
|
|
45
|
+
}
|
|
46
|
+
export interface ColumnJSON {
|
|
47
|
+
id: string;
|
|
48
|
+
width: string;
|
|
49
|
+
styles?: Record<string, any>;
|
|
50
|
+
elements: ElementJSON[];
|
|
51
|
+
/** Optional nested rows (sections) inside this column */
|
|
52
|
+
nestedRows?: RowJSON[];
|
|
53
|
+
/** HTML attributes for the column (id, class, etc.) */
|
|
54
|
+
attrs?: Record<string, any>;
|
|
55
|
+
}
|
|
56
|
+
export interface RowJSON {
|
|
57
|
+
id: string;
|
|
58
|
+
style: RowStyles;
|
|
59
|
+
columns: ColumnJSON[];
|
|
60
|
+
htmlId?: string;
|
|
61
|
+
htmlClass?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface BodyJSON {
|
|
64
|
+
style: TemplateStyles;
|
|
65
|
+
rows: RowJSON[];
|
|
66
|
+
strataConfig?: {
|
|
67
|
+
projectId: string;
|
|
68
|
+
syncEnabled: boolean;
|
|
69
|
+
};
|
|
70
|
+
uploadedImages?: Array<{
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
src: string;
|
|
74
|
+
}>;
|
|
75
|
+
}
|
|
76
|
+
export interface TemplateJSON {
|
|
77
|
+
body: BodyJSON;
|
|
78
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SdkPlan } from './tierFeatures';
|
|
2
|
+
export type ApiKeyStatus = 'initializing' | 'valid' | 'invalid' | 'error';
|
|
3
|
+
export interface ApiKeyValidationResult {
|
|
4
|
+
status: ApiKeyStatus;
|
|
5
|
+
plan: SdkPlan;
|
|
6
|
+
useAi: boolean;
|
|
7
|
+
aiProvider: string;
|
|
8
|
+
aiTier: string;
|
|
9
|
+
error: string | null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Validates a Plexo API key against the server on mount.
|
|
13
|
+
* Returns the resolved subscription plan and AI config.
|
|
14
|
+
*
|
|
15
|
+
* For dev/test environments where __internalPlan is provided,
|
|
16
|
+
* validation is skipped and the internal plan is used directly.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useApiKeyValidation(apiKey: string, __internalPlan?: 'FREE' | 'PRO' | 'ULTRA'): ApiKeyValidationResult;
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@charisol/plexo-sdk",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Plexo visual email and landing page builder SDK — drag-and-drop template editor with AI integration.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"email-builder",
|
|
8
|
+
"template-editor",
|
|
9
|
+
"drag-and-drop",
|
|
10
|
+
"react",
|
|
11
|
+
"plexo"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/challaris/plexo-sdk.git"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "./dist/index.js",
|
|
20
|
+
"module": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"require": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./dist/*": "./dist/*"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"dev": "vite",
|
|
35
|
+
"test": "vitest run",
|
|
36
|
+
"build": "vite build && tsc -p tsconfig.lib.json",
|
|
37
|
+
"lint": "oxlint",
|
|
38
|
+
"preview": "vite preview"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@dnd-kit/core": "^6.3.1",
|
|
42
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
43
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
44
|
+
"lucide-react": "^1.25.0",
|
|
45
|
+
"react": "^19.2.7",
|
|
46
|
+
"react-dom": "^19.2.7",
|
|
47
|
+
"zustand": "^5.0.14"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@tailwindcss/postcss": "^4.3.3",
|
|
51
|
+
"@types/node": "^24.13.2",
|
|
52
|
+
"@types/react": "^19.2.17",
|
|
53
|
+
"@types/react-dom": "^19.2.3",
|
|
54
|
+
"@vitejs/plugin-react": "^6.0.3",
|
|
55
|
+
"autoprefixer": "^10.5.4",
|
|
56
|
+
"oxlint": "^1.71.0",
|
|
57
|
+
"postcss": "^8.5.19",
|
|
58
|
+
"tailwindcss": "^4.3.3",
|
|
59
|
+
"typescript": "~6.0.2",
|
|
60
|
+
"vite": "^8.1.1",
|
|
61
|
+
"vitest": "^4.1.10"
|
|
62
|
+
}
|
|
63
|
+
}
|