cozy-bar 8.4.3 → 8.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/CHANGELOG.md +493 -0
  2. package/dist/cozy-bar.min.js +4 -4
  3. package/dist/cozy-bar.min.js.map +1 -1
  4. package/package.json +1 -1
  5. package/src/components/Apps/ButtonCozyHome.jsx +3 -3
  6. package/src/components/Apps/ButtonCozyHome.spec.jsx +4 -4
  7. package/src/styles/apps.css +36 -29
  8. package/transpiled/assets/icons/16/icon-storage-16.svg +3 -0
  9. package/transpiled/assets/icons/24/icon-arrow-left.svg +3 -0
  10. package/transpiled/assets/icons/32/icon-claudy.svg +1 -0
  11. package/transpiled/assets/icons/apps/icon-collect.svg +25 -0
  12. package/transpiled/assets/icons/apps/icon-drive.svg +17 -0
  13. package/transpiled/assets/icons/apps/icon-market-soon.svg +25 -0
  14. package/transpiled/assets/icons/apps/icon-photos.svg +19 -0
  15. package/transpiled/assets/icons/apps/icon-soon.svg +21 -0
  16. package/transpiled/assets/icons/apps/icon-store.svg +19 -0
  17. package/transpiled/assets/icons/claudyActions/icon-bills.svg +6 -0
  18. package/transpiled/assets/icons/claudyActions/icon-laptop.svg +7 -0
  19. package/transpiled/assets/icons/claudyActions/icon-phone.svg +8 -0
  20. package/transpiled/assets/icons/claudyActions/icon-question-mark.svg +6 -0
  21. package/transpiled/assets/icons/comingsoon/icon-bank.svg +12 -0
  22. package/transpiled/assets/icons/comingsoon/icon-sante.svg +12 -0
  23. package/transpiled/assets/icons/comingsoon/icon-store.svg +6 -0
  24. package/transpiled/assets/icons/icon-cozy.svg +3 -0
  25. package/transpiled/assets/icons/icon-shield.svg +3 -0
  26. package/transpiled/assets/icons/spinner.svg +4 -0
  27. package/transpiled/assets/sprites/icon-apps.svg +1 -0
  28. package/transpiled/assets/sprites/icon-cozy-home.svg +16 -0
  29. package/transpiled/components/Apps/AppItem.js +134 -0
  30. package/transpiled/components/Apps/AppItemPlaceholder.js +14 -0
  31. package/transpiled/components/Apps/AppNavButtons.js +108 -0
  32. package/transpiled/components/Apps/AppsContent.js +124 -0
  33. package/transpiled/components/Apps/ButtonCozyHome.js +25 -0
  34. package/transpiled/components/Apps/ButtonCozyHome.spec.jsx +53 -0
  35. package/transpiled/components/Apps/IconCozyHome.js +67 -0
  36. package/transpiled/components/Apps/index.js +102 -0
  37. package/transpiled/components/Banner.js +76 -0
  38. package/transpiled/components/Bar.js +329 -0
  39. package/transpiled/components/Bar.spec.jsx +133 -0
  40. package/transpiled/components/Claudy.js +123 -0
  41. package/transpiled/components/ClaudyIcon.js +16 -0
  42. package/transpiled/components/Drawer.js +367 -0
  43. package/transpiled/components/Drawer.spec.jsx +98 -0
  44. package/transpiled/components/SearchBar.js +407 -0
  45. package/transpiled/components/Settings/SettingsContent.js +128 -0
  46. package/transpiled/components/Settings/StorageData.js +24 -0
  47. package/transpiled/components/Settings/helper.js +9 -0
  48. package/transpiled/components/Settings/index.js +225 -0
  49. package/transpiled/components/StorageIcon.js +16 -0
  50. package/transpiled/components/SupportModal.js +86 -0
  51. package/transpiled/components/__snapshots__/Bar.spec.jsx.snap +302 -0
  52. package/transpiled/config/claudyActions.json +20 -0
  53. package/transpiled/config/persistWhitelist.json +4 -0
  54. package/transpiled/cozy-bar.css +5911 -0
  55. package/transpiled/dom.js +84 -0
  56. package/transpiled/index.js +246 -0
  57. package/transpiled/index.spec.jsx +34 -0
  58. package/transpiled/lib/api/helpers.js +12 -0
  59. package/transpiled/lib/api/index.js +175 -0
  60. package/transpiled/lib/exceptions.js +156 -0
  61. package/transpiled/lib/expiringMemoize.js +17 -0
  62. package/transpiled/lib/icon.js +154 -0
  63. package/transpiled/lib/intents.js +17 -0
  64. package/transpiled/lib/logger.js +10 -0
  65. package/transpiled/lib/middlewares/appsI18n.js +64 -0
  66. package/transpiled/lib/realtime.js +76 -0
  67. package/transpiled/lib/reducers/apps.js +291 -0
  68. package/transpiled/lib/reducers/apps.spec.js +59 -0
  69. package/transpiled/lib/reducers/content.js +68 -0
  70. package/transpiled/lib/reducers/context.js +138 -0
  71. package/transpiled/lib/reducers/index.js +59 -0
  72. package/transpiled/lib/reducers/locale.js +27 -0
  73. package/transpiled/lib/reducers/settings.js +253 -0
  74. package/transpiled/lib/reducers/theme.js +64 -0
  75. package/transpiled/lib/reducers/unserializable.js +31 -0
  76. package/transpiled/lib/stack-client.js +442 -0
  77. package/transpiled/lib/stack.js +122 -0
  78. package/transpiled/lib/store/index.js +42 -0
  79. package/transpiled/locales/de.json +57 -0
  80. package/transpiled/locales/en.json +57 -0
  81. package/transpiled/locales/es.json +57 -0
  82. package/transpiled/locales/fr.json +57 -0
  83. package/transpiled/locales/it.json +57 -0
  84. package/transpiled/locales/ja.json +57 -0
  85. package/transpiled/locales/nl_NL.json +57 -0
  86. package/transpiled/locales/pl.json +57 -0
  87. package/transpiled/locales/ru.json +57 -0
  88. package/transpiled/locales/sq.json +57 -0
  89. package/transpiled/locales/zh_CN.json +57 -0
  90. package/transpiled/proptypes/index.js +11 -0
  91. package/transpiled/queries/index.js +19 -0
  92. package/transpiled/styles/apps.css +255 -0
  93. package/transpiled/styles/banner.css +64 -0
  94. package/transpiled/styles/bar.css +106 -0
  95. package/transpiled/styles/base.css +21 -0
  96. package/transpiled/styles/claudy.css +98 -0
  97. package/transpiled/styles/drawer.css +126 -0
  98. package/transpiled/styles/index.styl +33 -0
  99. package/transpiled/styles/indicators.css +58 -0
  100. package/transpiled/styles/nav.css +81 -0
  101. package/transpiled/styles/navigation_item.css +34 -0
  102. package/transpiled/styles/searchbar.css +156 -0
  103. package/transpiled/styles/settings.css +34 -0
  104. package/transpiled/styles/storage.css +22 -0
  105. package/transpiled/styles/supportModal.css +20 -0
  106. package/transpiled/styles/theme.styl +25 -0
