@aiqa/sdk 1.0.0-develop.4 → 1.0.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/README.md +46 -0
- package/dist/browser/browser.d.ts +14 -2
- package/dist/browser/browser.js +24 -4
- package/dist/browser/browser.js.map +1 -1
- package/dist/node/node.d.ts +14 -2
- package/dist/node/node.js +24 -4
- package/dist/node/node.js.map +1 -1
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -89,6 +89,42 @@ If authentication hasn't completed yet, this throws. Use the `authenticated` eve
|
|
|
89
89
|
const application = await sdk.getApplication();
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
+
#### `setConversationProduct(product)`
|
|
93
|
+
|
|
94
|
+
Sets the conversation product using a valid product code.
|
|
95
|
+
|
|
96
|
+
**Parameters:**
|
|
97
|
+
|
|
98
|
+
- `product: string` - product code (from the `service.code` catalog)
|
|
99
|
+
|
|
100
|
+
**Returns:**
|
|
101
|
+
|
|
102
|
+
- `Promise<{ success: boolean; product: string }>`
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
const result = await sdk.setConversationProduct("life_insurance");
|
|
106
|
+
console.log(result.success, result.product);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### `setConversationLanguage(language)`
|
|
110
|
+
|
|
111
|
+
Sets the conversation language.
|
|
112
|
+
|
|
113
|
+
**Parameters:**
|
|
114
|
+
|
|
115
|
+
- `language: ConversationLanguage` - only valid enum values are accepted
|
|
116
|
+
|
|
117
|
+
**Returns:**
|
|
118
|
+
|
|
119
|
+
- `Promise<{ success: boolean; language: string }>`
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { ConversationLanguage } from "@aiqa/sdk";
|
|
123
|
+
|
|
124
|
+
const result = await sdk.setConversationLanguage(ConversationLanguage.EN);
|
|
125
|
+
console.log(result.success, result.language);
|
|
126
|
+
```
|
|
127
|
+
|
|
92
128
|
### Fact Management
|
|
93
129
|
|
|
94
130
|
#### `addFact(fact)`
|
|
@@ -242,6 +278,16 @@ type ApplicationFactInput = {
|
|
|
242
278
|
};
|
|
243
279
|
```
|
|
244
280
|
|
|
281
|
+
### ConversationLanguage
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
enum ConversationLanguage {
|
|
285
|
+
EN = "en",
|
|
286
|
+
ES = "es",
|
|
287
|
+
FR = "fr",
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
245
291
|
### FactUpdateEvent
|
|
246
292
|
|
|
247
293
|
```typescript
|
|
@@ -15,12 +15,22 @@ declare enum Methods {
|
|
|
15
15
|
STOP_RECORDING = "STOP_RECORDING",
|
|
16
16
|
IS_RECORDING = "IS_RECORDING",
|
|
17
17
|
ADD_FACT = "ADD_FACT",
|
|
18
|
-
SET_CONVERSATION_PRODUCT = "SET_CONVERSATION_PRODUCT"
|
|
18
|
+
SET_CONVERSATION_PRODUCT = "SET_CONVERSATION_PRODUCT",
|
|
19
|
+
SET_CONVERSATION_LANGUAGE = "SET_CONVERSATION_LANGUAGE"
|
|
19
20
|
}
|
|
20
21
|
type SetConversationProductResult = {
|
|
21
22
|
success: boolean;
|
|
22
23
|
product: string;
|
|
23
24
|
};
|
|
25
|
+
type SetConversationLanguageResult = {
|
|
26
|
+
success: boolean;
|
|
27
|
+
language: string;
|
|
28
|
+
};
|
|
29
|
+
declare enum ConversationLanguage {
|
|
30
|
+
EN = "en",
|
|
31
|
+
ES = "es",
|
|
32
|
+
FR = "fr"
|
|
33
|
+
}
|
|
24
34
|
type SdkEvent = Methods | "connect" | "disconnect" | "close" | "error" | "reconnect_attempt" | "reconnect_error" | "reconnect_failed" | "authenticated" | "app_version";
|
|
25
35
|
declare enum FactAnswerFormatType {
|
|
26
36
|
string = "STRING",
|
|
@@ -79,6 +89,7 @@ declare abstract class IAiqaSdk {
|
|
|
79
89
|
abstract addFact(fact: ApplicationFactInput): Promise<AddFactResult>;
|
|
80
90
|
abstract getFacts(): Promise<ApplicationFact[]>;
|
|
81
91
|
abstract setConversationProduct(product: string): Promise<SetConversationProductResult>;
|
|
92
|
+
abstract setConversationLanguage(language: ConversationLanguage): Promise<SetConversationLanguageResult>;
|
|
82
93
|
}
|
|
83
94
|
|
|
84
95
|
declare class AiQaSdk implements IAiqaSdk {
|
|
@@ -99,6 +110,7 @@ declare class AiQaSdk implements IAiqaSdk {
|
|
|
99
110
|
getFacts(): Promise<ApplicationFact[]>;
|
|
100
111
|
addFact(fact: ApplicationFactInput): Promise<AddFactResult>;
|
|
101
112
|
setConversationProduct(product: string): Promise<SetConversationProductResult>;
|
|
113
|
+
setConversationLanguage(language: ConversationLanguage): Promise<SetConversationLanguageResult>;
|
|
102
114
|
authenticate(): Promise<void>;
|
|
103
115
|
startRecording(): Promise<boolean>;
|
|
104
116
|
stopRecording(): Promise<boolean>;
|
|
@@ -108,4 +120,4 @@ declare class AiQaSdk implements IAiqaSdk {
|
|
|
108
120
|
private isManagerEvent;
|
|
109
121
|
}
|
|
110
122
|
|
|
111
|
-
export { type AddFactResult, AiQaSdk, type Application, type ApplicationFact, type ApplicationFactAnswerChoice, type ApplicationFactAnswerFormat, type ApplicationFactInput, FactAnswerFormatType, IAiqaSdk, Methods, type QuestionStatus, type SdkError, type SdkEvent, type SetConversationProductResult, type VerificationStatus };
|
|
123
|
+
export { type AddFactResult, AiQaSdk, type Application, type ApplicationFact, type ApplicationFactAnswerChoice, type ApplicationFactAnswerFormat, type ApplicationFactInput, ConversationLanguage, FactAnswerFormatType, IAiqaSdk, Methods, type QuestionStatus, type SdkError, type SdkEvent, type SetConversationLanguageResult, type SetConversationProductResult, type VerificationStatus };
|
package/dist/browser/browser.js
CHANGED
|
@@ -3346,8 +3346,15 @@ var Methods = /* @__PURE__ */ ((Methods2) => {
|
|
|
3346
3346
|
Methods2["IS_RECORDING"] = "IS_RECORDING";
|
|
3347
3347
|
Methods2["ADD_FACT"] = "ADD_FACT";
|
|
3348
3348
|
Methods2["SET_CONVERSATION_PRODUCT"] = "SET_CONVERSATION_PRODUCT";
|
|
3349
|
+
Methods2["SET_CONVERSATION_LANGUAGE"] = "SET_CONVERSATION_LANGUAGE";
|
|
3349
3350
|
return Methods2;
|
|
3350
3351
|
})(Methods || {});
|
|
3352
|
+
var ConversationLanguage = /* @__PURE__ */ ((ConversationLanguage3) => {
|
|
3353
|
+
ConversationLanguage3["EN"] = "en";
|
|
3354
|
+
ConversationLanguage3["ES"] = "es";
|
|
3355
|
+
ConversationLanguage3["FR"] = "fr";
|
|
3356
|
+
return ConversationLanguage3;
|
|
3357
|
+
})(ConversationLanguage || {});
|
|
3351
3358
|
var FactAnswerFormatType = /* @__PURE__ */ ((FactAnswerFormatType2) => {
|
|
3352
3359
|
FactAnswerFormatType2["string"] = "STRING";
|
|
3353
3360
|
FactAnswerFormatType2["number"] = "NUMBER";
|
|
@@ -3388,7 +3395,7 @@ var compareVersions = (left, right) => {
|
|
|
3388
3395
|
// package.json
|
|
3389
3396
|
var package_default = {
|
|
3390
3397
|
name: "@aiqa/sdk",
|
|
3391
|
-
version: "1.0.0-develop.
|
|
3398
|
+
version: "1.0.0-develop.5",
|
|
3392
3399
|
main: "dist/node/node.js",
|
|
3393
3400
|
module: "dist/node/node.js",
|
|
3394
3401
|
types: "dist/node/node.d.ts",
|
|
@@ -3400,12 +3407,18 @@ var package_default = {
|
|
|
3400
3407
|
commitlint: "commitlint",
|
|
3401
3408
|
"dev:node": "tsx src/node.ts",
|
|
3402
3409
|
lint: "tsc --noEmit -p tsconfig.json",
|
|
3403
|
-
format: 'prettier --check "{src,tests}/**/*.{ts,tsx,js,json,md,yml,yaml}" "*.{js,json,md,yml,yaml,ts}"',
|
|
3410
|
+
format: 'prettier --check "{src,tests}/**/*.{ts,tsx,js,json,md,yml,yaml}" "*.{js,json,md,yml,yaml,ts}" --ignore-path .prettierignore',
|
|
3404
3411
|
release: "semantic-release",
|
|
3405
3412
|
"start:node": "node dist/node/node.js",
|
|
3406
3413
|
"serve:browser": "serve .",
|
|
3407
3414
|
test: "jest",
|
|
3408
|
-
prepare: "husky"
|
|
3415
|
+
prepare: "husky",
|
|
3416
|
+
"lint-staged": "lint-staged"
|
|
3417
|
+
},
|
|
3418
|
+
"lint-staged": {
|
|
3419
|
+
"*.{ts,tsx,js,json,md,yml,yaml}": [
|
|
3420
|
+
"prettier --write"
|
|
3421
|
+
]
|
|
3409
3422
|
},
|
|
3410
3423
|
exports: {
|
|
3411
3424
|
".": {
|
|
@@ -3435,7 +3448,6 @@ var package_default = {
|
|
|
3435
3448
|
"@commitlint/cli": "^20.4.4",
|
|
3436
3449
|
"@commitlint/config-conventional": "^20.4.4",
|
|
3437
3450
|
"@jest/globals": "^29.7.0",
|
|
3438
|
-
"@semantic-release/changelog": "^6.0.3",
|
|
3439
3451
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
3440
3452
|
"@semantic-release/git": "^10.0.1",
|
|
3441
3453
|
"@semantic-release/npm": "^12.0.2",
|
|
@@ -3445,6 +3457,7 @@ var package_default = {
|
|
|
3445
3457
|
esbuild: "^0.23.0",
|
|
3446
3458
|
husky: "^9.1.7",
|
|
3447
3459
|
jest: "^29.7.0",
|
|
3460
|
+
"lint-staged": "^16.4.0",
|
|
3448
3461
|
prettier: "^3.8.1",
|
|
3449
3462
|
"semantic-release": "^24.2.9",
|
|
3450
3463
|
serve: "^14.2.3",
|
|
@@ -3623,6 +3636,12 @@ var AiQaSdk = class {
|
|
|
3623
3636
|
});
|
|
3624
3637
|
return result && result.data !== void 0 ? result.data : result;
|
|
3625
3638
|
}
|
|
3639
|
+
async setConversationLanguage(language) {
|
|
3640
|
+
const result = await this.sendMessage("SET_CONVERSATION_LANGUAGE" /* SET_CONVERSATION_LANGUAGE */, {
|
|
3641
|
+
language
|
|
3642
|
+
});
|
|
3643
|
+
return result && result.data !== void 0 ? result.data : result;
|
|
3644
|
+
}
|
|
3626
3645
|
async authenticate() {
|
|
3627
3646
|
try {
|
|
3628
3647
|
const result = await this.sendMessage("AUTHENTICATE" /* AUTHENTICATE */, {
|
|
@@ -3665,6 +3684,7 @@ var AiQaSdk = class {
|
|
|
3665
3684
|
var shared_default = AiQaSdk;
|
|
3666
3685
|
export {
|
|
3667
3686
|
shared_default as AiQaSdk,
|
|
3687
|
+
ConversationLanguage,
|
|
3668
3688
|
FactAnswerFormatType,
|
|
3669
3689
|
IAiqaSdk,
|
|
3670
3690
|
Methods
|