cozy-bar 8.2.0 → 8.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-bar",
3
- "version": "8.2.0",
3
+ "version": "8.4.1",
4
4
  "description": "cozy-bar.js library, a small lib provided by cozy-stack to inject the Cozy-bar component into each app",
5
5
  "main": "dist/cozy-bar.js",
6
6
  "author": "Cozy Cloud <contact@cozycloud.cc> (https://cozy.io/)",
@@ -53,6 +53,7 @@
53
53
  "babel-preset-cozy-app": "^1.9.0",
54
54
  "bundlesize": "0.18.0",
55
55
  "cozy-authentication": "1.19.1",
56
+ "cozy-intent": "^1.7.0",
56
57
  "css-loader": "1.0.1",
57
58
  "css-mqpacker": "7.0.0",
58
59
  "cssnano-preset-advanced": "4.0.7",
@@ -66,13 +67,14 @@
66
67
  "foreman": "3.0.1",
67
68
  "identity-obj-proxy": "3.0.0",
68
69
  "jest": "24.9.0",
70
+ "jest-fetch-mock": "^3.0.3",
69
71
  "json-loader": "0.5.7",
70
72
  "mini-css-extract-plugin": "0.8.0",
71
73
  "my-react": "npm:react@16.13.1",
72
74
  "my-react-dom": "npm:react-dom@16.13.1",
73
75
  "npm-run-all": "4.1.5",
74
76
  "parcel": "1.12.3",
75
- "postcss": "7.0.21",
77
+ "postcss": "7.0.36",
76
78
  "postcss-discard-duplicates": "4.0.2",
77
79
  "postcss-discard-empty": "4.0.1",
78
80
  "postcss-import": "12.0.1",
@@ -94,12 +96,12 @@
94
96
  },
95
97
  "dependencies": {
96
98
  "@cozy/minilog": "^1.0.0",
97
- "cozy-client": "13.8.3",
98
- "cozy-device-helper": "1.8.0",
99
+ "cozy-client": "^27.14.4",
100
+ "cozy-device-helper": "^1.16.1",
99
101
  "cozy-flags": "2.4.1",
100
102
  "cozy-interapp": "0.4.9",
101
103
  "cozy-realtime": "3.2.1",
102
- "cozy-ui": "40.1.0",
104
+ "cozy-ui": "^51.8.0",
103
105
  "hammerjs": "2.0.8",
104
106
  "lodash.debounce": "4.0.8",
105
107
  "lodash.unionwith": "4.6.0",
@@ -112,7 +114,8 @@
112
114
  "semver-compare": "^1.0.0"
113
115
  },
114
116
  "peerDependencies": {
115
- "cozy-client": "*"
117
+ "cozy-client": "*",
118
+ "cozy-intent": ">=1.7.0"
116
119
  },
