testaugnitosdk2 1.0.12

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.
Files changed (79) hide show
  1. package/README.md +442 -0
  2. package/dist/Augnito.d.ts +130 -0
  3. package/dist/AugnitoMobile.d.ts +13 -0
  4. package/dist/api/BaseAPI.d.ts +32 -0
  5. package/dist/api/FactoryAPI.d.ts +25 -0
  6. package/dist/api/Formatting/FormattingAPI.d.ts +15 -0
  7. package/dist/api/Formatting/FormattingModels.d.ts +29 -0
  8. package/dist/api/Macros/MacrosAPI.d.ts +28 -0
  9. package/dist/api/Macros/MacrosModels.d.ts +32 -0
  10. package/dist/api/MedicineOrdering/MedicineOrderderingData.d.ts +6 -0
  11. package/dist/api/MedicineOrdering/MedicineOrderingAPI.d.ts +15 -0
  12. package/dist/api/MedicineOrdering/MedicineOrderingModels.d.ts +26 -0
  13. package/dist/api/Vocabulary/VocabularyAPI.d.ts +31 -0
  14. package/dist/api/Vocabulary/VocabularyModels.d.ts +38 -0
  15. package/dist/api/index.d.ts +9 -0
  16. package/dist/augnitosdk.js +11067 -0
  17. package/dist/client/MobileClient.d.ts +17 -0
  18. package/dist/client/NotificationClient.d.ts +25 -0
  19. package/dist/client/PhilipsMicClient.d.ts +17 -0
  20. package/dist/client/WebClient.d.ts +59 -0
  21. package/dist/commands/AugnitoCommands.d.ts +93 -0
  22. package/dist/commands/AugnitoCommandsRegex.d.ts +9 -0
  23. package/dist/commands/AugnitoCommandsStatic.d.ts +6 -0
  24. package/dist/commands/AugnitoCustomCommands.d.ts +8 -0
  25. package/dist/commands/index.d.ts +1 -0
  26. package/dist/commands/utils/CustomCommandModel.d.ts +5 -0
  27. package/dist/commands/utils/TextToWordInteger.d.ts +5 -0
  28. package/dist/config/AugnitoConfig.d.ts +113 -0
  29. package/dist/config/AugnitoFormattingConfig.d.ts +10 -0
  30. package/dist/config/AugnitoMobileConfig.d.ts +7 -0
  31. package/dist/config/AugnitoVocabularyConfig.d.ts +10 -0
  32. package/dist/config/ConfigValidator.d.ts +15 -0
  33. package/dist/config/IConfiguration .d.ts +35 -0
  34. package/dist/config/PhilipsMicConfig.d.ts +8 -0
  35. package/dist/config/SDKConfig.d.ts +40 -0
  36. package/dist/config/SDKConfigMobile.d.ts +21 -0
  37. package/dist/config/index.d.ts +4 -0
  38. package/dist/index.d.ts +10 -0
  39. package/dist/index.js +188 -0
  40. package/dist/interop/core/CommonEditorUtils.d.ts +10 -0
  41. package/dist/interop/core/EditorHandler.d.ts +35 -0
  42. package/dist/interop/core/EditorType.d.ts +8 -0
  43. package/dist/interop/core/PhilipsMicMode.d.ts +6 -0
  44. package/dist/interop/core/ProcessorFactory.d.ts +9 -0
  45. package/dist/interop/core/ProcessorHandler.d.ts +35 -0
  46. package/dist/interop/core/RichEditClientCommand.d.ts +416 -0
  47. package/dist/interop/core/TargetEditor.d.ts +7 -0
  48. package/dist/interop/index.d.ts +3 -0
  49. package/dist/interop/processors/BaseInteropProcessor.d.ts +10 -0
  50. package/dist/interop/processors/CKEditor4InteropProcessor.d.ts +14 -0
  51. package/dist/interop/processors/CKEditor5InteropProcessor.d.ts +17 -0
  52. package/dist/interop/processors/CommonContentEditableProcessor.d.ts +63 -0
  53. package/dist/interop/processors/DevExpressRichEditProcessor.d.ts +14 -0
  54. package/dist/interop/processors/GenericInteropProcessor.d.ts +11 -0
  55. package/dist/interop/processors/HTMLInteropProcessor.d.ts +41 -0
  56. package/dist/interop/processors/InteropProcessor.d.ts +11 -0
  57. package/dist/interop/processors/InteropProcessorCommon.d.ts +21 -0
  58. package/dist/interop/types/AnchoredEditorData.d.ts +4 -0
  59. package/dist/interop/types/CKEditorExtensions.d.ts +8 -0
  60. package/dist/interop/types/CommonTypes.d.ts +27 -0
  61. package/dist/interop/types/DynamicBadge.d.ts +5 -0
  62. package/dist/interop/types/DynamicSelect.d.ts +14 -0
  63. package/dist/recipe/ActionRecipe.d.ts +19 -0
  64. package/dist/recipe/index.d.ts +1 -0
  65. package/dist/support/AugnitoMobileSocketResponse.d.ts +19 -0
  66. package/dist/support/AugnitoNotificationMessage.d.ts +9 -0
  67. package/dist/support/AugnitoSDKErrorMessage.d.ts +7 -0
  68. package/dist/support/AugnitoSDKErrors.d.ts +7 -0
  69. package/dist/support/AugnitoSDKEvent.d.ts +11 -0
  70. package/dist/support/AugnitoServerStatusCode.d.ts +7 -0
  71. package/dist/support/AugnitoSocketResponse.d.ts +17 -0
  72. package/dist/support/AugnitoSource.d.ts +17 -0
  73. package/dist/support/AugnitoStatus.d.ts +27 -0
  74. package/dist/utils/AugnitoDomainUtils.d.ts +8 -0
  75. package/dist/utils/AugnitoUtils.d.ts +11 -0
  76. package/dist/utils/Guard.d.ts +11 -0
  77. package/dist/utils/Logger.d.ts +6 -0
  78. package/dist/utils/RichEditAction.d.ts +11 -0
  79. package/package.json +79 -0
