cozy-bar 18.2.0 → 18.3.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/README.md +9 -0
- package/dist/components/Apps/AppItem.js +11 -32
- package/dist/components/Apps/AppItemPlaceholder.js +2 -8
- package/dist/components/Apps/AppNavButtons.js +11 -32
- package/dist/components/Apps/AppsContent.js +8 -33
- package/dist/components/Apps/ButtonCozyHome.js +2 -14
- package/dist/components/Apps/IconCozyHome.js +3 -22
- package/dist/components/Apps/index.js +13 -25
- package/dist/components/AppsMenu/AppsMenuContent.js +5 -28
- package/dist/components/AppsMenu/components/AppItem.js +3 -19
- package/dist/components/AppsMenu/components/AppItemPlaceholder.js +2 -9
- package/dist/components/AppsMenu/index.js +7 -24
- package/dist/components/Banner.js +8 -19
- package/dist/components/Bar.js +47 -94
- package/dist/components/BarCenter.js +0 -3
- package/dist/components/BarComponent.js +44 -69
- package/dist/components/BarLeft.js +0 -3
- package/dist/components/BarProvider.js +21 -39
- package/dist/components/BarRight.js +0 -3
- package/dist/components/BarRoutes.js +2 -9
- package/dist/components/BarSearch.js +0 -3
- package/dist/components/BarTheme.js +0 -3
- package/dist/components/Drawer.js +44 -107
- package/dist/components/HelpLink/index.js +1 -9
- package/dist/components/Search/SearchButton.js +4 -15
- package/dist/components/Settings/SettingsContent.js +9 -29
- package/dist/components/Settings/StorageData.js +6 -16
- package/dist/components/Settings/actions/appearance.js +7 -20
- package/dist/components/Settings/actions/connectedDevices.js +7 -20
- package/dist/components/Settings/actions/connections.js +7 -20
- package/dist/components/Settings/actions/contact.js +7 -20
- package/dist/components/Settings/actions/help.js +7 -20
- package/dist/components/Settings/actions/index.js +0 -10
- package/dist/components/Settings/actions/legalNotice.js +8 -21
- package/dist/components/Settings/actions/logout.js +32 -59
- package/dist/components/Settings/actions/permissions.js +7 -21
- package/dist/components/Settings/actions/plans.js +8 -24
- package/dist/components/Settings/actions/profile.js +7 -20
- package/dist/components/Settings/actions/storage.js +7 -21
- package/dist/components/Settings/actions/termsOfService.js +8 -21
- package/dist/components/Settings/helper.js +5 -12
- package/dist/components/Settings/index.js +8 -25
- package/dist/components/UserMenu/UserMenuContent.js +10 -45
- package/dist/components/UserMenu/components/AvatarMyself.js +5 -19
- package/dist/components/UserMenu/helpers.js +28 -50
- package/dist/components/UserMenu/index.js +10 -29
- package/dist/components/useI18n.js +1 -8
- package/dist/dom.js +12 -33
- package/dist/index.js +16 -28
- package/dist/lib/exceptions.js +35 -90
- package/dist/lib/icon.js +89 -123
- package/dist/lib/logger.js +1 -9
- package/dist/lib/queries.js +2 -7
- package/dist/lib/realtime.js +26 -44
- package/dist/lib/reducers/apps.js +96 -165
- package/dist/lib/reducers/context.js +52 -78
- package/dist/lib/reducers/index.js +32 -55
- package/dist/lib/reducers/settings.js +85 -129
- package/dist/lib/stack-client.js +46 -90
- package/dist/lib/stack.js +6 -24
- package/dist/lib/store/index.js +6 -24
- package/dist/proptypes/index.js +2 -7
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
7
|
+
Object.defineProperty(exports, "BarCenter", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _BarCenter.BarCenter;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
8
13
|
Object.defineProperty(exports, "BarComponent", {
|
|
9
14
|
enumerable: true,
|
|
10
15
|
get: function get() {
|
|
@@ -17,22 +22,22 @@ Object.defineProperty(exports, "BarLeft", {
|
|
|
17
22
|
return _BarLeft.BarLeft;
|
|
18
23
|
}
|
|
19
24
|
});
|
|
20
|
-
Object.defineProperty(exports, "
|
|
25
|
+
Object.defineProperty(exports, "BarProvider", {
|
|
21
26
|
enumerable: true,
|
|
22
27
|
get: function get() {
|
|
23
|
-
return
|
|
28
|
+
return _BarProvider.default;
|
|
24
29
|
}
|
|
25
30
|
});
|
|
26
|
-
Object.defineProperty(exports, "
|
|
31
|
+
Object.defineProperty(exports, "BarRight", {
|
|
27
32
|
enumerable: true,
|
|
28
33
|
get: function get() {
|
|
29
|
-
return
|
|
34
|
+
return _BarRight.BarRight;
|
|
30
35
|
}
|
|
31
36
|
});
|
|
32
|
-
Object.defineProperty(exports, "
|
|
37
|
+
Object.defineProperty(exports, "BarRoutes", {
|
|
33
38
|
enumerable: true,
|
|
34
39
|
get: function get() {
|
|
35
|
-
return
|
|
40
|
+
return _BarRoutes.BarRoutes;
|
|
36
41
|
}
|
|
37
42
|
});
|
|
38
43
|
Object.defineProperty(exports, "BarSearch", {
|
|
@@ -41,16 +46,10 @@ Object.defineProperty(exports, "BarSearch", {
|
|
|
41
46
|
return _BarSearch.BarSearch;
|
|
42
47
|
}
|
|
43
48
|
});
|
|
44
|
-
Object.defineProperty(exports, "
|
|
45
|
-
enumerable: true,
|
|
46
|
-
get: function get() {
|
|
47
|
-
return _BarRoutes.BarRoutes;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
Object.defineProperty(exports, "BarProvider", {
|
|
49
|
+
Object.defineProperty(exports, "BarTheme", {
|
|
51
50
|
enumerable: true,
|
|
52
51
|
get: function get() {
|
|
53
|
-
return
|
|
52
|
+
return _BarTheme.BarTheme;
|
|
54
53
|
}
|
|
55
54
|
});
|
|
56
55
|
Object.defineProperty(exports, "barReducers", {
|
|
@@ -60,27 +59,16 @@ Object.defineProperty(exports, "barReducers", {
|
|
|
60
59
|
}
|
|
61
60
|
});
|
|
62
61
|
exports.version = void 0;
|
|
63
|
-
|
|
64
62
|
require("cozy-search/dist/stylesheet.css");
|
|
65
|
-
|
|
66
63
|
var _BarComponent = require("./components/BarComponent");
|
|
67
|
-
|
|
68
64
|
var _BarLeft = require("./components/BarLeft");
|
|
69
|
-
|
|
70
65
|
var _BarRight = require("./components/BarRight");
|
|
71
|
-
|
|
72
66
|
var _BarCenter = require("./components/BarCenter");
|
|
73
|
-
|
|
74
67
|
var _BarTheme = require("./components/BarTheme");
|
|
75
|
-
|
|
76
68
|
var _BarSearch = require("./components/BarSearch");
|
|
77
|
-
|
|
78
69
|
var _BarRoutes = require("./components/BarRoutes");
|
|
79
|
-
|
|
80
70
|
var _BarProvider = _interopRequireDefault(require("./components/BarProvider"));
|
|
81
|
-
|
|
82
71
|
var _reducers = require("./lib/reducers");
|
|
83
|
-
|
|
84
72
|
/* global __VERSION__ */
|
|
85
|
-
|
|
86
|
-
exports.version =
|
|
73
|
+
|
|
74
|
+
var version = exports.version = "\"18.3.0\"";
|
package/dist/lib/exceptions.js
CHANGED
|
@@ -1,153 +1,98 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.
|
|
9
|
-
|
|
7
|
+
exports.UnavailableStackException = exports.UnauthorizedStackException = exports.ServerErrorException = exports.NotFoundException = exports.MethodNotAllowedException = exports.ForbiddenException = void 0;
|
|
8
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
|
|
14
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
|
-
|
|
16
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
17
|
-
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
18
13
|
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
23
|
-
|
|
24
|
-
var ForbiddenException = /*#__PURE__*/function (_Error) {
|
|
25
|
-
(0, _inherits2.default)(ForbiddenException, _Error);
|
|
26
|
-
|
|
27
|
-
var _super = _createSuper(ForbiddenException);
|
|
28
|
-
|
|
14
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
15
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
16
|
+
var ForbiddenException = exports.ForbiddenException = /*#__PURE__*/function (_Error) {
|
|
29
17
|
function ForbiddenException(message) {
|
|
30
18
|
var _this;
|
|
31
|
-
|
|
32
19
|
(0, _classCallCheck2.default)(this, ForbiddenException);
|
|
33
|
-
_this =
|
|
20
|
+
_this = _callSuper(this, ForbiddenException);
|
|
34
21
|
_this.name = 'Forbidden';
|
|
35
22
|
_this.status = 403;
|
|
36
23
|
_this.message = message || 'The application does not have permission to access this resource.';
|
|
37
24
|
_this.stack = new Error().stack;
|
|
38
25
|
return _this;
|
|
39
26
|
}
|
|
40
|
-
|
|
41
|
-
return ForbiddenException;
|
|
42
|
-
}(
|
|
43
|
-
|
|
44
|
-
exports.ForbiddenException = ForbiddenException;
|
|
45
|
-
|
|
46
|
-
var ServerErrorException = /*#__PURE__*/function (_Error2) {
|
|
47
|
-
(0, _inherits2.default)(ServerErrorException, _Error2);
|
|
48
|
-
|
|
49
|
-
var _super2 = _createSuper(ServerErrorException);
|
|
50
|
-
|
|
27
|
+
(0, _inherits2.default)(ForbiddenException, _Error);
|
|
28
|
+
return (0, _createClass2.default)(ForbiddenException);
|
|
29
|
+
}(/*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
30
|
+
var ServerErrorException = exports.ServerErrorException = /*#__PURE__*/function (_Error2) {
|
|
51
31
|
function ServerErrorException(message) {
|
|
52
32
|
var _this2;
|
|
53
|
-
|
|
54
33
|
(0, _classCallCheck2.default)(this, ServerErrorException);
|
|
55
|
-
_this2 =
|
|
34
|
+
_this2 = _callSuper(this, ServerErrorException);
|
|
56
35
|
_this2.name = 'ServerError';
|
|
57
36
|
_this2.status = 500;
|
|
58
37
|
_this2.message = message || 'A server error occurred';
|
|
59
38
|
_this2.stack = new Error().stack;
|
|
60
39
|
return _this2;
|
|
61
40
|
}
|
|
62
|
-
|
|
63
|
-
return ServerErrorException;
|
|
64
|
-
}(
|
|
65
|
-
|
|
66
|
-
exports.ServerErrorException = ServerErrorException;
|
|
67
|
-
|
|
68
|
-
var NotFoundException = /*#__PURE__*/function (_Error3) {
|
|
69
|
-
(0, _inherits2.default)(NotFoundException, _Error3);
|
|
70
|
-
|
|
71
|
-
var _super3 = _createSuper(NotFoundException);
|
|
72
|
-
|
|
41
|
+
(0, _inherits2.default)(ServerErrorException, _Error2);
|
|
42
|
+
return (0, _createClass2.default)(ServerErrorException);
|
|
43
|
+
}(/*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
44
|
+
var NotFoundException = exports.NotFoundException = /*#__PURE__*/function (_Error3) {
|
|
73
45
|
function NotFoundException(message) {
|
|
74
46
|
var _this3;
|
|
75
|
-
|
|
76
47
|
(0, _classCallCheck2.default)(this, NotFoundException);
|
|
77
|
-
_this3 =
|
|
48
|
+
_this3 = _callSuper(this, NotFoundException);
|
|
78
49
|
_this3.name = 'NotFound';
|
|
79
50
|
_this3.status = 404;
|
|
80
51
|
_this3.message = message || 'The ressource was not found';
|
|
81
52
|
_this3.stack = new Error().stack;
|
|
82
53
|
return _this3;
|
|
83
54
|
}
|
|
84
|
-
|
|
85
|
-
return NotFoundException;
|
|
86
|
-
}(
|
|
87
|
-
|
|
88
|
-
exports.NotFoundException = NotFoundException;
|
|
89
|
-
|
|
90
|
-
var MethodNotAllowedException = /*#__PURE__*/function (_Error4) {
|
|
91
|
-
(0, _inherits2.default)(MethodNotAllowedException, _Error4);
|
|
92
|
-
|
|
93
|
-
var _super4 = _createSuper(MethodNotAllowedException);
|
|
94
|
-
|
|
55
|
+
(0, _inherits2.default)(NotFoundException, _Error3);
|
|
56
|
+
return (0, _createClass2.default)(NotFoundException);
|
|
57
|
+
}(/*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
58
|
+
var MethodNotAllowedException = exports.MethodNotAllowedException = /*#__PURE__*/function (_Error4) {
|
|
95
59
|
function MethodNotAllowedException(message) {
|
|
96
60
|
var _this4;
|
|
97
|
-
|
|
98
61
|
(0, _classCallCheck2.default)(this, MethodNotAllowedException);
|
|
99
|
-
_this4 =
|
|
62
|
+
_this4 = _callSuper(this, MethodNotAllowedException);
|
|
100
63
|
_this4.name = 'MethodNotAllowed';
|
|
101
64
|
_this4.status = 405;
|
|
102
65
|
_this4.message = message || 'Method not allowed';
|
|
103
66
|
_this4.stack = new Error().stack;
|
|
104
67
|
return _this4;
|
|
105
68
|
}
|
|
106
|
-
|
|
107
|
-
return MethodNotAllowedException;
|
|
108
|
-
}(
|
|
109
|
-
|
|
110
|
-
exports.MethodNotAllowedException = MethodNotAllowedException;
|
|
111
|
-
|
|
112
|
-
var UnavailableStackException = /*#__PURE__*/function (_Error5) {
|
|
113
|
-
(0, _inherits2.default)(UnavailableStackException, _Error5);
|
|
114
|
-
|
|
115
|
-
var _super5 = _createSuper(UnavailableStackException);
|
|
116
|
-
|
|
69
|
+
(0, _inherits2.default)(MethodNotAllowedException, _Error4);
|
|
70
|
+
return (0, _createClass2.default)(MethodNotAllowedException);
|
|
71
|
+
}(/*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
72
|
+
var UnavailableStackException = exports.UnavailableStackException = /*#__PURE__*/function (_Error5) {
|
|
117
73
|
function UnavailableStackException(message) {
|
|
118
74
|
var _this5;
|
|
119
|
-
|
|
120
75
|
(0, _classCallCheck2.default)(this, UnavailableStackException);
|
|
121
|
-
_this5 =
|
|
76
|
+
_this5 = _callSuper(this, UnavailableStackException);
|
|
122
77
|
_this5.name = 'UnavailableStack';
|
|
123
78
|
_this5.message = message || 'The stack is temporarily unavailable';
|
|
124
79
|
_this5.stack = new Error().stack;
|
|
125
80
|
return _this5;
|
|
126
81
|
}
|
|
127
|
-
|
|
128
|
-
return UnavailableStackException;
|
|
129
|
-
}(
|
|
130
|
-
|
|
131
|
-
exports.UnavailableStackException = UnavailableStackException;
|
|
132
|
-
|
|
133
|
-
var UnauthorizedStackException = /*#__PURE__*/function (_Error6) {
|
|
134
|
-
(0, _inherits2.default)(UnauthorizedStackException, _Error6);
|
|
135
|
-
|
|
136
|
-
var _super6 = _createSuper(UnauthorizedStackException);
|
|
137
|
-
|
|
82
|
+
(0, _inherits2.default)(UnavailableStackException, _Error5);
|
|
83
|
+
return (0, _createClass2.default)(UnavailableStackException);
|
|
84
|
+
}(/*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
85
|
+
var UnauthorizedStackException = exports.UnauthorizedStackException = /*#__PURE__*/function (_Error6) {
|
|
138
86
|
function UnauthorizedStackException(message) {
|
|
139
87
|
var _this6;
|
|
140
|
-
|
|
141
88
|
(0, _classCallCheck2.default)(this, UnauthorizedStackException);
|
|
142
|
-
_this6 =
|
|
89
|
+
_this6 = _callSuper(this, UnauthorizedStackException);
|
|
143
90
|
_this6.name = 'UnauthorizedStack';
|
|
144
91
|
_this6.status = 401;
|
|
145
92
|
_this6.message = message || 'The app is not allowed to access to the requested resource';
|
|
146
93
|
_this6.stack = new Error().stack;
|
|
147
94
|
return _this6;
|
|
148
95
|
}
|
|
149
|
-
|
|
150
|
-
return UnauthorizedStackException;
|
|
151
|
-
}(
|
|
152
|
-
|
|
153
|
-
exports.UnauthorizedStackException = UnauthorizedStackException;
|
|
96
|
+
(0, _inherits2.default)(UnauthorizedStackException, _Error6);
|
|
97
|
+
return (0, _createClass2.default)(UnauthorizedStackException);
|
|
98
|
+
}(/*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
package/dist/lib/icon.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = getIcon;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var cache = {};
|
|
15
11
|
var mimeTypes = {
|
|
16
12
|
gif: 'image/gif',
|
|
@@ -20,6 +16,7 @@ var mimeTypes = {
|
|
|
20
16
|
png: 'image/png',
|
|
21
17
|
svg: 'image/svg+xml'
|
|
22
18
|
};
|
|
19
|
+
|
|
23
20
|
/**
|
|
24
21
|
* Get an icon URL usable in the HTML page from it's stack path
|
|
25
22
|
*
|
|
@@ -32,132 +29,101 @@ var mimeTypes = {
|
|
|
32
29
|
* @returns {Promise} url string of an icon usable in the HTML page
|
|
33
30
|
* may be empty if the `app` object didn't have an icon path
|
|
34
31
|
*/
|
|
35
|
-
|
|
36
32
|
function getIcon(_x) {
|
|
37
33
|
return _getIcon.apply(this, arguments);
|
|
38
34
|
}
|
|
39
|
-
|
|
40
35
|
function _getIcon() {
|
|
41
|
-
_getIcon = (0, _asyncToGenerator2.default)(
|
|
36
|
+
_getIcon = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(iconFetcher) {
|
|
42
37
|
var app,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
useCache,
|
|
39
|
+
url,
|
|
40
|
+
icon,
|
|
41
|
+
resp,
|
|
42
|
+
extension,
|
|
43
|
+
iconURL,
|
|
44
|
+
_args = arguments;
|
|
50
45
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
51
|
-
while (1) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!(useCache && cache.icons && cache.icons[url])) {
|
|
58
|
-
_context.next = 4;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return _context.abrupt("return", cache.icons[url]);
|
|
63
|
-
|
|
64
|
-
case 4:
|
|
65
|
-
url = app.links && app.links.icon;
|
|
66
|
-
|
|
67
|
-
if (url) {
|
|
68
|
-
_context.next = 7;
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return _context.abrupt("return", '');
|
|
73
|
-
|
|
74
|
-
case 7:
|
|
75
|
-
_context.prev = 7;
|
|
76
|
-
_context.next = 10;
|
|
77
|
-
return iconFetcher(url);
|
|
78
|
-
|
|
79
|
-
case 10:
|
|
80
|
-
resp = _context.sent;
|
|
81
|
-
|
|
82
|
-
if (resp.ok) {
|
|
83
|
-
_context.next = 13;
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
throw new Error("Error while fetching icon ".concat(resp.statusText, ": ").concat(url));
|
|
88
|
-
|
|
89
|
-
case 13:
|
|
90
|
-
_context.next = 15;
|
|
91
|
-
return resp.blob();
|
|
92
|
-
|
|
93
|
-
case 15:
|
|
94
|
-
icon = _context.sent;
|
|
95
|
-
_context.next = 21;
|
|
46
|
+
while (1) switch (_context.prev = _context.next) {
|
|
47
|
+
case 0:
|
|
48
|
+
app = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
49
|
+
useCache = _args.length > 2 && _args[2] !== undefined ? _args[2] : true;
|
|
50
|
+
if (!(useCache && cache.icons && cache.icons[url])) {
|
|
51
|
+
_context.next = 4;
|
|
96
52
|
break;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
53
|
+
}
|
|
54
|
+
return _context.abrupt("return", cache.icons[url]);
|
|
55
|
+
case 4:
|
|
56
|
+
url = app.links && app.links.icon;
|
|
57
|
+
if (url) {
|
|
58
|
+
_context.next = 7;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
return _context.abrupt("return", '');
|
|
62
|
+
case 7:
|
|
63
|
+
_context.prev = 7;
|
|
64
|
+
_context.next = 10;
|
|
65
|
+
return iconFetcher(url);
|
|
66
|
+
case 10:
|
|
67
|
+
resp = _context.sent;
|
|
68
|
+
if (resp.ok) {
|
|
69
|
+
_context.next = 13;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
throw new Error("Error while fetching icon ".concat(resp.statusText, ": ").concat(url));
|
|
73
|
+
case 13:
|
|
74
|
+
_context.next = 15;
|
|
75
|
+
return resp.blob();
|
|
76
|
+
case 15:
|
|
77
|
+
icon = _context.sent;
|
|
78
|
+
_context.next = 21;
|
|
79
|
+
break;
|
|
80
|
+
case 18:
|
|
81
|
+
_context.prev = 18;
|
|
82
|
+
_context.t0 = _context["catch"](7);
|
|
83
|
+
throw _context.t0;
|
|
84
|
+
case 21:
|
|
85
|
+
if (icon.type) {
|
|
86
|
+
_context.next = 30;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
if (app.icon) {
|
|
90
|
+
_context.next = 24;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
throw new Error("".concat(app.name, ": Cannot detect mime type for icon ").concat(url));
|
|
94
|
+
case 24:
|
|
95
|
+
extension = app.icon.split('.').pop();
|
|
96
|
+
if (extension) {
|
|
97
|
+
_context.next = 27;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
throw new Error("".concat(app.name, ": Unable to detect icon mime type from extension (").concat(app.icon, ")"));
|
|
101
|
+
case 27:
|
|
102
|
+
if (mimeTypes[extension]) {
|
|
103
|
+
_context.next = 29;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
throw new Error("".concat(app.name, ": 'Unexpected icon extension (").concat(app.icon, ")"));
|
|
107
|
+
case 29:
|
|
108
|
+
icon = new Blob([icon], {
|
|
109
|
+
type: mimeTypes[extension]
|
|
110
|
+
});
|
|
111
|
+
case 30:
|
|
112
|
+
if (!icon.type.match(/^image\/.*$/)) {
|
|
113
|
+
_context.next = 34;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
iconURL = URL.createObjectURL(icon);
|
|
117
|
+
if (useCache) {
|
|
118
|
+
cache.icons = cache.icons || {};
|
|
119
|
+
cache.icons[url] = iconURL;
|
|
120
|
+
}
|
|
121
|
+
return _context.abrupt("return", iconURL);
|
|
122
|
+
case 34:
|
|
123
|
+
throw new Error("".concat(app.name, ": icon ").concat(url, " is not an image."));
|
|
124
|
+
case 35:
|
|
125
|
+
case "end":
|
|
126
|
+
return _context.stop();
|
|
161
127
|
}
|
|
162
128
|
}, _callee, null, [[7, 18]]);
|
|
163
129
|
}));
|
package/dist/lib/logger.js
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _cozyFlags = _interopRequireDefault(require("cozy-flags"));
|
|
11
|
-
|
|
12
9
|
var _minilog2 = _interopRequireDefault(require("@cozy/minilog"));
|
|
13
|
-
|
|
14
10
|
var _lodash = _interopRequireDefault(require("lodash.set"));
|
|
15
|
-
|
|
16
11
|
(0, _lodash.default)(window, "cozy.debug.flagship", function () {
|
|
17
12
|
return (0, _cozyFlags.default)('flagship.debug', true);
|
|
18
13
|
});
|
|
19
14
|
var minilog = window.minilog || _minilog2.default;
|
|
20
15
|
var logger = minilog('cozy-bar');
|
|
21
|
-
|
|
22
16
|
if (!(0, _cozyFlags.default)('bar.debug')) {
|
|
23
17
|
minilog.suggest.deny('cozy-bar', 'info');
|
|
24
18
|
}
|
|
25
|
-
|
|
26
|
-
var _default = logger;
|
|
27
|
-
exports.default = _default;
|
|
19
|
+
var _default = exports.default = logger;
|
package/dist/lib/queries.js
CHANGED
|
@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.buildMyselfQuery = void 0;
|
|
7
|
-
|
|
8
7
|
var _cozyClient = require("cozy-client");
|
|
9
|
-
|
|
10
8
|
var ONE_HOUR = 60 * 60 * 1000;
|
|
11
|
-
|
|
12
|
-
var buildMyselfQuery = function buildMyselfQuery() {
|
|
9
|
+
var buildMyselfQuery = exports.buildMyselfQuery = function buildMyselfQuery() {
|
|
13
10
|
return {
|
|
14
11
|
definition: (0, _cozyClient.Q)('io.cozy.contacts').where({
|
|
15
12
|
me: true
|
|
@@ -19,6 +16,4 @@ var buildMyselfQuery = function buildMyselfQuery() {
|
|
|
19
16
|
fetchPolicy: _cozyClient.fetchPolicies.olderThan(ONE_HOUR)
|
|
20
17
|
}
|
|
21
18
|
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
exports.buildMyselfQuery = buildMyselfQuery;
|
|
19
|
+
};
|