@wildix/xbees-connect 1.3.2 → 1.3.4
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/package.json +4 -4
- package/dist-cjs/index.js +0 -27
- package/dist-cjs/package.json +0 -48
- package/dist-cjs/src/Client.js +0 -485
- package/dist-cjs/src/enums/index.js +0 -73
- package/dist-cjs/src/helpers/ClientParams.js +0 -37
- package/dist-cjs/src/helpers/LocalStorageManager.js +0 -74
- package/dist-cjs/src/helpers/MessageListener.js +0 -85
- package/dist-cjs/src/helpers/PostMessageController.js +0 -48
- package/dist-cjs/src/helpers/PostMessageControllerNative.js +0 -47
- package/dist-cjs/src/helpers/PostMessageControllerWeb.js +0 -36
- package/dist-cjs/src/helpers/TechnicalSupport.js +0 -30
- package/dist-cjs/src/utils/url/getUrlSearchParamsMap.js +0 -7
- package/dist-cjs/types/AvailableContactData.js +0 -2
- package/dist-cjs/types/Callback.js +0 -2
- package/dist-cjs/types/Client.js +0 -2
- package/dist-cjs/types/Contact.js +0 -2
- package/dist-cjs/types/Event.js +0 -3
- package/dist-cjs/types/Json.js +0 -2
- package/dist-cjs/types/Listener.js +0 -2
- package/dist-cjs/types/Message.js +0 -2
- package/dist-cjs/types/MessageSender.js +0 -2
- package/dist-cjs/types/Payload.js +0 -2
- package/dist-cjs/types/Platform.js +0 -9
- package/dist-cjs/types/Resolver.js +0 -2
- package/dist-cjs/types/Storage.js +0 -2
- package/dist-cjs/types/Toast.js +0 -2
- package/dist-cjs/types/WorkVariant.js +0 -2
- package/dist-cjs/types/XBeesUser.js +0 -2
- package/dist-cjs/types/conversation.js +0 -2
- package/dist-cjs/types/index.js +0 -5
- package/dist-es/index.js +0 -6
- package/dist-es/package.json +0 -48
- package/dist-es/src/Client.js +0 -478
- package/dist-es/src/enums/index.js +0 -70
- package/dist-es/src/helpers/ClientParams.js +0 -34
- package/dist-es/src/helpers/LocalStorageManager.js +0 -72
- package/dist-es/src/helpers/MessageListener.js +0 -81
- package/dist-es/src/helpers/PostMessageController.js +0 -42
- package/dist-es/src/helpers/PostMessageControllerNative.js +0 -44
- package/dist-es/src/helpers/PostMessageControllerWeb.js +0 -33
- package/dist-es/src/helpers/TechnicalSupport.js +0 -25
- package/dist-es/src/utils/url/getUrlSearchParamsMap.js +0 -3
- package/dist-es/types/AvailableContactData.js +0 -1
- package/dist-es/types/Callback.js +0 -1
- package/dist-es/types/Client.js +0 -1
- package/dist-es/types/Contact.js +0 -1
- package/dist-es/types/Event.js +0 -1
- package/dist-es/types/Json.js +0 -1
- package/dist-es/types/Listener.js +0 -1
- package/dist-es/types/Message.js +0 -1
- package/dist-es/types/MessageSender.js +0 -1
- package/dist-es/types/Payload.js +0 -1
- package/dist-es/types/Platform.js +0 -6
- package/dist-es/types/Resolver.js +0 -1
- package/dist-es/types/Storage.js +0 -1
- package/dist-es/types/Toast.js +0 -1
- package/dist-es/types/WorkVariant.js +0 -1
- package/dist-es/types/XBeesUser.js +0 -1
- package/dist-es/types/conversation.js +0 -1
- package/dist-es/types/index.js +0 -1
- package/dist-types/index.d.ts +0 -6
- package/dist-types/src/Client.d.ts +0 -116
- package/dist-types/src/enums/index.d.ts +0 -66
- package/dist-types/src/helpers/ClientParams.d.ts +0 -16
- package/dist-types/src/helpers/LocalStorageManager.d.ts +0 -20
- package/dist-types/src/helpers/MessageListener.d.ts +0 -14
- package/dist-types/src/helpers/PostMessageController.d.ts +0 -13
- package/dist-types/src/helpers/PostMessageControllerNative.d.ts +0 -8
- package/dist-types/src/helpers/PostMessageControllerWeb.d.ts +0 -8
- package/dist-types/src/helpers/TechnicalSupport.d.ts +0 -9
- package/dist-types/src/utils/url/getUrlSearchParamsMap.d.ts +0 -1
- package/dist-types/types/AvailableContactData.d.ts +0 -4
- package/dist-types/types/Callback.d.ts +0 -4
- package/dist-types/types/Client.d.ts +0 -222
- package/dist-types/types/Contact.d.ts +0 -24
- package/dist-types/types/Event.d.ts +0 -39
- package/dist-types/types/Json.d.ts +0 -6
- package/dist-types/types/Listener.d.ts +0 -7
- package/dist-types/types/Message.d.ts +0 -14
- package/dist-types/types/MessageSender.d.ts +0 -4
- package/dist-types/types/Payload.d.ts +0 -91
- package/dist-types/types/Platform.d.ts +0 -5
- package/dist-types/types/Resolver.d.ts +0 -5
- package/dist-types/types/Storage.d.ts +0 -1
- package/dist-types/types/Toast.d.ts +0 -1
- package/dist-types/types/WorkVariant.d.ts +0 -3
- package/dist-types/types/XBeesUser.d.ts +0 -7
- package/dist-types/types/conversation.d.ts +0 -4
- package/dist-types/types/index.d.ts +0 -16
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { EventType } from '../enums';
|
|
2
|
-
export class MessageListener {
|
|
3
|
-
static instance = null;
|
|
4
|
-
static getInstance() {
|
|
5
|
-
if (!this.instance) {
|
|
6
|
-
this.instance = new MessageListener();
|
|
7
|
-
}
|
|
8
|
-
return this.instance;
|
|
9
|
-
}
|
|
10
|
-
listeners = [];
|
|
11
|
-
useSubscription = false;
|
|
12
|
-
// eslint-disable-next-line
|
|
13
|
-
constructor() { }
|
|
14
|
-
parseMessage(message) {
|
|
15
|
-
try {
|
|
16
|
-
const data = typeof message.data === 'string' ? MessageListener.parseJSON(message.data) : message.data;
|
|
17
|
-
if (!data?.type) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
return data;
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
console.error('parse message error', error);
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
static parseJSON(messageData) {
|
|
28
|
-
const trimmedData = messageData.trim();
|
|
29
|
-
if (!trimmedData || !trimmedData.startsWith('{') || !trimmedData.endsWith('}')) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
return JSON.parse(trimmedData);
|
|
33
|
-
}
|
|
34
|
-
onMessage = (message) => {
|
|
35
|
-
if (window.location.host === message.origin || window === message.source) {
|
|
36
|
-
console.debug(`onMessage skipped ${window.location.host} - ${message.origin} - ${window === message.source} - ${message}`);
|
|
37
|
-
// skip events started from integration itself if any
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const data = this.parseMessage(message);
|
|
41
|
-
if (!data) {
|
|
42
|
-
console.debug('onMessage skipped', message);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const { type, payload } = data;
|
|
46
|
-
console.debug(`onMessage call - ${type} - ${payload}`);
|
|
47
|
-
this.listeners.forEach(({ eventName, callback }) => {
|
|
48
|
-
if (eventName === type) {
|
|
49
|
-
if (type === EventType.ADD_CALL) {
|
|
50
|
-
const callbackFn = callback;
|
|
51
|
-
callbackFn(payload);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
// @ts-expect-error TODO: check the type for Callback<?>
|
|
55
|
-
const callbackFn = callback;
|
|
56
|
-
callbackFn(payload);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
listen(eventName, callback) {
|
|
62
|
-
if (!this.useSubscription) {
|
|
63
|
-
this.useSubscription = true;
|
|
64
|
-
window.addEventListener('message', this.onMessage);
|
|
65
|
-
}
|
|
66
|
-
const foundThisEvent = this.listeners.find(({ eventName: _eventName, callback: _callback }) => eventName === _eventName && Object.is(callback, _callback));
|
|
67
|
-
if (!foundThisEvent) {
|
|
68
|
-
this.listeners.push({ eventName, callback });
|
|
69
|
-
}
|
|
70
|
-
return () => {
|
|
71
|
-
this.off(eventName, callback);
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
off(eventName, callback) {
|
|
75
|
-
this.listeners = this.listeners.filter(({ eventName: _eventName, callback: _callback }) => !(Object.is(callback, _callback) && (!eventName ? true : eventName === _eventName)));
|
|
76
|
-
if (this.useSubscription && !this.listeners.length) {
|
|
77
|
-
this.useSubscription = false;
|
|
78
|
-
window.removeEventListener('message', this.onMessage);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import ClientParams from './ClientParams';
|
|
2
|
-
import PostMessageControllerNative from './PostMessageControllerNative';
|
|
3
|
-
import PostMessageControllerWeb from './PostMessageControllerWeb';
|
|
4
|
-
export default class PostMessageController {
|
|
5
|
-
static instance = null;
|
|
6
|
-
static getInstance() {
|
|
7
|
-
if (!this.instance) {
|
|
8
|
-
this.instance = new PostMessageController();
|
|
9
|
-
}
|
|
10
|
-
return this.instance;
|
|
11
|
-
}
|
|
12
|
-
worker;
|
|
13
|
-
isParentReactNativeWebView;
|
|
14
|
-
constructor() {
|
|
15
|
-
// @ts-expect-error window.ReactNativeWebView will be provided by ReactNative WebView
|
|
16
|
-
this.isParentReactNativeWebView = !!window.ReactNativeWebView;
|
|
17
|
-
this.worker = this.isParentReactNativeWebView ? new PostMessageControllerNative() : new PostMessageControllerWeb();
|
|
18
|
-
}
|
|
19
|
-
sendAsync(data) {
|
|
20
|
-
return this.worker.sendAsync({
|
|
21
|
-
...data,
|
|
22
|
-
iframeId: ClientParams.getInstance().iframeId,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
async sendAsyncErrorSafe(data) {
|
|
26
|
-
try {
|
|
27
|
-
return await this.sendAsync(data);
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
console.debug('send error - type:', error);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
isPlatformNative() {
|
|
34
|
-
return this.isParentReactNativeWebView;
|
|
35
|
-
}
|
|
36
|
-
isPlatformWeb() {
|
|
37
|
-
return !this.isParentReactNativeWebView;
|
|
38
|
-
}
|
|
39
|
-
isOpenedFromXBees() {
|
|
40
|
-
return this.isParentReactNativeWebView || (!!parent && parent !== window);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export default class PostMessageControllerNative {
|
|
2
|
-
target;
|
|
3
|
-
timeout = 10000;
|
|
4
|
-
constructor() {
|
|
5
|
-
// @ts-expect-error window.ReactNativeWebView will be provided by ReactNative WebView
|
|
6
|
-
this.target = window.ReactNativeWebView;
|
|
7
|
-
}
|
|
8
|
-
sendAsync(data) {
|
|
9
|
-
if (!this.target) {
|
|
10
|
-
return Promise.reject('your application should be wrapped within iframe to xbees-connect perform the connection');
|
|
11
|
-
}
|
|
12
|
-
return this.send(this.target, data);
|
|
13
|
-
}
|
|
14
|
-
send(target, message) {
|
|
15
|
-
return new Promise((resolve, reject) => {
|
|
16
|
-
const channel = new MessageChannel();
|
|
17
|
-
const listener = (event) => {
|
|
18
|
-
try {
|
|
19
|
-
const parsedData = JSON.parse(event.data);
|
|
20
|
-
if (parsedData?.type === message.type) {
|
|
21
|
-
clearTimeout(timeout);
|
|
22
|
-
window.removeEventListener('message', listener);
|
|
23
|
-
if (!parsedData.errorMessage) {
|
|
24
|
-
resolve(parsedData);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
reject(parsedData);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
console.error('on receive response Error', error);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
window.addEventListener('message', listener);
|
|
36
|
-
const timeout = setTimeout(() => {
|
|
37
|
-
channel.port1.close();
|
|
38
|
-
window.removeEventListener('message', listener);
|
|
39
|
-
reject({ errorMessage: 'timeout', type: message.type });
|
|
40
|
-
}, this.timeout);
|
|
41
|
-
target.postMessage(JSON.stringify(message));
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export default class PostMessageControllerWeb {
|
|
2
|
-
target;
|
|
3
|
-
timeout = 10000;
|
|
4
|
-
constructor() {
|
|
5
|
-
this.target = parent;
|
|
6
|
-
}
|
|
7
|
-
sendAsync(data) {
|
|
8
|
-
if (!this.target || this.target === window) {
|
|
9
|
-
return Promise.reject('your application should be wrapped within iframe to xbees-connect perform the connection');
|
|
10
|
-
}
|
|
11
|
-
return this.send(this.target, data);
|
|
12
|
-
}
|
|
13
|
-
send(target, payload) {
|
|
14
|
-
return new Promise((resolve, reject) => {
|
|
15
|
-
const channel = new MessageChannel();
|
|
16
|
-
const timeout = setTimeout(() => {
|
|
17
|
-
channel.port1.close();
|
|
18
|
-
reject({ errorMessage: 'timeout', type: payload.type });
|
|
19
|
-
}, this.timeout);
|
|
20
|
-
channel.port1.onmessage = ({ data }) => {
|
|
21
|
-
clearTimeout(timeout);
|
|
22
|
-
channel.port1.close();
|
|
23
|
-
if (!data.errorMessage) {
|
|
24
|
-
resolve(data);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
reject(data);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
target.postMessage(payload, '*', [channel.port2]);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ClientEventType } from '../enums';
|
|
2
|
-
import ClientParams from './ClientParams';
|
|
3
|
-
import PostMessageController from './PostMessageController';
|
|
4
|
-
class TechnicalSupport {
|
|
5
|
-
static instance = null;
|
|
6
|
-
static getInstance() {
|
|
7
|
-
if (!this.instance) {
|
|
8
|
-
this.instance = new TechnicalSupport();
|
|
9
|
-
}
|
|
10
|
-
return this.instance;
|
|
11
|
-
}
|
|
12
|
-
// eslint-disable-next-line
|
|
13
|
-
constructor() { }
|
|
14
|
-
sendTechnicalInformation(message, data) {
|
|
15
|
-
return PostMessageController.getInstance().sendAsyncErrorSafe({
|
|
16
|
-
type: ClientEventType.SEND_TECHNICAL_SUPPORT_INFORMATION,
|
|
17
|
-
payload: {
|
|
18
|
-
'x-iframe-params': ClientParams.getInstance(),
|
|
19
|
-
message,
|
|
20
|
-
data,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export default TechnicalSupport;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist-es/types/Client.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist-es/types/Contact.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist-es/types/Event.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { EventType } from '../src/enums';
|
package/dist-es/types/Json.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist-es/types/Message.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist-es/types/Payload.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export var SupportedPlatformVariant;
|
|
2
|
-
(function (SupportedPlatformVariant) {
|
|
3
|
-
SupportedPlatformVariant["ALL"] = "all";
|
|
4
|
-
SupportedPlatformVariant["MOBILE"] = "mobile";
|
|
5
|
-
SupportedPlatformVariant["WEB"] = "web";
|
|
6
|
-
})(SupportedPlatformVariant || (SupportedPlatformVariant = {}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist-es/types/Storage.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist-es/types/Toast.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist-es/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SupportedPlatformVariant } from './Platform';
|
package/dist-types/index.d.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Callback, ConnectClient, Contact, ContactQuery, IPayloadViewPort, LookupAndMatchContactsResolver, Message, Reject, RemoveEventListener, ResponseMessage, StorageEventCallback, SuggestContactsResolver, SupportedPlatformVariant, ToastSeverity, XBeesUser } from '../types';
|
|
2
|
-
import { ReadyExtendedProps } from '../types/Event';
|
|
3
|
-
import { JSONValue } from '../types/Json';
|
|
4
|
-
import { LookupAndMatchBatchContactsResolver } from '../types/Resolver';
|
|
5
|
-
import { ClientEventType, EventType, StartPage } from './enums';
|
|
6
|
-
import TechnicalSupport from './helpers/TechnicalSupport';
|
|
7
|
-
/**
|
|
8
|
-
* Client provides functionality of communication between xBees and integrated web applications via iFrame or ReactNative WebView
|
|
9
|
-
* integration creates na instance with new Client()
|
|
10
|
-
* */
|
|
11
|
-
export declare class Client implements ConnectClient {
|
|
12
|
-
private static instance;
|
|
13
|
-
static getInstance(): ConnectClient;
|
|
14
|
-
static initialize(renderer: () => Promise<void>): void;
|
|
15
|
-
private worker;
|
|
16
|
-
private listeners;
|
|
17
|
-
private useSubscription;
|
|
18
|
-
private userToken;
|
|
19
|
-
private pbxDomain;
|
|
20
|
-
private visible;
|
|
21
|
-
private user;
|
|
22
|
-
private userExtension;
|
|
23
|
-
private readonly userEmail;
|
|
24
|
-
private readonly referrer;
|
|
25
|
-
private readonly needAuthorize;
|
|
26
|
-
private readonly isParentReactNativeWebView;
|
|
27
|
-
private readonly iframeId;
|
|
28
|
-
private readonly variant;
|
|
29
|
-
private readonly startPage;
|
|
30
|
-
private readonly localStorageManager;
|
|
31
|
-
constructor();
|
|
32
|
-
private sendAsync;
|
|
33
|
-
private sendAsyncErrorSafe;
|
|
34
|
-
private parseMessage;
|
|
35
|
-
private onMessage;
|
|
36
|
-
private sendDailyIntegrationUsageAnalytics;
|
|
37
|
-
ready(props?: SupportedPlatformVariant | ReadyExtendedProps | undefined): Promise<ResponseMessage>;
|
|
38
|
-
private requestXbeesUser;
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated Use getXBeesUserAsync instead. This method doesn't wait for the user data to be fetched.
|
|
41
|
-
*/
|
|
42
|
-
getXBeesUser(): XBeesUser | null;
|
|
43
|
-
/**
|
|
44
|
-
* Asynchronously retrieves the xBees user data.
|
|
45
|
-
* This method waits for the user data to be fetched before returning.
|
|
46
|
-
* @returns Promise that resolves to the XBeesUser or null if not available
|
|
47
|
-
*/
|
|
48
|
-
getXBeesUserAsync(): Promise<XBeesUser | null>;
|
|
49
|
-
version(): string;
|
|
50
|
-
isPlatformNative(): boolean;
|
|
51
|
-
isPlatformWeb(): boolean;
|
|
52
|
-
isOpenedFromXBees(): boolean;
|
|
53
|
-
getUserPbxToken(): string;
|
|
54
|
-
getUserEmail(): string;
|
|
55
|
-
getPbxDomain(): string;
|
|
56
|
-
getUserExtension(): string | null;
|
|
57
|
-
getReferrer(): string;
|
|
58
|
-
getStartPage(): StartPage | null;
|
|
59
|
-
isVisible(): boolean;
|
|
60
|
-
getBackToAppUrl(): string;
|
|
61
|
-
isDataOnly(): boolean;
|
|
62
|
-
isSetupDialog(): boolean;
|
|
63
|
-
showsUi(): boolean;
|
|
64
|
-
isFullsize(): boolean;
|
|
65
|
-
isActivationOnly(): boolean;
|
|
66
|
-
getContext(): Promise<Message<ClientEventType.CONTEXT>>;
|
|
67
|
-
getCurrentContact(): Promise<Message<ClientEventType.CURRENT_CONTACT>>;
|
|
68
|
-
getCurrentConversation(): Promise<Message<ClientEventType.CURRENT_CONVERSATION>>;
|
|
69
|
-
getAvailableContactData(): Promise<Message<ClientEventType.AVAILABLE_CONTACT_DATA>>;
|
|
70
|
-
contactUpdated(query: ContactQuery, contact: Contact): Promise<Message<ClientEventType.CONTACT_CREATE_OR_UPDATE>>;
|
|
71
|
-
contactMatchUpdated(query: ContactQuery, contact: Contact): Promise<ResponseMessage<ClientEventType.CONTACT_MATCH_UPDATE>>;
|
|
72
|
-
getThemeMode(): Promise<Message<ClientEventType.THEME_MODE>>;
|
|
73
|
-
getTheme(): Promise<Message<ClientEventType.THEME>>;
|
|
74
|
-
startCall(phoneNumber: string): Promise<Message<ClientEventType.START_CALL>>;
|
|
75
|
-
reboot(): Promise<ResponseMessage>;
|
|
76
|
-
setViewport(payload: IPayloadViewPort): Promise<ResponseMessage>;
|
|
77
|
-
toClipboard(payload: string): Promise<ResponseMessage>;
|
|
78
|
-
showToast(message: string, severity?: ToastSeverity | undefined): Promise<ResponseMessage>;
|
|
79
|
-
isNotAuthorized(): Promise<ResponseMessage>;
|
|
80
|
-
isAuthorized(): Promise<ResponseMessage>;
|
|
81
|
-
addEventListener<T extends EventType = EventType>(eventName: T, callback: Callback<T>): RemoveEventListener;
|
|
82
|
-
removeEventListener<T extends EventType = EventType>(eventName: T | null, callback: Callback<T>): void;
|
|
83
|
-
off(callback: Callback | StorageEventCallback): void;
|
|
84
|
-
onRedirectQuery(callback: Callback<EventType.REDIRECT_QUERY>): RemoveEventListener;
|
|
85
|
-
onCallEnded(callback: Callback<EventType.TERMINATE_CALL>): RemoveEventListener;
|
|
86
|
-
onCallStarted(callback: Callback<EventType.ADD_CALL>): RemoveEventListener;
|
|
87
|
-
onPbxTokenChange(callback: Callback<EventType.PBX_TOKEN>): RemoveEventListener;
|
|
88
|
-
getXBeesToken(): Promise<Message<ClientEventType.TOKEN>>;
|
|
89
|
-
onSuggestContacts(callback: (query: string, resolve: SuggestContactsResolver, reject: Reject) => void): RemoveEventListener;
|
|
90
|
-
onLookupAndMatchContact(callback: (query: ContactQuery, resolve: LookupAndMatchContactsResolver, reject: Reject) => void): RemoveEventListener;
|
|
91
|
-
onLookupAndMatchBatchContacts(callback: (query: ContactQuery[], returnResults: LookupAndMatchBatchContactsResolver) => void): RemoveEventListener;
|
|
92
|
-
createContactIsSupported(): Promise<ResponseMessage>;
|
|
93
|
-
createContactHasNoPermission(): Promise<ResponseMessage>;
|
|
94
|
-
onThemeChange(callback: Callback<EventType.USE_THEME>): RemoveEventListener;
|
|
95
|
-
getFromStorage<Type>(key: string): Type | null;
|
|
96
|
-
saveToStorage<SavingType>(key: string, value: SavingType): void;
|
|
97
|
-
deleteFromStorage(key: string): void;
|
|
98
|
-
onStorage(listener: StorageEventCallback): () => void;
|
|
99
|
-
onLogout(callback: Callback<EventType.LOGOUT>): RemoveEventListener;
|
|
100
|
-
sendAnalytics(eventName: string, params?: Record<string, string>): void;
|
|
101
|
-
setIntegrationStorageKey(integrationKey: string): void;
|
|
102
|
-
getTechnicalSupport(): TechnicalSupport;
|
|
103
|
-
onVisibilityChange(callback: Callback<EventType.VISIBILITY>): RemoveEventListener;
|
|
104
|
-
saveInXbeesStorage<SavingType>(key: string, value: SavingType): void;
|
|
105
|
-
getFromXbeesStorage(key: string): Promise<ResponseMessage<ClientEventType.GET_FROM_STORAGE>>;
|
|
106
|
-
removeFromXbeesStorage(key: string): void;
|
|
107
|
-
/** should be removed, sendCustomEvent is enough **/
|
|
108
|
-
sendDropdownVisibilityEvent(dropdownVisibilityStatus: boolean): void;
|
|
109
|
-
sendCustomEvent({ type, payload }: {
|
|
110
|
-
type: string;
|
|
111
|
-
payload?: JSONValue;
|
|
112
|
-
}): void;
|
|
113
|
-
onContactWeightUpdate(callback: Callback<EventType.CONTACT_WEIGHT_UPDATE>): RemoveEventListener;
|
|
114
|
-
onContactRefresh(callback: Callback<EventType.CONTACT_REFRESH>): RemoveEventListener;
|
|
115
|
-
onStorageUpdated(callback: Callback<EventType.STORAGE_IS_UPDATED>): RemoveEventListener;
|
|
116
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export declare enum EventType {
|
|
2
|
-
GET_CONTACTS_AUTO_SUGGEST = "xBeesGetContactsAutoSuggest",
|
|
3
|
-
GET_LOOK_UP_AND_MATCH = "xBeesGetLookUpAndMatch",
|
|
4
|
-
GET_LOOK_UP_AND_MATCH_BATCH = "xBeesGetLookUpAndMatchBatch",
|
|
5
|
-
ADD_CALL = "xBeesAddCall",
|
|
6
|
-
TERMINATE_CALL = "xBeesTerminateCall",
|
|
7
|
-
USE_THEME = "xBeesUseTheme",
|
|
8
|
-
PBX_TOKEN = "xBeesPbxToken",
|
|
9
|
-
REDIRECT_QUERY = "xBeesRedirectQuery",
|
|
10
|
-
LOGOUT = "xBeesLogout",
|
|
11
|
-
VISIBILITY = "xBeesVisibility",
|
|
12
|
-
CONTACT_WEIGHT_UPDATE = "xBeesContactWeightUpdate",
|
|
13
|
-
CONTACT_REFRESH = "xBeesContactRefresh",
|
|
14
|
-
STORAGE_IS_UPDATED = "xBeesStorageIsUpdated"
|
|
15
|
-
}
|
|
16
|
-
export declare enum ClientEventType {
|
|
17
|
-
READY = "xBeesReady",
|
|
18
|
-
CONTEXT = "xBeesContext",
|
|
19
|
-
CURRENT_CONTACT = "xBeesCurrentContact",
|
|
20
|
-
CURRENT_CONVERSATION = "xBeesCurrentConversation",
|
|
21
|
-
THEME_MODE = "xBeesThemeMode",
|
|
22
|
-
THEME = "xBeesTheme",
|
|
23
|
-
START_CALL = "xBeesStartCall",
|
|
24
|
-
VIEW_PORT = "xBeesViewPort",
|
|
25
|
-
REBOOT = "xBeesReboot",
|
|
26
|
-
TO_CLIPBOARD = "xBeesToClipboard",
|
|
27
|
-
TOAST = "xBeesShowToast",
|
|
28
|
-
NOT_AUTHORIZED = "xBeesNotAuthorized",
|
|
29
|
-
AUTHORIZED = "xBeesAuthorized",
|
|
30
|
-
TOKEN = "xBeesToken",
|
|
31
|
-
CONTACTS_AUTO_SUGGEST = "xBeesContactsAutoSuggest",
|
|
32
|
-
CONTACT_LOOKUP_AND_MATCH = "xBeesContactLookupAndMatch",
|
|
33
|
-
LOOK_UP_AND_MATCH_BATCH_CONTACTS = "xBeesLookupAndMatchBatchContacts",
|
|
34
|
-
LOOKUP_AND_MATCH_BATCH_ERROR = "xBeesLookupAndMatchBatchError",
|
|
35
|
-
CONTACT_LOOKUP_AND_MATCH_NOT_FOUND = "xBeesContactLookupAndMatchNotFound",
|
|
36
|
-
CONTACT_CREATE_OR_UPDATE = "xBeesContactCreateOrUpdate",
|
|
37
|
-
CONTACT_MATCH_UPDATE = "xBeesContactMatchUpdate",
|
|
38
|
-
CONTACTS_AUTO_SUGGEST_IS_SUPPORTED = "xBeesContactsAutoSuggestIsSupported",
|
|
39
|
-
CONTACT_LOOK_UP_AND_MATCH_IS_SUPPORTED = "xBeesContactLookupAndMatchIsSupported",
|
|
40
|
-
LOOK_UP_AND_MATCH_BATCH_CONTACTS_IS_SUPPORTED = "xBeesLookupAndMatchBatchContactsIsSupported",
|
|
41
|
-
LOGOUT_IS_SUPPORTED = "xBeesLogoutIsSupported",
|
|
42
|
-
SEND_ANALYTICS = "xBeesSendAnalytics",
|
|
43
|
-
SEND_TECHNICAL_SUPPORT_INFORMATION = "xBeesSendTechInfo",
|
|
44
|
-
USER = "xBeesUser",
|
|
45
|
-
SAVE_TO_STORAGE = "xBeesSaveToStorage",
|
|
46
|
-
GET_FROM_STORAGE = "xBeesRequestFromStorage",
|
|
47
|
-
REMOVE_FROM_STORAGE = "xBeesRemoveFromStorage",
|
|
48
|
-
AVAILABLE_CONTACT_DATA = "xBeesAvailableContactData",
|
|
49
|
-
DROPDOWN_VISIBILITY = "xBeesDropdownVisibility",
|
|
50
|
-
CUSTOM_EVENT = "xBeesCustomEvent",
|
|
51
|
-
CREATE_CONTACT_IS_SUPPORTED = "xBeesCreateContactIsSupported",
|
|
52
|
-
CREATE_CONTACT_HAS_NO_PERMISSION = "xBeesCreateContactHasNoPermission"
|
|
53
|
-
}
|
|
54
|
-
export declare enum UrlParams {
|
|
55
|
-
TOKEN = "t",
|
|
56
|
-
ID = "i",
|
|
57
|
-
VARIANT = "v",
|
|
58
|
-
USER = "u",
|
|
59
|
-
EXTENSION = "e",
|
|
60
|
-
REFERRER = "r",
|
|
61
|
-
AUTHORIZE = "a",
|
|
62
|
-
START_PAGE = "sp"
|
|
63
|
-
}
|
|
64
|
-
export declare enum StartPage {
|
|
65
|
-
CREATE_CONTACT = "createContact"
|
|
66
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { WorkVariants } from '../../types';
|
|
2
|
-
import { StartPage } from '../enums';
|
|
3
|
-
export default class ClientParams {
|
|
4
|
-
private static instance;
|
|
5
|
-
static getInstance(): ClientParams;
|
|
6
|
-
userToken: string;
|
|
7
|
-
readonly userEmail: string;
|
|
8
|
-
readonly referrer: string;
|
|
9
|
-
readonly needAuthorize: boolean;
|
|
10
|
-
readonly iframeId: string;
|
|
11
|
-
readonly variant: WorkVariants | null;
|
|
12
|
-
readonly userExtension: string | null;
|
|
13
|
-
readonly startPage: StartPage | null;
|
|
14
|
-
constructor();
|
|
15
|
-
toString(): string;
|
|
16
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { StorageEventCallback } from '../../types';
|
|
2
|
-
declare class LocalStorageManager {
|
|
3
|
-
private static instance;
|
|
4
|
-
static getInstance(): LocalStorageManager;
|
|
5
|
-
private listeners;
|
|
6
|
-
private integrationKey;
|
|
7
|
-
setIntegrationKey(integrationKey: string): void;
|
|
8
|
-
getStorageKey(key: string): string;
|
|
9
|
-
getKey(key: string): string;
|
|
10
|
-
constructor();
|
|
11
|
-
private calculateIntegrationKey;
|
|
12
|
-
private shouldUseIntegrationKey;
|
|
13
|
-
save(key: string, value: any): void;
|
|
14
|
-
delete(key: string): void;
|
|
15
|
-
retrieve(key: string): any;
|
|
16
|
-
get(key: string): any;
|
|
17
|
-
onStorage(listener: StorageEventCallback): () => void;
|
|
18
|
-
removeOnStorage(listener: StorageEventCallback): void;
|
|
19
|
-
}
|
|
20
|
-
export default LocalStorageManager;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Callback, RemoveEventListener } from '../../types';
|
|
2
|
-
import { EventType } from '../enums';
|
|
3
|
-
export declare class MessageListener {
|
|
4
|
-
private static instance;
|
|
5
|
-
static getInstance(): MessageListener;
|
|
6
|
-
private listeners;
|
|
7
|
-
private useSubscription;
|
|
8
|
-
private constructor();
|
|
9
|
-
private parseMessage;
|
|
10
|
-
static parseJSON(messageData: string): any;
|
|
11
|
-
private onMessage;
|
|
12
|
-
listen<T extends EventType = EventType>(eventName: T, callback: Callback<T>): RemoveEventListener;
|
|
13
|
-
off<T extends EventType = EventType>(eventName: T | null, callback: Callback<T>): void;
|
|
14
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Message, MessageType } from '../../types';
|
|
2
|
-
export default class PostMessageController {
|
|
3
|
-
private static instance;
|
|
4
|
-
static getInstance(): PostMessageController;
|
|
5
|
-
private worker;
|
|
6
|
-
private readonly isParentReactNativeWebView;
|
|
7
|
-
constructor();
|
|
8
|
-
sendAsync<T extends MessageType>(data: Message<T>): Promise<import("../../types").ResponseMessage<T>>;
|
|
9
|
-
sendAsyncErrorSafe<T extends MessageType>(data: Message<T>): Promise<import("../../types").ResponseMessage<T> | undefined>;
|
|
10
|
-
isPlatformNative(): boolean;
|
|
11
|
-
isPlatformWeb(): boolean;
|
|
12
|
-
isOpenedFromXBees(): boolean;
|
|
13
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { MessageIFrameResponse, MessageSender, MessageType, ResponseMessage } from '../../types';
|
|
2
|
-
export default class PostMessageControllerNative implements MessageSender {
|
|
3
|
-
private readonly target;
|
|
4
|
-
private timeout;
|
|
5
|
-
constructor();
|
|
6
|
-
sendAsync<T extends MessageType>(data: MessageIFrameResponse<T>): Promise<ResponseMessage<T>>;
|
|
7
|
-
private send;
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { MessageIFrameResponse, MessageSender, MessageType, ResponseMessage } from '../../types';
|
|
2
|
-
export default class PostMessageControllerWeb implements MessageSender {
|
|
3
|
-
private readonly target;
|
|
4
|
-
private timeout;
|
|
5
|
-
constructor();
|
|
6
|
-
sendAsync<T extends MessageType>(data: MessageIFrameResponse<T>): Promise<ResponseMessage<T>>;
|
|
7
|
-
private send;
|
|
8
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { JSONArray, JSONObject } from '../../types';
|
|
2
|
-
import { ClientEventType } from '../enums';
|
|
3
|
-
declare class TechnicalSupport {
|
|
4
|
-
private static instance;
|
|
5
|
-
static getInstance(): TechnicalSupport;
|
|
6
|
-
private constructor();
|
|
7
|
-
sendTechnicalInformation(message: string, data?: JSONObject | JSONArray): Promise<import("../../types").ResponseMessage<ClientEventType.SEND_TECHNICAL_SUPPORT_INFORMATION> | undefined>;
|
|
8
|
-
}
|
|
9
|
-
export default TechnicalSupport;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getUrlSearchParamsMap(): URLSearchParams;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { EventType } from '../src/enums';
|
|
2
|
-
import { EventCallbackMap } from './Event';
|
|
3
|
-
export type DefaultCallback = (...args: unknown[]) => void;
|
|
4
|
-
export type Callback<T extends EventType = EventType> = T extends keyof EventCallbackMap ? EventCallbackMap[T] : DefaultCallback;
|