@acrobits/ipc-sdk 0.10.0 → 0.11.2-alpha.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/docs/assets/main.js +4 -4
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +7 -5
- package/docs/classes/IPCManager.html +94 -69
- package/docs/enums/IPCEvents.html +10 -8
- package/docs/index.html +2 -2
- package/docs/interfaces/DetailedContactURI.html +6 -6
- package/docs/interfaces/ILogger.html +7 -7
- package/docs/modules.html +17 -17
- package/docs/types/BaseContactItem.html +10 -0
- package/docs/types/CloudUsernameContactItem.html +6 -0
- package/docs/types/ContactItem.html +2 -2
- package/docs/types/ContactLabel.html +2 -2
- package/docs/types/ContactType.html +2 -2
- package/docs/types/ContactURI.html +2 -2
- package/docs/types/DetailedContactItem.html +16 -0
- package/docs/types/HostType.html +2 -2
- package/docs/types/IPCContext.html +2 -2
- package/docs/types/IpcProtocolVersion.html +2 -2
- package/docs/types/UnsubscribeCallback.html +2 -2
- package/docs/types/UriContactItem.html +3 -0
- package/lib/index.d.ts +254 -33
- package/lib/ipc-sdk.js +944 -538
- package/lib/ipc-sdk.js.map +1 -1
- package/lib/ipc-sdk.umd.cjs +3 -3
- package/lib/ipc-sdk.umd.cjs.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +3 -3
- package/docs/assets/icons.js +0 -15
- package/docs/assets/icons.svg +0 -1
- package/docs/hierarchy.html +0 -1
- package/docs/interfaces/BaseContactItem.html +0 -8
- package/docs/interfaces/CloudUsernameContactItem.html +0 -10
- package/docs/interfaces/DetailedContactItem.html +0 -17
- package/docs/interfaces/UriContactItem.html +0 -10
package/lib/index.d.ts
CHANGED
|
@@ -3,11 +3,57 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @public
|
|
5
5
|
*/
|
|
6
|
-
export declare
|
|
6
|
+
export declare type BaseContactItem = {
|
|
7
|
+
/**
|
|
8
|
+
* Unique ID for the contact item.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This value is required since v2.1.
|
|
12
|
+
*
|
|
13
|
+
* @since 2.1
|
|
14
|
+
*/
|
|
15
|
+
contactId?: string;
|
|
7
16
|
/**
|
|
8
17
|
* Type of contact item.
|
|
9
18
|
*/
|
|
10
19
|
type: ContactType;
|
|
20
|
+
/**
|
|
21
|
+
* Cloud ID associated with the contact.
|
|
22
|
+
*
|
|
23
|
+
* @deprecated Use {@link CloudContact.cloudId} instead.
|
|
24
|
+
*/
|
|
25
|
+
cloudId?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Network ID for the contact.
|
|
28
|
+
*
|
|
29
|
+
* @deprecated Use {@link CloudContact.networkId} instead.
|
|
30
|
+
*/
|
|
31
|
+
networkId?: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Use unified DetailedContactItem instead
|
|
36
|
+
*/
|
|
37
|
+
declare type BaseDetailedContactItem = {
|
|
38
|
+
type: 'cloudUsername' | 'uri';
|
|
39
|
+
contactId?: string;
|
|
40
|
+
cloudId: string;
|
|
41
|
+
networkId: string;
|
|
42
|
+
displayName?: string;
|
|
43
|
+
profilePictureUrl?: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Defines cloud-username contact information.
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
* @since 2.1
|
|
51
|
+
*/
|
|
52
|
+
declare type CloudContact = {
|
|
53
|
+
/**
|
|
54
|
+
* Cloud username associated with the contact.
|
|
55
|
+
*/
|
|
56
|
+
cloudUsername: string;
|
|
11
57
|
/**
|
|
12
58
|
* Cloud ID associated with the contact.
|
|
13
59
|
*/
|
|
@@ -16,27 +62,55 @@ export declare interface BaseContactItem {
|
|
|
16
62
|
* Network ID for the contact.
|
|
17
63
|
*/
|
|
18
64
|
networkId: string;
|
|
19
|
-
}
|
|
65
|
+
};
|
|
20
66
|
|
|
21
67
|
/**
|
|
22
68
|
* Defines the properties of a CloudUsername based contact item.
|
|
23
69
|
*
|
|
24
70
|
* @public
|
|
25
71
|
*/
|
|
26
|
-
export declare
|
|
72
|
+
export declare type CloudUsernameContactItem = BaseContactItem & {
|
|
27
73
|
type: 'cloudUsername';
|
|
74
|
+
/**
|
|
75
|
+
* Cloud user associated with the contact.
|
|
76
|
+
*
|
|
77
|
+
* @since 2.1
|
|
78
|
+
*/
|
|
79
|
+
contactUser: CloudContact;
|
|
28
80
|
/**
|
|
29
81
|
* Cloud username associated with the contact.
|
|
82
|
+
*
|
|
83
|
+
* @deprecated Use {@link CloudContact.cloudUsername} instead.
|
|
30
84
|
*/
|
|
85
|
+
cloudUsername?: string;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated Use unified DetailedContactItem instead
|
|
90
|
+
*/
|
|
91
|
+
declare type CloudUsernameDetailedContactItem = BaseDetailedContactItem & {
|
|
92
|
+
type: 'cloudUsername';
|
|
31
93
|
cloudUsername: string;
|
|
32
|
-
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Defines an email for a contact item.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* const email1 = 'test@example.com';
|
|
102
|
+
* const email2 = 'test@example.com';
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
declare type ContactEmail = `${string}@${string}`;
|
|
33
107
|
|
|
34
108
|
/**
|
|
35
|
-
* Represents either a CloudUsername or Sip URI based contact item.
|
|
109
|
+
* Represents either a CloudUsername, Number or Sip URI based contact item.
|
|
36
110
|
*
|
|
37
111
|
* @public
|
|
38
112
|
*/
|
|
39
|
-
export declare type ContactItem = CloudUsernameContactItem | UriContactItem;
|
|
113
|
+
export declare type ContactItem = CloudUsernameContactItem | UriContactItem | NumberContactItem | EmailContactItem;
|
|
40
114
|
|
|
41
115
|
/**
|
|
42
116
|
* Label of contact being described.
|
|
@@ -45,12 +119,25 @@ export declare type ContactItem = CloudUsernameContactItem | UriContactItem;
|
|
|
45
119
|
*/
|
|
46
120
|
export declare type ContactLabel = 'home' | 'work' | 'mobile' | 'other';
|
|
47
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Defines a number for a contact item. Number should be in E.164 format.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* const number1 = '1234567890';
|
|
128
|
+
* const number2 = '+1234567890';
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
declare type ContactNumber = `${number}` | `+${number}`;
|
|
134
|
+
|
|
48
135
|
/**
|
|
49
136
|
* Defines a basic Contact Item type.
|
|
50
137
|
*
|
|
51
138
|
* @public
|
|
52
139
|
*/
|
|
53
|
-
export declare type ContactType = 'cloudUsername' | 'uri';
|
|
140
|
+
export declare type ContactType = 'cloudUsername' | 'uri' | 'number' | 'email';
|
|
54
141
|
|
|
55
142
|
/**
|
|
56
143
|
* Defines a URI for a contact item.
|
|
@@ -63,35 +150,46 @@ export declare type ContactType = 'cloudUsername' | 'uri';
|
|
|
63
150
|
*
|
|
64
151
|
* @public
|
|
65
152
|
*/
|
|
66
|
-
export declare type ContactURI = `sip:${string}` | `tel:${
|
|
153
|
+
export declare type ContactURI = `sip:${string}` | `tel:${ContactNumber}` | `sips:${string}` | `tels:${ContactNumber}`;
|
|
67
154
|
|
|
68
155
|
/**
|
|
69
|
-
* Defines
|
|
70
|
-
* SIP URIs and contact type etc.
|
|
156
|
+
* Defines an email and its associated label.
|
|
71
157
|
*
|
|
72
158
|
* @public
|
|
159
|
+
* @since 2.1
|
|
73
160
|
*/
|
|
74
|
-
|
|
161
|
+
declare type DetailedContactEmail = {
|
|
75
162
|
/**
|
|
76
|
-
*
|
|
163
|
+
* Email associated with the contact.
|
|
77
164
|
*/
|
|
78
|
-
|
|
165
|
+
email: ContactEmail;
|
|
79
166
|
/**
|
|
80
|
-
*
|
|
167
|
+
* Label associated with this email.
|
|
81
168
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
169
|
+
label: ContactLabel;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Defines a unified contact item with all possible contact methods.
|
|
174
|
+
* At least one contact method (contactUser, uri, or numbers) should be defined.
|
|
175
|
+
*
|
|
176
|
+
* @remarks
|
|
177
|
+
* This is a unified type that replaces the previous union type of different contact subtypes.
|
|
178
|
+
* For backward compatibility, the contactId field is optional but it is required since v2.1.
|
|
179
|
+
*
|
|
180
|
+
* @public
|
|
181
|
+
* @since 2.1
|
|
182
|
+
*/
|
|
183
|
+
export declare type DetailedContactItem = {
|
|
91
184
|
/**
|
|
92
|
-
*
|
|
185
|
+
* Unique ID for the contact item.
|
|
186
|
+
*
|
|
187
|
+
* @remarks
|
|
188
|
+
* This value is required since v2.1.
|
|
189
|
+
*
|
|
190
|
+
* @since 2.1
|
|
93
191
|
*/
|
|
94
|
-
|
|
192
|
+
contactId?: string;
|
|
95
193
|
/**
|
|
96
194
|
* Name of the contact entry.
|
|
97
195
|
*/
|
|
@@ -100,16 +198,49 @@ export declare interface DetailedContactItem {
|
|
|
100
198
|
* An optional URL for the contact's profile picture.
|
|
101
199
|
*/
|
|
102
200
|
profilePictureUrl?: string;
|
|
103
|
-
|
|
201
|
+
/**
|
|
202
|
+
* Cloud contact information.
|
|
203
|
+
* Contains cloudUsername, cloudId, and networkId.
|
|
204
|
+
*/
|
|
205
|
+
contactUser?: CloudContact;
|
|
206
|
+
/**
|
|
207
|
+
* URIs associated with the contact.
|
|
208
|
+
*/
|
|
209
|
+
uri?: DetailedContactURI[];
|
|
210
|
+
/**
|
|
211
|
+
* Numbers associated with the contact.
|
|
212
|
+
*/
|
|
213
|
+
numbers?: DetailedContactNumber[];
|
|
214
|
+
/**
|
|
215
|
+
* Emails associated with the contact.
|
|
216
|
+
*/
|
|
217
|
+
emails?: DetailedContactEmail[];
|
|
218
|
+
};
|
|
104
219
|
|
|
105
220
|
/**
|
|
106
|
-
* Defines a
|
|
221
|
+
* Defines a number and its associated label.
|
|
222
|
+
*
|
|
223
|
+
* @public
|
|
224
|
+
*/
|
|
225
|
+
declare type DetailedContactNumber = {
|
|
226
|
+
/**
|
|
227
|
+
* Number associated with the contact.
|
|
228
|
+
*/
|
|
229
|
+
number: ContactNumber;
|
|
230
|
+
/**
|
|
231
|
+
* Label associated with this number.
|
|
232
|
+
*/
|
|
233
|
+
label: ContactLabel;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Defines a SIP URI and its associated label.
|
|
107
238
|
*
|
|
108
239
|
* @public
|
|
109
240
|
*/
|
|
110
241
|
export declare interface DetailedContactURI {
|
|
111
242
|
/**
|
|
112
|
-
* URI
|
|
243
|
+
* URI associated with the contact with prefix (e.g. sip: or tel:)
|
|
113
244
|
*/
|
|
114
245
|
uri: ContactURI;
|
|
115
246
|
/**
|
|
@@ -118,6 +249,19 @@ export declare interface DetailedContactURI {
|
|
|
118
249
|
label: ContactLabel;
|
|
119
250
|
}
|
|
120
251
|
|
|
252
|
+
/**
|
|
253
|
+
* Defines the properties of an email based contact item.
|
|
254
|
+
*
|
|
255
|
+
* @public
|
|
256
|
+
*/
|
|
257
|
+
declare type EmailContactItem = BaseContactItem & {
|
|
258
|
+
type: 'email';
|
|
259
|
+
/**
|
|
260
|
+
* Email associated with the contact.
|
|
261
|
+
*/
|
|
262
|
+
emails: ContactEmail[];
|
|
263
|
+
};
|
|
264
|
+
|
|
121
265
|
/**
|
|
122
266
|
* Type of the Host app. Valid values are only `webrtc`, `desktop`, `ios`, `android`, `ios_jitsi`
|
|
123
267
|
* and `electron`.
|
|
@@ -169,7 +313,11 @@ export declare const enum IPCEvents {
|
|
|
169
313
|
/**
|
|
170
314
|
* Event that is fired when the `Host` app sends a new PUSH TOKEN.
|
|
171
315
|
*/
|
|
172
|
-
PushToken = "PUSH TOKEN"
|
|
316
|
+
PushToken = "PUSH TOKEN",
|
|
317
|
+
/**
|
|
318
|
+
* Event that is fired when the `Host` app sends a REQUEST LOGS event.
|
|
319
|
+
*/
|
|
320
|
+
RequestLogs = "REQUEST LOGS"
|
|
173
321
|
}
|
|
174
322
|
|
|
175
323
|
/**
|
|
@@ -238,6 +386,21 @@ export declare class IPCManager {
|
|
|
238
386
|
/**
|
|
239
387
|
* Requests the `Host` app to open the contact selection UI.
|
|
240
388
|
*
|
|
389
|
+
* @param corelationId - An identifier for the message stream
|
|
390
|
+
* @param options - Configuration options for contact selection:
|
|
391
|
+
* - `mode`: Whether to allow 'single' or 'multi' contact selection
|
|
392
|
+
* - `currentContacts`: For multi-select mode, the list of currently selected contacts
|
|
393
|
+
* - `contactType`: The type of contacts to select ('cloudUsername' or 'uri'). Defaults to 'cloudUsername'
|
|
394
|
+
* - `includeOffNetworkContacts`: Whether to include contacts not on the network. Defaults to false
|
|
395
|
+
*
|
|
396
|
+
* @returns A collection of {@link ContactItem} objects which the user selected
|
|
397
|
+
*/
|
|
398
|
+
selectContacts(corelationId: number, options: SelectContactsOptions): Promise<ContactItem[]>;
|
|
399
|
+
/**
|
|
400
|
+
* Requests the `Host` app to open the contact selection UI.
|
|
401
|
+
*
|
|
402
|
+
* @deprecated Use the `selectContacts` method with the `options` parameter instead.
|
|
403
|
+
*
|
|
241
404
|
* @remarks
|
|
242
405
|
* When requesting a `single` contact, the `Host` app will return immediately
|
|
243
406
|
* after contact selection.
|
|
@@ -254,6 +417,8 @@ export declare class IPCManager {
|
|
|
254
417
|
/**
|
|
255
418
|
* Requests the `Host` app to open the contact selection UI.
|
|
256
419
|
*
|
|
420
|
+
* @deprecated Use the `selectContacts` method with the `options` parameter instead.
|
|
421
|
+
*
|
|
257
422
|
* @remarks
|
|
258
423
|
* When requesting a `multi` contact, the user will have to manually close the contact selection
|
|
259
424
|
* UI. The `Host` app will return the selected contacts when the user closes the UI.
|
|
@@ -272,6 +437,8 @@ export declare class IPCManager {
|
|
|
272
437
|
* `corelationId`.
|
|
273
438
|
*/
|
|
274
439
|
selectContacts(corelationId: number, mode: 'multi', currentContacts: ContactItem[], contactType?: ContactType): Promise<ContactItem[]>;
|
|
440
|
+
private selectContacts_V2_0;
|
|
441
|
+
private selectContacts_V2_1;
|
|
275
442
|
/**
|
|
276
443
|
* Matches batch of {@link ContactItem} objects against the Host's contact list to fetch detailed
|
|
277
444
|
* contact information.
|
|
@@ -281,7 +448,7 @@ export declare class IPCManager {
|
|
|
281
448
|
* @returns A collection of {@link DetailedContactItem} objects which were matched against the
|
|
282
449
|
* Host's contact list.
|
|
283
450
|
*/
|
|
284
|
-
matchContacts(contacts: ContactItem[]): Promise<DetailedContactItem[]>;
|
|
451
|
+
matchContacts(contacts: ContactItem[]): Promise<Record<string, DetailedContactItem | null | undefined> | CloudUsernameDetailedContactItem[]>;
|
|
285
452
|
/**
|
|
286
453
|
* Requests the `Host` app to provide the Push Token for the current device.
|
|
287
454
|
*
|
|
@@ -309,6 +476,25 @@ export declare class IPCManager {
|
|
|
309
476
|
* @remarks
|
|
310
477
|
* Any additional data to be posted alongside the URL is included with the `data` parameter.
|
|
311
478
|
*
|
|
479
|
+
* @example
|
|
480
|
+
*
|
|
481
|
+
* ```ts
|
|
482
|
+
* // import the IPCManager
|
|
483
|
+
* import { IPCManager } from '@acrobits/ipc-sdk';
|
|
484
|
+
*
|
|
485
|
+
* // create an instance of IPCManager
|
|
486
|
+
* const manager = new IPCManager();
|
|
487
|
+
*
|
|
488
|
+
* // open the URL with additional data
|
|
489
|
+
* const url = 'https://example.com';
|
|
490
|
+
* const data = {
|
|
491
|
+
* name: 'John Doe',
|
|
492
|
+
* age: 30
|
|
493
|
+
* };
|
|
494
|
+
*
|
|
495
|
+
* manager.openUrl(url, data);
|
|
496
|
+
* ```
|
|
497
|
+
*
|
|
312
498
|
* @param url - URL to open in the external browser
|
|
313
499
|
* @param data - _Optional_. Any additional data to be sent along with the URL
|
|
314
500
|
*/
|
|
@@ -352,6 +538,22 @@ export declare class IPCManager {
|
|
|
352
538
|
* @returns An unsubscribe callback to remove the listener.
|
|
353
539
|
*/
|
|
354
540
|
onPushToken(callback: (token: string, appId: string, selector: string) => void): () => boolean | undefined;
|
|
541
|
+
/**
|
|
542
|
+
* Registers a callback to be invoked when a {@link IPCEvents.RequestLogs} event is received.
|
|
543
|
+
*
|
|
544
|
+
* @remarks
|
|
545
|
+
* The Host app can request logs from the Client app by sending a RequestLogs event. The callback
|
|
546
|
+
* will receive a skipCompression parameter indicating whether the logs should be compressed or not.
|
|
547
|
+
*
|
|
548
|
+
* When skipCompression is true, the logs should be sent uncompressed. When false or undefined,
|
|
549
|
+
* the logs should be compressed before sending.
|
|
550
|
+
*
|
|
551
|
+
* @param callback - A callback function to be invoked when a {@link IPCEvents.RequestLogs} event
|
|
552
|
+
* is received. The callback receives an optional skipCompression parameter.
|
|
553
|
+
*
|
|
554
|
+
* @returns An unsubscribe callback to remove the listener.
|
|
555
|
+
*/
|
|
556
|
+
onRequestLogsMessage(callback: (skipCompression?: boolean) => void): () => boolean | undefined;
|
|
355
557
|
private evaluateContext;
|
|
356
558
|
}
|
|
357
559
|
|
|
@@ -360,7 +562,26 @@ export declare class IPCManager {
|
|
|
360
562
|
*
|
|
361
563
|
* @public
|
|
362
564
|
*/
|
|
363
|
-
export declare type IpcProtocolVersion = '0.1' | '0.2' | '0.3' | '0.4' | '0.5' | '0.6' | '0.7' | '0.8' | '0.9' | '0.10' | '2.0';
|
|
565
|
+
export declare type IpcProtocolVersion = '0.1' | '0.2' | '0.3' | '0.4' | '0.5' | '0.6' | '0.7' | '0.8' | '0.9' | '0.10' | '2.0' | '2.1';
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Defines the properties of a number based contact item.
|
|
569
|
+
*
|
|
570
|
+
* @public
|
|
571
|
+
*/
|
|
572
|
+
declare type NumberContactItem = BaseContactItem & {
|
|
573
|
+
type: 'number';
|
|
574
|
+
/**
|
|
575
|
+
* Number associated with the contact.
|
|
576
|
+
*/
|
|
577
|
+
numbers: ContactNumber[];
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
declare type SelectContactsOptions = {
|
|
581
|
+
mode: 'single' | 'multi';
|
|
582
|
+
currentContacts?: ContactItem[];
|
|
583
|
+
resultTypes?: ContactType[];
|
|
584
|
+
};
|
|
364
585
|
|
|
365
586
|
/**
|
|
366
587
|
* A callback function to unsubscribe the registered listener.
|
|
@@ -374,12 +595,12 @@ export declare type UnsubscribeCallback = () => void;
|
|
|
374
595
|
*
|
|
375
596
|
* @public
|
|
376
597
|
*/
|
|
377
|
-
export declare
|
|
598
|
+
export declare type UriContactItem = BaseContactItem & {
|
|
378
599
|
type: 'uri';
|
|
379
600
|
/**
|
|
380
601
|
* URI or number associated with the contact with prefix (e.g. sip: or tel:)
|
|
381
602
|
*/
|
|
382
603
|
uri: ContactURI;
|
|
383
|
-
}
|
|
604
|
+
};
|
|
384
605
|
|
|
385
606
|
export { }
|