cozy-bar 16.0.1 → 17.0.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 +30 -0
- package/dist/components/Bar.js +16 -1
- package/dist/components/Bar.spec.jsx +1 -0
- package/dist/components/BarComponent.js +6 -1
- package/dist/components/BarRoutes.js +25 -0
- package/dist/components/Settings/SettingsContent.js +1 -1
- package/dist/index.js +11 -1
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -89,6 +89,36 @@ You also need to disable the internal store onto the `BarComponent` with the pro
|
|
|
89
89
|
<BarComponent disableInternalStore />
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
+
## Enable search and AI assistant
|
|
93
|
+
|
|
94
|
+
Search and AI assistant is now proposed by the cozy-bar. To enable it, you need to :
|
|
95
|
+
|
|
96
|
+
1. Add the data proxy in your app
|
|
97
|
+
|
|
98
|
+
- cozy-dataproxy-lib must be installed in your app
|
|
99
|
+
- DataProxyProvider must be added before BarProvider in your app
|
|
100
|
+
|
|
101
|
+
2. Enable the search
|
|
102
|
+
|
|
103
|
+
```jsx
|
|
104
|
+
`<BarComponent searchOptions={{ enabled: true }} />`
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
3. Add the routes
|
|
108
|
+
|
|
109
|
+
These routes allow to display the AI assistant.
|
|
110
|
+
|
|
111
|
+
```jsx
|
|
112
|
+
import { BarRoutes } from 'cozy-bar'
|
|
113
|
+
|
|
114
|
+
<Routes>
|
|
115
|
+
// Your routes
|
|
116
|
+
// ...
|
|
117
|
+
|
|
118
|
+
{...BarRoutes}
|
|
119
|
+
</Routes>
|
|
120
|
+
```
|
|
121
|
+
|
|
92
122
|
## Change theme bar
|
|
93
123
|
|
|
94
124
|
It's possible to update theme on the cozy-bar with `setTheme` function using the bar context
|
package/dist/components/Bar.js
CHANGED
|
@@ -43,6 +43,8 @@ var _useI18n2 = _interopRequireDefault(require("./useI18n"));
|
|
|
43
43
|
|
|
44
44
|
var _cozyClient = require("cozy-client");
|
|
45
45
|
|
|
46
|
+
var _cozySearch = require("cozy-search");
|
|
47
|
+
|
|
46
48
|
/* Generated with node_modules/.bin/svgr src/assets/sprites/icon-apps.svg */
|
|
47
49
|
function SvgIconApps(props) {
|
|
48
50
|
return /*#__PURE__*/_react.default.createElement("svg", (0, _extends2.default)({
|
|
@@ -66,6 +68,7 @@ var Bar = function Bar(_ref) {
|
|
|
66
68
|
barSearch = _ref.barSearch,
|
|
67
69
|
onLogOut = _ref.onLogOut,
|
|
68
70
|
userActionRequired = _ref.userActionRequired,
|
|
71
|
+
searchOptions = _ref.searchOptions,
|
|
69
72
|
isInvertedTheme = _ref.isInvertedTheme,
|
|
70
73
|
appName = _ref.appName,
|
|
71
74
|
appNamePrefix = _ref.appNamePrefix,
|
|
@@ -159,6 +162,18 @@ var Bar = function Bar(_ref) {
|
|
|
159
162
|
}) : null;
|
|
160
163
|
};
|
|
161
164
|
|
|
165
|
+
var renderSearch = function renderSearch() {
|
|
166
|
+
return searchOptions.enabled && !isMobile ? /*#__PURE__*/_react.default.createElement("div", {
|
|
167
|
+
className: "u-flex-grow u-mh-2"
|
|
168
|
+
}, /*#__PURE__*/_react.default.createElement(_cozySearch.AssistantDesktop, {
|
|
169
|
+
componentsProps: {
|
|
170
|
+
SearchBarDesktop: {
|
|
171
|
+
size: 'small'
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
})) : null;
|
|
175
|
+
};
|
|
176
|
+
|
|
162
177
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
163
178
|
className: "coz-bar-wrapper",
|
|
164
179
|
"data-testid": "coz-bar-wrapper"
|
|
@@ -168,7 +183,7 @@ var Bar = function Bar(_ref) {
|
|
|
168
183
|
className: "coz-bar-container"
|
|
169
184
|
}, barLeft || renderLeft(), barCenter || renderCenter(), /*#__PURE__*/_react.default.createElement("div", {
|
|
170
185
|
className: "u-flex-grow"
|
|
171
|
-
}, barSearch), barRight || renderRight(), showDrawerAndBurger ? /*#__PURE__*/_react.default.createElement(_Drawer.default, {
|
|
186
|
+
}, barSearch || renderSearch()), barRight || renderRight(), showDrawerAndBurger ? /*#__PURE__*/_react.default.createElement(_Drawer.default, {
|
|
172
187
|
visible: drawerVisible,
|
|
173
188
|
onClose: toggleDrawer,
|
|
174
189
|
drawerListener: function drawerListener() {
|
|
@@ -102,7 +102,11 @@ var BarComponent = function BarComponent(_ref2) {
|
|
|
102
102
|
isPublic = _ref2$isPublic === void 0 ? false : _ref2$isPublic,
|
|
103
103
|
onLogOut = _ref2.onLogOut,
|
|
104
104
|
_ref2$disableInternal = _ref2.disableInternalStore,
|
|
105
|
-
disableInternalStore = _ref2$disableInternal === void 0 ? false : _ref2$disableInternal
|
|
105
|
+
disableInternalStore = _ref2$disableInternal === void 0 ? false : _ref2$disableInternal,
|
|
106
|
+
_ref2$searchOptions = _ref2.searchOptions,
|
|
107
|
+
searchOptions = _ref2$searchOptions === void 0 ? {
|
|
108
|
+
enabled: false
|
|
109
|
+
} : _ref2$searchOptions;
|
|
106
110
|
var barContext = (0, _BarProvider.useBarContext)();
|
|
107
111
|
|
|
108
112
|
var _ref3 = barContext || {},
|
|
@@ -154,6 +158,7 @@ var BarComponent = function BarComponent(_ref2) {
|
|
|
154
158
|
isPublic: isPublicForce || isPublic,
|
|
155
159
|
onLogOut: onLogOut,
|
|
156
160
|
userActionRequired: (0, _dom.getUserActionRequired)(),
|
|
161
|
+
searchOptions: searchOptions,
|
|
157
162
|
onDrawer: function onDrawer(visible) {
|
|
158
163
|
wrapperElement.dataset.visible = visible;
|
|
159
164
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.BarRoutes = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _cozyClient = require("cozy-client");
|
|
13
|
+
|
|
14
|
+
var _cozySearch = require("cozy-search");
|
|
15
|
+
|
|
16
|
+
var _reactRouterDom = require("react-router-dom");
|
|
17
|
+
|
|
18
|
+
var BarRoutes = [/*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
19
|
+
key: "assistant/:conversationId",
|
|
20
|
+
path: "assistant/:conversationId",
|
|
21
|
+
element: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_cozyClient.RealTimeQueries, {
|
|
22
|
+
doctype: "io.cozy.ai.chat.conversations"
|
|
23
|
+
}), /*#__PURE__*/_react.default.createElement(_cozySearch.AssistantDialog, null))
|
|
24
|
+
})];
|
|
25
|
+
exports.BarRoutes = BarRoutes;
|
|
@@ -41,7 +41,7 @@ var SettingsContent = function SettingsContent(_ref) {
|
|
|
41
41
|
var _useI18n = (0, _useI18n2.default)(),
|
|
42
42
|
t = _useI18n.t;
|
|
43
43
|
|
|
44
|
-
var actions = (0, _Actions.makeActions)([_actions.profile, _actions.appearance, _actions.plans, _actions.storage,
|
|
44
|
+
var actions = (0, _Actions.makeActions)([_actions.profile, _actions.appearance, _actions.plans, _actions.storage, _Actions.divider, _actions.permissions, _actions.connectedDevices, _actions.connections, _Actions.divider, _actions.help, _actions.contact, _legalNotice.legalNotice, _termsOfService.termsOfService, _actions.logout], {
|
|
45
45
|
t: t,
|
|
46
46
|
instanceInfo: instanceInfo,
|
|
47
47
|
onLogOut: onLogOut
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,12 @@ Object.defineProperty(exports, "BarSearch", {
|
|
|
41
41
|
return _BarSearch.BarSearch;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
+
Object.defineProperty(exports, "BarRoutes", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function get() {
|
|
47
|
+
return _BarRoutes.BarRoutes;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
44
50
|
Object.defineProperty(exports, "BarProvider", {
|
|
45
51
|
enumerable: true,
|
|
46
52
|
get: function get() {
|
|
@@ -55,6 +61,8 @@ Object.defineProperty(exports, "barReducers", {
|
|
|
55
61
|
});
|
|
56
62
|
exports.version = void 0;
|
|
57
63
|
|
|
64
|
+
require("cozy-search/dist/stylesheet.css");
|
|
65
|
+
|
|
58
66
|
var _BarComponent = require("./components/BarComponent");
|
|
59
67
|
|
|
60
68
|
var _BarLeft = require("./components/BarLeft");
|
|
@@ -67,10 +75,12 @@ var _BarTheme = require("./components/BarTheme");
|
|
|
67
75
|
|
|
68
76
|
var _BarSearch = require("./components/BarSearch");
|
|
69
77
|
|
|
78
|
+
var _BarRoutes = require("./components/BarRoutes");
|
|
79
|
+
|
|
70
80
|
var _BarProvider = _interopRequireDefault(require("./components/BarProvider"));
|
|
71
81
|
|
|
72
82
|
var _reducers = require("./lib/reducers");
|
|
73
83
|
|
|
74
84
|
/* global __VERSION__ */
|
|
75
|
-
var version = "\"
|
|
85
|
+
var version = "\"17.0.0\"";
|
|
76
86
|
exports.version = version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-bar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0",
|
|
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/index.js",
|
|
6
6
|
"author": "Cozy Cloud <contact@cozycloud.cc> (https://cozy.io/)",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"prewatch": "npm-run-all clean",
|
|
26
26
|
"tx": "tx pull --all || true",
|
|
27
27
|
"test": "jest",
|
|
28
|
-
"travis-deploy-once": "travis-deploy-once",
|
|
29
28
|
"start": "yarn build --watch"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
@@ -43,6 +42,7 @@
|
|
|
43
42
|
"babel-plugin-transform-define": "^2.0.0",
|
|
44
43
|
"babel-preset-cozy-app": "^1.9.0",
|
|
45
44
|
"cozy-client": "^51.1.0",
|
|
45
|
+
"cozy-dataproxy-lib": "^4.1.0",
|
|
46
46
|
"cozy-device-helper": "2.6.0",
|
|
47
47
|
"cozy-flags": "^4.6.1",
|
|
48
48
|
"cozy-intent": "^2.29.1",
|
|
@@ -56,10 +56,12 @@
|
|
|
56
56
|
"npm-run-all": "4.1.5",
|
|
57
57
|
"react": "16.10.1",
|
|
58
58
|
"react-dom": "16.10.1",
|
|
59
|
+
"react-router-dom": "6.14.2",
|
|
59
60
|
"semantic-release": "15.13.24",
|
|
60
61
|
"stylus": "0.57.0"
|
|
61
62
|
},
|
|
62
63
|
"dependencies": {
|
|
64
|
+
"cozy-search": "0.1.0",
|
|
63
65
|
"hammerjs": "2.0.8",
|
|
64
66
|
"lodash.debounce": "4.0.8",
|
|
65
67
|
"lodash.set": "^4.3.2",
|
|
@@ -74,6 +76,7 @@
|
|
|
74
76
|
"peerDependencies": {
|
|
75
77
|
"@cozy/minilog": ">=1.0.0",
|
|
76
78
|
"cozy-client": ">=51.1.0",
|
|
79
|
+
"cozy-dataproxy-lib": ">=4.1.0",
|
|
77
80
|
"cozy-device-helper": ">=2.6.0",
|
|
78
81
|
"cozy-flags": ">=4.6.1",
|
|
79
82
|
"cozy-intent": ">=2.29.1",
|
|
@@ -81,6 +84,7 @@
|
|
|
81
84
|
"cozy-realtime": ">=4.0.5",
|
|
82
85
|
"cozy-ui": ">=111.12.0",
|
|
83
86
|
"react": ">=16.10.1",
|
|
84
|
-
"react-dom": ">=16.10.1"
|
|
87
|
+
"react-dom": ">=16.10.1",
|
|
88
|
+
"react-router-dom": ">=6.14.2"
|
|
85
89
|
}
|
|
86
90
|
}
|