@wildix/xbees-connect 1.3.15 → 1.3.17-alpha.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 +8 -0
- package/dist-cjs/package.json +1 -1
- package/dist-cjs/src/Client.js +6 -0
- package/dist-cjs/src/enums/index.js +1 -0
- package/dist-es/package.json +1 -1
- package/dist-es/src/Client.js +6 -0
- package/dist-es/src/enums/index.js +1 -0
- package/dist-types/src/Client.d.ts +2 -1
- package/dist-types/src/enums/index.d.ts +1 -0
- package/dist-types/types/Client.d.ts +6 -1
- package/dist-types/types/Event.d.ts +2 -2
- package/dist-types/types/Payload.d.ts +4 -1
- package/dist-types/types/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -516,6 +516,14 @@ Tells x-bees which chat or conversation should be opened (brought into focus). T
|
|
|
516
516
|
client.setChatToOpen('chat_id');
|
|
517
517
|
```
|
|
518
518
|
|
|
519
|
+
#### `getChannelsByEmailOrPhone(payload: IPayloadGetChannelsByEmailOrPhone): Promise<ResponseMessage>`
|
|
520
|
+
|
|
521
|
+
Asks x-bees to look up chat channels for an email address or phone number. The integration sends `ClientEventType.GET_CHANNELS_BY_EMAIL_OR_PHONE` (`xBeesGetChannelsByEmailOrPhone`) with payload `{ id, type }`, where `type` is `'email'` or `'phone'`. Resolves with a `ResponseMessage` whose payload contains the matching channels returned by x-bees.
|
|
522
|
+
|
|
523
|
+
```ts
|
|
524
|
+
const { payload } = await client.getChannelsByEmailOrPhone({ id: 'user@example.com', type: 'email' });
|
|
525
|
+
```
|
|
526
|
+
|
|
519
527
|
---
|
|
520
528
|
|
|
521
529
|
### Technical support
|
package/dist-cjs/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.17-alpha.1",
|
|
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
|
@@ -546,6 +546,12 @@ class Client {
|
|
|
546
546
|
payload: { chatId },
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
|
+
getChannelsByEmailOrPhone(payload) {
|
|
550
|
+
return this.sendAsync({
|
|
551
|
+
type: enums_1.ClientEventType.GET_CHANNELS_BY_EMAIL_OR_PHONE,
|
|
552
|
+
payload,
|
|
553
|
+
});
|
|
554
|
+
}
|
|
549
555
|
onContactWeightUpdate(callback) {
|
|
550
556
|
return this.addEventListener(enums_1.EventType.CONTACT_WEIGHT_UPDATE, callback);
|
|
551
557
|
}
|
|
@@ -58,6 +58,7 @@ var ClientEventType;
|
|
|
58
58
|
ClientEventType["DROPDOWN_VISIBILITY"] = "xBeesDropdownVisibility";
|
|
59
59
|
ClientEventType["CUSTOM_EVENT"] = "xBeesCustomEvent";
|
|
60
60
|
ClientEventType["SET_CHAT_TO_OPEN"] = "xBeesSetChatToOpen";
|
|
61
|
+
ClientEventType["GET_CHANNELS_BY_EMAIL_OR_PHONE"] = "xBeesGetChannelsByEmailOrPhone";
|
|
61
62
|
ClientEventType["CREATE_CONTACT_IS_SUPPORTED"] = "xBeesCreateContactIsSupported";
|
|
62
63
|
ClientEventType["CREATE_CONTACT_HAS_NO_PERMISSION"] = "xBeesCreateContactHasNoPermission";
|
|
63
64
|
ClientEventType["INTEGRATION_PROXY_RESPONSE"] = "xBeesIntegrationProxyResponse";
|
package/dist-es/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.17-alpha.1",
|
|
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
|
@@ -540,6 +540,12 @@ export class Client {
|
|
|
540
540
|
payload: { chatId },
|
|
541
541
|
});
|
|
542
542
|
}
|
|
543
|
+
getChannelsByEmailOrPhone(payload) {
|
|
544
|
+
return this.sendAsync({
|
|
545
|
+
type: ClientEventType.GET_CHANNELS_BY_EMAIL_OR_PHONE,
|
|
546
|
+
payload,
|
|
547
|
+
});
|
|
548
|
+
}
|
|
543
549
|
onContactWeightUpdate(callback) {
|
|
544
550
|
return this.addEventListener(EventType.CONTACT_WEIGHT_UPDATE, callback);
|
|
545
551
|
}
|
|
@@ -55,6 +55,7 @@ export var ClientEventType;
|
|
|
55
55
|
ClientEventType["DROPDOWN_VISIBILITY"] = "xBeesDropdownVisibility";
|
|
56
56
|
ClientEventType["CUSTOM_EVENT"] = "xBeesCustomEvent";
|
|
57
57
|
ClientEventType["SET_CHAT_TO_OPEN"] = "xBeesSetChatToOpen";
|
|
58
|
+
ClientEventType["GET_CHANNELS_BY_EMAIL_OR_PHONE"] = "xBeesGetChannelsByEmailOrPhone";
|
|
58
59
|
ClientEventType["CREATE_CONTACT_IS_SUPPORTED"] = "xBeesCreateContactIsSupported";
|
|
59
60
|
ClientEventType["CREATE_CONTACT_HAS_NO_PERMISSION"] = "xBeesCreateContactHasNoPermission";
|
|
60
61
|
ClientEventType["INTEGRATION_PROXY_RESPONSE"] = "xBeesIntegrationProxyResponse";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Callback, ConnectClient, Contact, ContactQuery, IntegrationProxyRequest, IPayloadViewPort, LookupAndMatchContactsResolver, Message, Reject, RemoveEventListener, ResponseMessage, StorageEventCallback, SuggestContactsResolver, SupportedPlatformVariant, ToastSeverity, XBeesUser } from '../types';
|
|
1
|
+
import { Callback, ConnectClient, Contact, ContactQuery, IntegrationProxyRequest, IPayloadGetChannelsByEmailOrPhone, IPayloadViewPort, LookupAndMatchContactsResolver, Message, Reject, RemoveEventListener, ResponseMessage, StorageEventCallback, SuggestContactsResolver, SupportedPlatformVariant, ToastSeverity, XBeesUser } from '../types';
|
|
2
2
|
import { ReadyExtendedProps } from '../types/Event';
|
|
3
3
|
import { JSONValue } from '../types/Json';
|
|
4
4
|
import { IntegrationProxyRequestResolver, LookupAndMatchBatchContactsResolver } from '../types/Resolver';
|
|
@@ -120,6 +120,7 @@ export declare class Client implements ConnectClient {
|
|
|
120
120
|
* @param chatId - Conversation or chat identifier in x-bees.
|
|
121
121
|
*/
|
|
122
122
|
setChatToOpen(chatId: string): void;
|
|
123
|
+
getChannelsByEmailOrPhone(payload: IPayloadGetChannelsByEmailOrPhone): Promise<ResponseMessage>;
|
|
123
124
|
onContactWeightUpdate(callback: Callback<EventType.CONTACT_WEIGHT_UPDATE>): RemoveEventListener;
|
|
124
125
|
onContactRefresh(callback: Callback<EventType.CONTACT_REFRESH>): RemoveEventListener;
|
|
125
126
|
/**
|
|
@@ -53,6 +53,7 @@ export declare enum ClientEventType {
|
|
|
53
53
|
DROPDOWN_VISIBILITY = "xBeesDropdownVisibility",
|
|
54
54
|
CUSTOM_EVENT = "xBeesCustomEvent",
|
|
55
55
|
SET_CHAT_TO_OPEN = "xBeesSetChatToOpen",
|
|
56
|
+
GET_CHANNELS_BY_EMAIL_OR_PHONE = "xBeesGetChannelsByEmailOrPhone",
|
|
56
57
|
CREATE_CONTACT_IS_SUPPORTED = "xBeesCreateContactIsSupported",
|
|
57
58
|
CREATE_CONTACT_HAS_NO_PERMISSION = "xBeesCreateContactHasNoPermission",
|
|
58
59
|
INTEGRATION_PROXY_RESPONSE = "xBeesIntegrationProxyResponse",
|
|
@@ -6,7 +6,7 @@ import { ReadyExtendedProps } from './Event';
|
|
|
6
6
|
import { JSONValue } from './Json';
|
|
7
7
|
import { RemoveEventListener } from './Listener';
|
|
8
8
|
import { ResponseMessage } from './Message';
|
|
9
|
-
import { IntegrationProxyRequest, IPayloadViewPort } from './Payload';
|
|
9
|
+
import { IntegrationProxyRequest, IPayloadGetChannelsByEmailOrPhone, IPayloadViewPort } from './Payload';
|
|
10
10
|
import { SupportedPlatformVariant } from './Platform';
|
|
11
11
|
import { IntegrationProxyRequestResolver, LookupAndMatchBatchContactsResolver, LookupAndMatchContactsResolver, Reject, SuggestContactsResolver } from './Resolver';
|
|
12
12
|
import { StorageEventCallback } from './Storage';
|
|
@@ -234,6 +234,11 @@ export interface ConnectClient {
|
|
|
234
234
|
* @param chatId - Conversation or chat identifier in x-bees.
|
|
235
235
|
*/
|
|
236
236
|
setChatToOpen: (chatId: string) => void;
|
|
237
|
+
/**
|
|
238
|
+
* Asks x-bees to look up chat channels for an email address or phone number.
|
|
239
|
+
* @param payload - Contact identifier: `id` (email or phone value) and `type` (`'email'` or `'phone'`).
|
|
240
|
+
*/
|
|
241
|
+
getChannelsByEmailOrPhone: (payload: IPayloadGetChannelsByEmailOrPhone) => Promise<ResponseMessage>;
|
|
237
242
|
/**
|
|
238
243
|
* Starts listen for the events of contact weight update and handle with the provided callback
|
|
239
244
|
*/
|
|
@@ -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 { IntegrationProxyRequest, IntegrationProxyResponse, IPayloadAutoSuggestResult, IPayloadBatchContactsMatchResult, IPayloadBatchContactsMatchResultError, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadCancelRedirectToEntityPage, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContactWeightUpdate, IPayloadContextResult, IPayloadConversationResult, IPayloadCustomEvent,
|
|
5
|
+
import { IntegrationProxyRequest, IntegrationProxyResponse, IPayloadAutoSuggestResult, IPayloadBatchContactsMatchResult, IPayloadBatchContactsMatchResultError, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadCancelRedirectToEntityPage, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContactWeightUpdate, IPayloadContextResult, IPayloadConversationResult, IPayloadCustomEvent, IPayloadDaemonCallFinished, IPayloadDaemonCallStarted, IPayloadDropdownVisibility, IPayloadGetChannelsByEmailOrPhone, IPayloadGetFromStorage, IPayloadSaveToStorage, IPayloadSendAnalytics, IPayloadSetChatToOpen, IPayloadStartRedirectToEntityPage, 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.DROPDOWN_VISIBILITY ? IPayloadDropdownVisibility : T extends ClientEventType.CUSTOM_EVENT ? IPayloadCustomEvent : T extends ClientEventType.SET_CHAT_TO_OPEN ? IPayloadSetChatToOpen : T extends EventType.START_REDIRECT_TO_ENTITY_PAGE ? IPayloadStartRedirectToEntityPage : T extends EventType.CANCEL_REDIRECT_TO_ENTITY_PAGE ? IPayloadCancelRedirectToEntityPage : T extends EventType.GET_INTEGRATION_PROXY_REQUEST ? IntegrationProxyRequest : T extends ClientEventType.INTEGRATION_PROXY_RESPONSE ? IntegrationProxyResponse : T extends ClientEventType.INTEGRATION_PROXY_REQUEST_IS_SUPPORTED ? undefined : T extends EventType.DAEMON_CALL_SESSION_STARTED ? IPayloadDaemonCallStarted : T extends EventType.DAEMON_CALL_SESSION_FINISHED ? IPayloadDaemonCallFinished : never;
|
|
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.DROPDOWN_VISIBILITY ? IPayloadDropdownVisibility : T extends ClientEventType.CUSTOM_EVENT ? IPayloadCustomEvent : T extends ClientEventType.SET_CHAT_TO_OPEN ? IPayloadSetChatToOpen : T extends ClientEventType.GET_CHANNELS_BY_EMAIL_OR_PHONE ? IPayloadGetChannelsByEmailOrPhone : T extends EventType.START_REDIRECT_TO_ENTITY_PAGE ? IPayloadStartRedirectToEntityPage : T extends EventType.CANCEL_REDIRECT_TO_ENTITY_PAGE ? IPayloadCancelRedirectToEntityPage : T extends EventType.GET_INTEGRATION_PROXY_REQUEST ? IntegrationProxyRequest : T extends ClientEventType.INTEGRATION_PROXY_RESPONSE ? IntegrationProxyResponse : T extends ClientEventType.INTEGRATION_PROXY_REQUEST_IS_SUPPORTED ? undefined : T extends EventType.DAEMON_CALL_SESSION_STARTED ? IPayloadDaemonCallStarted : T extends EventType.DAEMON_CALL_SESSION_FINISHED ? IPayloadDaemonCallFinished : never;
|
|
9
9
|
export type EventPayloadMap = {
|
|
10
10
|
[EventType.GET_CONTACTS_AUTO_SUGGEST]: string;
|
|
11
11
|
[EventType.GET_LOOK_UP_AND_MATCH]: ContactQuery;
|
|
@@ -97,10 +97,13 @@ export interface IPayloadCustomEvent {
|
|
|
97
97
|
type: string;
|
|
98
98
|
payload?: JSONValue;
|
|
99
99
|
}
|
|
100
|
-
/** Payload for the integration → x-bees message that requests opening a chat by id (`ClientEventType.SET_CHAT_TO_OPEN`). */
|
|
101
100
|
export interface IPayloadSetChatToOpen {
|
|
102
101
|
chatId: string;
|
|
103
102
|
}
|
|
103
|
+
export interface IPayloadGetChannelsByEmailOrPhone {
|
|
104
|
+
id: string;
|
|
105
|
+
type: 'email' | 'phone';
|
|
106
|
+
}
|
|
104
107
|
export interface IPayloadContactWeightUpdate {
|
|
105
108
|
id: string;
|
|
106
109
|
query: ContactQuery;
|
|
@@ -7,7 +7,7 @@ export type { JSONArray, JSONObject } from './Json';
|
|
|
7
7
|
export type { Listener, RemoveEventListener } from './Listener';
|
|
8
8
|
export type { Message, MessageIFrameResponse, MessageType, ResponseMessage } from './Message';
|
|
9
9
|
export type { MessageSender } from './MessageSender';
|
|
10
|
-
export type { IntegrationProxyErrorCode, IntegrationProxyRequest, IntegrationProxyResponse, IPayloadAutoSuggestResult, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadCancelRedirectToEntityPage, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContextResult, IPayloadConversationResult, IPayloadDaemonCallFinished, IPayloadDaemonCallStarted, IPayloadSendAnalytics, IPayloadSetChatToOpen, IPayloadStartRedirectToEntityPage, IPayloadTechSupport, IPayloadThemeChange, IPayloadToast, IPayloadVersion, IPayloadViewPort, } from './Payload';
|
|
10
|
+
export type { IntegrationProxyErrorCode, IntegrationProxyRequest, IntegrationProxyResponse, IPayloadAutoSuggestResult, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadCancelRedirectToEntityPage, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContextResult, IPayloadConversationResult, IPayloadDaemonCallFinished, IPayloadDaemonCallStarted, IPayloadGetChannelsByEmailOrPhone, IPayloadSendAnalytics, IPayloadSetChatToOpen, IPayloadStartRedirectToEntityPage, IPayloadTechSupport, IPayloadThemeChange, IPayloadToast, IPayloadVersion, IPayloadViewPort, } from './Payload';
|
|
11
11
|
export { SupportedPlatformVariant } from './Platform';
|
|
12
12
|
export type { IntegrationProxyRequestResolver, LookupAndMatchBatchContactsResolver, LookupAndMatchContactsResolver, Reject, SuggestContactsResolver, } from './Resolver';
|
|
13
13
|
export type { StorageEventCallback } from './Storage';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.17-alpha.1",
|
|
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": "",
|