@enact/webos 4.5.2 → 4.6.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  The following is a curated list of changes in the Enact webos module, newest changes on the top.
4
4
 
5
+ ## [4.6.0] - 2022-12-05
6
+
7
+ No significant changes.
8
+
9
+ ## [4.0.12] - 2022-09-16
10
+
11
+ No significant changes.
12
+
5
13
  ## [4.5.2] - 2022-08-17
6
14
 
7
15
  No significant changes.
@@ -30,10 +38,18 @@ No significant changes.
30
38
 
31
39
  No significant changes.
32
40
 
41
+ ## [4.0.11] - 2022-04-25
42
+
43
+ No significant changes.
44
+
33
45
  ## [4.5.0-alpha.1] - 2022-04-15
34
46
 
35
47
  No significant changes.
36
48
 
49
+ ## [4.0.10] - 2022-04-05
50
+
51
+ No significant changes.
52
+
37
53
  ## [4.1.4] - 2022-03-24
38
54
 
39
55
  No significant changes.
@@ -42,10 +58,18 @@ No significant changes.
42
58
 
43
59
  No significant changes.
44
60
 
61
+ ## [3.2.7] - 2022-01-17
62
+
63
+ No significant changes.
64
+
45
65
  ## [4.1.2] - 2021-12-22
46
66
 
47
67
  No significant changes.
48
68
 
69
+ ## [4.0.9] - 2021-12-15
70
+
71
+ No significant changes.
72
+
49
73
  ## [4.1.1] - 2021-11-30
50
74
 
51
75
  No significant changes.
@@ -4,41 +4,33 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _util = require("@enact/core/util");
9
-
10
8
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
-
12
9
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
13
-
14
10
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
15
-
16
11
  var refs = {};
17
-
18
12
  var adjustPath = function adjustPath(path) {
19
13
  if (!/^(luna|palm):\/\//.test(path)) path = 'luna://' + path;
20
14
  if (path.slice(-1) !== '/') path += '/';
21
15
  return path;
22
- }; // default handlers
23
-
16
+ };
24
17
 
18
+ // default handlers
25
19
  var failureHandler = function failureHandler(_ref) {
26
20
  var errorText = _ref.errorText;
27
21
  return console.error("LS2Request: ".concat(errorText));
28
22
  };
29
-
30
23
  var timeoutHandler = function timeoutHandler(_ref2) {
31
24
  var errorText = _ref2.errorText;
32
25
  return console.warn("LS2Request: ".concat(errorText));
33
26
  };
27
+
34
28
  /**
35
29
  * A class for managing LS2 Requests.
36
30
  *
37
31
  * @memberof webos/LS2Request
38
32
  * @class
39
33
  */
40
-
41
-
42
34
  var LS2Request = /*#__PURE__*/function () {
43
35
  /**
44
36
  * Create a new LS2 request
@@ -48,23 +40,22 @@ var LS2Request = /*#__PURE__*/function () {
48
40
  */
49
41
  function LS2Request() {
50
42
  var _this = this;
51
-
52
43
  _classCallCheck(this, LS2Request);
53
-
54
44
  this.timeoutJob = new _util.Job(function (_ref3) {
55
45
  var onTimeout = _ref3.onTimeout,
56
- timeout = _ref3.timeout;
46
+ timeout = _ref3.timeout;
57
47
  onTimeout({
58
48
  errorCode: -2,
59
49
  errorText: "Request timed out after ".concat(timeout, " ms."),
60
50
  returnValue: false
61
- }); // cancel the request
62
-
51
+ });
52
+ // cancel the request
63
53
  _this.cancel();
64
54
  });
65
55
  this.bridge = null;
66
56
  this.subscribe = false;
67
57
  }
58
+
68
59
  /**
69
60
  * Send a request to an LS2 service method.
70
61
  *
@@ -85,35 +76,31 @@ var LS2Request = /*#__PURE__*/function () {
85
76
  * @returns {webos/LS2Request}
86
77
  * @public
87
78
  */
88
-
89
-
90
79
  _createClass(LS2Request, [{
91
80
  key: "send",
92
81
  value: function send(_ref4) {
93
82
  var _ref4$service = _ref4.service,
94
- service = _ref4$service === void 0 ? '' : _ref4$service,
95
- _ref4$method = _ref4.method,
96
- method = _ref4$method === void 0 ? '' : _ref4$method,
97
- _ref4$parameters = _ref4.parameters,
98
- parameters = _ref4$parameters === void 0 ? {} : _ref4$parameters,
99
- _ref4$onSuccess = _ref4.onSuccess,
100
- onSuccess = _ref4$onSuccess === void 0 ? null : _ref4$onSuccess,
101
- _ref4$onFailure = _ref4.onFailure,
102
- onFailure = _ref4$onFailure === void 0 ? null : _ref4$onFailure,
103
- _ref4$onComplete = _ref4.onComplete,
104
- onComplete = _ref4$onComplete === void 0 ? null : _ref4$onComplete,
105
- _ref4$onTimeout = _ref4.onTimeout,
106
- onTimeout = _ref4$onTimeout === void 0 ? timeoutHandler : _ref4$onTimeout,
107
- _ref4$subscribe = _ref4.subscribe,
108
- subscribe = _ref4$subscribe === void 0 ? false : _ref4$subscribe,
109
- _ref4$timeout = _ref4.timeout,
110
- timeout = _ref4$timeout === void 0 ? 0 : _ref4$timeout;
83
+ service = _ref4$service === void 0 ? '' : _ref4$service,
84
+ _ref4$method = _ref4.method,
85
+ method = _ref4$method === void 0 ? '' : _ref4$method,
86
+ _ref4$parameters = _ref4.parameters,
87
+ parameters = _ref4$parameters === void 0 ? {} : _ref4$parameters,
88
+ _ref4$onSuccess = _ref4.onSuccess,
89
+ onSuccess = _ref4$onSuccess === void 0 ? null : _ref4$onSuccess,
90
+ _ref4$onFailure = _ref4.onFailure,
91
+ onFailure = _ref4$onFailure === void 0 ? null : _ref4$onFailure,
92
+ _ref4$onComplete = _ref4.onComplete,
93
+ onComplete = _ref4$onComplete === void 0 ? null : _ref4$onComplete,
94
+ _ref4$onTimeout = _ref4.onTimeout,
95
+ onTimeout = _ref4$onTimeout === void 0 ? timeoutHandler : _ref4$onTimeout,
96
+ _ref4$subscribe = _ref4.subscribe,
97
+ subscribe = _ref4$subscribe === void 0 ? false : _ref4$subscribe,
98
+ _ref4$timeout = _ref4.timeout,
99
+ timeout = _ref4$timeout === void 0 ? 0 : _ref4$timeout;
111
100
  this.cancelled = false;
112
-
113
101
  if (!onFailure && !onComplete) {
114
102
  onFailure = failureHandler;
115
103
  }
116
-
117
104
  if (typeof window !== 'object' || !window.PalmServiceBridge) {
118
105
  /* eslint no-unused-expressions: ["error", { "allowShortCircuit": true }]*/
119
106
  if (onFailure) onFailure({
@@ -129,34 +116,28 @@ var LS2Request = /*#__PURE__*/function () {
129
116
  console.error('PalmServiceBridge not found.');
130
117
  return;
131
118
  }
132
-
133
119
  if (this.ts && refs[this.ts]) {
134
120
  delete refs[this.ts];
135
121
  }
136
-
137
122
  this.subscribe = subscribe;
138
-
139
123
  if (this.subscribe) {
140
124
  parameters.subscribe = this.subscribe;
141
125
  }
142
-
143
126
  if (parameters.subscribe) {
144
127
  this.subscribe = parameters.subscribe;
145
128
  }
146
-
147
129
  this.ts = performance.now();
148
- refs[this.ts] = this; // eslint-disable-next-line no-undef
130
+ refs[this.ts] = this;
149
131
 
132
+ // eslint-disable-next-line no-undef
150
133
  this.bridge = new PalmServiceBridge();
151
134
  this.bridge.onservicecallback = this.callback.bind(this, onSuccess, onFailure, onComplete);
152
-
153
135
  if (timeout) {
154
136
  this.timeoutJob.startAfter(timeout, {
155
137
  onTimeout: onTimeout,
156
138
  timeout: timeout
157
139
  });
158
140
  }
159
-
160
141
  this.bridge.call(adjustPath(service) + method, JSON.stringify(parameters));
161
142
  return this;
162
143
  }
@@ -165,12 +146,11 @@ var LS2Request = /*#__PURE__*/function () {
165
146
  value: function callback(onSuccess, onFailure, onComplete, msg) {
166
147
  if (this.cancelled) {
167
148
  return;
168
- } // remove timeout job
169
-
149
+ }
170
150
 
151
+ // remove timeout job
171
152
  this.timeoutJob.stop();
172
153
  var parsedMsg;
173
-
174
154
  if (msg == null) {
175
155
  parsedMsg = {
176
156
  errorCode: -1,
@@ -188,7 +168,6 @@ var LS2Request = /*#__PURE__*/function () {
188
168
  };
189
169
  }
190
170
  }
191
-
192
171
  if (parsedMsg.errorCode || parsedMsg.returnValue === false) {
193
172
  if (onFailure) {
194
173
  onFailure(parsedMsg);
@@ -196,15 +175,14 @@ var LS2Request = /*#__PURE__*/function () {
196
175
  } else if (onSuccess) {
197
176
  onSuccess(parsedMsg);
198
177
  }
199
-
200
178
  if (onComplete) {
201
179
  onComplete(parsedMsg);
202
180
  }
203
-
204
181
  if (!this.subscribe) {
205
182
  this.cancel();
206
183
  }
207
184
  }
185
+
208
186
  /**
209
187
  * Cancel the current LS2 request.
210
188
  *
@@ -213,26 +191,21 @@ var LS2Request = /*#__PURE__*/function () {
213
191
  * @returns {undefined}
214
192
  * @public
215
193
  */
216
-
217
194
  }, {
218
195
  key: "cancel",
219
196
  value: function cancel() {
220
197
  // remove timeout job
221
198
  this.timeoutJob.stop();
222
199
  this.cancelled = true;
223
-
224
200
  if (this.bridge) {
225
201
  this.bridge.cancel();
226
202
  this.bridge = null;
227
203
  }
228
-
229
204
  if (this.ts && refs[this.ts]) {
230
205
  delete refs[this.ts];
231
206
  }
232
207
  }
233
208
  }]);
234
-
235
209
  return LS2Request;
236
210
  }();
237
-
238
211
  exports["default"] = LS2Request;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _LS2Request = _interopRequireDefault(require("../LS2Request"));
4
-
5
4
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6
-
7
5
  describe('LS2Request', function () {
8
6
  var nop = function nop() {};
9
-
10
7
  describe('callback', function () {
11
8
  var invalidResponse = '{invalid: json';
12
9
  var failedResponse = '{"errorCode": 101}';
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.platformBack = exports.fetchAppRootPath = exports.fetchAppInfo = exports.fetchAppId = void 0;
7
-
8
7
  /* eslint-disable no-console */
9
8
 
10
9
  /**
@@ -16,7 +15,9 @@ exports.platformBack = exports.fetchAppRootPath = exports.fetchAppInfo = exports
16
15
  * @exports fetchAppRootPath,
17
16
  * @exports platformBack
18
17
  */
18
+
19
19
  var appInfo = {};
20
+
20
21
  /**
21
22
  * Fetches the appID of the caller app.
22
23
  *
@@ -25,13 +26,13 @@ var appInfo = {};
25
26
  * @memberof webos/application
26
27
  * @public
27
28
  */
28
-
29
29
  var fetchAppId = function fetchAppId() {
30
30
  if (window.PalmSystem && window.PalmSystem.identifier) {
31
31
  // PalmSystem.identifier: <appid> <processid>
32
32
  return window.PalmSystem.identifier.split(' ')[0];
33
33
  }
34
34
  };
35
+
35
36
  /**
36
37
  * The callback signature for `fetchAppInfo`
37
38
  *
@@ -50,10 +51,7 @@ var fetchAppId = function fetchAppId() {
50
51
  * @memberof webos/application
51
52
  * @public
52
53
  */
53
-
54
-
55
54
  exports.fetchAppId = fetchAppId;
56
-
57
55
  var fetchAppInfo = function fetchAppInfo(callback, path) {
58
56
  if (Object.keys(appInfo).length === 0) {
59
57
  var parseInfo = function parseInfo(err, info) {
@@ -69,9 +67,7 @@ var fetchAppInfo = function fetchAppInfo(callback, path) {
69
67
  callback();
70
68
  }
71
69
  };
72
-
73
70
  var req = new window.XMLHttpRequest();
74
-
75
71
  req.onreadystatechange = function () {
76
72
  if (req.readyState === 4) {
77
73
  if (req.status >= 200 && req.status < 300 || req.status === 0) {
@@ -83,7 +79,6 @@ var fetchAppInfo = function fetchAppInfo(callback, path) {
83
79
  }
84
80
  }
85
81
  };
86
-
87
82
  try {
88
83
  req.open('GET', path || 'appinfo.json', true);
89
84
  req.send(null);
@@ -96,6 +91,7 @@ var fetchAppInfo = function fetchAppInfo(callback, path) {
96
91
  callback(appInfo);
97
92
  }
98
93
  };
94
+
99
95
  /**
100
96
  * Fetches the full root URI (path) of the caller app.
101
97
  *
@@ -104,31 +100,24 @@ var fetchAppInfo = function fetchAppInfo(callback, path) {
104
100
  * @memberof webos/application
105
101
  * @public
106
102
  */
107
-
108
-
109
103
  exports.fetchAppInfo = fetchAppInfo;
110
-
111
104
  var fetchAppRootPath = function fetchAppRootPath() {
112
105
  var base = window.location.href;
113
-
114
106
  if ('baseURI' in window.document) {
115
107
  base = window.document.baseURI;
116
108
  } else {
117
109
  var baseTags = window.document.getElementsByTagName('base');
118
-
119
110
  if (baseTags.length > 0) {
120
111
  base = baseTags[0].href;
121
112
  }
122
113
  }
123
-
124
114
  var match = base.match(new RegExp('.*://[^#]*/'));
125
-
126
115
  if (match) {
127
116
  return match[0];
128
117
  }
129
-
130
118
  return '';
131
119
  };
120
+
132
121
  /**
133
122
  * Emulate the remote *back* key.
134
123
  *
@@ -137,14 +126,10 @@ var fetchAppRootPath = function fetchAppRootPath() {
137
126
  * @memberof webos/application
138
127
  * @public
139
128
  */
140
-
141
-
142
129
  exports.fetchAppRootPath = fetchAppRootPath;
143
-
144
130
  var platformBack = function platformBack() {
145
131
  if (window.PalmSystem && window.PalmSystem.platformBack) {
146
132
  return window.PalmSystem.platformBack();
147
133
  }
148
134
  };
149
-
150
135
  exports.platformBack = platformBack;
@@ -4,20 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.deviceinfo = exports["default"] = void 0;
7
-
8
7
  var _LS2Request = _interopRequireDefault(require("../LS2Request"));
9
-
10
8
  var _platform = require("../platform");
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
10
  /**
15
11
  * Provides a function to get the device-specific information.
16
12
  *
17
13
  * @module webos/deviceinfo
18
14
  * @exports deviceinfo
19
15
  */
16
+
20
17
  var device = {};
18
+
21
19
  /**
22
20
  * Callback signature for `deviceinfo`
23
21
  *
@@ -45,7 +43,6 @@ var device = {};
45
43
  * @memberof webos/deviceinfo
46
44
  * @public
47
45
  */
48
-
49
46
  var deviceinfo = function deviceinfo(callback) {
50
47
  if (Object.keys(device).length === 0) {
51
48
  try {
@@ -62,10 +59,8 @@ var deviceinfo = function deviceinfo(callback) {
62
59
  } catch (e) {
63
60
  device.modelName = device.modelNameAscii = 'webOS Device';
64
61
  }
65
-
66
62
  device.screenHeight = device.screenHeight || window.screen.height;
67
63
  device.screenWidth = device.screenWidth || window.screen.width;
68
-
69
64
  if (_platform.platform.tv) {
70
65
  new _LS2Request["default"]().send({
71
66
  service: 'luna://com.webos.service.tv.systemproperty',
@@ -78,16 +73,13 @@ var deviceinfo = function deviceinfo(callback) {
78
73
  device.modelNameAscii = response.modelName || device.modelNameAscii;
79
74
  device.sdkVersion = response.sdkVersion || device.sdkVersion;
80
75
  device.uhd = response.UHD === 'true';
81
-
82
76
  if (!response.firmwareVersion || response.firmwareVersion === '0.0.0') {
83
77
  response.firmwareVersion = response.sdkVersion;
84
78
  }
85
-
86
79
  if (response.firmwareVersion) {
87
80
  device.version = response.firmwareVersion;
88
81
  var segments = device.version.split('.');
89
82
  var keys = ['versionMajor', 'versionMinor', 'versionDot'];
90
-
91
83
  for (var i = 0; i < keys.length; i++) {
92
84
  try {
93
85
  device[keys[i]] = parseInt(segments[i]);
@@ -96,7 +88,6 @@ var deviceinfo = function deviceinfo(callback) {
96
88
  }
97
89
  }
98
90
  }
99
-
100
91
  callback(device);
101
92
  },
102
93
  onFailure: function onFailure() {
@@ -108,7 +99,6 @@ var deviceinfo = function deviceinfo(callback) {
108
99
  callback(device);
109
100
  }
110
101
  };
111
-
112
102
  exports.deviceinfo = deviceinfo;
113
103
  var _default = deviceinfo;
114
104
  exports["default"] = _default;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isShowing = void 0;
7
-
8
7
  /**
9
8
  * Provides a function to check visibility of virtual keyboard.
10
9
  *
@@ -23,5 +22,4 @@ exports.isShowing = void 0;
23
22
  var isShowing = function isShowing() {
24
23
  return window.PalmSystem && window.PalmSystem.isKeyboardVisible;
25
24
  };
26
-
27
25
  exports.isShowing = isShowing;
package/package.json CHANGED
@@ -1,7 +1,13 @@
1
1
  {
2
2
  "name": "@enact/webos",
3
- "version": "4.5.2",
3
+ "version": "4.6.0",
4
4
  "description": "webOS support library",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/enactjs/enact.git",
8
+ "directory": "packages/webos"
9
+ },
10
+ "homepage": "https://enactjs.com",
5
11
  "main": "index.js",
6
12
  "scripts": {
7
13
  "clean": "enact clean",
@@ -25,7 +31,7 @@
25
31
  }
26
32
  },
27
33
  "dependencies": {
28
- "@enact/core": "^4.5.2",
34
+ "@enact/core": "^4.6.0",
29
35
  "prop-types": "^15.8.1",
30
36
  "react": "^18.2.0",
31
37
  "react-dom": "^18.2.0"
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports["default"] = void 0;
7
7
  exports.detect = detect;
8
8
  exports.platform = void 0;
9
-
10
9
  /**
11
10
  * Utilities for webOS platform detection.
12
11
  *
@@ -14,11 +13,12 @@ exports.platform = void 0;
14
13
  * @exports detect
15
14
  * @exports platform
16
15
  */
16
+
17
17
  function is(type) {
18
18
  return window.navigator.userAgent.indexOf(type) > -1;
19
19
  }
20
-
21
20
  var _platform;
21
+
22
22
  /**
23
23
  * Returns the {@link webos/platform.platform} object.
24
24
  *
@@ -27,8 +27,6 @@ var _platform;
27
27
  * @memberof webos/platform
28
28
  * @public
29
29
  */
30
-
31
-
32
30
  function detect() {
33
31
  if (_platform) {
34
32
  // if we've already determined the platform, we'll use that determination
@@ -38,11 +36,10 @@ function detect() {
38
36
  return {
39
37
  unknown: true
40
38
  };
41
- } // build out our cached platform determination for future usage
42
-
39
+ }
43
40
 
41
+ // build out our cached platform determination for future usage
44
42
  _platform = {};
45
-
46
43
  if (is('SmartWatch')) {
47
44
  _platform.watch = true;
48
45
  } else if (is('SmartTV') || is('Large Screen')) {
@@ -50,11 +47,9 @@ function detect() {
50
47
  } else {
51
48
  try {
52
49
  var legacyInfo = JSON.parse(window.PalmSystem.deviceInfo || '{}');
53
-
54
50
  if (legacyInfo.platformVersionMajor && legacyInfo.platformVersionMinor) {
55
51
  var major = parseInt(legacyInfo.platformVersionMajor);
56
52
  var minor = parseInt(legacyInfo.platformVersionMinor);
57
-
58
53
  if (major < 3 || major === 3 && minor <= 0) {
59
54
  _platform.legacy = true;
60
55
  } else {
@@ -65,17 +60,17 @@ function detect() {
65
60
  }
66
61
  } catch (e) {
67
62
  _platform.open = true;
68
- } // TODO: clean these up. They shouldn't be here
69
-
63
+ }
70
64
 
65
+ // TODO: clean these up. They shouldn't be here
71
66
  window.Mojo = window.Mojo || {
72
67
  relaunch: function relaunch() {}
73
68
  };
74
69
  if (window.PalmSystem.stageReady) window.PalmSystem.stageReady();
75
70
  }
76
-
77
71
  return _platform;
78
72
  }
73
+
79
74
  /**
80
75
  * Provides identification of webOS variants.
81
76
  *
@@ -89,8 +84,6 @@ function detect() {
89
84
  * @memberof webos/platform
90
85
  * @public
91
86
  */
92
-
93
-
94
87
  var platform = {};
95
88
  exports.platform = platform;
96
89
  ['tv', 'watch', 'open', 'legacy', 'unknown'].forEach(function (name) {
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.warning = exports.perfLog = exports.notice = exports.info = exports.error = exports.emergency = exports.debug = exports.critical = exports.alert = void 0;
7
-
8
7
  /* eslint-disable no-console */
9
-
10
8
  /**
11
9
  * Provides a wrapper around PmLogLib logging API
12
10
  *
@@ -21,6 +19,7 @@ exports.warning = exports.perfLog = exports.notice = exports.info = exports.erro
21
19
  * @exports debug
22
20
  * @exports perfLog
23
21
  */
22
+
24
23
  // Log level constants
25
24
  var levelEmergency = 0;
26
25
  var levelAlert = 1;
@@ -30,12 +29,11 @@ var levelWarning = 4;
30
29
  var levelNotice = 5;
31
30
  var levelInfo = 6;
32
31
  var levelDebug = 7;
33
-
34
32
  var isObject = function isObject(obj) {
35
33
  return !!obj && typeof obj === 'object' && Object.prototype.toString.call(obj) !== '[object Array]';
36
- }; // Log function stringifies and escapes keyVals, and passes to PmLogString
37
-
34
+ };
38
35
 
36
+ // Log function stringifies and escapes keyVals, and passes to PmLogString
39
37
  var log = function log(level, messageId, keyVals, freeText) {
40
38
  if (typeof window !== 'undefined' && window.PalmSystem) {
41
39
  if (keyVals && !isObject(keyVals)) {
@@ -47,15 +45,12 @@ var log = function log(level, messageId, keyVals, freeText) {
47
45
  freeText = null;
48
46
  console.warn('webOSLog called with invalid format: keyVals must be an object');
49
47
  }
50
-
51
48
  if (!messageId && level !== levelDebug) {
52
49
  console.warn('webOSLog called with invalid format: messageId was empty');
53
50
  }
54
-
55
51
  if (keyVals) {
56
52
  keyVals = JSON.stringify(keyVals);
57
53
  }
58
-
59
54
  if (window.PalmSystem.PmLogString) {
60
55
  if (level === levelDebug) {
61
56
  // debug only accepts 2 arguments
@@ -68,6 +63,7 @@ var log = function log(level, messageId, keyVals, freeText) {
68
63
  }
69
64
  }
70
65
  };
66
+
71
67
  /**
72
68
  * Logs with PmLogLib at the "emergency" level.
73
69
  *
@@ -79,11 +75,10 @@ var log = function log(level, messageId, keyVals, freeText) {
79
75
  * @memberof webos/pmloglib
80
76
  * @public
81
77
  */
82
-
83
-
84
78
  var emergency = function emergency(messageId, keyVals, freeText) {
85
79
  log(levelEmergency, messageId, keyVals, freeText);
86
80
  };
81
+
87
82
  /**
88
83
  * Logs with PmLogLib at the "alert" level.
89
84
  *
@@ -95,13 +90,11 @@ var emergency = function emergency(messageId, keyVals, freeText) {
95
90
  * @memberof webos/pmloglib
96
91
  * @public
97
92
  */
98
-
99
-
100
93
  exports.emergency = emergency;
101
-
102
94
  var alert = function alert(messageId, keyVals, freeText) {
103
95
  log(levelAlert, messageId, keyVals, freeText);
104
96
  };
97
+
105
98
  /**
106
99
  * Logs with PmLogLib at the "critical" level.
107
100
  *
@@ -113,13 +106,11 @@ var alert = function alert(messageId, keyVals, freeText) {
113
106
  * @memberof webos/pmloglib
114
107
  * @public
115
108
  */
116
-
117
-
118
109
  exports.alert = alert;
119
-
120
110
  var critical = function critical(messageId, keyVals, freeText) {
121
111
  log(levelCritical, messageId, keyVals, freeText);
122
112
  };
113
+
123
114
  /**
124
115
  * Logs with PmLogLib at the "error" level.
125
116
  *
@@ -131,13 +122,11 @@ var critical = function critical(messageId, keyVals, freeText) {
131
122
  * @memberof webos/pmloglib
132
123
  * @public
133
124
  */
134
-
135
-
136
125
  exports.critical = critical;
137
-
138
126
  var error = function error(messageId, keyVals, freeText) {
139
127
  log(levelError, messageId, keyVals, freeText);
140
128
  };
129
+
141
130
  /**
142
131
  * Logs with PmLogLib at the "warning" level.
143
132
  *
@@ -149,13 +138,11 @@ var error = function error(messageId, keyVals, freeText) {
149
138
  * @memberof webos/pmloglib
150
139
  * @public
151
140
  */
152
-
153
-
154
141
  exports.error = error;
155
-
156
142
  var warning = function warning(messageId, keyVals, freeText) {
157
143
  log(levelWarning, messageId, keyVals, freeText);
158
144
  };
145
+
159
146
  /**
160
147
  * Logs with PmLogLib at the "notice" level.
161
148
  *
@@ -167,13 +154,11 @@ var warning = function warning(messageId, keyVals, freeText) {
167
154
  * @memberof webos/pmloglib
168
155
  * @public
169
156
  */
170
-
171
-
172
157
  exports.warning = warning;
173
-
174
158
  var notice = function notice(messageId, keyVals, freeText) {
175
159
  log(levelNotice, messageId, keyVals, freeText);
176
160
  };
161
+
177
162
  /**
178
163
  * Logs with PmLogLib at the "info" level.
179
164
  *
@@ -185,13 +170,11 @@ var notice = function notice(messageId, keyVals, freeText) {
185
170
  * @memberof webos/pmloglib
186
171
  * @public
187
172
  */
188
-
189
-
190
173
  exports.notice = notice;
191
-
192
174
  var info = function info(messageId, keyVals, freeText) {
193
175
  log(levelInfo, messageId, keyVals, freeText);
194
176
  };
177
+
195
178
  /**
196
179
  * Logs with PmLogLib at the "debug" level.
197
180
  *
@@ -201,13 +184,11 @@ var info = function info(messageId, keyVals, freeText) {
201
184
  * @memberof webos/pmloglib
202
185
  * @public
203
186
  */
204
-
205
-
206
187
  exports.info = info;
207
-
208
188
  var debug = function debug(freeText) {
209
189
  log(levelDebug, '', '', freeText);
210
190
  };
191
+
211
192
  /**
212
193
  * Places a time-stamped performance log entry into the system log using the `PmLogInfoWithClock()`
213
194
  * method.
@@ -220,16 +201,12 @@ var debug = function debug(freeText) {
220
201
  * @memberof webos/pmloglib
221
202
  * @public
222
203
  */
223
-
224
-
225
204
  exports.debug = debug;
226
-
227
205
  var perfLog = function perfLog(messageId, perfType, perfGroup) {
228
206
  if (typeof window !== 'undefined' && window.PalmSystem) {
229
207
  if (!messageId) {
230
208
  console.warn('PmLogInfoWithClock called with invalid format: messageId was empty');
231
209
  }
232
-
233
210
  if (window.PalmSystem.PmLogInfoWithClock) {
234
211
  window.PalmSystem.PmLogInfoWithClock(messageId, perfType ? perfType : '', perfGroup ? perfGroup : '');
235
212
  } else {
@@ -237,5 +214,4 @@ var perfLog = function perfLog(messageId, perfType, perfGroup) {
237
214
  }
238
215
  }
239
216
  };
240
-
241
217
  exports.perfLog = perfLog;
@@ -4,45 +4,25 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = exports.VoiceControlDecorator = void 0;
7
-
8
7
  var _react = require("react");
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _reactDom = require("react-dom");
13
-
14
10
  var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
15
-
16
11
  var _jsxRuntime = require("react/jsx-runtime");
17
-
18
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
-
20
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
-
22
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
-
24
15
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25
-
26
16
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
-
28
17
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
29
-
30
18
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
31
-
32
19
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
33
-
34
20
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
35
-
36
21
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
37
-
38
22
  function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
39
-
40
23
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
41
-
42
24
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
43
-
44
25
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
45
-
46
26
  /**
47
27
  * VoiceControlDecorator is a higher-order component that adds a callback for voice event
48
28
  * to its wrapped component.
@@ -96,27 +76,20 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
96
76
  */
97
77
  var VoiceControlDecorator = (0, _hoc["default"])(function (config, Wrapped) {
98
78
  var _class;
99
-
100
79
  return _class = /*#__PURE__*/function (_Component) {
101
80
  _inherits(_class, _Component);
102
-
103
81
  var _super = _createSuper(_class);
104
-
105
82
  function _class() {
106
83
  _classCallCheck(this, _class);
107
-
108
84
  return _super.apply(this, arguments);
109
85
  }
110
-
111
86
  _createClass(_class, [{
112
87
  key: "componentDidMount",
113
88
  value: function componentDidMount() {
114
89
  this.node = (0, _reactDom.findDOMNode)(this); // eslint-disable-line
115
-
116
90
  if (this.node && !(this.node.hasAttribute('data-webos-voice-event-target') || this.node.hasAttribute('data-webos-voice-intent'))) {
117
91
  this.node = this.node.querySelector('[data-webos-voice-event-target]') || this.node.querySelector('[data-webos-voice-intent]');
118
92
  }
119
-
120
93
  if (this.node) this.node.addEventListener('webOSVoice', this.props.onVoice);
121
94
  }
122
95
  }, {
@@ -128,16 +101,12 @@ var VoiceControlDecorator = (0, _hoc["default"])(function (config, Wrapped) {
128
101
  key: "render",
129
102
  value: function render() {
130
103
  var props = _objectSpread({}, this.props);
131
-
132
104
  delete props.onVoice;
133
105
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread({}, props));
134
106
  }
135
107
  }]);
136
-
137
108
  return _class;
138
- }(_react.Component), _class.displayName = 'VoiceControlDecorator', _class.propTypes =
139
- /** @lends webos/speech.VoiceControlDecorator.prototype */
140
- {
109
+ }(_react.Component), _class.displayName = 'VoiceControlDecorator', _class.propTypes = /** @lends webos/speech.VoiceControlDecorator.prototype */{
141
110
  /**
142
111
  * Callback to be executed when a wrapped element's `data-webos-voice-intent` is activated.
143
112
  *
package/speech/index.js CHANGED
@@ -15,9 +15,6 @@ Object.defineProperty(exports, "readAlert", {
15
15
  return _readAlert["default"];
16
16
  }
17
17
  });
18
-
19
18
  var _readAlert = _interopRequireDefault(require("./readAlert"));
20
-
21
19
  var _VoiceControlDecorator = _interopRequireDefault(require("./VoiceControlDecorator"));
22
-
23
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.readAlert = exports["default"] = void 0;
7
-
8
7
  var _LS2Request = _interopRequireDefault(require("../LS2Request"));
9
-
10
8
  var _platform = require("../platform");
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
10
  /* eslint-disable no-console */
15
- var audioGuidanceEnabled = null;
16
11
 
12
+ var audioGuidanceEnabled = null;
17
13
  var checkAudioGuidance = function checkAudioGuidance() {
18
14
  return new Promise(function (resolve, reject) {
19
15
  if (audioGuidanceEnabled === null) {
@@ -31,7 +27,6 @@ var checkAudioGuidance = function checkAudioGuidance() {
31
27
  resolve();
32
28
  return;
33
29
  }
34
-
35
30
  audioGuidanceEnabled = false;
36
31
  reject();
37
32
  },
@@ -46,7 +41,6 @@ var checkAudioGuidance = function checkAudioGuidance() {
46
41
  }
47
42
  });
48
43
  };
49
-
50
44
  var readAlertMessage = function readAlertMessage(string, clear) {
51
45
  return function () {
52
46
  return new Promise(function (resolve, reject) {
@@ -65,6 +59,7 @@ var readAlertMessage = function readAlertMessage(string, clear) {
65
59
  });
66
60
  };
67
61
  };
62
+
68
63
  /**
69
64
  * Read alert text when accessibility audio guidance is enabled.
70
65
  *
@@ -75,11 +70,8 @@ var readAlertMessage = function readAlertMessage(string, clear) {
75
70
  * @memberof webos/speech
76
71
  * @public
77
72
  */
78
-
79
-
80
73
  var readAlert = function readAlert(string) {
81
74
  var clear = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
82
-
83
75
  if (_platform.platform.tv) {
84
76
  checkAudioGuidance().then(readAlertMessage(string, clear))["catch"](function (message) {
85
77
  if (message) {
@@ -90,7 +82,6 @@ var readAlert = function readAlert(string) {
90
82
  console.warn('Platform doesn\'t support TTS api.');
91
83
  }
92
84
  };
93
-
94
85
  exports.readAlert = readAlert;
95
86
  var _default = readAlert;
96
87
  exports["default"] = _default;