@bravophone/webphone 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/bravophone.mjs +20 -20
- package/dist/bravophone.umd.js +12 -12
- package/host/popup.js +1 -1
- package/host/shim/guest-bridge.js +15 -2
- package/package.json +1 -1
- package/types/index.d.ts +19 -0
|
@@ -152,9 +152,22 @@
|
|
|
152
152
|
}
|
|
153
153
|
Object.keys(dados).forEach(function (k) { if (dados[k] === null) delete dados[k] })
|
|
154
154
|
|
|
155
|
-
return new Promise(function (resolve) {
|
|
155
|
+
return new Promise(function (resolve, reject) {
|
|
156
156
|
chrome.storage.local.set(dados, function () {
|
|
157
|
-
|
|
157
|
+
// O ramal NÃO vai para o storage: o bundle o mantém apenas no store
|
|
158
|
+
// Vuex (mutation addExtension), em memória. E o checkToken exige as
|
|
159
|
+
// DUAS metades — `vxToken` da sessão E `extension` com username e
|
|
160
|
+
// password. Só a sessão deixa o app na tela de login.
|
|
161
|
+
if (!s.extension) return resolve({ ok: true, extension: false })
|
|
162
|
+
|
|
163
|
+
waitFor(findStore, 20000).then(function (store) {
|
|
164
|
+
// Depois da sessão gravada, de propósito: a mutation relê o
|
|
165
|
+
// storage para decidir se está logado.
|
|
166
|
+
store.commit('addExtension', s.extension)
|
|
167
|
+
resolve({ ok: true, extension: true })
|
|
168
|
+
}).catch(function (err) {
|
|
169
|
+
reject(new Error('sessão gravada, mas o ramal não pôde ser aplicado: ' + err.message))
|
|
170
|
+
})
|
|
158
171
|
})
|
|
159
172
|
})
|
|
160
173
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bravophone/webphone",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Webphone BRAVOPHONE embutível em qualquer página web. Renderiza uma janela flutuante arrastável com todas as funcionalidades do softphone.",
|
|
5
5
|
"main": "./dist/bravophone.umd.js",
|
|
6
6
|
"module": "./dist/bravophone.mjs",
|
package/types/index.d.ts
CHANGED
|
@@ -10,6 +10,25 @@ export interface BravophoneSession {
|
|
|
10
10
|
ramal?: string
|
|
11
11
|
clienteId?: string
|
|
12
12
|
ramaisUrl?: string
|
|
13
|
+
/**
|
|
14
|
+
* O ramal SIP, como vem do `/api/voxfree/login`. **Obrigatório para
|
|
15
|
+
* registrar**: o `checkToken` do webphone exige as duas metades — o
|
|
16
|
+
* `vxToken` da sessão E um `extension` com `username` e `password`. Só a
|
|
17
|
+
* sessão deixa o app parado na tela de login.
|
|
18
|
+
*
|
|
19
|
+
* Onde ele fica: o SDK o envia apenas pela ponte (postMessage) e o aplica
|
|
20
|
+
* no store em memória do webphone. Nunca entra no HTML do iframe nem no
|
|
21
|
+
* localStorage — a credencial SIP não fica legível no DOM da sua página.
|
|
22
|
+
*/
|
|
23
|
+
extension?: {
|
|
24
|
+
username: string
|
|
25
|
+
password: string
|
|
26
|
+
server?: string
|
|
27
|
+
authID?: string
|
|
28
|
+
displayName?: string
|
|
29
|
+
label?: string
|
|
30
|
+
[k: string]: unknown
|
|
31
|
+
}
|
|
13
32
|
}
|
|
14
33
|
|
|
15
34
|
export interface BravophoneOptions {
|