@bacca2095/webphone 1.1.0 → 1.2.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 CHANGED
@@ -28,12 +28,12 @@ The library requires Pinia. Register `WebPhonePlugin` after `createPinia()`.
28
28
  ```ts
29
29
  import { createApp } from 'vue'
30
30
  import { createPinia } from 'pinia'
31
- import { WebPhonePlugin } from '@bacca2095/webphone'
31
+ import { WebPhone } from '@bacca2095/webphone'
32
32
  import '@bacca2095/webphone/style.css'
33
33
 
34
34
  const app = createApp(App)
35
35
  app.use(createPinia())
36
- app.use(WebPhonePlugin)
36
+ app.use(WebPhone)
37
37
  app.mount('#app')
38
38
  ```
39
39
 
@@ -42,20 +42,62 @@ app.mount('#app')
42
42
  ```vue
43
43
  <script setup lang="ts">
44
44
  import { WebPhone } from '@bacca2095/webphone'
45
- import type { WebPhoneConfig } from '@bacca2095/webphone'
45
+ import type { WebPhoneConfig, Contact } from '@bacca2095/webphone'
46
46
 
47
47
  const config: WebPhoneConfig = {
48
48
  uri: 'sip:user@domain.com',
49
49
  password: 'secret',
50
- servers: ['wss://sip.domain.com'],
50
+ server: 'wss://sip.domain.com',
51
51
  }
52
+
53
+ const contacts: Contact[] = [
54
+ { id: '1', name: 'Alice', phone: 'sip:alice@domain.com', type: 'internal' },
55
+ ]
52
56
  </script>
53
57
 
54
58
  <template>
55
- <WebPhone :config="config" />
59
+ <WebPhone :config="config" :contacts="contacts" />
56
60
  </template>
57
61
  ```
58
62
 
63
+ ## WebPhone Props
64
+
65
+ | Prop | Type | Required | Description |
66
+ |------|------|----------|-------------|
67
+ | `config` | `WebPhoneConfig` | No | SIP connection configuration. If omitted, the phone renders without connecting. |
68
+ | `floating` | `boolean` | No | Renders the phone as a fixed, draggable overlay. |
69
+ | `contacts` | `Contact[]` | No | External contact list surfaced in the contacts panel. |
70
+
71
+ ## WebPhone Emits
72
+
73
+ | Event | Payload | Description |
74
+ |-------|---------|-------------|
75
+ | `open-history` | — | Fired when the user navigates to the history panel. |
76
+ | `open-notes` | `remoteUri?: string` | Fired when the user navigates to the notes panel. |
77
+ | `open-contacts` | — | Fired when the user navigates to the contacts panel. |
78
+ | `open-calendar` | — | Fired when the user navigates to the calendar panel. |
79
+
80
+ ## Types
81
+
82
+ ### `WebPhoneConfig`
83
+
84
+ | Field | Type | Required | Description |
85
+ |-------|------|----------|-------------|
86
+ | `server` | `string` | Yes | WebSocket server URL — e.g. `wss://sip.domain.com` |
87
+ | `uri` | `string` | Yes | SIP URI — e.g. `sip:user@domain.com` |
88
+ | `password` | `string` | Yes | SIP account password |
89
+ | `displayName` | `string` | No | Caller ID display name |
90
+ | `iceServers` | `RTCIceServer[]` | No | STUN/TURN servers for ICE negotiation |
91
+
92
+ ### `Contact`
93
+
94
+ | Field | Type | Required | Description |
95
+ |-------|------|----------|-------------|
96
+ | `id` | `string` | Yes | Unique identifier |
97
+ | `name` | `string` | Yes | Display name |
98
+ | `phone` | `string` | Yes | Extension, phone number, or SIP URI |
99
+ | `type` | `'internal' \| 'external' \| 'service' \| 'emergency'` | No | Contact category |
100
+
59
101
  ## API
60
102
 
61
103
  ### Components
@@ -77,34 +119,50 @@ const config: WebPhoneConfig = {
77
119
  | `useContacts` | Contacts CRUD and search |
78
120
  | `useWebPhoneStore` | Pinia store — reactive phone state |
79
121
 
80
- ### Types
122
+ ### Additional Types
81
123
 
82
- ```ts
83
- import type {
84
- WebPhoneConfig,
85
- CallInfo,
86
- CallStatus,
87
- CallDirection,
88
- Contact,
89
- ContactType,
90
- PhoneNote,
91
- NoteColor,
92
- ScheduledCall,
93
- MicPermission,
94
- } from '@bacca2095/webphone'
124
+ `CallInfo`, `CallStatus`, `CallDirection`, `PhoneNote`, `NoteColor`, `ScheduledCall`, `MicPermission`
125
+
126
+ ## CDN Usage (Web Component)
127
+
128
+ The library ships a self-contained web component build that works without Vue or any bundler.
129
+
130
+ **ES module (recommended):**
131
+
132
+ ```html
133
+ <script type="module" src="https://unpkg.com/@bacca2095/webphone/dist/webphone.es.js"></script>
134
+
135
+ <web-phone></web-phone>
95
136
  ```
96
137
 
97
- ## Web Component
138
+ **IIFE (no module support required):**
98
139
 
99
- A standalone web component build is available for use outside Vue applications.
140
+ ```html
141
+ <script src="https://unpkg.com/@bacca2095/webphone/dist/webphone.iife.js"></script>
142
+
143
+ <web-phone></web-phone>
144
+ ```
145
+
146
+ **Passing config via attribute:**
100
147
 
101
148
  ```html
102
- <script type="module" src="@bacca2095/webphone/webcomponent"></script>
149
+ <web-phone id="phone"></web-phone>
150
+
151
+ <script type="module">
152
+ const phone = document.getElementById('phone')
153
+ phone.config = {
154
+ uri: 'sip:user@domain.com',
155
+ password: 'secret',
156
+ server: 'wss://sip.domain.com',
157
+ }
158
+ </script>
103
159
  ```
104
160
 
161
+ > The web component bundles all dependencies including styles. No additional CSS import is needed.
162
+
105
163
  ## Demo
106
164
 
107
- A live demo is available at [bacca2095.github.io/webphone-libs](https://bacca2095.github.io/webphone-libs).
165
+ A live demo is available at [bacca2095.github.io/webphone](https://bacca2095.github.io/webphone).
108
166
 
109
167
  ## License
110
168