@alpaca-editor/core 1.0.4014 → 1.0.4017
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/dist/components/ui/calendar.js +2 -6
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/card.d.ts +2 -1
- package/dist/components/ui/card.js +2 -2
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/copy-button.js +31 -3
- package/dist/components/ui/copy-button.js.map +1 -1
- package/dist/components/ui/popover.js +6 -3
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/config/config.js +20 -13
- package/dist/config/config.js.map +1 -1
- package/dist/editor/FieldList.js +1 -1
- package/dist/editor/FieldList.js.map +1 -1
- package/dist/editor/FieldListField.js +1 -1
- package/dist/editor/FieldListField.js.map +1 -1
- package/dist/editor/ScrollingContentTree.d.ts +2 -1
- package/dist/editor/ScrollingContentTree.js +2 -2
- package/dist/editor/ScrollingContentTree.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +1 -0
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/itemsRepository.d.ts +2 -2
- package/dist/editor/client/itemsRepository.js +15 -5
- package/dist/editor/client/itemsRepository.js.map +1 -1
- package/dist/editor/client/operations.js +18 -6
- package/dist/editor/client/operations.js.map +1 -1
- package/dist/editor/client/pageModelBuilder.js +2 -1
- package/dist/editor/client/pageModelBuilder.js.map +1 -1
- package/dist/editor/context-menu/InsertMenu.js +45 -12
- package/dist/editor/context-menu/InsertMenu.js.map +1 -1
- package/dist/editor/field-types/DateFieldEditor.js +1 -1
- package/dist/editor/field-types/DateFieldEditor.js.map +1 -1
- package/dist/editor/field-types/DateTimeFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/DateTimeFieldEditor.js +151 -0
- package/dist/editor/field-types/DateTimeFieldEditor.js.map +1 -0
- package/dist/editor/field-types/InternalLinkFieldEditor.js +1 -1
- package/dist/editor/field-types/InternalLinkFieldEditor.js.map +1 -1
- package/dist/editor/field-types/TreeListEditor.js +17 -6
- package/dist/editor/field-types/TreeListEditor.js.map +1 -1
- package/dist/editor/fieldTypes.d.ts +6 -0
- package/dist/editor/menubar/ToolbarFactory.js +1 -1
- package/dist/editor/menubar/ToolbarFactory.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/EditControls.d.ts +7 -1
- package/dist/editor/menubar/toolbar-sections/EditControls.js +2 -2
- package/dist/editor/menubar/toolbar-sections/EditControls.js.map +1 -1
- package/dist/editor/page-viewer/EditorForm.js +3 -1
- package/dist/editor/page-viewer/EditorForm.js.map +1 -1
- package/dist/editor/page-viewer/PageViewer.d.ts +2 -1
- package/dist/editor/page-viewer/PageViewer.js +7 -5
- package/dist/editor/page-viewer/PageViewer.js.map +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.d.ts +2 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +3 -2
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/sidebar/ComponentPalette.js +28 -1
- package/dist/editor/sidebar/ComponentPalette.js.map +1 -1
- package/dist/editor/sidebar/Debug.js +13 -3
- package/dist/editor/sidebar/Debug.js.map +1 -1
- package/dist/editor/ui/ItemSearch.d.ts +1 -0
- package/dist/editor/ui/ItemSearch.js +5 -5
- package/dist/editor/ui/ItemSearch.js.map +1 -1
- package/dist/editor/ui/SimpleTabs.d.ts +2 -1
- package/dist/editor/ui/SimpleTabs.js +8 -7
- package/dist/editor/ui/SimpleTabs.js.map +1 -1
- package/dist/editor/ui/Spinner.d.ts +1 -1
- package/dist/page-wizard/WizardSteps.js +5 -4
- package/dist/page-wizard/WizardSteps.js.map +1 -1
- package/dist/page-wizard/steps/CollectStep.js +1 -1
- package/dist/page-wizard/steps/CollectStep.js.map +1 -1
- package/dist/page-wizard/steps/ContentStep.js +4 -3
- package/dist/page-wizard/steps/ContentStep.js.map +1 -1
- package/dist/page-wizard/steps/FindItemsStep.js +2 -13
- package/dist/page-wizard/steps/FindItemsStep.js.map +1 -1
- package/dist/page-wizard/steps/usePageCreator.js +2 -4
- package/dist/page-wizard/steps/usePageCreator.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/styles.css +357 -60
- package/package.json +1 -1
- package/src/components/ui/calendar.tsx +2 -18
- package/src/components/ui/card.tsx +5 -0
- package/src/components/ui/copy-button.tsx +32 -3
- package/src/components/ui/popover.tsx +6 -3
- package/src/config/config.tsx +21 -14
- package/src/editor/FieldList.tsx +1 -1
- package/src/editor/FieldListField.tsx +1 -1
- package/src/editor/ScrollingContentTree.tsx +3 -0
- package/src/editor/client/editContext.ts +1 -0
- package/src/editor/client/itemsRepository.ts +25 -7
- package/src/editor/client/operations.ts +19 -5
- package/src/editor/client/pageModelBuilder.ts +1 -1
- package/src/editor/context-menu/InsertMenu.tsx +77 -30
- package/src/editor/field-types/DateFieldEditor.tsx +8 -2
- package/src/editor/field-types/DateTimeFieldEditor.tsx +281 -0
- package/src/editor/field-types/InternalLinkFieldEditor.tsx +1 -1
- package/src/editor/field-types/TreeListEditor.tsx +41 -8
- package/src/editor/fieldTypes.ts +8 -0
- package/src/editor/menubar/ToolbarFactory.tsx +2 -1
- package/src/editor/menubar/toolbar-sections/EditControls.tsx +37 -23
- package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +1 -1
- package/src/editor/page-viewer/EditorForm.tsx +3 -1
- package/src/editor/page-viewer/PageViewer.tsx +18 -15
- package/src/editor/page-viewer/PageViewerFrame.tsx +11 -2
- package/src/editor/sidebar/ComponentPalette.tsx +36 -1
- package/src/editor/sidebar/Debug.tsx +14 -6
- package/src/editor/ui/ItemSearch.tsx +6 -3
- package/src/editor/ui/SimpleTabs.tsx +10 -1
- package/src/editor/ui/Spinner.tsx +1 -1
- package/src/page-wizard/WizardSteps.tsx +2 -3
- package/src/page-wizard/steps/CollectStep.tsx +1 -1
- package/src/page-wizard/steps/ContentStep.tsx +18 -12
- package/src/page-wizard/steps/FindItemsStep.tsx +1 -50
- package/src/page-wizard/steps/usePageCreator.ts +2 -3
- package/src/revision.ts +2 -2
- package/styles.css +1 -0
|
@@ -7,7 +7,7 @@ import { InsertOption } from "../../types";
|
|
|
7
7
|
|
|
8
8
|
import { useEditContext } from "../client/editContext";
|
|
9
9
|
import { FilterInput, highlightMatch } from "../../components/FilterInput";
|
|
10
|
-
import { useState, useRef } from "react";
|
|
10
|
+
import { useState, useRef, useEffect } from "react";
|
|
11
11
|
|
|
12
12
|
export function ComponentPalette({}: {}) {
|
|
13
13
|
const editContext = useEditContext()!;
|
|
@@ -16,6 +16,41 @@ export function ComponentPalette({}: {}) {
|
|
|
16
16
|
|
|
17
17
|
const insertOptions = getInsertOptionsForCurrentSelection(editContext);
|
|
18
18
|
|
|
19
|
+
// Auto-focus filter input when typing
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
function handleKeyDown(event: KeyboardEvent) {
|
|
22
|
+
// Only handle if the filter input is not already focused
|
|
23
|
+
if (document.activeElement === filterRef.current) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Only handle printable characters (not special keys like arrows, escape, etc.)
|
|
28
|
+
if (
|
|
29
|
+
event.key.length === 1 &&
|
|
30
|
+
!event.ctrlKey &&
|
|
31
|
+
!event.metaKey &&
|
|
32
|
+
!event.altKey
|
|
33
|
+
) {
|
|
34
|
+
// Focus the filter input
|
|
35
|
+
filterRef.current?.focus();
|
|
36
|
+
|
|
37
|
+
// Clear current filter and set to the typed character
|
|
38
|
+
setFilter(event.key);
|
|
39
|
+
|
|
40
|
+
// Prevent the default action to avoid any other handlers
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Add event listener to the document
|
|
46
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
47
|
+
|
|
48
|
+
// Cleanup
|
|
49
|
+
return () => {
|
|
50
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
51
|
+
};
|
|
52
|
+
}, []);
|
|
53
|
+
|
|
19
54
|
const insertOptionsByGroup = insertOptions.reduce(
|
|
20
55
|
(acc, value) => {
|
|
21
56
|
const group = value.group || "Other";
|
|
@@ -7,6 +7,7 @@ import { getComponentByIdFromHeadlessLayout } from "../componentTreeHelper";
|
|
|
7
7
|
import { ObjectInspector, ObjectLabel, ObjectRootLabel } from "react-inspector";
|
|
8
8
|
import { Component } from "../pageModel";
|
|
9
9
|
import { useEditContext } from "../client/editContext";
|
|
10
|
+
import { usePageViewContext } from "../page-viewer/pageViewContext";
|
|
10
11
|
|
|
11
12
|
import { getPageJson } from "../services/contentService";
|
|
12
13
|
|
|
@@ -17,20 +18,27 @@ export function Debug({}: {}) {
|
|
|
17
18
|
const editContext = useEditContext();
|
|
18
19
|
if (!editContext) return;
|
|
19
20
|
|
|
21
|
+
const pageViewContext = usePageViewContext({
|
|
22
|
+
pageItemDescriptor: editContext.contentEditorItem?.descriptor,
|
|
23
|
+
itemsRepository: editContext.itemsRepository,
|
|
24
|
+
configuration: editContext.configuration,
|
|
25
|
+
});
|
|
26
|
+
|
|
20
27
|
useEffect(() => {
|
|
21
28
|
const loadLayout = async () => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
!editContext.contentEditorItem.hasLayout
|
|
25
|
-
)
|
|
26
|
-
return;
|
|
29
|
+
// Only load layout for headless page items
|
|
30
|
+
if (!editContext.contentEditorItem || !pageViewContext.isHeadless) return;
|
|
27
31
|
const layout = await getPageJson(
|
|
28
32
|
editContext.contentEditorItem.descriptor,
|
|
29
33
|
);
|
|
30
34
|
setPageLayout(layout);
|
|
31
35
|
};
|
|
32
36
|
loadLayout();
|
|
33
|
-
}, [
|
|
37
|
+
}, [
|
|
38
|
+
editContext.contentEditorItem,
|
|
39
|
+
editContext.itemsRepository.revision,
|
|
40
|
+
pageViewContext.isHeadless,
|
|
41
|
+
]);
|
|
34
42
|
|
|
35
43
|
const page = pageLayout; // editContext.page;
|
|
36
44
|
let component = null;
|
|
@@ -27,6 +27,7 @@ interface SearchProps {
|
|
|
27
27
|
language?: string;
|
|
28
28
|
resultClassName?: string;
|
|
29
29
|
autoFocus?: boolean;
|
|
30
|
+
disabled?: boolean;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export const ItemSearch: React.FC<SearchProps> = ({
|
|
@@ -36,6 +37,7 @@ export const ItemSearch: React.FC<SearchProps> = ({
|
|
|
36
37
|
language,
|
|
37
38
|
resultClassName,
|
|
38
39
|
autoFocus = false,
|
|
40
|
+
disabled = false,
|
|
39
41
|
}) => {
|
|
40
42
|
const [query, setQuery] = useState("");
|
|
41
43
|
const [results, setResults] = useState<ResultItem[]>([]);
|
|
@@ -44,7 +46,7 @@ export const ItemSearch: React.FC<SearchProps> = ({
|
|
|
44
46
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
45
47
|
|
|
46
48
|
const handleSearch = useDebouncedCallback(async (searchPrompt: string) => {
|
|
47
|
-
if (!editContext) return;
|
|
49
|
+
if (!editContext || disabled) return;
|
|
48
50
|
|
|
49
51
|
setLoading(true);
|
|
50
52
|
const currentQuery = searchPrompt;
|
|
@@ -97,13 +99,13 @@ export const ItemSearch: React.FC<SearchProps> = ({
|
|
|
97
99
|
}, 600);
|
|
98
100
|
|
|
99
101
|
useEffect(() => {
|
|
100
|
-
if (query) {
|
|
102
|
+
if (query && !disabled) {
|
|
101
103
|
setLoading(true);
|
|
102
104
|
handleSearch(query);
|
|
103
105
|
} else {
|
|
104
106
|
setResults([]);
|
|
105
107
|
}
|
|
106
|
-
}, [query]);
|
|
108
|
+
}, [query, disabled]);
|
|
107
109
|
|
|
108
110
|
useEffect(() => {
|
|
109
111
|
if (inputRef.current && autoFocus) {
|
|
@@ -122,6 +124,7 @@ export const ItemSearch: React.FC<SearchProps> = ({
|
|
|
122
124
|
autoFocus={autoFocus}
|
|
123
125
|
placeholder="Search..."
|
|
124
126
|
loading={loading}
|
|
127
|
+
disabled={disabled}
|
|
125
128
|
/>
|
|
126
129
|
</div>
|
|
127
130
|
{results.length > 0 && (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { twMerge } from "tailwind-merge";
|
|
2
|
+
import { Spinner } from "./Spinner";
|
|
2
3
|
|
|
3
4
|
export type Tab = {
|
|
4
5
|
label: string;
|
|
@@ -14,12 +15,14 @@ export function SimpleTabs({
|
|
|
14
15
|
activeTab,
|
|
15
16
|
className,
|
|
16
17
|
tabClassName,
|
|
18
|
+
isLoading = false,
|
|
17
19
|
}: {
|
|
18
20
|
tabs: Tab[];
|
|
19
21
|
setActiveTab: (index: number) => void;
|
|
20
22
|
activeTab: number;
|
|
21
23
|
className?: string;
|
|
22
24
|
tabClassName?: string;
|
|
25
|
+
isLoading?: boolean;
|
|
23
26
|
}) {
|
|
24
27
|
if (activeTab > tabs.length - 1) {
|
|
25
28
|
activeTab = 0;
|
|
@@ -33,7 +36,7 @@ export function SimpleTabs({
|
|
|
33
36
|
|
|
34
37
|
return (
|
|
35
38
|
<>
|
|
36
|
-
<div className={twMerge("flex
|
|
39
|
+
<div className={twMerge("flex items-start gap-2", className)}>
|
|
37
40
|
{tabs.map((tab, index) => (
|
|
38
41
|
<button
|
|
39
42
|
id={tab.id}
|
|
@@ -56,7 +59,13 @@ export function SimpleTabs({
|
|
|
56
59
|
<span className="truncate">{tab.label}</span>
|
|
57
60
|
</button>
|
|
58
61
|
))}
|
|
62
|
+
{isLoading && (
|
|
63
|
+
<div className="flex items-center">
|
|
64
|
+
<Spinner size="md" />
|
|
65
|
+
</div>
|
|
66
|
+
)}
|
|
59
67
|
</div>
|
|
68
|
+
|
|
60
69
|
{tabs[activeTab]?.content}
|
|
61
70
|
</>
|
|
62
71
|
);
|
|
@@ -127,9 +127,8 @@ function NavigationSteps({
|
|
|
127
127
|
<div className="p-2.5 text-xs">
|
|
128
128
|
<div className="flex items-center gap-3 md:justify-center">
|
|
129
129
|
{wizard.steps.map((step, index) => (
|
|
130
|
-
|
|
130
|
+
<React.Fragment key={step.id}>
|
|
131
131
|
<div
|
|
132
|
-
key={step.id}
|
|
133
132
|
ref={(el) => {
|
|
134
133
|
stepRefs.current[index] = el;
|
|
135
134
|
}}
|
|
@@ -177,7 +176,7 @@ function NavigationSteps({
|
|
|
177
176
|
)}
|
|
178
177
|
/>
|
|
179
178
|
)}
|
|
180
|
-
|
|
179
|
+
</React.Fragment>
|
|
181
180
|
))}
|
|
182
181
|
</div>
|
|
183
182
|
</div>
|
|
@@ -164,7 +164,7 @@ export function CollectStep({
|
|
|
164
164
|
>
|
|
165
165
|
{error && <div className="mt-2 text-sm text-red-500">{error}</div>}
|
|
166
166
|
<div
|
|
167
|
-
className={`flex flex-col items-center justify-center border border-dashed
|
|
167
|
+
className={`border-theme-secondary flex flex-col items-center justify-center border border-dashed p-8 ${
|
|
168
168
|
isUploading ? "" : "bg-white"
|
|
169
169
|
}`}
|
|
170
170
|
onDrop={handleDrop}
|
|
@@ -27,6 +27,7 @@ import { useThrottledCallback } from "use-debounce";
|
|
|
27
27
|
import { InputTextarea } from "primereact/inputtextarea";
|
|
28
28
|
import { InputText } from "primereact/inputtext";
|
|
29
29
|
import { LanguageSelector } from "../../editor/menubar/LanguageSelector";
|
|
30
|
+
import { EditControls } from "../../editor/menubar/toolbar-sections/EditControls";
|
|
30
31
|
import { getFilteredInputData } from "../utils/dataAccessor";
|
|
31
32
|
|
|
32
33
|
import { WizardBox } from "../WizardBox";
|
|
@@ -188,7 +189,7 @@ export function ContentStep({
|
|
|
188
189
|
]);
|
|
189
190
|
|
|
190
191
|
useEffect(() => {
|
|
191
|
-
editContext?.setMode("
|
|
192
|
+
editContext?.setMode("preview");
|
|
192
193
|
if (!internalState.layoutInstructions) {
|
|
193
194
|
setInternalState({
|
|
194
195
|
...internalState,
|
|
@@ -670,9 +671,10 @@ export function ContentStep({
|
|
|
670
671
|
description="Configure the page name, target location and language for your new page"
|
|
671
672
|
collapsible="yes"
|
|
672
673
|
summary={
|
|
673
|
-
<div className="text-xs text-gray-500">
|
|
674
|
-
Folder: {fullParentItem?.path}
|
|
675
|
-
{
|
|
674
|
+
<div className="flex flex-col gap-2 text-xs break-all text-gray-500">
|
|
675
|
+
<div>Folder: {fullParentItem?.path}</div>
|
|
676
|
+
<div>Language: {language}</div>
|
|
677
|
+
<div>Name: {pageModel.name || "Not set"}</div>
|
|
676
678
|
</div>
|
|
677
679
|
}
|
|
678
680
|
className="w-full md:w-96"
|
|
@@ -680,7 +682,7 @@ export function ContentStep({
|
|
|
680
682
|
<div className="flex flex-col items-stretch">
|
|
681
683
|
<div className="relative flex-1">
|
|
682
684
|
{isGenerating ? (
|
|
683
|
-
<div className="flex h-full items-center justify-center pb-4">
|
|
685
|
+
<div className="mt-4 flex h-full items-center justify-center pb-4">
|
|
684
686
|
<Generate title="Generating page name..." size="medium" />
|
|
685
687
|
</div>
|
|
686
688
|
) : (
|
|
@@ -845,6 +847,7 @@ export function ContentStep({
|
|
|
845
847
|
noPadding={true}
|
|
846
848
|
className="flex-1"
|
|
847
849
|
showFullscreenButton={true}
|
|
850
|
+
headerActions={<EditControls hideSuggestions />}
|
|
848
851
|
>
|
|
849
852
|
<div
|
|
850
853
|
className={cn(
|
|
@@ -852,13 +855,16 @@ export function ContentStep({
|
|
|
852
855
|
pageLoaded ? "h-full" : "h-0",
|
|
853
856
|
)}
|
|
854
857
|
>
|
|
855
|
-
<
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
858
|
+
<div className="bg-gray-5 h-full">
|
|
859
|
+
<PageViewer
|
|
860
|
+
name="single"
|
|
861
|
+
compareView={false}
|
|
862
|
+
showFormEditor={editContext?.mode === "edit"}
|
|
863
|
+
followEditsDefault={true}
|
|
864
|
+
pageViewContext={editContext!.pageView}
|
|
865
|
+
noMargins={true}
|
|
866
|
+
/>
|
|
867
|
+
</div>
|
|
862
868
|
</div>
|
|
863
869
|
</WizardBox>
|
|
864
870
|
</>
|
|
@@ -28,10 +28,6 @@ export function FindItemsStep({
|
|
|
28
28
|
const [selectedItems, setSelectedItems] = useState<ItemTreeNodeData[]>([]);
|
|
29
29
|
const [rootItemIds, setRootItemIds] = useState<string[]>([]);
|
|
30
30
|
const [selectedValues, setSelectedValues] = useState<string[]>([]);
|
|
31
|
-
const [aiSuggestions, setAiSuggestions] = useState<string[]>([]);
|
|
32
|
-
const [aiSuggestedItems, setAiSuggestedItems] = useState<ItemTreeNodeData[]>(
|
|
33
|
-
[],
|
|
34
|
-
);
|
|
35
31
|
const [loadingAI, setLoadingAI] = useState(false);
|
|
36
32
|
const [loadingAIItems, setLoadingAIItems] = useState(false);
|
|
37
33
|
const [aiError, setAiError] = useState<string | null>(null);
|
|
@@ -147,8 +143,6 @@ export function FindItemsStep({
|
|
|
147
143
|
hasLayout: false,
|
|
148
144
|
}));
|
|
149
145
|
|
|
150
|
-
setAiSuggestedItems(suggestedItems);
|
|
151
|
-
|
|
152
146
|
// Auto-apply suggestions
|
|
153
147
|
const itemsToApply = multiSelect
|
|
154
148
|
? suggestedItems
|
|
@@ -156,12 +150,6 @@ export function FindItemsStep({
|
|
|
156
150
|
|
|
157
151
|
if (itemsToApply.length > 0) {
|
|
158
152
|
handleSelectionChange(itemsToApply);
|
|
159
|
-
|
|
160
|
-
// Clear suggestions after applying them
|
|
161
|
-
setTimeout(() => {
|
|
162
|
-
setAiSuggestions([]);
|
|
163
|
-
setAiSuggestedItems([]);
|
|
164
|
-
}, 2000); // Show the "applied" message for 2 seconds before clearing
|
|
165
153
|
}
|
|
166
154
|
}
|
|
167
155
|
} catch (error) {
|
|
@@ -251,11 +239,10 @@ Return a JSON object with suggested item IDs in this format:
|
|
|
251
239
|
};
|
|
252
240
|
|
|
253
241
|
const suggestionIds = suggestions.suggestions || [];
|
|
254
|
-
setAiSuggestions(suggestionIds);
|
|
255
242
|
setAiError(null); // Clear any previous errors
|
|
256
243
|
console.log("AI Reasoning:", suggestions.reasoning);
|
|
257
244
|
|
|
258
|
-
// Fetch full item details for the suggestions
|
|
245
|
+
// Fetch full item details for the suggestions and apply them directly
|
|
259
246
|
await fetchAISuggestedItems(suggestionIds);
|
|
260
247
|
}
|
|
261
248
|
} catch (parseError) {
|
|
@@ -466,42 +453,6 @@ Return a JSON object with suggested item IDs in this format:
|
|
|
466
453
|
{aiError}
|
|
467
454
|
</div>
|
|
468
455
|
)}
|
|
469
|
-
|
|
470
|
-
{/* AI Suggestions Applied */}
|
|
471
|
-
{(aiSuggestions.length > 0 || aiSuggestedItems.length > 0) && (
|
|
472
|
-
<div className="rounded-md bg-green-50 p-3">
|
|
473
|
-
<h4 className="text-sm font-medium text-green-900">
|
|
474
|
-
AI Suggestions Applied (
|
|
475
|
-
{Math.max(aiSuggestions.length, aiSuggestedItems.length)}):
|
|
476
|
-
</h4>
|
|
477
|
-
<div className="mt-2 flex flex-wrap gap-2">
|
|
478
|
-
{aiSuggestedItems.length > 0
|
|
479
|
-
? aiSuggestedItems.map((item) => (
|
|
480
|
-
<span
|
|
481
|
-
key={item.id}
|
|
482
|
-
className="inline-flex items-center gap-1 rounded-md bg-green-100 px-2 py-1 text-xs text-green-800"
|
|
483
|
-
>
|
|
484
|
-
{item.icon && (
|
|
485
|
-
<img src={item.icon} alt="" className="h-3 w-3" />
|
|
486
|
-
)}
|
|
487
|
-
{item.name}
|
|
488
|
-
</span>
|
|
489
|
-
))
|
|
490
|
-
: aiSuggestions.map((suggestionId) => (
|
|
491
|
-
<span
|
|
492
|
-
key={suggestionId}
|
|
493
|
-
className="inline-flex items-center rounded-md bg-green-100 px-2 py-1 text-xs text-green-800"
|
|
494
|
-
>
|
|
495
|
-
{suggestionId}
|
|
496
|
-
</span>
|
|
497
|
-
))}
|
|
498
|
-
</div>
|
|
499
|
-
<p className="mt-2 text-xs text-green-700">
|
|
500
|
-
These items were automatically selected by AI based on your input
|
|
501
|
-
data.
|
|
502
|
-
</p>
|
|
503
|
-
</div>
|
|
504
|
-
)}
|
|
505
456
|
</div>
|
|
506
457
|
|
|
507
458
|
<div className="flex-1 overflow-hidden rounded-md border border-gray-300">
|
|
@@ -131,7 +131,7 @@ export function usePageCreator(
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
// Wait for the component to be created
|
|
134
|
-
const componentId = addComponentOp.componentId;
|
|
134
|
+
const componentId = stripGuid(addComponentOp.componentId);
|
|
135
135
|
console.log("! Waiting for component to be created", componentId);
|
|
136
136
|
|
|
137
137
|
let createdComponent;
|
|
@@ -148,9 +148,8 @@ export function usePageCreator(
|
|
|
148
148
|
break;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
if (createdComponent) break;
|
|
152
151
|
|
|
153
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
152
|
+
await new Promise((resolve) => setTimeout(resolve, 200)); // Wait 100ms between attempts
|
|
154
153
|
console.log("! Waiting for component to be created", componentId);
|
|
155
154
|
attempts++;
|
|
156
155
|
}
|
package/src/revision.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = "1.0.
|
|
2
|
-
export const buildDate = "2025-07-24
|
|
1
|
+
export const version = "1.0.4017";
|
|
2
|
+
export const buildDate = "2025-07-24 21:01:29";
|