You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reducer.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // @flow
  2. import { assign, ReducerRegistry } from '../base/redux';
  3. import {
  4. _SET_EMITTER_SUBSCRIPTIONS,
  5. ADD_PENDING_INVITE_REQUEST,
  6. REMOVE_PENDING_INVITE_REQUESTS,
  7. SET_CALLEE_INFO_VISIBLE,
  8. UPDATE_DIAL_IN_NUMBERS_FAILED,
  9. UPDATE_DIAL_IN_NUMBERS_SUCCESS
  10. } from './actionTypes';
  11. const DEFAULT_STATE = {
  12. /**
  13. * The indicator which determines whether (the) {@code CalleeInfo} is
  14. * visible.
  15. *
  16. * @type {boolean|undefined}
  17. */
  18. calleeInfoVisible: false,
  19. numbersEnabled: true,
  20. pendingInviteRequests: []
  21. };
  22. ReducerRegistry.register('features/invite', (state = DEFAULT_STATE, action) => {
  23. switch (action.type) {
  24. case _SET_EMITTER_SUBSCRIPTIONS:
  25. return (
  26. assign(state, 'emitterSubscriptions', action.emitterSubscriptions));
  27. case ADD_PENDING_INVITE_REQUEST:
  28. return {
  29. ...state,
  30. pendingInviteRequests: [
  31. ...state.pendingInviteRequests,
  32. action.request
  33. ]
  34. };
  35. case REMOVE_PENDING_INVITE_REQUESTS:
  36. return {
  37. ...state,
  38. pendingInviteRequests: []
  39. };
  40. case SET_CALLEE_INFO_VISIBLE:
  41. return {
  42. ...state,
  43. calleeInfoVisible: action.calleeInfoVisible,
  44. initialCalleeInfo: action.initialCalleeInfo
  45. };
  46. case UPDATE_DIAL_IN_NUMBERS_FAILED:
  47. return {
  48. ...state,
  49. error: action.error
  50. };
  51. case UPDATE_DIAL_IN_NUMBERS_SUCCESS: {
  52. const {
  53. defaultCountry,
  54. numbers,
  55. numbersEnabled
  56. } = action.dialInNumbers;
  57. return {
  58. ...state,
  59. conferenceID: action.conferenceID,
  60. defaultCountry,
  61. numbers,
  62. numbersEnabled
  63. };
  64. }
  65. }
  66. return state;
  67. });