@wildix/xbees-connect 1.2.0-alpha.3 → 1.2.0-alpha.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.2.0-alpha.3",
3
+ "version": "1.2.0-alpha.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": "",
@@ -4,6 +4,7 @@ import ClientParams from './helpers/ClientParams';
4
4
  import LocalStorageManager from './helpers/LocalStorageManager';
5
5
  import { MessageListener } from './helpers/MessageListener';
6
6
  import PostMessageController from './helpers/PostMessageController';
7
+ import TechnicalSupport from './helpers/TechnicalSupport';
7
8
  /**
8
9
  * Client provides functionality of communication between xBees and integrated web applications via iFrame or ReactNative WebView
9
10
  * integration creates na instance with new Client()
@@ -238,4 +239,7 @@ export class Client {
238
239
  setIntegrationStorageKey(integrationKey) {
239
240
  this.localStorageManager.setIntegrationKey(integrationKey);
240
241
  }
242
+ getTechnicalSupport() {
243
+ return TechnicalSupport.getInstance();
244
+ }
241
245
  }
@@ -23,4 +23,7 @@ export default class ClientParams {
23
23
  this.referrer = (params.get(UrlParams.REFERRER) ?? params.get(DeprecatedUrlParams.REFERRER));
24
24
  this.needAuthorize = params.has(UrlParams.AUTHORIZE) ?? params.has(DeprecatedUrlParams.AUTHORIZE);
25
25
  }
26
+ toString() {
27
+ return JSON.stringify(this);
28
+ }
26
29
  }
@@ -0,0 +1,25 @@
1
+ import { ClientEventType } from '../enums';
2
+ import ClientParams from './ClientParams';
3
+ import PostMessageController from './PostMessageController';
4
+ class TechnicalSupport {
5
+ static instance = null;
6
+ static getInstance() {
7
+ if (!this.instance) {
8
+ this.instance = new TechnicalSupport();
9
+ }
10
+ return this.instance;
11
+ }
12
+ // eslint-disable-next-line
13
+ constructor() { }
14
+ sendTechnicalInformation(message, data) {
15
+ return PostMessageController.getInstance().sendAsyncErrorSafe({
16
+ type: ClientEventType.SEND_TECHNICAL_SUPPORT_INFORMATION,
17
+ payload: {
18
+ 'x-iframe-params': ClientParams.getInstance(),
19
+ message,
20
+ data,
21
+ },
22
+ });
23
+ }
24
+ }
25
+ export default TechnicalSupport;
@@ -0,0 +1 @@
1
+ export {};
@@ -8,6 +8,7 @@ import { LookupAndMatchContactsResolver, Reject, SuggestContactsResolver } from
8
8
  import { StorageEventCallback } from '../types/Storage';
9
9
  import { ToastSeverity } from '../types/Toast';
10
10
  import { ClientEventType, EventType } from './enums';
11
+ import TechnicalSupport from './helpers/TechnicalSupport';
11
12
  /**
12
13
  * Client provides functionality of communication between xBees and integrated web applications via iFrame or ReactNative WebView
13
14
  * integration creates na instance with new Client()
@@ -65,4 +66,5 @@ export declare class Client implements ConnectClient {
65
66
  onLogout(callback: Callback<EventType.LOGOUT>): RemoveEventListener;
66
67
  sendAnalytics(eventName: string, params?: Record<string, string>): void;
67
68
  setIntegrationStorageKey(integrationKey: string): void;
69
+ getTechnicalSupport(): TechnicalSupport;
68
70
  }
@@ -9,4 +9,5 @@ export default class ClientParams {
9
9
  readonly iframeId: string;
10
10
  readonly variant: WorkVariants | null;
11
11
  constructor();
12
+ toString(): string;
12
13
  }
@@ -0,0 +1,9 @@
1
+ import { JSONArray, JSONObject } from '../../types';
2
+ import { ClientEventType } from '../enums';
3
+ declare class TechnicalSupport {
4
+ private static instance;
5
+ static getInstance(): TechnicalSupport;
6
+ private constructor();
7
+ sendTechnicalInformation(message: string, data?: JSONObject | JSONArray): Promise<import("../../types/Message").ResponseMessage<ClientEventType.SEND_TECHNICAL_SUPPORT_INFORMATION> | undefined>;
8
+ }
9
+ export default TechnicalSupport;
@@ -1,4 +1,5 @@
1
1
  import { ClientEventType, EventType } from '../src/enums';
2
+ import TechnicalSupport from '../src/helpers/TechnicalSupport';
2
3
  import { Callback } from './Callback';
3
4
  import { Contact, ContactQuery } from './Contact';
4
5
  import { RemoveEventListener } from './Listener';
@@ -147,4 +148,7 @@ export interface ConnectClient {
147
148
  /**
148
149
  * send analytics data to x-bees for track into analytics data */
