@webex/contact-center 3.12.0-task-refactor.4 → 3.12.0-task-refactor.6

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.
Files changed (35) hide show
  1. package/dist/services/task/TaskManager.js +1 -0
  2. package/dist/services/task/TaskManager.js.map +1 -1
  3. package/dist/services/task/TaskUtils.js +8 -6
  4. package/dist/services/task/TaskUtils.js.map +1 -1
  5. package/dist/services/task/state-machine/TaskStateMachine.js +77 -14
  6. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -1
  7. package/dist/services/task/state-machine/actions.js +85 -13
  8. package/dist/services/task/state-machine/actions.js.map +1 -1
  9. package/dist/services/task/state-machine/guards.js +35 -0
  10. package/dist/services/task/state-machine/guards.js.map +1 -1
  11. package/dist/services/task/state-machine/uiControlsComputer.js +76 -10
  12. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -1
  13. package/dist/services/task/voice/Voice.js +10 -4
  14. package/dist/services/task/voice/Voice.js.map +1 -1
  15. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +68 -8
  16. package/dist/types/services/task/state-machine/guards.d.ts +5 -0
  17. package/dist/types/services/task/voice/Voice.d.ts +18 -17
  18. package/dist/webex.js +1 -1
  19. package/package.json +1 -1
  20. package/src/services/task/TaskManager.ts +1 -1
  21. package/src/services/task/TaskUtils.ts +8 -6
  22. package/src/services/task/state-machine/TaskStateMachine.ts +101 -16
  23. package/src/services/task/state-machine/actions.ts +148 -24
  24. package/src/services/task/state-machine/guards.ts +46 -0
  25. package/src/services/task/state-machine/uiControlsComputer.ts +158 -15
  26. package/src/services/task/voice/Voice.ts +12 -5
  27. package/test/unit/spec/services/WebCallingService.ts +7 -1
  28. package/test/unit/spec/services/task/TaskManager.ts +26 -0
  29. package/test/unit/spec/services/task/TaskUtils.ts +16 -0
  30. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +573 -0
  31. package/test/unit/spec/services/task/state-machine/guards.ts +88 -0
  32. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +1023 -46
  33. package/test/unit/spec/services/task/voice/Voice.ts +44 -0
  34. package/umd/contact-center.min.js +2 -2
  35. package/umd/contact-center.min.js.map +1 -1
@@ -192,6 +192,94 @@ describe('State Machine Guards', () => {
192
192
  false
193
193
  );
194
194
  });
195
+
196
+ it('isInteractionConsulting returns true for pending self consult on hydrate', () => {
197
+ const ctx = createContext();
198
+ const taskData = createTaskData({
199
+ isConsulted: false,
200
+ interaction: {
201
+ ...createTaskData().interaction,
202
+ state: 'conference',
203
+ participants: {
204
+ 'agent-123': {
205
+ ...createParticipant('agent-123', 'Agent'),
206
+ consultState: 'consultInitiated',
207
+ isConsulted: false,
208
+ },
209
+ 'agent-456': {
210
+ ...createParticipant('agent-456', 'Agent'),
211
+ hasJoined: false,
212
+ consultState: 'consultReserved',
213
+ isConsulted: true,
214
+ },
215
+ },
216
+ media: {
217
+ [INTERACTION_ID]: {
218
+ mediaResourceId: INTERACTION_ID,
219
+ mediaType: 'telephony',
220
+ mediaMgr: 'media-mgr',
221
+ participants: ['agent-123'],
222
+ mType: 'mainCall',
223
+ isHold: true,
224
+ holdTimestamp: Date.now(),
225
+ },
226
+ 'consult-media': {
227
+ mediaResourceId: 'consult-media',
228
+ mediaType: 'telephony',
229
+ mediaMgr: 'media-mgr',
230
+ participants: ['agent-123', 'agent-456'],
231
+ mType: 'consult',
232
+ isHold: false,
233
+ holdTimestamp: null,
234
+ },
235
+ },
236
+ } as any,
237
+ });
238
+ expect(
239
+ guards.isInteractionConsulting(createParams(ctx, createEventWithTaskData(taskData)))
240
+ ).toBe(true);
241
+ });
242
+
243
+ it('isInteractionConsulting returns false for consulted agent pending consult state', () => {
244
+ const ctx = createContext();
245
+ const taskData = createTaskData({
246
+ isConsulted: true,
247
+ interaction: {
248
+ ...createTaskData().interaction,
249
+ state: 'conference',
250
+ participants: {
251
+ 'agent-123': {
252
+ ...createParticipant('agent-123', 'Agent'),
253
+ consultState: 'consultInitiated',
254
+ isConsulted: true,
255
+ },
256
+ },
257
+ media: {
258
+ [INTERACTION_ID]: {
259
+ mediaResourceId: INTERACTION_ID,
260
+ mediaType: 'telephony',
261
+ mediaMgr: 'media-mgr',
262
+ participants: ['agent-123'],
263
+ mType: 'mainCall',
264
+ isHold: true,
265
+ holdTimestamp: Date.now(),
266
+ },
267
+ 'consult-media': {
268
+ mediaResourceId: 'consult-media',
269
+ mediaType: 'telephony',
270
+ mediaMgr: 'media-mgr',
271
+ participants: ['agent-123'],
272
+ mType: 'consult',
273
+ isHold: false,
274
+ holdTimestamp: null,
275
+ },
276
+ },
277
+ } as any,
278
+ });
279
+ expect(
280
+ guards.isInteractionConsulting(createParams(ctx, createEventWithTaskData(taskData)))
281
+ ).toBe(false);
282
+ });
195
283
  });
196
284
 
197
285
  describe('Wrap-up Guards', () => {