@wildix/xbees-connect 1.2.33 → 1.2.34-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/dist-cjs/package.json +1 -1
- package/dist-cjs/src/Client.js +9 -5
- package/dist-cjs/src/enums/index.js +2 -1
- package/dist-es/package.json +1 -1
- package/dist-es/src/Client.js +9 -5
- package/dist-es/src/enums/index.js +2 -1
- package/dist-types/src/Client.d.ts +7 -2
- package/dist-types/src/enums/index.d.ts +3 -2
- package/dist-types/types/Client.d.ts +10 -3
- package/dist-types/types/Event.d.ts +2 -2
- package/dist-types/types/Json.d.ts +1 -2
- package/dist-types/types/Payload.d.ts +6 -5
- package/package.json +2 -2
package/dist-cjs/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.34-alpha.0",
|
|
4
4
|
"description": "This library provides easy communication between x-bees and integrated web applications",
|
|
5
5
|
"author": "dimitri.chernykh <dimitri.chernykh@wildix.com>",
|
|
6
6
|
"homepage": "",
|
package/dist-cjs/src/Client.js
CHANGED
|
@@ -371,10 +371,14 @@ class Client {
|
|
|
371
371
|
}
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
|
-
createContactIsSupported(
|
|
374
|
+
createContactIsSupported() {
|
|
375
375
|
return this.sendAsync({
|
|
376
376
|
type: enums_1.ClientEventType.CREATE_CONTACT_IS_SUPPORTED,
|
|
377
|
-
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
createContactHasPermission() {
|
|
380
|
+
return this.sendAsync({
|
|
381
|
+
type: enums_1.ClientEventType.CREATE_CONTACT_HAS_PERMISSION,
|
|
378
382
|
});
|
|
379
383
|
}
|
|
380
384
|
onThemeChange(callback) {
|
|
@@ -438,10 +442,10 @@ class Client {
|
|
|
438
442
|
payload: { key },
|
|
439
443
|
});
|
|
440
444
|
}
|
|
441
|
-
|
|
445
|
+
sendCustomEvent({ type, payload }) {
|
|
442
446
|
void this.sendAsync({
|
|
443
|
-
type: enums_1.ClientEventType.
|
|
444
|
-
payload: {
|
|
447
|
+
type: enums_1.ClientEventType.CUSTOM_EVENT,
|
|
448
|
+
payload: { type, payload },
|
|
445
449
|
});
|
|
446
450
|
}
|
|
447
451
|
}
|
|
@@ -48,8 +48,9 @@ var ClientEventType;
|
|
|
48
48
|
ClientEventType["GET_FROM_STORAGE"] = "xBeesRequestFromStorage";
|
|
49
49
|
ClientEventType["REMOVE_FROM_STORAGE"] = "xBeesRemoveFromStorage";
|
|
50
50
|
ClientEventType["AVAILABLE_CONTACT_DATA"] = "xBeesAvailableContactData";
|
|
51
|
-
ClientEventType["
|
|
51
|
+
ClientEventType["CUSTOM_EVENT"] = "xBeesCustomEvent";
|
|
52
52
|
ClientEventType["CREATE_CONTACT_IS_SUPPORTED"] = "xBeesCreateContactIsSupported";
|
|
53
|
+
ClientEventType["CREATE_CONTACT_HAS_PERMISSION"] = "xBeesCreateContactHasPermission";
|
|
53
54
|
})(ClientEventType || (exports.ClientEventType = ClientEventType = {}));
|
|
54
55
|
var UrlParams;
|
|
55
56
|
(function (UrlParams) {
|
package/dist-es/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.34-alpha.0",
|
|
4
4
|
"description": "This library provides easy communication between x-bees and integrated web applications",
|
|
5
5
|
"author": "dimitri.chernykh <dimitri.chernykh@wildix.com>",
|
|
6
6
|
"homepage": "",
|
package/dist-es/src/Client.js
CHANGED
|
@@ -365,10 +365,14 @@ export class Client {
|
|
|
365
365
|
}
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
|
-
createContactIsSupported(
|
|
368
|
+
createContactIsSupported() {
|
|
369
369
|
return this.sendAsync({
|
|
370
370
|
type: ClientEventType.CREATE_CONTACT_IS_SUPPORTED,
|
|
371
|
-
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
createContactHasPermission() {
|
|
374
|
+
return this.sendAsync({
|
|
375
|
+
type: ClientEventType.CREATE_CONTACT_HAS_PERMISSION,
|
|
372
376
|
});
|
|
373
377
|
}
|
|
374
378
|
onThemeChange(callback) {
|
|
@@ -432,10 +436,10 @@ export class Client {
|
|
|
432
436
|
payload: { key },
|
|
433
437
|
});
|
|
434
438
|
}
|
|
435
|
-
|
|
439
|
+
sendCustomEvent({ type, payload }) {
|
|
436
440
|
void this.sendAsync({
|
|
437
|
-
type: ClientEventType.
|
|
438
|
-
payload: {
|
|
441
|
+
type: ClientEventType.CUSTOM_EVENT,
|
|
442
|
+
payload: { type, payload },
|
|
439
443
|
});
|
|
440
444
|
}
|
|
441
445
|
}
|
|
@@ -45,8 +45,9 @@ export var ClientEventType;
|
|
|
45
45
|
ClientEventType["GET_FROM_STORAGE"] = "xBeesRequestFromStorage";
|
|
46
46
|
ClientEventType["REMOVE_FROM_STORAGE"] = "xBeesRemoveFromStorage";
|
|
47
47
|
ClientEventType["AVAILABLE_CONTACT_DATA"] = "xBeesAvailableContactData";
|
|
48
|
-
ClientEventType["
|
|
48
|
+
ClientEventType["CUSTOM_EVENT"] = "xBeesCustomEvent";
|
|
49
49
|
ClientEventType["CREATE_CONTACT_IS_SUPPORTED"] = "xBeesCreateContactIsSupported";
|
|
50
|
+
ClientEventType["CREATE_CONTACT_HAS_PERMISSION"] = "xBeesCreateContactHasPermission";
|
|
50
51
|
})(ClientEventType || (ClientEventType = {}));
|
|
51
52
|
export var UrlParams;
|
|
52
53
|
(function (UrlParams) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Callback, ConnectClient, Contact, ContactQuery, IPayloadViewPort, LookupAndMatchContactsResolver, Message, Reject, RemoveEventListener, ResponseMessage, StorageEventCallback, SuggestContactsResolver, SupportedPlatformVariant, ToastSeverity, XBeesUser } from '../types';
|
|
2
2
|
import { ReadyExtendedProps } from '../types/Event';
|
|
3
|
+
import { JSONValue } from '../types/Json';
|
|
3
4
|
import { LookupAndMatchBatchContactsResolver } from '../types/Resolver';
|
|
4
5
|
import { ClientEventType, EventType, StartPage } from './enums';
|
|
5
6
|
import TechnicalSupport from './helpers/TechnicalSupport';
|
|
@@ -78,7 +79,8 @@ export declare class Client implements ConnectClient {
|
|
|
78
79
|
onSuggestContacts(callback: (query: string, resolve: SuggestContactsResolver, reject: Reject) => void): RemoveEventListener;
|
|
79
80
|
onLookupAndMatchContact(callback: (query: ContactQuery, resolve: LookupAndMatchContactsResolver, reject: Reject) => void): RemoveEventListener;
|
|
80
81
|
onLookupAndMatchBatchContacts(callback: (query: ContactQuery[], returnResults: LookupAndMatchBatchContactsResolver) => void): RemoveEventListener;
|
|
81
|
-
createContactIsSupported(
|
|
82
|
+
createContactIsSupported(): Promise<ResponseMessage>;
|
|
83
|
+
createContactHasPermission(): Promise<ResponseMessage>;
|
|
82
84
|
onThemeChange(callback: Callback<EventType.USE_THEME>): RemoveEventListener;
|
|
83
85
|
getFromStorage<Type>(key: string): Type | null;
|
|
84
86
|
saveToStorage<SavingType>(key: string, value: SavingType): void;
|
|
@@ -92,5 +94,8 @@ export declare class Client implements ConnectClient {
|
|
|
92
94
|
saveInXbeesStorage<SavingType>(key: string, value: SavingType): void;
|
|
93
95
|
getFromXbeesStorage(key: string): Promise<ResponseMessage<ClientEventType.GET_FROM_STORAGE>>;
|
|
94
96
|
removeFromXbeesStorage(key: string): void;
|
|
95
|
-
|
|
97
|
+
sendCustomEvent({ type, payload }: {
|
|
98
|
+
type: string;
|
|
99
|
+
payload?: JSONValue;
|
|
100
|
+
}): void;
|
|
96
101
|
}
|
|
@@ -43,8 +43,9 @@ export declare enum ClientEventType {
|
|
|
43
43
|
GET_FROM_STORAGE = "xBeesRequestFromStorage",
|
|
44
44
|
REMOVE_FROM_STORAGE = "xBeesRemoveFromStorage",
|
|
45
45
|
AVAILABLE_CONTACT_DATA = "xBeesAvailableContactData",
|
|
46
|
-
|
|
47
|
-
CREATE_CONTACT_IS_SUPPORTED = "xBeesCreateContactIsSupported"
|
|
46
|
+
CUSTOM_EVENT = "xBeesCustomEvent",
|
|
47
|
+
CREATE_CONTACT_IS_SUPPORTED = "xBeesCreateContactIsSupported",
|
|
48
|
+
CREATE_CONTACT_HAS_PERMISSION = "xBeesCreateContactHasPermission"
|
|
48
49
|
}
|
|
49
50
|
export declare enum UrlParams {
|
|
50
51
|
TOKEN = "t",
|
|
@@ -3,6 +3,7 @@ import TechnicalSupport from '../src/helpers/TechnicalSupport';
|
|
|
3
3
|
import { Callback } from './Callback';
|
|
4
4
|
import { Contact, ContactQuery } from './Contact';
|
|
5
5
|
import { ReadyExtendedProps } from './Event';
|
|
6
|
+
import { JSONValue } from './Json';
|
|
6
7
|
import { RemoveEventListener } from './Listener';
|
|
7
8
|
import { ResponseMessage } from './Message';
|
|
8
9
|
import { IPayloadViewPort } from './Payload';
|
|
@@ -140,7 +141,10 @@ export interface ConnectClient {
|
|
|
140
141
|
onLookupAndMatchBatchContacts: (callback: (queries: ContactQuery[], returnResults: LookupAndMatchBatchContactsResolver) => void) => RemoveEventListener;
|
|
141
142
|
/**
|
|
142
143
|
* Send event for indicate if create contact functionality is supported */
|
|
143
|
-
createContactIsSupported: (
|
|
144
|
+
createContactIsSupported: () => Promise<ResponseMessage>;
|
|
145
|
+
/**
|
|
146
|
+
* Send event for indicate if user has permission to create contact */
|
|
147
|
+
createContactHasPermission: () => Promise<ResponseMessage>;
|
|
144
148
|
/**
|
|
145
149
|
* Starts listen for the events of starting the call and handle with the provided callback */
|
|
146
150
|
onCallStarted: (callback: Callback<EventType.ADD_CALL>) => RemoveEventListener;
|
|
@@ -190,7 +194,10 @@ export interface ConnectClient {
|
|
|
190
194
|
* Remove data from x-bees storage */
|
|
191
195
|
removeFromXbeesStorage: (key: string) => void;
|
|
192
196
|
/**
|
|
193
|
-
* Send to xbees
|
|
197
|
+
* Send to xbees custom event with eventType and payload
|
|
194
198
|
*/
|
|
195
|
-
|
|
199
|
+
sendCustomEvent: ({ type, payload }: {
|
|
200
|
+
type: string;
|
|
201
|
+
payload?: JSONValue;
|
|
202
|
+
}) => void;
|
|
196
203
|
}
|
|
@@ -2,10 +2,10 @@ import { ClientEventType, EventType } from '../src/enums';
|
|
|
2
2
|
import { AvailableContactData } from './AvailableContactData';
|
|
3
3
|
import { ContactQuery } from './Contact';
|
|
4
4
|
import { Message, MessageType } from './Message';
|
|
5
|
-
import { IPayloadAutoSuggestResult, IPayloadBatchContactsMatchResult, IPayloadBatchContactsMatchResultError, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContextResult, IPayloadConversationResult,
|
|
5
|
+
import { IPayloadAutoSuggestResult, IPayloadBatchContactsMatchResult, IPayloadBatchContactsMatchResultError, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContextResult, IPayloadConversationResult, IPayloadCustomEvent, IPayloadGetFromStorage, IPayloadSaveToStorage, IPayloadSendAnalytics, IPayloadTechSupport, IPayloadThemeChange, IPayloadToast, IPayloadVersion, IPayloadViewPort } from './Payload';
|
|
6
6
|
import { SupportedPlatformVariant } from './Platform';
|
|
7
7
|
import { XBeesUser } from './XBeesUser';
|
|
8
|
-
export type EventPayload<T extends MessageType> = T extends EventType.GET_CONTACTS_AUTO_SUGGEST ? string : T extends ClientEventType.CONTACTS_AUTO_SUGGEST ? IPayloadAutoSuggestResult : T extends ClientEventType.CONTACT_LOOKUP_AND_MATCH | ClientEventType.CONTACT_CREATE_OR_UPDATE | ClientEventType.CONTACT_MATCH_UPDATE ? IPayloadContactMatchResult : T extends ClientEventType.CONTACT_LOOKUP_AND_MATCH_NOT_FOUND ? IPayloadContactMatchResultNotFound : T extends ClientEventType.LOOKUP_AND_MATCH_BATCH_ERROR ? IPayloadBatchContactsMatchResultError : T extends ClientEventType.CONTEXT ? IPayloadContextResult : T extends ClientEventType.CURRENT_CONTACT ? IPayloadContactResult : T extends ClientEventType.CURRENT_CONVERSATION ? IPayloadConversationResult : T extends EventType.ADD_CALL ? IPayloadCallStartedInfo : T extends ClientEventType.START_CALL ? IPayloadCallStart : T extends ClientEventType.READY ? IPayloadVersion : T extends ClientEventType.VIEW_PORT ? IPayloadViewPort : T extends ClientEventType.THEME ? IPayloadThemeChange : T extends EventType.USE_THEME ? IPayloadThemeChange : T extends ClientEventType.TOAST ? IPayloadToast : T extends ClientEventType.SEND_ANALYTICS ? IPayloadSendAnalytics : T extends ClientEventType.SEND_TECHNICAL_SUPPORT_INFORMATION ? IPayloadTechSupport : T extends EventType.PBX_TOKEN ? string : T extends ClientEventType.TOKEN ? string : T extends ClientEventType.TO_CLIPBOARD ? string : T extends EventType.GET_LOOK_UP_AND_MATCH ? ContactQuery : T extends EventType.GET_LOOK_UP_AND_MATCH_BATCH ? ContactQuery[] : T extends EventType.VISIBILITY ? boolean : T extends ClientEventType.USER ? XBeesUser : T extends ClientEventType.SAVE_TO_STORAGE ? IPayloadSaveToStorage : T extends ClientEventType.GET_FROM_STORAGE ? IPayloadGetFromStorage : T extends ClientEventType.REMOVE_FROM_STORAGE ? IPayloadGetFromStorage : T extends ClientEventType.AVAILABLE_CONTACT_DATA ? AvailableContactData | null : T extends ClientEventType.LOOK_UP_AND_MATCH_BATCH_CONTACTS ? IPayloadBatchContactsMatchResult : T extends ClientEventType.
|
|
8
|
+
export type EventPayload<T extends MessageType> = T extends EventType.GET_CONTACTS_AUTO_SUGGEST ? string : T extends ClientEventType.CONTACTS_AUTO_SUGGEST ? IPayloadAutoSuggestResult : T extends ClientEventType.CONTACT_LOOKUP_AND_MATCH | ClientEventType.CONTACT_CREATE_OR_UPDATE | ClientEventType.CONTACT_MATCH_UPDATE ? IPayloadContactMatchResult : T extends ClientEventType.CONTACT_LOOKUP_AND_MATCH_NOT_FOUND ? IPayloadContactMatchResultNotFound : T extends ClientEventType.LOOKUP_AND_MATCH_BATCH_ERROR ? IPayloadBatchContactsMatchResultError : T extends ClientEventType.CONTEXT ? IPayloadContextResult : T extends ClientEventType.CURRENT_CONTACT ? IPayloadContactResult : T extends ClientEventType.CURRENT_CONVERSATION ? IPayloadConversationResult : T extends EventType.ADD_CALL ? IPayloadCallStartedInfo : T extends ClientEventType.START_CALL ? IPayloadCallStart : T extends ClientEventType.READY ? IPayloadVersion : T extends ClientEventType.VIEW_PORT ? IPayloadViewPort : T extends ClientEventType.THEME ? IPayloadThemeChange : T extends EventType.USE_THEME ? IPayloadThemeChange : T extends ClientEventType.TOAST ? IPayloadToast : T extends ClientEventType.SEND_ANALYTICS ? IPayloadSendAnalytics : T extends ClientEventType.SEND_TECHNICAL_SUPPORT_INFORMATION ? IPayloadTechSupport : T extends EventType.PBX_TOKEN ? string : T extends ClientEventType.TOKEN ? string : T extends ClientEventType.TO_CLIPBOARD ? string : T extends EventType.GET_LOOK_UP_AND_MATCH ? ContactQuery : T extends EventType.GET_LOOK_UP_AND_MATCH_BATCH ? ContactQuery[] : T extends EventType.VISIBILITY ? boolean : T extends ClientEventType.USER ? XBeesUser : T extends ClientEventType.SAVE_TO_STORAGE ? IPayloadSaveToStorage : T extends ClientEventType.GET_FROM_STORAGE ? IPayloadGetFromStorage : T extends ClientEventType.REMOVE_FROM_STORAGE ? IPayloadGetFromStorage : T extends ClientEventType.AVAILABLE_CONTACT_DATA ? AvailableContactData | null : T extends ClientEventType.LOOK_UP_AND_MATCH_BATCH_CONTACTS ? IPayloadBatchContactsMatchResult : T extends ClientEventType.CUSTOM_EVENT ? IPayloadCustomEvent : never;
|
|
9
9
|
export type EventPayloadMap = {
|
|
10
10
|
[EventType.GET_CONTACTS_AUTO_SUGGEST]: string;
|
|
11
11
|
[EventType.GET_LOOK_UP_AND_MATCH]: ContactQuery;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
type JSONValue = string | number | boolean | null | JSONObject | JSONArray;
|
|
1
|
+
export type JSONValue = string | number | boolean | null | JSONObject | JSONArray;
|
|
2
2
|
export interface JSONObject {
|
|
3
3
|
[key: string]: JSONValue;
|
|
4
4
|
}
|
|
5
5
|
export interface JSONArray extends Array<JSONValue> {
|
|
6
6
|
}
|
|
7
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ClientParams from '../src/helpers/ClientParams';
|
|
2
2
|
import { Contact, ContactQuery } from './Contact';
|
|
3
3
|
import { Conversation } from './conversation';
|
|
4
|
-
import { JSONArray, JSONObject } from './Json';
|
|
4
|
+
import { JSONArray, JSONObject, JSONValue } from './Json';
|
|
5
5
|
import { SupportedPlatformVariant } from './Platform';
|
|
6
6
|
import { ToastSeverity } from './Toast';
|
|
7
7
|
export interface IPayloadViewPort {
|
|
@@ -50,8 +50,8 @@ export interface IPayloadContactMatchResultNotFound {
|
|
|
50
50
|
export interface IPayloadBatchContactsMatchResultError {
|
|
51
51
|
reason: string;
|
|
52
52
|
}
|
|
53
|
-
export interface
|
|
54
|
-
|
|
53
|
+
export interface IPayloadCreateContactHasPermission {
|
|
54
|
+
hasPermission: boolean;
|
|
55
55
|
}
|
|
56
56
|
export interface IPayloadContactResult {
|
|
57
57
|
contact: Contact;
|
|
@@ -77,7 +77,8 @@ export interface IPayloadTechSupport {
|
|
|
77
77
|
message: string;
|
|
78
78
|
data?: JSONObject | JSONArray;
|
|
79
79
|
}
|
|
80
|
-
export interface
|
|
81
|
-
|
|
80
|
+
export interface IPayloadCustomEvent {
|
|
81
|
+
type: string;
|
|
82
|
+
payload?: JSONValue;
|
|
82
83
|
}
|
|
83
84
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.34-alpha.0",
|
|
4
4
|
"description": "This library provides easy communication between x-bees and integrated web applications",
|
|
5
5
|
"author": "dimitri.chernykh <dimitri.chernykh@wildix.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=16"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "2dd79a03878a5403cd31cefc3cd2016229cf6e63"
|
|
49
49
|
}
|