@wildix/xbees-connect 1.3.11 → 1.3.12
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 +12 -0
- package/dist-cjs/package.json +1 -1
- package/dist-cjs/src/Client.js +10 -0
- package/dist-cjs/src/enums/index.js +1 -0
- package/dist-es/package.json +1 -1
- package/dist-es/src/Client.js +10 -0
- package/dist-es/src/enums/index.js +1 -0
- package/dist-types/src/Client.d.ts +5 -0
- package/dist-types/src/enums/index.d.ts +1 -0
- package/dist-types/types/Client.d.ts +8 -0
- package/dist-types/types/Event.d.ts +2 -2
- package/dist-types/types/Payload.d.ts +4 -0
- package/dist-types/types/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -494,6 +494,18 @@ Notifies x-bees when a dropdown inside the integration opens or closes, which al
|
|
|
494
494
|
|
|
495
495
|
---
|
|
496
496
|
|
|
497
|
+
### Chat connections
|
|
498
|
+
|
|
499
|
+
#### `setChatToOpen(chatId: string): void`
|
|
500
|
+
|
|
501
|
+
Tells x-bees which chat or conversation should be opened (brought into focus). The integration sends `ClientEventType.SET_CHAT_TO_OPEN` (`xBeesSetChatToOpen`) with payload `{ chatId }`. The call returns immediately; x-bees applies the navigation when it handles the message.
|
|
502
|
+
|
|
503
|
+
```ts
|
|
504
|
+
client.setChatToOpen('chat_id');
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
497
509
|
### Technical support
|
|
498
510
|
|
|
499
511
|
#### `getTechnicalSupport(): TechnicalSupport`
|
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.12",
|
|
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
|
@@ -536,6 +536,16 @@ class Client {
|
|
|
536
536
|
payload: { type, payload },
|
|
537
537
|
});
|
|
538
538
|
}
|
|
539
|
+
/**
|
|
540
|
+
* Asks x-bees to open (focus) the chat or conversation identified by `chatId`.
|
|
541
|
+
* @param chatId - Conversation or chat identifier in x-bees.
|
|
542
|
+
*/
|
|
543
|
+
setChatToOpen(chatId) {
|
|
544
|
+
void this.sendAsync({
|
|
545
|
+
type: enums_1.ClientEventType.SET_CHAT_TO_OPEN,
|
|
546
|
+
payload: { chatId },
|
|
547
|
+
});
|
|
548
|
+
}
|
|
539
549
|
onContactWeightUpdate(callback) {
|
|
540
550
|
return this.addEventListener(enums_1.EventType.CONTACT_WEIGHT_UPDATE, callback);
|
|
541
551
|
}
|
|
@@ -55,6 +55,7 @@ var ClientEventType;
|
|
|
55
55
|
ClientEventType["AVAILABLE_CONTACT_DATA"] = "xBeesAvailableContactData";
|
|
56
56
|
ClientEventType["DROPDOWN_VISIBILITY"] = "xBeesDropdownVisibility";
|
|
57
57
|
ClientEventType["CUSTOM_EVENT"] = "xBeesCustomEvent";
|
|
58
|
+
ClientEventType["SET_CHAT_TO_OPEN"] = "xBeesSetChatToOpen";
|
|
58
59
|
ClientEventType["CREATE_CONTACT_IS_SUPPORTED"] = "xBeesCreateContactIsSupported";
|
|
59
60
|
ClientEventType["CREATE_CONTACT_HAS_NO_PERMISSION"] = "xBeesCreateContactHasNoPermission";
|
|
60
61
|
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.12",
|
|
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
|
@@ -530,6 +530,16 @@ export class Client {
|
|
|
530
530
|
payload: { type, payload },
|
|
531
531
|
});
|
|
532
532
|
}
|
|
533
|
+
/**
|
|
534
|
+
* Asks x-bees to open (focus) the chat or conversation identified by `chatId`.
|
|
535
|
+
* @param chatId - Conversation or chat identifier in x-bees.
|
|
536
|
+
*/
|
|
537
|
+
setChatToOpen(chatId) {
|
|
538
|
+
void this.sendAsync({
|
|
539
|
+
type: ClientEventType.SET_CHAT_TO_OPEN,
|
|
540
|
+
payload: { chatId },
|
|
541
|
+
});
|
|
542
|
+
}
|
|
533
543
|
onContactWeightUpdate(callback) {
|
|
534
544
|
return this.addEventListener(EventType.CONTACT_WEIGHT_UPDATE, callback);
|
|
535
545
|
}
|
|
@@ -52,6 +52,7 @@ export var ClientEventType;
|
|
|
52
52
|
ClientEventType["AVAILABLE_CONTACT_DATA"] = "xBeesAvailableContactData";
|
|
53
53
|
ClientEventType["DROPDOWN_VISIBILITY"] = "xBeesDropdownVisibility";
|
|
54
54
|
ClientEventType["CUSTOM_EVENT"] = "xBeesCustomEvent";
|
|
55
|
+
ClientEventType["SET_CHAT_TO_OPEN"] = "xBeesSetChatToOpen";
|
|
55
56
|
ClientEventType["CREATE_CONTACT_IS_SUPPORTED"] = "xBeesCreateContactIsSupported";
|
|
56
57
|
ClientEventType["CREATE_CONTACT_HAS_NO_PERMISSION"] = "xBeesCreateContactHasNoPermission";
|
|
57
58
|
ClientEventType["INTEGRATION_PROXY_RESPONSE"] = "xBeesIntegrationProxyResponse";
|
|
@@ -115,6 +115,11 @@ export declare class Client implements ConnectClient {
|
|
|
115
115
|
type: string;
|
|
116
116
|
payload?: JSONValue;
|
|
117
117
|
}): void;
|
|
118
|
+
/**
|
|
119
|
+
* Asks x-bees to open (focus) the chat or conversation identified by `chatId`.
|
|
120
|
+
* @param chatId - Conversation or chat identifier in x-bees.
|
|
121
|
+
*/
|
|
122
|
+
setChatToOpen(chatId: string): void;
|
|
118
123
|
onContactWeightUpdate(callback: Callback<EventType.CONTACT_WEIGHT_UPDATE>): RemoveEventListener;
|
|
119
124
|
onContactRefresh(callback: Callback<EventType.CONTACT_REFRESH>): RemoveEventListener;
|
|
120
125
|
onStartRedirectToEntityPage(callback: Callback<EventType.START_REDIRECT_TO_ENTITY_PAGE>): RemoveEventListener;
|
|
@@ -50,6 +50,7 @@ export declare enum ClientEventType {
|
|
|
50
50
|
AVAILABLE_CONTACT_DATA = "xBeesAvailableContactData",
|
|
51
51
|
DROPDOWN_VISIBILITY = "xBeesDropdownVisibility",
|
|
52
52
|
CUSTOM_EVENT = "xBeesCustomEvent",
|
|
53
|
+
SET_CHAT_TO_OPEN = "xBeesSetChatToOpen",
|
|
53
54
|
CREATE_CONTACT_IS_SUPPORTED = "xBeesCreateContactIsSupported",
|
|
54
55
|
CREATE_CONTACT_HAS_NO_PERMISSION = "xBeesCreateContactHasNoPermission",
|
|
55
56
|
INTEGRATION_PROXY_RESPONSE = "xBeesIntegrationProxyResponse",
|
|
@@ -220,6 +220,14 @@ export interface ConnectClient {
|
|
|
220
220
|
type: string;
|
|
221
221
|
payload?: JSONValue;
|
|
222
222
|
}) => void;
|
|
223
|
+
/**
|
|
224
|
+
* Asks x-bees to open (focus) the chat or conversation identified by `chatId`.
|
|
225
|
+
* Fire-and-forget: sends `ClientEventType.SET_CHAT_TO_OPEN` to the parent; no response is surfaced to the integration.
|
|
226
|
+
* When the app is not embedded in x-bees, this is a no-op (same as other outbound client messages).
|
|
227
|
+
*
|
|
228
|
+
* @param chatId - Conversation or chat identifier in x-bees.
|
|
229
|
+
*/
|
|
230
|
+
setChatToOpen: (chatId: string) => void;
|
|
223
231
|
/**
|
|
224
232
|
* Starts listen for the events of contact weight update and handle with the provided callback
|
|
225
233
|
*/
|
|
@@ -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, IPayloadDropdownVisibility, IPayloadGetFromStorage, IPayloadSaveToStorage, IPayloadSendAnalytics, IPayloadStartRedirectToEntityPage, IPayloadTechSupport, IPayloadThemeChange, IPayloadToast, IPayloadVersion, IPayloadViewPort } from './Payload';
|
|
5
|
+
import { IntegrationProxyRequest, IntegrationProxyResponse, IPayloadAutoSuggestResult, IPayloadBatchContactsMatchResult, IPayloadBatchContactsMatchResultError, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadCancelRedirectToEntityPage, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContactWeightUpdate, IPayloadContextResult, IPayloadConversationResult, IPayloadCustomEvent, IPayloadSetChatToOpen, IPayloadDropdownVisibility, IPayloadGetFromStorage, IPayloadSaveToStorage, IPayloadSendAnalytics, 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 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 : 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 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 : never;
|
|
9
9
|
export type EventPayloadMap = {
|
|
10
10
|
[EventType.GET_CONTACTS_AUTO_SUGGEST]: string;
|
|
11
11
|
[EventType.GET_LOOK_UP_AND_MATCH]: ContactQuery;
|
|
@@ -87,6 +87,10 @@ export interface IPayloadCustomEvent {
|
|
|
87
87
|
type: string;
|
|
88
88
|
payload?: JSONValue;
|
|
89
89
|
}
|
|
90
|
+
/** Payload for the integration → x-bees message that requests opening a chat by id (`ClientEventType.SET_CHAT_TO_OPEN`). */
|
|
91
|
+
export interface IPayloadSetChatToOpen {
|
|
92
|
+
chatId: string;
|
|
93
|
+
}
|
|
90
94
|
export interface IPayloadContactWeightUpdate {
|
|
91
95
|
id: string;
|
|
92
96
|
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, IPayloadSendAnalytics, IPayloadStartRedirectToEntityPage, IPayloadTechSupport, IPayloadThemeChange, IPayloadToast, IPayloadVersion, IPayloadViewPort, } from './Payload';
|
|
10
|
+
export type { IntegrationProxyErrorCode, IntegrationProxyRequest, IntegrationProxyResponse, IPayloadAutoSuggestResult, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadCancelRedirectToEntityPage, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContextResult, IPayloadConversationResult, 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.12",
|
|
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": "",
|