@onereach/step-voice 4.0.14 → 4.0.15

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/step.js CHANGED
@@ -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,14 +133,20 @@ class ConvStep extends step_1.default {
134
133
  }
135
134
  }
136
135
  async onCancel() {
137
- if (!this.thread.hasAction()) {
138
- this.log.debug('conv.onCancel end', { state: this.state, lcl: this.convDataCache?._conv.lcl });
139
- this.end();
136
+ if (this.getExitStepId('cancel')) {
137
+ this.log.debug('conv.cancel exit');
138
+ this.exitStep('cancel');
140
139
  }
141
140
  else {
142
- this.log.debug('conv.onCancel', { state: this.state });
143
- this.state.name = this.state.prevCancelName;
144
- delete this.state.prevCancelName;
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({ name: 'waitForEnd', direct: true });
145
+ }
146
+ else {
147
+ this.log.debug('conv.cancel end', this.conversation);
148
+ this.end();
149
+ }
145
150
  }
146
151
  }
147
152
  async pause() {
package/dst/voice.d.ts CHANGED
@@ -35,7 +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
38
  waitForEnd(): Promise<void>;
40
39
  sendCommands({ id, type, callback }: IVoiceChannel, commands: TODO[]): Promise<unknown>;
41
40
  extractSectionMessages(sections: IPromtpSection[]): string;
package/dst/voice.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/strict-boolean-expressions, @typescript-eslint/explicit-function-return-type */
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,22 +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
19
  async waitForEnd() {
36
20
  this.exitFlow();
37
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "4.0.14",
3
+ "version": "4.0.15",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",