@parhelia/page-wizard 0.1.11004 → 0.1.11005

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.
Files changed (91) hide show
  1. package/dist/SplashScreen.d.ts +1 -0
  2. package/dist/SplashScreen.js +110 -0
  3. package/dist/SplashScreen.js.map +1 -0
  4. package/dist/dist/PageWizard.d.ts +78 -0
  5. package/dist/dist/PageWizard.js +57 -0
  6. package/dist/dist/PageWizard.js.map +1 -0
  7. package/dist/dist/SplashScreen.d.ts +1 -0
  8. package/dist/dist/SplashScreen.js +110 -0
  9. package/dist/dist/SplashScreen.js.map +1 -0
  10. package/dist/dist/WizardBoxConnector.d.ts +4 -0
  11. package/dist/dist/WizardBoxConnector.js +6 -0
  12. package/dist/dist/WizardBoxConnector.js.map +1 -0
  13. package/dist/dist/WizardSteps.d.ts +8 -0
  14. package/dist/dist/WizardSteps.js +174 -0
  15. package/dist/dist/WizardSteps.js.map +1 -0
  16. package/dist/dist/config.d.ts +2 -0
  17. package/dist/dist/config.js +86 -0
  18. package/dist/dist/config.js.map +1 -0
  19. package/dist/dist/index.d.ts +2 -0
  20. package/dist/dist/index.js +2 -0
  21. package/dist/dist/index.js.map +1 -0
  22. package/dist/dist/service.d.ts +15 -0
  23. package/dist/dist/service.js +29 -0
  24. package/dist/dist/service.js.map +1 -0
  25. package/dist/dist/startPageWizardCommand.d.ts +13 -0
  26. package/dist/dist/startPageWizardCommand.js +31 -0
  27. package/dist/dist/startPageWizardCommand.js.map +1 -0
  28. package/dist/dist/steps/BuildPageStep.d.ts +2 -0
  29. package/dist/dist/steps/BuildPageStep.js +138 -0
  30. package/dist/dist/steps/BuildPageStep.js.map +1 -0
  31. package/dist/dist/steps/CollectStep.d.ts +2 -0
  32. package/dist/dist/steps/CollectStep.js +115 -0
  33. package/dist/dist/steps/CollectStep.js.map +1 -0
  34. package/dist/dist/steps/ComponentTypesSelector.d.ts +13 -0
  35. package/dist/dist/steps/ComponentTypesSelector.js +155 -0
  36. package/dist/dist/steps/ComponentTypesSelector.js.map +1 -0
  37. package/dist/dist/steps/Components.d.ts +9 -0
  38. package/dist/dist/steps/Components.js +89 -0
  39. package/dist/dist/steps/Components.js.map +1 -0
  40. package/dist/dist/steps/ContentStep.d.ts +2 -0
  41. package/dist/dist/steps/ContentStep.js +808 -0
  42. package/dist/dist/steps/ContentStep.js.map +1 -0
  43. package/dist/dist/steps/EditButton.d.ts +8 -0
  44. package/dist/dist/steps/EditButton.js +5 -0
  45. package/dist/dist/steps/EditButton.js.map +1 -0
  46. package/dist/dist/steps/FieldEditor.d.ts +5 -0
  47. package/dist/dist/steps/FieldEditor.js +27 -0
  48. package/dist/dist/steps/FieldEditor.js.map +1 -0
  49. package/dist/dist/steps/FindItemsStep.d.ts +2 -0
  50. package/dist/dist/steps/FindItemsStep.js +294 -0
  51. package/dist/dist/steps/FindItemsStep.js.map +1 -0
  52. package/dist/dist/steps/Generate.d.ts +6 -0
  53. package/dist/dist/steps/Generate.js +31 -0
  54. package/dist/dist/steps/Generate.js.map +1 -0
  55. package/dist/dist/steps/ImagesStep.d.ts +2 -0
  56. package/dist/dist/steps/ImagesStep.js +178 -0
  57. package/dist/dist/steps/ImagesStep.js.map +1 -0
  58. package/dist/dist/steps/LayoutStep.d.ts +2 -0
  59. package/dist/dist/steps/LayoutStep.js +128 -0
  60. package/dist/dist/steps/LayoutStep.js.map +1 -0
  61. package/dist/dist/steps/MetaDataStep.d.ts +2 -0
  62. package/dist/dist/steps/MetaDataStep.js +112 -0
  63. package/dist/dist/steps/MetaDataStep.js.map +1 -0
  64. package/dist/dist/steps/SchottSelectImagesStep.d.ts +2 -0
  65. package/dist/dist/steps/SchottSelectImagesStep.js +55 -0
  66. package/dist/dist/steps/SchottSelectImagesStep.js.map +1 -0
  67. package/dist/dist/steps/SelectStep.d.ts +2 -0
  68. package/dist/dist/steps/SelectStep.js +151 -0
  69. package/dist/dist/steps/SelectStep.js.map +1 -0
  70. package/dist/dist/steps/StructureStep.d.ts +2 -0
  71. package/dist/dist/steps/StructureStep.js +205 -0
  72. package/dist/dist/steps/StructureStep.js.map +1 -0
  73. package/dist/dist/steps/TranslateStep.d.ts +2 -0
  74. package/dist/dist/steps/TranslateStep.js +613 -0
  75. package/dist/dist/steps/TranslateStep.js.map +1 -0
  76. package/dist/dist/steps/schema.d.ts +13 -0
  77. package/dist/dist/steps/schema.js +139 -0
  78. package/dist/dist/steps/schema.js.map +1 -0
  79. package/dist/dist/steps/usePageCreator.d.ts +7 -0
  80. package/dist/dist/steps/usePageCreator.js +285 -0
  81. package/dist/dist/steps/usePageCreator.js.map +1 -0
  82. package/dist/dist/types.d.ts +27 -0
  83. package/dist/dist/types.js +2 -0
  84. package/dist/dist/types.js.map +1 -0
  85. package/dist/dist/usePageWizard.d.ts +22 -0
  86. package/dist/dist/usePageWizard.js +69 -0
  87. package/dist/dist/usePageWizard.js.map +1 -0
  88. package/dist/dist/utils/dataAccessor.d.ts +57 -0
  89. package/dist/dist/utils/dataAccessor.js +323 -0
  90. package/dist/dist/utils/dataAccessor.js.map +1 -0
  91. package/package.json +1 -1
