cozy-search 0.23.4 → 0.24.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.
|
@@ -13,7 +13,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _Box = _interopRequireDefault(require("cozy-ui/transpiled/react/Box"));
|
|
17
17
|
|
|
18
18
|
var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
|
|
19
19
|
|
|
@@ -121,8 +121,13 @@ var ApiKeyStep = function ApiKeyStep(_ref) {
|
|
|
121
121
|
icon: _Eye.default
|
|
122
122
|
}))
|
|
123
123
|
}
|
|
124
|
-
})), /*#__PURE__*/_react.default.createElement(
|
|
125
|
-
|
|
124
|
+
})), /*#__PURE__*/_react.default.createElement(_Box.default, {
|
|
125
|
+
display: "block",
|
|
126
|
+
border: 1,
|
|
127
|
+
borderColor: "var(--dividerColor)",
|
|
128
|
+
borderRadius: 8,
|
|
129
|
+
padding: 2,
|
|
130
|
+
className: (0, _classnames.default)({
|
|
126
131
|
'u-bg-primaryBackgroundLight': theme === 'light',
|
|
127
132
|
'u-bg-coolGrey': theme === 'dark'
|
|
128
133
|
})
|
|
@@ -13,7 +13,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
|
|
14
14
|
var _react2 = _interopRequireDefault(require("react"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _Box = _interopRequireDefault(require("cozy-ui/transpiled/react/Box"));
|
|
17
17
|
|
|
18
18
|
var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
|
|
19
19
|
|
|
@@ -31,8 +31,12 @@ var UserMessage = function UserMessage() {
|
|
|
31
31
|
|
|
32
32
|
return /*#__PURE__*/_react2.default.createElement(_react.MessagePrimitive.Root, {
|
|
33
33
|
className: "u-mt-1"
|
|
34
|
-
}, /*#__PURE__*/_react2.default.createElement(
|
|
35
|
-
|
|
34
|
+
}, /*#__PURE__*/_react2.default.createElement(_Box.default, {
|
|
35
|
+
display: "block",
|
|
36
|
+
border: 0,
|
|
37
|
+
borderRadius: 10,
|
|
38
|
+
padding: 0.5,
|
|
39
|
+
className: (0, _classnames.default)('u-ml-auto', styles['cozyThread-user-messages'], styles["cozyThread-user-messages--".concat(theme)])
|
|
36
40
|
}, /*#__PURE__*/_react2.default.createElement(_react.MessagePrimitive.Parts, {
|
|
37
41
|
components: {
|
|
38
42
|
Text: function Text(_ref) {
|
|
@@ -19,9 +19,11 @@ var useConversation = function useConversation() {
|
|
|
19
19
|
setIsOpenSearchConversation = _useAssistant.setIsOpenSearchConversation;
|
|
20
20
|
|
|
21
21
|
var goToConversation = function goToConversation(conversationId) {
|
|
22
|
+
var _match$;
|
|
23
|
+
|
|
22
24
|
// Extract base path safely by identifying the start of '/assistant' if it exists.
|
|
23
25
|
var match = location.pathname.match(/^(.*?)(\/assistant(\/|$).*|$)/);
|
|
24
|
-
var basePath = ((match === null || match === void 0 ? void 0 : match[1])
|
|
26
|
+
var basePath = ((_match$ = match === null || match === void 0 ? void 0 : match[1]) !== null && _match$ !== void 0 ? _match$ : location.pathname).replace(/\/$/, '');
|
|
25
27
|
var newPathname = "".concat(basePath, "/assistant/").concat(conversationId);
|
|
26
28
|
setIsOpenSearchConversation(false);
|
|
27
29
|
navigate({
|
|
@@ -66,6 +66,18 @@ describe('useConversation', () => {
|
|
|
66
66
|
hash: ''
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
|
+
it('navigates correctly when assistant route is at the root', () => {
|
|
70
|
+
mockLocation.pathname = '/assistant/old-convo-123';
|
|
71
|
+
const { result } = renderHook(() => useConversation());
|
|
72
|
+
act(() => {
|
|
73
|
+
result.current.goToConversation('new-convo-456');
|
|
74
|
+
});
|
|
75
|
+
expect(mockNavigate).toHaveBeenCalledWith({
|
|
76
|
+
pathname: '/assistant/new-convo-456',
|
|
77
|
+
search: '',
|
|
78
|
+
hash: ''
|
|
79
|
+
});
|
|
80
|
+
});
|
|
69
81
|
it('preserves search query and hash fragments', () => {
|
|
70
82
|
mockLocation = {
|
|
71
83
|
pathname: '/base',
|
|
@@ -82,6 +82,21 @@ describe('useConversation', () => {
|
|
|
82
82
|
})
|
|
83
83
|
})
|
|
84
84
|
|
|
85
|
+
it('navigates correctly when assistant route is at the root', () => {
|
|
86
|
+
mockLocation.pathname = '/assistant/old-convo-123'
|
|
87
|
+
const { result } = renderHook(() => useConversation())
|
|
88
|
+
|
|
89
|
+
act(() => {
|
|
90
|
+
result.current.goToConversation('new-convo-456')
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
expect(mockNavigate).toHaveBeenCalledWith({
|
|
94
|
+
pathname: '/assistant/new-convo-456',
|
|
95
|
+
search: '',
|
|
96
|
+
hash: ''
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
|
|
85
100
|
it('preserves search query and hash fragments', () => {
|
|
86
101
|
mockLocation = {
|
|
87
102
|
pathname: '/base',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-search",
|
|
3
3
|
"description": "UI components about search bar and IA assistant",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.24.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Cozy Cloud",
|
|
7
7
|
"url": "https://github.com/cozy"
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"babel-plugin-module-resolver": "^4.0.0",
|
|
27
27
|
"babel-plugin-tsconfig-paths": "^1.0.3",
|
|
28
28
|
"babel-preset-cozy-app": "^2.8.4",
|
|
29
|
-
"cozy-bar": "^29.0.0",
|
|
30
29
|
"cozy-client": "60.23.0",
|
|
31
30
|
"cozy-device-helper": "^4.0.3",
|
|
32
31
|
"cozy-flags": "^4.9.1",
|
|
@@ -35,7 +34,7 @@
|
|
|
35
34
|
"cozy-minilog": "^3.10.1",
|
|
36
35
|
"cozy-pouch-link": "^54.0.0",
|
|
37
36
|
"cozy-realtime": "^5.9.1",
|
|
38
|
-
"cozy-ui": "^
|
|
37
|
+
"cozy-ui": "^138.1.0",
|
|
39
38
|
"cozy-ui-plus": "^6.0.0",
|
|
40
39
|
"cross-fetch": "^4.0.0",
|
|
41
40
|
"jest": "30.3.0",
|
|
@@ -61,7 +60,6 @@
|
|
|
61
60
|
"./dist/stylesheet.css": "./dist/stylesheet.css"
|
|
62
61
|
},
|
|
63
62
|
"peerDependencies": {
|
|
64
|
-
"cozy-bar": ">=29.0.0",
|
|
65
63
|
"cozy-client": ">=60.21.0",
|
|
66
64
|
"cozy-device-helper": ">=3.7.1",
|
|
67
65
|
"cozy-flags": ">=4.6.1",
|
|
@@ -70,8 +68,8 @@
|
|
|
70
68
|
"cozy-minilog": ">=3.3.1",
|
|
71
69
|
"cozy-pouch-link": "54.0.0",
|
|
72
70
|
"cozy-realtime": ">=5.6.4",
|
|
73
|
-
"cozy-ui": ">=
|
|
74
|
-
"cozy-ui-plus": ">=
|
|
71
|
+
"cozy-ui": ">=138.1.0",
|
|
72
|
+
"cozy-ui-plus": ">=6.0.0",
|
|
75
73
|
"react": ">=18.0.0",
|
|
76
74
|
"react-dom": ">=18.0.0",
|
|
77
75
|
"react-router-dom": "^6.28.0",
|
|
@@ -94,5 +92,5 @@
|
|
|
94
92
|
"lint": "cd .. && yarn eslint --ext js,jsx,ts packages/cozy-search"
|
|
95
93
|
},
|
|
96
94
|
"types": "dist/index.d.ts",
|
|
97
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "a0c69ea92558eebaef06da8fd0d2593213adce76"
|
|
98
96
|
}
|