117
120
  "bundlesize": [
118
121
  {
@@ -1,13 +1,13 @@
1
1
  import React, { Component } from 'react'
2
2
  import { connect } from 'react-redux'
3
3
 
4
- import { getHomeApp } from 'lib/reducers'
4
+ import BottomIcon from 'cozy-ui/react/Icons/Bottom'
5
+ import Icon from 'cozy-ui/react/Icon'
5
6
  import TopIcon from 'cozy-ui/react/Icons/Top'
6
- import BottomIcon from 'cozy-ui/react/Icons/Top'
7
-
8
7
  import { translate } from 'cozy-ui/react/I18n'
9
- import Icon from 'cozy-ui/react/Icon'
10
- import HomeIcon from 'components/Apps/IconCozyHome'
8
+
9
+ import { ButtonCozyHome } from 'components/Apps/ButtonCozyHome'
10
+ import { getHomeApp } from 'lib/reducers'
11
11
  import { isFetchingApps } from 'lib/reducers'
12
12
 
13
13
  class AppNavButton extends Component {
@@ -52,16 +52,10 @@ class AppNavButton extends Component {
52
52
 
53
53
  return (
54
54
  <div className={`coz-nav-apps-btns${isHomeApp ? ' --currentHome' : ''}`}>
55
- {homeHref ? (
56
- <a href={homeHref} className="coz-nav-apps-btns-home">
57
- <HomeIcon className="coz-nav-apps-btns-home-svg" />
58
- </a>
59
- ) : (
60
- <span className="coz-nav-apps-btns-home">
61
- <HomeIcon className="coz-nav-apps-btns-home-svg" />
62
- </span>
63
- )}
55
+ <ButtonCozyHome homeHref={homeHref} />
56
+
64
57
  {!isHomeApp && <span className="coz-nav-apps-btns-sep" />}
58
+
65
59
  <button
66
60
  type="button"
67
61
  onClick={isPublic ? null : handleClick}
@@ -0,0 +1,30 @@
1
+ import React from 'react'
2
+
3
+ import IconCozyHome from './IconCozyHome'
4
+
5
+ export const ButtonCozyHome = ({ webviewContext, homeHref }) => {
6
+ if (webviewContext)
7
+ return (
8
+ <button
9
+ onClick={() => {
10
+ webviewContext.call('backToHome')
11
+ }}
12
+ className="coz-nav-apps-btns-home --flagship"
13
+ >
14
+ <IconCozyHome className="coz-nav-apps-btns-home-svg" />
15
+ </button>
16
+ )
17
+
18
+ if (homeHref)
19
+ return (
20
+ <a href={homeHref} className="coz-nav-apps-btns-home">
21
+ <IconCozyHome className="coz-nav-apps-btns-home-svg" />
22
+ </a>
23
+ )
24
+
25
+ return (
26
+ <span className="coz-nav-apps-btns-home">
27
+ <IconCozyHome className="coz-nav-apps-btns-home-svg" />
28
+ </span>
29
+ )
30
+ }
@@ -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 a button when webviewContext', () => {
29
+ const render = shallow(<ButtonCozyHome webviewContext={webviewContext} />)
30
+ const element = render.getElement()
31
+
32
+ expect(element.type).toBe('button')
33
+ })
34
+
35
+ it('should give priority to button 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('button')
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
+ })
@@ -12,6 +12,7 @@ import {
12
12
  } from 'cozy-ui/react/helpers/tracker'
13
13
  import { isMobileApp } from 'cozy-device-helper'
14
14
 
15
+ import { ButtonCozyHome } from 'components/Apps/ButtonCozyHome'
15
16
  import Banner from 'components/Banner'
16
17
  import Drawer from 'components/Drawer'
17
18
  import Settings from 'components/Settings'
@@ -27,7 +28,8 @@ import {
27
28
  fetchApps,
28
29
  fetchContext,
29
30
  fetchSettingsData,
30
- shouldEnableClaudy
31
+ shouldEnableClaudy,
32
+ getWebviewContext
31
33
  } from 'lib/reducers'
32
34
 
33
35
  /* Generated with node_modules/.bin/svgr src/assets/sprites/icon-apps.svg */
@@ -163,7 +165,12 @@ export class Bar extends Component {
163
165
  }
164
166
 
165
167
  renderLeft = () => {
166
- const { t, isPublic } = this.props
168
+ const { t, isPublic, webviewContext } = this.props
169
+
170
+ if (webviewContext) {
171
+ return <ButtonCozyHome webviewContext={webviewContext} />
172
+ }
173
+
167
174
  // data-tutorial attribute allows to be targeted in an application tutorial
168
175
  return !isPublic ? (
169
176
  <button
@@ -197,6 +204,7 @@ export class Bar extends Component {
197
204
  supportDisplayed,
198
205
  usageTracker
199
206
  } = this.state
207
+
200
208
  const {
201
209
  theme,
202
210
  themeOverrides,
@@ -269,7 +277,8 @@ export const mapStateToProps = state => ({
269
277
  barSearch: getContent(state, 'search'),
270
278
  isDrive: isCurrentApp(state, { slug: 'drive' }),
271
279
  claudyEnabled: shouldEnableClaudy(state),
272
- hasFetchedApps: hasFetched(state)
280
+ hasFetchedApps: hasFetched(state),
281
+ webviewContext: getWebviewContext(state)
273
282
  })
274
283
 
275
284
  export const mapDispatchToProps = dispatch => ({
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import { shallow } from 'enzyme'
3
- import { isMobileApp } from 'cozy-device-helper'
3
+ import { isFlagshipApp, isMobileApp } from 'cozy-device-helper'
4
4
  import toJson from 'enzyme-to-json'
5
5
  import reducers from 'lib/reducers'
6
6
  import CozyClient from 'cozy-client'
@@ -9,7 +9,8 @@ import { Bar, mapStateToProps, mapDispatchToProps } from './Bar'
9
9
 
10
10
  jest.mock('cozy-device-helper', () => ({
11
11
  ...require.requireActual('cozy-device-helper'),
12
- isMobileApp: jest.fn()
12
+ isMobileApp: jest.fn(),
13
+ isFlagshipApp: jest.fn()
13
14
  }))
14
15
 
15
16
  describe('Bar', () => {
@@ -32,6 +33,7 @@ describe('Bar', () => {
32
33
 
33
34
  afterEach(() => {
34
35
  Bar.prototype.fetchApps.mockRestore()
36
+ isFlagshipApp.mockClear()
35
37
  })
36
38
 
37
39
  it('should fetch data when mounted', () => {
@@ -5,6 +5,8 @@ import get from 'lodash/get'
5
5
 
6
6
  import { translate } from 'cozy-ui/react/I18n'
7
7
  import { Button } from 'cozy-ui/react/Button'
8
+ import GearIcon from 'cozy-ui/react/Icons/Gear'
9
+
8
10
  import { queryConnect } from 'cozy-client/dist'
9
11
  import { models } from 'cozy-client'
10
12
  let instanceModel = undefined
@@ -148,7 +150,7 @@ export class Settings extends Component {
148
150
  className="coz-nav-settings-btn"
149
151
  aria-controls="coz-nav-pop--settings"
150
152
  busy={isBusy}
151
- icon="gear"
153
+ icon={GearIcon}
152
154
  label={t('menu.settings')}
153
155
  />
154
156
  <div
@@ -174,6 +174,7 @@ Object {
174
174
  "isDrive": false,
175
175
  "theme": "default",
176
176
  "themeOverrides": Object {},
177
+ "webviewContext": undefined,
177
178
  }
178
179
  `;
179
180
 
package/src/index.jsx CHANGED
@@ -218,7 +218,8 @@ const {
218
218
  BarRight,
219
219
  BarLeft,
220
220
  BarSearch,
221
- setTheme
221
+ setTheme,
222
+ setWebviewContext
222
223
  } = proxiedAPI
223
224
 
224
225
  const version = __VERSION__
@@ -235,6 +236,7 @@ export {
235
236
  BarCenter,
236
237
  BarSearch,
237
238
  setTheme,
239
+ setWebviewContext,
238
240
  setLocale,
239
241
  updateAccessToken
240
242
  }
@@ -1,7 +1,13 @@
1
1
  import CozyClient from 'cozy-client'
2
+ import jestFetchMock from 'jest-fetch-mock'
3
+
2
4
  import * as cozyBar from './index'
3
5
 
4
6
  describe('init', () => {
7
+ beforeAll(() => {
8
+ global.fetch = jestFetchMock
9
+ })
10
+
5
11
  beforeEach(() => {
6
12
  jest.spyOn(console, 'error')
7
13
  const div = document.createElement('div')
@@ -1,5 +1,11 @@
1
1
  import React, { Component } from 'react'
2
- import { setContent, unsetContent, setLocale, setTheme } from 'lib/reducers'
2
+ import {
3
+ setContent,
4
+ unsetContent,
5
+ setLocale,
6
+ setTheme,
7
+ setWebviewContext
8
+ } from 'lib/reducers'
3
9
 
4
10
  import { locations, getJsApiName, getReactApiName } from 'lib/api/helpers'
5
11
 
@@ -90,6 +96,10 @@ export const createBarAPI = store => {
90
96
  store.dispatch(setTheme(...args))
91
97
  }
92
98
 
99
+ methods.setWebviewContext = (...args) => {
100
+ store.dispatch(setWebviewContext(...args))
101
+ }
102
+
93
103
  return methods
94
104
  }
95
105
 
@@ -128,7 +138,7 @@ export const createBarProxiedAPI = exposedAPI => {
128
138
  }
129
139
  })
130
140
 
131
- for (let fnName of ['setLocale', 'setTheme']) {
141
+ for (let fnName of ['setLocale', 'setTheme', 'setWebviewContext']) {
132
142
  apiReferences[fnName] = makeProxyMethodToAPI(exposedAPI, fnName)
133
143
  }
134
144
  return apiReferences
@@ -2,6 +2,7 @@ import { combineReducers } from 'redux'
2
2
  import * as content from 'lib/reducers/content'
3
3
  import * as locale from 'lib/reducers/locale'
4
4
  import * as theme from 'lib/reducers/theme'
5
+ import * as unserializable from 'lib/reducers/unserializable'
5
6
  import appsReducer, * as apps from 'lib/reducers/apps'
6
7
  import settingsReducer, * as settings from 'lib/reducers/settings'
7
8
  import contextReducer, * as context from 'lib/reducers/context'
@@ -16,6 +17,7 @@ const setContent = content.setContent
16
17
  const unsetContent = content.unsetContent
17
18
  const setLocale = locale.setLocale
18
19
  const setTheme = theme.setTheme
20
+ const setWebviewContext = unserializable.setWebviewContext
19
21
  const fetchApps = apps.fetchApps
20
22
  const setInfos = apps.setInfos
21
23
  const fetchSettingsData = settings.fetchSettingsData
@@ -26,6 +28,7 @@ export {
26
28
  unsetContent,
27
29
  setLocale,
28
30
  setTheme,
31
+ setWebviewContext,
29
32
  fetchApps,
30
33
  setInfos,
31
34
  fetchSettingsData,
@@ -48,18 +51,23 @@ export const isFetchingSettings = proxy('settings', settings.isFetchingSettings)
48
51
  export const getHelpLink = proxy('context', context.getHelpLink)
49
52
  export const getClaudyActions = proxy('context', context.getClaudyActions)
50
53
  export const shouldEnableClaudy = proxy('context', context.shouldEnableClaudy)
54
+ export const getWebviewContext = proxy(
55
+ 'unserializable',
56
+ unserializable.getWebviewContext
57
+ )
51
58
 
52
59
  // realtime handlers
53
60
  export const onRealtimeCreate = apps.receiveApp
54
61
  export const onRealtimeDelete = apps.deleteApp
55
62
 
56
63
  export const reducers = {
64
+ apps: appsReducer,
57
65
  content: content.reducer,
66
+ context: contextReducer,
58
67
  locale: locale.reducer,
59
- theme: theme.reducer,
60
- apps: appsReducer,
61
68
  settings: settingsReducer,
62
- context: contextReducer
69
+ theme: theme.reducer,
70
+ unserializable: unserializable.reducer
63
71
  }
64
72
 
65
73
  export default combineReducers(reducers)
@@ -0,0 +1,26 @@
1
+ const SET_WEBVIEW_CONTEXT = 'SET_WEBVIEW_CONTEXT'
2
+
3
+ // selectors
4
+ export const getWebviewContext = state => {
5
+ return state.webviewContext
6
+ }
7
+
8
+ // actions
9
+ export const setWebviewContext = payload => ({
10
+ type: SET_WEBVIEW_CONTEXT,
11
+ payload
12
+ })
13
+
14
+ // reducers
15
+ const defaultState = {
16
+ webviewContext: undefined
17
+ }
18
+
19
+ export const reducer = (state = defaultState, action) => {
20
+ switch (action.type) {
21
+ case SET_WEBVIEW_CONTEXT:
22
+ return { ...state, webviewContext: action.payload }
23
+ default:
24
+ return state
25
+ }
26
+ }
@@ -46,11 +46,16 @@
46
46
  }
47
47
 
48
48
  [role=banner] .coz-nav-apps-btns-home {
49
- width: 2rem;
50
49
  height: 2rem;
51
50
  margin-right: .75rem;
52
51
  }
53
52
 
53
+ [role=banner] .coz-nav-apps-btns-home.--flagship {
54
+ background: none;
55
+ border: 0;
56
+ height: 100%;
57
+ }
58
+
54
59
  [role=banner] .coz-nav-apps-btns-home-svg {
55
60
  max-width: 2rem;
56
61
  max-height: 2rem;
@@ -179,7 +184,7 @@
179
184
  display: flex;
180
185
  justify-content: flex-start;
181
186
  }
182
- [role=banner] [role=menuitem].coz-apps-home-btn img {
187
+ [role=banner] [role=menuitem].coz-apps-home-btn img, .coz-apps-home-btn svg {
183
188
  width: 1rem;
184
189
  height: 1rem;
185
190
  margin-right: .5rem;
@@ -10,12 +10,12 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
10
10
 
11
11
  import React, { Component } from 'react';
12
12
  import { connect } from 'react-redux';
13
- import { getHomeApp } from "../../lib/reducers";
13
+ import BottomIcon from "cozy-ui/transpiled/react/Icons/Bottom";
14
+ import Icon from "cozy-ui/transpiled/react/Icon";
14
15
  import TopIcon from "cozy-ui/transpiled/react/Icons/Top";
15
- import BottomIcon from "cozy-ui/transpiled/react/Icons/Top";
16
16
  import { translate } from "cozy-ui/transpiled/react/I18n";
17
- import Icon from "cozy-ui/transpiled/react/Icon";
18
- import HomeIcon from "./IconCozyHome";
17
+ import { ButtonCozyHome } from "./ButtonCozyHome";
18
+ import { getHomeApp } from "../../lib/reducers";
19
19
  import { isFetchingApps } from "../../lib/reducers";
20
20
 
21
21
  var AppNavButton = /*#__PURE__*/function (_Component) {
@@ -65,16 +65,9 @@ var AppNavButton = /*#__PURE__*/function (_Component) {
65
65
  var homeHref = !isPublic && homeApp && homeApp.href;
66
66
  return /*#__PURE__*/React.createElement("div", {
67
67
  className: "coz-nav-apps-btns".concat(isHomeApp ? ' --currentHome' : '')
68
- }, homeHref ? /*#__PURE__*/React.createElement("a", {
69
- href: homeHref,
70
- className: "coz-nav-apps-btns-home"
71
- }, /*#__PURE__*/React.createElement(HomeIcon, {
72
- className: "coz-nav-apps-btns-home-svg"
73
- })) : /*#__PURE__*/React.createElement("span", {
74
- className: "coz-nav-apps-btns-home"
75
- }, /*#__PURE__*/React.createElement(HomeIcon, {
76
- className: "coz-nav-apps-btns-home-svg"
77
- })), !isHomeApp && /*#__PURE__*/React.createElement("span", {
68
+ }, /*#__PURE__*/React.createElement(ButtonCozyHome, {
69
+ homeHref: homeHref
70
+ }), !isHomeApp && /*#__PURE__*/React.createElement("span", {
78
71
  className: "coz-nav-apps-btns-sep"
79
72
  }), /*#__PURE__*/React.createElement("button", {
80
73
  type: "button",
@@ -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("button", {
7
+ onClick: function onClick() {
8
+ webviewContext.call('backToHome');
9
+ },
10
+ className: "coz-nav-apps-btns-home --flagship"
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 a button when webviewContext', () => {
29
+ const render = shallow(<ButtonCozyHome webviewContext={webviewContext} />)
30
+ const element = render.getElement()
31
+
32
+ expect(element.type).toBe('button')
33
+ })
34
+
35
+ it('should give priority to button 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('button')
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
+ })
@@ -19,6 +19,7 @@ import { translate } from "cozy-ui/transpiled/react/I18n";
19
19
  import Icon from "cozy-ui/transpiled/react/Icon";
20
20
  import { shouldEnableTracking, getTracker, configureTracker } from "cozy-ui/transpiled/react/helpers/tracker";
21
21
  import { isMobileApp } from 'cozy-device-helper';
22
+ import { ButtonCozyHome } from "./Apps/ButtonCozyHome";
22
23
  import Banner from "./Banner";
23
24
  import Drawer from "./Drawer";
24
25
  import Settings from "./Settings";
@@ -26,7 +27,7 @@ import Apps from "./Apps";
26
27
  import SearchBar from "./SearchBar";
27
28
  import Claudy from "./Claudy";
28
29
  import SupportModal from "./SupportModal";
29
- import { getTheme, hasFetched, getContent, isCurrentApp, fetchApps as _fetchApps, fetchContext as _fetchContext, fetchSettingsData as _fetchSettingsData, shouldEnableClaudy } from "../lib/reducers";
30
+ import { getTheme, hasFetched, getContent, isCurrentApp, fetchApps as _fetchApps, fetchContext as _fetchContext, fetchSettingsData as _fetchSettingsData, shouldEnableClaudy, getWebviewContext } from "../lib/reducers";
30
31
  /* Generated with node_modules/.bin/svgr src/assets/sprites/icon-apps.svg */
31
32
 
32
33
  function SvgIconApps(props) {
@@ -102,7 +103,15 @@ export var Bar = /*#__PURE__*/function (_Component) {
102
103
  _defineProperty(_assertThisInitialized(_this), "renderLeft", function () {
103
104
  var _this$props = _this.props,
104
105
  t = _this$props.t,
105
- isPublic = _this$props.isPublic; // data-tutorial attribute allows to be targeted in an application tutorial
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
+
106
115
 
107
116
  return !isPublic ? /*#__PURE__*/React.createElement("button", {
108
117
  type: "button",
@@ -174,7 +183,7 @@ export var Bar = /*#__PURE__*/function (_Component) {
174
183
  }, {
175
184
  key: "initPiwikTracker",
176
185
  value: function initPiwikTracker() {
177
- var trackerInstance = getTracker("\"https://piwik.cozycloud.cc\"", 8, false, false);
186
+ var trackerInstance = getTracker("\"https://matomo.cozycloud.cc\"", 8, false, false);
178
187
  configureTracker({
179
188
  appDimensionId: 1,
180
189
  app: 'Cozy Bar',
@@ -300,7 +309,8 @@ export var mapStateToProps = function mapStateToProps(state) {
300
309
  slug: 'drive'
301
310
  }),
302
311
  claudyEnabled: shouldEnableClaudy(state),
303
- hasFetchedApps: hasFetched(state)
312
+ hasFetchedApps: hasFetched(state),
313
+ webviewContext: getWebviewContext(state)
304
314
  };
305
315
  };
306
316
  export var mapDispatchToProps = function mapDispatchToProps(dispatch) {
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import { shallow } from 'enzyme'
3
- import { isMobileApp } from 'cozy-device-helper'
3
+ import { isFlagshipApp, isMobileApp } from 'cozy-device-helper'
4
4
  import toJson from 'enzyme-to-json'
5
5
  import reducers from 'lib/reducers'
6
6
  import CozyClient from 'cozy-client'
@@ -9,7 +9,8 @@ import { Bar, mapStateToProps, mapDispatchToProps } from './Bar'
9
9
 
10
10
  jest.mock('cozy-device-helper', () => ({
11
11
  ...require.requireActual('cozy-device-helper'),
12
- isMobileApp: jest.fn()
12
+ isMobileApp: jest.fn(),
13
+ isFlagshipApp: jest.fn()
13
14
  }))
14
15
 
15
16
  describe('Bar', () => {
@@ -32,6 +33,7 @@ describe('Bar', () => {
32
33
 
33
34
  afterEach(() => {
34
35
  Bar.prototype.fetchApps.mockRestore()
36
+ isFlagshipApp.mockClear()
35
37
  })
36
38
 
37
39
  it('should fetch data when mounted', () => {
@@ -16,6 +16,7 @@ import { compose } from 'redux';
16
16
  import get from 'lodash/get';
17
17
  import { translate } from "cozy-ui/transpiled/react/I18n";
18
18
  import { Button } from "cozy-ui/transpiled/react/Button";
19
+ import GearIcon from "cozy-ui/transpiled/react/Icons/Gear";
19
20
  import { queryConnect } from 'cozy-client/dist';
20
21
  import { models } from 'cozy-client';
21
22
  var instanceModel = undefined;
@@ -162,7 +163,7 @@ export var Settings = /*#__PURE__*/function (_Component) {
162
163
  className: "coz-nav-settings-btn",
163
164
  "aria-controls": "coz-nav-pop--settings",
164
165
  busy: isBusy,
165
- icon: "gear",
166
+ icon: GearIcon,
166
167
  label: t('menu.settings')
167
168
  }), /*#__PURE__*/React.createElement("div", {
168
169
  className: "coz-nav-pop coz-nav-pop--settings",