Skip to content

Commit

Permalink
small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DaKingKong committed Dec 14, 2022
1 parent 0be82f0 commit 8ae8775
Show file tree
Hide file tree
Showing 32 changed files with 395 additions and 229 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ env.yml
serverless.yml

server/serverless-deploy/*
client/dist.zip
4 changes: 3 additions & 1 deletion client/src/components/auth/insightlyAuth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,22 @@ export default () => {
color='action.primary'
/></div>
<RcText style={titleStyle} variant='title2'>Register API Key</RcText>
<RcText style={titleStyle} variant='caption1'>(info under User Settings - API section)</RcText>
<RcTextField
style={titleStyle}
label='Key'
onChange={onChangeKey}
value={apiKey}
required={true}
helperText='eg. xxxxx-xxxx-xxxx-xxxx-xxxxxxx'
></RcTextField>
<RcTextField
style={titleStyle}
label='API url'
onChange={onChangeApiUrl}
value={apiUrl}
required={true}
helperText='eg. https://api.na1.insightly.com'
helperText='eg. https://api.xxx.insightly.com'
></RcTextField>
</div>
)
Expand Down
2 changes: 2 additions & 0 deletions client/src/core/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ async function apiKeyLogin({ apiKey, apiUrl }) {
}
});
setAuth(true);
showNotification({ level: 'success', message: 'Successfully authorized.', ttl: 3000 });
await chrome.storage.local.set({
['rcUnifiedCrmExtJwt']: res.data
});
Expand All @@ -39,6 +40,7 @@ async function onAuthCallback(callbackUri) {
const hostname = platformInfo['platform-info'].hostname;
const res = await axios.get(`${config.serverUrl}/oauth-callback?callbackUri=${callbackUri}&rcUserNumber=${rcUserNumber}&hostname=${hostname}`);
setAuth(true);
showNotification({ level: 'success', message: 'Successfully authorized.', ttl: 3000 });
await chrome.storage.local.set({
['rcUnifiedCrmExtJwt']: res.data
});
Expand Down
9 changes: 7 additions & 2 deletions client/src/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ window.addEventListener('message', async (e) => {
const rcUserInfo = { rcUserNumber: data.loginNumber };
await chrome.storage.local.set(rcUserInfo);
document.getElementById('rc-widget').style.zIndex = 0;
const { rcUnifiedCrmExtJwt } = await chrome.storage.local.get('rcUnifiedCrmExtJwt');
if(!rcUnifiedCrmExtJwt)
{
showNotification({ level: 'warning', message: 'Please authorize CRM platform account in User Settings.', ttl: 10000 });
}
break;
case 'rc-login-popup-notify':
handleRCOAuthWindow(data.oAuthUri);
Expand Down Expand Up @@ -86,13 +91,13 @@ window.addEventListener('message', async (e) => {
// query on 3rd party API to get the matched contact info and return
const { matched: contactMatched, contactInfo } = await getContact({ phoneNumber: contactPhoneNumber });
if (contactMatched) {
matchedContacts[contactInfo.phones[0]] = [{
matchedContacts[contactInfo.phone] = [{
id: contactInfo.id,
type: config.currentPlatform,
name: contactInfo.name,
phoneNumbers: [
{
phoneNumber: contactInfo.phones[0],
phoneNumber: contactInfo.phone,
phoneType: 'direct'
}
]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rc-unified-crm-extension",
"version": "0.3.12",
"version": "0.3.13",
"description": "RingCentral Unified CRM Extension",
"main": "index.js",
"bin": {
Expand Down
64 changes: 34 additions & 30 deletions server/coverage/clover.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1670553534323" clover="3.2.0">
<project timestamp="1670553534323" name="All files">
<metrics statements="270" coveredstatements="217" conditionals="88" coveredconditionals="64" methods="30" coveredmethods="21" elements="388" coveredelements="302" complexity="0" loc="270" ncloc="270" packages="5" files="10" classes="10"/>
<coverage generated="1670997274101" clover="3.2.0">
<project timestamp="1670997274101" name="All files">
<metrics statements="274" coveredstatements="219" conditionals="90" coveredconditionals="64" methods="31" coveredmethods="23" elements="395" coveredelements="306" complexity="0" loc="274" ncloc="274" packages="5" files="10" classes="10"/>
<package name="src">
<metrics statements="107" coveredstatements="74" conditionals="18" coveredconditionals="12" methods="10" coveredmethods="6"/>
<file name="index.js" path="C:\Users\dak.admin\Documents\Github\rc-unified-crm-extension\server\src\index.js">
Expand Down Expand Up @@ -279,9 +279,9 @@
</file>
</package>
<package name="src.platformModules">
<metrics statements="33" coveredstatements="29" conditionals="26" coveredconditionals="16" methods="8" coveredmethods="5"/>
<metrics statements="37" coveredstatements="31" conditionals="28" coveredconditionals="16" methods="9" coveredmethods="7"/>
<file name="pipedrive.js" path="C:\Users\dak.admin\Documents\Github\rc-unified-crm-extension\server\src\platformModules\pipedrive.js">
<metrics statements="33" coveredstatements="29" conditionals="26" coveredconditionals="16" methods="8" coveredmethods="5"/>
<metrics statements="37" coveredstatements="31" conditionals="28" coveredconditionals="16" methods="9" coveredmethods="7"/>
<line num="1" count="2" type="stmt"/>
<line num="2" count="2" type="stmt"/>
<line num="3" count="2" type="stmt"/>
Expand All @@ -290,31 +290,35 @@
<line num="19" count="0" type="stmt"/>
<line num="24" count="0" type="stmt"/>
<line num="38" count="0" type="stmt"/>
<line num="54" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="55" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="56" count="1" type="stmt"/>
<line num="66" count="1" type="stmt"/>
<line num="72" count="1" type="stmt"/>
<line num="76" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="77" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="78" count="1" type="stmt"/>
<line num="87" count="1" type="stmt"/>
<line num="93" count="1" type="stmt"/>
<line num="97" count="6" type="stmt"/>
<line num="102" count="6" type="cond" truecount="2" falsecount="0"/>
<line num="103" count="3" type="stmt"/>
<line num="106" count="3" type="stmt"/>
<line num="107" count="3" type="stmt"/>
<line num="112" count="3" type="cond" truecount="1" falsecount="1"/>
<line num="113" count="0" type="stmt"/>
<line num="115" count="3" type="stmt"/>
<line num="119" count="2" type="stmt"/>
<line num="120" count="2" type="stmt"/>
<line num="121" count="2" type="stmt"/>
<line num="122" count="2" type="stmt"/>
<line num="123" count="2" type="stmt"/>
<line num="124" count="2" type="stmt"/>
<line num="125" count="2" type="stmt"/>
<line num="39" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="40" count="0" type="stmt"/>
<line num="54" count="0" type="stmt"/>
<line num="71" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="72" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="73" count="1" type="stmt"/>
<line num="83" count="1" type="stmt"/>
<line num="89" count="1" type="stmt"/>
<line num="93" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="94" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="95" count="1" type="stmt"/>
<line num="104" count="1" type="stmt"/>
<line num="110" count="1" type="stmt"/>
<line num="114" count="6" type="stmt"/>
<line num="119" count="6" type="cond" truecount="2" falsecount="0"/>
<line num="120" count="3" type="stmt"/>
<line num="123" count="3" type="stmt"/>
<line num="124" count="3" type="stmt"/>
<line num="129" count="3" type="cond" truecount="1" falsecount="1"/>
<line num="130" count="3" type="stmt"/>
<line num="132" count="3" type="stmt"/>
<line num="137" count="3" type="stmt"/>
<line num="145" count="2" type="stmt"/>
<line num="146" count="2" type="stmt"/>
<line num="147" count="2" type="stmt"/>
<line num="148" count="2" type="stmt"/>
<line num="149" count="2" type="stmt"/>
<line num="150" count="2" type="stmt"/>
<line num="151" count="2" type="stmt"/>
</file>
</package>
</project>
Expand Down
Loading

0 comments on commit 8ae8775

Please sign in to comment.