@templatical/core 0.26.2 → 0.27.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/dist/cloud/index.d.ts +196 -110
- package/dist/cloud/index.js +380 -563
- package/dist/cloud/index.js.map +1 -1
- package/dist/editor-BCujEIye.d.ts +99 -0
- package/dist/index.d.ts +209 -5
- package/dist/index.js +524 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/editor-BIIsaIoN.d.ts +0 -45
package/dist/cloud/index.d.ts
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
|
-
import { r as UseEditorReturn
|
|
2
|
-
import { AiChatMessage, AiConfig, AuthConfig, AuthRequestOptions, Block, Collaborator,
|
|
3
|
-
import { ComputedRef,
|
|
1
|
+
import { r as UseEditorReturn } from "../editor-BCujEIye.js";
|
|
2
|
+
import { AiChatMessage, AiConfig, AuthConfig, AuthRequestOptions, Block, Collaborator, CommentResponse, CommentsProvider, CustomFont, ExportResult, FontsConfig, HealthCheckResult, McpOperationPayload, MergeTag, PlanConfig, PlanFeatures, RenderProvider, SavedBlock, SavedBlocksProvider, ScoringCategory, ScoringFinding, ScoringResult, SdkAuthConfig, Template, TemplateContent, TemplatePatch, TemplateVersionResponse, TemplatesProvider, TestEmailConfig, TestEmailProvider, UserConfig, VersionHistoryProvider, WebSocketServerConfig } from "@templatical/types";
|
|
3
|
+
import { ComputedRef, Ref, ref } from "vue";
|
|
4
4
|
import { Channel, PresenceChannel } from "pusher-js";
|
|
5
5
|
//#region src/cloud/auth.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Whether a token-refresh failure is worth interrupting the user over.
|
|
8
|
+
*
|
|
9
|
+
* **Fatal** means the endpoint actively rejected the credentials — a `4xx`. No
|
|
10
|
+
* amount of retrying fixes that: every subsequent request will fail the same
|
|
11
|
+
* way, so the session really is over and the editor should say so.
|
|
12
|
+
*
|
|
13
|
+
* **Everything else is transient**: a network blip, a `5xx`, a timeout, a
|
|
14
|
+
* malformed response. Those resolve on their own, and blanking the editor over
|
|
15
|
+
* one interrupts someone mid-edit on a template that is very likely unsaved.
|
|
16
|
+
* `AuthManager` reports every failure to `onError` and re-throws regardless, so
|
|
17
|
+
* a caller that genuinely cannot proceed still finds out; this only decides
|
|
18
|
+
* whether the *overlay* goes up.
|
|
19
|
+
*
|
|
20
|
+
* `404` is treated as fatal deliberately: a refresh URL that does not exist is a
|
|
21
|
+
* misconfiguration, and retrying a typo forever is worse than saying so.
|
|
22
|
+
*/
|
|
23
|
+
declare function isFatalAuthError(error: unknown): boolean;
|
|
6
24
|
declare class AuthManager {
|
|
7
25
|
private static readonly DEFAULT_BASE_URL;
|
|
8
26
|
private accessToken;
|
|
@@ -44,13 +62,20 @@ declare class ApiClient {
|
|
|
44
62
|
private get baseParams();
|
|
45
63
|
private request;
|
|
46
64
|
private extractFirstValidationError;
|
|
47
|
-
createTemplate(content: TemplateContent): Promise<Template>;
|
|
65
|
+
createTemplate(content: TemplateContent, name?: string): Promise<Template>;
|
|
48
66
|
getTemplate(id: string): Promise<Template>;
|
|
49
|
-
|
|
50
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Apply a partial update. Takes a patch rather than bare content so a rename
|
|
69
|
+
* can travel without content and vice versa — the shape `TemplatePatch`
|
|
70
|
+
* defines, which is what `createCloudTemplatesProvider` forwards verbatim. Only
|
|
71
|
+
* the keys present are sent.
|
|
72
|
+
*/
|
|
73
|
+
updateTemplate(id: string, patch: TemplatePatch): Promise<Template>;
|
|
74
|
+
createVersion(templateId: string, content: TemplateContent, label?: string): Promise<TemplateVersionResponse>;
|
|
51
75
|
deleteTemplate(id: string): Promise<void>;
|
|
52
|
-
|
|
53
|
-
|
|
76
|
+
getVersions(templateId: string): Promise<TemplateVersionResponse[]>;
|
|
77
|
+
getVersion(templateId: string, versionId: string): Promise<TemplateVersionResponse>;
|
|
78
|
+
restoreVersion(templateId: string, versionId: string): Promise<Template>;
|
|
54
79
|
exportTemplate(templateId: string, fontsPayload?: {
|
|
55
80
|
customFonts: CustomFont[];
|
|
56
81
|
defaultFallback: string;
|
|
@@ -65,7 +90,7 @@ declare class ApiClient {
|
|
|
65
90
|
signature: string;
|
|
66
91
|
}): Promise<void>;
|
|
67
92
|
private commentsUrl;
|
|
68
|
-
getComments(templateId: string): Promise<
|
|
93
|
+
getComments(templateId: string): Promise<CommentResponse[]>;
|
|
69
94
|
createComment(templateId: string, data: {
|
|
70
95
|
body: string;
|
|
71
96
|
block_id?: string;
|
|
@@ -73,13 +98,13 @@ declare class ApiClient {
|
|
|
73
98
|
user_id: string;
|
|
74
99
|
user_name: string;
|
|
75
100
|
user_signature: string;
|
|
76
|
-
}, headers?: Record<string, string>): Promise<
|
|
101
|
+
}, headers?: Record<string, string>): Promise<CommentResponse>;
|
|
77
102
|
updateComment(templateId: string, commentId: string, data: {
|
|
78
103
|
body: string;
|
|
79
104
|
user_id: string;
|
|
80
105
|
user_name: string;
|
|
81
106
|
user_signature: string;
|
|
82
|
-
}, headers?: Record<string, string>): Promise<
|
|
107
|
+
}, headers?: Record<string, string>): Promise<CommentResponse>;
|
|
83
108
|
deleteComment(templateId: string, commentId: string, data: {
|
|
84
109
|
user_id: string;
|
|
85
110
|
user_name: string;
|
|
@@ -89,7 +114,7 @@ declare class ApiClient {
|
|
|
89
114
|
user_id: string;
|
|
90
115
|
user_name: string;
|
|
91
116
|
user_signature: string;
|
|
92
|
-
}, headers?: Record<string, string>): Promise<
|
|
117
|
+
}, headers?: Record<string, string>): Promise<CommentResponse>;
|
|
93
118
|
fetchConfig(): Promise<PlanConfig>;
|
|
94
119
|
listModules(search?: string, category?: string): Promise<SavedBlock[]>;
|
|
95
120
|
createModule(data: {
|
|
@@ -118,10 +143,10 @@ declare const API_ROUTES: {
|
|
|
118
143
|
readonly "templates.export": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/export";
|
|
119
144
|
readonly "templates.importFromBeefree": "/api/v1/projects/{project}/tenants/{tenant}/templates/import/from-beefree";
|
|
120
145
|
readonly "templates.sendTestEmail": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/send-test-email";
|
|
121
|
-
readonly "
|
|
122
|
-
readonly "
|
|
123
|
-
readonly "
|
|
124
|
-
readonly "
|
|
146
|
+
readonly "versions.index": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/versions";
|
|
147
|
+
readonly "versions.store": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/versions";
|
|
148
|
+
readonly "versions.show": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/versions/{version}";
|
|
149
|
+
readonly "versions.restore": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/versions/{version}/restore";
|
|
125
150
|
readonly "comments.index": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/comments";
|
|
126
151
|
readonly "comments.store": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/comments";
|
|
127
152
|
readonly "comments.update": "/api/v1/projects/{project}/tenants/{tenant}/templates/{template}/comments/{comment}";
|
|
@@ -185,45 +210,6 @@ declare class WebSocketClient {
|
|
|
185
210
|
get isConnected(): boolean;
|
|
186
211
|
}
|
|
187
212
|
//#endregion
|
|
188
|
-
//#region src/cloud/editor.d.ts
|
|
189
|
-
interface UseEditorOptions {
|
|
190
|
-
authManager: AuthManager;
|
|
191
|
-
defaultFontFamily?: string;
|
|
192
|
-
templateDefaults?: TemplateDefaults;
|
|
193
|
-
onError?: (error: Error) => void;
|
|
194
|
-
lockedBlocks?: Ref<Map<string, unknown>>;
|
|
195
|
-
}
|
|
196
|
-
interface UseEditorReturn {
|
|
197
|
-
state: DeepReadonly<EditorState>;
|
|
198
|
-
content: Ref<TemplateContent>;
|
|
199
|
-
selectedBlock: Ref<Block | null>;
|
|
200
|
-
setContent: (content: TemplateContent, markDirty?: boolean) => void;
|
|
201
|
-
selectBlock: (blockId: string | null) => void;
|
|
202
|
-
setViewport: (viewport: ViewportSize) => void;
|
|
203
|
-
setDarkMode: (darkMode: boolean) => void;
|
|
204
|
-
setPreviewMode: (previewMode: boolean) => void;
|
|
205
|
-
setUiTheme: (theme: UiTheme) => void;
|
|
206
|
-
updateBlock: (blockId: string, updates: Partial<Block>) => void;
|
|
207
|
-
updateSettings: (updates: Partial<TemplateSettings>) => void;
|
|
208
|
-
addBlock: (block: Block, targetSectionId?: string, columnIndex?: number, index?: number) => void;
|
|
209
|
-
removeBlock: (blockId: string) => void;
|
|
210
|
-
moveBlock: (blockId: string, newIndex: number, targetSectionId?: string, columnIndex?: number) => void;
|
|
211
|
-
savedBlockIds: Ref<Set<string>>;
|
|
212
|
-
isBlockLocked: (blockId: string) => boolean;
|
|
213
|
-
findBlockLocation: (blockId: string) => {
|
|
214
|
-
targetSectionId?: string;
|
|
215
|
-
columnIndex?: number;
|
|
216
|
-
index: number;
|
|
217
|
-
} | null;
|
|
218
|
-
create: (content?: TemplateContent) => Promise<Template>;
|
|
219
|
-
load: (templateId: string) => Promise<Template>;
|
|
220
|
-
save: () => Promise<Template>;
|
|
221
|
-
createSnapshot: () => Promise<void>;
|
|
222
|
-
hasTemplate: () => boolean;
|
|
223
|
-
markDirty: () => void;
|
|
224
|
-
}
|
|
225
|
-
declare function useEditor(options: UseEditorOptions): UseEditorReturn;
|
|
226
|
-
//#endregion
|
|
227
213
|
//#region src/cloud/mcp-operation-handler.d.ts
|
|
228
214
|
declare function handleOperation(editor: UseEditorReturn, payload: McpOperationPayload): void;
|
|
229
215
|
//#endregion
|
|
@@ -317,45 +303,59 @@ interface DesignReferenceInput {
|
|
|
317
303
|
}
|
|
318
304
|
declare function useDesignReference(options: UseDesignReferenceOptions): UseDesignReferenceReturn;
|
|
319
305
|
//#endregion
|
|
320
|
-
//#region src/cloud/comments.d.ts
|
|
321
|
-
|
|
306
|
+
//#region src/cloud/comments-provider.d.ts
|
|
307
|
+
/**
|
|
308
|
+
* The two methods this adapter needs from a Pusher channel, named structurally.
|
|
309
|
+
*
|
|
310
|
+
* Deliberately not `PresenceChannel`: `pusher-js` is an **optional** peer of this
|
|
311
|
+
* package, so a type imported from it would make `@templatical/editor` — which
|
|
312
|
+
* holds the channel ref for us — fail to typecheck without it installed. A
|
|
313
|
+
* `PresenceChannel` satisfies this shape, so nothing at the call site changes.
|
|
314
|
+
*/
|
|
315
|
+
interface RealtimeChannel {
|
|
316
|
+
bind(event: string, handler: (payload: any) => void): unknown;
|
|
317
|
+
unbind(event: string, handler?: (payload: any) => void): unknown;
|
|
318
|
+
}
|
|
319
|
+
interface CreateCloudCommentsProviderOptions {
|
|
322
320
|
authManager: AuthManager;
|
|
323
|
-
|
|
321
|
+
/**
|
|
322
|
+
* Cloud's presence channel for the open template, or `null` before it joins.
|
|
323
|
+
*
|
|
324
|
+
* A ref rather than a value because the channel arrives after the template
|
|
325
|
+
* loads and is replaced when another one is opened — {@link subscribe} watches
|
|
326
|
+
* it and rebinds, which is what keeps realtime optional from the editor's point
|
|
327
|
+
* of view: the contract only ever sees `subscribe`.
|
|
328
|
+
*/
|
|
329
|
+
channel: Ref<RealtimeChannel | null>;
|
|
330
|
+
/**
|
|
331
|
+
* The socket id to stamp on writes, so Cloud's backend can skip echoing them
|
|
332
|
+
* back to their author. Returns `null` before the socket connects.
|
|
333
|
+
*/
|
|
324
334
|
getSocketId?: () => string | null;
|
|
325
|
-
onComment?: (event: CommentEvent) => void;
|
|
326
|
-
onError?: (error: Error) => void;
|
|
327
|
-
isAuthReady?: Ref<boolean>;
|
|
328
|
-
hasCommentingFeature?: () => boolean;
|
|
329
335
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
interface UseCommentListenerOptions {
|
|
355
|
-
comments: UseCommentsReturn;
|
|
356
|
-
channel: Ref<PresenceChannel | null>;
|
|
357
|
-
}
|
|
358
|
-
declare function useCommentListener(options: UseCommentListenerOptions): void;
|
|
336
|
+
/**
|
|
337
|
+
* Cloud-backed {@link CommentsProvider} — the Templatical Cloud adapter for the
|
|
338
|
+
* same review contract consumers implement themselves.
|
|
339
|
+
*
|
|
340
|
+
* All four mutations are enabled: comment storage and its realtime fan-out are
|
|
341
|
+
* what the `commenting` plan feature pays for, so there is no Cloud tier that can
|
|
342
|
+
* read a thread but not reply to it. A consumer who wants a read-only review
|
|
343
|
+
* supplies their own provider with the mutations set to `false`.
|
|
344
|
+
*
|
|
345
|
+
* Two things about the write payloads are Cloud's alone and stay on this side of
|
|
346
|
+
* the seam:
|
|
347
|
+
*
|
|
348
|
+
* - **The author is signed.** `user_id` / `user_name` / `user_signature` come from
|
|
349
|
+
* the JWT, not from the editor's `user` config, so a browser cannot attribute a
|
|
350
|
+
* comment to someone else. The editor's `user` key still gates the feature and
|
|
351
|
+
* drives "you wrote this" in the UI; the two agree because `initCloud()` fills
|
|
352
|
+
* `user` from the same JWT.
|
|
353
|
+
* - **`X-Socket-ID`.** Cloud excludes the originating socket from the broadcast,
|
|
354
|
+
* which is why a local write and its echo can't double-post. Every implementation
|
|
355
|
+
* is nonetheless echo-safe (`upsert` replaces by id), so a backend without that
|
|
356
|
+
* header is fine too.
|
|
357
|
+
*/
|
|
358
|
+
declare function createCloudCommentsProvider(options: CreateCloudCommentsProviderOptions): CommentsProvider;
|
|
359
359
|
//#endregion
|
|
360
360
|
//#region src/cloud/collaboration.d.ts
|
|
361
361
|
interface UseCollaborationOptions {
|
|
@@ -394,7 +394,7 @@ interface BroadcastTarget {
|
|
|
394
394
|
* Must be applied **before** the history interceptor so the call chain is:
|
|
395
395
|
* history.record() → broadcast + original mutation.
|
|
396
396
|
*/
|
|
397
|
-
declare function useCollaborationBroadcast(editor: UseEditorReturn
|
|
397
|
+
declare function useCollaborationBroadcast(editor: Pick<UseEditorReturn, "addBlock" | "updateBlock" | "removeBlock" | "moveBlock" | "updateSettings" | "setContent">, collaboration: BroadcastTarget): void;
|
|
398
398
|
//#endregion
|
|
399
399
|
//#region src/cloud/web-socket.d.ts
|
|
400
400
|
interface UseWebSocketOptions {
|
|
@@ -432,21 +432,90 @@ declare function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn;
|
|
|
432
432
|
*/
|
|
433
433
|
declare function createCloudSavedBlocksProvider(authManager: AuthManager): SavedBlocksProvider;
|
|
434
434
|
//#endregion
|
|
435
|
-
//#region src/cloud/
|
|
436
|
-
|
|
435
|
+
//#region src/cloud/templates-provider.d.ts
|
|
436
|
+
/**
|
|
437
|
+
* Cloud-backed {@link TemplatesProvider} — the Templatical Cloud adapter for the
|
|
438
|
+
* same save/load contract consumers implement themselves.
|
|
439
|
+
*
|
|
440
|
+
* Auth (JWT via {@link AuthManager}) and project/tenant scoping live entirely on
|
|
441
|
+
* this side of the seam; the editor's header, Cmd+S, autosave and
|
|
442
|
+
* unsaved-changes guard never see them.
|
|
443
|
+
*
|
|
444
|
+
* All three methods are enabled: Cloud's template storage is what the plan pays
|
|
445
|
+
* for, so there is no tier in which a Cloud session can load but not save. A
|
|
446
|
+
* consumer who wants read-only supplies their own provider with `save: false`.
|
|
447
|
+
*
|
|
448
|
+
* **This is also where automatic versions are recorded.** The editor never
|
|
449
|
+
* creates one on its own — whoever implements `save` decides whether a save also
|
|
450
|
+
* records a version, which keeps throttling and retention with the side that
|
|
451
|
+
* pays for the storage. Cloud throttles to one automatic version per
|
|
452
|
+
* {@link AUTO_VERSION_INTERVAL_MS}, so an autosave firing every few seconds does
|
|
453
|
+
* not turn history into a keystroke log. This replaced an editor-side
|
|
454
|
+
* `createSnapshot()` on a timer, which put Cloud's retention policy in the
|
|
455
|
+
* editor.
|
|
456
|
+
*
|
|
457
|
+
* Note `initCloud()` **rejects** a consumer-supplied templates provider, unlike
|
|
458
|
+
* `savedBlocks` and `testEmail`. Those are inert — nothing keys off them. The
|
|
459
|
+
* template id is the join key for collaboration, version history, comments, AI
|
|
460
|
+
* rewrite, scoring and the server-side export, so an id Cloud never issued would
|
|
461
|
+
* degrade all six silently.
|
|
462
|
+
*/
|
|
463
|
+
declare function createCloudTemplatesProvider(authManager: AuthManager): TemplatesProvider;
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region src/cloud/render-provider.d.ts
|
|
466
|
+
interface CreateCloudRenderProviderOptions {
|
|
437
467
|
authManager: AuthManager;
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
interface UseSnapshotHistoryReturn {
|
|
443
|
-
snapshots: Ref<TemplateSnapshot[]>;
|
|
444
|
-
isLoading: Ref<boolean>;
|
|
445
|
-
isRestoring: Ref<boolean>;
|
|
446
|
-
loadSnapshots: () => Promise<void>;
|
|
447
|
-
restoreSnapshot: (snapshotId: string) => Promise<Template>;
|
|
468
|
+
/** The loaded template's id, or `null` before one exists. */
|
|
469
|
+
getTemplateId: () => string | null;
|
|
470
|
+
/** Persist the canvas so the endpoint renders what the user is looking at. */
|
|
471
|
+
save: () => Promise<Template>;
|
|
448
472
|
}
|
|
449
|
-
|
|
473
|
+
/**
|
|
474
|
+
* Templatical Cloud's renderer, shaped as a {@link RenderProvider} so it plugs
|
|
475
|
+
* into the same editor seam a consumer's own backend would.
|
|
476
|
+
*
|
|
477
|
+
* **Why Cloud renders server-side at all**, rather than running the bundled
|
|
478
|
+
* renderer like an OSS consumer: its output is a deliberate *superset* that a
|
|
479
|
+
* browser cannot produce. A countdown block resolves to a URL serving a live,
|
|
480
|
+
* on-demand animated GIF; a video block gets a composited play button. Both are
|
|
481
|
+
* injected into the published renderer through `blockRenderers` in Cloud's Node
|
|
482
|
+
* sidecar, so the delta is two functions and parity on the other twelve block
|
|
483
|
+
* types holds by construction.
|
|
484
|
+
*
|
|
485
|
+
* Two consequences of the endpoint rendering the **stored** template:
|
|
486
|
+
*
|
|
487
|
+
* - **Every render saves first.** The same trade the test-email adapter makes, for
|
|
488
|
+
* the same reason: exporting a stale version of what is on screen is worse than
|
|
489
|
+
* a write the caller did not ask for. It also means `toMjml()` needs a template
|
|
490
|
+
* to exist — a Cloud session that never created one gets a clear rejection
|
|
491
|
+
* rather than an export of nothing.
|
|
492
|
+
* - **`payload.content` is ignored**, along with the custom-block `renderedHtml`
|
|
493
|
+
* the editor pre-rendered into it. Cloud's `save()` persists that same content
|
|
494
|
+
* immediately before, so the server reads it from storage rather than trusting an
|
|
495
|
+
* echo. `payload.fonts` *is* read, because it is the only place the editor's
|
|
496
|
+
* effective font set is expressed. Don't "fix" the content branch.
|
|
497
|
+
*
|
|
498
|
+
* `compileMjml` is deliberately absent: `toMjml` and `toHtml` are both whole-
|
|
499
|
+
* pipeline calls here, so there is no MJML the editor would hand back for
|
|
500
|
+
* compiling.
|
|
501
|
+
*/
|
|
502
|
+
declare function createCloudRenderProvider(options: CreateCloudRenderProviderOptions): RenderProvider;
|
|
503
|
+
//#endregion
|
|
504
|
+
//#region src/cloud/version-history-provider.d.ts
|
|
505
|
+
/**
|
|
506
|
+
* Cloud-backed {@link VersionHistoryProvider} — the Templatical Cloud adapter for
|
|
507
|
+
* the same contract consumers implement themselves.
|
|
508
|
+
*
|
|
509
|
+
* Both mutations are enabled: version storage is what the plan pays for, so
|
|
510
|
+
* there is no Cloud tier that can list history but not restore it. A consumer
|
|
511
|
+
* who wants read-only history supplies their own provider with `restore: false`.
|
|
512
|
+
*
|
|
513
|
+
* **Automatic versions are not created here.** They are recorded by
|
|
514
|
+
* `createCloudTemplatesProvider`'s `save`, because the contract puts that
|
|
515
|
+
* decision on whoever implements `save` — the side that knows the storage cost.
|
|
516
|
+
* `create` here is for a version a person asked for.
|
|
517
|
+
*/
|
|
518
|
+
declare function createCloudVersionHistoryProvider(authManager: AuthManager): VersionHistoryProvider;
|
|
450
519
|
//#endregion
|
|
451
520
|
//#region src/cloud/test-email.d.ts
|
|
452
521
|
/**
|
|
@@ -512,15 +581,32 @@ interface CreateCloudTestEmailProviderOptions {
|
|
|
512
581
|
declare function createCloudTestEmailProvider(options: CreateCloudTestEmailProviderOptions): TestEmailProvider;
|
|
513
582
|
//#endregion
|
|
514
583
|
//#region src/cloud/export.d.ts
|
|
584
|
+
/** The fonts half of an export request, as Cloud's endpoint expects it. */
|
|
585
|
+
interface ExportFontsPayload {
|
|
586
|
+
customFonts: CustomFont[];
|
|
587
|
+
defaultFallback: string;
|
|
588
|
+
}
|
|
515
589
|
interface UseExportOptions {
|
|
516
590
|
authManager: AuthManager;
|
|
517
|
-
getFontsConfig?: () => FontsConfig | undefined;
|
|
518
|
-
canUseCustomFonts?: () => boolean;
|
|
519
591
|
}
|
|
520
592
|
interface UseExportReturn {
|
|
521
|
-
exportHtml: (templateId: string) => Promise<ExportResult>;
|
|
522
|
-
getMjmlSource: (templateId: string) => Promise<string>;
|
|
593
|
+
exportHtml: (templateId: string, fonts: ExportFontsPayload) => Promise<ExportResult>;
|
|
594
|
+
getMjmlSource: (templateId: string, fonts: ExportFontsPayload) => Promise<string>;
|
|
523
595
|
}
|
|
596
|
+
/**
|
|
597
|
+
* Flatten a {@link FontsConfig} into the export payload.
|
|
598
|
+
*
|
|
599
|
+
* Unconditional: gating fonts by entitlement meters no resource Cloud buys, and
|
|
600
|
+
* would only make the paid tier render fewer fonts than the free editor.
|
|
601
|
+
*/
|
|
602
|
+
declare function resolveExportFonts(fonts: FontsConfig | undefined): ExportFontsPayload;
|
|
603
|
+
/**
|
|
604
|
+
* Cloud's server-side export endpoint, as a plain API wrapper.
|
|
605
|
+
*
|
|
606
|
+
* Both calls render from the **stored** template, so callers save first when the
|
|
607
|
+
* canvas may have moved on — see `createCloudRenderProvider`, which is where that
|
|
608
|
+
* policy lives.
|
|
609
|
+
*/
|
|
524
610
|
declare function useExport(options: UseExportOptions): UseExportReturn;
|
|
525
611
|
//#endregion
|
|
526
612
|
//#region src/cloud/plan-config.d.ts
|
|
@@ -552,5 +638,5 @@ interface UseMcpListenerOptions {
|
|
|
552
638
|
}
|
|
553
639
|
declare function useMcpListener(options: UseMcpListenerOptions): void;
|
|
554
640
|
//#endregion
|
|
555
|
-
export { API_ROUTES, ApiClient, type AuthConfig, AuthManager, type AuthRequestOptions, type
|
|
641
|
+
export { API_ROUTES, ApiClient, type AuthConfig, AuthManager, type AuthRequestOptions, type CreateCloudCommentsProviderOptions, type CreateCloudRenderProviderOptions, type CreateCloudTestEmailProviderOptions, type DesignReferenceInput, type ExportFontsPayload, type PresenceMember, type RealtimeChannel, type SdkAuthConfig, type TestEmailConfig, type UseAiChatOptions, type UseAiChatReturn, type UseAiConfigReturn, type UseAiRewriteOptions, type UseAiRewriteReturn, type UseCollaborationOptions, type UseCollaborationReturn, type UseDesignReferenceOptions, type UseDesignReferenceReturn, type UseExportOptions, type UseExportReturn, type UseMcpListenerOptions, type UsePlanConfigOptions, type UsePlanConfigReturn, type UseTemplateScoringOptions, type UseTemplateScoringReturn, type UseTestEmailOptions, type UseTestEmailReturn, type UseWebSocketOptions, type UseWebSocketReturn, type UserConfig, WebSocketClient, type WebSocketClientOptions, type WebSocketConfig, buildUrl, createCloudCommentsProvider, createCloudRenderProvider, createCloudSavedBlocksProvider, createCloudTemplatesProvider, createCloudTestEmailProvider, createCloudVersionHistoryProvider, createSdkAuthManager, handleOperation, isFatalAuthError, performHealthCheck, resolveExportFonts, resolveWebSocketConfig, useAiChat, useAiConfig, useAiRewrite, useCollaboration, useCollaborationBroadcast, useDesignReference, useExport, useMcpListener, usePlanConfig, useTemplateScoring, useTestEmail, useWebSocket };
|
|
556
642
|
//# sourceMappingURL=index.d.ts.map
|