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.6KB

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