senza-sdk 4.3.3 → 4.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "senza-sdk",
3
- "version": "4.3.3",
3
+ "version": "4.3.4",
4
4
  "main": "./src/api.js",
5
5
  "description": "API for Senza application",
6
6
  "license": "MIT",
@@ -54,9 +54,9 @@
54
54
  },
55
55
  "src/interface": {
56
56
  "branches": 68.42,
57
- "functions": 40,
58
- "lines": 65.28,
59
- "statements": 65.65
57
+ "functions": 39.63,
58
+ "lines": 64.94,
59
+ "statements": 65.32
60
60
  }
61
61
  }
62
62
  },
@@ -723,6 +723,38 @@ class Lifecycle extends LifecycleInterface {
723
723
  return Promise.reject("exitApplication is not supported if NOT running e2e");
724
724
  }
725
725
 
726
+ disconnect() {
727
+ if (window.cefQuery) {
728
+ return new Promise((resolve, reject) => {
729
+ const FCID = getFCID();
730
+ const logger = sdkLogger.withFields({ FCID });
731
+ const message = {
732
+ type: "disconnect",
733
+ reason: "appInitiated",
734
+ target: "client",
735
+ fcid: FCID
736
+ };
737
+ const request = { target: "TC", waitForResponse: false, message: JSON.stringify(message) };
738
+
739
+ logger.log("disconnect: sending disconnect message with reason 'appInitiated'");
740
+ window.cefQuery({
741
+ request: JSON.stringify(request),
742
+ persistent: false,
743
+ onSuccess: () => {
744
+ logger.log("disconnect request successfully sent");
745
+ resolve(true);
746
+ },
747
+ onFailure: (code, msg) => {
748
+ logger.error(`disconnect failed: ${code} ${msg}`);
749
+ reject(`disconnect failed: ${code} ${msg}`);
750
+ }
751
+ });
752
+ });
753
+ }
754
+ sdkLogger.warn("disconnect is not supported if NOT running e2e");
755
+ return Promise.reject("disconnect is not supported if NOT running e2e");
756
+ }
757
+
726
758
  addEventListener(type, listener, options) {
727
759
  if (type === "userdisconnected") {
728
760
  // Use the event manager for userdisconnected events
@@ -250,6 +250,18 @@ class Lifecycle extends EventTarget {
250
250
  return noop("lifecycle.exitApplication");
251
251
  }
252
252
 
253
+ /**
254
+ * Use this api to disconnect from the current session.
255
+ * This will send a disconnect message to the platform indicating the disconnection was initiated by the application.
256
+ * @return {Promise} Promise which is resolved when the disconnect command has been successfully sent.
257
+ * Failure to process the disconnect command will result in the promise being rejected.
258
+ * @alpha API has not yet been released
259
+ */
260
+ // API is part of HSDEV-16695
261
+ disconnect() {
262
+ return noop("lifecycle.disconnect");
263
+ }
264
+
253
265
  /**
254
266
  * Add event listener for lifecycle events
255
267
  * @param {string} type - The event type to listen for
@@ -1 +1 @@
1
- export const version = "4.3.3";
1
+ export const version = "4.3.4";