Skip to content

Commit 354b3a6

Browse files
committed
- feat: Log missed call/unread voicemail as not done
- Use Dexie to increase indexedDB performance - fix: Fix inbound SMS log
1 parent 232f813 commit 354b3a6

File tree

6 files changed

+41
-38
lines changed

6 files changed

+41
-38
lines changed

package-lock.json

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pipedrive-embeddable-ringcentral-phone-spa",
3-
"version": "2.10.1",
3+
"version": "2.11.0",
44
"description": "Add RingCentral Embeddable Voice widgets to Pipedrive",
55
"keywords": [
66
"RingCentral",
@@ -69,7 +69,7 @@
6969
"react-dom": "^16.13.1",
7070
"recursive-assign": "0.2.0",
7171
"replace-in-file": "^5.0.2",
72-
"ringcentral-embeddable-extension-common": "0.9.8",
72+
"ringcentral-embeddable-extension-common": "0.11.0",
7373
"shelljs": "0.8.2",
7474
"standard": "^12.0.1",
7575
"style-loader": "0.23.1",

src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export const phoneNumberSelectors = [
162162
* thirdPartyService config
163163
* @param {*} serviceName
164164
*/
165-
export function thirdPartyServiceConfig (serviceName) {
165+
export async function thirdPartyServiceConfig (serviceName) {
166166
console.log(serviceName, 'serviceName')
167167

168168
let services = {

src/features/call-log-sync.js

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,18 @@ function buildMsgs (body, contactId) {
154154
let msgs = _.get(body, 'conversation.messages')
155155
const arr = []
156156
for (const m of msgs) {
157-
let desc = m.direction === 'Outbound'
158-
? 'to'
159-
: 'from'
160-
let n = m.direction === 'Outbound'
161-
? m.to
162-
: [m.from]
163-
n = n.map(m => formatPhoneLocal(m.phoneNumber)).join(', ')
157+
const fromN = getFullNumber(_.get(m, 'from')) ||
158+
getFullNumber(_.get(m, 'from[0]')) || ''
159+
const fromName = _.get(m, 'from.name') || _.get(m, 'from.phoneNumber') ||
160+
(_.get(m, 'from') || []).map(d => d.name).join(', ') || ''
161+
const toN = getFullNumber(_.get(m, 'to')) ||
162+
getFullNumber(_.get(m, 'to[0]')) || ''
163+
const toName = _.get(m, 'to.name') ||
164+
(_.get(m, 'to') || []).map(d => d.name).join(', ') || ''
165+
const from = fromN +
166+
(fromName ? `(${fromName})` : '')
167+
const to = toN +
168+
(toName ? `(${toName})` : '')
164169
let attachments = (m.attachments || [])
165170
.filter(d => d.type !== 'Text')
166171
.map(d => {
@@ -169,9 +174,9 @@ function buildMsgs (body, contactId) {
169174
}).join('')
170175
attachments = attachments ? `<p>attachments: </p>${attachments}` : ''
171176
arr.push({
172-
body: `<div>SMS: <b>${m.subject}</b> - ${desc} <b>${n}</b> - ${moment(m.creationTime).format('MMM DD, YYYY HH:mm')}${attachments}</div>`,
173-
id: m.id,
177+
body: `<div>SMS: <b>${m.subject}</b> - from <b>${from}</b> to <b>${to}</b> - ${moment(m.creationTime).format('MMM DD, YYYY HH:mm')}${attachments}</div>`,
174178
done: m.readStatus === 'Read',
179+
id: m.id,
175180
contactId
176181
})
177182
}
@@ -189,7 +194,7 @@ function buildVoiceMailMsgs (body, contactId) {
189194
let n = isOut
190195
? m.to
191196
: [m.from]
192-
n = n.map(m => formatPhoneLocal(m.phoneNumber || m.extensionNumber)).join(', ')
197+
n = n.map(m => formatPhoneLocal(getFullNumber(m))).join(', ')
193198
let links = m.attachments.map(t => t.link).join(', ')
194199
arr.push({
195200
body: `<p>Voice mail: ${links} - ${n ? desc : ''} <b>${n}</b> ${moment(m.creationTime).format('MMM DD, YYYY HH:mm')}</p>`,
@@ -237,6 +242,8 @@ async function doSyncOne (contact, body, formData, isManuallySync) {
237242
if (!isManuallySync) {
238243
desc = await ls.get(sessid) || ''
239244
}
245+
const result = _.get(body, 'call.result')
246+
const done = !!(result && result !== 'Missed')
240247
let toNumber = getFullNumber(_.get(body, 'call.to'))
241248
let fromNumber = getFullNumber(_.get(body, 'call.from'))
242249
let duration = _.get(body, 'call.duration') || 0
@@ -274,6 +281,7 @@ async function doSyncOne (contact, body, formData, isManuallySync) {
274281
mainBody = [{
275282
body: mainBody,
276283
id: externalId,
284+
done,
277285
contactId: id
278286
}]
279287
}
@@ -286,8 +294,8 @@ async function doSyncOne (contact, body, formData, isManuallySync) {
286294
.join('')
287295
let bodyAll = mainBody.map(mm => {
288296
return {
289-
id: mm.id,
290297
...mm,
298+
id: mm.id,
291299
body: `<div>${descFormatted}</div><p>${mm.body}</p>${recording}`
292300
}
293301
})

src/manifest.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Ringcentral Embeddable Widgets for Pipedrive",
3-
"version": "2.10.1",
3+
"version": "2.11.0",
44
"description": "Add RingCentral Embeddable Voice widgets to Pipedrive",
55
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1YqYvCEeGGNOgtKrx8DfG33ujx7NgAwbyVpikug4mHiNvKZYWulw7lY5fjaD8wAy5bmXnkfULDzqMkL8UOxUcf8qD2lJFcLm+BqBtqNnoSz00vwjSOxXrcDvpvsMrjEZkI7N/FD60sTWp1U+QOehua7OboUpXb4iV7TQfppz3PsCz7qGOa4PWjUMAZTTgomUtW47Es6f/vjIeejs7Ihro3Al5Jo3SWIbjpjSU9BK34XgFvtcZx3lZQgfFiK+ZNyxlx8mgC/PLqJB+uX63ywMrT86TdcfxBuaThy98S8SCXjZTpHOP6X5pmGMk0lPM06hwxmSCBZgHOHL/Wk6r8FUlQIDAQAB",
66
"permissions": [
@@ -13,7 +13,11 @@
1313
"tabCapture",
1414
"system.display",
1515
"unlimitedStorage",
16-
"https://*.pipedrive.com/*"
16+
"https://*.pipedrive.com/*",
17+
"https://*.hubspot.com/*",
18+
"https://kocm6omq0b.execute-api.us-east-1.amazonaws.com/*",
19+
"https://*.gtihub.io/*",
20+
"https://*.ringcentral.com/*"
1721
],
1822
"page_action": {
1923
"default_icon": {
@@ -22,7 +26,7 @@
2226
"48": "icons/rc48.png",
2327
"128": "icons/rc128.png"
2428
},
25-
"default_title": "pipedrive-embeddable-ringcentral-phone-spa"
29+
"default_title": "PipeDrive embeddable RingCentral phone"
2630
},
2731
"icons": {
2832
"16": "icons/rc16.png",
@@ -42,7 +46,6 @@
4246
"js": [
4347
"./react.production.min.js",
4448
"./react-dom.production.min.js",
45-
"./jsstore.worker.min.js",
4649
"./content.js"
4750
]
4851
}

webpack.config.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ const f32 = path.resolve(
3535
__dirname,
3636
'node_modules/react-dom/umd/react-dom.production.min.js'
3737
)
38-
const f3 = path.resolve(
39-
__dirname,
40-
'node_modules/jsstore/dist/jsstore.worker.min.js'
41-
)
4238
const to4 = path.resolve(
4339
__dirname,
4440
'dist'
@@ -55,11 +51,7 @@ const patterns = [{
5551
from: f2,
5652
to: to4,
5753
force: true
58-
}, */ {
59-
from: f3,
60-
to: to4,
61-
force: true
62-
}, /* {
54+
}, {
6355
from: f2,
6456
to: to4f,
6557
force: true

0 commit comments

Comments
 (0)