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