@onereach/step-voice 4.0.32 → 4.0.35

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.
@@ -55,9 +55,6 @@ class GlobalCommand extends voice_1.default {
55
55
  }
56
56
  async globThread() {
57
57
  const channel = await this.fetchData();
58
- const findExit = (exitId) => {
59
- return lodash_1.default.find(this.step.exits, (exit) => exitId === exit.stepId);
60
- };
61
58
  this.triggers.once(`in/voice/${channel.id}/event`, async (event) => {
62
59
  event.processed = undefined;
63
60
  switch (event.params.type) {
@@ -72,8 +69,8 @@ class GlobalCommand extends voice_1.default {
72
69
  case 'digit':
73
70
  case 'digits': {
74
71
  const params = event.params;
75
- const exitId = params.exitId ?? '';
76
- if (findExit(exitId)) {
72
+ const exitId = params.exitId;
73
+ if (exitId && this.getExitStepId(exitId, false)) {
77
74
  await this.transcript(channel, {
78
75
  previousTranscriptId: channel.lastTranscriptId,
79
76
  keyPress: params.digit,
@@ -84,12 +81,15 @@ class GlobalCommand extends voice_1.default {
84
81
  });
85
82
  return await this.exitThread(event, 'digit', exitId);
86
83
  }
84
+ else {
85
+ this.log.debug('exitId missmatch', { exitId, exits: this.step.exits });
86
+ }
87
87
  return {};
88
88
  }
89
89
  case 'recognition': {
90
90
  const params = event.params;
91
- const exitId = params.exitId ?? '';
92
- if (findExit(exitId)) {
91
+ const exitId = params.exitId;
92
+ if (exitId && this.getExitStepId(exitId, false)) {
93
93
  const voiceProcessResult = lodash_1.default.chain(params.phrases)
94
94
  .map((p) => p.lexical)
95
95
  .join(' | ')
@@ -104,6 +104,9 @@ class GlobalCommand extends voice_1.default {
104
104
  });
105
105
  return await this.exitThread(event, 'voice', exitId);
106
106
  }
107
+ else {
108
+ this.log.debug('exitId missmatch', { exitId, exits: this.step.exits });
109
+ }
107
110
  return {};
108
111
  }
109
112
  case 'error':
@@ -138,7 +141,7 @@ class GlobalCommand extends voice_1.default {
138
141
  }
139
142
  }
140
143
  async exitThread(event, type, stepExit) {
141
- // this.log.warn('EXIT HOOK', type, stepExit);
144
+ this.log.debug('exitThread', type, stepExit);
142
145
  const params = event.params;
143
146
  const data = { type };
144
147
  if (!lodash_1.default.isEmpty(params.tags)) {
@@ -167,7 +170,7 @@ class GlobalCommand extends voice_1.default {
167
170
  // }])
168
171
  // channel.global = null;
169
172
  // await this.updateData()
170
- const exitLabel = this.getExitStepLabel(stepExit) ?? stepExit;
173
+ const exitLabel = lodash_1.default.replace(this.getExitStepLabel(stepExit) ?? stepExit, /\W+/g, '');
171
174
  await this.process.runThread({
172
175
  id: `${exitLabel}_${(0, nanoid_1.nanoid)(8)}`,
173
176
  state: {
package/package.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "4.0.32",
3
+ "version": "4.0.35",
4
+ "pkg_version": "4",
5
+ "dep_version": "^$[__package.pkg_version]",
4
6
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
7
  "contributors": [
6
8
  "Roman Zolotarov",
@@ -75,4 +77,4 @@
75
77
  "node_modules"
76
78
  ]
77
79
  }
78
- }
80
+ }