149
150
  sendAnalytics: (eventName: string, params?: Record<string, string>) => void;
151
+ /**
152
+ * special object to provide x-bees technical support */
153
+ getTechnicalSupport: () => TechnicalSupport;
150
154
  }
@@ -0,0 +1,7 @@
1
+ type JSONValue = string | number | boolean | null | JSONObject | JSONArray;
2
+ export interface JSONObject {
3
+ [key: string]: JSONValue;
4
+ }
5
+ export interface JSONArray extends Array<JSONValue> {
6
+ }
7
+ export {};
@@ -1,5 +1,7 @@
1
+ import ClientParams from '../src/helpers/ClientParams';
1
2
  import { Contact, ContactQuery } from './Contact';
2
3
  import { Conversation } from './conversation';
4
+ import { JSONArray, JSONObject } from './Json';
3
5
  import { SupportedPlatformVariant } from './Platform';
4
6
  import { ToastSeverity } from './Toast';
5
7
  export interface IPayloadViewPort {
@@ -52,5 +54,7 @@ export interface IPayloadSendAnalytics {
52
54
  params?: Record<string, string>;
53
55
  }
54
56
  export interface IPayloadTechSupport {
57
+ 'x-iframe-params': ClientParams;
55
58
  message: string;
59
+ data?: JSONObject | JSONArray;
56
60
  }
@@ -1,3 +1,4 @@
1
1
  import { Contact, ContactQuery } from './Contact';
2
+ import { JSONArray, JSONObject } from './Json';
2
3
  import { IPayloadAutoSuggestResult, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContextResult, IPayloadConversationResult, IPayloadSendAnalytics, IPayloadTechSupport, IPayloadThemeChange, IPayloadToast, IPayloadVersion, IPayloadViewPort } from './Payload';
3
- export type { Contact, ContactQuery, IPayloadAutoSuggestResult, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContextResult, IPayloadConversationResult, IPayloadSendAnalytics, IPayloadTechSupport, IPayloadThemeChange, IPayloadToast, IPayloadVersion, IPayloadViewPort, };
4
+ export type { Contact, ContactQuery, IPayloadAutoSuggestResult, IPayloadCallStart, IPayloadCallStartedInfo, IPayloadContactMatchResult, IPayloadContactMatchResultNotFound, IPayloadContactResult, IPayloadContextResult, IPayloadConversationResult, IPayloadSendAnalytics, IPayloadTechSupport, IPayloadThemeChange, IPayloadToast, IPayloadVersion, IPayloadViewPort, JSONArray, JSONObject, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.2.0-alpha.3",
3
+ "version": "1.2.0-alpha.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": "",
@@ -42,5 +42,5 @@
42
42
  "engines": {
43
43
  "node": ">=16"
44
44
  },
45
- "gitHead": "53d26ea455e12585a72b9e4c831927afa241f7a5"
45
+ "gitHead": "9b2373d5205d394e554be89f5001d14105322995"
46
46
  }