@wildix/xbees-connect 1.2.19-alpha.2 → 1.2.19-alpha.7
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 +1 -0
- package/dist-cjs/types/CachedContact.js +2 -0
- package/dist-es/package.json +1 -1
- package/dist-es/src/Client.js +9 -5
- package/dist-es/src/enums/index.js +1 -0
- package/dist-es/types/CachedContact.js +1 -0
- package/dist-types/src/Client.d.ts +4 -3
- package/dist-types/src/enums/index.d.ts +2 -1
- package/dist-types/types/CachedContact.d.ts +4 -0
- package/dist-types/types/Client.d.ts +9 -0
- package/dist-types/types/Contact.d.ts +2 -2
- package/dist-types/types/Event.d.ts +2 -1
- package/dist-types/types/XBeesUser.d.ts +1 -0
- package/dist-types/types/index.d.ts +1 -0
- 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.19-alpha.
|
|
3
|
+
"version": "1.2.19-alpha.6",
|
|
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
|
@@ -113,11 +113,11 @@ class Client {
|
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
sendDailyIntegrationUsageAnalytics() {
|
|
116
|
-
const
|
|
116
|
+
const sentUsageAnalyticsDate = this.getFromStorage('sentUsageAnalyticsDate');
|
|
117
117
|
const today = new Date().toDateString();
|
|
118
|
-
if (
|
|
118
|
+
if (sentUsageAnalyticsDate !== today) {
|
|
119
119
|
this.sendAnalytics('xBeesIntegrationUsage');
|
|
120
|
-
this.saveToStorage('
|
|
120
|
+
this.saveToStorage('sentUsageAnalyticsDate', today);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
ready(props = types_1.SupportedPlatformVariant.ALL) {
|
|
@@ -204,6 +204,9 @@ class Client {
|
|
|
204
204
|
getCurrentConversation() {
|
|
205
205
|
return this.sendAsync({ type: enums_1.ClientEventType.CURRENT_CONVERSATION });
|
|
206
206
|
}
|
|
207
|
+
getCachedContact() {
|
|
208
|
+
return this.sendAsync({ type: enums_1.ClientEventType.CACHED_CONTACT });
|
|
209
|
+
}
|
|
207
210
|
contactUpdated(query, contact) {
|
|
208
211
|
return this.sendAsync({ type: enums_1.ClientEventType.CONTACT_CREATE_OR_UPDATE, payload: { query, contact } });
|
|
209
212
|
}
|
|
@@ -340,8 +343,9 @@ class Client {
|
|
|
340
343
|
getFromStorage(key) {
|
|
341
344
|
return this.localStorageManager.retrieve(key);
|
|
342
345
|
}
|
|
343
|
-
saveToStorage(key, value) {
|
|
346
|
+
saveToStorage(key, value, sendToXbees = false) {
|
|
344
347
|
this.localStorageManager.save(key, value);
|
|
348
|
+
sendToXbees && this.sendToXbeesStorage(key, value);
|
|
345
349
|
}
|
|
346
350
|
deleteFromStorage(key) {
|
|
347
351
|
this.localStorageManager.delete(key);
|
|
@@ -379,7 +383,7 @@ class Client {
|
|
|
379
383
|
type: enums_1.ClientEventType.SAVE_TO_STORAGE,
|
|
380
384
|
payload: {
|
|
381
385
|
key,
|
|
382
|
-
value,
|
|
386
|
+
value: typeof value === 'string' ? value : JSON.stringify(value),
|
|
383
387
|
},
|
|
384
388
|
});
|
|
385
389
|
}
|
|
@@ -42,6 +42,7 @@ var ClientEventType;
|
|
|
42
42
|
ClientEventType["USER"] = "xBeesUser";
|
|
43
43
|
ClientEventType["SAVE_TO_STORAGE"] = "xBeesSaveToStorage";
|
|
44
44
|
ClientEventType["REQUEST_FROM_STORAGE"] = "xBeesRequestFromStorage";
|
|
45
|
+
ClientEventType["CACHED_CONTACT"] = "xBeesCachedContact";
|
|
45
46
|
})(ClientEventType || (exports.ClientEventType = ClientEventType = {}));
|
|
46
47
|
var UrlParams;
|
|
47
48
|
(function (UrlParams) {
|
package/dist-es/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.2.19-alpha.
|
|
3
|
+
"version": "1.2.19-alpha.6",
|
|
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
|
@@ -107,11 +107,11 @@ export class Client {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
sendDailyIntegrationUsageAnalytics() {
|
|
110
|
-
const
|
|
110
|
+
const sentUsageAnalyticsDate = this.getFromStorage('sentUsageAnalyticsDate');
|
|
111
111
|
const today = new Date().toDateString();
|
|
112
|
-
if (
|
|
112
|
+
if (sentUsageAnalyticsDate !== today) {
|
|
113
113
|
this.sendAnalytics('xBeesIntegrationUsage');
|
|
114
|
-
this.saveToStorage('
|
|
114
|
+
this.saveToStorage('sentUsageAnalyticsDate', today);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
ready(props = SupportedPlatformVariant.ALL) {
|
|
@@ -198,6 +198,9 @@ export class Client {
|
|
|
198
198
|
getCurrentConversation() {
|
|
199
199
|
return this.sendAsync({ type: ClientEventType.CURRENT_CONVERSATION });
|
|
200
200
|
}
|
|
201
|
+
getCachedContact() {
|
|
202
|
+
return this.sendAsync({ type: ClientEventType.CACHED_CONTACT });
|
|
203
|
+
}
|
|
201
204
|
contactUpdated(query, contact) {
|
|
202
205
|
return this.sendAsync({ type: ClientEventType.CONTACT_CREATE_OR_UPDATE, payload: { query, contact } });
|
|
203
206
|
}
|
|
@@ -334,8 +337,9 @@ export class Client {
|
|
|
334
337
|
getFromStorage(key) {
|
|
335
338
|
return this.localStorageManager.retrieve(key);
|
|
336
339
|
}
|
|
337
|
-
saveToStorage(key, value) {
|
|
340
|
+
saveToStorage(key, value, sendToXbees = false) {
|
|
338
341
|
this.localStorageManager.save(key, value);
|
|
342
|
+
sendToXbees && this.sendToXbeesStorage(key, value);
|
|
339
343
|
}
|
|
340
344
|
deleteFromStorage(key) {
|
|
341
345
|
this.localStorageManager.delete(key);
|
|
@@ -373,7 +377,7 @@ export class Client {
|
|
|
373
377
|
type: ClientEventType.SAVE_TO_STORAGE,
|
|
374
378
|
payload: {
|
|
375
379
|
key,
|
|
376
|
-
value,
|
|
380
|
+
value: typeof value === 'string' ? value : JSON.stringify(value),
|
|
377
381
|
},
|
|
378
382
|
});
|
|
379
383
|
}
|
|
@@ -39,6 +39,7 @@ export var ClientEventType;
|
|
|
39
39
|
ClientEventType["USER"] = "xBeesUser";
|
|
40
40
|
ClientEventType["SAVE_TO_STORAGE"] = "xBeesSaveToStorage";
|
|
41
41
|
ClientEventType["REQUEST_FROM_STORAGE"] = "xBeesRequestFromStorage";
|
|
42
|
+
ClientEventType["CACHED_CONTACT"] = "xBeesCachedContact";
|
|
42
43
|
})(ClientEventType || (ClientEventType = {}));
|
|
43
44
|
export var UrlParams;
|
|
44
45
|
(function (UrlParams) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -52,6 +52,7 @@ export declare class Client implements ConnectClient {
|
|
|
52
52
|
getContext(): Promise<Message<ClientEventType.CONTEXT>>;
|
|
53
53
|
getCurrentContact(): Promise<Message<ClientEventType.CURRENT_CONTACT>>;
|
|
54
54
|
getCurrentConversation(): Promise<Message<ClientEventType.CURRENT_CONVERSATION>>;
|
|
55
|
+
getCachedContact(): Promise<Message<ClientEventType.CACHED_CONTACT>>;
|
|
55
56
|
contactUpdated(query: ContactQuery, contact: Contact): Promise<Message<ClientEventType.CONTACT_CREATE_OR_UPDATE>>;
|
|
56
57
|
contactMatchUpdated(query: ContactQuery, contact: Contact): Promise<ResponseMessage<ClientEventType.CONTACT_MATCH_UPDATE>>;
|
|
57
58
|
getThemeMode(): Promise<Message<ClientEventType.THEME_MODE>>;
|
|
@@ -75,7 +76,7 @@ export declare class Client implements ConnectClient {
|
|
|
75
76
|
onLookupAndMatchContact(callback: (query: ContactQuery, resolve: LookupAndMatchContactsResolver, reject: Reject) => void): RemoveEventListener;
|
|
76
77
|
onThemeChange(callback: Callback<EventType.USE_THEME>): RemoveEventListener;
|
|
77
78
|
getFromStorage<Type>(key: string): Type | null;
|
|
78
|
-
saveToStorage<SavingType>(key: string, value: SavingType): void;
|
|
79
|
+
saveToStorage<SavingType>(key: string, value: SavingType, sendToXbees?: boolean): void;
|
|
79
80
|
deleteFromStorage(key: string): void;
|
|
80
81
|
onStorage(listener: StorageEventCallback): () => void;
|
|
81
82
|
onLogout(callback: Callback<EventType.LOGOUT>): RemoveEventListener;
|
|
@@ -83,6 +84,6 @@ export declare class Client implements ConnectClient {
|
|
|
83
84
|
setIntegrationStorageKey(integrationKey: string): void;
|
|
84
85
|
getTechnicalSupport(): TechnicalSupport;
|
|
85
86
|
onVisibilityChange(callback: Callback<EventType.VISIBILITY>): RemoveEventListener;
|
|
86
|
-
sendToXbeesStorage(key: string, value:
|
|
87
|
-
requestFromXbeesStorage
|
|
87
|
+
sendToXbeesStorage<SavingType>(key: string, value: SavingType): void;
|
|
88
|
+
requestFromXbeesStorage(key: string): Promise<ResponseMessage<ClientEventType.REQUEST_FROM_STORAGE>>;
|
|
88
89
|
}
|
|
@@ -36,7 +36,8 @@ export declare enum ClientEventType {
|
|
|
36
36
|
SEND_TECHNICAL_SUPPORT_INFORMATION = "xBeesSendTechInfo",
|
|
37
37
|
USER = "xBeesUser",
|
|
38
38
|
SAVE_TO_STORAGE = "xBeesSaveToStorage",
|
|
39
|
-
REQUEST_FROM_STORAGE = "xBeesRequestFromStorage"
|
|
39
|
+
REQUEST_FROM_STORAGE = "xBeesRequestFromStorage",
|
|
40
|
+
CACHED_CONTACT = "xBeesCachedContact"
|
|
40
41
|
}
|
|
41
42
|
export declare enum UrlParams {
|
|
42
43
|
TOKEN = "t",
|
|
@@ -75,6 +75,9 @@ export interface ConnectClient {
|
|
|
75
75
|
/**
|
|
76
76
|
* Retrieves current opened in x-bees conversation data or undefined if the conversation is temporary */
|
|
77
77
|
getCurrentConversation: () => Promise<ResponseMessage<ClientEventType.CURRENT_CONVERSATION>>;
|
|
78
|
+
/**
|
|
79
|
+
* Retrieves contact cached by x-bees */
|
|
80
|
+
getCachedContact: () => Promise<ResponseMessage<ClientEventType.CACHED_CONTACT>>;
|
|
78
81
|
/**
|
|
79
82
|
* Sends notification to x-bees about contact data updated */
|
|
80
83
|
contactUpdated(query: ContactQuery, contact: Contact): Promise<ResponseMessage<ClientEventType.CONTACT_CREATE_OR_UPDATE>>;
|
|
@@ -168,4 +171,10 @@ export interface ConnectClient {
|
|
|
168
171
|
/**
|
|
169
172
|
* Starts listen for the events of changing iframe activity and handle with the provided callback */
|
|
170
173
|
onVisibilityChange: (callback: Callback<EventType.VISIBILITY>) => RemoveEventListener;
|
|
174
|
+
/**
|
|
175
|
+
* Send data to save in x-bees storage */
|
|
176
|
+
sendToXbeesStorage: (key: string, value: string) => void;
|
|
177
|
+
/**
|
|
178
|
+
* Request stored data from x-bees storage */
|
|
179
|
+
requestFromXbeesStorage: (key: string) => Promise<ResponseMessage<ClientEventType.REQUEST_FROM_STORAGE>>;
|
|
171
180
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
interface ContactShape {
|
|
1
|
+
export interface ContactShape {
|
|
2
2
|
id: string;
|
|
3
3
|
name: string;
|
|
4
4
|
email?: string;
|
|
5
5
|
phone?: string;
|
|
6
|
+
picture?: string;
|
|
6
7
|
mobileNumber?: string;
|
|
7
8
|
officeNumber?: string;
|
|
8
9
|
faxNumber?: string;
|
|
@@ -21,4 +22,3 @@ export type ContactQuery = {
|
|
|
21
22
|
email?: string;
|
|
22
23
|
phone?: string;
|
|
23
24
|
};
|
|
24
|
-
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ClientEventType, EventType } from '../src/enums';
|
|
2
|
+
import { CachedContact } from './CachedContact';
|
|
2
3
|
import { ContactQuery } from './Contact';
|
|
3
4
|
import { Message, MessageType } from './Message';
|
|
4
5
|
import { IPayloadAutoSuggestResult, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContextResult, IPayloadConversationResult, IPayloadRequestFromStorage, IPayloadSendAnalytics, IPayloadSentToStorage, IPayloadTechSupport, IPayloadThemeChange, IPayloadToast, IPayloadVersion, IPayloadViewPort } from './Payload';
|
|
5
6
|
import { SupportedPlatformVariant } from './Platform';
|
|
6
7
|
import { XBeesUser } from './XBeesUser';
|
|
7
|
-
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.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.VISIBILITY ? boolean : T extends ClientEventType.USER ? XBeesUser : T extends ClientEventType.SAVE_TO_STORAGE ? IPayloadSentToStorage : T extends ClientEventType.REQUEST_FROM_STORAGE ? IPayloadRequestFromStorage : 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.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.VISIBILITY ? boolean : T extends ClientEventType.USER ? XBeesUser : T extends ClientEventType.SAVE_TO_STORAGE ? IPayloadSentToStorage : T extends ClientEventType.REQUEST_FROM_STORAGE ? IPayloadRequestFromStorage : T extends ClientEventType.CACHED_CONTACT ? CachedContact | null : never;
|
|
8
9
|
export type EventPayloadMap = {
|
|
9
10
|
[EventType.GET_CONTACTS_AUTO_SUGGEST]: string;
|
|
10
11
|
[EventType.GET_LOOK_UP_AND_MATCH]: ContactQuery;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.2.19-alpha.
|
|
3
|
+
"version": "1.2.19-alpha.7",
|
|
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": "",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=16"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "b27f6fe6b4a9ec487df32fc601639960b694d606"
|
|
47
47
|
}
|