@veltdev/sdk-dev 5.0.2-beta.43 → 5.0.2-beta.44
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.
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TargetTextRange } from './target-text-range.data.model';
|
|
2
|
+
import { RewriterEventTypes } from '../../utils/enums';
|
|
3
|
+
export interface TextSelectedEvent {
|
|
4
|
+
selectionId: string;
|
|
5
|
+
text: string;
|
|
6
|
+
targetTextRange: TargetTextRange;
|
|
7
|
+
}
|
|
8
|
+
export interface RewriterAskAiRequest {
|
|
9
|
+
model: string;
|
|
10
|
+
prompt: string;
|
|
11
|
+
selectedText: string;
|
|
12
|
+
}
|
|
13
|
+
export interface RewriterReplaceTextRequest {
|
|
14
|
+
text: string;
|
|
15
|
+
event: TextSelectedEvent;
|
|
16
|
+
}
|
|
17
|
+
export interface RewriterAddCommentRequest {
|
|
18
|
+
text: string;
|
|
19
|
+
event: TextSelectedEvent;
|
|
20
|
+
}
|
|
21
|
+
export interface RewriterAskAiResponse {
|
|
22
|
+
text: string;
|
|
23
|
+
success: boolean;
|
|
24
|
+
error?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface RewriterReplaceTextResponse {
|
|
27
|
+
success: boolean;
|
|
28
|
+
originalText: string;
|
|
29
|
+
replacedText: string;
|
|
30
|
+
error?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface RewriterAddCommentResponse {
|
|
33
|
+
success: boolean;
|
|
34
|
+
annotationId?: string;
|
|
35
|
+
commentText?: string;
|
|
36
|
+
error?: string;
|
|
37
|
+
}
|
|
38
|
+
export type RewriterEventTypesMap = {
|
|
39
|
+
[RewriterEventTypes.TEXT_SELECTED]: TextSelectedEvent;
|
|
40
|
+
};
|
|
@@ -1,23 +1,55 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import { RewriterAskAiRequest, RewriterAskAiResponse, RewriterReplaceTextRequest, RewriterReplaceTextResponse, RewriterAddCommentRequest, RewriterAddCommentResponse, RewriterEventTypesMap } from "../data/rewriter-events.data.model";
|
|
2
4
|
export declare class RewriterElement {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
/**
|
|
6
|
+
* To enable rewriter feature
|
|
7
|
+
*/
|
|
8
|
+
enableRewriter: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* To disable rewriter feature
|
|
11
|
+
*/
|
|
12
|
+
disableRewriter: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* Subscribe to rewriter events
|
|
15
|
+
*/
|
|
16
|
+
on: <T extends keyof RewriterEventTypesMap>(action: T) => Observable<RewriterEventTypesMap[T]>;
|
|
17
|
+
/**
|
|
18
|
+
* Call AI with the currently selected text
|
|
19
|
+
*/
|
|
20
|
+
askAi: (request: RewriterAskAiRequest) => Promise<RewriterAskAiResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* Replace the selected text in the DOM with the given text
|
|
23
|
+
*/
|
|
24
|
+
replaceText: (request: RewriterReplaceTextRequest) => Promise<RewriterReplaceTextResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Add a comment annotation on the selected text with the given text as comment body
|
|
27
|
+
*/
|
|
28
|
+
addComment: (request: RewriterAddCommentRequest) => Promise<RewriterAddCommentResponse>;
|
|
29
|
+
constructor();
|
|
30
|
+
/**
|
|
31
|
+
* To enable rewriter feature
|
|
32
|
+
*/
|
|
33
|
+
private _enableRewriter;
|
|
34
|
+
/**
|
|
35
|
+
* To disable rewriter feature
|
|
36
|
+
*/
|
|
37
|
+
private _disableRewriter;
|
|
38
|
+
/**
|
|
39
|
+
* Subscribe to rewriter events
|
|
40
|
+
*/
|
|
41
|
+
private _on;
|
|
42
|
+
/**
|
|
43
|
+
* Call AI with the selected text
|
|
44
|
+
*/
|
|
45
|
+
private _askAi;
|
|
46
|
+
/**
|
|
47
|
+
* Replace the selected text in the DOM with the given text
|
|
48
|
+
*/
|
|
49
|
+
private _replaceText;
|
|
50
|
+
/**
|
|
51
|
+
* Add a comment annotation on the selected text with the given text as comment body
|
|
52
|
+
*/
|
|
53
|
+
private _addComment;
|
|
23
54
|
}
|
|
55
|
+
|
package/app/utils/enums.d.ts
CHANGED
|
@@ -88,6 +88,9 @@ export declare const RecorderEventTypes: {
|
|
|
88
88
|
readonly RECORDING_STOPPED: "recordingStopped";
|
|
89
89
|
readonly RECORDING_DONE_LOCAL: "recordingDoneLocal";
|
|
90
90
|
};
|
|
91
|
+
export declare const RewriterEventTypes: {
|
|
92
|
+
readonly TEXT_SELECTED: "textSelected";
|
|
93
|
+
};
|
|
91
94
|
export declare const CoreEventTypes: {
|
|
92
95
|
readonly PERMISSION_PROVIDER: "permissionProvider";
|
|
93
96
|
readonly USER_RESOLVER: "userResolver";
|
|
@@ -128,6 +131,7 @@ export type CoreEventType = typeof CoreEventTypes[keyof typeof CoreEventTypes];
|
|
|
128
131
|
export type LiveStateSyncEventType = typeof LiveStateSyncEventTypes[keyof typeof LiveStateSyncEventTypes];
|
|
129
132
|
export type PresenceEventType = typeof PresenceEventTypes[keyof typeof PresenceEventTypes];
|
|
130
133
|
export type NotificationEventType = typeof NotificationEventTypes[keyof typeof NotificationEventTypes];
|
|
134
|
+
export type RewriterEventType = typeof RewriterEventTypes[keyof typeof RewriterEventTypes];
|
|
131
135
|
export type CrdtEventType = typeof CrdtEventTypes[keyof typeof CrdtEventTypes];
|
|
132
136
|
export declare enum TagStatus {
|
|
133
137
|
ADDED = "added",
|
package/models.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export * from './app/models/data/recorder.model';
|
|
|
49
49
|
export * from './app/models/data/recorder-annotation.data.model';
|
|
50
50
|
export * from './app/models/data/recorder-events.data.model';
|
|
51
51
|
export * from './app/models/data/rewriter-annotation.data.model';
|
|
52
|
+
export * from './app/models/data/rewriter-events.data.model';
|
|
52
53
|
export * from './app/models/data/screen-size.data.model';
|
|
53
54
|
export * from './app/models/data/screenshot.data.model';
|
|
54
55
|
export * from './app/models/data/selection.model';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veltdev/sdk-dev",
|
|
3
|
-
"version": "5.0.2-beta.
|
|
3
|
+
"version": "5.0.2-beta.44",
|
|
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": [
|