@@ -2,106 +2,30 @@ import React, { PropTypes } from 'react';
2
2
import { connect } from 'react-redux' ;
3
3
4
4
import Alert from 'ringcentral-integration/modules/Alert' ;
5
- import Brand from 'ringcentral-integration/modules/Brand' ;
6
5
import Locale from 'ringcentral-integration/modules/Locale' ;
7
- import RateLimiter from 'ringcentral-integration/modules/RateLimiter' ;
8
6
9
7
import AlertDisplay from '../../components/AlertDisplay' ;
10
8
11
- import AuthAlert from '../../components/AuthAlert' ;
12
- import CallAlert from '../../components/CallAlert' ;
13
- import CallingSettingsAlert from '../../components/CallingSettingsAlert' ;
14
- import RegionSettingsAlert from '../../components/RegionSettingsAlert' ;
15
- import MessageSenderAlert from '../../components/MessageSenderAlert' ;
16
- import RateExceededAlert from '../../components/RateExceededAlert' ;
17
- import ConnectivityAlert from '../../components/ConnectivityAlert' ;
18
- import WebphoneAlert from '../../components/WebphoneAlert' ;
19
- import RolesAndPermissionsAlert from '../../components/RolesAndPermissionsAlert' ;
20
-
21
9
const AlertContainer = connect ( ( state , {
22
10
locale,
23
11
alert,
24
12
} ) => ( {
25
13
currentLocale : locale . currentLocale ,
26
14
messages : alert . messages ,
27
15
} ) , ( dispatch , {
28
- rateLimiter,
29
- brand,
16
+ getRenderer,
30
17
alert,
31
18
} ) => ( {
32
- getRenderer : ( message ) => {
33
- if ( AuthAlert . handleMessage ( message ) ) {
34
- return AuthAlert ;
35
- }
36
- if ( CallAlert . handleMessage ( message ) ) {
37
- return props => (
38
- < CallAlert
39
- { ...props }
40
- regionSettingsUrl = "/settings/region" />
41
- ) ;
42
- }
43
- if ( CallingSettingsAlert . handleMessage ( message ) ) {
44
- return props => (
45
- < CallingSettingsAlert
46
- { ...props }
47
- brand = { brand . fullName }
48
- callingSettingsUrl = "/settings/calling" />
49
- ) ;
50
- }
51
-
52
- if ( RegionSettingsAlert . handleMessage ( message ) ) {
53
- return props => (
54
- < RegionSettingsAlert
55
- { ...props }
56
- regionSettingsUrl = "/settings/region" />
57
- ) ;
58
- }
59
-
60
- if ( MessageSenderAlert . handleMessage ( message ) ) {
61
- return props => (
62
- < MessageSenderAlert
63
- { ...props }
64
- regionSettingsUrl = "/settings/region" />
65
- ) ;
66
- }
67
-
68
- if ( RateExceededAlert . handleMessage ( message ) ) {
69
- return props => (
70
- < RateExceededAlert
71
- { ...props }
72
- timestamp = { rateLimiter . timestamp }
73
- duration = { rateLimiter . _throttleDuration } />
74
- ) ;
75
- }
76
-
77
- if ( ConnectivityAlert . handleMessage ( message ) ) {
78
- return ConnectivityAlert ;
79
- }
80
-
81
- if ( WebphoneAlert . handleMessage ( message ) ) {
82
- return WebphoneAlert ;
83
- }
84
- if ( RolesAndPermissionsAlert . handleMessage ( message ) ) {
85
- return props => (
86
- < RolesAndPermissionsAlert
87
- { ...props }
88
- brand = { brand . fullName }
89
- application = { brand . application } />
90
- ) ;
91
- }
92
-
93
- return undefined ;
94
- } ,
19
+ getRenderer,
95
20
dismiss : ( id ) => {
96
21
alert . dismiss ( id ) ;
97
22
} ,
98
23
} ) ) ( AlertDisplay ) ;
99
24
100
25
AlertContainer . propTypes = {
101
26
alert : PropTypes . instanceOf ( Alert ) . isRequired ,
102
- brand : PropTypes . instanceOf ( Brand ) . isRequired ,
27
+ getRenderer : PropTypes . func . isRequired ,
103
28
locale : PropTypes . instanceOf ( Locale ) . isRequired ,
104
- rateLimiter : PropTypes . instanceOf ( RateLimiter ) . isRequired ,
105
29
} ;
106
30
107
31
export default AlertContainer ;
0 commit comments