@codebolt/codeboltjs 1.1.37 → 1.1.38

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/index.d.ts CHANGED
@@ -53,6 +53,8 @@ declare class Codebolt {
53
53
  getPDF: () => void;
54
54
  pdfToText: () => void;
55
55
  getContent: () => Promise<import("@codebolt/types").GetContentResponse>;
56
+ getSnapShot: () => Promise<any>;
57
+ getBrowserInfo: () => Promise<any>;
56
58
  extractText: () => Promise<import("@codebolt/types").ExtractTextResponse>;
57
59
  close: () => void;
58
60
  scroll: (direction: string, pixels: string) => Promise<unknown>;
@@ -46,6 +46,16 @@ declare const cbbrowser: {
46
46
  * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
47
47
  */
48
48
  getContent: () => Promise<GetContentResponse>;
49
+ /**
50
+ * Retrieves the snapshot of the current page.
51
+ * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
52
+ */
53
+ getSnapShot: () => Promise<any>;
54
+ /**
55
+ * Retrieves browser info like height width scrollx scrolly of the current page.
56
+ * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
57
+ */
58
+ getBrowserInfo: () => Promise<any>;
49
59
  /**
50
60
  * Extracts text from the current page.
51
61
  * @returns {Promise<ExtractTextResponse>} A promise that resolves with the extracted text.
@@ -145,6 +145,42 @@ const cbbrowser = {
145
145
  });
146
146
  });
147
147
  },
148
+ /**
149
+ * Retrieves the snapshot of the current page.
150
+ * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
151
+ */
152
+ getSnapShot: () => {
153
+ return new Promise((resolve, reject) => {
154
+ websocket_1.default.getWebsocket.send(JSON.stringify({
155
+ "type": "browserEvent",
156
+ action: 'getSnapShot'
157
+ }));
158
+ websocket_1.default.getWebsocket.on('message', (data) => {
159
+ const response = JSON.parse(data);
160
+ if (response.event === "getSnapShotResponse") {
161
+ resolve(response);
162
+ }
163
+ });
164
+ });
165
+ },
166
+ /**
167
+ * Retrieves browser info like height width scrollx scrolly of the current page.
168
+ * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
169
+ */
170
+ getBrowserInfo: () => {
171
+ return new Promise((resolve, reject) => {
172
+ websocket_1.default.getWebsocket.send(JSON.stringify({
173
+ "type": "browserEvent",
174
+ action: 'getBrowserInfo'
175
+ }));
176
+ websocket_1.default.getWebsocket.on('message', (data) => {
177
+ const response = JSON.parse(data);
178
+ if (response.event === "getBrowserInfoResponse") {
179
+ resolve(response);
180
+ }
181
+ });
182
+ });
183
+ },
148
184
  /**
149
185
  * Extracts text from the current page.
150
186
  * @returns {Promise<ExtractTextResponse>} A promise that resolves with the extracted text.
package/modules/chat.d.ts CHANGED
@@ -28,7 +28,7 @@ declare const cbchat: {
28
28
  /**
29
29
  * Waits for a reply to a sent message.
30
30
  * @param {string} message - The message for which a reply is expected.
31
- * @returns {Promise<string>} A promise that resolves with the reply.
31
+ * @returns {Promise<ChatMessage>} A promise that resolves with the reply.
32
32
  */
33
33
  waitforReply: (message: string) => Promise<string>;
34
34
  /**
package/modules/chat.js CHANGED
@@ -62,7 +62,7 @@ const cbchat = {
62
62
  /**
63
63
  * Waits for a reply to a sent message.
64
64
  * @param {string} message - The message for which a reply is expected.
65
- * @returns {Promise<string>} A promise that resolves with the reply.
65
+ * @returns {Promise<ChatMessage>} A promise that resolves with the reply.
66
66
  */
67
67
  waitforReply: (message) => {
68
68
  return new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebolt/codeboltjs",
3
- "version": "1.1.37",
3
+ "version": "1.1.38",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -152,6 +152,44 @@ const cbbrowser = {
152
152
  });
153
153
  });
154
154
  },
155
+ /**
156
+ * Retrieves the snapshot of the current page.
157
+ * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
158
+ */
159
+ getSnapShot: ():Promise<any> => {
160
+
161
+ return new Promise((resolve, reject) => {
162
+ cbws.getWebsocket.send(JSON.stringify({
163
+ "type": "browserEvent",
164
+ action: 'getSnapShot'
165
+ }));
166
+ cbws.getWebsocket.on('message', (data: string) => {
167
+ const response = JSON.parse(data);
168
+ if (response.event === "getSnapShotResponse") {
169
+ resolve(response);
170
+ }
171
+ });
172
+ });
173
+ },
174
+ /**
175
+ * Retrieves browser info like height width scrollx scrolly of the current page.
176
+ * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
177
+ */
178
+ getBrowserInfo: ():Promise<any> => {
179
+
180
+ return new Promise((resolve, reject) => {
181
+ cbws.getWebsocket.send(JSON.stringify({
182
+ "type": "browserEvent",
183
+ action: 'getBrowserInfo'
184
+ }));
185
+ cbws.getWebsocket.on('message', (data: string) => {
186
+ const response = JSON.parse(data);
187
+ if (response.event === "getBrowserInfoResponse") {
188
+ resolve(response);
189
+ }
190
+ });
191
+ });
192
+ },
155
193
 
156
194
  /**
157
195
  * Extracts text from the current page.
@@ -63,7 +63,7 @@ const cbchat = {
63
63
  /**
64
64
  * Waits for a reply to a sent message.
65
65
  * @param {string} message - The message for which a reply is expected.
66
- * @returns {Promise<string>} A promise that resolves with the reply.
66
+ * @returns {Promise<ChatMessage>} A promise that resolves with the reply.
67
67
  */
68
68
  waitforReply: (message: string): Promise<string> => {
69
69
  return new Promise((resolve, reject) => {