Skip to content

Commit dca598a

Browse files
authored
Merge pull request #187 from u9520107/rcint-2915
Rcint 2915
2 parents 6dab75a + b847154 commit dca598a

File tree

51 files changed

+1332
-742
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1332
-742
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"react/forbid-prop-types": 0,
3434
"react/require-default-props": 1,
3535
"jsx-a11y/no-static-element-interactions": 0,
36-
"no-shadow": 0
36+
"no-shadow": 0,
37+
"class-methods-use-this": 0,
3738
}
3839
}

dev-server/Phone.js

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ import CallHistory from 'ringcentral-integration/modules/CallHistory';
4545
import ContactMatcher from 'ringcentral-integration/modules/ContactMatcher';
4646
import ActivityMatcher from 'ringcentral-integration/modules/ActivityMatcher';
4747
import CallLogger from 'ringcentral-integration/modules/CallLogger';
48+
import ConversationMatcher from 'ringcentral-integration/modules/ConversationMatcher';
49+
import ConversationLogger from 'ringcentral-integration/modules/ConversationLogger';
4850

4951
import RouterInteraction from '../src/modules/RouterInteraction';
5052

@@ -321,13 +323,7 @@ export default class Phone extends RcModule {
321323
messageStore: this.messageStore,
322324
getState: () => this.state.conversation,
323325
}));
324-
this.addModule('messages', new Messages({
325-
...options,
326-
alert: this.alert,
327-
messageStore: this.messageStore,
328-
perPage: 20,
329-
getState: () => this.state.messages,
330-
}));
326+
331327
this.addModule('conference', new Conference({
332328
...options,
333329
auth: this.auth,
@@ -386,8 +382,36 @@ export default class Phone extends RcModule {
386382
callMonitor: this.callMonitor,
387383
contactMatcher: this.contactMatcher,
388384
activityMatcher: this.activityMatcher,
385+
logFunction: async () => {},
386+
readyCheckFunction: () => true,
389387
getState: () => this.state.callLogger,
390388
}));
389+
this.addModule('conversationMatcher', new ConversationMatcher({
390+
storage: this.storage,
391+
getState: () => this.state.conversationMatcher,
392+
}));
393+
this.addModule('conversationLogger', new ConversationLogger({
394+
...options,
395+
storage: this.storage,
396+
dateTimeFormat: this.dateTimeFormat,
397+
messageStore: this.messageStore,
398+
extensionInfo: this.extensionInfo,
399+
contactMatcher: this.contactMatcher,
400+
conversationMatcher: this.conversationMatcher,
401+
tabManager: this.tabManager,
402+
logFunction: async () => {},
403+
readyCheckFunction: () => true,
404+
getState: () => this.state.conversationLogger,
405+
}));
406+
this.addModule('messages', new Messages({
407+
...options,
408+
alert: this.alert,
409+
messageStore: this.messageStore,
410+
extensionInfo: this.extensionInfo,
411+
contactMatcher: this.contactMatcher,
412+
conversationLogger: this.conversationLogger,
413+
getState: () => this.state.messages,
414+
}));
391415
this._reducer = combineReducers({
392416
accountExtension: this.accountExtension.reducer,
393417
accountInfo: this.accountInfo.reducer,
@@ -424,6 +448,8 @@ export default class Phone extends RcModule {
424448
composeText: this.composeText.reducer,
425449
messageStore: this.messageStore.reducer,
426450
conversation: this.conversation.reducer,
451+
conversationMatcher: this.conversationMatcher.reducer,
452+
conversationLogger: this.conversationLogger.reducer,
427453
messages: this.messages.reducer,
428454
conference: this.conference.reducer,
429455
activeCalls: this.activeCalls.reducer,

dev-server/containers/App/index.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ export default function App({
166166
router={phone.router}
167167
onLogCall={async () => { await sleep(1000); }}
168168
onViewContact={() => {}}
169+
onCreateContact={() => {}}
169170
/>
170171
)} />
171172
<Route
@@ -209,6 +210,11 @@ export default function App({
209210
messageStore={phone.messageStore}
210211
dateTimeFormat={phone.dateTimeFormat}
211212
contactMatcher={phone.contactMatcher}
213+
messages={phone.messages}
214+
conversationLogger={phone.conversationLogger}
215+
rateLimiter={phone.rateLimiter}
216+
connectivityMonitor={phone.connectivityMonitor}
217+
onLogConversation={async () => {sleep(1000);}}
212218
/>
213219
)} />
214220
<Route
@@ -217,13 +223,18 @@ export default function App({
217223
component={() => (
218224
<MessagesPage
219225
locale={phone.locale}
220-
auth={phone.auth}
226+
router={phone.router}
221227
messages={phone.messages}
222-
messageStore={phone.messageStore}
223-
extensionInfo={phone.extensionInfo}
224228
regionSettings={phone.regionSettings}
225-
contactMatcher={phone.contactMatcher}
226229
dateTimeFormat={phone.dateTimeFormat}
230+
connectivityMonitor={phone.connectivityMonitor}
231+
rateLimiter={phone.rateLimiter}
232+
call={phone.call}
233+
conversationLogger={phone.conversationLogger}
234+
rolesAndPermissions={phone.rolesAndPermissions}
235+
onLogConversation={async () => { await sleep(1000); }}
236+
onViewContact={() => {}}
237+
onCreateContact={() => {}}
227238
/>
228239
)} />
229240
</Route>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"redux-thunk": "^2.1.0",
7979
"ringcentral": "3.0.0",
8080
"ringcentral-client": "^1.0.0-rc1",
81-
"ringcentral-integration": "^0.5.27",
81+
"ringcentral-integration": "^0.6.0",
8282
"sass-loader": "^4.1.1",
8383
"source-map-loader": "^0.1.5",
8484
"style-loader": "^0.13.1",

src/components/ActionMenu/index.js

Lines changed: 59 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Spinner from '../Spinner';
44
import SlideMenu from '../SlideMenu';
55
import EntityModal from '../EntityModal';
66
import Button from '../Button';
7+
import LogButton from '../LogButton';
78
import styles from './styles.scss';
89
import dynamicsFont from '../../assets/DynamicsFont/DynamicsFont.scss';
910

@@ -70,52 +71,6 @@ ClickToSmsButton.defaultProps = {
7071
phoneNumber: undefined,
7172
};
7273

73-
function LogButton({
74-
className,
75-
currentLocale,
76-
onLogCall,
77-
isLogged,
78-
disableLinks,
79-
isLogging,
80-
}) {
81-
const spinner = isLogging ?
82-
(
83-
<div className={styles.spinnerContainer}>
84-
<Spinner ringWidth={2} />
85-
</div>
86-
) :
87-
null;
88-
return (
89-
<Button
90-
className={classnames(styles.log, className)}
91-
onClick={onLogCall}
92-
disabled={disableLinks || isLogging}
93-
>
94-
<span
95-
className={isLogged ?
96-
dynamicsFont.edit :
97-
dynamicsFont.callLog
98-
} />
99-
{spinner}
100-
</Button>
101-
);
102-
}
103-
LogButton.propTypes = {
104-
className: PropTypes.string,
105-
onLogCall: PropTypes.func,
106-
isLogged: PropTypes.bool,
107-
disableLinks: PropTypes.bool,
108-
isLogging: PropTypes.bool,
109-
currentLocale: PropTypes.string.isRequired,
110-
};
111-
LogButton.defaultProps = {
112-
className: undefined,
113-
onLogCall: undefined,
114-
isLogged: false,
115-
disableLinks: false,
116-
isLogging: false,
117-
};
118-
11974
function EntityButton({
12075
className,
12176
currentLocale,
@@ -173,31 +128,35 @@ export default class ActionMenu extends Component {
173128
this.state = {
174129
entityModalVisible: false,
175130
};
176-
177-
this.openEntityModal = () => {
178-
this.setState({
179-
entityModalVisible: true
180-
});
181-
};
182-
this.closeEntityModal = () => {
183-
this.setState({
184-
entityModalVisible: false
185-
});
186-
};
187-
this.onCreateEnityModal = (entityType) => {
188-
this.props.onCreateEntity(entityType);
189-
this.closeEntityModal();
190-
};
191-
this.onCancelEntityModal = () => {
192-
this.closeEntityModal();
193-
};
131+
}
132+
onCreateEnityModal = (entityType) => {
133+
this.props.onCreateEntity(entityType);
134+
this.closeEntityModal();
135+
}
136+
onCancelEntityModal = () => {
137+
this.closeEntityModal();
138+
}
139+
openEntityModal = () => {
140+
this.setState({
141+
entityModalVisible: true
142+
});
143+
}
144+
closeEntityModal = () => {
145+
this.setState({
146+
entityModalVisible: false
147+
});
148+
}
149+
captureClick = (e) => {
150+
if (this.props.stopPropagation) {
151+
e.stopPropagation();
152+
}
194153
}
195154

196155
render() {
197156
const {
198157
className,
199158
currentLocale,
200-
onLogCall,
159+
onLog,
201160
isLogged,
202161
isLogging,
203162
isCreating,
@@ -209,20 +168,21 @@ export default class ActionMenu extends Component {
209168
phoneNumber,
210169
disableLinks,
211170
disableClickToDial,
171+
stopPropagation,
212172
} = this.props;
213173

214-
const logButton = onLogCall ?
215-
(
216-
<LogButton
217-
className={styles.baseGroup}
218-
onLogCall={onLogCall}
219-
disableLinks={disableLinks}
220-
isLogged={isLogged}
221-
isLogging={isLogging}
222-
currentLocale={currentLocale}
223-
/>
224-
) :
225-
null;
174+
const logButton = onLog ?
175+
(
176+
<LogButton
177+
className={styles.baseGroup}
178+
onLog={onLog}
179+
disableLinks={disableLinks}
180+
isLogged={isLogged}
181+
isLogging={isLogging}
182+
currentLocale={currentLocale}
183+
/>
184+
) :
185+
null;
226186

227187
let entityButton;
228188
if (hasEntity && onViewEntity) {
@@ -232,15 +192,15 @@ export default class ActionMenu extends Component {
232192
hasEntity={hasEntity}
233193
disableLinks={disableLinks}
234194
currentLocale={currentLocale}
235-
/>);
195+
/>);
236196
} else if (!hasEntity && phoneNumber && onCreateEntity) {
237197
entityButton = (<EntityButton
238198
className={styles.baseGroup}
239199
onCreateEntity={this.openEntityModal}
240200
hasEntity={hasEntity}
241201
disableLinks={disableLinks}
242202
currentLocale={currentLocale}
243-
/>);
203+
/>);
244204
} else {
245205
entityButton = null;
246206
}
@@ -251,7 +211,7 @@ export default class ActionMenu extends Component {
251211
show={this.state.entityModalVisible}
252212
onCreate={this.onCreateEnityModal}
253213
onCancel={this.onCancelEntityModal}
254-
/>
214+
/>
255215
) : null;
256216

257217
const hasBaseGroup = !!(logButton || entityButton);
@@ -283,17 +243,19 @@ export default class ActionMenu extends Component {
283243
if (hasSecondGroup) {
284244
// slide menu
285245
return (
286-
<SlideMenu
287-
className={classnames(styles.root, className)}
288-
minWidth={40}
289-
maxWidth={75} >
290-
{clickToDialButton}
291-
{clickToSmsButton}
292-
{entityButton}
293-
{logButton}
294-
{entityModal}
295-
</SlideMenu>
296-
246+
<div
247+
onClick={this.captureClick}>
248+
<SlideMenu
249+
className={classnames(styles.root, className)}
250+
minWidth={40}
251+
maxWidth={75} >
252+
{clickToDialButton}
253+
{clickToSmsButton}
254+
{entityButton}
255+
{logButton}
256+
{entityModal}
257+
</SlideMenu>
258+
</div>
297259
);
298260
} else if (
299261
!clickToDialButton &&
@@ -305,7 +267,8 @@ export default class ActionMenu extends Component {
305267
}
306268
// no slide menu
307269
return (
308-
<div>
270+
<div
271+
onClick={this.captureClick} >
309272
<div className={classnames(styles.root, className)}>
310273
{clickToDialButton}
311274
{clickToSmsButton}
@@ -321,7 +284,7 @@ export default class ActionMenu extends Component {
321284
ActionMenu.propTypes = {
322285
className: PropTypes.string,
323286
currentLocale: PropTypes.string.isRequired,
324-
onLogCall: PropTypes.func,
287+
onLog: PropTypes.func,
325288
isLogged: PropTypes.bool,
326289
isLogging: PropTypes.bool,
327290
isCreating: PropTypes.bool,
@@ -333,10 +296,11 @@ ActionMenu.propTypes = {
333296
phoneNumber: PropTypes.string,
334297
disableLinks: PropTypes.bool,
335298
disableClickToDial: PropTypes.bool,
299+
stopPropagation: PropTypes.bool,
336300
};
337301
ActionMenu.defaultProps = {
338302
className: undefined,
339-
onLogCall: undefined,
303+
onLog: undefined,
340304
isLogged: false,
341305
isLogging: false,
342306
isCreating: false,
@@ -348,4 +312,5 @@ ActionMenu.defaultProps = {
348312
phoneNumber: undefined,
349313
disableLinks: false,
350314
disableClickToDial: false,
315+
stopPropagation: false,
351316
};

src/components/ActionMenu/styles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
height: 100%;
55
top: 0;
66
right: 0;
7+
cursor: default;
78
}
89

910
.baseGroup {

0 commit comments

Comments
 (0)