Skip to content

Commit 8eac472

Browse files
authored
sync features and bugfixs from b33ddb14 (#1660)
1 parent 504e0c9 commit 8eac472

File tree

418 files changed

+9442
-2242
lines changed

Some content is hidden

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

418 files changed

+9442
-2242
lines changed

.sync

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
94b20ac373f4b4b2b76a4023a3f2e369eb193d91
1+
b33ddb1410019452acbe86c80a5efa52d1331701

packages/babel-settings/babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const plugins = [
1616
'@babel/plugin-proposal-object-rest-spread',
1717
'@babel/plugin-proposal-optional-chaining',
1818
'@babel/plugin-proposal-nullish-coalescing-operator',
19+
'const-enum',
1920
];
2021

2122
module.exports = function baseBabelConfig(api) {

packages/babel-settings/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"@babel/preset-react": "^7.10.4",
2626
"@babel/preset-typescript": "^7.10.4",
2727
"@babel/register": "^7.10.5",
28+
"babel-plugin-const-enum": "^1.0.1",
2829
"core-js": "^2.6.11",
2930
"typescript": "^4.0.2"
3031
},

packages/core/README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ yarn add @ringcentral-integration/core
1717
- [state API](#state-api)
1818
- [action API](#action-api)
1919
- [computed API](#computed-api)
20-
- [proxyState API](#proxystate-api)
2120
- [RcUIModule APIs](#rcuimodule-apis)
2221
- [Dependency Injection](#dependency-injection)
2322
- [Storage and GlobalStorage APIs](#storage-and-globalstorage-apis)
@@ -26,7 +25,7 @@ yarn add @ringcentral-integration/core
2625

2726
### RcModule APIs
2827

29-
`@ringcentral-integration/core` provides `RcModuleV2` base module, decorators `state`, `action`, `computed`, `storage` and `globalStorage`, `proxyState`.
28+
`@ringcentral-integration/core` provides `RcModuleV2` base module, decorators `state`, `action`, `computed`, `storage` and `globalStorage`.
3029

3130
The decorator `storage` depends on `Storage` Module, And The decorator `globalStorage` depends on `GlobalStorage` Module.
3231

@@ -122,10 +121,6 @@ class Auth extends RcModuleV2<Deps> {
122121
}
123122
```
124123

125-
#### proxyState API
126-
127-
`@proxyState` is used for asynchronous state changes of the browser client, and its parameter must be an asynchronous function and cannot be used with `@storage`/`@globalStorage`.
128-
129124
### RcUIModule APIs
130125

131126
`@ringcentral-integration/core` provides `RcUIModuleV2` base module and all decorators in `RcModuleV2`.
@@ -253,18 +248,30 @@ class Call extends RcModuleV2<Deps> {
253248
});
254249
}
255250

251+
// Pass a tracking event type
256252
@track(trackEvents.inbound)
257253
inboundCall() {
258254
//
259255
}
260256

257+
// Pass a function that returns an array `[customTrackEvent, trackProps]`
261258
@track((that: Call, phoneNumber: string) => [
262259
trackEvents.outbound,
263260
{ loginType: that.callType, phoneNumber },
264261
])
265262
async dialout(phoneNumber: string) {
266263
//
267264
}
265+
266+
// Pass a higher-order function and the sub-function has access to the `analytics` module
267+
@track(() => (analytics) => {
268+
analytics.setUserId();
269+
return [trackEvents.authentication];
270+
})
271+
@action
272+
setLoginSuccess(token: TokenInfo) {
273+
//
274+
}
268275
}
269276
```
270277

packages/core/lib/RcModule/RcModule.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Storage as StorageV2 } from 'ringcentral-integration/modules/StorageV2'
55
import { GlobalStorage as GlobalStorageV2 } from 'ringcentral-integration/modules/GlobalStorageV2';
66
import Storage from 'ringcentral-integration/modules/Storage';
77
import GlobalStorage from 'ringcentral-integration/modules/GlobalStorage';
8-
import { Analytics } from 'ringcentral-integration/modules/Analytics';
8+
import { Analytics } from 'ringcentral-integration/modules/AnalyticsV2';
99
import BaseModule, { state, action } from '../usm-redux';
1010
import { moduleStatuses } from '../../enums/moduleStatuses';
1111
import { Params } from '../usm/core/module';
@@ -42,7 +42,11 @@ function storage(
4242
return descriptor;
4343
}
4444

45-
type TrackEvent = string | ((...args: any) => [string, object?]);
45+
type TrackEvent =
46+
| string
47+
| ((
48+
...args: any
49+
) => [string, object?] | ((analytics: Analytics) => [string, object?]));
4650

4751
/**
4852
* decorate a method with `Analytics` Module
@@ -75,7 +79,11 @@ function track(trackEvent: TrackEvent) {
7579
if (typeof trackEvent === 'string') {
7680
analytics.track(trackEvent);
7781
} else {
78-
const [event, trackProps] = trackEvent(this, ...args) ?? [];
82+
let trackReturn = trackEvent(this, ...args);
83+
if (typeof trackReturn === 'function') {
84+
trackReturn = trackReturn(analytics);
85+
}
86+
const [event, trackProps] = trackReturn ?? [];
7987
if (event) {
8088
analytics.track(event, trackProps);
8189
}
@@ -123,6 +131,7 @@ class RcModuleV2<
123131
S extends Record<string, any> = {}
124132
> extends BaseModule<T> {
125133
__$$state$$__: any;
134+
protected initializeProxy?(): Promise<void> | void;
126135
/**
127136
* `onInit` life cycle for current initialization before all deps modules are all ready.
128137
*/

packages/core/lib/usm-redux/core/module.ts

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,8 @@ class Module<T extends Record<string, any> = {}> extends BaseModule<T> {
3030
this._actionTypes.forEach((name) => {
3131
this._reducersMaps[name] = (types) => (
3232
_state = this._initialValue[name],
33-
{ type, states, __proxyState__ },
34-
) => {
35-
if (type.indexOf(types[name]) > -1 && __proxyState__) {
36-
return __proxyState__[name];
37-
} else if (type.indexOf(types[name]) > -1 && states) {
38-
if (this._transport && this.__proxyState__?.[name]) {
39-
// sync up state with async proxy callback
40-
(async () => {
41-
await this.__proxyState__[name](this, states[name]);
42-
this._dispatch({
43-
type: this.parentModule.__proxyAction__,
44-
action: {
45-
type: [types[name]],
46-
__proxyState__: { [name]: states[name] },
47-
},
48-
});
49-
})();
50-
return _state;
51-
}
52-
return states[name];
53-
}
54-
return _state;
55-
};
33+
{ type, states },
34+
) => (type.indexOf(types[name]) > -1 && states ? states[name] : _state);
5635
});
5736
}
5837
super._makeInstance(params);

packages/core/lib/usm/core/module.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export interface Params<T = {}> {
1818
export interface Action {
1919
type: string[] | string;
2020
states?: Properties;
21-
__proxyState__?: Record<string, any>;
2221
[K: string]: any;
2322
}
2423

@@ -39,10 +38,6 @@ interface Module {
3938
* Used by browser client to transport data.
4039
*/
4140
_transport?: any;
42-
/**
43-
* browser client's proxy state.
44-
*/
45-
__proxyState__: Record<string, (...args: any) => any>;
4641
/**
4742
* Used by browser client to dispatch.
4843
*/

packages/engage-voice-widget/assets/icons/icon-pvc-connecting.svg

Lines changed: 1 addition & 1 deletion
Loading

packages/engage-voice-widget/assets/icons/icon-pvc-disabled.svg

Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 6 additions & 6 deletions
Loading

packages/engage-voice-widget/assets/icons/icon-pvc-on.svg

Lines changed: 1 addition & 1 deletion
Loading

packages/engage-voice-widget/components/ActivityCallLogPanel/ActivityCallLogPanel.ut.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@ export const UTActivityCallLogPanel: StepFunction<any, any> = async (
3333

3434
openField.simulate('click');
3535

36-
const addMenuIcon = getSelectList().find(
37-
'RcIconButton[data-sign="addEntityMenu"]',
38-
);
36+
const addMenuIcon = getSelectList()
37+
.find('RcIconButton[data-sign="addEntityMenu"]')
38+
.find('button');
3939

4040
addMenuIcon.simulate('click');
4141

4242
const menuItems = getSelectList().find('RcMenuItem');
4343

44-
const entityName = props.entityName.toLowerCase();
45-
menuItems.find(`[title="Create ${entityName}"]`).simulate('click');
44+
menuItems.find(`[title="New ${props.entityName}"]`).simulate('click');
4645
wrapper.unmount();
4746
};

packages/engage-voice-widget/components/ActivityCallLogPanel/IvrInfo/IvrInfo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const IvrInfo: FunctionComponent<IvrInfoProps> = ({
7070
const bodyRender = () => {
7171
if (body.length > 0) {
7272
if (onClick) {
73-
return <RcLink handleOnClick={onClick}>{body}</RcLink>;
73+
return <RcLink onClick={onClick}>{body}</RcLink>;
7474
}
7575
return <div className={styles.body}>{body}</div>;
7676
}

packages/engage-voice-widget/components/ActivityCallLogPanel/i18n/en-US.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
export default {
22
submit: 'Submit',
3+
create: 'Create',
4+
update: 'Update',
35
disposition: 'Disposition',
46
internalTransfer: 'Internal transfer',
57
phoneBookTransfer: 'Phone book transfer',

packages/engage-voice-widget/components/ActivityCallLogPanel/utils/getButtonText.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export function getButtonText(
1414
return <RcIcon symbol={checkSvg} />;
1515
case 'saving':
1616
return null;
17+
case 'create':
18+
return i18n.getString('create', currentLocale);
19+
case 'update':
20+
return i18n.getString('update', currentLocale);
1721
case 'submit':
1822
default:
1923
return i18n.getString('submit', currentLocale);

packages/engage-voice-widget/components/AlertRenderer/EvIntegratedSoftphoneAlert/EvIntegratedSoftphoneAlert.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ EvIntegratedSoftphoneAlert.handleMessage = ({ message }: { message: string }) =>
2626
tabManagerEvents.SIP_CONNECTING,
2727
tabManagerEvents.SIP_RECONNECTING_WHEN_CALL_CONNECTED,
2828
tabManagerEvents.ASK_AUDIO_PERMISSION,
29+
tabManagerEvents.NOTIFY_ACTIVE_TAB_CALL_ACTIVE,
2930
]);

packages/engage-voice-widget/components/AlertRenderer/EvIntegratedSoftphoneAlert/i18n/en-US.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export default {
1212
[tabManagerEvents.SIP_RECONNECTING_WHEN_CALL_CONNECTED]:
1313
'Try to reconnect Integrated Softphone...',
1414
[tabManagerEvents.ASK_AUDIO_PERMISSION]: 'Wait for accept audio permission.',
15+
[tabManagerEvents.NOTIFY_ACTIVE_TAB_CALL_ACTIVE]:
16+
'You have an incoming call. Switch to the browser tab with the blue flashing dot to answer the call',
1517

1618
// Attempt to dequeue call to agent failed! Outdial to destination [16503990023*106] failed after [2] seconds with disposition [INTERCEPT]
1719
};

packages/engage-voice-widget/components/BasicSessionPanel/BasicSessionPanel.spec.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from 'react';
44

55
import { BasicSessionPanel, BasicSessionPanelProps } from './BasicSessionPanel';
66

7-
let wrapper;
7+
let wrapper: ReturnType<typeof mount>;
88
const currentLocale = 'en-US';
99
const defaultSkillProfileList = [
1010
{
@@ -203,7 +203,12 @@ describe('<BasicSessionPanel />', async () => {
203203
);
204204

205205
expect(skillProfilePickList.prop('value')).toBe(selectedSkillProfileId);
206-
expect(skillProfilePickList.find('.RcLineSelect-select').text()).toBe(
206+
expect(
207+
skillProfilePickList
208+
.find('RcSelect')
209+
.find('[aria-haspopup="listbox"]')
210+
.text(),
211+
).toBe(
207212
defaultSkillProfileList.find(
208213
(x) => x.profileId === selectedSkillProfileId,
209214
).profileName,

packages/engage-voice-widget/components/BasicSessionPanel/BasicSessionPanel.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export const BasicSessionPanel: FunctionComponent<BasicSessionPanelProps> = ({
7070
{showInboundQueues && (
7171
<RcTextField
7272
label={i18n.getString('inboundQueues', currentLocale)}
73+
gutterBottom
7374
title={inboundQueuesFieldText}
7475
value={inboundQueuesFieldText}
7576
fullWidth
@@ -107,6 +108,7 @@ export const BasicSessionPanel: FunctionComponent<BasicSessionPanelProps> = ({
107108
/>
108109
{isExtensionNumber && (
109110
<RcTextField
111+
gutterBottom
110112
label={i18n.getString('extensionNumber', currentLocale)}
111113
fullWidth
112114
value={extensionNumber}
@@ -142,6 +144,7 @@ export const BasicSessionPanel: FunctionComponent<BasicSessionPanelProps> = ({
142144
{showAutoAnswer && (
143145
<RcSwitch
144146
data-sign="autoAnswer"
147+
className={styles.switchRoot}
145148
formControlLabelProps={{
146149
labelPlacement: 'start',
147150
classes: {

packages/engage-voice-widget/components/BasicSessionPanel/styles.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ p.warning {
2222
display: flex;
2323
margin-left: 0;
2424
margin-bottom: 16px;
25+
26+
.switchRoot.switchRoot {
27+
margin: 0;
28+
}
2529
}
2630

2731
.label {

0 commit comments

Comments
 (0)