@shopgate/pwa-core 7.30.0-alpha.10 → 7.30.0-alpha.11

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.
Files changed (37) hide show
  1. package/classes/AppCommand/index.js +17 -15
  2. package/classes/AppCommand/spec.js +11 -8
  3. package/classes/AppCommandRequest/index.js +38 -34
  4. package/classes/AppPermissionsRequest/AppPermissionsRequest.js +21 -15
  5. package/classes/AppPermissionsRequest/GetAppPermissionsRequest.js +12 -8
  6. package/classes/AppPermissionsRequest/RequestAppPermissionsRequest.js +12 -8
  7. package/classes/Bridge/index.js +7 -5
  8. package/classes/BrightnessRequest/index.js +7 -5
  9. package/classes/BrightnessRequest/spec.js +2 -2
  10. package/classes/BrowserConnector/index.js +98 -81
  11. package/classes/Conditioner/index.js +17 -14
  12. package/classes/DataRequest/index.js +25 -19
  13. package/classes/DevServerBridge/index.js +11 -9
  14. package/classes/DevServerBridge/spec.js +4 -4
  15. package/classes/ErrorManager/index.js +11 -9
  16. package/classes/Event/index.js +29 -24
  17. package/classes/HttpRequest/index.js +39 -33
  18. package/classes/PipelineDependencies/index.js +11 -9
  19. package/classes/PipelineDependencies/spec.js +1 -1
  20. package/classes/PipelineManager/index.js +48 -46
  21. package/classes/PipelineRequest/index.js +50 -44
  22. package/classes/PipelineRequest/mock.js +52 -39
  23. package/classes/PipelineRequest/spec.js +1 -1
  24. package/classes/PipelineSequence/index.js +11 -9
  25. package/classes/Request/index.js +15 -13
  26. package/classes/RequestBuffer/index.js +11 -9
  27. package/classes/RequestManager/index.js +20 -15
  28. package/classes/RequestManager/spec.js +40 -25
  29. package/classes/Scanner/index.js +218 -219
  30. package/classes/ScannerEvent/index.js +22 -22
  31. package/classes/ScannerEventHandler/index.js +35 -35
  32. package/classes/ScannerEventListener/index.js +77 -78
  33. package/classes/ScannerManager/ScanProcessingError.js +11 -5
  34. package/classes/ScannerManager/index.js +16 -14
  35. package/classes/WebStorageRequest/index.js +18 -12
  36. package/helpers/index.js +8 -8
  37. package/package.json +1 -1
@@ -7,12 +7,12 @@ import Bridge from "../Bridge";
7
7
  /**
8
8
  * The app command class.
9
9
  */
