@wildix/xbees-connect 1.1.14 → 1.1.16
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-es/package.json +1 -1
- package/dist-es/src/Client.js +11 -12
- package/dist-es/src/enums/index.js +2 -0
- package/dist-es/src/helpers/LocalStorageManager.js +3 -0
- package/dist-types/src/Client.d.ts +2 -3
- package/dist-types/src/enums/index.d.ts +2 -0
- package/dist-types/src/helpers/LocalStorageManager.d.ts +1 -0
- package/dist-types/types/index.d.ts +3 -6
- package/package.json +2 -2
package/dist-es/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.15",
|
|
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
|
@@ -183,18 +183,6 @@ export class Client {
|
|
|
183
183
|
isAuthorized() {
|
|
184
184
|
return this.sendAsync({ type: ClientEventType.AUTHORIZED });
|
|
185
185
|
}
|
|
186
|
-
sendContactsAutoSuggest(payload) {
|
|
187
|
-
return this.sendAsync({
|
|
188
|
-
type: ClientEventType.CONTACTS_AUTO_SUGGEST,
|
|
189
|
-
payload,
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
sendContactMatch(payload) {
|
|
193
|
-
return this.sendAsync({
|
|
194
|
-
type: ClientEventType.CONTACT_LOOKUP_AND_MATCH,
|
|
195
|
-
payload,
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
186
|
addEventListener(eventName, callback) {
|
|
199
187
|
if (!this.useSubscription) {
|
|
200
188
|
this.useSubscription = true;
|
|
@@ -236,6 +224,10 @@ export class Client {
|
|
|
236
224
|
return this.sendAsync({ type: ClientEventType.TOKEN });
|
|
237
225
|
}
|
|
238
226
|
onSuggestContacts(callback) {
|
|
227
|
+
// send event to x-bees
|
|
228
|
+
void this.sendAsync({
|
|
229
|
+
type: ClientEventType.CONTACTS_AUTO_SUGGEST_IS_SUPPORTED,
|
|
230
|
+
});
|
|
239
231
|
return this.addEventListener(EventType.GET_CONTACTS_AUTO_SUGGEST, (query) => {
|
|
240
232
|
const resolve = (contacts) => this.sendAsync({
|
|
241
233
|
type: ClientEventType.CONTACTS_AUTO_SUGGEST,
|
|
@@ -256,6 +248,10 @@ export class Client {
|
|
|
256
248
|
});
|
|
257
249
|
}
|
|
258
250
|
onLookupAndMatchContact(callback) {
|
|
251
|
+
// send event to x-bees
|
|
252
|
+
void this.sendAsync({
|
|
253
|
+
type: ClientEventType.CONTACT_LOOK_UP_AND_MATCH_IS_SUPPORTED,
|
|
254
|
+
});
|
|
259
255
|
return this.addEventListener(EventType.GET_LOOK_UP_AND_MATCH, (query) => {
|
|
260
256
|
const resolve = (contact) => this.sendAsync({
|
|
261
257
|
type: ClientEventType.CONTACT_LOOKUP_AND_MATCH,
|
|
@@ -310,4 +306,7 @@ export class Client {
|
|
|
310
306
|
},
|
|
311
307
|
});
|
|
312
308
|
}
|
|
309
|
+
setIntegrationStorageKey(integrationKey) {
|
|
310
|
+
this.localStorageManager.setIntegrationKey(integrationKey);
|
|
311
|
+
}
|
|
313
312
|
}
|
|
@@ -29,6 +29,8 @@ export var ClientEventType;
|
|
|
29
29
|
ClientEventType["CONTACT_LOOKUP_AND_MATCH"] = "xBeesContactLookupAndMatch";
|
|
30
30
|
ClientEventType["CONTACT_LOOKUP_AND_MATCH_NOT_FOUND"] = "xBeesContactLookupAndMatchNotFound";
|
|
31
31
|
ClientEventType["CONTACT_CREATE_OR_UPDATE"] = "xBeesContactCreateOrUpdate";
|
|
32
|
+
ClientEventType["CONTACTS_AUTO_SUGGEST_IS_SUPPORTED"] = "xBeesContactsAutoSuggestIsSupported";
|
|
33
|
+
ClientEventType["CONTACT_LOOK_UP_AND_MATCH_IS_SUPPORTED"] = "xBeesContactLookupAndMatchIsSupported";
|
|
32
34
|
ClientEventType["LOGOUT_IS_SUPPORTED"] = "xBeesLogoutIsSupported";
|
|
33
35
|
ClientEventType["SEND_ANALYTICS"] = "xBeesSendAnalytics";
|
|
34
36
|
})(ClientEventType || (ClientEventType = {}));
|
|
@@ -8,6 +8,9 @@ class LocalStorageManager {
|
|
|
8
8
|
}
|
|
9
9
|
listeners = new Set();
|
|
10
10
|
integrationKey = '';
|
|
11
|
+
setIntegrationKey(integrationKey) {
|
|
12
|
+
this.integrationKey = integrationKey;
|
|
13
|
+
}
|
|
11
14
|
getStorageKey(key) {
|
|
12
15
|
return !this.integrationKey ? key : `${this.integrationKey}_${key}`;
|
|
13
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Callback, ConnectClient, Contact, ContactQuery,
|
|
1
|
+
import { Callback, ConnectClient, Contact, ContactQuery, IPayloadViewPort, LookupAndMatchContactsResolver, Message, Reject, RemoveEventListener, ResponseMessage, StorageEventCallback, SuggestContactsResolver, SupportedPlatformVariant, ToastSeverity } from '../types';
|
|
2
2
|
import { ClientEventType, EventType } from './enums';
|
|
3
3
|
/**
|
|
4
4
|
* Client provides functionality of communication between xBees and integrated web applications via iFrame or ReactNative WebView
|
|
@@ -49,8 +49,6 @@ export declare class Client implements ConnectClient {
|
|
|
49
49
|
showToast(message: string, severity?: ToastSeverity | undefined): Promise<ResponseMessage>;
|
|
50
50
|
isNotAuthorized(): Promise<ResponseMessage>;
|
|
51
51
|
isAuthorized(): Promise<ResponseMessage>;
|
|
52
|
-
sendContactsAutoSuggest(payload: IPayloadAutoSuggestResult): Promise<Message<ClientEventType.CONTACTS_AUTO_SUGGEST>>;
|
|
53
|
-
sendContactMatch(payload: IPayloadContactMatchResult): Promise<Message<ClientEventType.CONTACT_LOOKUP_AND_MATCH>>;
|
|
54
52
|
addEventListener<T extends EventType = EventType>(eventName: T, callback: Callback<T>): RemoveEventListener;
|
|
55
53
|
removeEventListener<T extends EventType = EventType>(eventName: T | null, callback: Callback<T>): void;
|
|
56
54
|
off(callback: Callback | StorageEventCallback): void;
|
|
@@ -68,4 +66,5 @@ export declare class Client implements ConnectClient {
|
|
|
68
66
|
onStorage(listener: StorageEventCallback): () => void;
|
|
69
67
|
onLogout(callback: Callback<EventType.LOGOUT>): RemoveEventListener;
|
|
70
68
|
sendAnalytics(eventName: string, params?: Record<string, string>): void;
|
|
69
|
+
setIntegrationStorageKey(integrationKey: string): void;
|
|
71
70
|
}
|
|
@@ -27,6 +27,8 @@ export declare enum ClientEventType {
|
|
|
27
27
|
CONTACT_LOOKUP_AND_MATCH = "xBeesContactLookupAndMatch",
|
|
28
28
|
CONTACT_LOOKUP_AND_MATCH_NOT_FOUND = "xBeesContactLookupAndMatchNotFound",
|
|
29
29
|
CONTACT_CREATE_OR_UPDATE = "xBeesContactCreateOrUpdate",
|
|
30
|
+
CONTACTS_AUTO_SUGGEST_IS_SUPPORTED = "xBeesContactsAutoSuggestIsSupported",
|
|
31
|
+
CONTACT_LOOK_UP_AND_MATCH_IS_SUPPORTED = "xBeesContactLookupAndMatchIsSupported",
|
|
30
32
|
LOGOUT_IS_SUPPORTED = "xBeesLogoutIsSupported",
|
|
31
33
|
SEND_ANALYTICS = "xBeesSendAnalytics"
|
|
32
34
|
}
|
|
@@ -199,12 +199,6 @@ export interface ConnectClient {
|
|
|
199
199
|
/**
|
|
200
200
|
* Sends message to x-bees to be shown as a toast with specified severity level */
|
|
201
201
|
showToast: (message: string, severity?: ToastSeverity) => Promise<ResponseMessage>;
|
|
202
|
-
/**
|
|
203
|
-
* Sends a response to x-bees for contacts autoSuggest */
|
|
204
|
-
sendContactsAutoSuggest: (payload: IPayloadAutoSuggestResult) => Promise<Message<ClientEventType.CONTACTS_AUTO_SUGGEST>>;
|
|
205
|
-
/**
|
|
206
|
-
* Sends a response to x-bees for contact match */
|
|
207
|
-
sendContactMatch: (payload: IPayloadContactMatchResult) => Promise<Message<ClientEventType.CONTACT_LOOKUP_AND_MATCH>>;
|
|
208
202
|
/**
|
|
209
203
|
* pushes to x-bees message that user is authorized and no more actions required */
|
|
210
204
|
isAuthorized: () => Promise<ResponseMessage>;
|
|
@@ -253,6 +247,9 @@ export interface ConnectClient {
|
|
|
253
247
|
/**
|
|
254
248
|
* Removes data from localStorage */
|
|
255
249
|
deleteFromStorage: (key: string) => void;
|
|
250
|
+
/**
|
|
251
|
+
* Set parent integration key to switch to parent integration localStorage data */
|
|
252
|
+
setIntegrationStorageKey: (integrationKey: string) => void;
|
|
256
253
|
/**
|
|
257
254
|
* listens on localStorage */
|
|
258
255
|
onStorage: (listener: StorageEventCallback) => () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-connect",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.16",
|
|
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": "",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=16"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "2f71923d9d094f77d8e41b6ea7a2e7dc4aed9c1b"
|
|
46
46
|
}
|