@onereach/step-voice 4.0.20 → 4.0.23

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/Choice.js CHANGED
@@ -171,8 +171,7 @@ class Choice extends voice_1.default {
171
171
  return this.exitStep(exitId, this.exitChoiceData('voice', params));
172
172
  }
173
173
  else if (this.rptsHasMore({ repromptsList }) &&
174
- usePromptsTriggers &&
175
- isRepromptTrigger(phrases, this.data.promptsTriggers)) {
174
+ (usePromptsTriggers ? isRepromptTrigger(phrases, this.data.promptsTriggers) : true)) {
176
175
  await this.transcript(channel, {
177
176
  message: 'Unrecognized',
178
177
  voiceProcessResult,
@@ -29,6 +29,7 @@ export default class GlobalCommand extends VoiceStep<Partial<INPUT>, OUTPUT, EVE
29
29
  get isGlobal(): boolean;
30
30
  get autoCancel(): boolean | undefined;
31
31
  runStep(): Promise<void>;
32
+ initThread(): Promise<void>;
32
33
  globThread(): Promise<void>;
33
34
  hangup(channel: IVoiceChannel): Promise<unknown>;
34
35
  exitThread(event: ITypedEvent<EVENT>, type: string, stepExit: string): Promise<void>;
@@ -13,6 +13,22 @@ class GlobalCommand extends voice_1.default {
13
13
  return undefined;
14
14
  }
15
15
  async runStep() {
16
+ this._clearCache();
17
+ await this.process.runThread({
18
+ id: `G:${this.dataThreadId}`,
19
+ local: {
20
+ background: true
21
+ },
22
+ state: {
23
+ name: 'initThread',
24
+ step: this.step.id,
25
+ thread: this.dataThreadId
26
+ }
27
+ });
28
+ await this.fetchData();
29
+ this.exitStep('no commands');
30
+ }
31
+ async initThread() {
16
32
  const channel = await this.fetchData();
17
33
  // if (recordCall || _.includes(['bot', 'both'], processHangUp)) {
18
34
  // // prevent delete of session by "End" step
@@ -45,18 +61,7 @@ class GlobalCommand extends voice_1.default {
45
61
  }
46
62
  ]);
47
63
  await this.updateData();
48
- await this.process.runThread({
49
- id: `G:${this.dataThreadId}`,
50
- local: {
51
- background: true
52
- },
53
- state: {
54
- name: 'globThread',
55
- step: this.step.id,
56
- thread: this.dataThreadId
57
- }
58
- });
59
- this.exitStep('no commands');
64
+ this.gotoState({ ...this.state, name: 'globThread' });
60
65
  }
61
66
  async globThread() {
62
67
  const channel = await this.fetchData();
package/dst/step.js CHANGED
@@ -3,6 +3,7 @@
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"));
6
+ const event_1 = tslib_1.__importDefault(require("@onereach/flow-sdk/dst/event"));
6
7
  class ConvStep extends step_1.default {
7
8
  get conversation() {
8
9
  if (this.data.conversation == null)
@@ -40,13 +41,13 @@ class ConvStep extends step_1.default {
40
41
  return (await this._fetchData())?._conv != null;
41
42
  }
42
43
  async runBefore() {
43
- this.log.debug('conv.runBefore', { state: this.state, conv: this.conversation });
44
44
  await super.runBefore();
45
45
  // ensure cache is reset between step runs, just in case
46
46
  this._clearCache();
47
47
  this.triggers.local('_conv');
48
48
  if (!await this.hasConversation())
49
49
  return;
50
+ this.log.debug('conv.runBefore', { state: this.state, conv: this.convDataCache?._conv });
50
51
  if (this.state.direct)
51
52
  return;
52
53
  if (this.event.action === 'cancel') {
@@ -80,7 +81,7 @@ class ConvStep extends step_1.default {
80
81
  await this.sendEventToStep({ toGlobal: this.isGlobal, action: 'activate' });
81
82
  }
82
83
  }
83
- if (this.isGlobal && this.event.processed !== true) {
84
+ if (this.isGlobal && !event_1.default.isProcessed(this.event)) {
84
85
  await this.sendEventToStep({ toGlobal: false, event: { ...this.event, processed: undefined, action: 'local' } });
85
86
  }
86
87
  await super.runAfter();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "4.0.20",
3
+ "version": "4.0.23",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",
@@ -18,22 +18,22 @@
18
18
  "uuid": "^8.3.2"
19
19
  },
20
20
  "devDependencies": {
21
- "@onereach/flow-sdk": "^3.1.15",
21
+ "@onereach/flow-sdk": "^3.1.36",
22
22
  "@swc/cli": "^0.1.57",
23
- "@swc/core": "^1.2.198",
23
+ "@swc/core": "^1.2.205",
24
24
  "@swc/jest": "^0.2.21",
25
- "@types/jest": "^28.1.1",
25
+ "@types/jest": "^28.1.3",
26
26
  "@types/lodash": "^4.14.182",
27
27
  "@types/timestring": "^6.0.2",
28
28
  "@types/uuid": "^8.3.4",
29
- "aws-sdk": "^2.1153.0",
29
+ "aws-sdk": "^2.1164.0",
30
30
  "babel-runtime": "^6.26.0",
31
31
  "docdash": "^1.2.0",
32
32
  "husky": "^8.0.1",
33
33
  "jest": "^28.1.1",
34
34
  "pinst": "^3.0.0",
35
35
  "ts-standard": "^11.0.0",
36
- "typescript": "^4.7.3"
36
+ "typescript": "^4.7.4"
37
37
  },
38
38
  "files": [
39
39
  "/dst"
@@ -60,6 +60,7 @@
60
60
  "steps"
61
61
  ],
62
62
  "license": "SEE LICENSE IN onereach.lic",
63
+ "private": false,
63
64
  "standard-engine": {
64
65
  "name": "ts-standard"
65
66
  },
@@ -73,4 +74,4 @@
73
74
  "node_modules"
74
75
  ]
75
76
  }
76
- }
77
+ }