@@ -0,0 +1,151 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect } from "react";
3
+ import { Card, Textarea, ActionButton, cn, useEditContext, executePromptWithJsonResult } from "@parhelia/core";
4
+ import { createWizardAiContext } from "../service";
5
+ import Generate from "./Generate";
6
+ import { WizardBoxConnector } from "../WizardBoxConnector";
7
+ import { Settings, CheckSquare } from "lucide-react";
8
+ import { evaluateDataExpression, setDataProperty, getFilteredInputData, processPromptTemplate, } from "../utils/dataAccessor";
9
+ export function SelectStep({ step, data, setData, setStepCompleted, internalState, setInternalState, }) {
10
+ const editContext = useEditContext();
11
+ const [options, setOptions] = useState([]);
12
+ const [loading, setLoading] = useState(false);
13
+ const [error, setError] = useState(null);
14
+ const [selectedOptions, setSelectedOptions] = useState([]);
15
+ const [instructions, setInstructions] = useState(step.fields.instructions || "");
16
+ // Get the property name from the step or use "choice" as default
17
+ const inputProperties = step.fields?.inputProperties ||
18
+ step.fields?.propertyName ||
19
+ "selectedOptions";
20
+ const propertyName = step.fields.propertyName || "selectedOptions";
21
+ useEffect(() => {
22
+ const { value: existingValues, error } = evaluateDataExpression(inputProperties, data);
23
+ if (error) {
24
+ console.warn(`Error evaluating input properties "${inputProperties}":`, error);
25
+ }
26
+ if (Array.isArray(existingValues) && existingValues.length) {
27
+ setStepCompleted?.(true);
28
+ }
29
+ }, [data, inputProperties]);
30
+ // Initialize the property in data
31
+ useEffect(() => {
32
+ const { value: existingValues } = evaluateDataExpression(inputProperties, data);
33
+ if (!existingValues) {
34
+ setData((prevData) => setDataProperty(propertyName, [], prevData));
35
+ }
36
+ }, [inputProperties, propertyName, setData]);
37
+ const generateOptions = async () => {
38
+ if (!editContext)
39
+ return;
40
+ setLoading(true);
41
+ setError(null);
42
+ try {
43
+ // Replace placeholders in instructions using the same logic as ContentStep
44
+ const processedInstructionsResult = processPromptTemplate(instructions || "", data);
45
+ if (processedInstructionsResult.error) {
46
+ setError(`Template Error: ${processedInstructionsResult.error}`);
47
+ return;
48
+ }
49
+ const processedSystemInstructionsResult = processPromptTemplate(step.fields.systemInstructions || "", data);
50
+ if (processedSystemInstructionsResult.error) {
51
+ setError(`Template Error: ${processedSystemInstructionsResult.error}`);
52
+ return;
53
+ }
54
+ const processedInstructions = processedInstructionsResult.value || "";
55
+ const processedSystemInstructions = processedSystemInstructionsResult.value || "";
56
+ // Filter input data if inputProperties are provided
57
+ const inputData = getFilteredInputData(step, data);
58
+ // Create a prompt based on processed instructions and filtered data
59
+ const prompt = `${processedSystemInstructions}\n${processedInstructions}\n\nCurrent data: ${JSON.stringify(inputData, null, 2)}`;
60
+ // Call the executePromptWithJsonResult function with the prompt
61
+ const abortController = new AbortController();
62
+ const result = await executePromptWithJsonResult([
63
+ {
64
+ content: `You are a helpful assistant that generates options for a wizard select step.
65
+
66
+ Return a JSON array of objects with the following structure:
67
+ [{ "value": "option_value", "label": "Option Label", "description": "Brief description", id: "unique_id" }]
68
+
69
+ Create ${step.fields.numberOfOptions || 5} relevant options.`,
70
+ name: "system",
71
+ role: "system",
72
+ id: crypto.randomUUID(), // Use proper UUID instead of Date.now()
73
+ },
74
+ {
75
+ content: prompt,
76
+ name: "user",
77
+ role: "user",
78
+ id: crypto.randomUUID(), // Use proper UUID instead of Date.now()
79
+ },
80
+ ], { editContext, createAiContext: createWizardAiContext }, { model: step.fields.aiModel || undefined }, { signal: abortController.signal });
81
+ // Handle both array and object responses
82
+ const optionsArray = Array.isArray(result)
83
+ ? result
84
+ : result?.options || [];
85
+ // Set the parsed options
86
+ setOptions(optionsArray);
87
+ setInternalState?.((state) => ({
88
+ ...state,
89
+ [step.id + "options"]: optionsArray,
90
+ }));
91
+ }
92
+ catch (err) {
93
+ const errorMessage = err instanceof Error ? err.message : "Failed to generate options.";
94
+ setError(errorMessage);
95
+ console.error("Error generating options:", err);
96
+ }
97
+ finally {
98
+ setLoading(false);
99
+ }
100
+ };
101
+ // Generate options on component mount
102
+ useEffect(() => {
103
+ if (internalState[step.id + "options"]?.length > 0) {
104
+ setOptions(internalState[step.id + "options"]);
105
+ return;
106
+ }
107
+ generateOptions();
108
+ }, [step.fields.instructions, internalState]);
109
+ // Sync data with selectedOptions state using flexible expression
110
+ useEffect(() => {
111
+ const { value: currentSelections } = evaluateDataExpression(inputProperties, data);
112
+ const selectionsArray = Array.isArray(currentSelections)
113
+ ? currentSelections
114
+ : [];
115
+ setSelectedOptions(selectionsArray.map((option) => typeof option === "string" ? option : option.id));
116
+ }, [data, inputProperties]);
117
+ // Handle option selection
118
+ const handleOptionSelect = (option) => {
119
+ setData((prevData) => {
120
+ const { value: currentData } = evaluateDataExpression(inputProperties, prevData);
121
+ const dataArray = currentData || [];
122
+ const isSelected = dataArray.some((o) => o.id === option.id);
123
+ let updatedData;
124
+ if (isSelected) {
125
+ // Remove option if already selected
126
+ updatedData = dataArray.filter((o) => o.id !== option.id);
127
+ }
128
+ else {
129
+ // Add option if not selected
130
+ updatedData = [...dataArray, option];
131
+ }
132
+ return setDataProperty(propertyName, updatedData, prevData);
133
+ });
134
+ };
135
+ if (error) {
136
+ return (_jsxs("div", { className: "p-4 text-red-500", children: [error, _jsx("button", { className: "ml-4 rounded bg-blue-500 px-2 py-1 text-white", onClick: () => window.location.reload(), children: "Retry" })] }));
137
+ }
138
+ return (_jsxs("div", { className: "flex h-full flex-col md:flex-row", children: [_jsx(Card, { title: step.fields.configureTitle || "Configuration", icon: _jsx(Settings, { strokeWidth: 1 }), description: step.fields.configureDescription ||
139
+ "Configure instructions and regenerate options", className: "md:w-96", children: _jsxs("div", { className: "flex h-full flex-col items-stretch", children: [_jsx("div", { className: "relative flex-1", children: _jsxs("div", { className: "absolute inset-0 overflow-y-auto", children: [_jsx("h3", { className: "text-sm font-bold", children: "Instructions" }), _jsx(Textarea, { className: "h-48 w-full text-sm", value: instructions, onChange: (e) => setInstructions(e.target.value), placeholder: "Enter instructions for generating the options" })] }) }), _jsx("div", { className: "py-2", children: _jsx(ActionButton, { onClick: generateOptions, isLoading: loading, disabled: loading, loadingText: "Thinking...", className: "w-full", children: "Regenerate Options" }) })] }) }), _jsx(WizardBoxConnector, {}), _jsx(Card, { title: step.fields.selectOptionsTitle || "Select Options", icon: _jsx(CheckSquare, { strokeWidth: 1 }), description: step.fields.selectOptionsDescription ||
140
+ "Choose from the generated options below", className: "flex-1", children: _jsxs("div", { className: "h-full", children: [loading && (_jsx("div", { className: "flex h-full items-center justify-center", children: _jsx(Generate, { title: step.fields.generatingOptionsText || "Generating options..." }) })), !loading && (_jsx("div", { children: options.length === 0 ? (_jsx("div", { className: "p-4 text-gray-500", children: "No options available. Try refreshing the page." })) : (options.map((option, index) => {
141
+ const isSelected = selectedOptions.includes(option.id);
142
+ return (_jsxs("div", { className: cn("mb-3 flex items-center rounded border-2 bg-white p-3", index % 2 === 0
143
+ ? "animate-fadeRight"
144
+ : "animate-fadeLeft", isSelected
145
+ ? "text-theme-secondary border-theme-secondary"
146
+ : "border-gray-300 text-gray-600"), onClick: () => handleOptionSelect(option), children: [_jsxs("div", { className: "flex flex-1 cursor-pointer flex-col", children: [_jsx("div", { className: "font-medium", children: option.title }), _jsx("div", { className: "text-xs text-gray-600", children: option.description })] }), _jsx("div", { className: cn("ml-2 flex h-6 w-6 items-center justify-center rounded-full text-white", isSelected
147
+ ? "bg-theme-secondary opacity-100"
148
+ : "opacity-0"), children: "\u2713" })] }, option.id));
149
+ })) }))] }) })] }));
150
+ }
151
+ //# sourceMappingURL=SelectStep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectStep.js","sourceRoot":"","sources":["../../src/steps/SelectStep.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC/G,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAY/B,MAAM,UAAU,UAAU,CAAC,EACzB,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACG;IACnB,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAC;IACrD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,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AS,EAAC,qCAAqC,aAClD,cAAK,SAAS,EAAC,aAAa,YAAE,MAAM,CAAC,KAAK,GAAO,EACjD,cAAK,SAAS,EAAC,uBAAuB,YACnC,MAAM,CAAC,WAAW,GACf,IACF,EACN,cACE,SAAS,EAAE,EAAE,CACX,uEAAuE,EACvE,UAAU;gDACR,CAAC,CAAC,gCAAgC;gDAClC,CAAC,CAAC,WAAW,CAChB,uBAGG,KA3BD,MAAM,CAAC,EAAE,CA4BV,CACP,CAAC;4BACJ,CAAC,CAAC,CACH,GACG,CACP,IACG,GACD,IACH,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { StepComponentProps } from "../types";
2
+ export declare function StructureStep({ step, data, setData, setStepCompleted, internalState, setInternalState, }: StepComponentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,205 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect } from "react";
3
+ import { Card, Textarea, ActionButton, useEditContext, executePrompt } from "@parhelia/core";
4
+ import { createWizardAiContext } from "../service";
5
+ import Generate from "./Generate";
6
+ import { Settings, Layout, ChevronDown, ChevronRight } from "lucide-react";
7
+ import { evaluateDataExpression, setDataProperty, processPromptTemplate, } from "../utils/dataAccessor";
8
+ export function StructureStep({ step, data, setData, setStepCompleted, internalState, setInternalState, }) {
9
+ const editContext = useEditContext();
10
+ const [structure, setStructure] = useState([]);
11
+ const [loading, setLoading] = useState(false);
12
+ const [error, setError] = useState(null);
13
+ const [customInstructions, setCustomInstructions] = useState("");
14
+ const [expandedElements, setExpandedElements] = useState(new Set());
15
+ // Get the property name from the step or use "structure" as default
16
+ const inputProperties = step.fields?.inputProperties || step.fields?.propertyName || "structure";
17
+ const propertyName = step.fields?.propertyName || "structure";
18
+ useEffect(() => {
19
+ const { value: existingStructure, error } = evaluateDataExpression(inputProperties, data);
20
+ if (error) {
21
+ console.warn(`Error evaluating input properties "${inputProperties}":`, error);
22
+ }
23
+ if (existingStructure?.length) {
24
+ setStepCompleted(true);
25
+ }
26
+ }, [data, inputProperties]);
27
+ // Initialize the property in data
28
+ useEffect(() => {
29
+ const { value: existingStructure } = evaluateDataExpression(inputProperties, data);
30
+ if (!existingStructure) {
31
+ setData((prevData) => setDataProperty(propertyName, [], prevData));
32
+ }
33
+ }, [inputProperties, propertyName]);
34
+ // Load existing structure data into local state
35
+ useEffect(() => {
36
+ const { value: existingStructure } = evaluateDataExpression(inputProperties, data);
37
+ if (Array.isArray(existingStructure)) {
38
+ setStructure(existingStructure);
39
+ }
40
+ else if (existingStructure &&
41
+ typeof existingStructure === "object" &&
42
+ Array.isArray(existingStructure.sections)) {
43
+ setStructure(existingStructure.sections);
44
+ }
45
+ else if (existingStructure !== undefined) {
46
+ console.warn("StructureStep: existing structure is not an array; ignoring value", existingStructure);
47
+ }
48
+ }, [data, inputProperties]);
49
+ // Auto-execute structure generation on component mount if no existing structure
50
+ useEffect(() => {
51
+ const { value: existingStructure } = evaluateDataExpression(inputProperties, data);
52
+ // Only auto-execute if:
53
+ // 1. No existing structure
54
+ // 2. We have edit context
55
+ // 3. We have system instructions configured
56
+ // 4. Not already loading
57
+ if (!existingStructure &&
58
+ editContext &&
59
+ step.fields.systemInstructions &&
60
+ !loading) {
61
+ generateStructure();
62
+ }
63
+ }, [editContext, step.fields.systemInstructions]); // Dependencies that indicate readiness
64
+ // Generate structure using AI
65
+ const generateStructure = async () => {
66
+ if (!editContext) {
67
+ setError("No edit context defined.");
68
+ return;
69
+ }
70
+ if (!step.fields.systemInstructions) {
71
+ setError("No instructions defined in step configuration.");
72
+ return;
73
+ }
74
+ setLoading(true);
75
+ setError(null);
76
+ // Process template expressions in system instructions
77
+ const systemInstructionsResult = processPromptTemplate(step.fields.systemInstructions || "", data);
78
+ if (systemInstructionsResult.error) {
79
+ console.error("Template processing error in system instructions:", systemInstructionsResult.error);
80
+ setError(`Template Error: ${systemInstructionsResult.error}`);
81
+ setLoading(false);
82
+ return;
83
+ }
84
+ // Process template expressions in custom instructions
85
+ const customInstructionsResult = processPromptTemplate(customInstructions || "", data);
86
+ if (customInstructionsResult.error) {
87
+ console.error("Template processing error in custom instructions:", customInstructionsResult.error);
88
+ setError(`Template Error: ${customInstructionsResult.error}`);
89
+ setLoading(false);
90
+ return;
91
+ }
92
+ const basePrompt = `
93
+ ${systemInstructionsResult.value || ""}
94
+
95
+ ${customInstructionsResult.value ? `Additional requirements: ${customInstructionsResult.value}` : ""}
96
+ `;
97
+ try {
98
+ const result = await executePrompt([
99
+ {
100
+ content: `You are an expert content strategist helping to structure content. Return ONLY a valid JSON array with section objects in this exact format: {sections: [{type: string, content: string, description: string}] }`,
101
+ name: "system",
102
+ role: "system",
103
+ id: crypto.randomUUID(), // Use proper UUID instead of Date.now()
104
+ },
105
+ {
106
+ content: basePrompt,
107
+ name: "user",
108
+ role: "user",
109
+ id: crypto.randomUUID(), // Use proper UUID instead of Date.now()
110
+ },
111
+ ], { editContext, createAiContext: createWizardAiContext }, {
112
+ allowedFunctions: [],
113
+ model: step.fields.aiModel || undefined,
114
+ endpoint: "/parhelia/page-wizard/prompt",
115
+ }, undefined, undefined, false);
116
+ console.log("AI RESULT: ", result);
117
+ // Parse the result and set structure
118
+ if (result && result.messages && result.messages.length > 0) {
119
+ try {
120
+ const lastMessage = result.messages[result.messages.length - 1];
121
+ if (lastMessage && lastMessage.content) {
122
+ const generatedStructure = JSON.parse(lastMessage.content);
123
+ const sections = Array.isArray(generatedStructure?.sections)
124
+ ? generatedStructure.sections
125
+ : undefined;
126
+ if (!sections) {
127
+ console.error("StructureStep: AI response missing valid 'sections' array", generatedStructure);
128
+ setError("Failed to parse structure. The response did not include a valid 'sections' array.");
129
+ }
130
+ else {
131
+ setStructure(sections);
132
+ setData((prevData) => setDataProperty(propertyName, sections, prevData));
133
+ setInternalState?.((state) => ({
134
+ ...state,
135
+ [step.id + "structure"]: sections,
136
+ }));
137
+ }
138
+ }
139
+ }
140
+ catch (parseError) {
141
+ console.error("Error parsing structure:", parseError);
142
+ setError("Failed to parse structure. The response was not in the expected format.");
143
+ }
144
+ }
145
+ else {
146
+ setError("No structure was generated. Please try again.");
147
+ }
148
+ }
149
+ catch (err) {
150
+ setError("Failed to generate structure. Please try again.");
151
+ console.error("Error generating structure:", err);
152
+ }
153
+ finally {
154
+ setLoading(false);
155
+ }
156
+ };
157
+ // Remove structure element
158
+ const removeElement = (index) => {
159
+ const updatedStructure = structure.filter((_, i) => i !== index);
160
+ setStructure(updatedStructure);
161
+ setData((prevData) => setDataProperty(propertyName, updatedStructure, prevData));
162
+ setInternalState?.((state) => ({
163
+ ...state,
164
+ [step.id + "structure"]: updatedStructure,
165
+ }));
166
+ };
167
+ // Edit structure element content
168
+ const editElement = (index, newContent) => {
169
+ const updatedStructure = [...structure];
170
+ const currentElement = updatedStructure[index];
171
+ if (currentElement) {
172
+ updatedStructure[index] = {
173
+ ...currentElement,
174
+ content: newContent,
175
+ };
176
+ }
177
+ setStructure(updatedStructure);
178
+ setData((prevData) => setDataProperty(propertyName, updatedStructure, prevData));
179
+ setInternalState?.((state) => ({
180
+ ...state,
181
+ [step.id + "structure"]: updatedStructure,
182
+ }));
183
+ };
184
+ // Toggle expand/collapse for an element
185
+ const toggleElement = (index) => {
186
+ const newExpanded = new Set(expandedElements);
187
+ if (newExpanded.has(index)) {
188
+ newExpanded.delete(index);
189
+ }
190
+ else {
191
+ newExpanded.add(index);
192
+ }
193
+ setExpandedElements(newExpanded);
194
+ };
195
+ if (loading) {
196
+ return _jsx(Generate, { title: "Analyzing content..." });
197
+ }
198
+ return (_jsx("div", { className: "flex h-full flex-col", children: _jsx(Card, { icon: _jsx(Layout, { className: "h-5 w-5" }), title: "Page Structure", description: "Define the structure and content flow for your page", children: _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "text-sm text-gray-600", children: [_jsxs("p", { children: ["Allowed structure types:", " ", _jsx("strong", { children: step.fields.instructions })] }), _jsx("p", { children: "The AI will generate a logical page structure using these element types." })] }), _jsxs("div", { className: "space-y-2", children: [_jsx("label", { className: "block text-sm font-medium text-gray-700", children: "Additional Requirements (Optional)" }), _jsx(Textarea, { value: customInstructions, onChange: (e) => setCustomInstructions(e.target.value), placeholder: "Describe any specific requirements for your page structure...", rows: 3, className: "w-full" })] }), error && (_jsx("div", { className: "rounded-md bg-red-50 p-3 text-sm text-red-700", children: error })), (structure?.length ?? 0) > 0 && (_jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-sm font-medium text-gray-900", children: "Generated Structure" }), _jsx("div", { className: "gap-2 space-y-3", children: structure.map((element, index) => {
199
+ const isExpanded = expandedElements.has(index);
200
+ return (_jsxs("div", { className: "rounded-lg border bg-gray-50 p-4", children: [_jsxs("div", { className: "mb-2 flex items-start justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "inline-flex items-center rounded-full bg-blue-100 px-2.5 py-0.5 text-xs font-medium text-blue-800", children: element.type }), _jsxs("button", { onClick: () => toggleElement(index), className: "flex items-center gap-1 text-sm text-gray-600 transition-colors hover:text-gray-800", children: [isExpanded ? (_jsx(ChevronDown, { className: "h-4 w-4" })) : (_jsx(ChevronRight, { className: "h-4 w-4" })), isExpanded ? "Collapse" : "Expand"] })] }), _jsx("button", { onClick: () => removeElement(index), className: "text-sm text-red-500 hover:text-red-700", children: "Remove" })] }), !isExpanded && (_jsxs("div", { className: "cursor-pointer space-y-2", onClick: () => toggleElement(index), children: [element.description && (_jsx("p", { className: "text-sm font-medium text-gray-700", children: element.headline || element.description })), _jsx("p", { className: "text-xs text-blue-600 hover:text-blue-800", children: "Click to expand and edit" })] })), isExpanded && (_jsx("div", { className: "space-y-3", children: _jsxs("div", { className: "space-y-1", children: [_jsx("label", { className: "block text-xs font-medium text-gray-700", children: "Content" }), _jsx(Textarea, { value: element.content, onChange: (e) => editElement(index, e.target.value), className: "w-full", rows: 4 })] }) }))] }, index));
201
+ }) })] })), _jsx("div", { className: "flex space-x-3", children: _jsx(ActionButton, { onClick: generateStructure, disabled: loading, children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Settings, { className: "h-4 w-4" }), (structure?.length ?? 0) > 0
202
+ ? "Regenerate Structure"
203
+ : "Generate Structure"] }) }) })] }) }) }));
204
+ }
205
+ //# sourceMappingURL=StructureStep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StructureStep.js","sourceRoot":"","sources":["../../src/steps/StructureStep.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAS/B,MAAM,UAAU,aAAa,CAAC,EAC5B,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACG;IACnB,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAqB,EAAE,CAAC,CAAC;IACnE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjE,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAC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function TranslateStep({ step, data, setData, setStepCompleted, internalState, setInternalState, parentItem, }: StepComponentProps): import("react/jsx-runtime").JSX.Element;