@wildix/xbees-connect 1.0.6-alpha.9 → 1.0.6

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.0.6-alpha.8",
3
+ "version": "1.0.6-alpha.11",
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": "",
@@ -11,6 +11,7 @@
11
11
  "module": "./dist-es/index.js",
12
12
  "type": "module",
13
13
  "scripts": {
14
+ "build": "yarn clean && yarn build:es && yarn build:types",
14
15
  "build:es": "tsc -p tsconfig.es.json",
15
16
  "build:types": "tsc -p tsconfig.types.json",
16
17
  "build:docs": "typedoc",
@@ -1,5 +1,5 @@
1
1
  import packageJson from '../package.json';
2
- import { ClientEventType, EventType, UrlParams } from './enums';
2
+ import { ClientEventType, DeprecatedUrlParams, EventType, UrlParams } from './enums';
3
3
  import PostMessageControllerNative from './helpers/PostMessageControllerNative';
4
4
  import PostMessageControllerWeb from './helpers/PostMessageControllerWeb';
5
5
  /**
@@ -38,12 +38,12 @@ export class Client {
38
38
  variant = null;
39
39
  constructor() {
40
40
  const params = new URLSearchParams(window.location.search);
41
- this.iframeId = params.get(UrlParams.ID);
42
- this.variant = params.get(UrlParams.VARIANT);
43
- this.userEmail = params.get(UrlParams.USER);
44
- this.userToken = params.get(UrlParams.TOKEN);
45
- this.referrer = params.get(UrlParams.REFERRER);
46
- this.needAuthorize = params.has(UrlParams.AUTHORIZE);
41
+ this.iframeId = (params.get(UrlParams.ID) ?? params.get(DeprecatedUrlParams.ID));
42
+ this.variant = (params.get(UrlParams.VARIANT) ?? params.get(DeprecatedUrlParams.VARIANT));
43
+ this.userEmail = (params.get(UrlParams.USER) ?? params.get(DeprecatedUrlParams.USER));
44
+ this.userToken = (params.get(UrlParams.TOKEN) ?? params.get(DeprecatedUrlParams.TOKEN));
45
+ this.referrer = (params.get(UrlParams.REFERRER) ?? params.get(DeprecatedUrlParams.REFERRER));
46
+ this.needAuthorize = (params.has(UrlParams.AUTHORIZE) ?? params.has(DeprecatedUrlParams.AUTHORIZE));
47
47
  // @ts-expect-error window.ReactNativeWebView will be provided by ReactNative WebView
48
48
  this.worker = window.ReactNativeWebView
49
49
  ? new PostMessageControllerNative()
@@ -107,7 +107,7 @@ export class Client {
107
107
  return this.userEmail;
108
108
  }
109
109
  isDataOnly() {
110
- return this.variant === 'd';
110
+ return this.variant === 'no-ui' || this.variant === 'daemon';
111
111
  }
112
112
  showsUi() {
113
113
  return !this.isDataOnly();
@@ -23,6 +23,15 @@ export var ClientEventType;
23
23
  ClientEventType["CONTACTS_AUTO_SUGGEST"] = "xBeesContactsAutoSuggest";
24
24
  ClientEventType["CONTACT_LOOKUP_AND_MATCH"] = "xBeesContactLookupAndMatch";
25
25
  })(ClientEventType || (ClientEventType = {}));
26
+ export var DeprecatedUrlParams;
27
+ (function (DeprecatedUrlParams) {
28
+ DeprecatedUrlParams["TOKEN"] = "token";
29
+ DeprecatedUrlParams["ID"] = "iframeId";
30
+ DeprecatedUrlParams["VARIANT"] = "variant";
31
+ DeprecatedUrlParams["USER"] = "u";
32
+ DeprecatedUrlParams["REFERRER"] = "referrer";
33
+ DeprecatedUrlParams["AUTHORIZE"] = "authorize";
34
+ })(DeprecatedUrlParams || (DeprecatedUrlParams = {}));
26
35
  export var UrlParams;
27
36
  (function (UrlParams) {
28
37
  UrlParams["TOKEN"] = "t";
@@ -21,6 +21,14 @@ export declare enum ClientEventType {
21
21
  CONTACTS_AUTO_SUGGEST = "xBeesContactsAutoSuggest",
22
22
  CONTACT_LOOKUP_AND_MATCH = "xBeesContactLookupAndMatch"
23
23
  }
24
+ export declare enum DeprecatedUrlParams {
25
+ TOKEN = "token",
26
+ ID = "iframeId",
27
+ VARIANT = "variant",
28
+ USER = "u",
29
+ REFERRER = "referrer",
30
+ AUTHORIZE = "authorize"
31
+ }
24
32
  export declare enum UrlParams {
25
33
  TOKEN = "t",
26
34
  ID = "i",
@@ -20,14 +20,6 @@ export type Contact = (ContactShape & {
20
20
  });
21
21
  export type ContactQuery = {
22
22
  id?: string;
23
- email: string;
24
- phone?: string;
25
- } | {
26
- id?: string;
27
- email?: string;
28
- phone: string;
29
- } | {
30
- id: string;
31
23
  email?: string;
32
24
  phone?: string;
33
25
  };
@@ -98,7 +90,8 @@ export interface Listener<T extends EventType = EventType> {
98
90
  eventName: T;
99
91
  callback: Callback<T>;
100
92
  }
101
- export type WorkVariants = 'ui' | 'no-ui' | 'd';
93
+ type DeprecatedWorkVariants = 'info-frame' | 'daemon' | 'dialog';
94
+ export type WorkVariants = 'ui' | 'no-ui' | 'd' | DeprecatedWorkVariants;
102
95
  export interface PostMessageController {
103
96
  sendAsync<T extends MessageType>(data: MessageIFrameResponse<T>): Promise<ResponseMessage<T>>;
104
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.0.6-alpha.9",
3
+ "version": "1.0.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": "",
@@ -11,6 +11,7 @@
11
11
  "module": "./dist-es/index.js",
12
12
  "type": "module",
13
13
  "scripts": {
14
+ "build": "yarn clean && yarn build:es && yarn build:types",
14
15
  "build:es": "tsc -p tsconfig.es.json",
15
16
  "build:types": "tsc -p tsconfig.types.json",
16
17
  "build:docs": "typedoc",
@@ -41,5 +42,5 @@
41
42
  "engines": {
42
43
  "node": ">=16"
43
44
  },
44
- "gitHead": "b236e9266bc7d907e8423a1138b29dd7febf31ca"
45
+ "gitHead": "a86498b5352884d912b68ae0360ef282437ba0c8"
45
46
  }