@wazo/sdk 0.37.32 → 0.37.33

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 (42) hide show
  1. package/dist/wazo-sdk.js +1 -1
  2. package/esm/domain/CallSession.js +8 -0
  3. package/esm/domain/Phone/CTIPhone.js +8 -0
  4. package/esm/domain/Phone/WebRTCPhone.js +8 -0
  5. package/esm/domain/__tests__/CallSession.test.js +40 -4
  6. package/esm/domain/__tests__/IndirectTransfer.test.js +8 -0
  7. package/esm/domain/__tests__/Room.test.js +8 -0
  8. package/esm/index.js +8 -0
  9. package/esm/simple/Auth.js +8 -0
  10. package/esm/simple/Configuration.js +8 -0
  11. package/esm/simple/Phone.js +8 -0
  12. package/esm/simple/index.js +8 -0
  13. package/esm/simple/room/LocalParticipant.js +8 -0
  14. package/esm/simple/room/Participant.js +8 -0
  15. package/esm/simple/room/RemoteParticipant.js +8 -0
  16. package/esm/simple/room/Room.js +8 -0
  17. package/esm/simple/room/SipRoom.js +8 -0
  18. package/esm/simple/room/Stream.js +8 -0
  19. package/esm/simple/room/__tests__/RemoteParticipant.test.js +8 -0
  20. package/esm/simple/utils.js +8 -0
  21. package/lib/domain/CallSession.js +8 -0
  22. package/lib/domain/Phone/CTIPhone.js +8 -0
  23. package/lib/domain/Phone/WebRTCPhone.js +8 -0
  24. package/lib/domain/__tests__/CallSession.test.js +40 -4
  25. package/lib/domain/__tests__/IndirectTransfer.test.js +8 -0
  26. package/lib/domain/__tests__/Room.test.js +8 -0
  27. package/lib/index.js +8 -0
  28. package/lib/simple/Auth.js +8 -0
  29. package/lib/simple/Configuration.js +8 -0
  30. package/lib/simple/Phone.js +8 -0
  31. package/lib/simple/index.js +8 -0
  32. package/lib/simple/room/LocalParticipant.js +8 -0
  33. package/lib/simple/room/Participant.js +8 -0
  34. package/lib/simple/room/RemoteParticipant.js +8 -0
  35. package/lib/simple/room/Room.js +8 -0
  36. package/lib/simple/room/SipRoom.js +8 -0
  37. package/lib/simple/room/Stream.js +8 -0
  38. package/lib/simple/room/__tests__/RemoteParticipant.test.js +8 -0
  39. package/lib/simple/utils.js +8 -0
  40. package/package.json +1 -1
  41. package/src/domain/CallSession.js +8 -0
  42. package/src/domain/__tests__/CallSession.test.js +32 -4
@@ -3601,6 +3601,14 @@ class CallSession {
3601
3601
  return !!this.answerTime;
3602
3602
  }
3603
3603
 
3604
+ toJSON() {
3605
+ const jsonObj = { ...this };
3606
+ // $FlowFixMe
3607
+ jsonObj.answered = this.answered;
3608
+
3609
+ return jsonObj;
3610
+ }
3611
+
3604
3612
  static parseCall(call ) {
3605
3613
  return new CallSession({
3606
3614
  callId: call.id,
@@ -3601,6 +3601,14 @@ class CallSession {
3601
3601
  return !!this.answerTime;
3602
3602
  }
3603
3603
 
3604
+ toJSON() {
3605
+ const jsonObj = { ...this };
3606
+ // $FlowFixMe
3607
+ jsonObj.answered = this.answered;
3608
+
3609
+ return jsonObj;
3610
+ }
3611
+
3604
3612
  static parseCall(call ) {
3605
3613
  return new CallSession({
3606
3614
  callId: call.id,
@@ -3603,6 +3603,14 @@ class CallSession {
3603
3603
  return !!this.answerTime;
3604
3604
  }
3605
3605
 
3606
+ toJSON() {
3607
+ const jsonObj = { ...this };
3608
+ // $FlowFixMe
3609
+ jsonObj.answered = this.answered;
3610
+
3611
+ return jsonObj;
3612
+ }
3613
+
3606
3614
  static parseCall(call ) {
3607
3615
  return new CallSession({
3608
3616
  callId: call.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wazo/sdk",
3
- "version": "0.37.32",
3
+ "version": "0.37.33",
4
4
  "description": "Wazo's JavaScript Software Development Kit.",
5
5
  "main": "dist/wazo-sdk.js",
6
6
  "author": "Wazo (http://wazo.io)",
@@ -351,6 +351,14 @@ export default class CallSession {
351
351
  return !!this.answerTime;
352
352
  }
353
353
 
354
+ toJSON() {
355
+ const jsonObj = { ...this };
356
+ // $FlowFixMe
357
+ jsonObj.answered = this.answered;
358
+
359
+ return jsonObj;
360
+ }
361
+
354
362
  static parseCall(call: Call): CallSession {
355
363
  return new CallSession({
356
364
  callId: call.id,
@@ -1,5 +1,7 @@
1
1
  import CallSession from '../CallSession';
2
2
 
3
+ const stringify = cs => JSON.parse(JSON.stringify(cs));
4
+
3
5
  describe('CallSession domain', () => {
4
6
  it('should update from another CallSession without data loss', () => {
5
7
  const callSession = new CallSession({
@@ -38,7 +40,7 @@ describe('CallSession domain', () => {
38
40
  expect(cs2.is(cs1)).toBeTruthy();
39
41
  });
40
42
 
41
- it('should set answerTime when setting answered', () => {
43
+ it('should set answerTime when setting answered to true', () => {
42
44
  const cs1 = new CallSession({});
43
45
  cs1.answered = true;
44
46
 
@@ -47,11 +49,37 @@ describe('CallSession domain', () => {
47
49
 
48
50
  const cs3 = new CallSession({ answered: true });
49
51
 
50
- expect(cs1.answered).toBeTruthy();
52
+ expect(cs1.answered).toEqual(true);
51
53
  expect(cs1.answerTime).not.toBeNull();
52
- expect(cs2.answered).toBeTruthy();
54
+ expect(cs2.answered).toEqual(true);
53
55
  expect(cs2.answerTime).not.toBeNull();
54
- expect(cs3.answered).toBeTruthy();
56
+ expect(cs3.answered).toEqual(true);
55
57
  expect(cs3.answerTime).not.toBeNull();
58
+
59
+ const cs4 = stringify(cs1);
60
+ const cs5 = stringify(cs2);
61
+ const cs6 = stringify(cs3);
62
+
63
+ expect(cs4.answered).toEqual(true);
64
+ expect(cs5.answered).toEqual(true);
65
+ expect(cs6.answered).toEqual(true);
66
+ });
67
+
68
+ it('should reset answerTime when setting answered to false', () => {
69
+ const cs1 = new CallSession({});
70
+ cs1.answered = false;
71
+
72
+ const cs2 = new CallSession({ answered: false });
73
+
74
+ expect(cs1.answered).toEqual(false);
75
+ expect(cs1.answerTime).toBeNull();
76
+ expect(cs2.answered).toEqual(false);
77
+ expect(cs2.answerTime).toBeNull();
78
+
79
+ const cs4 = stringify(cs1);
80
+ const cs5 = stringify(cs2);
81
+
82
+ expect(cs4.answered).toEqual(false);
83
+ expect(cs5.answered).toEqual(false);
56
84
  });
57
85
  });