10
- class AppCommand {
10
+ let AppCommand = /*#__PURE__*/function () {
11
11
  /**
12
12
  * @param {boolean} log Whether the command will be logged.
13
13
  * @param {boolean} checkLibVersion Whether the lib version will be checked before dispatch.
14
14
  */
15
- constructor(log = true, checkLibVersion = hasSGJavaScriptBridge()) {
15
+ function AppCommand(log = true, checkLibVersion = hasSGJavaScriptBridge()) {
16
16
  this.log = log;
17
17
  this.checkLibVersion = checkLibVersion;
18
18
  this.name = '';
@@ -26,7 +26,8 @@ class AppCommand {
26
26
  * @param {string} name The command name.
27
27
  * @return {AppCommand}
28
28
  */
29
- setCommandName(name) {
29
+ var _proto = AppCommand.prototype;
30
+ _proto.setCommandName = function setCommandName(name) {
30
31
  if (typeof name === 'string') {
31
32
  this.name = name;
32
33
  } else {
@@ -39,8 +40,8 @@ class AppCommand {
39
40
  * Sets the command params.
40
41
  * @param {Object} [params=null] The command params.
41
42
  * @return {AppCommand}
42
- */
43
- setCommandParams(params) {
43
+ */;
44
+ _proto.setCommandParams = function setCommandParams(params) {
44
45
  if (params && typeof params === 'object' && params.constructor === Object) {
45
46
  this.params = params;
46
47
  } else {
@@ -53,8 +54,8 @@ class AppCommand {
53
54
  * Sets the minimum required shopgate lib version for the command.
54
55
  * @param {string} libVersion The library version.
55
56
  * @return {AppCommand}
56
- */
57
- setLibVersion(libVersion) {
57
+ */;
58
+ _proto.setLibVersion = function setLibVersion(libVersion) {
58
59
  if (isValidVersion(libVersion)) {
59
60
  this.libVersion = libVersion;
60
61
  } else {
@@ -67,8 +68,8 @@ class AppCommand {
67
68
  * Logs the command to the console.
68
69
  * @private
69
70
  * @return {AppCommand}
70
- */
71
- logCommand() {
71
+ */;
72
+ _proto.logCommand = function logCommand() {
72
73
  if (this.log && !this.commandsWithoutLog.includes(this.name)) {
73
74
  const title = `AppCommand %c${this.name}`;
74
75
  logGroup(title, this.params || {}, '#8e44ad');
@@ -79,8 +80,8 @@ class AppCommand {
79
80
  /**
80
81
  * Creates the command object which will be dispatched through the JavaScript bridge.
81
82
  * @return {Object|null}
82
- */
83
- buildCommand() {
83
+ */;
84
+ _proto.buildCommand = function buildCommand() {
84
85
  const command = this.name ? {
85
86
  c: this.name,
86
87
  ...(this.params && {
@@ -96,8 +97,8 @@ class AppCommand {
96
97
  * of refactoring within existing code. But it resolves with FALSE in those cases.
97
98
  * @param {Object} [params] The command params.
98
99
  * @return {Promise<boolean>}
99
- */
100
- async dispatch(params) {
100
+ */;
101
+ _proto.dispatch = async function dispatch(params) {
101
102
  if (params) {
102
103
  this.setCommandParams(params);
103
104
  }
@@ -132,6 +133,7 @@ class AppCommand {
132
133
  return false;
133
134
  }
134
135
  return true;
135
- }
136
- }
136
+ };
137
+ return AppCommand;
138
+ }();
137
139
  export default AppCommand;
@@ -9,10 +9,10 @@ const mockedLoggerWarn = jest.fn();
9
9
  jest.mock("../../helpers", () => ({
10
10
  logger: {
11
11
  error: (...args) => {
12
- mockedLoggerError(...args);
12
+ mockedLoggerError.apply(void 0, args);
13
13
  },
14
14
  warn: (...args) => {
15
- mockedLoggerWarn(...args);
15
+ mockedLoggerWarn.apply(void 0, args);
16
16
  },
17
17
  log: () => {}
18
18
  },
@@ -22,17 +22,20 @@ jest.mock("../../helpers", () => ({
22
22
  const mockedLogGroup = jest.fn();
23
23
  // eslint-disable-next-line extra-rules/potential-point-free
24
24
  jest.mock("../../helpers/logGroup", () => function logGroup(...args) {
25
- mockedLogGroup(...args);
25
+ mockedLogGroup.apply(void 0, args);
26
26
  });
27
27
  let mockedBridgeDispatch = jest.fn();
28
28
 
29
29
  /* eslint-disable require-jsdoc, class-methods-use-this */
30
30
  jest.mock("../DevServerBridge", () => {
31
- class DevServerBridge {
32
- dispatchCommandsForVersion(...args) {
33
- return mockedBridgeDispatch(...args);
34
- }
35
- }
31
+ let DevServerBridge = /*#__PURE__*/function () {
32
+ function DevServerBridge() {}
33
+ var _proto = DevServerBridge.prototype;
34
+ _proto.dispatchCommandsForVersion = function dispatchCommandsForVersion(...args) {
35
+ return mockedBridgeDispatch.apply(void 0, args);
36
+ };
37
+ return DevServerBridge;
38
+ }();
36
39
  return {
37
40
  __esModule: true,
38
41
  default: DevServerBridge
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  /* eslint-disable class-methods-use-this */
2
3
  import Request from "../Request";
3
4
  import AppCommand from "../AppCommand";
@@ -13,22 +14,24 @@ const DEFAULT_LIB_VERSION = '25.0';
13
14
  * It contains the logic which in necessary to establish the process of sending an
14
15
  * app command and receiving an associated event.
15
16
  */
16
- class AppCommandRequest extends Request {
17
+ let AppCommandRequest = /*#__PURE__*/function (_Request) {
17
18
  /**
18
19
  * The constructor.
19
20
  * @param {string} commandName The name of the command which is dispatched to the app.
20
21
  * @param {string} eventName The event name which is called by the app to deliver the data.
21
22
  */
22
- constructor(commandName, eventName) {
23
- super();
24
- this.commandName = commandName;
25
- this.eventName = eventName || `${commandName}Response`;
26
- this.commandParams = null;
27
- this.libVersion = DEFAULT_LIB_VERSION;
28
- this.logColor = '#9a9800';
29
- event.registerEvent(this.eventName);
30
- this.createSerial(this.commandName);
31
- this.createEventCallbackName(this.eventName);
23
+ function AppCommandRequest(commandName, eventName) {
24
+ var _this;
25
+ _this = _Request.call(this) || this;
26
+ _this.commandName = commandName;
27
+ _this.eventName = eventName || `${commandName}Response`;
28
+ _this.commandParams = null;
29
+ _this.libVersion = DEFAULT_LIB_VERSION;
30
+ _this.logColor = '#9a9800';
31
+ event.registerEvent(_this.eventName);
32
+ _this.createSerial(_this.commandName);
33
+ _this.createEventCallbackName(_this.eventName);
34
+ return _this;
32
35
  }
33
36
 
34
37
  /**
@@ -36,7 +39,9 @@ class AppCommandRequest extends Request {
36
39
  * @param {Object} [commandParams=null] The parameters.
37
40
  * @return {AppCommandRequest}
38
41
  */
39
- setCommandParams(commandParams = null) {
42
+ _inheritsLoose(AppCommandRequest, _Request);
43
+ var _proto = AppCommandRequest.prototype;
44
+ _proto.setCommandParams = function setCommandParams(commandParams = null) {
40
45
  this.commandParams = commandParams;
41
46
  return this;
42
47
  }
@@ -45,8 +50,8 @@ class AppCommandRequest extends Request {
45
50
  * Sets the minimum lib version for the app command.
46
51
  * @param {string} [libVersion="25.0"] The lib version.
47
52
  * @return {AppCommandRequest}
48
- */
49
- setLibVersion(libVersion = DEFAULT_LIB_VERSION) {
53
+ */;
54
+ _proto.setLibVersion = function setLibVersion(libVersion = DEFAULT_LIB_VERSION) {
50
55
  this.libVersion = libVersion;
51
56
  return this;
52
57
  }
@@ -56,8 +61,8 @@ class AppCommandRequest extends Request {
56
61
  * @private
57
62
  * @param {Function} requestCallback The event callback that processes the response.
58
63
  * @return {AppCommandRequest}
59
- */
60
- cleanUpRequest(requestCallback) {
64
+ */;
65
+ _proto.cleanUpRequest = function cleanUpRequest(requestCallback) {
61
66
  // Remove the event listener entry.
62
67
  event.removeCallback(this.getEventCallbackName(), requestCallback);
63
68
  // Remove the request from the buffer.
@@ -72,8 +77,8 @@ class AppCommandRequest extends Request {
72
77
  * currently configured command params object.
73
78
  * @param {Object} commandParams The params of the command to be dispatched
74
79
  * @return {boolean}
75
- */
76
- validateCommandParams() {
80
+ */;
81
+ _proto.validateCommandParams = function validateCommandParams() {
77
82
  return true;
78
83
  }
79
84
 
@@ -83,8 +88,8 @@ class AppCommandRequest extends Request {
83
88
  * This method is supposed to be overwritten by an inheriting class to enable customization of
84
89
  * log output.
85
90
  * @returns {string}
86
- */
87
- getRequestLogTitle() {
91
+ */;
92
+ _proto.getRequestLogTitle = function getRequestLogTitle() {
88
93
  return `AppCommandRequest %c${this.commandName}`;
89
94
  }
90
95
 
@@ -94,8 +99,8 @@ class AppCommandRequest extends Request {
94
99
  * This method is supposed to be overwritten by an inheriting class to enable customization of
95
100
  * log output.
96
101
  * @returns {string}
97
- */
98
- getResponseLogTitle() {
102
+ */;
103
+ _proto.getResponseLogTitle = function getResponseLogTitle() {
99
104
  return `AppCommandResponse %c${this.commandName}`;
100
105
  }
101
106
 
@@ -108,8 +113,8 @@ class AppCommandRequest extends Request {
108
113
  * @param {string} serial The serial that was used to identify the response callback.
109
114
  * @param {Object} response The response object for the request
110
115
  * @returns {Object}
111
- */
112
- getResponseLogPayload(serial, response) {
116
+ */;
117
+ _proto.getResponseLogPayload = function getResponseLogPayload(serial, response) {
113
118
  return response;
114
119
  }
115
120
 
@@ -126,8 +131,8 @@ class AppCommandRequest extends Request {
126
131
  * of the AppCommandRequest instance.
127
132
  * @param {string} serial The serial that was used to identify the response callback.
128
133
  * @param {Object} response The response object for the request
129
- */
130
- onResponse(resolve, reject, serial, response) {
134
+ */;
135
+ _proto.onResponse = function onResponse(resolve, reject, serial, response) {
131
136
  resolve(response);
132
137
  }
133
138
 
@@ -136,8 +141,8 @@ class AppCommandRequest extends Request {
136
141
  * @private
137
142
  * @param {Function} resolve The resolve() callback of the dispatch promise.
138
143
  * @param {Function} reject The reject() callback of the dispatch promise.
139
- */
140
- async onDispatch(resolve, reject) {
144
+ */;
145
+ _proto.onDispatch = async function onDispatch(resolve, reject) {
141
146
  // Validate the command parameters.
142
147
  if (this.validateCommandParams(this.commandParams) === false) {
143
148
  // In case of an error log a message and reject the request promise.
@@ -151,9 +156,9 @@ class AppCommandRequest extends Request {
151
156
  * The event callback for the command response.
152
157
  */
153
158
  const requestCallback = (...params) => {
154
- logGroup(this.getResponseLogTitle(), this.getResponseLogPayload(...params) || {}, this.logColor);
159
+ logGroup(this.getResponseLogTitle(), this.getResponseLogPayload.apply(this, params) || {}, this.logColor);
155
160
  this.cleanUpRequest(requestCallback);
156
- this.onResponse(resolve, reject, ...params);
161
+ this.onResponse.apply(this, [resolve, reject].concat(params));
157
162
  };
158
163
 
159
164
  // Add the request to the buffer.
@@ -179,9 +184,8 @@ class AppCommandRequest extends Request {
179
184
  return;
180
185
  }
181
186
  logGroup(this.getRequestLogTitle(), this.commandParams || {}, this.logColor);
182
- }
183
- }
184
-
187
+ };
188
+ return AppCommandRequest;
189
+ }(Request);
185
190
  /* eslint-enable class-methods-use-this */
186
-
187
191
  export default AppCommandRequest;
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import "core-js/modules/es.string.replace.js";
2
3
  import AppCommandRequest from "../AppCommandRequest";
3
4
 
@@ -6,16 +7,18 @@ import AppCommandRequest from "../AppCommandRequest";
6
7
  * It contains the logic which in necessary to establish the process of sending an
7
8
  * app command and receiving an associated event.
8
9
  */
9
- class AppPermissionsRequest extends AppCommandRequest {
10
+ let AppPermissionsRequest = /*#__PURE__*/function (_AppCommandRequest) {
10
11
  /**
11
12
  * The constructor.
12
13
  * @param {string} commandName The name of the command which is dispatched to the app.
13
14
  * @param {string} eventName The event name which is called by the app to deliver the data.
14
15
  */
15
- constructor(commandName, eventName) {
16
- super(commandName, eventName);
17
- this.dispatchMock = null;
18
- this.setLibVersion('18.0');
16
+ function AppPermissionsRequest(commandName, eventName) {
17
+ var _this;
18
+ _this = _AppCommandRequest.call(this, commandName, eventName) || this;
19
+ _this.dispatchMock = null;
20
+ _this.setLibVersion('18.0');
21
+ return _this;
19
22
  }
20
23
 
21
24
  /**
@@ -24,7 +27,9 @@ class AppPermissionsRequest extends AppCommandRequest {
24
27
  * @param {Function} dispatchMock The dispatch mock
25
28
  * @returns {AppPermissionsRequest}
26
29
  */
27
- setDispatchMock(dispatchMock = null) {
30
+ _inheritsLoose(AppPermissionsRequest, _AppCommandRequest);
31
+ var _proto = AppPermissionsRequest.prototype;
32
+ _proto.setDispatchMock = function setDispatchMock(dispatchMock = null) {
28
33
  this.dispatchMock = dispatchMock;
29
34
  return this;
30
35
  }
@@ -32,8 +37,8 @@ class AppPermissionsRequest extends AppCommandRequest {
32
37
  /**
33
38
  * Creates title for the app command request log
34
39
  * @returns {string}
35
- */
36
- getRequestLogTitle() {
40
+ */;
41
+ _proto.getRequestLogTitle = function getRequestLogTitle() {
37
42
  const requestType = this.commandName.replace('AppPermissions', '');
38
43
  return `AppPermissionsRequest %c${requestType}`;
39
44
  }
@@ -41,8 +46,8 @@ class AppPermissionsRequest extends AppCommandRequest {
41
46
  /**
42
47
  * Creates title for the app command response log
43
48
  * @returns {string}
44
- */
45
- getResponseLogTitle() {
49
+ */;
50
+ _proto.getResponseLogTitle = function getResponseLogTitle() {
46
51
  const requestType = this.commandName.replace('AppPermissions', '');
47
52
  return `AppPermissionsResponse %c${requestType}`;
48
53
  }
@@ -50,12 +55,13 @@ class AppPermissionsRequest extends AppCommandRequest {
50
55
  /**
51
56
  * Dispatches the request.
52
57
  * @return {Promise} A promise that is fulfilled when a response is received for this request.
53
- */
54
- dispatch() {
58
+ */;
59
+ _proto.dispatch = function dispatch() {
55
60
  if (typeof this.dispatchMock === 'function') {
56
61
  return this.dispatchMock(this.commandName, this.commandParams);
57
62
  }
58
- return super.dispatch();
59
- }
60
- }
63
+ return _AppCommandRequest.prototype.dispatch.call(this);
64
+ };
65
+ return AppPermissionsRequest;
66
+ }(AppCommandRequest);
61
67
  export default AppPermissionsRequest;
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import AppPermissionsRequest from "./AppPermissionsRequest";
2
3
  import { availablePermissionsIds } from "../../constants/AppPermissions";
3
4
  import { COMMAND_GET_APP_PERMISSIONS } from "../../constants/AppCommands";
@@ -6,12 +7,12 @@ import { COMMAND_GET_APP_PERMISSIONS } from "../../constants/AppCommands";
6
7
  * The GetAppPermissionsRequest class is about to get an overview about the already granted
7
8
  * permissions by the operation system e.g. location or camera access.
8
9
  */
9
- class GetAppPermissionsRequest extends AppPermissionsRequest {
10
+ let GetAppPermissionsRequest = /*#__PURE__*/function (_AppPermissionsReques) {
10
11
  /**
11
12
  * The constructor.
12
13
  */
13
- constructor() {
14
- super(COMMAND_GET_APP_PERMISSIONS);
14
+ function GetAppPermissionsRequest() {
15
+ return _AppPermissionsReques.call(this, COMMAND_GET_APP_PERMISSIONS) || this;
15
16
  }
16
17
 
17
18
  /**
@@ -19,7 +20,9 @@ class GetAppPermissionsRequest extends AppPermissionsRequest {
19
20
  * @param {Array} [permissionIds=[]] The permission ids.
20
21
  * @return {GetAppPermissionsRequest}
21
22
  */
22
- setPermissionIds(permissionIds = []) {
23
+ _inheritsLoose(GetAppPermissionsRequest, _AppPermissionsReques);
24
+ var _proto = GetAppPermissionsRequest.prototype;
25
+ _proto.setPermissionIds = function setPermissionIds(permissionIds = []) {
23
26
  this.setCommandParams({
24
27
  permissionIds
25
28
  });
@@ -31,8 +34,8 @@ class GetAppPermissionsRequest extends AppPermissionsRequest {
31
34
  * @override
32
35
  * @private
33
36
  * @return {boolean}
34
- */
35
- validateCommandParams() {
37
+ */;
38
+ _proto.validateCommandParams = function validateCommandParams() {
36
39
  // Empty command params are ok for this command.
37
40
  if (this.commandParams === null) {
38
41
  return true;
@@ -53,6 +56,7 @@ class GetAppPermissionsRequest extends AppPermissionsRequest {
53
56
 
54
57
  // Check if all permission ids are valid.
55
58
  return permissionIds.every(permissionId => availablePermissionsIds.includes(permissionId));
56
- }
57
- }
59
+ };
60
+ return GetAppPermissionsRequest;
61
+ }(AppPermissionsRequest);
58
62
  export default GetAppPermissionsRequest;
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import AppPermissionsRequest from "./AppPermissionsRequest";
2
3
  import { availablePermissionsIds } from "../../constants/AppPermissions";
3
4
  import { COMMAND_REQUEST_APP_PERMISSIONS } from "../../constants/AppCommands";
@@ -6,12 +7,12 @@ import { COMMAND_REQUEST_APP_PERMISSIONS } from "../../constants/AppCommands";
6
7
  * The RequestAppPermissionsRequest class is about to initiate the process to request
7
8
  * additional permissions from the operating system e.g. location or camera access.
8
9
  */
9
- class RequestAppPermissionsRequest extends AppPermissionsRequest {
10
+ let RequestAppPermissionsRequest = /*#__PURE__*/function (_AppPermissionsReques) {
10
11
  /**
11
12
  * The constructor.
12
13
  */
13
- constructor() {
14
- super(COMMAND_REQUEST_APP_PERMISSIONS);
14
+ function RequestAppPermissionsRequest() {
15
+ return _AppPermissionsReques.call(this, COMMAND_REQUEST_APP_PERMISSIONS) || this;
15
16
  }
16
17
 
17
18
  /**
@@ -19,7 +20,9 @@ class RequestAppPermissionsRequest extends AppPermissionsRequest {
19
20
  * @param {Array} permissions The permissions.
20
21
  * @return {RequestAppPermissionsRequest}
21
22
  */
22
- setPermissions(permissions) {
23
+ _inheritsLoose(RequestAppPermissionsRequest, _AppPermissionsReques);
24
+ var _proto = RequestAppPermissionsRequest.prototype;
25
+ _proto.setPermissions = function setPermissions(permissions) {
23
26
  this.setCommandParams({
24
27
  permissions
25
28
  });
@@ -31,8 +34,8 @@ class RequestAppPermissionsRequest extends AppPermissionsRequest {
31
34
  * @override
32
35
  * @private
33
36
  * @return {boolean}
34
- */
35
- validateCommandParams() {
37
+ */;
38
+ _proto.validateCommandParams = function validateCommandParams() {
36
39
  // The command can't be sent without command params.
37
40
  if (this.commandParams === null) {
38
41
  return false;
@@ -59,6 +62,7 @@ class RequestAppPermissionsRequest extends AppPermissionsRequest {
59
62
  }
60
63
  return true;
61
64
  });
62
- }
63
- }
65
+ };
66
+ return RequestAppPermissionsRequest;
67
+ }(AppPermissionsRequest);
64
68
  export default RequestAppPermissionsRequest;
@@ -7,11 +7,11 @@ import DevServerBridge from "../DevServerBridge";
7
7
  * Creates a new Javascript Bridge for App Commands
8
8
  * based on the device's capabilities.
9
9
  */
10
- class Bridge {
10
+ let Bridge = /*#__PURE__*/function () {
11
11
  /**
12
12
  * Initializes the Bridge.
13
13
  */
14
- constructor() {
14
+ function Bridge() {
15
15
  if (useBrowserConnector()) {
16
16
  this.bridge = new BrowserConnector();
17
17
  } else if (hasSGJavaScriptBridge()) {
@@ -26,7 +26,8 @@ class Bridge {
26
26
  * @param {Object} command The app command to dispatch.
27
27
  * @param {string} libVersion The command's lib version.
28
28
  */
29
- dispatchCommand(command, libVersion) {
29
+ var _proto = Bridge.prototype;
30
+ _proto.dispatchCommand = function dispatchCommand(command, libVersion) {
30
31
  if ('dispatchCommandForVersion' in this.bridge) {
31
32
  this.bridge.dispatchCommandForVersion(command, libVersion);
32
33
  /* istanbul ignore else */
@@ -35,6 +36,7 @@ class Bridge {
35
36
  } else {
36
37
  this.bridge.dispatchCommandsStringForVersion(JSON.stringify([command]), libVersion);
37
38
  }
38
- }
39
- }
39
+ };
40
+ return Bridge;
41
+ }();
40
42
  export default Bridge;
@@ -11,11 +11,11 @@ const RESPONSE_EVENT_NAME = 'currentBrightnessResponse';
11
11
  * Maintains the request command and waits for a response to resolve a promise returned by
12
12
  * `.dispatch`.
13
13
  */
14
- export class BrightnessRequest {
14
+ export let BrightnessRequest = /*#__PURE__*/function () {
15
15
  /**
16
16
  * Constructor.
17
17
  */
18
- constructor() {
18
+ function BrightnessRequest() {
19
19
  /**
20
20
  * Handles responses
21
21
  * @param {Object} response Response.
@@ -39,11 +39,12 @@ export class BrightnessRequest {
39
39
  this.responseQueue = [];
40
40
  event.addCallback(RESPONSE_EVENT_NAME, this.handleResponse);
41
41
  }
42
+ var _proto = BrightnessRequest.prototype;
42
43
  /**
43
44
  * Dispatches the request.
44
45
  * @returns {Promise}
45
46
  */
46
- dispatch() {
47
+ _proto.dispatch = function dispatch() {
47
48
  return new Promise(async (resolve, reject) => {
48
49
  this.responseQueue.push({
49
50
  resolve,
@@ -61,6 +62,7 @@ export class BrightnessRequest {
61
62
  reject(new Error('getCurrentBrightness command dispatch failed'));
62
63
  }
63
64
  });
64
- }
65
- }
65
+ };
66
+ return BrightnessRequest;
67
+ }();
66
68
  export default new BrightnessRequest();
@@ -5,7 +5,7 @@ import { mockedSetCommandName, mockedSetLibVersion, mockedDispatch, triggerDispa
5
5
  const mockedAddCallback = jest.fn();
6
6
  jest.mock("../Event", () => ({
7
7
  addCallback: (...args) => {
8
- mockedAddCallback(...args);
8
+ mockedAddCallback.apply(void 0, args);
9
9
  }
10
10
  }));
11
11
  jest.mock("../AppCommand");
@@ -13,7 +13,7 @@ const mockedLoggerError = jest.fn();
13
13
  jest.mock("../../helpers", () => ({
14
14
  logger: {
15
15
  error: (...args) => {
16
- mockedLoggerError(...args);
16
+ mockedLoggerError.apply(void 0, args);
17
17
  }
18
18
  }
19
19
  }));