cozy-bar 8.4.0 → 8.4.3
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/dist/cozy-bar.min.js +4 -4
- package/dist/cozy-bar.min.js.map +1 -1
- package/package.json +3 -3
- package/src/components/Apps/AppNavButtons.jsx +5 -5
- package/src/components/Apps/ButtonCozyHome.spec.jsx +1 -1
- package/CHANGELOG.md +0 -493
- package/transpiled/assets/icons/16/icon-storage-16.svg +0 -3
- package/transpiled/assets/icons/24/icon-arrow-left.svg +0 -3
- package/transpiled/assets/icons/32/icon-claudy.svg +0 -1
- package/transpiled/assets/icons/apps/icon-collect.svg +0 -25
- package/transpiled/assets/icons/apps/icon-drive.svg +0 -17
- package/transpiled/assets/icons/apps/icon-market-soon.svg +0 -25
- package/transpiled/assets/icons/apps/icon-photos.svg +0 -19
- package/transpiled/assets/icons/apps/icon-soon.svg +0 -21
- package/transpiled/assets/icons/apps/icon-store.svg +0 -19
- package/transpiled/assets/icons/claudyActions/icon-bills.svg +0 -6
- package/transpiled/assets/icons/claudyActions/icon-laptop.svg +0 -7
- package/transpiled/assets/icons/claudyActions/icon-phone.svg +0 -8
- package/transpiled/assets/icons/claudyActions/icon-question-mark.svg +0 -6
- package/transpiled/assets/icons/comingsoon/icon-bank.svg +0 -12
- package/transpiled/assets/icons/comingsoon/icon-sante.svg +0 -12
- package/transpiled/assets/icons/comingsoon/icon-store.svg +0 -6
- package/transpiled/assets/icons/icon-cozy.svg +0 -3
- package/transpiled/assets/icons/icon-shield.svg +0 -3
- package/transpiled/assets/icons/spinner.svg +0 -4
- package/transpiled/assets/sprites/icon-apps.svg +0 -1
- package/transpiled/assets/sprites/icon-cozy-home.svg +0 -16
- package/transpiled/components/Apps/AppItem.js +0 -134
- package/transpiled/components/Apps/AppItemPlaceholder.js +0 -14
- package/transpiled/components/Apps/AppNavButtons.js +0 -108
- package/transpiled/components/Apps/AppsContent.js +0 -124
- package/transpiled/components/Apps/ButtonCozyHome.js +0 -25
- package/transpiled/components/Apps/ButtonCozyHome.spec.jsx +0 -53
- package/transpiled/components/Apps/IconCozyHome.js +0 -67
- package/transpiled/components/Apps/index.js +0 -102
- package/transpiled/components/Banner.js +0 -76
- package/transpiled/components/Bar.js +0 -329
- package/transpiled/components/Bar.spec.jsx +0 -133
- package/transpiled/components/Claudy.js +0 -123
- package/transpiled/components/ClaudyIcon.js +0 -16
- package/transpiled/components/Drawer.js +0 -367
- package/transpiled/components/Drawer.spec.jsx +0 -98
- package/transpiled/components/SearchBar.js +0 -407
- package/transpiled/components/Settings/SettingsContent.js +0 -128
- package/transpiled/components/Settings/StorageData.js +0 -24
- package/transpiled/components/Settings/helper.js +0 -9
- package/transpiled/components/Settings/index.js +0 -225
- package/transpiled/components/StorageIcon.js +0 -16
- package/transpiled/components/SupportModal.js +0 -86
- package/transpiled/components/__snapshots__/Bar.spec.jsx.snap +0 -302
- package/transpiled/config/claudyActions.json +0 -20
- package/transpiled/config/persistWhitelist.json +0 -4
- package/transpiled/cozy-bar.css +0 -5905
- package/transpiled/dom.js +0 -84
- package/transpiled/index.js +0 -246
- package/transpiled/index.spec.jsx +0 -34
- package/transpiled/lib/api/helpers.js +0 -12
- package/transpiled/lib/api/index.js +0 -175
- package/transpiled/lib/exceptions.js +0 -156
- package/transpiled/lib/expiringMemoize.js +0 -17
- package/transpiled/lib/icon.js +0 -154
- package/transpiled/lib/intents.js +0 -17
- package/transpiled/lib/logger.js +0 -10
- package/transpiled/lib/middlewares/appsI18n.js +0 -64
- package/transpiled/lib/realtime.js +0 -76
- package/transpiled/lib/reducers/apps.js +0 -291
- package/transpiled/lib/reducers/apps.spec.js +0 -59
- package/transpiled/lib/reducers/content.js +0 -68
- package/transpiled/lib/reducers/context.js +0 -138
- package/transpiled/lib/reducers/index.js +0 -59
- package/transpiled/lib/reducers/locale.js +0 -27
- package/transpiled/lib/reducers/settings.js +0 -253
- package/transpiled/lib/reducers/theme.js +0 -64
- package/transpiled/lib/reducers/unserializable.js +0 -31
- package/transpiled/lib/stack-client.js +0 -442
- package/transpiled/lib/stack.js +0 -122
- package/transpiled/lib/store/index.js +0 -42
- package/transpiled/locales/de.json +0 -57
- package/transpiled/locales/en.json +0 -57
- package/transpiled/locales/es.json +0 -57
- package/transpiled/locales/fr.json +0 -57
- package/transpiled/locales/it.json +0 -57
- package/transpiled/locales/ja.json +0 -57
- package/transpiled/locales/nl_NL.json +0 -57
- package/transpiled/locales/pl.json +0 -57
- package/transpiled/locales/ru.json +0 -57
- package/transpiled/locales/sq.json +0 -57
- package/transpiled/locales/zh_CN.json +0 -57
- package/transpiled/proptypes/index.js +0 -11
- package/transpiled/queries/index.js +0 -19
- package/transpiled/styles/apps.css +0 -248
- package/transpiled/styles/banner.css +0 -64
- package/transpiled/styles/bar.css +0 -106
- package/transpiled/styles/base.css +0 -21
- package/transpiled/styles/claudy.css +0 -98
- package/transpiled/styles/drawer.css +0 -126
- package/transpiled/styles/index.styl +0 -33
- package/transpiled/styles/indicators.css +0 -58
- package/transpiled/styles/nav.css +0 -81
- package/transpiled/styles/navigation_item.css +0 -34
- package/transpiled/styles/searchbar.css +0 -156
- package/transpiled/styles/settings.css +0 -34
- package/transpiled/styles/storage.css +0 -22
- package/transpiled/styles/supportModal.css +0 -20
- package/transpiled/styles/theme.styl +0 -25
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
7
|
-
|
|
8
|
-
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); }; }
|
|
9
|
-
|
|
10
|
-
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; } }
|
|
11
|
-
|
|
12
|
-
import React, { PureComponent } from 'react';
|
|
13
|
-
import AppIcon from "cozy-ui/transpiled/react/AppIcon";
|
|
14
|
-
import stack from "../../lib/stack";
|
|
15
|
-
/* Generated with node_modules/.bin/svgr src/assets/sprites/icon-cozy-home.svg */
|
|
16
|
-
|
|
17
|
-
function SvgIconCozyHome(props) {
|
|
18
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
19
|
-
width: 32,
|
|
20
|
-
height: 32
|
|
21
|
-
}, props), /*#__PURE__*/React.createElement("g", {
|
|
22
|
-
fill: "none",
|
|
23
|
-
fillRule: "evenodd"
|
|
24
|
-
}, /*#__PURE__*/React.createElement("circle", {
|
|
25
|
-
fill: "#297EF2",
|
|
26
|
-
fillRule: "nonzero",
|
|
27
|
-
cx: 16,
|
|
28
|
-
cy: 16,
|
|
29
|
-
r: 16
|
|
30
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
31
|
-
d: "M19.314 17.561a.555.555 0 01-.82.12 4.044 4.044 0 01-2.499.862 4.04 4.04 0 01-2.494-.86.557.557 0 01-.815-.12.547.547 0 01.156-.748c.214-.14.229-.421.229-.424a.555.555 0 01.176-.385.504.504 0 01.386-.145.544.544 0 01.528.553c0 .004 0 .153-.054.36a2.954 2.954 0 003.784-.008 1.765 1.765 0 01-.053-.344.546.546 0 01.536-.561h.01c.294 0 .538.237.545.532 0 0 .015.282.227.422a.544.544 0 01.158.746m2.322-6.369a5.94 5.94 0 00-1.69-3.506A5.651 5.651 0 0015.916 6a5.648 5.648 0 00-4.029 1.687 5.936 5.936 0 00-1.691 3.524 5.677 5.677 0 00-3.433 1.737 5.966 5.966 0 00-1.643 4.137C5.12 20.347 7.704 23 10.882 23h10.236c3.176 0 5.762-2.653 5.762-5.915 0-3.083-2.31-5.623-5.244-5.893",
|
|
32
|
-
fill: "#FFF"
|
|
33
|
-
})));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var IconCozyHome = /*#__PURE__*/function (_PureComponent) {
|
|
37
|
-
_inherits(IconCozyHome, _PureComponent);
|
|
38
|
-
|
|
39
|
-
var _super = _createSuper(IconCozyHome);
|
|
40
|
-
|
|
41
|
-
function IconCozyHome() {
|
|
42
|
-
_classCallCheck(this, IconCozyHome);
|
|
43
|
-
|
|
44
|
-
return _super.apply(this, arguments);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
_createClass(IconCozyHome, [{
|
|
48
|
-
key: "render",
|
|
49
|
-
value: function render() {
|
|
50
|
-
var className = this.props.className;
|
|
51
|
-
|
|
52
|
-
var fetchIcon = function fetchIcon() {
|
|
53
|
-
return "".concat(stack.get.cozyURL(), "/assets/images/icon-cozy-home.svg");
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
return /*#__PURE__*/React.createElement(AppIcon, {
|
|
57
|
-
fetchIcon: fetchIcon,
|
|
58
|
-
fallbackIcon: SvgIconCozyHome,
|
|
59
|
-
className: className
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}]);
|
|
63
|
-
|
|
64
|
-
return IconCozyHome;
|
|
65
|
-
}(PureComponent);
|
|
66
|
-
|
|
67
|
-
export default IconCozyHome;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
|
-
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); }; }
|
|
10
|
-
|
|
11
|
-
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; } }
|
|
12
|
-
|
|
13
|
-
import React, { Component } from 'react';
|
|
14
|
-
import AppsContent from "./AppsContent";
|
|
15
|
-
import AppNavButtons from "./AppNavButtons";
|
|
16
|
-
|
|
17
|
-
var Apps = /*#__PURE__*/function (_Component) {
|
|
18
|
-
_inherits(Apps, _Component);
|
|
19
|
-
|
|
20
|
-
var _super = _createSuper(Apps);
|
|
21
|
-
|
|
22
|
-
function Apps(props) {
|
|
23
|
-
var _this;
|
|
24
|
-
|
|
25
|
-
_classCallCheck(this, Apps);
|
|
26
|
-
|
|
27
|
-
_this = _super.call(this, props);
|
|
28
|
-
|
|
29
|
-
_defineProperty(_assertThisInitialized(_this), "onClickOutside", function (event) {
|
|
30
|
-
if (_this.state.opened) {
|
|
31
|
-
// if it's not a cozy-bar nav popup, close the opened popup
|
|
32
|
-
if (!_this.rootRef.contains(event.target) && !_this.modalContainer.contains(event.target)) {
|
|
33
|
-
_this.setState({
|
|
34
|
-
opened: false
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
event.stopPropagation();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
_defineProperty(_assertThisInitialized(_this), "toggleMenu", function () {
|
|
43
|
-
_this.setState({
|
|
44
|
-
opened: !_this.state.opened
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
_this.state = {
|
|
49
|
-
opened: false
|
|
50
|
-
};
|
|
51
|
-
return _this;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
_createClass(Apps, [{
|
|
55
|
-
key: "componentDidMount",
|
|
56
|
-
value: function componentDidMount() {
|
|
57
|
-
document.body.addEventListener('click', this.onClickOutside);
|
|
58
|
-
this.modalContainer = document.getElementById('cozy-bar-modal-dom-place');
|
|
59
|
-
}
|
|
60
|
-
}, {
|
|
61
|
-
key: "componentWillUnmount",
|
|
62
|
-
value: function componentWillUnmount() {
|
|
63
|
-
document.body.removeEventListener('click', this.onClickOutside);
|
|
64
|
-
}
|
|
65
|
-
}, {
|
|
66
|
-
key: "render",
|
|
67
|
-
// data-tutorial attribute allows to be targeted in an application tutorial
|
|
68
|
-
value: function render() {
|
|
69
|
-
var _this2 = this;
|
|
70
|
-
|
|
71
|
-
var _this$props = this.props,
|
|
72
|
-
appName = _this$props.appName,
|
|
73
|
-
appNamePrefix = _this$props.appNamePrefix,
|
|
74
|
-
appSlug = _this$props.appSlug,
|
|
75
|
-
iconPath = _this$props.iconPath,
|
|
76
|
-
isPublic = _this$props.isPublic;
|
|
77
|
-
var opened = this.state.opened;
|
|
78
|
-
return /*#__PURE__*/React.createElement("nav", {
|
|
79
|
-
className: "coz-nav coz-nav-apps",
|
|
80
|
-
ref: function ref(_ref) {
|
|
81
|
-
_this2.rootRef = _ref;
|
|
82
|
-
}
|
|
83
|
-
}, /*#__PURE__*/React.createElement(AppNavButtons, {
|
|
84
|
-
appName: appName,
|
|
85
|
-
appNamePrefix: appNamePrefix,
|
|
86
|
-
appSlug: appSlug,
|
|
87
|
-
iconPath: iconPath,
|
|
88
|
-
handleClick: this.toggleMenu,
|
|
89
|
-
opened: opened,
|
|
90
|
-
isPublic: isPublic
|
|
91
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
92
|
-
className: "coz-nav-pop coz-nav-pop--apps",
|
|
93
|
-
id: "coz-nav-pop--apps",
|
|
94
|
-
"aria-hidden": !opened
|
|
95
|
-
}, /*#__PURE__*/React.createElement(AppsContent, null)));
|
|
96
|
-
}
|
|
97
|
-
}]);
|
|
98
|
-
|
|
99
|
-
return Apps;
|
|
100
|
-
}(Component);
|
|
101
|
-
|
|
102
|
-
export default Apps;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
|
|
8
|
-
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); }; }
|
|
9
|
-
|
|
10
|
-
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; } }
|
|
11
|
-
|
|
12
|
-
import React, { Component } from 'react';
|
|
13
|
-
import { ButtonLink } from "cozy-ui/transpiled/react/Button";
|
|
14
|
-
import { translate } from "cozy-ui/transpiled/react/I18n";
|
|
15
|
-
|
|
16
|
-
var Banner = /*#__PURE__*/function (_Component) {
|
|
17
|
-
_inherits(Banner, _Component);
|
|
18
|
-
|
|
19
|
-
var _super = _createSuper(Banner);
|
|
20
|
-
|
|
21
|
-
function Banner(props) {
|
|
22
|
-
var _this;
|
|
23
|
-
|
|
24
|
-
_classCallCheck(this, Banner);
|
|
25
|
-
|
|
26
|
-
_this = _super.call(this, props);
|
|
27
|
-
_this.state = {
|
|
28
|
-
unmounted: true
|
|
29
|
-
};
|
|
30
|
-
_this.animate = _this.animate.bind(_assertThisInitialized(_this));
|
|
31
|
-
return _this;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
_createClass(Banner, [{
|
|
35
|
-
key: "animate",
|
|
36
|
-
value: function animate() {
|
|
37
|
-
var _this2 = this;
|
|
38
|
-
|
|
39
|
-
// To animate we have to use a setTimeout to
|
|
40
|
-
// force a CSS class update and trigger CSS animation
|
|
41
|
-
return setTimeout(function () {
|
|
42
|
-
_this2.setState(function () {
|
|
43
|
-
return {
|
|
44
|
-
unmounted: false
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
}, 100);
|
|
48
|
-
}
|
|
49
|
-
}, {
|
|
50
|
-
key: "componentDidMount",
|
|
51
|
-
value: function componentDidMount() {
|
|
52
|
-
this.animate();
|
|
53
|
-
}
|
|
54
|
-
}, {
|
|
55
|
-
key: "render",
|
|
56
|
-
value: function render() {
|
|
57
|
-
var _this$props = this.props,
|
|
58
|
-
t = _this$props.t,
|
|
59
|
-
code = _this$props.code,
|
|
60
|
-
links = _this$props.links;
|
|
61
|
-
var unmounted = this.state.unmounted;
|
|
62
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
63
|
-
className: "coz-bar-banner".concat(unmounted ? ' unmounted' : '')
|
|
64
|
-
}, /*#__PURE__*/React.createElement("p", null, t("banner.".concat(code, ".description"))), /*#__PURE__*/React.createElement(ButtonLink, {
|
|
65
|
-
className: "coz-bar-banner-button",
|
|
66
|
-
size: "tiny",
|
|
67
|
-
href: links,
|
|
68
|
-
label: t("banner.".concat(code, ".CTA"))
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
}]);
|
|
72
|
-
|
|
73
|
-
return Banner;
|
|
74
|
-
}(Component);
|
|
75
|
-
|
|
76
|
-
export default translate()(Banner);
|
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
10
|
-
|
|
11
|
-
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); }; }
|
|
12
|
-
|
|
13
|
-
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; } }
|
|
14
|
-
|
|
15
|
-
/* global __PIWIK_TRACKER_URL__ __PIWIK_SITEID__ __PIWIK_DIMENSION_ID_APP__ */
|
|
16
|
-
import React, { Component } from 'react';
|
|
17
|
-
import { connect } from 'react-redux';
|
|
18
|
-
import { translate } from "cozy-ui/transpiled/react/I18n";
|
|
19
|
-
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
20
|
-
import { shouldEnableTracking, getTracker, configureTracker } from "cozy-ui/transpiled/react/helpers/tracker";
|
|
21
|
-
import { isMobileApp } from 'cozy-device-helper';
|
|
22
|
-
import { ButtonCozyHome } from "./Apps/ButtonCozyHome";
|
|
23
|
-
import Banner from "./Banner";
|
|
24
|
-
import Drawer from "./Drawer";
|
|
25
|
-
import Settings from "./Settings";
|
|
26
|
-
import Apps from "./Apps";
|
|
27
|
-
import SearchBar from "./SearchBar";
|
|
28
|
-
import Claudy from "./Claudy";
|
|
29
|
-
import SupportModal from "./SupportModal";
|
|
30
|
-
import { getTheme, hasFetched, getContent, isCurrentApp, fetchApps as _fetchApps, fetchContext as _fetchContext, fetchSettingsData as _fetchSettingsData, shouldEnableClaudy, getWebviewContext } from "../lib/reducers";
|
|
31
|
-
/* Generated with node_modules/.bin/svgr src/assets/sprites/icon-apps.svg */
|
|
32
|
-
|
|
33
|
-
function SvgIconApps(props) {
|
|
34
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
35
|
-
width: 16,
|
|
36
|
-
height: 16
|
|
37
|
-
}, props), /*#__PURE__*/React.createElement("path", {
|
|
38
|
-
d: "M0 0h4v4H0V0zm0 6h4v4H0V6zm0 6h4v4H0v-4zM6 0h4v4H6V0zm0 6h4v4H6V6zm0 6h4v4H6v-4zm6-12h4v4h-4V0zm0 6h4v4h-4V6zm0 6h4v4h-4v-4z",
|
|
39
|
-
fillRule: "evenodd"
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export var Bar = /*#__PURE__*/function (_Component) {
|
|
44
|
-
_inherits(Bar, _Component);
|
|
45
|
-
|
|
46
|
-
var _super = _createSuper(Bar);
|
|
47
|
-
|
|
48
|
-
function Bar(props) {
|
|
49
|
-
var _this;
|
|
50
|
-
|
|
51
|
-
_classCallCheck(this, Bar);
|
|
52
|
-
|
|
53
|
-
_this = _super.call(this, props);
|
|
54
|
-
|
|
55
|
-
_defineProperty(_assertThisInitialized(_this), "toggleDrawer", function () {
|
|
56
|
-
// don't allow to toggle the drawer if claudy opened or is opening
|
|
57
|
-
if (_this.state.claudyOpened || _this.state.claudyFired) return;
|
|
58
|
-
var drawerVisible = !_this.state.drawerVisible; // don't wait for transitionend if displaying
|
|
59
|
-
|
|
60
|
-
if (drawerVisible) _this.props.onDrawer(drawerVisible);
|
|
61
|
-
|
|
62
|
-
_this.setState({
|
|
63
|
-
drawerVisible: drawerVisible
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
_defineProperty(_assertThisInitialized(_this), "toggleClaudy", function () {
|
|
68
|
-
var isFromDrawer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
69
|
-
if (!_this.props.claudyEnabled) return;
|
|
70
|
-
var _this$state = _this.state,
|
|
71
|
-
usageTracker = _this$state.usageTracker,
|
|
72
|
-
claudyOpened = _this$state.claudyOpened;
|
|
73
|
-
|
|
74
|
-
if (isFromDrawer && !claudyOpened) {
|
|
75
|
-
// if opened from drawer
|
|
76
|
-
// reset to toggle via the Claudy component
|
|
77
|
-
return _this.setState({
|
|
78
|
-
claudyFired: true
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (_this.state.claudyFired) _this.setState({
|
|
83
|
-
claudyFired: false
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
if (usageTracker) {
|
|
87
|
-
usageTracker.push(['trackEvent', 'Claudy', claudyOpened ? 'close' : 'open', 'claudy']);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
_this.setState({
|
|
91
|
-
claudyOpened: !claudyOpened
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
_defineProperty(_assertThisInitialized(_this), "toggleSupport", function () {
|
|
96
|
-
var supportDisplayed = _this.state.supportDisplayed;
|
|
97
|
-
|
|
98
|
-
_this.setState({
|
|
99
|
-
supportDisplayed: !supportDisplayed
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
_defineProperty(_assertThisInitialized(_this), "renderLeft", function () {
|
|
104
|
-
var _this$props = _this.props,
|
|
105
|
-
t = _this$props.t,
|
|
106
|
-
isPublic = _this$props.isPublic,
|
|
107
|
-
webviewContext = _this$props.webviewContext;
|
|
108
|
-
|
|
109
|
-
if (webviewContext) {
|
|
110
|
-
return /*#__PURE__*/React.createElement(ButtonCozyHome, {
|
|
111
|
-
webviewContext: webviewContext
|
|
112
|
-
});
|
|
113
|
-
} // data-tutorial attribute allows to be targeted in an application tutorial
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return !isPublic ? /*#__PURE__*/React.createElement("button", {
|
|
117
|
-
type: "button",
|
|
118
|
-
className: "coz-bar-btn coz-bar-burger",
|
|
119
|
-
onClick: _this.toggleDrawer,
|
|
120
|
-
"data-tutorial": "apps-mobile"
|
|
121
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
122
|
-
icon: SvgIconApps,
|
|
123
|
-
width: 16,
|
|
124
|
-
height: 16,
|
|
125
|
-
color: "currentColor"
|
|
126
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
127
|
-
className: "coz-bar-hidden"
|
|
128
|
-
}, t('drawer'))) : null;
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
_defineProperty(_assertThisInitialized(_this), "renderRight", function () {
|
|
132
|
-
var isPublic = _this.props.isPublic;
|
|
133
|
-
return !isPublic ? /*#__PURE__*/React.createElement(Settings, {
|
|
134
|
-
toggleSupport: _this.toggleSupport,
|
|
135
|
-
onLogOut: _this.props.onLogOut
|
|
136
|
-
}) : null;
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
_this.state = {
|
|
140
|
-
claudyFired: false,
|
|
141
|
-
// true to fire claudy (used by the drawer)
|
|
142
|
-
claudyOpened: false,
|
|
143
|
-
drawerVisible: false,
|
|
144
|
-
usageTracker: null,
|
|
145
|
-
supportDisplayed: false,
|
|
146
|
-
searchBarEnabled: props.isDrive && !props.isPublic && !isMobileApp()
|
|
147
|
-
};
|
|
148
|
-
_this.fetchApps = _this.fetchApps.bind(_assertThisInitialized(_this));
|
|
149
|
-
_this.fetchInitialData = _this.fetchInitialData.bind(_assertThisInitialized(_this));
|
|
150
|
-
_this.handleTokenRefreshed = _this.handleTokenRefreshed.bind(_assertThisInitialized(_this));
|
|
151
|
-
return _this;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
_createClass(Bar, [{
|
|
155
|
-
key: "componentDidMount",
|
|
156
|
-
value: function componentDidMount() {
|
|
157
|
-
if (shouldEnableTracking()) {
|
|
158
|
-
this.initPiwikTracker();
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
this.fetchInitialData();
|
|
162
|
-
var cozyClient = this.props.cozyClient;
|
|
163
|
-
cozyClient.on('tokenRefreshed', this.handleTokenRefreshed);
|
|
164
|
-
}
|
|
165
|
-
}, {
|
|
166
|
-
key: "componentWillUnmount",
|
|
167
|
-
value: function componentWillUnmount() {
|
|
168
|
-
var cozyClient = this.props.cozyClient;
|
|
169
|
-
cozyClient.removeListener('tokenRefreshed', this.handleTokenRefreshed);
|
|
170
|
-
}
|
|
171
|
-
}, {
|
|
172
|
-
key: "componentDidUpdate",
|
|
173
|
-
value: function componentDidUpdate(prevProps, prevState) {
|
|
174
|
-
if (!this.props.hasFetchedApps && this.state.drawerVisible && prevState.drawerVisible !== this.state.drawerVisible) {
|
|
175
|
-
this.fetchApps();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}, {
|
|
179
|
-
key: "handleTokenRefreshed",
|
|
180
|
-
value: function handleTokenRefreshed() {
|
|
181
|
-
this.fetchInitialData();
|
|
182
|
-
}
|
|
183
|
-
}, {
|
|
184
|
-
key: "initPiwikTracker",
|
|
185
|
-
value: function initPiwikTracker() {
|
|
186
|
-
var trackerInstance = getTracker("\"https://matomo.cozycloud.cc\"", 8, false, false);
|
|
187
|
-
configureTracker({
|
|
188
|
-
appDimensionId: 1,
|
|
189
|
-
app: 'Cozy Bar',
|
|
190
|
-
heartbeat: 0
|
|
191
|
-
});
|
|
192
|
-
this.setState({
|
|
193
|
-
usageTracker: trackerInstance
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}, {
|
|
197
|
-
key: "fetchApps",
|
|
198
|
-
value: function fetchApps() {
|
|
199
|
-
this.props.fetchApps();
|
|
200
|
-
}
|
|
201
|
-
}, {
|
|
202
|
-
key: "fetchInitialData",
|
|
203
|
-
value: function fetchInitialData() {
|
|
204
|
-
if (this.props.isPublic) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
this.props.fetchContext();
|
|
209
|
-
this.props.fetchSettingsData(false);
|
|
210
|
-
this.fetchApps();
|
|
211
|
-
}
|
|
212
|
-
}, {
|
|
213
|
-
key: "renderCenter",
|
|
214
|
-
value: function renderCenter() {
|
|
215
|
-
var _this$props2 = this.props,
|
|
216
|
-
appName = _this$props2.appName,
|
|
217
|
-
appNamePrefix = _this$props2.appNamePrefix,
|
|
218
|
-
appSlug = _this$props2.appSlug,
|
|
219
|
-
iconPath = _this$props2.iconPath,
|
|
220
|
-
isPublic = _this$props2.isPublic;
|
|
221
|
-
return /*#__PURE__*/React.createElement(Apps, {
|
|
222
|
-
appName: appName,
|
|
223
|
-
appNamePrefix: appNamePrefix,
|
|
224
|
-
appSlug: appSlug,
|
|
225
|
-
iconPath: iconPath,
|
|
226
|
-
isPublic: isPublic
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
}, {
|
|
230
|
-
key: "render",
|
|
231
|
-
value: function render() {
|
|
232
|
-
var _this2 = this;
|
|
233
|
-
|
|
234
|
-
var _this$state2 = this.state,
|
|
235
|
-
claudyFired = _this$state2.claudyFired,
|
|
236
|
-
claudyOpened = _this$state2.claudyOpened,
|
|
237
|
-
drawerVisible = _this$state2.drawerVisible,
|
|
238
|
-
searchBarEnabled = _this$state2.searchBarEnabled,
|
|
239
|
-
supportDisplayed = _this$state2.supportDisplayed,
|
|
240
|
-
usageTracker = _this$state2.usageTracker;
|
|
241
|
-
var _this$props3 = this.props,
|
|
242
|
-
theme = _this$props3.theme,
|
|
243
|
-
themeOverrides = _this$props3.themeOverrides,
|
|
244
|
-
barLeft = _this$props3.barLeft,
|
|
245
|
-
barRight = _this$props3.barRight,
|
|
246
|
-
barCenter = _this$props3.barCenter,
|
|
247
|
-
barSearch = _this$props3.barSearch,
|
|
248
|
-
claudyEnabled = _this$props3.claudyEnabled,
|
|
249
|
-
onDrawer = _this$props3.onDrawer,
|
|
250
|
-
isPublic = _this$props3.isPublic,
|
|
251
|
-
onLogOut = _this$props3.onLogOut,
|
|
252
|
-
userActionRequired = _this$props3.userActionRequired;
|
|
253
|
-
var pColor = themeOverrides.primaryColor,
|
|
254
|
-
pctColor = themeOverrides.primaryContrastTextColor;
|
|
255
|
-
var pStyle = pColor ? {
|
|
256
|
-
'--cozBarThemePrimaryColor': pColor
|
|
257
|
-
} : {};
|
|
258
|
-
var pctStyle = pctColor ? {
|
|
259
|
-
'--cozBarThemePrimaryContrastTextColor': pctColor
|
|
260
|
-
} : {};
|
|
261
|
-
|
|
262
|
-
var themeStyle = _objectSpread({}, pStyle, pctStyle);
|
|
263
|
-
|
|
264
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
265
|
-
className: "coz-bar-wrapper coz-theme-".concat(theme),
|
|
266
|
-
style: themeStyle
|
|
267
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
268
|
-
id: "cozy-bar-modal-dom-place"
|
|
269
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
270
|
-
className: "coz-bar-container"
|
|
271
|
-
}, barLeft || this.renderLeft(), barCenter || this.renderCenter(), /*#__PURE__*/React.createElement("div", {
|
|
272
|
-
className: "u-flex-grow"
|
|
273
|
-
}, barSearch || (searchBarEnabled ? /*#__PURE__*/React.createElement(SearchBar, null) : null)), barRight || this.renderRight(), !isPublic ? /*#__PURE__*/React.createElement(Drawer, {
|
|
274
|
-
visible: drawerVisible,
|
|
275
|
-
onClose: this.toggleDrawer,
|
|
276
|
-
onClaudy: claudyEnabled && function () {
|
|
277
|
-
return _this2.toggleClaudy(true);
|
|
278
|
-
} || false,
|
|
279
|
-
isClaudyLoading: claudyFired,
|
|
280
|
-
drawerListener: function drawerListener() {
|
|
281
|
-
return onDrawer(drawerVisible);
|
|
282
|
-
},
|
|
283
|
-
toggleSupport: this.toggleSupport,
|
|
284
|
-
onLogOut: onLogOut
|
|
285
|
-
}) : null, claudyEnabled && /*#__PURE__*/React.createElement(Claudy, {
|
|
286
|
-
usageTracker: usageTracker,
|
|
287
|
-
claudyFired: claudyFired,
|
|
288
|
-
onToggle: function onToggle() {
|
|
289
|
-
return _this2.toggleClaudy(false);
|
|
290
|
-
},
|
|
291
|
-
opened: claudyOpened
|
|
292
|
-
}), supportDisplayed && /*#__PURE__*/React.createElement(SupportModal, {
|
|
293
|
-
onClose: this.toggleSupport
|
|
294
|
-
})), userActionRequired && /*#__PURE__*/React.createElement(Banner, userActionRequired));
|
|
295
|
-
}
|
|
296
|
-
}]);
|
|
297
|
-
|
|
298
|
-
return Bar;
|
|
299
|
-
}(Component);
|
|
300
|
-
export var mapStateToProps = function mapStateToProps(state) {
|
|
301
|
-
return {
|
|
302
|
-
theme: getTheme(state).name,
|
|
303
|
-
themeOverrides: getTheme(state).overrides,
|
|
304
|
-
barLeft: getContent(state, 'left'),
|
|
305
|
-
barRight: getContent(state, 'right'),
|
|
306
|
-
barCenter: getContent(state, 'center'),
|
|
307
|
-
barSearch: getContent(state, 'search'),
|
|
308
|
-
isDrive: isCurrentApp(state, {
|
|
309
|
-
slug: 'drive'
|
|
310
|
-
}),
|
|
311
|
-
claudyEnabled: shouldEnableClaudy(state),
|
|
312
|
-
hasFetchedApps: hasFetched(state),
|
|
313
|
-
webviewContext: getWebviewContext(state)
|
|
314
|
-
};
|
|
315
|
-
};
|
|
316
|
-
export var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
317
|
-
return {
|
|
318
|
-
fetchApps: function fetchApps() {
|
|
319
|
-
return dispatch(_fetchApps());
|
|
320
|
-
},
|
|
321
|
-
fetchContext: function fetchContext() {
|
|
322
|
-
return dispatch(_fetchContext());
|
|
323
|
-
},
|
|
324
|
-
fetchSettingsData: function fetchSettingsData(displayBusy) {
|
|
325
|
-
return dispatch(_fetchSettingsData(displayBusy));
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
};
|
|
329
|
-
export default translate()(connect(mapStateToProps, mapDispatchToProps)(Bar));
|