@wildix/xbees-connect 1.2.13 → 1.2.14

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.2.13",
3
+ "version": "1.2.14",
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": "",
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Client = void 0;
7
7
  const package_json_1 = __importDefault(require("../package.json"));
8
+ const types_1 = require("../types");
8
9
  const enums_1 = require("./enums");
9
10
  const LocalStorageManager_1 = __importDefault(require("./helpers/LocalStorageManager"));
10
11
  const MessageListener_1 = require("./helpers/MessageListener");
@@ -34,9 +35,6 @@ class Client {
34
35
  console.error('Error on init rendering widget:', error);
35
36
  }
36
37
  }
37
- else {
38
- void this.getInstance().ready();
39
- }
40
38
  }
41
39
  worker;
42
40
  listeners = [];
@@ -124,10 +122,11 @@ class Client {
124
122
  this.saveToStorage('sendedUsageAnalyticsDate', today);
125
123
  }
126
124
  }
127
- ready(templateId, platform = 'all') {
125
+ ready(props = types_1.SupportedPlatformVariant.ALL) {
126
+ const payload = typeof props === 'string' ? { version: this.version(), platform: props } : { version: this.version(), ...props };
128
127
  return this.sendAsync({
129
128
  type: enums_1.ClientEventType.READY,
130
- payload: { version: this.version(), platform, templateId },
129
+ payload,
131
130
  });
132
131
  }
133
132
  version() {
@@ -1,2 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SupportedPlatformVariant = void 0;
4
+ var SupportedPlatformVariant;
5
+ (function (SupportedPlatformVariant) {
6
+ SupportedPlatformVariant["ALL"] = "all";
7
+ SupportedPlatformVariant["MOBILE"] = "mobile";
8
+ SupportedPlatformVariant["WEB"] = "web";
9
+ })(SupportedPlatformVariant || (exports.SupportedPlatformVariant = SupportedPlatformVariant = {}));
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SupportedPlatformVariant = void 0;
4
+ var Platform_1 = require("./Platform");
5
+ Object.defineProperty(exports, "SupportedPlatformVariant", { enumerable: true, get: function () { return Platform_1.SupportedPlatformVariant; } });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.2.13",
3
+ "version": "1.2.14",
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": "",
@@ -1,4 +1,5 @@
1
1
  import packageJson from '../package.json';
2
+ import { SupportedPlatformVariant, } from '../types';
2
3
  import { ClientEventType, EventType, UrlParams } from './enums';
3
4
  import LocalStorageManager from './helpers/LocalStorageManager';
4
5
  import { MessageListener } from './helpers/MessageListener';
@@ -28,9 +29,6 @@ export class Client {
28
29
  console.error('Error on init rendering widget:', error);
29
30
  }
30
31
  }
31
- else {
32
- void this.getInstance().ready();
33
- }
34
32
  }
35
33
  worker;
36
34
  listeners = [];
@@ -118,10 +116,11 @@ export class Client {
118
116
  this.saveToStorage('sendedUsageAnalyticsDate', today);
119
117
  }
120
118
  }
121
- ready(templateId, platform = 'all') {
119
+ ready(props = SupportedPlatformVariant.ALL) {
120
+ const payload = typeof props === 'string' ? { version: this.version(), platform: props } : { version: this.version(), ...props };
122
121
  return this.sendAsync({
123
122
  type: ClientEventType.READY,
124
- payload: { version: this.version(), platform, templateId },
123
+ payload,
125
124
  });
126
125
  }
127
126
  version() {
@@ -1 +1,6 @@
1
- export {};
1
+ export var SupportedPlatformVariant;
2
+ (function (SupportedPlatformVariant) {
3
+ SupportedPlatformVariant["ALL"] = "all";
4
+ SupportedPlatformVariant["MOBILE"] = "mobile";
5
+ SupportedPlatformVariant["WEB"] = "web";
6
+ })(SupportedPlatformVariant || (SupportedPlatformVariant = {}));
@@ -1 +1 @@
1
- export {};
1
+ export { SupportedPlatformVariant } from './Platform';
@@ -1,4 +1,5 @@
1
1
  import { Callback, ConnectClient, Contact, ContactQuery, IPayloadViewPort, LookupAndMatchContactsResolver, Message, Reject, RemoveEventListener, ResponseMessage, StorageEventCallback, SuggestContactsResolver, SupportedPlatformVariant, ToastSeverity } from '../types';
2
+ import { ReadyExtendedProps } from '../types/Event';
2
3
  import { ClientEventType, EventType } from './enums';
3
4
  import TechnicalSupport from './helpers/TechnicalSupport';
4
5
  /**
@@ -29,7 +30,7 @@ export declare class Client implements ConnectClient {
29
30
  private parseMessage;
30
31
  private onMessage;
31
32
  private sendDailyIntegrationUsageAnalytics;
32
- ready(templateId?: string, platform?: SupportedPlatformVariant | undefined): Promise<ResponseMessage>;
33
+ ready(props?: SupportedPlatformVariant | ReadyExtendedProps | undefined): Promise<ResponseMessage>;
33
34
  version(): string;
34
35
  isPlatformNative(): boolean;
35
36
  isPlatformWeb(): boolean;
@@ -2,6 +2,7 @@ import { ClientEventType, EventType } from '../src/enums';
2
2
  import TechnicalSupport from '../src/helpers/TechnicalSupport';
3
3
  import { Callback } from './Callback';
4
4
  import { Contact, ContactQuery } from './Contact';
5
+ import { ReadyExtendedProps } from './Event';
5
6
  import { RemoveEventListener } from './Listener';
6
7
  import { ResponseMessage } from './Message';
7
8
  import { IPayloadViewPort } from './Payload';
@@ -12,7 +13,7 @@ import { ToastSeverity } from './Toast';
12
13
  export interface ConnectClient {
13
14
  /**
14
15
  * Sends to x-bees signal that iFrame is ready to be shown. iFrame should send it when the application starts and ready */
15
- ready: (templateId?: string, platform?: SupportedPlatformVariant) => Promise<ResponseMessage>;
16
+ ready: (props?: SupportedPlatformVariant | ReadyExtendedProps) => Promise<ResponseMessage>;
16
17
  /**
17
18
  * Retrieves current pbx token */
18
19
  getUserPbxToken: () => string;
@@ -2,6 +2,7 @@ import { ClientEventType, EventType } from '../src/enums';
2
2
  import { ContactQuery } from './Contact';
3
3
  import { Message, MessageType } from './Message';
4
4
  import { IPayloadAutoSuggestResult, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContextResult, IPayloadConversationResult, IPayloadSendAnalytics, IPayloadTechSupport, IPayloadThemeChange, IPayloadToast, IPayloadVersion, IPayloadViewPort } from './Payload';
5
+ import { SupportedPlatformVariant } from './Platform';
5
6
  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 : never;
6
7
  export type EventPayloadMap = {
7
8
  [EventType.GET_CONTACTS_AUTO_SUGGEST]: string;
@@ -22,3 +23,7 @@ export type EventCallbackMap = {
22
23
  [EventType.REDIRECT_QUERY]: (query: EventPayloadMap[EventType.REDIRECT_QUERY]) => void;
23
24
  };
24
25
  export type RawMessageEvent = MessageEvent<string | Message>;
26
+ export type ReadyExtendedProps = {
27
+ templateId?: string;
28
+ platform?: SupportedPlatformVariant;
29
+ };
@@ -1 +1,5 @@
1
- export type SupportedPlatformVariant = 'all' | 'web' | 'mobile';
1
+ export declare enum SupportedPlatformVariant {
2
+ ALL = "all",
3
+ MOBILE = "mobile",
4
+ WEB = "web"
5
+ }
@@ -7,7 +7,7 @@ export type { Listener, RemoveEventListener } from './Listener';
7
7
  export type { Message, MessageIFrameResponse, MessageType, ResponseMessage } from './Message';
8
8
  export type { MessageSender } from './MessageSender';
9
9
  export type { IPayloadAutoSuggestResult, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContextResult, IPayloadConversationResult, IPayloadSendAnalytics, IPayloadTechSupport, IPayloadThemeChange, IPayloadToast, IPayloadVersion, IPayloadViewPort, } from './Payload';
10
- export type { SupportedPlatformVariant } from './Platform';
10
+ export { SupportedPlatformVariant } from './Platform';
11
11
  export type { LookupAndMatchContactsResolver, Reject, SuggestContactsResolver } from './Resolver';
12
12
  export type { StorageEventCallback } from './Storage';
13
13
  export type { ToastSeverity } from './Toast';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.2.13",
3
+ "version": "1.2.14",
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": "",
@@ -46,5 +46,5 @@
46
46
  "dependencies": {
47
47
  "jwt-decode": "^4.0.0"
48
48
  },
49
- "gitHead": "0f28736f8508d1ec0520f8f4cad83aa49546c141"
49
+ "gitHead": "206439b991196810aa57e016b74508fe287cda02"
50
50
  }