@onereach/step-voice 4.0.14 → 4.0.17
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/dst/Initiate Call.js +2 -2
- package/dst/step.d.ts +1 -0
- package/dst/step.js +18 -10
- package/dst/voice.d.ts +0 -2
- package/dst/voice.js +1 -20
- package/package.json +2 -2
package/dst/Initiate Call.js
CHANGED
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const voice_1 = tslib_1.__importDefault(require("./voice"));
|
|
6
6
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
7
|
const timestring_1 = tslib_1.__importDefault(require("timestring"));
|
|
8
|
-
const
|
|
8
|
+
const uuid = tslib_1.__importStar(require("uuid"));
|
|
9
9
|
const defaultSessionTimeoutMin = 5;
|
|
10
10
|
class InitiateCall extends voice_1.default {
|
|
11
11
|
get conversation() {
|
|
@@ -17,7 +17,7 @@ class InitiateCall extends voice_1.default {
|
|
|
17
17
|
return undefined;
|
|
18
18
|
}
|
|
19
19
|
async runStep() {
|
|
20
|
-
const { channelId =
|
|
20
|
+
const { channelId = uuid.v4() } = this.data;
|
|
21
21
|
if (!this.session.key) {
|
|
22
22
|
const sessionTimeoutMs = (0, timestring_1.default)(`${this.data.sessionTimeout ?? defaultSessionTimeoutMin} min`, 'ms');
|
|
23
23
|
await this.session.start({
|
package/dst/step.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export default class ConvStep<TData = unknown, TIn = unknown, TOut = unknown, TP
|
|
|
24
24
|
onSkipEvent(): Promise<void>;
|
|
25
25
|
cancel(): Promise<void>;
|
|
26
26
|
onCancel(): Promise<void>;
|
|
27
|
+
waitCancelEnd(): Promise<void>;
|
|
27
28
|
pause(): Promise<void>;
|
|
28
29
|
resume(): Promise<void>;
|
|
29
30
|
sendEventToStep({ toGlobal, toStep, action, event }: {
|
package/dst/step.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/strict-boolean-expressions
|
|
2
|
+
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const step_1 = tslib_1.__importDefault(require("@onereach/flow-sdk/dst/step"));
|
|
@@ -12,7 +12,7 @@ class ConvStep extends step_1.default {
|
|
|
12
12
|
/** id of the thread where conversation data is stored */
|
|
13
13
|
get dataThreadId() {
|
|
14
14
|
const dataThreadId = this.state.thread ?? this.data.conversationThread;
|
|
15
|
-
return dataThreadId
|
|
15
|
+
return dataThreadId || this.thread.id;
|
|
16
16
|
}
|
|
17
17
|
get autoCancel() {
|
|
18
18
|
return undefined;
|
|
@@ -50,7 +50,6 @@ class ConvStep extends step_1.default {
|
|
|
50
50
|
if (this.state.direct)
|
|
51
51
|
return;
|
|
52
52
|
if (this.event.action === 'cancel') {
|
|
53
|
-
this.state.prevCancelName = this.state.name;
|
|
54
53
|
this.state.name = 'onCancel';
|
|
55
54
|
return;
|
|
56
55
|
}
|
|
@@ -134,16 +133,25 @@ class ConvStep extends step_1.default {
|
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
async onCancel() {
|
|
137
|
-
if (
|
|
138
|
-
this.log.debug('conv.
|
|
139
|
-
this.
|
|
136
|
+
if (this.getExitStepId('cancel')) {
|
|
137
|
+
this.log.debug('conv.cancel exit');
|
|
138
|
+
this.exitStep('cancel');
|
|
140
139
|
}
|
|
141
140
|
else {
|
|
142
|
-
this.
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
const conversationThread = this.state.thread ?? this.thread.id;
|
|
142
|
+
if (conversationThread === this.thread.id) {
|
|
143
|
+
this.log.debug('conv.cancel wait for end', this.conversation);
|
|
144
|
+
this.gotoState({ ...this.state, name: 'waitCancelEnd', direct: true });
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
this.log.debug('conv.cancel end', this.conversation);
|
|
148
|
+
this.end();
|
|
149
|
+
}
|
|
145
150
|
}
|
|
146
151
|
}
|
|
152
|
+
async waitCancelEnd() {
|
|
153
|
+
this.exitFlow();
|
|
154
|
+
}
|
|
147
155
|
async pause() {
|
|
148
156
|
const conv = await this._getConversation();
|
|
149
157
|
const activeStep = await this.activeStep(false);
|
|
@@ -236,7 +244,7 @@ class ConvStep extends step_1.default {
|
|
|
236
244
|
}
|
|
237
245
|
};
|
|
238
246
|
await this.updateData();
|
|
239
|
-
this.state.thread = this.dataThreadId
|
|
247
|
+
// this.state.thread = this.dataThreadId
|
|
240
248
|
}
|
|
241
249
|
async _fetchData() {
|
|
242
250
|
if (this.convDataCache != null)
|
package/dst/voice.d.ts
CHANGED
|
@@ -35,8 +35,6 @@ export default class VoiceStep<TIn = unknown, TOut = unknown, TParams = VoiceEve
|
|
|
35
35
|
handleCancel?: boolean;
|
|
36
36
|
}, TOut, TParams> {
|
|
37
37
|
get autoCancel(): boolean | undefined;
|
|
38
|
-
onCancel(): Promise<void>;
|
|
39
|
-
waitForEnd(): Promise<void>;
|
|
40
38
|
sendCommands({ id, type, callback }: IVoiceChannel, commands: TODO[]): Promise<unknown>;
|
|
41
39
|
extractSectionMessages(sections: IPromtpSection[]): string;
|
|
42
40
|
extractSectionFiles(sections: IPromtpSection[]): Array<{
|
package/dst/voice.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/strict-boolean-expressions
|
|
2
|
+
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.VoiceStepError = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
@@ -16,25 +16,6 @@ class VoiceStep extends step_1.default {
|
|
|
16
16
|
get autoCancel() {
|
|
17
17
|
return true;
|
|
18
18
|
}
|
|
19
|
-
async onCancel() {
|
|
20
|
-
if (this.data.handleCancel === true) {
|
|
21
|
-
this.exitStep('cancel');
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
const conversationThread = this.state.thread ?? this.thread.id;
|
|
25
|
-
if (conversationThread === this.thread.id) {
|
|
26
|
-
this.log.debug('cancel wait for end', this.conversation);
|
|
27
|
-
this.gotoState({ name: 'waitForEnd', direct: true });
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
this.log.debug('cancel end', this.conversation);
|
|
31
|
-
this.end();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
async waitForEnd() {
|
|
36
|
-
this.exitFlow();
|
|
37
|
-
}
|
|
38
19
|
async sendCommands({ id, type, callback }, commands) {
|
|
39
20
|
if (lodash_1.default.isEmpty(commands))
|
|
40
21
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/step-voice",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.17",
|
|
4
4
|
"author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Roman Zolotarov",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"uuid": "^8.3.2"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@onereach/flow-sdk": "^3.1.
|
|
21
|
+
"@onereach/flow-sdk": "^3.1.3",
|
|
22
22
|
"@swc/cli": "^0.1.57",
|
|
23
23
|
"@swc/core": "^1.2.197",
|
|
24
24
|
"@swc/jest": "^0.2.21",
|