Skip to content

Commit

Permalink
sync features and bugfixs from 7698f10 (#1606)
Browse files Browse the repository at this point in the history
* sync features and bugfixs from 7698f10

* remove unused file
  • Loading branch information
embbnux authored Nov 20, 2019
1 parent 658ef77 commit 97c585a
Show file tree
Hide file tree
Showing 1,233 changed files with 27,587 additions and 18,983 deletions.
2 changes: 1 addition & 1 deletion .sync
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ac165a0f343a29ede4aad1fb555aff401f3dfea7
7698f1018c89580fc352022f2b6da694f5533b77
38 changes: 20 additions & 18 deletions packages/babel-settings/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
const plugins = [
[
'@babel/plugin-proposal-decorators',
{
legacy: true,
},
],
'@babel/plugin-proposal-function-bind',
[
'@babel/plugin-proposal-class-properties',
{
loose: true,
},
],
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-proposal-object-rest-spread',
];

module.exports = function baseBabelConfig(api) {
api.cache(true);
return {
Expand All @@ -18,23 +37,6 @@ module.exports = function baseBabelConfig(api) {
},
],
],
plugins: [
[
'@babel/plugin-proposal-decorators',
{
legacy: true,
},
],
'@babel/plugin-proposal-function-bind',
[
'@babel/plugin-proposal-class-properties',
{
loose: true,
},
],
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-proposal-object-rest-spread',
],
plugins,
};
};
2 changes: 2 additions & 0 deletions packages/eslint-settings/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ module.exports = {
{ declaration: false, assignment: false },
],
'react/jsx-one-expression-per-line': 0,
camelcase: 0,
},
overrides: [
{
Expand Down Expand Up @@ -177,6 +178,7 @@ module.exports = {
'object-shorthand': [2, 'always'],
'no-unused-vars': 0,
'@typescript-eslint/no-unused-vars': 1,
'import/export': 0,
},
},
],
Expand Down
6 changes: 3 additions & 3 deletions packages/glip-widgets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
},
"homepage": "https://github.com/ringcentral/ringcentral-js-widgets#readme",
"peerDependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-redux": "^5.1.1",
"react-router": "^3.0.0",
"react-router-redux": "^4.0.7",
Expand All @@ -34,7 +34,7 @@
"@ringcentral-integration/locale-settings": "*",
"autoprefixer": "^9.6.1",
"execa": "^1.0.0",
"fs-extra": "^7.0.1",
"fs-extra": "^8.1.0",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-istanbul": "^1.1.1",
Expand Down
30 changes: 15 additions & 15 deletions packages/i18n/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
export declare const DEFAULT_LOCALE = "en-US";
export declare const PSEUDO_LOCALE = "en-ZZ";
export declare const DEFAULT_LOCALE = 'en-US';
export declare const PSEUDO_LOCALE = 'en-ZZ';
export declare const RUNTIME: {
locale: string;
defaultLocale: string;
instances: Set<any>;
padRatio: number;
locale: string;
defaultLocale: string;
instances: Set<any>;
padRatio: number;
};
declare function setLocale(locale: any): Promise<void>;
export default class I18n {
_loadLocale: any;
_cache: any;
constructor(loadLocale: any);
_load(locale: any): Promise<void>;
load(): Promise<void>;
_getString(key: any, locale: any): any;
getString(key: any, locale?: string): any;
readonly currentLocale: string;
readonly setLocale: typeof setLocale;
_loadLocale: any;
_cache: any;
constructor(loadLocale: any);
_load(locale: any): Promise<void>;
load(): Promise<void>;
_getString(key: any, locale: any): any;
getString(key: any, locale?: string): any;
readonly currentLocale: string;
static readonly setLocale: typeof setLocale;
}
export {};
12 changes: 10 additions & 2 deletions packages/i18n/lib/toPseudoString/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,20 @@ export declare const charMap: {
};
export declare function toAccentString(str: string): string;
export declare function processVars(str: string): string;
export declare function padString({ str, padRatio, padChar }?: {
export declare function padString({
str,
padRatio,
padChar,
}?: {
str?: string;
padRatio?: number;
padChar?: string;
}): string;
export default function toPseudoString({ str, padRatio, padChar }: {
export default function toPseudoString({
str,
padRatio,
padChar,
}: {
str: any;
padRatio: any;
padChar: any;
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@ringcentral-integration/babel-settings": "*",
"babel-jest": "^24.8.0",
"faker": "^4.1.0",
"fs-extra": "^7.0.1",
"fs-extra": "^8.1.0",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-sourcemaps": "^2.6.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/locale-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@babel/parser": "^7.6.0",
"chalk": "^2.4.1",
"dedent": "^0.7.0",
"fs-extra": "^7.0.1",
"fs-extra": "^8.1.0",
"glob": "^7.1.2",
"inquirer": "^6.0.0",
"loader-utils": "^1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/phone-number/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"devDependencies": {
"@ringcentral-integration/babel-settings": "*",
"babel-jest": "^24.8.0",
"fs-extra": "^7.0.1",
"fs-extra": "^8.1.0",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-sourcemaps": "^2.6.5",
Expand Down
6 changes: 0 additions & 6 deletions packages/ringcentral-integration/enums/callDirections.js

This file was deleted.

8 changes: 8 additions & 0 deletions packages/ringcentral-integration/enums/callDirections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createHashMap } from '../lib/HashMap';

const callDirection = createHashMap({
inbound: 'Inbound',
outbound: 'Outbound',
});

export default callDirection;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Enum from 'ringcentral-integration/lib/Enum';

export default new Enum(
['loggedSuccess', 'loggedFailure'],
'conversationLogStatus',
);
10 changes: 0 additions & 10 deletions packages/ringcentral-integration/enums/messageTypes.js

This file was deleted.

12 changes: 12 additions & 0 deletions packages/ringcentral-integration/enums/messageTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { createHashMap } from '../lib/HashMap';

const messageTypes = createHashMap({
all: 'All',
fax: 'Fax',
sms: 'SMS',
voiceMail: 'VoiceMail',
pager: 'Pager',
text: 'Text',
});

export default messageTypes;
6 changes: 4 additions & 2 deletions packages/ringcentral-integration/enums/telephonyStatus.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import HashMap from '../lib/HashMap';
import { createHashMap } from '../lib/HashMap';

export default new HashMap({
const telephonyStatus = createHashMap({
noCall: 'NoCall',
onHold: 'OnHold',
ringing: 'Ringing',
callConnected: 'CallConnected',
parkedCall: 'ParkedCall',
});

export default telephonyStatus;
24 changes: 17 additions & 7 deletions packages/ringcentral-integration/helpers/meetingHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import format, {
formatTypes,
} from '@ringcentral-integration/phone-number/lib/format';

export function getMobileDialingNumberTpl(dialInNumbers, meetingId) {
function getMobileDialingNumberTpl(dialInNumbers, meetingId) {
return dialInNumbers
.map(
({ phoneNumber, location = '' }) =>
Expand All @@ -11,7 +11,7 @@ export function getMobileDialingNumberTpl(dialInNumbers, meetingId) {
.join('\n ');
}

export function getPhoneDialingNumberTpl(dialInNumbers) {
function getPhoneDialingNumberTpl(dialInNumbers) {
return dialInNumbers
.map(({ phoneNumber, location = '', country }) => {
const filterFormattedNumber = format({
Expand All @@ -24,14 +24,14 @@ export function getPhoneDialingNumberTpl(dialInNumbers) {
.join('\n ');
}

export const UTC_TIMEZONE_ID = '1';
export const MeetingType = {
const UTC_TIMEZONE_ID = '1';
const MeetingType = {
SCHEDULED: 'Scheduled',
RECURRING: 'Recurring',
INSTANT: 'Instant',
};

export function getMeetingSettings({
function getMeetingSettings({
extensionName,
startTime,
durationInMinutes = 60,
Expand Down Expand Up @@ -59,7 +59,7 @@ export function getMeetingSettings({
}

// Basic default meeting type information
export function getDefaultMeetingSettings(extensionName, startTime) {
function getDefaultMeetingSettings(extensionName, startTime) {
return {
topic: `${extensionName}'s Meeting`,
meetingType: MeetingType.SCHEDULED,
Expand All @@ -85,8 +85,18 @@ export function getDefaultMeetingSettings(extensionName, startTime) {
};
}

export function getInitializedStartTime() {
function getInitializedStartTime() {
const now = new Date();
const startTime = now.setHours(now.getHours() + 1, 0, 0);
return startTime;
}

export {
getMobileDialingNumberTpl,
getPhoneDialingNumberTpl,
UTC_TIMEZONE_ID,
MeetingType,
getMeetingSettings,
getDefaultMeetingSettings,
getInitializedStartTime,
};
11 changes: 0 additions & 11 deletions packages/ringcentral-integration/lib/HashMap/index.d.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class HashMap {

for (const key in definition) {
/* istanbul ignore else */
if (definition::Object.prototype.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(definition, key)) {
Object.defineProperty(this, key, {
get() {
return this[sDefinition][key];
Expand All @@ -32,12 +32,15 @@ export default class HashMap {
}
Object.freeze(this);
}

static getKey(map, value) {
return map[sValueMap].get(value);
}

static hasValue(map, value) {
return map[sValueMap].has(value);
}

static fromSet({
set,
getKey = defaultGetFunction,
Expand All @@ -54,3 +57,9 @@ export default class HashMap {
return new HashMap(definition);
}
}

export function createHashMap<V extends string, P>(
definition: { [K in V]: string },
): { [K in V]: string } & { [K in keyof P]: string } {
return new HashMap(definition) as any;
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ export default class MessageTransport extends TransportBase {
}
}

async request({ payload }) {
async request<T = any>({ payload }) {
const requestId = uuid.v4();
let promise = new Promise((resolve, reject) => {
let promise = new Promise<T>((resolve, reject) => {
this._myRequests.set(requestId, {
resolve,
reject,
Expand Down
Loading

0 comments on commit 97c585a

Please sign in to comment.