@@ -0,0 +1,108 @@
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
+
7
+ 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); }; }
8
+
9
+ 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; } }
10
+
11
+ import React, { Component } from 'react';
12
+ import { connect } from 'react-redux';
13
+ import BottomIcon from "cozy-ui/transpiled/react/Icons/Bottom";
14
+ import Icon from "cozy-ui/transpiled/react/Icon";
15
+ import TopIcon from "cozy-ui/transpiled/react/Icons/Top";
16
+ import { translate } from "cozy-ui/transpiled/react/I18n";
17
+ import { ButtonCozyHome } from "./ButtonCozyHome";
18
+ import { getHomeApp } from "../../lib/reducers";
19
+ import { isFetchingApps } from "../../lib/reducers";
20
+
21
+ var AppNavButton = /*#__PURE__*/function (_Component) {
22
+ _inherits(AppNavButton, _Component);
23
+
24
+ var _super = _createSuper(AppNavButton);
25
+
26
+ function AppNavButton() {
27
+ _classCallCheck(this, AppNavButton);
28
+
29
+ return _super.apply(this, arguments);
30
+ }
31
+
32
+ _createClass(AppNavButton, [{
33
+ key: "render",
34
+ value: function render() {
35
+ var _this$props = this.props,
36
+ homeApp = _this$props.homeApp,
37
+ handleClick = _this$props.handleClick,
38
+ appName = _this$props.appName,
39
+ appNamePrefix = _this$props.appNamePrefix,
40
+ appSlug = _this$props.appSlug,
41
+ iconPath = _this$props.iconPath,
42
+ isFetchingApps = _this$props.isFetchingApps,
43
+ isPublic = _this$props.isPublic,
44
+ opened = _this$props.opened,
45
+ t = _this$props.t;
46
+ var isHomeApp = homeApp && homeApp.isCurrentApp;
47
+
48
+ if (!isPublic && isFetchingApps) {
49
+ return /*#__PURE__*/React.createElement("div", {
50
+ className: "coz-nav-apps-btns --loading"
51
+ }, /*#__PURE__*/React.createElement("div", {
52
+ className: "coz-nav-apps-btns-home coz-loading-placeholder"
53
+ }), /*#__PURE__*/React.createElement("div", {
54
+ className: "coz-nav-apps-btns-main coz-loading-placeholder"
55
+ }));
56
+ }
57
+
58
+ var displayName = !isHomeApp && appNamePrefix ? [t("".concat(appSlug, ".name_prefix"), {
59
+ _: appNamePrefix
60
+ }), t("".concat(appSlug, ".name"), {
61
+ _: appName
62
+ })].join(' ') : t("".concat(appSlug, ".name"), {
63
+ _: appName
64
+ });
65
+ var homeHref = !isPublic && homeApp && homeApp.href;
66
+ return /*#__PURE__*/React.createElement("div", {
67
+ className: "coz-nav-apps-btns".concat(isHomeApp ? ' --currentHome' : '')
68
+ }, /*#__PURE__*/React.createElement(ButtonCozyHome, {
69
+ homeHref: homeHref
70
+ }), !isHomeApp && /*#__PURE__*/React.createElement("span", {
71
+ className: "coz-nav-apps-btns-sep"
72
+ }), /*#__PURE__*/React.createElement("button", {
73
+ type: "button",
74
+ onClick: isPublic ? null : handleClick,
75
+ className: "coz-nav-apps-btns-main",
76
+ "aria-controls": "coz-nav-pop--apps",
77
+ "data-tutorial": "apps",
78
+ disabled: isPublic
79
+ }, !isHomeApp && /*#__PURE__*/React.createElement("img", {
80
+ className: "coz-bar-hide-sm",
81
+ src: iconPath,
82
+ width: "28",
83
+ alt: ""
84
+ }), /*#__PURE__*/React.createElement("span", {
85
+ className: "coz-nav-app-name"
86
+ }, displayName), !isPublic && /*#__PURE__*/React.createElement(Icon, {
87
+ icon: opened ? TopIcon : BottomIcon,
88
+ color: "#95999d",
89
+ size: "12"
90
+ })));
91
+ }
92
+ }]);
93
+
94
+ return AppNavButton;
95
+ }(Component);
96
+
97
+ var mapStateToProps = function mapStateToProps(state) {
98
+ return {
99
+ homeApp: getHomeApp(state),
100
+ isFetchingApps: isFetchingApps(state)
101
+ };
102
+ };
103
+
104
+ var mapDispatchToProps = function mapDispatchToProps() {
105
+ return {};
106
+ };
107
+
108
+ export default connect(mapStateToProps, mapDispatchToProps)(translate()(AppNavButton));
@@ -0,0 +1,124 @@
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
+
7
+ 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); }; }
8
+
9
+ 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; } }
10
+
11
+ import React, { Component } from 'react';
12
+ import { connect } from 'react-redux';
13
+ import Proptypes from 'prop-types';
14
+ import { translate } from "cozy-ui/transpiled/react/I18n";
15
+ import Icon from 'cozy-ui/transpiled/react/Icon';
16
+ import CloudIcon from 'cozy-ui/transpiled/react/Icons/Cloud';
17
+ import withBreakpoints from "cozy-ui/transpiled/react/helpers/withBreakpoints";
18
+ import { getApps, getHomeApp, isFetchingApps } from "../../lib/reducers";
19
+ import AppItem from "./AppItem";
20
+ import AppItemPlaceholder from "./AppItemPlaceholder";
21
+
22
+ var sorter = function sorter(fn) {
23
+ return function (itemA, itemB) {
24
+ return fn(itemA) > fn(itemB);
25
+ };
26
+ };
27
+
28
+ export var AppsContent = /*#__PURE__*/function (_Component) {
29
+ _inherits(AppsContent, _Component);
30
+
31
+ var _super = _createSuper(AppsContent);
32
+
33
+ function AppsContent(props, context) {
34
+ var _this;
35
+
36
+ _classCallCheck(this, AppsContent);
37
+
38
+ _this = _super.call(this, props, context);
39
+ _this.translateApp = translateApp(_this.props.t);
40
+ return _this;
41
+ }
42
+
43
+ _createClass(AppsContent, [{
44
+ key: "render",
45
+ value: function render() {
46
+ var _this$props = this.props,
47
+ t = _this$props.t,
48
+ apps = _this$props.apps,
49
+ breakpoints = _this$props.breakpoints,
50
+ homeApp = _this$props.homeApp,
51
+ isFetchingApps = _this$props.isFetchingApps,
52
+ onAppSwitch = _this$props.onAppSwitch;
53
+ var isMobile = breakpoints.isMobile;
54
+ var isHomeApp = homeApp && homeApp.isCurrentApp;
55
+ var homeSlug = homeApp && homeApp.slug;
56
+
57
+ if (!isFetchingApps && (!apps || !apps.length)) {
58
+ return /*#__PURE__*/React.createElement("p", {
59
+ className: "coz-nav--error coz-nav-group"
60
+ }, t('no_apps'));
61
+ }
62
+
63
+ return /*#__PURE__*/React.createElement("div", {
64
+ className: "coz-nav-pop-content"
65
+ }, /*#__PURE__*/React.createElement("ul", {
66
+ className: "coz-nav-group"
67
+ }, isMobile && homeApp && /*#__PURE__*/React.createElement(AppItem, {
68
+ app: homeApp,
69
+ useHomeIcon: true,
70
+ onAppSwitch: onAppSwitch
71
+ }), isFetchingApps ? new Array(3).fill({}).map(function (nothing, index) {
72
+ return /*#__PURE__*/React.createElement(AppItemPlaceholder, {
73
+ key: index
74
+ });
75
+ }) : apps.filter(function (app) {
76
+ return app.slug !== homeSlug;
77
+ }).sort(sorter(this.translateApp)).map(function (app, index) {
78
+ return /*#__PURE__*/React.createElement(AppItem, {
79
+ app: app,
80
+ key: index,
81
+ onAppSwitch: onAppSwitch
82
+ });
83
+ })), homeApp && !isMobile && !isHomeApp && /*#__PURE__*/React.createElement("a", {
84
+ role: "menuitem",
85
+ href: homeApp.href,
86
+ className: "coz-apps-home-btn"
87
+ }, /*#__PURE__*/React.createElement(Icon, {
88
+ icon: CloudIcon
89
+ }), t('menu.home')));
90
+ }
91
+ }]);
92
+
93
+ return AppsContent;
94
+ }(Component);
95
+ AppsContent.propTypes = {
96
+ homeApp: Proptypes.shape({
97
+ isCurrentApp: Proptypes.bool,
98
+ slug: Proptypes.string
99
+ }),
100
+ apps: Proptypes.array,
101
+ isFetchingApps: Proptypes.bool.isRequired
102
+ };
103
+
104
+ var translateApp = function translateApp(t) {
105
+ return function (app) {
106
+ var namePrefix = app.namePrefix ? t("".concat(app.slug, ".namePrefix"), {
107
+ _: app.namePrefix
108
+ }) : null;
109
+ var name = t("".concat(app.slug, ".name"), {
110
+ _: app.name
111
+ });
112
+ return namePrefix ? "".concat(namePrefix, " ").concat(name) : "".concat(name);
113
+ };
114
+ };
115
+
116
+ var mapStateToProps = function mapStateToProps(state) {
117
+ return {
118
+ apps: getApps(state),
119
+ homeApp: getHomeApp(state),
120
+ isFetchingApps: isFetchingApps(state)
121
+ };
122
+ };
123
+
124
+ export default connect(mapStateToProps)(translate()(withBreakpoints()(AppsContent)));
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import IconCozyHome from "./IconCozyHome";
3
+ export var ButtonCozyHome = function ButtonCozyHome(_ref) {
4
+ var webviewContext = _ref.webviewContext,
5
+ homeHref = _ref.homeHref;
6
+ if (webviewContext) return /*#__PURE__*/React.createElement("a", {
7
+ onClick: function onClick() {
8
+ webviewContext.call('backToHome');
9
+ },
10
+ className: "coz-nav-apps-btns-home"
11
+ }, /*#__PURE__*/React.createElement(IconCozyHome, {
12
+ className: "coz-nav-apps-btns-home-svg"
13
+ }));
14
+ if (homeHref) return /*#__PURE__*/React.createElement("a", {
15
+ href: homeHref,
16
+ className: "coz-nav-apps-btns-home"
17
+ }, /*#__PURE__*/React.createElement(IconCozyHome, {
18
+ className: "coz-nav-apps-btns-home-svg"
19
+ }));
20
+ return /*#__PURE__*/React.createElement("span", {
21
+ className: "coz-nav-apps-btns-home"
22
+ }, /*#__PURE__*/React.createElement(IconCozyHome, {
23
+ className: "coz-nav-apps-btns-home-svg"
24
+ }));
25
+ };
@@ -0,0 +1,53 @@
1
+ import React from 'react'
2
+ import { shallow } from 'enzyme'
3
+
4
+ import { ButtonCozyHome } from 'components/Apps/ButtonCozyHome'
5
+
6
+ const homeHref = 'foo'
7
+ const expectedCall = 'backToHome'
8
+ const webviewContext = {
9
+ call: jest.fn()
10
+ }
11
+
12
+ describe('ButtonCozyHome', () => {
13
+ it('should render a span with no props', () => {
14
+ const render = shallow(<ButtonCozyHome />)
15
+ const element = render.getElement()
16
+
17
+ expect(element.type).toBe('span')
18
+ })
19
+
20
+ it('should render an anchor with correct href when homeHref', () => {
21
+ const render = shallow(<ButtonCozyHome homeHref={homeHref} />)
22
+ const element = render.getElement()
23
+
24
+ expect(element.type).toBe('a')
25
+ expect(element.props.href).toBe(homeHref)
26
+ })
27
+
28
+ it('should render an anchor when webviewContext', () => {
29
+ const render = shallow(<ButtonCozyHome webviewContext={webviewContext} />)
30
+ const element = render.getElement()
31
+
32
+ expect(element.type).toBe('a')
33
+ })
34
+
35
+ it('should give priority to anchor if both webviewContext and homeHref are present', () => {
36
+ const render = shallow(
37
+ <ButtonCozyHome homeHref={homeHref} webviewContext={webviewContext} />
38
+ )
39
+ const element = render.getElement()
40
+
41
+ expect(element.type).toBe('a')
42
+ })
43
+
44
+ it('should call the correct context method on click', () => {
45
+ const render = shallow(
46
+ <ButtonCozyHome homeHref={homeHref} webviewContext={webviewContext} />
47
+ )
48
+
49
+ render.simulate('click')
50
+
51
+ expect(webviewContext.call).toBeCalledWith(expectedCall)
52
+ })
53
+ })
@@ -0,0 +1,67 @@
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;
@@ -0,0 +1,102 @@
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;
@@ -0,0 +1,76 @@
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);