package/README.md ADDED
@@ -0,0 +1,442 @@
1
+ # Augnito Speech SDK
2
+
3
+ You can use **Augnito SDK** to make use of the Speech Recognition AI. To get access credentials or talk to us about your project, get in touch with us at <partnerships@augnito.ai>.
4
+
5
+ ## Installation
6
+
7
+ Install the library in your Typescript project.
8
+
9
+ ### [Typescript](#tab/tab-ts)
10
+
11
+ ```ts
12
+ npm install augnitosdk
13
+ ```
14
+
15
+ _Note: If you wish to integrate augnitosdk with CKEDitor 5 editor then please make sure to install @ckeditor/ckeditor5-core package using below command_
16
+
17
+ ```js
18
+ npm install @ckeditor/ckeditor5-core
19
+ ```
20
+
21
+ ### [Vanilla JS](#tab/tab-js)
22
+
23
+ use https://cdn.jsdelivr.net/npm/augnitosdk@latest/dist/augnitosdk.js to import the library from npm using CDN url.
24
+
25
+ ## Basic Usage
26
+
27
+ ### 1- Import the library
28
+
29
+ ### [Typescript](#tab/tab-ts)
30
+
31
+ ```ts
32
+ import { Augnito } from 'augnitosdk';
33
+ ```
34
+
35
+ ### [Vanilla JS](#tab/tab-js)
36
+
37
+ ```js
38
+ import { Augnito } from 'https://cdn.jsdelivr.net/npm/augnitosdk@latest/dist/augnitosdk.js';
39
+ ```
40
+
41
+ Note - All other steps are common for Vanilla JS and Typescript implementations.
42
+
43
+ ### 2- Create the configuration file and instantiate Augnito Client
44
+
45
+ ```js
46
+ const augnitoConfig: AugnitoConfig = {
47
+ server: '<your domain server>',
48
+ accountCode: '<your accountcode>',
49
+ accessKey: '<your accesskey>',
50
+ userTag: '<your usertag>',
51
+ sourceApp: '<your sourceapp>',
52
+ lmId: '<your lmid>'
53
+ noiseCt: 1, //Optional parameter, to set noice cancellation value and default value is 1 which is off
54
+ enableLogs: false, // Optional parameter, to check debug logs set to true
55
+ listOfControls: [], // Optional parameter, set a list of type TargetEditor. Setting editor instance is necessary for EditorType.DEVEXPRESS and to handle navigation command between fields
56
+ editor: EditorType.HTML, // Optional parameter, set EditorType enum for SDK to insert sppech-to-text display at cursor placed inside field and to handle commands dictated. Other enum values are EditorType.CKEDITOR4 | EditorType.CKEDITOR5 | EditorType.GENERIC | EditorType.DEVEXPRESS,
57
+ earlyInitialiseRecorder: false, // Optional parameter, set it to true if required to initialise recorder mic as soon as page is loaded so as to start listening immediately on mic button click
58
+ pauseStateBufferInterval: 1, // Optional parameter, set value between 0-1 if earlyInitialiseRecorder is set to true and the value indicates interval (in seconds) of audio which needs to be streamed while resuming mic,
59
+ switchToRegularSpeechProfile: false, //Optional parameter, set to true for using regular speech profile else by default it is set to fast speech profile
60
+ };
61
+
62
+ const augnito = new Augnito(augnitoConfig);
63
+ ```
64
+
65
+ ### 3- Toggle the client!
66
+
67
+ Now all you have to do is toggle the status when you want to connect/disconnect!
68
+
69
+ ```js
70
+ // Toggles the Speech API connection. Set optional parameter shouldPauseResume to true to toggle pause and resume dictation. This will ensure socket connection remains connected throughout. If no parameter is given, then the method will function as toggle of start and stop dictation. This will create a new socket connection on every start
71
+ augnito.toggleListening((shouldPauseResume = false));
72
+
73
+ augnito.requestMicOff(); //call this method to close the socket connection and clear all resources in case shouldPauseResume is set to true
74
+ ```
75
+
76
+ ## Mobile Application
77
+
78
+ Whether you want to use the **Augnito Mic** as your microphone, or you want to develop your own app, we got you covered.
79
+
80
+ All you have to do is initialize the mobile configuration. The SDK will generate a value that you need to use to generate a QR code which should be scanned in the App.
81
+
82
+ ```js
83
+ import { AugnitoMobileConfig } from 'augnitosdk';
84
+
85
+ const mobileConfig: AugnitoMobileConfig = {
86
+ enableLogs: false
87
+ };
88
+ const augnitoMobile = augnito.initMobileClient(mobileConfig);
89
+
90
+ //Generate a QR Code with the following value
91
+ const code = augnito.getQRCode();
92
+ ```
93
+
94
+ ## Config Philips Speech Mic
95
+
96
+ If you have a Philips speech mic and want to use it as the input device, then include the below code.
97
+
98
+ ```js
99
+ import { PhilipsMicMode } from 'augnitosdk';
100
+
101
+ const philipMicConfig = {
102
+ philipsMicMode: PhilipsMicMode['HandsFree'] //other options include PhilipsMicMode.PushToTalk or PhilipsMicMode.BOTH
103
+ };
104
+ const philipMicHandler = augnito.initPhilipMicClient(philipMicConfig);
105
+ ```
106
+
107
+ - HandsFree - where you push the record button speak and the push the button to stop
108
+ - PushToTalk - where you press and hold the record button to speak. Release of the button will stop
109
+ - BOTH - SDK will intelligently handle the other two modes based on user action
110
+
111
+ ## Augnito - Speech Related Callbacks
112
+
113
+ | Name | type | Description |
114
+ | ------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
115
+ | onPartialResult | (text: string) => void | Partial Result generated from the server |
116
+ | onFinalResult | (finalText: Recipe) => boolean | A final result is called when text has been processed by the Speech Server. Returns `true` to stop the processing in the SDK |
117
+ | onCommandResult | (command: Recipe) => boolean | A command generated from the server. Returns `true` to stop the processing in the SDK |
118
+ | onStateChanged | (isConnected: boolean) => void | Callback to indicate the status of the microphone listening state has changed. |
119
+ | onSessionEvent | (data: AugnitoSocketResponse) => void | Callback to intercept Session Events |
120
+ | onIdleMic | () => void | Callback when the Mic is idle for 5 minutes |
121
+ | onMicrophoneOnError | (isWebClient: boolean) => void | Callback triggered when trying to start the connection, but it fails because it is already opened. (It can be opened in another tab, or it was not closed properly) |
122
+ | onError | (error: AugnitoSDKErrorMessage) => void | Callback triggered when the SDK encouters an error |
123
+
124
+ ## Augnito Mobile - Speech Related Callbacks
125
+
126
+ | Name | type | Description |
127
+ | ------------------- | ---------- | ------------------------------------------------------ |
128
+ | onConnectionRequest | () => void | Callback when a mobile client is requesting to connect |
129
+ | onMobileScan | () => void | Callback when a mobile client has scanned the QR Code |
130
+
131
+ ## Philips Speech Mic Related Callbacks
132
+
133
+ | Name | type | Description |
134
+ | ------------------- | ---------- | ------------------------------------------------------------ |
135
+ | onPhilipsMicPressed | () => void | Callback when record button is pressed on Philips Speech Mic |
136
+
137
+ ### Augnito Methods
138
+
139
+ | prop | type | notes |
140
+ | ------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
141
+ | toggleListening | void | Toggles the Speech API connection: if already connected, it will stop the web socket; otherwise, it will start a new connection. If optional parameter shouldPauseResume is set to true then listening to mic will be suspended and resumed, here web socket will remain alive throughout the session. Consumers of the sdk are expected to call requestMicOff to stop the web sockeet and clean the resources in the end |
142
+ | isConnected | boolean | Returns the status of the web socket: true if connected; otherwise false. |
143
+ | getQRCode | string | Returns the Generated Value for the QR Code (If and only if the DeviceId was provided). |
144
+ | dispose | void | Dispose all resources. |
145
+ | initMobileClient | AugnitoMobile | Creates a web socket for getting notifications from client mobile application: only to be used with Mobile App |
146
+ | apisFactory | FactoryAPI | Returns an Abstract Factory to create different API Clients. |
147
+ | requestMicOff | void | Sends a request to close all opened connections. |
148
+ | initPhilipMicClient | PhilipsMicClient | To be used with Philips Speecch Mic. It will listen to press event of record button on the mic. |
149
+
150
+ ## MacrosAPI
151
+
152
+ ### MacrosAPI Methods
153
+
154
+ | name | type | notes |
155
+ | ----------- | -------------------- | -------------------------------------------------- |
156
+ | getMacros | Promise: MacroResult | Returns a list of macros for the specified user. |
157
+ | upsertMacro | Promis: MacroResult | Creates or Updates a Macro for the specified user. |
158
+ | deleteMacro | Promise: MacroResult | Deletes a Macro for the specified user. |
159
+
160
+ ### 1- Create Macros Client
161
+
162
+ ```js
163
+ // If you already have an augnito client..
164
+ const macrosClient = augnito.apisFactory.getMacrosAPI();
165
+
166
+ // OR
167
+ import { MacrosAPI } from 'augnitosdk';
168
+ const macrosClient = new MacrosAPI(accountCode, accessKey, server);
169
+ ```
170
+
171
+ ### 2- Use the Macros Client to list, create, update or delete user macros
172
+
173
+ ```js
174
+ macrosClient
175
+ .getMacros({
176
+ UserTag: userTag
177
+ })
178
+ .then((result) => {
179
+ console.log(result);
180
+ });
181
+ ```
182
+
183
+ ## Formatting Preference API
184
+
185
+ ### Formatting Preference API Interfaces
186
+
187
+ ```js
188
+ interface Edge
189
+ {
190
+ PK: string;
191
+ SK: string;
192
+ }
193
+
194
+ interface UserFormattingRequest
195
+ {
196
+ PageId?: Edge; // Optional page edge for next and previous pages of search results
197
+ Limit?: number; // Optional limit for number of search results
198
+ }
199
+
200
+ interface FormattingItem
201
+ {
202
+ SpokenForm: string; // The spoken form of the formatting preference
203
+ DisplayForm: string; // The display form of the formatting preference
204
+ ID: string; // The ID of the formatting preference
205
+ }
206
+
207
+ interface FormattingResult
208
+ {
209
+ Status: number; // Response status code
210
+ ErrorMessage: string; // Error message if any
211
+ Data: {
212
+ StatusMessage: string; // Response status message
213
+ FormattingPreferenceItems? :
214
+ {
215
+ PageSize: number; // Number of items in the current page
216
+ PageIdNext?: Edge; // Next page edge if any
217
+ PageIdPrevious?: Edge; // Previous page edge if any
218
+ Items: Array<FormattingItem>; // List of formatting preferences
219
+ };
220
+ };
221
+ }
222
+
223
+ interface UpsertFormattingRequest {
224
+ SpokenForm: string; // The spoken form of the formatting preference
225
+ DisplayForm: string; // The display form of the formatting preference
226
+ ID?: string; // The ID of the formatting preference if updating an existing preference
227
+ }
228
+
229
+ RemoveFormattingRequest {
230
+ ID: string; // The Id of the formatting preference to be deleted
231
+ }
232
+
233
+ ```
234
+
235
+ ### Formatting Preference API Methods
236
+
237
+ | name | type | notes |
238
+ | -------------------------------------------------- | ------------------------- | ------------------------------------------------------------------ |
239
+ | getFormatting(request: UserFormattingRequest) | Promise: FormattingResult | Returns a list of formatting preferfences for the specified user. |
240
+ | upsertFormatting(request: UpsertFormattingRequest) | Promise: FormattingResult | Creates or Updates a formatting preference for the specified user. |
241
+ | removeFormatting(request: RemoveFormattingRequest) | Promise: FormattingResult | Deletes a formatting preference for the specified user. |
242
+
243
+ ### 1- Create Formatting Preference Client
244
+
245
+ ```js
246
+ // If you already have an augnito client..
247
+ const formattingAPI = augnito.apisFactory.getFormattingAPI();
248
+
249
+ // OR
250
+ import { FormattingAPI } from 'augnitosdk';
251
+ const formattingAPI = new FormattingAPI({
252
+ UserCode: <your usercode>,
253
+ SubscriptionCode: <your subscription code>,
254
+ AccessKey: <your access key>,
255
+ SmId: <your sm id>,
256
+ DeviceCode: <your device code>,
257
+ SourceApp: <your source app>,
258
+ AccountCode: <your account code>,
259
+ Server: <your server>,
260
+ EnableLogs: true | false,
261
+ });
262
+
263
+ ```
264
+
265
+ ### 2- Use the Formatting Preference Client to list, create, update or delete user macros
266
+
267
+ ```js
268
+ formatApi
269
+ .getFormatting({
270
+ Limit: 10
271
+ })
272
+ .then((result) => {
273
+ console.log('formatting', result);
274
+ });
275
+ ```
276
+
277
+ ## Vocabulary API
278
+
279
+ Vocabulary items can be added to the model for a specific user and model.
280
+ When the word has been added and is ready to be recognised a notification will be sent to the client and the microphone will need to be restarted.
281
+
282
+ ### Vocabulary Models
283
+
284
+ ```js
285
+ interface Edge
286
+ {
287
+ PK: string;
288
+ SK: string;
289
+ }
290
+
291
+ interface UserVocabularyRequest
292
+ {
293
+ PageId?: Edge; // Optional page edge for next and previous pages of search results
294
+ Limit?: number; // Optional limit for number of search results
295
+ }
296
+
297
+ interface VocabularyItem
298
+ {
299
+ Word: string; // The word
300
+ SpokenWord: string | null; // The , optional, spoken form of the word
301
+ IsAbbreviation: boolean; // Whether the word is an abbreviation or not
302
+ CreatedAt: Date; // The date the word was added to the vocabulary
303
+ Status: string; // The status of the word
304
+ }
305
+
306
+ interface VocabularyResult
307
+ {
308
+ Status: number; // Response status code
309
+ ErrorMessage: string; // Error message if any
310
+ Data: {
311
+ StatusMessage: string; // Response status message
312
+ WordItems? :
313
+ {
314
+ SubscriptionCode: string; // The subscription code
315
+ UserCode: string; // The user code the word has been added for
316
+ PageSize: number; // Number of items in the current page
317
+ PageIdNext?: Edge; // Next page edge if any
318
+ PageIdPrevious?: Edge; // Previous page edge if any
319
+ Items: Array<VocabularyItem>; // List of vocabulary items
320
+ };
321
+ };
322
+ }
323
+
324
+ interface UpsertVocabularyRequest
325
+ {
326
+ file: File; // Audio file of the word to be added
327
+ Word: string; // The word
328
+ SpokenWord: string; // The, optional, spoken form of the word
329
+ IsAbbreviation: boolean; // Whether the word is an abbreviation or not
330
+ }
331
+
332
+ interface RemoveVocabularyRequest
333
+ {
334
+ Word: string; // The word to be removed
335
+ }
336
+
337
+ ```
338
+
339
+ ### VocabularyAPI Methods
340
+
341
+ | name | type | notes |
342
+ | -------------------------------------------------- | ------------------------- | ----------------------------------------------------- |
343
+ | getVocabulary(request: UserVocabularyRequest) | Promise: VocabularyResult | Returns a list of vocabulary for the specified user. |
344
+ | upsertFormatting(request: UpsertVocabularyRequest) | Promise: VocabularyResult | Creates or Updates vocabulary for the specified user. |
345
+ | removeFormatting(request: RemoveVocabularyRequest) | Promise: VocabularyResult | Deletes a vocabulary for the specified user. |
346
+
347
+ ### VocabularyAPI Callback
348
+
349
+ | Name | type | Description |
350
+ | ----------------- | ---------------------------------------------- | ------------------------------------------------------- |
351
+ | onVocabularyAdded | (notification: AugnitoAppNotification) => void | Notification that a vocabulary word has been processed. |
352
+
353
+ ### Vocbaulary Helper Methods
354
+
355
+ | Name | type | Description |
356
+ | ---------------- | ---------------------------- | ------------------------------------------------------------ |
357
+ | startRecording() | (Promise) => void | Starts recording audio. Will turn off main Augnito mic if on |
358
+ | stopRecording() | (blob:Promise<Blob>) => void | Stops recording audio and returns the audio |
359
+
360
+ The audio for the vocabulary to be added must be between 1 and 8 seconds long.
361
+ If you call stop recording less than 1 second after start the recording will wait for a second to have passed since it started before resolving the promise.
362
+ If you call stop recording more than 8 seconds after start the returned recording will be the first 8 seconds recorded.
363
+
364
+ ### 1- Create Vocabulary Client
365
+
366
+ ```js
367
+ const vocabularyAPI = augnito.apisFactory.getVocabularyAPI();
368
+
369
+ // Add a callback to be notified when a vocabulary word has been processed
370
+ vocabularyAPI.onVocabularyAdded = (notification: AugnitoAppNotification) => {
371
+ console.log(notification);
372
+ };
373
+
374
+ ```
375
+
376
+ ### 2 - Add a new vocabulary item
377
+
378
+ ```js
379
+
380
+ // Start recording
381
+ vocabularyAPI.startRecording();
382
+ ... // Record for 1-8 seconds
383
+ // Stop recording
384
+ vocabularyAPI.stopRecording().then((blob) => {
385
+ // Add the word to the vocabulary
386
+ vocabularyAPI.upsertVocabulary({
387
+ file: new File([blob], 'test.wav'),
388
+ Word: 'test',
389
+ SpokenWord: 'test',
390
+ IsAbbreviation: false,
391
+ });
392
+ });
393
+
394
+ ```
395
+
396
+ ### 3 - List vocabulary items from multiple pages
397
+
398
+ ```js
399
+ const loadWords = (page?: Edge) => {
400
+ vocabularyAPI
401
+ .getVocabulary({ Limit: 10, PageId: page })
402
+ .then(function (result) {
403
+ if (typeof result != 'string') {
404
+ result.Data.WordItems?.Items.forEach((value) => {
405
+ console.log(value);
406
+ });
407
+ if (result.Data.WordItems?.PageIdNext) {
408
+ loadWords( result.Data.WordItems.PageIdNext);
409
+ }
410
+ }
411
+ });
412
+ };
413
+
414
+ loadWords();
415
+ ```
416
+
417
+ ## MedicineOrderingAPI
418
+
419
+ ### MedicineOrderingAPI Methods
420
+
421
+ | Name | type | Description |
422
+ | -------------------- | ----------------------------------------- | -------------------------------------------------------------- |
423
+ | getMedicineOrderData | Promise: MedicineOrderingResult Or String | Returns medicine ordering data for text specified by the user. |
424
+
425
+ ### 1- Create MedicineOrdering Client
426
+
427
+ ```js
428
+ // If you already have an augnito client..
429
+ const orderingClient = augnito.apisFactory.getMedicineOrderingAPI();
430
+ ```
431
+
432
+ ### 2- Use the MedicineOrdering Client to get medicine order data in the following manner
433
+
434
+ ```js
435
+ orderingClient
436
+ .getMedicineOrderData({
437
+ Text: ''
438
+ })
439
+ .then((result) => {
440
+ console.log(result);
441
+ });
442
+ ```
@@ -0,0 +1,130 @@
1
+ import { AugnitoConfig } from './config/AugnitoConfig';
2
+ import { AugnitoMobileConfig } from './config/AugnitoMobileConfig';
3
+ import { ActionRecipe } from './recipe/ActionRecipe';
4
+ import { AugnitoSocketResponse } from './support/AugnitoSocketResponse';
5
+ import { AugnitoMobile } from './AugnitoMobile';
6
+ import { FactoryAPI } from './api/FactoryAPI';
7
+ import { IConfiguration } from './config/IConfiguration ';
8
+ import { AugnitoSDKErrorMessage } from './support/AugnitoSDKErrorMessage';
9
+ import { PhilipsMicConfig } from './config/PhilipsMicConfig';
10
+ import { PhilipsMicClient } from './client/PhilipsMicClient';
11
+ /**
12
+ * Augnito Manager
13
+ * @description Handles the connection with the Speech API Server. Only one instance of the class should be created
14
+ */
15
+ export declare class Augnito {
16
+ private _logTag;
17
+ /** Web Client */
18
+ private _webClient;
19
+ private _sdkMobileConfig;
20
+ /** Mobile Client */
21
+ private _augnitoMobile;
22
+ /** Web Worker */
23
+ private _worker;
24
+ private enableLogs;
25
+ private isConnected;
26
+ private switchToRegularSpeechProfile;
27
+ private shouldPreInitialiseMic;
28
+ private forceStopAudio;
29
+ private config;
30
+ private _factoryAPI;
31
+ private _editorHandler;
32
+ private recorderIns;
33
+ private _notificationClient;
34
+ /**
35
+ * @callback Callback partial results
36
+ * @description optional callback
37
+ */
38
+ onPartialResult?: (text: string) => void;
39
+ /**
40
+ * Callback to process Final Results
41
+ * @description A final result is called when text has been processed by the Speech Server
42
+ */
43
+ onFinalResult?: (finalText: Partial<ActionRecipe>) => boolean;
44
+ /**
45
+ * Callback to intercept Commands
46
+ */
47
+ onCommandResult?: (command: Partial<ActionRecipe>) => boolean;
48
+ /**
49
+ * Callback for status changed
50
+ * @description Mandatory field
51
+ */
52
+ onStateChanged?: (isConnected: boolean) => void;
53
+ /**
54
+ * Callback to intercept Session Events
55
+ */
56
+ onSessionEvent?: (data: AugnitoSocketResponse) => void;
57
+ /**
58
+ * Iddle Callback: When the Mic is iddle for 5 minutes
59
+ * @description Mandatory field
60
+ */
61
+ onIdleMic?: () => void;
62
+ /**
63
+ * Callback triggered when trying to start the connection, but it fails because it is already opened.
64
+ * It can happen if the client has more than one tab opened.
65
+ * This error will ALSO come through on the onError handler if you don't have a handler attached to this callback.
66
+ * @param isWebClient If true, the error was raised from the Web Client; otherwise from the mobile client
67
+ */
68
+ onMicrophoneOnError?: (isWebClient: boolean) => void;
69
+ /**
70
+ * Callback triggered when an error occurs within the Augnito SDK
71
+ * @param error An object containing the error type and error message
72
+ */
73
+ onError?: (error: AugnitoSDKErrorMessage) => void;
74
+ constructor(config: AugnitoConfig);
75
+ /**
76
+ * Toggles the Speech API connection
77
+ * @description if already connected, it will stop the web socket; otherwise, it will start a new connection
78
+ */
79
+ toggleListening(shouldPauseResume?: boolean): void;
80
+ /**
81
+ * Returns the status of the web socket.
82
+ * @returns true if connected; otherwise false
83
+ */
84
+ /**
85
+ * Returns the Generated Value for the QR Code (If and only if the DeviceId was provided)
86
+ */
87
+ getQRCode(): string | undefined;
88
+ navigateToNextField(): void;
89
+ navigateToPreviousField(): void;
90
+ getCursorPosition(): any;
91
+ setCursorAtPosition(position: number): void;
92
+ setCursorAtDocumentEnd(): void;
93
+ /**
94
+ * Dispose all resources.
95
+ */
96
+ dispose(): void;
97
+ /**
98
+ * Creates a web socket for getting notifications from client mobile application
99
+ * @description To be used with Augnito Mobile SDK
100
+ * @param config Mobile config
101
+ */
102
+ initMobileClient(config?: AugnitoMobileConfig): AugnitoMobile;
103
+ initPhilipMicClient(config: PhilipsMicConfig): PhilipsMicClient;
104
+ /**
105
+ * Sends a request to close all opened connections.
106
+ * To be used in case the Augnito client is instantiated in multiple tabs
107
+ */
108
+ requestMicOff(): void;
109
+ addCustomCommand(commandName: string, callbackParameter: any, callbackFunction: any): void;
110
+ setAnchoredEditor(editor: Element | undefined, editorName: string | null): void;
111
+ /** Returns an Abstract Factory to create different API Clients */
112
+ get apisFactory(): FactoryAPI;
113
+ /** Returns an IConfiguration that can be used to set for application properties */
114
+ get configuration(): IConfiguration | null;
115
+ private stopAudio;
116
+ private onPartialResultsCallback;
117
+ private onFinalResultsCallback;
118
+ private onCommandResultsCallback;
119
+ private interfaceCommand;
120
+ private onErrorCallback;
121
+ private onIdleMicCallback;
122
+ private onStateChangeCallback;
123
+ private onSocketFinalResult;
124
+ private onSessionEventCallback;
125
+ private onMicrophoneOnErrorCallback;
126
+ private createSDKConfig;
127
+ private createWorker;
128
+ private handleBeforeUnloadEvent;
129
+ private handleStorageChangeEvent;
130
+ }
@@ -0,0 +1,13 @@
1
+ import { MobileClient } from './client/MobileClient';
2
+ export declare class AugnitoMobile {
3
+ private _mobileClient;
4
+ /** Callback when a mobile client is requesting to connect */
5
+ onConnectionRequest?: () => void;
6
+ /** Callback when a mobile client has scanned the QR Code */
7
+ onMobileScan?: () => void;
8
+ constructor(_mobileClient: MobileClient);
9
+ dispose(): void;
10
+ stopMobileMicConnection(): void;
11
+ private onConnectionRequestCallback;
12
+ private onMobileScanCallback;
13
+ }
@@ -0,0 +1,32 @@
1
+ export interface BaseResult {
2
+ Status: number;
3
+ ErrorMessage: string;
4
+ Data: {
5
+ StatusMessage: string;
6
+ };
7
+ }
8
+ export interface GetCommonPersonalisationRequest {
9
+ SubscriptionCode: string;
10
+ AccessKey: string;
11
+ SmId: string;
12
+ }
13
+ export interface GetCommonAccountInfoRequest {
14
+ SubscriptionCode: string;
15
+ AccessKey: string;
16
+ }
17
+ export interface GetVocabularyRequest extends GetCommonPersonalisationRequest {
18
+ UserCode: string;
19
+ }
20
+ export interface GetFormattingRequest extends GetCommonPersonalisationRequest {
21
+ UserTag: string;
22
+ }
23
+ export interface GetMedicineOrderingRequest extends GetCommonAccountInfoRequest {
24
+ UserTag: string;
25
+ }
26
+ export interface Edge {
27
+ PK: string;
28
+ SK: string;
29
+ }
30
+ export declare abstract class BaseAPI {
31
+ protected makePostRequest<R>(request: R, url: string): Promise<BaseResult | string>;
32
+ }
@@ -0,0 +1,25 @@
1
+ import { MacrosAPI } from './Macros/MacrosAPI';
2
+ import { VocabularyAPI } from './Vocabulary/VocabularyAPI';
3
+ import { NotificationClient } from '../client/NotificationClient';
4
+ import { FormattingAPI } from './Formatting/FormattingAPI';
5
+ import { MedicineOrderingAPI } from './MedicineOrdering/MedicineOrderingAPI';
6
+ export declare class FactoryAPI {
7
+ private _accountCode;
8
+ private _accessKey;
9
+ private _server;
10
+ private _userTag;
11
+ private _lmid;
12
+ private _deviceId;
13
+ private _sourceApp;
14
+ private _enableLogs;
15
+ private _notificationClient;
16
+ constructor(_accountCode: string, _accessKey: string, _server: string, _userTag: string, _lmid: string, _deviceId: string | undefined, _sourceApp: string, _enableLogs: boolean, _notificationClient: NotificationClient);
17
+ /**
18
+ * Creates a client to interact with the MacrosAPI
19
+ * @returns The MacrosAPI client
20
+ */
21
+ getMacrosAPI(): MacrosAPI;
22
+ getMedicineOrderingAPI(): MedicineOrderingAPI;
23
+ getFormattingAPI(): FormattingAPI;
24
+ getVocabularyAPI(notifSubscribedInOtherWindow?: boolean): VocabularyAPI;
25
+ }
@@ -0,0 +1,15 @@
1
+ import { BaseAPI } from '../BaseAPI';
2
+ import { AugnitoFormattingConfig } from '../../config/AugnitoFormattingConfig';
3
+ import { FormattingResult, RemoveFormattingRequest, UpsertFormattingRequest, UserFormattingRequest } from './FormattingModels';
4
+ export declare class FormattingAPI extends BaseAPI {
5
+ private _config;
6
+ private _logTag;
7
+ private _baseUrl;
8
+ constructor(_config: AugnitoFormattingConfig);
9
+ private getURL;
10
+ getFormatting(request: UserFormattingRequest): Promise<FormattingResult | string>;
11
+ upsertFormatting(request: UpsertFormattingRequest): Promise<FormattingResult | string>;
12
+ removeFormatting(request: RemoveFormattingRequest): Promise<FormattingResult | string>;
13
+ private log;
14
+ private getGetCommonModel;
15
+ }