@onereach/step-voice 4.0.18 → 4.0.21

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
@@ -106,12 +106,12 @@ class Choice extends voice_1.default {
106
106
  case 'digits': {
107
107
  const params = event.params;
108
108
  const digit = params.digit ?? params.digits;
109
- const exitId = params.exitId ?? '';
109
+ const exitId = params.exitId;
110
110
  // On bargeIn, we should stop playback
111
111
  if (exitExists(exitId)) {
112
112
  await this.transcript(channel, {
113
113
  keyPress: digit,
114
- message: lodash_1.default.replace(this.getExitStepLabel(exitId), /^(\d+\. )?(~ )?/, ''),
114
+ message: lodash_1.default.replace(this.getExitStepLabel(exitId) ?? '', /^(\d+\. )?(~ )?/, ''),
115
115
  reportingSettingsKey,
116
116
  action: 'Call DTMF',
117
117
  actionFromBot: false
@@ -149,7 +149,7 @@ class Choice extends voice_1.default {
149
149
  }
150
150
  case 'recognition': {
151
151
  const params = event.params;
152
- const exitId = params.exitId ?? '';
152
+ const exitId = params.exitId;
153
153
  const phrases = params.phrases;
154
154
  if (lodash_1.default.isEmpty(phrases)) {
155
155
  return this.exitStep('unrecognized', {});
@@ -161,7 +161,7 @@ class Choice extends voice_1.default {
161
161
  // On bargeIn, we should stop playback
162
162
  if (exitExists(exitId)) {
163
163
  await this.transcript(channel, {
164
- message: lodash_1.default.replace(this.getExitStepLabel(exitId), /^(\d+\. )?(~ )?/, ''),
164
+ message: lodash_1.default.replace(this.getExitStepLabel(exitId) ?? '', /^(\d+\. )?(~ )?/, ''),
165
165
  voiceProcessResult,
166
166
  reportingSettingsKey,
167
167
  action: 'Call Recognition',
@@ -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,
@@ -97,7 +97,7 @@ class GlobalCommand extends voice_1.default {
97
97
  await this.transcript(channel, {
98
98
  previousTranscriptId: channel.lastTranscriptId,
99
99
  keyPress: params.digit,
100
- message: lodash_1.default.replace(this.getExitStepLabel(exitId), /^(\d+\. )?(~ )?/, ''),
100
+ message: lodash_1.default.replace(this.getExitStepLabel(exitId) ?? '', /^(\d+\. )?(~ )?/, ''),
101
101
  action: 'Call DTMF',
102
102
  reportingSettingsKey: 'transcript',
103
103
  actionFromBot: false
@@ -116,7 +116,7 @@ class GlobalCommand extends voice_1.default {
116
116
  .value();
117
117
  await this.transcript(channel, {
118
118
  previousTranscriptId: channel.lastTranscriptId,
119
- message: lodash_1.default.replace(this.getExitStepLabel(exitId), /^(\d+\. )?(~ )?/, ''),
119
+ message: lodash_1.default.replace(this.getExitStepLabel(exitId) ?? '', /^(\d+\. )?(~ )?/, ''),
120
120
  action: 'Call Recognition',
121
121
  voiceProcessResult,
122
122
  reportingSettingsKey: 'transcript',
@@ -1,7 +1,7 @@
1
1
  import VoiceStep, { CallStartEvent, TODO } from './voice';
2
2
  interface INPUT {
3
3
  channelId?: string;
4
- sessionTimeout?: number;
4
+ sessionTimeout?: number | string;
5
5
  asr: TODO;
6
6
  tts: TODO;
7
7
  from: string;
@@ -9,7 +9,7 @@ interface INPUT {
9
9
  sipHost?: string;
10
10
  sipUser?: string;
11
11
  sipPassword?: string;
12
- timeout?: number;
12
+ timeout?: number | string;
13
13
  headers?: Array<{
14
14
  name: string;
15
15
  value: string;
package/dst/step.d.ts CHANGED
@@ -19,7 +19,7 @@ export default class ConvStep<TData = unknown, TIn = unknown, TOut = unknown, TP
19
19
  runBefore(): Promise<void>;
20
20
  runAfter(): Promise<void>;
21
21
  hasActiveGlobal(): Promise<boolean>;
22
- setTriggerType(): Promise<void>;
22
+ setLocalTriggers(): Promise<void>;
23
23
  waitForConversation(): Promise<void>;
24
24
  onSkipEvent(): Promise<void>;
25
25
  cancel(): Promise<void>;
package/dst/step.js CHANGED
@@ -40,13 +40,13 @@ class ConvStep extends step_1.default {
40
40
  return (await this._fetchData())?._conv != null;
41
41
  }
42
42
  async runBefore() {
43
- this.log.debug('conv.runBefore', { state: this.state, conv: this.conversation });
44
43
  await super.runBefore();
45
44
  // ensure cache is reset between step runs, just in case
46
45
  this._clearCache();
47
46
  this.triggers.local('_conv');
48
47
  if (!await this.hasConversation())
49
48
  return;
49
+ this.log.debug('conv.runBefore', { state: this.state, conv: this.convDataCache?._conv });
50
50
  if (this.state.direct)
51
51
  return;
52
52
  if (this.event.action === 'cancel') {
@@ -70,9 +70,7 @@ class ConvStep extends step_1.default {
70
70
  if (this.isGlobal && this.event.action === 'global') {
71
71
  return; // it was redirected from (1)
72
72
  }
73
- if (!this.isGlobal && (this.convDataCache?._conv?.glb?.length ?? 0) > 0) {
74
- this.triggers.config({ params: { type: 'local' } });
75
- }
73
+ await this.setLocalTriggers();
76
74
  }
77
75
  async runAfter() {
78
76
  if (!await this.hasConversation())
@@ -91,9 +89,9 @@ class ConvStep extends step_1.default {
91
89
  const globalLength = (await this._getConversation())?.glb?.length ?? 0;
92
90
  return globalLength > 0;
93
91
  }
94
- async setTriggerType() {
95
- if (!this.isGlobal && !await this.hasActiveGlobal()) {
96
- this.triggers.config({ params: { type: 'local' } });
92
+ async setLocalTriggers() {
93
+ if (!this.isGlobal && await this.hasActiveGlobal()) {
94
+ this.triggers.config({ target: 'session' });
97
95
  }
98
96
  }
99
97
  async waitForConversation() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "4.0.18",
3
+ "version": "4.0.21",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",
@@ -18,15 +18,15 @@
18
18
  "uuid": "^8.3.2"
19
19
  },
20
20
  "devDependencies": {
21
- "@onereach/flow-sdk": "^3.1.3",
21
+ "@onereach/flow-sdk": "^3.1.24",
22
22
  "@swc/cli": "^0.1.57",
23
- "@swc/core": "^1.2.197",
23
+ "@swc/core": "^1.2.198",
24
24
  "@swc/jest": "^0.2.21",
25
25
  "@types/jest": "^28.1.1",
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.1151.0",
29
+ "aws-sdk": "^2.1153.0",
30
30
  "babel-runtime": "^6.26.0",
31
31
  "docdash": "^1.2.0",
32
32
  "husky": "^8.0.1",
@@ -73,4 +73,4 @@
73
73
  "node_modules"
74
74
  ]
75
75
  }
76
- }
76
+ }