@templatical/core 0.10.0 → 0.10.2
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/dist/cloud/index.d.ts +397 -375
- package/dist/cloud/index.js +2179 -2698
- package/dist/cloud/index.js.map +1 -1
- package/dist/editor-zvlM4bZ7.d.ts +46 -0
- package/dist/index.d.ts +68 -62
- package/dist/index.js +477 -600
- package/dist/index.js.map +1 -1
- package/package.json +6 -7
- package/dist/editor-D7sbEq2_.d.ts +0 -44
package/dist/cloud/index.d.ts
CHANGED
|
@@ -1,377 +1,390 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { a as UseEditorReturn$1 } from '../editor-D7sbEq2_.js';
|
|
6
|
-
import '@vue/reactivity';
|
|
1
|
+
import { r as UseEditorReturn$1 } from "../editor-zvlM4bZ7.js";
|
|
2
|
+
import { AiChatMessage, AiConfig, AuthConfig, AuthRequestOptions, Block, Collaborator, Comment, CommentEvent, CommentThread, CustomFont, EditorState, ExportResult, FontsConfig, HealthCheckResult, McpOperationPayload, MergeTag, PlanConfig, PlanFeatures, SavedModule, ScoringCategory, ScoringFinding, ScoringResult, SdkAuthConfig, Template, TemplateContent, TemplateDefaults, TemplateSettings, TemplateSnapshot, TestEmailConfig, UiTheme, UserConfig, ViewportSize, WebSocketServerConfig } from "@templatical/types";
|
|
3
|
+
import { ComputedRef, DeepReadonly, Ref, ref } from "vue";
|
|
4
|
+
import { Channel, PresenceChannel } from "pusher-js";
|
|
7
5
|
|
|
6
|
+
//#region src/cloud/auth.d.ts
|
|
8
7
|
declare class AuthManager {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
8
|
+
private static readonly DEFAULT_BASE_URL;
|
|
9
|
+
private accessToken;
|
|
10
|
+
private expiresAt;
|
|
11
|
+
private _projectId;
|
|
12
|
+
private _tenantId;
|
|
13
|
+
private _tenantSlug;
|
|
14
|
+
private _testEmailConfig;
|
|
15
|
+
private _userConfig;
|
|
16
|
+
private readonly url;
|
|
17
|
+
private readonly baseUrl;
|
|
18
|
+
private readonly requestOptions;
|
|
19
|
+
private readonly onError?;
|
|
20
|
+
private refreshPromise;
|
|
21
|
+
private static readonly REFRESH_THRESHOLD_MS;
|
|
22
|
+
constructor(config: AuthConfig);
|
|
23
|
+
resolveUrl(path: string): string;
|
|
24
|
+
get projectId(): string;
|
|
25
|
+
get tenantId(): string;
|
|
26
|
+
get tenantSlug(): string;
|
|
27
|
+
get testEmailConfig(): TestEmailConfig | null;
|
|
28
|
+
get userConfig(): UserConfig | null;
|
|
29
|
+
get accessTokenValue(): string | null;
|
|
30
|
+
initialize(): Promise<void>;
|
|
31
|
+
private ensureToken;
|
|
32
|
+
private isTokenExpiringSoon;
|
|
33
|
+
refreshToken(): Promise<string>;
|
|
34
|
+
private performRefresh;
|
|
35
|
+
authenticatedFetch(url: string, options?: RequestInit): Promise<Response>;
|
|
37
36
|
}
|
|
38
37
|
declare function createSdkAuthManager(config: SdkAuthConfig, onError?: (error: Error) => void): AuthManager;
|
|
39
|
-
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/cloud/api.d.ts
|
|
40
40
|
declare class ApiClient {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
41
|
+
private readonly authManager;
|
|
42
|
+
constructor(authManager: AuthManager);
|
|
43
|
+
private get projectId();
|
|
44
|
+
private get tenantSlug();
|
|
45
|
+
private get baseParams();
|
|
46
|
+
private request;
|
|
47
|
+
private extractFirstValidationError;
|
|
48
|
+
createTemplate(content: TemplateContent): Promise<Template>;
|
|
49
|
+
getTemplate(id: string): Promise<Template>;
|
|
50
|
+
updateTemplate(id: string, content: TemplateContent): Promise<Template>;
|
|
51
|
+
createSnapshot(templateId: string, content: TemplateContent): Promise<TemplateSnapshot>;
|
|
52
|
+
deleteTemplate(id: string): Promise<void>;
|
|
53
|
+
getSnapshots(templateId: string): Promise<TemplateSnapshot[]>;
|
|
54
|
+
restoreSnapshot(templateId: string, snapshotId: string): Promise<Template>;
|
|
55
|
+
exportTemplate(templateId: string, fontsPayload?: {
|
|
56
|
+
customFonts: CustomFont[];
|
|
57
|
+
defaultFallback: string;
|
|
58
|
+
}): Promise<{
|
|
59
|
+
html: string;
|
|
60
|
+
mjml: string;
|
|
61
|
+
}>;
|
|
62
|
+
sendTestEmail(templateId: string, payload: {
|
|
63
|
+
recipient: string;
|
|
64
|
+
html: string;
|
|
65
|
+
allowed_emails: string[];
|
|
66
|
+
signature: string;
|
|
67
|
+
}): Promise<void>;
|
|
68
|
+
private commentsUrl;
|
|
69
|
+
getComments(templateId: string): Promise<Comment[]>;
|
|
70
|
+
createComment(templateId: string, data: {
|
|
71
|
+
body: string;
|
|
72
|
+
block_id?: string;
|
|
73
|
+
parent_id?: string;
|
|
74
|
+
user_id: string;
|
|
75
|
+
user_name: string;
|
|
76
|
+
user_signature: string;
|
|
77
|
+
}, headers?: Record<string, string>): Promise<Comment>;
|
|
78
|
+
updateComment(templateId: string, commentId: string, data: {
|
|
79
|
+
body: string;
|
|
80
|
+
user_id: string;
|
|
81
|
+
user_name: string;
|
|
82
|
+
user_signature: string;
|
|
83
|
+
}, headers?: Record<string, string>): Promise<Comment>;
|
|
84
|
+
deleteComment(templateId: string, commentId: string, data: {
|
|
85
|
+
user_id: string;
|
|
86
|
+
user_name: string;
|
|
87
|
+
user_signature: string;
|
|
88
|
+
}, headers?: Record<string, string>): Promise<void>;
|
|
89
|
+
resolveComment(templateId: string, commentId: string, data: {
|
|
90
|
+
user_id: string;
|
|
91
|
+
user_name: string;
|
|
92
|
+
user_signature: string;
|
|
93
|
+
}, headers?: Record<string, string>): Promise<Comment>;
|
|
94
|
+
fetchConfig(): Promise<PlanConfig>;
|
|
95
|
+
listModules(search?: string): Promise<SavedModule[]>;
|
|
96
|
+
createModule(data: {
|
|
97
|
+
name: string;
|
|
98
|
+
content: Block[];
|
|
99
|
+
}): Promise<SavedModule>;
|
|
100
|
+
updateModule(id: string, data: Partial<{
|
|
101
|
+
name: string;
|
|
102
|
+
content: Block[];
|
|
103
|
+
}>): Promise<SavedModule>;
|
|
104
|
+
deleteModule(id: string): Promise<void>;
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/cloud/url-builder.d.ts
|
|
107
108
|
declare function buildUrl(template: string, params: Record<string, string>): string;
|
|
108
109
|
declare const API_ROUTES: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
110
|
+
readonly health: "/api/v1/health";
|
|
111
|
+
readonly "projects.config": "/api/v1/projects/{project}/tenants/{tenant}/config";
|
|
112
|
+
readonly "broadcasting.auth": "/api/v1/projects/{project}/tenants/{tenant}/broadcasting/auth";
|
|
113
|
+
readonly "templates.store": "/api/v1/projects/{project}/tenants/{tenant}/templates";
|
|
114
|
+
readonly "templates.show": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}";
|
|
115
|
+
readonly "templates.update": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}";
|
|
116
|
+
readonly "templates.destroy": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}";
|
|
117
|
+
readonly "templates.export": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/export";
|
|
118
|
+
readonly "templates.importFromBeefree": "/api/v1/projects/{project}/tenants/{tenant}/templates/import/from-beefree";
|
|
119
|
+
readonly "templates.sendTestEmail": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/send-test-email";
|
|
120
|
+
readonly "snapshots.index": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/snapshots";
|
|
121
|
+
readonly "snapshots.store": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/snapshots";
|
|
122
|
+
readonly "snapshots.show": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/snapshots/{snapshot}";
|
|
123
|
+
readonly "snapshots.restore": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/snapshots/{snapshot}/restore";
|
|
124
|
+
readonly "comments.index": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/comments";
|
|
125
|
+
readonly "comments.store": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/comments";
|
|
126
|
+
readonly "comments.update": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/comments/{comment}";
|
|
127
|
+
readonly "comments.destroy": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/comments/{comment}";
|
|
128
|
+
readonly "comments.resolve": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/comments/{comment}/resolve";
|
|
129
|
+
readonly "ai.generate": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/ai/generate";
|
|
130
|
+
readonly "ai.conversationMessages": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/ai/conversation-messages";
|
|
131
|
+
readonly "ai.suggestions": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/ai/suggestions";
|
|
132
|
+
readonly "ai.rewriteText": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/ai/rewrite-text";
|
|
133
|
+
readonly "ai.score": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/ai/score";
|
|
134
|
+
readonly "ai.fixFinding": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/ai/fix-finding";
|
|
135
|
+
readonly "ai.generateFromDesign": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/ai/generate-from-design";
|
|
136
|
+
readonly "media.upload": "/api/v1/projects/{project}/tenants/{tenant}/media/upload";
|
|
137
|
+
readonly "media.browse": "/api/v1/projects/{project}/tenants/{tenant}/media/browse";
|
|
138
|
+
readonly "media.delete": "/api/v1/projects/{project}/tenants/{tenant}/media/delete";
|
|
139
|
+
readonly "media.move": "/api/v1/projects/{project}/tenants/{tenant}/media/move";
|
|
140
|
+
readonly "media.update": "/api/v1/projects/{project}/tenants/{tenant}/media/{media}";
|
|
141
|
+
readonly "media.replace": "/api/v1/projects/{project}/tenants/{tenant}/media/{media}/replace";
|
|
142
|
+
readonly "media.checkUsage": "/api/v1/projects/{project}/tenants/{tenant}/media/check-usage";
|
|
143
|
+
readonly "media.frequentlyUsed": "/api/v1/projects/{project}/tenants/{tenant}/media/frequently-used";
|
|
144
|
+
readonly "media.importFromUrl": "/api/v1/projects/{project}/tenants/{tenant}/media/import-from-url";
|
|
145
|
+
readonly "folders.index": "/api/v1/projects/{project}/tenants/{tenant}/media/folders";
|
|
146
|
+
readonly "folders.store": "/api/v1/projects/{project}/tenants/{tenant}/media/folders";
|
|
147
|
+
readonly "folders.update": "/api/v1/projects/{project}/tenants/{tenant}/media/folders/{mediaFolder}";
|
|
148
|
+
readonly "folders.destroy": "/api/v1/projects/{project}/tenants/{tenant}/media/folders/{mediaFolder}";
|
|
149
|
+
readonly "savedModules.index": "/api/v1/projects/{project}/tenants/{tenant}/saved-modules";
|
|
150
|
+
readonly "savedModules.store": "/api/v1/projects/{project}/tenants/{tenant}/saved-modules";
|
|
151
|
+
readonly "savedModules.update": "/api/v1/projects/{project}/tenants/{tenant}/saved-modules/{savedModule}";
|
|
152
|
+
readonly "savedModules.destroy": "/api/v1/projects/{project}/tenants/{tenant}/saved-modules/{savedModule}";
|
|
152
153
|
};
|
|
153
|
-
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/cloud/websocket-client.d.ts
|
|
154
156
|
interface WebSocketConfig {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
host: string;
|
|
158
|
+
port: number;
|
|
159
|
+
appKey: string;
|
|
158
160
|
}
|
|
159
161
|
declare function resolveWebSocketConfig(serverConfig: WebSocketServerConfig): WebSocketConfig;
|
|
160
162
|
interface PresenceMember {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
id: string;
|
|
164
|
+
name: string;
|
|
165
|
+
type: "user" | "mcp";
|
|
164
166
|
}
|
|
165
167
|
interface WebSocketClientOptions {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
168
|
+
authManager: AuthManager;
|
|
169
|
+
config: WebSocketConfig;
|
|
170
|
+
onError?: (error: Error) => void;
|
|
169
171
|
}
|
|
170
172
|
declare class WebSocketClient {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
173
|
+
private pusher;
|
|
174
|
+
private readonly authManager;
|
|
175
|
+
private readonly config;
|
|
176
|
+
private readonly onError?;
|
|
177
|
+
constructor(options: WebSocketClientOptions);
|
|
178
|
+
connect(): Promise<void>;
|
|
179
|
+
subscribePresence(channelName: string): PresenceChannel;
|
|
180
|
+
unsubscribe(channelName: string): void;
|
|
181
|
+
getChannel(channelName: string): Channel | undefined;
|
|
182
|
+
disconnect(): void;
|
|
183
|
+
getSocketId(): string | null;
|
|
184
|
+
get isConnected(): boolean;
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/cloud/editor.d.ts
|
|
185
188
|
interface UseEditorOptions {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
authManager: AuthManager;
|
|
190
|
+
defaultFontFamily?: string;
|
|
191
|
+
templateDefaults?: TemplateDefaults;
|
|
192
|
+
onError?: (error: Error) => void;
|
|
193
|
+
lockedBlocks?: Ref<Map<string, unknown>>;
|
|
191
194
|
}
|
|
192
195
|
interface UseEditorReturn {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
196
|
+
state: DeepReadonly<EditorState>;
|
|
197
|
+
content: Ref<TemplateContent>;
|
|
198
|
+
selectedBlock: Ref<Block | null>;
|
|
199
|
+
setContent: (content: TemplateContent, markDirty?: boolean) => void;
|
|
200
|
+
selectBlock: (blockId: string | null) => void;
|
|
201
|
+
setViewport: (viewport: ViewportSize) => void;
|
|
202
|
+
setDarkMode: (darkMode: boolean) => void;
|
|
203
|
+
setPreviewMode: (previewMode: boolean) => void;
|
|
204
|
+
setUiTheme: (theme: UiTheme) => void;
|
|
205
|
+
updateBlock: (blockId: string, updates: Partial<Block>) => void;
|
|
206
|
+
updateSettings: (updates: Partial<TemplateSettings>) => void;
|
|
207
|
+
addBlock: (block: Block, targetSectionId?: string, columnIndex?: number, index?: number) => void;
|
|
208
|
+
removeBlock: (blockId: string) => void;
|
|
209
|
+
moveBlock: (blockId: string, newIndex: number, targetSectionId?: string, columnIndex?: number) => void;
|
|
210
|
+
savedBlockIds: Ref<Set<string>>;
|
|
211
|
+
isBlockLocked: (blockId: string) => boolean;
|
|
212
|
+
findBlockLocation: (blockId: string) => {
|
|
213
|
+
targetSectionId?: string;
|
|
214
|
+
columnIndex?: number;
|
|
215
|
+
index: number;
|
|
216
|
+
} | null;
|
|
217
|
+
create: (content?: TemplateContent) => Promise<Template>;
|
|
218
|
+
load: (templateId: string) => Promise<Template>;
|
|
219
|
+
save: () => Promise<Template>;
|
|
220
|
+
createSnapshot: () => Promise<void>;
|
|
221
|
+
hasTemplate: () => boolean;
|
|
222
|
+
markDirty: () => void;
|
|
220
223
|
}
|
|
221
224
|
declare function useEditor(options: UseEditorOptions): UseEditorReturn;
|
|
222
|
-
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/cloud/mcp-operation-handler.d.ts
|
|
223
227
|
declare function handleOperation(editor: UseEditorReturn, payload: McpOperationPayload): void;
|
|
224
|
-
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/cloud/ai-chat.d.ts
|
|
225
230
|
interface UseAiChatOptions {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
231
|
+
authManager: AuthManager;
|
|
232
|
+
getTemplateId: () => string | null;
|
|
233
|
+
onApply?: (content: TemplateContent) => void;
|
|
234
|
+
onError?: (error: Error) => void;
|
|
230
235
|
}
|
|
231
236
|
interface UseAiChatReturn {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
237
|
+
messages: ReturnType<typeof ref<AiChatMessage[]>>;
|
|
238
|
+
isGenerating: ReturnType<typeof ref<boolean>>;
|
|
239
|
+
isLoadingHistory: ReturnType<typeof ref<boolean>>;
|
|
240
|
+
isLastChangeReverted: ReturnType<typeof ref<boolean>>;
|
|
241
|
+
lastApplyMessageId: ReturnType<typeof ref<string | null>>;
|
|
242
|
+
error: ReturnType<typeof ref<string | null>>;
|
|
243
|
+
failedPrompt: ReturnType<typeof ref<string | null>>;
|
|
244
|
+
suggestions: ReturnType<typeof ref<string[]>>;
|
|
245
|
+
isLoadingSuggestions: ReturnType<typeof ref<boolean>>;
|
|
246
|
+
sendPrompt: (prompt: string, currentContent: TemplateContent, mergeTags: MergeTag[]) => Promise<TemplateContent | null>;
|
|
247
|
+
toggleLastRevert: () => void;
|
|
248
|
+
loadConversation: () => Promise<void>;
|
|
249
|
+
loadSuggestions: (currentContent: TemplateContent, mergeTags: MergeTag[]) => Promise<void>;
|
|
250
|
+
clearChat: () => void;
|
|
246
251
|
}
|
|
247
252
|
declare function useAiChat(options: UseAiChatOptions): UseAiChatReturn;
|
|
248
|
-
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/cloud/ai-rewrite.d.ts
|
|
249
255
|
interface UseAiRewriteOptions {
|
|
250
|
-
|
|
251
|
-
|
|
256
|
+
authManager: AuthManager;
|
|
257
|
+
getTemplateId: () => string | null;
|
|
252
258
|
}
|
|
253
259
|
interface UseAiRewriteReturn {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
260
|
+
isRewriting: ReturnType<typeof ref<boolean>>;
|
|
261
|
+
streamingText: ReturnType<typeof ref<string>>;
|
|
262
|
+
previousContent: ReturnType<typeof ref<string | null>>;
|
|
263
|
+
rewrittenContent: ReturnType<typeof ref<string | null>>;
|
|
264
|
+
isReverted: ReturnType<typeof ref<boolean>>;
|
|
265
|
+
error: ReturnType<typeof ref<string | null>>;
|
|
266
|
+
rewrite: (content: string, instruction: string, mergeTags: MergeTag[]) => Promise<string | null>;
|
|
267
|
+
undo: () => string | null;
|
|
268
|
+
redo: () => string | null;
|
|
269
|
+
reset: () => void;
|
|
264
270
|
}
|
|
265
271
|
declare function useAiRewrite(options: UseAiRewriteOptions): UseAiRewriteReturn;
|
|
266
|
-
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/cloud/ai-config.d.ts
|
|
267
274
|
interface UseAiConfigReturn {
|
|
268
|
-
|
|
269
|
-
|
|
275
|
+
isFeatureEnabled: (feature: keyof AiConfig) => boolean;
|
|
276
|
+
hasAnyMenuFeature: ComputedRef<boolean>;
|
|
270
277
|
}
|
|
271
278
|
declare function useAiConfig(config?: AiConfig | false): UseAiConfigReturn;
|
|
272
|
-
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/cloud/template-scoring.d.ts
|
|
273
281
|
interface UseTemplateScoringOptions {
|
|
274
|
-
|
|
275
|
-
|
|
282
|
+
authManager: AuthManager;
|
|
283
|
+
getTemplateId: () => string | null;
|
|
276
284
|
}
|
|
277
285
|
interface UseTemplateScoringReturn {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
isScoring: ReturnType<typeof ref<boolean>>;
|
|
287
|
+
scoringResult: ReturnType<typeof ref<ScoringResult | null>>;
|
|
288
|
+
error: ReturnType<typeof ref<string | null>>;
|
|
289
|
+
fixingFindingId: ReturnType<typeof ref<string | null>>;
|
|
290
|
+
fixStreamingText: ReturnType<typeof ref<string>>;
|
|
291
|
+
fixError: ReturnType<typeof ref<string | null>>;
|
|
292
|
+
score: (content: TemplateContent, mergeTags: MergeTag[]) => Promise<ScoringResult | null>;
|
|
293
|
+
fixFinding: (blockContent: string, finding: ScoringFinding, mergeTags: MergeTag[]) => Promise<string | null>;
|
|
294
|
+
removeFinding: (category: ScoringCategory, findingId: string) => void;
|
|
295
|
+
reset: () => void;
|
|
288
296
|
}
|
|
289
297
|
declare function useTemplateScoring(options: UseTemplateScoringOptions): UseTemplateScoringReturn;
|
|
290
|
-
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/cloud/design-reference.d.ts
|
|
291
300
|
interface UseDesignReferenceOptions {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
301
|
+
authManager: AuthManager;
|
|
302
|
+
getTemplateId: () => string | null;
|
|
303
|
+
onApply?: (content: TemplateContent) => void;
|
|
304
|
+
onError?: (error: Error) => void;
|
|
296
305
|
}
|
|
297
306
|
interface UseDesignReferenceReturn {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
307
|
+
isGenerating: ReturnType<typeof ref<boolean>>;
|
|
308
|
+
error: ReturnType<typeof ref<string | null>>;
|
|
309
|
+
generate: (input: DesignReferenceInput) => Promise<TemplateContent | null>;
|
|
310
|
+
reset: () => void;
|
|
302
311
|
}
|
|
303
312
|
interface DesignReferenceInput {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
313
|
+
prompt?: string;
|
|
314
|
+
imageUpload?: File;
|
|
315
|
+
pdfUpload?: File;
|
|
307
316
|
}
|
|
308
317
|
declare function useDesignReference(options: UseDesignReferenceOptions): UseDesignReferenceReturn;
|
|
309
|
-
|
|
318
|
+
//#endregion
|
|
319
|
+
//#region src/cloud/comments.d.ts
|
|
310
320
|
interface UseCommentsOptions {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
321
|
+
authManager: AuthManager;
|
|
322
|
+
getTemplateId: () => string | null;
|
|
323
|
+
getSocketId?: () => string | null;
|
|
324
|
+
onComment?: (event: CommentEvent) => void;
|
|
325
|
+
onError?: (error: Error) => void;
|
|
326
|
+
isAuthReady?: Ref<boolean>;
|
|
327
|
+
hasCommentingFeature?: () => boolean;
|
|
318
328
|
}
|
|
319
329
|
interface UseCommentsReturn {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
330
|
+
comments: Ref<CommentThread[]>;
|
|
331
|
+
isLoading: Ref<boolean>;
|
|
332
|
+
isSubmitting: Ref<boolean>;
|
|
333
|
+
isEnabled: ComputedRef<boolean>;
|
|
334
|
+
commentCountByBlock: ComputedRef<Map<string, number>>;
|
|
335
|
+
totalCount: ComputedRef<number>;
|
|
336
|
+
unresolvedCount: ComputedRef<number>;
|
|
337
|
+
loadComments: () => Promise<void>;
|
|
338
|
+
addComment: (body: string, blockId?: string, parentId?: string) => Promise<Comment | null>;
|
|
339
|
+
editComment: (commentId: string, body: string) => Promise<Comment | null>;
|
|
340
|
+
removeComment: (commentId: string) => Promise<boolean>;
|
|
341
|
+
toggleResolve: (commentId: string) => Promise<Comment | null>;
|
|
342
|
+
applyRemoteCreate: (comment: Comment) => void;
|
|
343
|
+
applyRemoteUpdate: (comment: Comment) => void;
|
|
344
|
+
applyRemoteDelete: (commentId: string, parentId: string | null) => void;
|
|
335
345
|
}
|
|
336
346
|
declare function useComments(options: UseCommentsOptions): UseCommentsReturn;
|
|
337
|
-
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/cloud/comment-listener.d.ts
|
|
338
349
|
interface CommentBroadcastPayload {
|
|
339
|
-
|
|
340
|
-
|
|
350
|
+
action: "comment_created" | "comment_updated" | "comment_deleted" | "comment_resolved" | "comment_unresolved";
|
|
351
|
+
comment: Comment;
|
|
341
352
|
}
|
|
342
353
|
interface UseCommentListenerOptions {
|
|
343
|
-
|
|
344
|
-
|
|
354
|
+
comments: UseCommentsReturn;
|
|
355
|
+
channel: Ref<PresenceChannel | null>;
|
|
345
356
|
}
|
|
346
357
|
declare function useCommentListener(options: UseCommentListenerOptions): void;
|
|
347
|
-
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/cloud/collaboration.d.ts
|
|
348
360
|
interface UseCollaborationOptions {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
361
|
+
authManager: AuthManager;
|
|
362
|
+
editor: UseEditorReturn;
|
|
363
|
+
channel: Ref<PresenceChannel | null>;
|
|
364
|
+
onError?: (error: Error) => void;
|
|
365
|
+
onCollaboratorJoined?: (collaborator: Collaborator) => void;
|
|
366
|
+
onCollaboratorLeft?: (collaborator: Collaborator) => void;
|
|
367
|
+
onBlockLocked?: (event: {
|
|
368
|
+
blockId: string;
|
|
369
|
+
collaborator: Collaborator;
|
|
370
|
+
}) => void;
|
|
371
|
+
onBlockUnlocked?: (event: {
|
|
372
|
+
blockId: string;
|
|
373
|
+
collaborator: Collaborator;
|
|
374
|
+
}) => void;
|
|
363
375
|
}
|
|
364
376
|
interface UseCollaborationReturn {
|
|
365
|
-
|
|
366
|
-
|
|
377
|
+
collaborators: Ref<Collaborator[]>;
|
|
378
|
+
lockedBlocks: Ref<Map<string, Collaborator>>;
|
|
367
379
|
}
|
|
368
380
|
declare function useCollaboration(options: UseCollaborationOptions): UseCollaborationReturn & {
|
|
369
|
-
|
|
370
|
-
|
|
381
|
+
_broadcastOperation: (payload: McpOperationPayload) => void;
|
|
382
|
+
_isProcessingRemoteOperation: () => boolean;
|
|
371
383
|
};
|
|
372
|
-
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region src/cloud/collaboration-broadcast.d.ts
|
|
373
386
|
interface BroadcastTarget {
|
|
374
|
-
|
|
387
|
+
_broadcastOperation: (payload: McpOperationPayload) => void;
|
|
375
388
|
}
|
|
376
389
|
/**
|
|
377
390
|
* Wraps editor mutation methods to broadcast operations to collaboration
|
|
@@ -381,105 +394,114 @@ interface BroadcastTarget {
|
|
|
381
394
|
* history.record() → broadcast + original mutation.
|
|
382
395
|
*/
|
|
383
396
|
declare function useCollaborationBroadcast(editor: UseEditorReturn$1, collaboration: BroadcastTarget): void;
|
|
384
|
-
|
|
397
|
+
//#endregion
|
|
398
|
+
//#region src/cloud/web-socket.d.ts
|
|
385
399
|
interface UseWebSocketOptions {
|
|
386
|
-
|
|
387
|
-
|
|
400
|
+
authManager: AuthManager;
|
|
401
|
+
onError?: (error: Error) => void;
|
|
388
402
|
}
|
|
389
403
|
interface UseWebSocketReturn {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
404
|
+
channel: Ref<PresenceChannel | null>;
|
|
405
|
+
isConnected: Ref<boolean>;
|
|
406
|
+
connect: (templateId: string, config: WebSocketConfig) => Promise<void>;
|
|
407
|
+
disconnect: () => void;
|
|
408
|
+
getSocketId: () => string | null;
|
|
395
409
|
}
|
|
396
410
|
declare function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn;
|
|
397
|
-
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region src/cloud/saved-modules.d.ts
|
|
398
413
|
interface UseSavedModulesOptions {
|
|
399
|
-
|
|
400
|
-
|
|
414
|
+
authManager: AuthManager;
|
|
415
|
+
onError?: (error: Error) => void;
|
|
401
416
|
}
|
|
402
417
|
interface UseSavedModulesReturn {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
418
|
+
modules: Ref<SavedModule[]>;
|
|
419
|
+
isLoading: Ref<boolean>;
|
|
420
|
+
loadModules: (search?: string) => Promise<void>;
|
|
421
|
+
createModule: (name: string, content: Block[]) => Promise<SavedModule>;
|
|
422
|
+
updateModule: (id: string, data: Partial<{
|
|
423
|
+
name: string;
|
|
424
|
+
content: Block[];
|
|
425
|
+
}>) => Promise<SavedModule>;
|
|
426
|
+
deleteModule: (id: string) => Promise<void>;
|
|
412
427
|
}
|
|
413
428
|
declare function useSavedModules(options: UseSavedModulesOptions): UseSavedModulesReturn;
|
|
414
|
-
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/cloud/snapshots.d.ts
|
|
415
431
|
interface UseSnapshotHistoryOptions {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
432
|
+
authManager: AuthManager;
|
|
433
|
+
templateId: string;
|
|
434
|
+
onRestore?: (template: Template) => void;
|
|
435
|
+
onError?: (error: Error) => void;
|
|
420
436
|
}
|
|
421
437
|
interface UseSnapshotHistoryReturn {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
438
|
+
snapshots: Ref<TemplateSnapshot[]>;
|
|
439
|
+
isLoading: Ref<boolean>;
|
|
440
|
+
isRestoring: Ref<boolean>;
|
|
441
|
+
loadSnapshots: () => Promise<void>;
|
|
442
|
+
restoreSnapshot: (snapshotId: string) => Promise<Template>;
|
|
427
443
|
}
|
|
428
444
|
declare function useSnapshotHistory(options: UseSnapshotHistoryOptions): UseSnapshotHistoryReturn;
|
|
429
|
-
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/cloud/test-email.d.ts
|
|
430
447
|
interface UseTestEmailOptions {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
448
|
+
authManager: AuthManager;
|
|
449
|
+
getTemplateId: () => string | null;
|
|
450
|
+
save: () => Promise<Template>;
|
|
451
|
+
exportHtml: (templateId: string) => Promise<ExportResult>;
|
|
452
|
+
onError?: (error: Error) => void;
|
|
453
|
+
isAuthReady?: Ref<boolean>;
|
|
454
|
+
onBeforeTestEmail?: (html: string) => string | Promise<string>;
|
|
438
455
|
}
|
|
439
456
|
interface UseTestEmailReturn {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
457
|
+
isEnabled: ComputedRef<boolean>;
|
|
458
|
+
allowedEmails: ComputedRef<string[]>;
|
|
459
|
+
isSending: Ref<boolean>;
|
|
460
|
+
error: Ref<string | null>;
|
|
461
|
+
sendTestEmail: (recipient: string) => Promise<void>;
|
|
445
462
|
}
|
|
446
463
|
declare function useTestEmail(options: UseTestEmailOptions): UseTestEmailReturn;
|
|
447
|
-
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region src/cloud/export.d.ts
|
|
448
466
|
interface UseExportOptions {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
467
|
+
authManager: AuthManager;
|
|
468
|
+
getFontsConfig?: () => FontsConfig | undefined;
|
|
469
|
+
canUseCustomFonts?: () => boolean;
|
|
452
470
|
}
|
|
453
471
|
interface UseExportReturn {
|
|
454
|
-
|
|
455
|
-
|
|
472
|
+
exportHtml: (templateId: string) => Promise<ExportResult>;
|
|
473
|
+
getMjmlSource: (templateId: string) => Promise<string>;
|
|
456
474
|
}
|
|
457
475
|
declare function useExport(options: UseExportOptions): UseExportReturn;
|
|
458
|
-
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/cloud/plan-config.d.ts
|
|
459
478
|
interface UsePlanConfigOptions {
|
|
460
|
-
|
|
461
|
-
|
|
479
|
+
authManager: AuthManager;
|
|
480
|
+
onError?: (error: Error) => void;
|
|
462
481
|
}
|
|
463
482
|
interface UsePlanConfigReturn {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
483
|
+
config: Ref<PlanConfig | null>;
|
|
484
|
+
isLoading: Ref<boolean>;
|
|
485
|
+
hasFeature: (feature: keyof PlanFeatures) => boolean;
|
|
486
|
+
features: ComputedRef<PlanFeatures | null>;
|
|
487
|
+
fetchConfig: () => Promise<void>;
|
|
469
488
|
}
|
|
470
489
|
declare function usePlanConfig(options: UsePlanConfigOptions): UsePlanConfigReturn;
|
|
471
|
-
|
|
490
|
+
//#endregion
|
|
491
|
+
//#region src/cloud/health-check.d.ts
|
|
472
492
|
interface HealthCheckOptions {
|
|
473
|
-
|
|
474
|
-
|
|
493
|
+
authManager?: AuthManager;
|
|
494
|
+
baseUrl?: string;
|
|
475
495
|
}
|
|
476
496
|
declare function performHealthCheck(options?: HealthCheckOptions): Promise<HealthCheckResult>;
|
|
477
|
-
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/cloud/mcp-listener.d.ts
|
|
478
499
|
interface UseMcpListenerOptions {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
500
|
+
editor: UseEditorReturn;
|
|
501
|
+
channel: Ref<PresenceChannel | null>;
|
|
502
|
+
onOperation?: (payload: McpOperationPayload) => void;
|
|
482
503
|
}
|
|
483
504
|
declare function useMcpListener(options: UseMcpListenerOptions): void;
|
|
484
|
-
|
|
485
|
-
export { API_ROUTES, ApiClient, AuthManager, type CommentBroadcastPayload, type DesignReferenceInput, type PresenceMember, type UseAiChatOptions, type UseAiChatReturn, type UseAiConfigReturn, type UseAiRewriteOptions, type UseAiRewriteReturn, type UseCollaborationOptions, type UseCollaborationReturn, type UseCommentListenerOptions, type UseCommentsOptions, type UseCommentsReturn, type UseDesignReferenceOptions, type UseDesignReferenceReturn, type UseEditorOptions, type UseEditorReturn, type UseExportOptions, type UseExportReturn, type UseMcpListenerOptions, type UsePlanConfigOptions, type UsePlanConfigReturn, type UseSavedModulesOptions, type UseSavedModulesReturn, type UseSnapshotHistoryOptions, type UseSnapshotHistoryReturn, type UseTemplateScoringOptions, type UseTemplateScoringReturn, type UseTestEmailOptions, type UseTestEmailReturn, type UseWebSocketOptions, type UseWebSocketReturn, WebSocketClient, type WebSocketClientOptions, type WebSocketConfig, buildUrl, createSdkAuthManager, handleOperation, performHealthCheck, resolveWebSocketConfig, useAiChat, useAiConfig, useAiRewrite, useCollaboration, useCollaborationBroadcast, useCommentListener, useComments, useDesignReference, useEditor, useExport, useMcpListener, usePlanConfig, useSavedModules, useSnapshotHistory, useTemplateScoring, useTestEmail, useWebSocket };
|
|
505
|
+
//#endregion
|
|
506
|
+
export { API_ROUTES, ApiClient, type AuthConfig, AuthManager, type AuthRequestOptions, type CommentBroadcastPayload, type DesignReferenceInput, type PresenceMember, type SdkAuthConfig, type TestEmailConfig, type UseAiChatOptions, type UseAiChatReturn, type UseAiConfigReturn, type UseAiRewriteOptions, type UseAiRewriteReturn, type UseCollaborationOptions, type UseCollaborationReturn, type UseCommentListenerOptions, type UseCommentsOptions, type UseCommentsReturn, type UseDesignReferenceOptions, type UseDesignReferenceReturn, type UseEditorOptions, type UseEditorReturn, type UseExportOptions, type UseExportReturn, type UseMcpListenerOptions, type UsePlanConfigOptions, type UsePlanConfigReturn, type UseSavedModulesOptions, type UseSavedModulesReturn, type UseSnapshotHistoryOptions, type UseSnapshotHistoryReturn, type UseTemplateScoringOptions, type UseTemplateScoringReturn, type UseTestEmailOptions, type UseTestEmailReturn, type UseWebSocketOptions, type UseWebSocketReturn, type UserConfig, WebSocketClient, type WebSocketClientOptions, type WebSocketConfig, buildUrl, createSdkAuthManager, handleOperation, performHealthCheck, resolveWebSocketConfig, useAiChat, useAiConfig, useAiRewrite, useCollaboration, useCollaborationBroadcast, useCommentListener, useComments, useDesignReference, useEditor, useExport, useMcpListener, usePlanConfig, useSavedModules, useSnapshotHistory, useTemplateScoring, useTestEmail, useWebSocket };
|
|
507
|
+
//# sourceMappingURL=index.d.ts.map
|