@dotcms/react 1.2.0 → 1.2.1-next.2

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": "@dotcms/react",
3
- "version": "1.2.0",
3
+ "version": "1.2.1-next.2",
4
4
  "peerDependencies": {
5
5
  "react": ">=18",
6
6
  "react-dom": ">=18"
@@ -31,7 +31,7 @@
31
31
  "./package.json": "./package.json",
32
32
  ".": {
33
33
  "import": "./index.esm.js",
34
- "types": "./index.esm.d.ts"
34
+ "types": "./index.d.ts"
35
35
  }
36
36
  },
37
37
  "typesVersions": {
@@ -50,5 +50,5 @@
50
50
  "module": "./index.esm.js",
51
51
  "type": "module",
52
52
  "main": "./index.esm.js",
53
- "types": "./index.esm.d.ts"
54
- }
53
+ "types": "./index.d.ts"
54
+ }
package/src/index.d.ts CHANGED
@@ -5,3 +5,6 @@ export { useEditableDotCMSPage } from './lib/next/hooks/useEditableDotCMSPage';
5
5
  export { DotCMSEditableText } from './lib/next/components/DotCMSEditableText/DotCMSEditableText';
6
6
  export { DotCMSBlockEditorRenderer, BlockEditorRendererProps, CustomRenderer, CustomRendererProps } from './lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer';
7
7
  export { DotCMSLayoutBodyProps } from './lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody';
8
+ export { useAISearch } from './lib/next/hooks/useAISearch';
9
+ export { useStyleEditorSchemas } from './lib/next/hooks/useStyleEditorSchemas';
10
+ export type { DotCMSAISearchValue, DotCMSAISearchProps } from './lib/next/shared/types';
@@ -0,0 +1,30 @@
1
+ import { DotCMSBasicContentlet } from '@dotcms/types';
2
+ import { DotCMSAISearchProps, DotCMSAISearchValue } from '../shared/types';
3
+ /**
4
+ * Hook to search for contentlets using AI.
5
+ * @template T - The type of the contentlet.
6
+ * @param client - The client to use for the search.
7
+ * @param indexName - The name of the index to search in.
8
+ * @param params - The parameters for the search.
9
+ * @returns The search results.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const { results, status, search, reset } = useAISearch<BlogPost>({
14
+ * client: dotCMSClient,
15
+ * indexName: 'blog-search-index',
16
+ * params: {
17
+ * query: {
18
+ * limit: 10,
19
+ * offset: 0,
20
+ * contentType: 'Blog'
21
+ * },
22
+ * config: {
23
+ * threshold: 0.5,
24
+ * responseLength: 1024
25
+ * }
26
+ * }
27
+ * });
28
+ * ```
29
+ */
30
+ export declare const useAISearch: <T extends DotCMSBasicContentlet>({ client, indexName, params }: DotCMSAISearchProps) => DotCMSAISearchValue<T>;
@@ -0,0 +1,7 @@
1
+ import { StyleEditorFormSchema } from '@dotcms/uve';
2
+ /**
3
+ * Hook to register style editor forms with the UVE editor.
4
+ * @param forms - Array of style editor form schemas to register
5
+ * @returns void
6
+ */
7
+ export declare const useStyleEditorSchemas: (styleEditorForms: StyleEditorFormSchema[]) => void;
@@ -0,0 +1,24 @@
1
+ import { createDotCMSClient } from '@dotcms/client';
2
+ import { DotCMSAISearchContentletData, DotCMSAISearchParams, DotCMSAISearchResponse, DotCMSBasicContentlet, DotCMSEntityStatus } from '@dotcms/types';
3
+ /**
4
+ * Return type of the AI Search context
5
+ * @interface DotCMSAISearchContextValue
6
+ * @template T - The content type extending DotCMSBasicContentlet
7
+ */
8
+ export interface DotCMSAISearchValue<T extends DotCMSBasicContentlet> {
9
+ response: DotCMSAISearchResponse<T> | null;
10
+ results: DotCMSAISearchContentletData<T>[];
11
+ status: DotCMSEntityStatus;
12
+ search: (prompt: string) => Promise<void>;
13
+ reset: () => void;
14
+ }
15
+ /**
16
+ * Props for the DotCMSAISearchProvider
17
+ * @interface DotCMSAISearchProviderProps
18
+ * @template T - The content type extending DotCMSBasicContentlet
19
+ */
20
+ export interface DotCMSAISearchProps {
21
+ client: ReturnType<typeof createDotCMSClient>;
22
+ indexName: string;
23
+ params: DotCMSAISearchParams;
24
+ }
File without changes