cozy-search 0.24.0 → 0.25.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.
@@ -0,0 +1,2 @@
1
+ export default SvgAiText;
2
+ declare function SvgAiText(props: any): JSX.Element;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ // Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/illus/ai-text.svg` to regenerate;
15
+ function SvgAiText(props) {
16
+ return /*#__PURE__*/_react.default.createElement("svg", (0, _extends2.default)({
17
+ viewBox: "0 0 27 22",
18
+ fill: "none"
19
+ }, props), /*#__PURE__*/_react.default.createElement("path", {
20
+ d: "M4.169 21.561h-4.17L7.592 0h4.821l7.602 21.561h-4.17l-5.758-17.14h-.169L4.17 21.562zm.137-8.454h11.37v3.138H4.306v-3.138zM26.759 0v21.561h-3.905V0h3.905z",
21
+ fill: "#97A3B7"
22
+ }));
23
+ }
24
+
25
+ var _default = SvgAiText;
26
+ exports.default = _default;
@@ -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]) || location.pathname).replace(/\/$/, '');
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/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { default as AssistantMobile } from './components/AssistantMobile';
4
4
  export { default as AssistantDialog } from './components/Views/AssistantDialog';
5
5
  export { default as CreateAssistantDialog } from './components/Views/CreateAssistantDialog';
6
6
  export { default as SearchDialog } from './components/Views/SearchDialog';
7
+ export { default as AiText } from './components/Icons/AiText';
7
8
  export { default as CozyAssistantRuntimeProvider } from './components/CozyAssistantRuntimeProvider';
8
9
  export { default as CozyComposer } from './components/Conversations/ConversationComposer';
9
10
  export { StreamBridge, createCozyRealtimeChatAdapter } from './components/adapters';
package/dist/index.js CHANGED
@@ -5,6 +5,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ Object.defineProperty(exports, "AiText", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _AiText.default;
12
+ }
13
+ });
8
14
  Object.defineProperty(exports, "AssistantDesktop", {
9
15
  enumerable: true,
10
16
  get: function get() {
@@ -84,6 +90,8 @@ var _CreateAssistantDialog = _interopRequireDefault(require("./components/Views/
84
90
 
85
91
  var _SearchDialog = _interopRequireDefault(require("./components/Views/SearchDialog"));
86
92
 
93
+ var _AiText = _interopRequireDefault(require("./components/Icons/AiText"));
94
+
87
95
  var _CozyAssistantRuntimeProvider = _interopRequireDefault(require("./components/CozyAssistantRuntimeProvider"));
88
96
 
89
97
  var _ConversationComposer = _interopRequireDefault(require("./components/Conversations/ConversationComposer"));
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.24.0",
4
+ "version": "0.25.0",
5
5
  "author": {
6
6
  "name": "Cozy Cloud",
7
7
  "url": "https://github.com/cozy"
@@ -92,5 +92,5 @@
92
92
  "lint": "cd .. && yarn eslint --ext js,jsx,ts packages/cozy-search"
93
93
  },
94
94
  "types": "dist/index.d.ts",
95
- "gitHead": "9655a128354d92bbb108ed6ec830704dd158d48a"
95
+ "gitHead": "81982c618611479a12815c23e534780a8d7f1906"
96
96
  }