@veltdev/types 6.0.0-beta.12 → 6.0.0-beta.13

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.
@@ -98,8 +98,24 @@ export interface TargetEditDetails<T = unknown> {
98
98
  * auto-commit so a subscriber to `targetEditCommit` can drive it explicitly.
99
99
  */
100
100
  export interface TargetEditCommitResult {
101
- /** Override the SDK's default `${targetId}: ${old} → ${new}` summary. */
101
+ /**
102
+ * Override the SDK's default diff summary (`Replace: "{old}" with "{new}"`;
103
+ * `Add:`/`Remove:` when one side is absent; a per-key op list when both
104
+ * values are plain objects). When provided without `summaryHtml`, it is
105
+ * used for BOTH the plain `commentText` and (escaped) the `commentHtml`
106
+ * of the seeded first comment.
107
+ */
102
108
  summary?: string;
109
+ /**
110
+ * Optional HTML version of the summary, used as the `commentHtml` of the
111
+ * suggestion's seeded first comment (the plain `summary` — or the SDK's
112
+ * default diff summary — stays in `commentText`). When BOTH are omitted,
113
+ * the SDK renders a default styled HTML diff (old/removed values in red
114
+ * italic, new/added values in green italic). Sanitized with DOMPurify at
115
+ * render time — script/event-handler content is stripped; inline `style`
116
+ * attributes are preserved.
117
+ */
118
+ summaryHtml?: string;
103
119
  /** Customer metadata persisted on the resulting Suggestion. */
104
120
  metadata?: Record<string, unknown>;
105
121
  }
@@ -134,6 +150,24 @@ export interface EnableSuggestionModeConfig {
134
150
  * to event subscribers.
135
151
  */
136
152
  onTargetEditCommit?: TargetEditCommitHandler;
153
+ /**
154
+ * When active AND no `onTargetEditCommit` handler is provided, every
155
+ * detected commit auto-commits with the SDK's default summary/summaryHtml
156
+ * (equivalent to a handler returning `{}`).
157
+ *
158
+ * **Default: true** — a bare `enableSuggestionMode()` turns edits into
159
+ * suggestions with zero config. Pass `autoCommit: false` for detect-only
160
+ * mode (events fire, nothing commits until a subscriber calls the event's
161
+ * `commitSuggestion` builder).
162
+ *
163
+ * A provided `onTargetEditCommit` handler always wins — including its
164
+ * null-return deferral contract — so handler-based integrations are
165
+ * unaffected. The `targetEditCommit` event still fires; its pre-bound
166
+ * `commitSuggestion` builder becomes a no-op for edits already
167
+ * auto-committed by this flag (same double-commit guard as the handler
168
+ * path).
169
+ */
170
+ autoCommit?: boolean;
137
171
  }
138
172
  /**
139
173
  * SDK-managed suggestion data persisted on a CommentAnnotation.
@@ -245,8 +279,24 @@ export interface CommitSuggestionConfig<T = unknown> {
245
279
  targetId: string;
246
280
  /** Any JSON-serializable value. Customer's apply handler interprets it. */
247
281
  newValue: T;
248
- /** Optional human-readable string for logs and notifications. */
282
+ /**
283
+ * Optional human-readable string for logs and notifications. When provided
284
+ * without `summaryHtml`, it is used for BOTH the seeded comment's plain
285
+ * `commentText` and (escaped) its `commentHtml`. When omitted, the seeded
286
+ * comment falls back to the SDK's default diff summary
287
+ * (`Replace: "{old}" with "{new}"`; `Add:`/`Remove:` when one side is
288
+ * absent; a per-key op list when both values are plain objects).
289
+ */
249
290
  summary?: string;
291
+ /**
292
+ * Optional HTML version of the summary — becomes the `commentHtml` of the
293
+ * suggestion's seeded first comment (plain `summary` or the default diff
294
+ * summary stays in `commentText`). When BOTH are omitted, the SDK renders
295
+ * a default styled HTML diff (old/removed values in red italic, new/added
296
+ * values in green italic). Sanitized with DOMPurify at render time; inline
297
+ * `style` attributes are preserved so rich diff styling survives.
298
+ */
299
+ summaryHtml?: string;
250
300
  /** Optional customer-defined metadata. Stored on Suggestion.metadata. */
251
301
  metadata?: Record<string, unknown>;
252
302
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltdev/types",
3
- "version": "6.0.0-beta.12",
3
+ "version": "6.0.0-beta.13",
4
4
  "description": "Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.",
5
5
  "homepage": "https://velt.dev",
6
6
  "keywords": [