Skip to content

Commit 0e96321

Browse files
committed
- feat: Add clear extension contacts data button
- feat: Sync contacts do not clear contacts data first
1 parent 4577c4c commit 0e96321

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pipedrive-embeddable-ringcentral-phone-spa",
3-
"version": "2.11.2",
3+
"version": "2.12.0",
44
"description": "Add RingCentral Embeddable Voice widgets to Pipedrive",
55
"keywords": [
66
"RingCentral",

src/custom.styl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@
3838
z-index 20
3939
box-shadow 0px 0px 3px 3px rgba(0,0,0,0.35)
4040
.rc-reloading-contacts
41-
z-index 21
41+
z-index 12000
4242
#Pipedrive-rc
4343
overflow visible
4444
b
4545
.bold
46-
font-weight bold
46+
font-weight bold
47+
*[class*="ant-"].ant-notification
48+
z-index 12000

src/features/contacts.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { setCache, getCache } from 'ringcentral-embeddable-extension-common/src/
1616
import fetch from 'ringcentral-embeddable-extension-common/src/common/fetch'
1717
import { thirdPartyConfigs } from 'ringcentral-embeddable-extension-common/src/common/app-config'
1818
import {
19-
remove,
2019
insert,
2120
getByPage,
2221
match
@@ -123,11 +122,6 @@ async function fetchAllContacts (_recent) {
123122
const lastSync = lastSyncOffset
124123
let start = await getCache(lastSync) || 0
125124
let hasMore = true
126-
if (!recent && !start) {
127-
await remove().catch(e => {
128-
console.log(e.stack)
129-
})
130-
}
131125
while (hasMore) {
132126
let res = await getContact(start).catch(console.debug)
133127
if (res && res.data) {
@@ -176,7 +170,9 @@ export const getContacts = async function (page = 1) {
176170
console.debug('use cache')
177171
return cached
178172
}
179-
fetchAllContacts()
173+
if (!window.rc.syncTimestamp && !cached.result.length) {
174+
fetchAllContacts()
175+
}
180176
return final
181177
}
182178

src/lib/react-ele.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
*/
44

55
import { useEffect } from 'react'
6-
import { Modal, Button } from 'antd'
6+
import { Modal, Button, notification } from 'antd'
77
import { SyncOutlined, InfoCircleOutlined } from '@ant-design/icons'
88
import { reSyncData } from '../features/contacts'
99
import './antd.less'
1010
import 'antd/dist/antd.less'
1111
import { doAuth } from '../features/auth'
1212
import AutoSync from './auto-resync'
13+
import {
14+
remove
15+
} from 'ringcentral-embeddable-extension-common/src/common/db'
1316

1417
function showSyncMenu () {
1518
let mod = null
@@ -21,6 +24,13 @@ function showSyncMenu () {
2124
reSyncData()
2225
destroyMod()
2326
}
27+
async function delAll () {
28+
await remove()
29+
notification.success({
30+
message: 'All contacts removed from extension database',
31+
zIndex: 6697
32+
})
33+
}
2434
function destroyMod () {
2535
mod.destroy()
2636
}
@@ -42,6 +52,13 @@ function showSyncMenu () {
4252
>
4353
Sync all contacts
4454
</Button>
55+
<Button
56+
type='primary'
57+
className='rc-mg1r rc-mg1b'
58+
onClick={delAll}
59+
>
60+
Remove all contacts data from extension database
61+
</Button>
4562
<Button
4663
type='ghost'
4764
className='rc-mg1r rc-mg1b'

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Ringcentral Embeddable Widgets for Pipedrive",
3-
"version": "2.11.2",
3+
"version": "2.12.0",
44
"description": "Add RingCentral Embeddable Voice widgets to Pipedrive",
55
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1YqYvCEeGGNOgtKrx8DfG33ujx7NgAwbyVpikug4mHiNvKZYWulw7lY5fjaD8wAy5bmXnkfULDzqMkL8UOxUcf8qD2lJFcLm+BqBtqNnoSz00vwjSOxXrcDvpvsMrjEZkI7N/FD60sTWp1U+QOehua7OboUpXb4iV7TQfppz3PsCz7qGOa4PWjUMAZTTgomUtW47Es6f/vjIeejs7Ihro3Al5Jo3SWIbjpjSU9BK34XgFvtcZx3lZQgfFiK+ZNyxlx8mgC/PLqJB+uX63ywMrT86TdcfxBuaThy98S8SCXjZTpHOP6X5pmGMk0lPM06hwxmSCBZgHOHL/Wk6r8FUlQIDAQAB",
66
"permissions": [

0 commit comments

Comments
 (0)