@wildix/xbees-connect 1.0.4-alpha.1 → 1.0.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/README.md CHANGED
@@ -7,14 +7,19 @@ This package is the Community plan edition of the client for UI integration appl
7
7
  Install the package in your project directory with:
8
8
 
9
9
  yarn
10
+
10
11
  ```bash
11
12
  yarn add @wildix/xbees-connect
12
13
  ```
14
+
13
15
  npm
16
+
14
17
  ```bash
15
18
  npm install @wildix/xbees-connect
16
19
  ```
20
+
17
21
  ## Usage
22
+
18
23
  ```
19
24
  import Client from "@wildix/xbees-connect";
20
25
 
package/dist-es/index.js CHANGED
@@ -1,6 +1,2 @@
1
1
  import { Client } from './src/Client';
2
- (function () {
3
- // @ts-expect-error window.xBeesConnect will be used inside another app
4
- window.xBeesConnect = Client;
5
- })();
6
2
  export default Client;
@@ -1,10 +1,11 @@
1
1
  {
2
- "name": "xbees-connect",
3
- "version": "1.0.0",
2
+ "name": "@wildix/xbees-connect",
3
+ "version": "1.0.4-alpha.10",
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": "",
7
- "license": "UNLICENSED",
7
+ "sideEffects": false,
8
+ "license": "MIT",
8
9
  "main": "./dist-cjs/index.js",
9
10
  "types": "./dist-types/index.d.ts",
10
11
  "module": "./dist-es/index.js",
@@ -13,6 +14,8 @@
13
14
  "build:es": "tsc -p tsconfig.es.json",
14
15
  "build:types": "tsc -p tsconfig.types.json",
15
16
  "build:docs": "typedoc",
17
+ "lint": "eslint .",
18
+ "lint:fix": "eslint . --fix",
16
19
  "clean": "rimraf ./dist-* && rimraf *.tsbuildinfo"
17
20
  },
18
21
  "files": [
@@ -20,15 +23,22 @@
20
23
  ],
21
24
  "repository": {
22
25
  "type": "git",
23
- "url": "git@git.wildix.com:dimitri.chernykh/sdk-ui.git"
26
+ "url": "git@git.wildix.com:xbs/sdk-ui.git"
24
27
  },
25
- "engines": {
26
- "node": ">=18"
28
+ "publishConfig": {
29
+ "access": "public"
27
30
  },
28
- "dependencies": {
31
+ "devDependencies": {
32
+ "eslint": "^8.53.0",
33
+ "rimraf": "^5.0.5",
29
34
  "typescript": "^5.2.2"
30
35
  },
31
- "devDependencies": {
32
- "rimraf": "^5.0.5"
36
+ "parserOptions": {
37
+ "project": [
38
+ "./tsconfig.json"
39
+ ]
40
+ },
41
+ "engines": {
42
+ "node": ">=16"
33
43
  }
34
44
  }
@@ -1,30 +1,48 @@
1
- import { ClientEventType, EventType, } from './types';
2
- import PostMessageControllerNative from './PostMessageControllerNative';
3
- import PostMessageControllerWeb from './PostMessageControllerWeb';
4
1
  import packageJson from '../package.json';
2
+ import PostMessageControllerNative from './helpers/PostMessageControllerNative';
3
+ import PostMessageControllerWeb from './helpers/PostMessageControllerWeb';
4
+ import { ClientEventType, EventType, } from './types';
5
5
  /**
6
6
  * Client provides functionality of communication between xBees and integrated web applications via iFrame or ReactNative WebView
7
7
  * integration creates na instance with new Client()
8
8
  * */
9
9
  export class Client {
10
+ static instance = null;
10
11
  static getInstance() {
11
12
  if (!this.instance) {
12
13
  this.instance = new Client();
13
14
  }
14
15
  return this.instance;
15
16
  }
17
+ static initialize(renderer) {
18
+ if (this.getInstance().showsUi()) {
19
+ try {
20
+ void renderer();
21
+ }
22
+ catch (error) {
23
+ console.error('Error on init rendering widget:', error);
24
+ }
25
+ }
26
+ else {
27
+ console.log('run daemon');
28
+ void this.getInstance().ready();
29
+ }
30
+ }
31
+ worker;
32
+ listeners = [];
33
+ useSubscription = false;
34
+ iframeId;
35
+ variant = null;
16
36
  constructor() {
17
- this.listeners = [];
18
- this.useSubscription = false;
19
- this.iframeId = null;
20
- this.variant = null;
21
37
  const params = new URLSearchParams(window.location.search);
22
38
  this.iframeId = params.get('iframeId');
23
39
  this.variant = params.get('variant');
24
40
  // @ts-expect-error window.ReactNativeWebView will be provided by ReactNative WebView
25
- this.worker = window.ReactNativeWebView ? new PostMessageControllerNative() : new PostMessageControllerWeb();
41
+ this.worker = window.ReactNativeWebView
42
+ ? new PostMessageControllerNative()
43
+ : new PostMessageControllerWeb();
26
44
  }
27
- async sendAsync(data) {
45
+ sendAsync(data) {
28
46
  return this.worker.sendAsync({
29
47
  ...data,
30
48
  iframeId: this.iframeId,
@@ -38,7 +56,8 @@ export class Client {
38
56
  }
39
57
  return data;
40
58
  }
41
- catch (e) {
59
+ catch (error) {
60
+ console.error('parse message error', error);
42
61
  return null;
43
62
  }
44
63
  }
@@ -51,19 +70,22 @@ export class Client {
51
70
  this.listeners.forEach(({ eventName, callback }) => {
52
71
  if (eventName === type) {
53
72
  if (type === EventType.ADD_CALL) {
54
- const cb = callback;
55
- cb(payload);
73
+ const callbackFn = callback;
74
+ callbackFn(payload);
56
75
  }
57
76
  else {
58
77
  // @ts-expect-error TODO: check the type for Callback<?>
59
- const cb = callback;
60
- cb(payload);
78
+ const callbackFn = callback;
79
+ callbackFn(payload);
61
80
  }
62
81
  }
63
82
  });
64
83
  }
65
- async ready() {
66
- return this.sendAsync({ type: ClientEventType.READY, payload: { version: this.version() } });
84
+ ready() {
85
+ return this.sendAsync({
86
+ type: ClientEventType.READY,
87
+ payload: { version: this.version() },
88
+ });
67
89
  }
68
90
  version() {
69
91
  return packageJson.version;
@@ -74,40 +96,43 @@ export class Client {
74
96
  showsUi() {
75
97
  return !this.isDaemon();
76
98
  }
77
- async getContext() {
99
+ getContext() {
78
100
  return this.sendAsync({ type: ClientEventType.CONTEXT });
79
101
  }
80
- async getCurrentContact() {
102
+ getCurrentContact() {
81
103
  return this.sendAsync({ type: ClientEventType.CURRENT_CONTACT });
82
104
  }
83
- async getThemeMode() {
105
+ getThemeMode() {
84
106
  return this.sendAsync({ type: ClientEventType.THEME_MODE });
85
107
  }
86
- async getTheme() {
108
+ getTheme() {
87
109
  return this.sendAsync({ type: ClientEventType.THEME });
88
110
  }
89
- async startCall(phoneNumber) {
90
- return this.sendAsync({ type: ClientEventType.START_CALL, payload: { phoneNumber } });
111
+ startCall(phoneNumber) {
112
+ return this.sendAsync({
113
+ type: ClientEventType.START_CALL,
114
+ payload: { phoneNumber },
115
+ });
91
116
  }
92
- async reboot() {
117
+ reboot() {
93
118
  return this.sendAsync({ type: ClientEventType.REBOOT });
94
119
  }
95
- async setViewport(payload) {
120
+ setViewport(payload) {
96
121
  return this.sendAsync({ type: ClientEventType.VIEW_PORT, payload });
97
122
  }
98
- async toClipboard(payload) {
123
+ toClipboard(payload) {
99
124
  return this.sendAsync({ type: ClientEventType.TO_CLIPBOARD, payload });
100
125
  }
101
- async isNotAuthorized(payload) {
102
- return this.sendAsync({ type: ClientEventType.NOT_AUTHORIZED, payload });
126
+ isNotAuthorized() {
127
+ return this.sendAsync({ type: ClientEventType.NOT_AUTHORIZED });
103
128
  }
104
- async isAuthorized(payload) {
105
- return this.sendAsync({ type: ClientEventType.AUTHORIZED, payload });
129
+ isAuthorized() {
130
+ return this.sendAsync({ type: ClientEventType.AUTHORIZED });
106
131
  }
107
- async getContactsAutoSuggest(payload) {
132
+ getContactsAutoSuggest(payload) {
108
133
  return this.sendAsync({
109
134
  type: ClientEventType.CONTACTS_AUTO_SUGGEST,
110
- payload: payload,
135
+ payload,
111
136
  });
112
137
  }
113
138
  addEventListener(eventName, callback) {
@@ -119,10 +144,13 @@ export class Client {
119
144
  if (!foundThisEvent) {
120
145
  this.listeners.push({ eventName, callback });
121
146
  }
122
- return () => { this.removeEventListener(eventName, callback); };
147
+ return () => {
148
+ this.removeEventListener(eventName, callback);
149
+ };
123
150
  }
124
151
  removeEventListener(eventName, callback) {
125
- this.listeners = this.listeners.filter(({ eventName: _eventName, callback: _callback }) => !(Object.is(callback, _callback) && (!eventName ? true : eventName === _eventName)));
152
+ this.listeners = this.listeners.filter(({ eventName: _eventName, callback: _callback }) => !(Object.is(callback, _callback) &&
153
+ (!eventName ? true : eventName === _eventName)));
126
154
  if (this.useSubscription && !this.listeners.length) {
127
155
  this.useSubscription = false;
128
156
  window.removeEventListener('message', this.onMessage.bind(this));
@@ -142,23 +170,21 @@ export class Client {
142
170
  }
143
171
  onSuggestContacts(callback) {
144
172
  return this.addEventListener(EventType.GET_CONTACTS_AUTO_SUGGEST, (query) => {
145
- const resolve = (contacts) => {
146
- return this.sendAsync({
147
- type: ClientEventType.CONTACTS_AUTO_SUGGEST,
148
- payload: {
149
- contacts,
150
- query
151
- },
152
- });
153
- };
173
+ const resolve = (contacts) => this.sendAsync({
174
+ type: ClientEventType.CONTACTS_AUTO_SUGGEST,
175
+ payload: {
176
+ contacts,
177
+ query,
178
+ },
179
+ });
154
180
  const reject = (reason) => {
155
181
  console.debug(reason);
156
182
  };
157
183
  try {
158
184
  callback(query, resolve, reject);
159
185
  }
160
- catch (e) {
161
- reject(e.toString());
186
+ catch (error) {
187
+ reject(`${error}`);
162
188
  }
163
189
  });
164
190
  }
@@ -166,4 +192,3 @@ export class Client {
166
192
  this.addEventListener(EventType.USE_THEME, callback);
167
193
  }
168
194
  }
169
- Client.instance = null;
@@ -1,43 +1,44 @@
1
1
  export default class PostMessageControllerNative {
2
+ target;
3
+ timeout = 10000;
2
4
  constructor() {
3
- this.timeout = 10000;
4
5
  // @ts-expect-error window.ReactNativeWebView will be provided by ReactNative WebView
5
6
  this.target = window.ReactNativeWebView;
6
7
  }
7
- async sendAsync(data) {
8
+ sendAsync(data) {
8
9
  if (!this.target) {
9
- return Promise.reject('xBeesConnect should be wrapped within iframe to perform the connection');
10
+ return Promise.reject('your application should be wrapped within iframe to xbees-connect perform the connection');
10
11
  }
11
12
  return this.send(this.target, data);
12
13
  }
13
- send(target, payload) {
14
- return new Promise((res, rej) => {
14
+ send(target, message) {
15
+ return new Promise((resolve, reject) => {
15
16
  const channel = new MessageChannel();
16
17
  const listener = (event) => {
17
18
  try {
18
19
  const parsedData = JSON.parse(event.data);
19
- if (parsedData?.type === payload.type) {
20
+ if (parsedData?.type === message.type) {
20
21
  clearTimeout(timeout);
21
22
  window.removeEventListener('message', listener);
22
23
  if (!parsedData.errorMessage) {
23
- res(parsedData);
24
+ resolve(parsedData);
24
25
  }
25
26
  else {
26
- rej(parsedData);
27
+ reject(parsedData);
27
28
  }
28
29
  }
29
30
  }
30
- catch (e) {
31
- console.error("on receive response Error", e);
31
+ catch (error) {
32
+ console.error('on receive response Error', error);
32
33
  }
33
34
  };
34
35
  window.addEventListener('message', listener);
35
36
  const timeout = setTimeout(() => {
36
37
  channel.port1.close();
37
38
  window.removeEventListener('message', listener);
38
- rej({ errorMessage: 'timeout', type: payload.type });
39
+ reject({ errorMessage: 'timeout', type: message.type });
39
40
  }, this.timeout);
40
- target.postMessage(JSON.stringify(payload));
41
+ target.postMessage(JSON.stringify(message));
41
42
  });
42
43
  }
43
44
  }
@@ -1,29 +1,30 @@
1
1
  export default class PostMessageControllerWeb {
2
+ target;
3
+ timeout = 10000;
2
4
  constructor() {
3
- this.timeout = 10000;
4
5
  this.target = parent;
5
6
  }
6
- async sendAsync(data) {
7
+ sendAsync(data) {
7
8
  if (!this.target || this.target === window) {
8
- return Promise.reject('xBeesConnect should be wrapped within iframe to perform the connection');
9
+ return Promise.reject('your application should be wrapped within iframe to xbees-connect perform the connection');
9
10
  }
10
11
  return this.send(this.target, data);
11
12
  }
12
13
  send(target, payload) {
13
- return new Promise((res, rej) => {
14
+ return new Promise((resolve, reject) => {
14
15
  const channel = new MessageChannel();
15
16
  const timeout = setTimeout(() => {
16
17
  channel.port1.close();
17
- rej({ errorMessage: 'timeout', type: payload.type });
18
+ reject({ errorMessage: 'timeout', type: payload.type });
18
19
  }, this.timeout);
19
20
  channel.port1.onmessage = ({ data }) => {
20
21
  clearTimeout(timeout);
21
22
  channel.port1.close();
22
23
  if (!data.errorMessage) {
23
- res(data);
24
+ resolve(data);
24
25
  }
25
26
  else {
26
- rej(data);
27
+ reject(data);
27
28
  }
28
29
  };
29
30
  target.postMessage(payload, '*', [channel.port2]);
@@ -1,4 +1,4 @@
1
- import { AutoSuggestResult, Callback, ConnectClient, EventType, Reject, RemoveEventListener, Resolve, Response } from './types';
1
+ import { AutoSuggestResult, Callback, ConnectClient, EventType, Reject, RemoveEventListener, Resolve, Response, ViewPortSize } from './types';
2
2
  /**
3
3
  * Client provides functionality of communication between xBees and integrated web applications via iFrame or ReactNative WebView
4
4
  * integration creates na instance with new Client()
@@ -6,6 +6,7 @@ import { AutoSuggestResult, Callback, ConnectClient, EventType, Reject, RemoveEv
6
6
  export declare class Client implements ConnectClient {
7
7
  private static instance;
8
8
  static getInstance(): Client;
9
+ static initialize(renderer: () => Promise<void>): void;
9
10
  private worker;
10
11
  private listeners;
11
12
  private useSubscription;
@@ -25,13 +26,10 @@ export declare class Client implements ConnectClient {
25
26
  getTheme(): Promise<Response>;
26
27
  startCall(phoneNumber: string): Promise<Response>;
27
28
  reboot(): Promise<Response>;
28
- setViewport(payload: {
29
- height: number;
30
- width: number;
31
- }): Promise<Response>;
29
+ setViewport(payload: ViewPortSize): Promise<Response>;
32
30
  toClipboard(payload: string): Promise<Response>;
33
- isNotAuthorized(payload: string): Promise<Response>;
34
- isAuthorized(payload: string): Promise<Response>;
31
+ isNotAuthorized(): Promise<Response>;
32
+ isAuthorized(): Promise<Response>;
35
33
  getContactsAutoSuggest(payload: AutoSuggestResult): Promise<Response>;
36
34
  addEventListener<T extends EventType = EventType>(eventName: T, callback: Callback<T>): RemoveEventListener;
37
35
  removeEventListener<T extends EventType = EventType>(eventName: T | null, callback: Callback<T>): void;
@@ -0,0 +1,8 @@
1
+ import { MessageResponse, PostMessageController, Response } from '../types';
2
+ export default class PostMessageControllerNative implements PostMessageController {
3
+ private readonly target;
4
+ private timeout;
5
+ constructor();
6
+ sendAsync(data: MessageResponse): Promise<Response>;
7
+ private send;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { MessageResponse, PostMessageController, Response } from '../types';
2
+ export default class PostMessageControllerWeb implements PostMessageController {
3
+ private readonly target;
4
+ private timeout;
5
+ constructor();
6
+ sendAsync(data: MessageResponse): Promise<Response>;
7
+ private send;
8
+ }
@@ -1,3 +1,25 @@
1
+ export declare enum EventType {
2
+ GET_CONTACTS_AUTO_SUGGEST = "xBeesGetContactsAutoSuggest",
3
+ ADD_CALL = "xBeesAddCall",
4
+ TERMINATE_CALL = "xBeesTerminateCall",
5
+ USE_THEME = "xBeesUseTheme",
6
+ PBX_TOKEN = "xBeesPbxToken"
7
+ }
8
+ export declare enum ClientEventType {
9
+ READY = "xBeesReady",
10
+ CONTEXT = "xBeesContext",
11
+ CURRENT_CONTACT = "xBeesCurrentContact",
12
+ THEME_MODE = "xBeesThemeMode",
13
+ THEME = "xBeesTheme",
14
+ START_CALL = "xBeesStartCall",
15
+ VIEW_PORT = "xBeesViewPort",
16
+ REBOOT = "xBeesReboot",
17
+ TO_CLIPBOARD = "xBeesToClipboard",
18
+ NOT_AUTHORIZED = "xBeesNotAuthorized",
19
+ AUTHORIZED = "xBeesAuthorized",
20
+ CONTACTS_AUTO_SUGGEST = "xBeesContactsAutoSuggest"
21
+ }
22
+ export type MessageType = ClientEventType | EventType;
1
23
  interface ContactShape {
2
24
  id: string;
3
25
  name: string;
@@ -11,45 +33,41 @@ interface ContactShape {
11
33
  extension?: string;
12
34
  organization?: string;
13
35
  }
14
- export type Contact = ContactShape & {
36
+ export type Contact = (ContactShape & {
15
37
  email: string;
16
- } | ContactShape & {
38
+ }) | (ContactShape & {
17
39
  phone: string;
40
+ });
41
+ export type ViewPortSize = {
42
+ height: number;
43
+ width: number;
18
44
  };
19
- export type Message<T extends EventType = EventType> = {
45
+ type EventPayload<T extends MessageType> = T extends EventType.GET_CONTACTS_AUTO_SUGGEST ? string : T extends ClientEventType.CONTACTS_AUTO_SUGGEST ? AutoSuggestResult : T extends EventType.ADD_CALL ? CallStartInfo : T extends ClientEventType.START_CALL ? StartCallPayload : T extends ClientEventType.READY ? {
46
+ version: string;
47
+ } : T extends ClientEventType.VIEW_PORT ? ViewPortSize : T extends EventType.USE_THEME ? string : T extends EventType.PBX_TOKEN ? string : never;
48
+ export type Message<T extends MessageType = MessageType> = {
20
49
  type: T;
21
- payload: EventPayload<T>;
50
+ payload?: EventPayload<T>;
22
51
  };
23
- export type Response = {
52
+ export type MessageResponse<T extends MessageType = MessageType> = Message<T> & {
53
+ iframeId: string;
54
+ };
55
+ export type Payload = string | Record<string, string> | ThemeChangePayload;
56
+ export type Response<T extends Payload = Payload> = {
24
57
  type?: string;
25
58
  message?: string;
26
59
  errorMessage?: string;
60
+ payload?: T;
61
+ };
62
+ export type RawMessage = {
63
+ data?: string;
64
+ };
65
+ export type SendPayload = {
66
+ type: ClientEventType;
27
67
  payload?: any;
28
68
  };
29
- export declare enum EventType {
30
- GET_CONTACTS_AUTO_SUGGEST = "xBeesGetContactsAutoSuggest",
31
- ADD_CALL = "xBeesAddCall",
32
- TERMINATE_CALL = "xBeesTerminateCall",
33
- USE_THEME = "xBeesUseTheme",
34
- PBX_TOKEN = "xBeesPbxToken"
35
- }
36
- export declare enum ClientEventType {
37
- READY = "xBeesReady",
38
- CONTEXT = "xBeesContext",
39
- CURRENT_CONTACT = "xBeesCurrentContact",
40
- THEME_MODE = "xBeesThemeMode",
41
- THEME = "xBeesTheme",
42
- START_CALL = "xBeesStartCall",
43
- VIEW_PORT = "xBeesViewPort",
44
- REBOOT = "xBeesReboot",
45
- TO_CLIPBOARD = "xBeesToClipboard",
46
- NOT_AUTHORIZED = "xBeesNotAuthorized",
47
- AUTHORIZED = "xBeesAuthorized",
48
- CONTACTS_AUTO_SUGGEST = "xBeesContactsAutoSuggest"
49
- }
50
- export type MessageType = ClientEventType | EventType;
51
69
  export type ThemeChangePayload = {
52
- mode: "light" | "dark";
70
+ mode: 'light' | 'dark';
53
71
  themeOptions?: {
54
72
  typography?: unknown;
55
73
  palette?: unknown;
@@ -61,7 +79,9 @@ type CallStartInfo = {
61
79
  destination: string;
62
80
  video: boolean;
63
81
  };
64
- type EventPayload<T extends EventType> = T extends EventType.GET_CONTACTS_AUTO_SUGGEST ? string : T extends EventType.ADD_CALL ? CallStartInfo : T extends EventType.USE_THEME ? string : T extends EventType.PBX_TOKEN ? string : never;
82
+ type StartCallPayload = {
83
+ phoneNumber: string;
84
+ };
65
85
  export type EventPayloadMap = {
66
86
  [EventType.GET_CONTACTS_AUTO_SUGGEST]: string;
67
87
  [EventType.ADD_CALL]: CallStartInfo;
@@ -88,6 +108,7 @@ export type ClientEventCallbackMap = {
88
108
  export interface ReactNativeWebView {
89
109
  postMessage: (payload: unknown, origin?: string, d?: unknown[]) => void;
90
110
  }
111
+ export type Callback<T extends EventType = EventType> = T extends keyof EventCallbackMap ? EventCallbackMap[T] : DefaultCallback;
91
112
  export interface Listener<T extends EventType = EventType> {
92
113
  eventName: T;
93
114
  callback: Callback<T>;
@@ -97,12 +118,11 @@ export interface AutoSuggestResult {
97
118
  contacts: Contact[];
98
119
  query: string;
99
120
  }
100
- export interface SendData {
101
- sendAsync(data: any): Promise<Response>;
121
+ export interface PostMessageController {
122
+ sendAsync(data: MessageResponse): Promise<Response>;
102
123
  }
103
124
  export type Resolve = (contacts: Contact[]) => void;
104
125
  export type Reject = (reason: string) => void;
105
- export type Callback<T extends EventType = EventType> = T extends keyof EventCallbackMap ? EventCallbackMap[T] : DefaultCallback;
106
126
  export type RemoveEventListener = () => void;
107
127
  export interface ConnectClient {
108
128
  /**
@@ -138,10 +158,7 @@ export interface ConnectClient {
138
158
  reboot: () => Promise<Response>;
139
159
  /**
140
160
  * Sends request to x-bees about current frame size change */
141
- setViewport: (payload: {
142
- height: number;
143
- width: number;
144
- }) => Promise<Response>;
161
+ setViewport: (payload: ViewPortSize) => Promise<Response>;
145
162
  /**
146
163
  * Sends request to x-bees to put string to the users clipboard */
147
164
  toClipboard: (payload: string) => Promise<Response>;
@@ -150,10 +167,10 @@ export interface ConnectClient {
150
167
  getContactsAutoSuggest: (payload: AutoSuggestResult) => Promise<Response>;
151
168
  /**
152
169
  * pushes to x-bees message that user is authorized and no more actions required */
153
- isAuthorized: (payload: string) => Promise<Response>;
170
+ isAuthorized: () => Promise<Response>;
154
171
  /**
155
172
  * pushes to x-bees message that user actions required */
156
- isNotAuthorized: (payload: string) => Promise<Response>;
173
+ isNotAuthorized: () => Promise<Response>;
157
174
  /**
158
175
  * Starts listen for one of the events of the x-bees and handle with the provided callback */
159
176
  addEventListener: <T extends EventType = EventType>(eventName: T, callback: Callback<T>) => RemoveEventListener;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.0.4-alpha.1",
3
+ "version": "1.0.4",
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": "",
@@ -14,6 +14,8 @@
14
14
  "build:es": "tsc -p tsconfig.es.json",
15
15
  "build:types": "tsc -p tsconfig.types.json",
16
16
  "build:docs": "typedoc",
17
+ "lint": "eslint .",
18
+ "lint:fix": "eslint . --fix",
17
19
  "clean": "rimraf ./dist-* && rimraf *.tsbuildinfo"
18
20
  },
19
21
  "files": [
@@ -21,14 +23,23 @@
21
23
  ],
22
24
  "repository": {
23
25
  "type": "git",
24
- "url": "git@git.wildix.com:dimitri.chernykh/sdk-ui.git"
26
+ "url": "git@git.wildix.com:xbs/sdk-ui.git"
25
27
  },
26
28
  "publishConfig": {
27
29
  "access": "public"
28
30
  },
29
31
  "devDependencies": {
32
+ "eslint": "^8.53.0",
30
33
  "rimraf": "^5.0.5",
31
34
  "typescript": "^5.2.2"
32
35
  },
33
- "gitHead": "b64d0bff60d65c22da252f2656c35d96507f4c16"
36
+ "parserOptions": {
37
+ "project": [
38
+ "./tsconfig.json"
39
+ ]
40
+ },
41
+ "engines": {
42
+ "node": ">=16"
43
+ },
44
+ "gitHead": "e98842e62bf2e122084d24b473c266f314df1a1c"
34
45
  }
@@ -1,8 +0,0 @@
1
- import { SendData, Response } from './types';
2
- export default class PostMessageControllerNative implements SendData {
3
- private readonly target;
4
- private timeout;
5
- constructor();
6
- sendAsync(data: any): Promise<Response>;
7
- private send;
8
- }
@@ -1,8 +0,0 @@
1
- import { SendData, Response } from './types';
2
- export default class PostMessageControllerWeb implements SendData {
3
- private readonly target;
4
- private timeout;
5
- constructor();
6
- sendAsync(data: any): Promise<Response>;
7
- private send;
8
- }