0.12.3 • Published 2 years ago

ringcentral-embeddable-extension-common v0.12.3

Weekly downloads
7
License
MIT
Repository
github
Last release
2 years ago

ringcentral-embeddable-extension-common

RingCentral Embeddable Voice Chrome/Firefox extension common files.

Use

Install

npm i -D -E ringcentral-embeddable-extension-common

In content.js for single page app

/**
 * content.js for chrome extension
 */

import createApp from 'ringcentral-embeddable-extension-common/src/spa/init'
//import * as config from './config'
import {ringCentralConfigs, thirdPartyConfigs, appVersion} from 'ringcentral-embeddable-extension-common/src/common/app-config'
import {isIframe} from 'ringcentral-embeddable-extension-common/src/common/helpers'
import 'ringcentral-embeddable-extension-common/src/spa/style.styl'
import './custom.styl'

let {
  clientID,
  appServer
} = ringCentralConfigs

let appConfigQuery = ''
let {serviceName} = thirdPartyConfigs
if (clientID || appServer) {
  appConfigQuery = `?prefix=${serviceName}-rc&newAdapterUI=1&userAgent=${serviceName}_extension%2F${appVersion}&disableActiveCallControl=false&appKey=${clientID}&appServer=${encodeURIComponent(appServer)}`
}

/* eslint-disable-next-line */
if (!isIframe) {
  ;(function() {
    console.log('import RingCentral Embeddable Voice to web page')
    var rcs = document.createElement('script')
    rcs.src = 'https://ringcentral.github.io/ringcentral-embeddable/adapter.js' + appConfigQuery
    var rcs0 = document.getElementsByTagName('script')[0]
    rcs0.parentNode.insertBefore(rcs, rcs0)
  })()
}

let config = {
  // config for insert click to call button, check ./config.js insertClickToCallButton  for detail
  insertClickToCallButton: [],

  // config for hover contact node to show click to dial tooltip, check ./config.js hoverShowClickToCallButton for detail
  hoverShowClickToCallButton: [],

  // config for modify phone number text to click-to-call link, check ./config.js phoneNumberSelectors for detail
  phoneNumberSelectors: [],

  // third party feature config, check ./config.js thirdPartyServiceConfig function for detail
  // should return
  /*
  {
    services: object,
    handleRCEvents: function
  }
  */
  thirdPartyServiceConfig: (serviceName) => console.log(serviceName),

  // after init callback function, can do some extra init here
  initThirdParty: () => null
}

window.addEventListener('load', createApp(config))

In content.js for not single page app

/**
 * content.js for chrome extension
 */

import createApp from 'ringcentral-embeddable-extension-common/src/no-spa/init'
// import * as config from './config'
import 'ringcentral-embeddable-extension-common/src/no-spa/style.styl'
import './custom.styl'

let config = {
  // config for insert click to call button, check ./config.js insertClickToCallButton  for detail
  insertClickToCallButton: [],

  // config for hover contact node to show click to dial tooltip, check ./config.js hoverShowClickToCallButton for detail
  hoverShowClickToCallButton: [],

  // config for modify phone number text to click-to-call link, check ./config.js phoneNumberSelectors for detail
  phoneNumberSelectors: [],

  // third party feature config, check ./config.js thirdPartyServiceConfig function for detail
  // should return
  /*
  {
    services: object,
    handleRCEvents: function
  }
  */
  thirdPartyServiceConfig: (serviceName) => console.log(serviceName),

  // after init callback function, can do some extra init here
  initThirdParty: () => null,

  // init call with ringcenntral button at page bottom
  // enbaled by default, change to false to disable it
  initCallButton: true
}

window.addEventListener('load', createApp(config))

Built-in oauth support

import getAuthCode from 'ringcentral-embeddable-extension-common/src/feat/browser-oauth'

async function auth() {
  let authCode = await getAuthCode(authUrl)
  // do something like get access code with auth code
}

License

MIT

1.0.0-beta.0

2 years ago

1.0.0-beta.1

2 years ago

0.12.3

2 years ago

0.12.2

3 years ago

0.12.1

3 years ago

0.12.0

3 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.0

4 years ago

0.9.9

4 years ago

0.9.8

4 years ago

0.9.7

4 years ago

0.9.6

4 years ago

0.9.5

4 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.8.8

4 years ago

0.9.0

4 years ago

0.8.7

4 years ago

0.8.6

4 years ago

0.8.5

4 years ago

0.8.4

4 years ago

0.8.3

4 years ago

0.8.1

4 years ago

0.8.2

4 years ago

0.8.0

4 years ago

0.7.10

4 years ago

0.7.9

4 years ago

0.7.8

4 years ago

0.7.7

4 years ago

0.7.6

4 years ago

0.7.5

4 years ago

0.7.4

4 years ago

0.7.3-b2

4 years ago

0.7.3-b1

4 years ago

0.7.2

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.10

5 years ago

0.6.9

5 years ago

0.6.8

5 years ago

0.6.7

5 years ago

0.6.6

5 years ago

0.6.5

5 years ago

0.6.4

5 years ago

0.6.3

5 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.12

5 years ago

0.5.11

5 years ago

0.5.10

5 years ago

0.5.9

5 years ago

0.5.8

5 years ago

0.5.7

5 years ago

0.5.6

5 years ago

0.5.4

5 years ago

0.5.3

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.13

5 years ago

0.4.12

5 years ago

0.4.11

5 years ago

0.4.10

5 years ago

0.4.9

5 years ago

0.4.8

5 years ago

0.4.7

5 years ago

0.4.6

5 years ago

0.4.5

5 years ago

0.4.4

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago