@enact/webos 4.9.0-alpha.3 → 5.0.0-alpha.1

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,16 @@
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
+ ## [5.0.0-alpha.1] - 2024-07-11
6
+
7
+ ### Removed
8
+
9
+ - `webos/platform` member `watch` and `legacy`
10
+
11
+ ## [4.9.0-beta.1] - 2024-06-17
12
+
13
+ No significant changes.
14
+
5
15
  ## [4.9.0-alpha.3] - 2024-06-05
6
16
 
7
17
  ### Changed
@@ -8,7 +8,7 @@ var _util = require("@enact/core/util");
8
8
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
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, _toPropertyKey(descriptor.key), descriptor); } }
10
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; }
11
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
12
12
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint-disable no-console */ /**
13
13
  * Provides a class for making LS2 service requests on webOS platforms.
14
14
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enact/webos",
3
- "version": "4.9.0-alpha.3",
3
+ "version": "5.0.0-alpha.1",
4
4
  "description": "webOS support library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,7 +32,7 @@
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
- "@enact/core": "^4.9.0-alpha.3",
35
+ "@enact/core": "^5.0.0-alpha.1",
36
36
  "prop-types": "^15.8.1",
37
37
  "react": "^18.3.1",
38
38
  "react-dom": "^18.3.1"
@@ -6,20 +6,20 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports["default"] = void 0;
7
7
  exports.detect = detect;
8
8
  exports.platform = exports.parseUserAgent = void 0;
9
- var _deprecate = _interopRequireDefault(require("@enact/core/internal/deprecate"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
9
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
12
10
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
11
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
12
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
15
13
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
16
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /**
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
+ /**
17
16
  * Utilities for webOS platform detection.
18
17
  *
19
18
  * @module webos/platform
20
19
  * @exports detect
21
20
  * @exports platform
22
21
  */
22
+
23
23
  var webOSVersion = [
24
24
  // Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.2.1 Chrome/38.0.2125.122 Safari/537.36 WebAppManager
25
25
  {
@@ -51,17 +51,7 @@ var webOSVersion = [
51
51
  chrome: 94,
52
52
  version: 23
53
53
  }];
54
- var platforms = [
55
- // LG webOS before adapting Chrome
56
- {
57
- regex: /Web0S;.*Safari\/537.41/,
58
- version: 1
59
- },
60
- // using WebKit 537.41 for WebAppManager, using Chrome 26 for the browser app
61
- {
62
- regex: /Web0S;.*Safari\/538.2/,
63
- version: 2
64
- }].concat(_toConsumableArray(webOSVersion.map(function (_ref) {
54
+ var platforms = [].concat(_toConsumableArray(webOSVersion.map(function (_ref) {
65
55
  var chrome = _ref.chrome,
66
56
  version = _ref.version;
67
57
  return {
@@ -81,29 +71,15 @@ var parseUserAgent = exports.parseUserAgent = function parseUserAgent(userAgent)
81
71
  var platformInfo = {
82
72
  webos: false
83
73
  };
84
- if (userAgent.indexOf('SmartWatch') > -1) {
85
- platformInfo.watch = true;
86
- } else if (userAgent.indexOf('SmartTV') > -1) {
87
- platformInfo.tv = true;
88
- } else if (userAgent.indexOf('Large Screen') > -1) {
89
- (0, _deprecate["default"])({
90
- name: 'Detecting webOS TV by "Large Screen" from the user agent string',
91
- until: '5.0.0'
92
- });
74
+ if (userAgent.indexOf('SmartTV') > -1) {
93
75
  platformInfo.tv = true;
94
76
  } else {
95
77
  var _window$webOSSystem, _webOSSystem$stageRea;
96
78
  var webOSSystem = (_window$webOSSystem = window.webOSSystem) !== null && _window$webOSSystem !== void 0 ? _window$webOSSystem : window.PalmSystem;
97
79
  try {
98
80
  var legacyInfo = JSON.parse(webOSSystem.deviceInfo || '{}');
99
- if (legacyInfo.platformVersionMajor && legacyInfo.platformVersionMinor) {
100
- var major = parseInt(legacyInfo.platformVersionMajor);
101
- var minor = parseInt(legacyInfo.platformVersionMinor);
102
- if (major < 3 || major === 3 && minor <= 0) {
103
- platformInfo.legacy = true;
104
- } else {
105
- platformInfo.open = true;
106
- }
81
+ if (typeof legacyInfo.platformVersionMajor !== 'undefined' && typeof legacyInfo.platformVersionMinor !== 'undefined') {
82
+ platformInfo.open = true;
107
83
  } else {
108
84
  platformInfo.unknown = true;
109
85
  }
@@ -161,9 +137,7 @@ function detect() {
161
137
  * @type {Object}
162
138
  * @property {Boolean} webos `true` for webOS
163
139
  * @property {Boolean} [tv] `true` for LG webOS SmartTV
164
- * @property {Boolean} [watch] `true` for LG webOS SmartWatch. Deprecated: will be removed in 5.0.0.
165
140
  * @property {Boolean} [open] `true` for Open webOS
166
- * @property {Boolean} [legacy] `true` for legacy webOS (Palm and HP hardware). Deprecated: will be removed in 5.0.0.
167
141
  * @property {Boolean} [unknown] `true` for any unknown system
168
142
  * @property {Number} [version] The version of the platform if detected
169
143
  * @property {Number} [chrome] The version of Chrome if detected
@@ -171,16 +145,10 @@ function detect() {
171
145
  * @public
172
146
  */
173
147
  var platform = exports.platform = {};
174
- ['tv', 'watch', 'open', 'legacy', 'unknown', 'version', 'chrome'].forEach(function (name) {
148
+ ['tv', 'open', 'unknown', 'version', 'chrome'].forEach(function (name) {
175
149
  Object.defineProperty(platform, name, {
176
150
  enumerable: true,
177
151
  get: function get() {
178
- if (name === 'watch' || name === 'legacy') {
179
- (0, _deprecate["default"])({
180
- name: name,
181
- until: '5.0.0'
182
- });
183
- }
184
152
  var p = detect();
185
153
  return p[name];
186
154
  }
@@ -4,8 +4,6 @@ var _platform = require("../platform");
4
4
  describe('platform', function () {
5
5
  describe('parseUserAgent for webOS', function () {
6
6
  // From http://webostv.developer.lge.com/discover/specifications/web-engine/
7
- var webOSTV1 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.41 (KHTML, like Gecko) Large Screen WebAppManager Safari/537.41';
8
- var webOSTV2 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/538.2 (KHTML, like Gecko) Large Screen WebAppManager Safari/538.2';
9
7
  var webOSTV3 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.2.1 Chrome/38.0.2125.122 Safari/537.36 WebAppManager';
10
8
  var webOSTV4 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.34 Safari/537.36 WebAppManager';
11
9
  var webOSTV5 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 WebAppManager';
@@ -14,20 +12,6 @@ describe('platform', function () {
14
12
  var webOSTV23 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.128 Safari/537.36 WebAppManager';
15
13
  var webOSTVChrome = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 WebAppManager';
16
14
  var webOSOther = 'Mozilla/5.0 (Web0S; Linux) AppleWebKit/537.36 (KHTML, like Gecko) Safari/537.36 WebAppManager';
17
- test('should detect webOS 1', function () {
18
- var expected = {
19
- version: 1
20
- };
21
- var actual = (0, _platform.parseUserAgent)(webOSTV1);
22
- expect(actual).toMatchObject(expected);
23
- });
24
- test('should detect webOS 2', function () {
25
- var expected = {
26
- version: 2
27
- };
28
- var actual = (0, _platform.parseUserAgent)(webOSTV2);
29
- expect(actual).toMatchObject(expected);
30
- });
31
15
  test('should detect webOS 3', function () {
32
16
  var expected = {
33
17
  version: 3
@@ -16,7 +16,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
16
16
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
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, _toPropertyKey(descriptor.key), descriptor); } }
18
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; }
19
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
20
20
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
21
21
  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); }
22
22
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }