@wavoip/wavoip-webphone 1.1.15 → 1.2.0

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
@@ -0,0 +1,6 @@
1
+ # Wavoip Webphone
2
+
3
+ Essa biblioteca foi feita com o intuito de facilitar a realização de ligações por dispositivos da Wavoip. Ela disponibiliza uma interface customizável e isolada do projeto onde está instalada. Esse webphone usa o [Wavoip API](https://github.com/wavoip/wavoip-api) por debaixo dos panos.
4
+
5
+ [Documentação disponível aqui](https://wavoip.gitbook.io/api/webphone)
6
+
package/dist/index.d.ts CHANGED
@@ -3,35 +3,18 @@ import { CallOffer } from '@wavoip/wavoip-api';
3
3
  import { CallOutgoing } from '@wavoip/wavoip-api';
4
4
  import { Device } from '@wavoip/wavoip-api';
5
5
 
6
- declare type AppConfig = {
7
- theme?: "dark" | "light" | "system";
8
- statusBar?: {
9
- showNotificationsIcon?: boolean;
10
- showSettingsIcon?: boolean;
11
- };
12
- settingsMenu?: {
13
- deviceMenu?: {
14
- show?: boolean;
15
- showAddDevices?: boolean;
16
- showEnableDevicesButton?: boolean;
17
- showRemoveDevicesButton?: boolean;
18
- };
19
- };
20
- widget?: {
21
- showWidgetButton?: boolean;
22
- startOpen?: boolean;
23
- };
24
- };
25
-
26
6
  declare type CallActiveProps = Pick<CallActive, "id" | "type" | "device_token" | "direction" | "status" | "peer" | "muted">;
27
7
 
28
8
  declare type CallOfferProps = Pick<CallOffer, "id" | "type" | "device_token" | "direction" | "status" | "peer" | "muted">;
29
9
 
30
10
  declare type CallOutgoingProps = Pick<CallOutgoing, "id" | "type" | "device_token" | "direction" | "status" | "peer" | "muted">;
31
11
 
32
- declare type DeepPartial<T> = T extends object ? {
33
- [P in keyof T]?: DeepPartial<T[P]>;
34
- } : T;
12
+ declare type DeviceMenuSettings = {
13
+ show?: boolean;
14
+ showAddDevices?: boolean;
15
+ showEnableDevicesButton?: boolean;
16
+ showRemoveDevicesButton?: boolean;
17
+ };
35
18
 
36
19
  declare type DeviceState = Device & {
37
20
  enable: boolean;
@@ -49,6 +32,15 @@ declare type NotificationsType = {
49
32
  created_at: Date;
50
33
  };
51
34
 
35
+ declare type SettingsMenuSettings = {
36
+ deviceMenu?: DeviceMenuSettings;
37
+ };
38
+
39
+ declare type StatusBarSettings = {
40
+ showNotificationsIcon?: boolean;
41
+ showSettingsIcon?: boolean;
42
+ };
43
+
52
44
  declare type Theme = "dark" | "light" | "system";
53
45
 
54
46
  declare const webphone: WebPhoneComponent;
@@ -74,24 +66,37 @@ declare type WebphoneAPI = {
74
66
  };
75
67
  device: {
76
68
  getDevices: () => DeviceState[];
69
+ get: () => DeviceState[];
77
70
  addDevice: (token: string, persist: boolean) => void;
71
+ add: (token: string, persist: boolean) => void;
78
72
  removeDevice: (token: string) => void;
73
+ remove: (token: string) => void;
79
74
  enableDevice: (token: string) => void;
75
+ enable: (token: string) => void;
80
76
  disableDevice: (token: string) => void;
77
+ disable: (token: string) => void;
81
78
  };
82
79
  notifications: {
83
80
  getNotifications: () => NotificationsType[];
81
+ get: () => NotificationsType[];
84
82
  addNotification: (notification: NotificationsType) => void;
83
+ add: (notification: NotificationsType) => void;
85
84
  removeNotification: (id: Date) => void;
85
+ remove: (id: Date) => void;
86
86
  clearNotifications: () => void;
87
+ clear: () => void;
87
88
  readNotifications: () => void;
89
+ read: () => void;
88
90
  };
89
91
  widget: {
92
+ isOpen: boolean;
90
93
  open: () => void;
91
94
  close: () => void;
92
95
  toggle: () => void;
93
96
  };
94
97
  theme: {
98
+ value: Theme;
99
+ set: (theme: Theme) => void;
95
100
  setTheme: (theme: Theme) => void;
96
101
  };
97
102
  settings: {
@@ -102,23 +107,46 @@ declare type WebphoneAPI = {
102
107
  showEnableDevices: boolean;
103
108
  showRemoveDevices: boolean;
104
109
  showWidgetButton: boolean;
105
- setShowNotifications: React.Dispatch<React.SetStateAction<boolean>>;
106
- setShowSettings: React.Dispatch<React.SetStateAction<boolean>>;
107
- setShowDevices: React.Dispatch<React.SetStateAction<boolean>>;
108
- setShowAddDevices: React.Dispatch<React.SetStateAction<boolean>>;
109
- setShowEnableDevices: React.Dispatch<React.SetStateAction<boolean>>;
110
- setShowRemoveDevices: React.Dispatch<React.SetStateAction<boolean>>;
111
- setShowWidgetButton: React.Dispatch<React.SetStateAction<boolean>>;
110
+ setShowNotifications: (show: boolean) => void;
111
+ setShowSettings: (show: boolean) => void;
112
+ setShowDevices: (show: boolean) => void;
113
+ setShowAddDevices: (show: boolean) => void;
114
+ setShowEnableDevices: (show: boolean) => void;
115
+ setShowRemoveDevices: (show: boolean) => void;
116
+ setShowWidgetButton: (show: boolean) => void;
117
+ };
118
+ position: {
119
+ value: {
120
+ x: number;
121
+ y: number;
122
+ };
123
+ set: (position: WebphonePosition) => void;
112
124
  };
113
125
  };
114
126
 
115
127
  declare class WebPhoneComponent {
116
128
  private container;
117
129
  private root;
118
- render(config?: WebphoneConfig): Promise<WebphoneAPI>;
130
+ render(config?: WebphoneSettings): Promise<WebphoneAPI>;
119
131
  destroy(): void;
120
132
  }
121
133
 
122
- export declare type WebphoneConfig = DeepPartial<AppConfig>;
134
+ declare type WebphonePosition = "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "center" | {
135
+ x: number;
136
+ y: number;
137
+ };
138
+
139
+ declare type WebphoneSettings = {
140
+ theme?: Theme;
141
+ statusBar?: Partial<StatusBarSettings>;
142
+ settingsMenu?: Partial<SettingsMenuSettings>;
143
+ widget?: Partial<WidgetSettings>;
144
+ position?: WebphonePosition;
145
+ };
146
+
147
+ declare type WidgetSettings = {
148
+ showWidgetButton?: boolean;
149
+ startOpen?: boolean;
150
+ };
123
151
 
124
152
  export { }