@parhelia/page-wizard 0.1.10745
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/LICENSE +8 -0
- package/README.md +28 -0
- package/dist/PageWizard.d.ts +78 -0
- package/dist/PageWizard.js +57 -0
- package/dist/PageWizard.js.map +1 -0
- package/dist/SplashScreen.d.ts +1 -0
- package/dist/SplashScreen.js +110 -0
- package/dist/SplashScreen.js.map +1 -0
- package/dist/WizardBoxConnector.d.ts +4 -0
- package/dist/WizardBoxConnector.js +6 -0
- package/dist/WizardBoxConnector.js.map +1 -0
- package/dist/WizardSteps.d.ts +8 -0
- package/dist/WizardSteps.js +174 -0
- package/dist/WizardSteps.js.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +86 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/service.d.ts +15 -0
- package/dist/service.js +29 -0
- package/dist/service.js.map +1 -0
- package/dist/startPageWizardCommand.d.ts +13 -0
- package/dist/startPageWizardCommand.js +31 -0
- package/dist/startPageWizardCommand.js.map +1 -0
- package/dist/steps/BuildPageStep.d.ts +2 -0
- package/dist/steps/BuildPageStep.js +138 -0
- package/dist/steps/BuildPageStep.js.map +1 -0
- package/dist/steps/CollectStep.d.ts +2 -0
- package/dist/steps/CollectStep.js +115 -0
- package/dist/steps/CollectStep.js.map +1 -0
- package/dist/steps/ComponentTypesSelector.d.ts +13 -0
- package/dist/steps/ComponentTypesSelector.js +155 -0
- package/dist/steps/ComponentTypesSelector.js.map +1 -0
- package/dist/steps/Components.d.ts +9 -0
- package/dist/steps/Components.js +89 -0
- package/dist/steps/Components.js.map +1 -0
- package/dist/steps/ContentStep.d.ts +2 -0
- package/dist/steps/ContentStep.js +809 -0
- package/dist/steps/ContentStep.js.map +1 -0
- package/dist/steps/EditButton.d.ts +8 -0
- package/dist/steps/EditButton.js +5 -0
- package/dist/steps/EditButton.js.map +1 -0
- package/dist/steps/FieldEditor.d.ts +5 -0
- package/dist/steps/FieldEditor.js +27 -0
- package/dist/steps/FieldEditor.js.map +1 -0
- package/dist/steps/FindItemsStep.d.ts +2 -0
- package/dist/steps/FindItemsStep.js +294 -0
- package/dist/steps/FindItemsStep.js.map +1 -0
- package/dist/steps/Generate.d.ts +6 -0
- package/dist/steps/Generate.js +31 -0
- package/dist/steps/Generate.js.map +1 -0
- package/dist/steps/ImagesStep.d.ts +2 -0
- package/dist/steps/ImagesStep.js +178 -0
- package/dist/steps/ImagesStep.js.map +1 -0
- package/dist/steps/LayoutStep.d.ts +2 -0
- package/dist/steps/LayoutStep.js +128 -0
- package/dist/steps/LayoutStep.js.map +1 -0
- package/dist/steps/MetaDataStep.d.ts +2 -0
- package/dist/steps/MetaDataStep.js +112 -0
- package/dist/steps/MetaDataStep.js.map +1 -0
- package/dist/steps/SchottSelectImagesStep.d.ts +2 -0
- package/dist/steps/SchottSelectImagesStep.js +55 -0
- package/dist/steps/SchottSelectImagesStep.js.map +1 -0
- package/dist/steps/SelectStep.d.ts +2 -0
- package/dist/steps/SelectStep.js +151 -0
- package/dist/steps/SelectStep.js.map +1 -0
- package/dist/steps/StructureStep.d.ts +2 -0
- package/dist/steps/StructureStep.js +205 -0
- package/dist/steps/StructureStep.js.map +1 -0
- package/dist/steps/TranslateStep.d.ts +2 -0
- package/dist/steps/TranslateStep.js +613 -0
- package/dist/steps/TranslateStep.js.map +1 -0
- package/dist/steps/schema.d.ts +13 -0
- package/dist/steps/schema.js +139 -0
- package/dist/steps/schema.js.map +1 -0
- package/dist/steps/usePageCreator.d.ts +7 -0
- package/dist/steps/usePageCreator.js +285 -0
- package/dist/steps/usePageCreator.js.map +1 -0
- package/dist/types.d.ts +27 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/usePageWizard.d.ts +22 -0
- package/dist/usePageWizard.js +69 -0
- package/dist/usePageWizard.js.map +1 -0
- package/dist/utils/dataAccessor.d.ts +57 -0
- package/dist/utils/dataAccessor.js +323 -0
- package/dist/utils/dataAccessor.js.map +1 -0
- package/package.json +48 -0
- package/styles.css +1 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @parhelia/page-wizard
|
|
2
|
+
|
|
3
|
+
Page creation wizard for Parhelia visual editor.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @parhelia/page-wizard
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { PageWizard, usePageWizard } from '@parhelia/page-wizard';
|
|
15
|
+
import '@parhelia/page-wizard/styles.css';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- Step-by-step page creation
|
|
21
|
+
- Template selection
|
|
22
|
+
- Page configuration
|
|
23
|
+
- Guided setup process
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
See LICENSE file for details.
|
|
28
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type ItemDescriptor, type Thumbnail } from "@parhelia/core";
|
|
2
|
+
export type Wizard = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
steps: WizardStep[];
|
|
7
|
+
icon: string;
|
|
8
|
+
schema: PageSchema;
|
|
9
|
+
templateId: string;
|
|
10
|
+
};
|
|
11
|
+
export type PageSchema = {
|
|
12
|
+
placeholders: SchemaPlaceholder[];
|
|
13
|
+
pageFields: SchemaField[];
|
|
14
|
+
};
|
|
15
|
+
export type SchemaComponent = {
|
|
16
|
+
type: string;
|
|
17
|
+
typeId: string;
|
|
18
|
+
fields: SchemaField[];
|
|
19
|
+
placeholders: SchemaPlaceholder[];
|
|
20
|
+
};
|
|
21
|
+
export type SchemaPlaceholder = {
|
|
22
|
+
name: string;
|
|
23
|
+
components: SchemaComponent[];
|
|
24
|
+
};
|
|
25
|
+
export type SchemaField = {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
type: string;
|
|
29
|
+
};
|
|
30
|
+
export type WizardSchemaComponent = {
|
|
31
|
+
type: string;
|
|
32
|
+
fields: WizardSchemaField[];
|
|
33
|
+
validParentPlaceholders?: string[];
|
|
34
|
+
allowedChildrenComponentTypes?: string[];
|
|
35
|
+
allowedOnRoot: boolean;
|
|
36
|
+
};
|
|
37
|
+
export type WizardSchemaField = {
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
};
|
|
41
|
+
export type WizardStep = {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
type: string;
|
|
45
|
+
fields: {
|
|
46
|
+
[key: string]: string;
|
|
47
|
+
};
|
|
48
|
+
children?: WizardStep[];
|
|
49
|
+
};
|
|
50
|
+
export type WizardData = {
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
currentItem?: ItemDescriptor;
|
|
53
|
+
};
|
|
54
|
+
export type WizardPageModel = {
|
|
55
|
+
components: WizardPageComponent[];
|
|
56
|
+
name: string;
|
|
57
|
+
metaDescription: string;
|
|
58
|
+
metaKeywords: string;
|
|
59
|
+
message?: string;
|
|
60
|
+
images?: Thumbnail[];
|
|
61
|
+
fields: WizardField[];
|
|
62
|
+
};
|
|
63
|
+
export type WizardPageComponent = {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
type: string;
|
|
67
|
+
fields: WizardField[];
|
|
68
|
+
children?: WizardPageComponent[];
|
|
69
|
+
description: string;
|
|
70
|
+
placeholder?: string;
|
|
71
|
+
};
|
|
72
|
+
export type WizardField = {
|
|
73
|
+
name: string;
|
|
74
|
+
value: string;
|
|
75
|
+
type: string;
|
|
76
|
+
writtenValue?: string;
|
|
77
|
+
};
|
|
78
|
+
export declare function PageWizard(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { useEditContext, Spinner } from "@parhelia/core";
|
|
4
|
+
import { getWizard } from "./service";
|
|
5
|
+
import { WizardSteps } from "./WizardSteps";
|
|
6
|
+
export function PageWizard() {
|
|
7
|
+
const editContext = useEditContext();
|
|
8
|
+
const [wizard, setWizard] = useState(null);
|
|
9
|
+
const [parentItem, setParentItem] = useState(null);
|
|
10
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const wizardId = editContext?.currentWizardId;
|
|
13
|
+
async function loadWizard() {
|
|
14
|
+
if (wizard)
|
|
15
|
+
return;
|
|
16
|
+
if (!wizardId) {
|
|
17
|
+
// If no wizard ID, we can't proceed
|
|
18
|
+
console.log("PageWizard - No wizard ID, cannot load wizard");
|
|
19
|
+
setIsLoading(false);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// If no content editor item yet, keep waiting (don't give up)
|
|
23
|
+
if (!editContext?.contentEditorItem) {
|
|
24
|
+
setIsLoading(true);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
setIsLoading(true);
|
|
28
|
+
try {
|
|
29
|
+
const foundWizard = await getWizard(wizardId, editContext.contentEditorItem.descriptor);
|
|
30
|
+
setWizard(foundWizard);
|
|
31
|
+
setParentItem(editContext.contentEditorItem.descriptor);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error("PageWizard: Error loading wizard:", error);
|
|
35
|
+
// If the wizard couldn't be loaded (not found, not valid for context, etc.)
|
|
36
|
+
editContext?.switchView("content-tree", { skipConfirmation: true });
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
setIsLoading(false);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
loadWizard();
|
|
43
|
+
}, [editContext?.contentEditorItem, editContext?.currentWizardId]);
|
|
44
|
+
// Only switch away if we have no wizard AND no wizard ID (i.e., we're not supposed to be here)
|
|
45
|
+
if (!wizard && !editContext?.currentWizardId) {
|
|
46
|
+
console.log("PageWizard - No wizard and no wizard ID, switching to content-tree");
|
|
47
|
+
editContext?.switchView("content-tree", { skipConfirmation: true });
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
// If we have a wizard, render it
|
|
51
|
+
if (wizard && parentItem) {
|
|
52
|
+
return _jsx(WizardSteps, { wizard: wizard, parentItem: parentItem });
|
|
53
|
+
}
|
|
54
|
+
// Still waiting for wizard to load
|
|
55
|
+
return (_jsx("div", { className: "flex h-full items-center justify-center", children: _jsx(Spinner, {}) }));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=PageWizard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageWizard.js","sourceRoot":"","sources":["../src/PageWizard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,OAAO,EAAuC,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAwF5C,MAAM,UAAU,UAAU;IACxB,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAC1D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAwB,IAAI,CAAC,CAAC;IAC1E,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEjD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,WAAW,EAAE,eAAe,CAAC;QAE9C,KAAK,UAAU,UAAU;Y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IAED,iCAAiC;IACjC,IAAI,MAAM,IAAI,UAAU,EAAE,CAAC;QACzB,OAAO,KAAC,WAAW,IAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAI,CAAC;IACjE,CAAC;IAED,mCAAmC;IACnC,OAAO,CACL,cAAK,SAAS,EAAC,yCAAyC,YACtD,KAAC,OAAO,KAAG,GACP,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SplashScreen(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { useEditContext, SplashScreen as DefaultSplashScreen, Card, ActionButton, Spinner, AgentProfilesOverview, loadAiProfiles } from "@parhelia/core";
|
|
4
|
+
import { getWizards } from "./service";
|
|
5
|
+
import { Bot } from "lucide-react";
|
|
6
|
+
export function SplashScreen() {
|
|
7
|
+
const editContext = useEditContext();
|
|
8
|
+
const [demoId, setDemoId] = useState(null);
|
|
9
|
+
const [demoWizard, setDemoWizard] = useState(null);
|
|
10
|
+
const [profiles, setProfiles] = useState(null);
|
|
11
|
+
const [loadingProfiles, setLoadingProfiles] = useState(false);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (typeof window !== "undefined") {
|
|
14
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
15
|
+
const demoIdParam = searchParams.get("demoId");
|
|
16
|
+
setDemoId(demoIdParam);
|
|
17
|
+
}
|
|
18
|
+
}, []);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const loadDemoData = async () => {
|
|
21
|
+
if (!demoId || !editContext)
|
|
22
|
+
return;
|
|
23
|
+
try {
|
|
24
|
+
const wizards = await getWizards({
|
|
25
|
+
id: demoId,
|
|
26
|
+
language: "en",
|
|
27
|
+
version: 0,
|
|
28
|
+
});
|
|
29
|
+
if (wizards && wizards.length > 0) {
|
|
30
|
+
setDemoWizard(wizards[0] || null);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error("Failed to load demo data:", error);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
loadDemoData();
|
|
38
|
+
}, [demoId]);
|
|
39
|
+
// Load AI agent profiles (same behavior as core splash)
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const loadProfiles = async () => {
|
|
42
|
+
try {
|
|
43
|
+
if (!editContext)
|
|
44
|
+
return;
|
|
45
|
+
const itemDescriptor = demoId
|
|
46
|
+
? { id: demoId, language: "en", version: 0 }
|
|
47
|
+
: editContext.currentItemDescriptor || undefined;
|
|
48
|
+
setLoadingProfiles(true);
|
|
49
|
+
const list = await loadAiProfiles(itemDescriptor);
|
|
50
|
+
setProfiles(list || []);
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
console.error("Failed to load AI profiles on splash:", e);
|
|
54
|
+
setProfiles([]);
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
setLoadingProfiles(false);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
loadProfiles();
|
|
61
|
+
}, [editContext?.currentItemDescriptor?.id, demoId]);
|
|
62
|
+
const launchDemoWizard = () => {
|
|
63
|
+
if (!demoWizard || !demoId || !editContext)
|
|
64
|
+
return;
|
|
65
|
+
editContext.executeCommand({
|
|
66
|
+
command: editContext.configuration.extensions["page-wizard"].startWizardCommand,
|
|
67
|
+
data: {
|
|
68
|
+
wizard: demoWizard,
|
|
69
|
+
item: {
|
|
70
|
+
id: demoId,
|
|
71
|
+
language: "en",
|
|
72
|
+
version: 0,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
if (!demoId) {
|
|
78
|
+
return _jsx(DefaultSplashScreen, {});
|
|
79
|
+
}
|
|
80
|
+
if (demoId && !demoWizard) {
|
|
81
|
+
return (_jsxs("div", { className: "relative flex h-full w-full bg-gray-100 md:items-center md:justify-center", children: [_jsx(Spinner, {}), _jsx("div", { className: "bg-wizard absolute inset-0" })] }));
|
|
82
|
+
}
|
|
83
|
+
if (demoWizard) {
|
|
84
|
+
return (_jsxs("div", { className: "relative flex h-full w-full bg-gray-100 md:items-center md:justify-center", children: [_jsxs("div", { className: "mt-2 flex flex-col gap-6 p-4 md:mt-6 md:gap-12", children: [_jsxs("div", { className: "z-10", children: [_jsx("h1", { className: "text-xl font-semibold", children: "Your global website" }), _jsx("div", { className: "text-sm text-gray-500", children: "Add a new page or manage existing ones" })] }), _jsx("div", { className: "z-10 flex flex-1 flex-col items-stretch gap-4 md:max-w-screen-xl md:flex-row", children: _jsx("div", { className: "flex flex-1 flex-col gap-4", children: _jsxs("div", { className: "flex-1 flex-col gap-7 rounded-lg bg-white p-6", children: [_jsxs("div", { className: "flex flex-col gap-4 md:flex-row", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("h1", { className: "text-normal flex items-center gap-2 font-bold", children: "Create content like magic" }), _jsx("h2", { className: "mb-2 text-xs text-gray-500", children: "Stunning business pages in no time. Just describe your idea and let the AI-wizard do the magic." })] }), _jsx(ActionButton, { onClick: launchDemoWizard, children: "Launch wizard" })] }), _jsx("div", { className: "bg-wizard-demo mt-3 aspect-[1.75] w-full rounded-lg" })] }) }) }), _jsx(Card, { title: "AI Agent Profiles", description: "Choose a profile to start a new agent", icon: _jsx(Bot, { strokeWidth: 1 }), className: "w-full md:max-w-screen-xl", children: loadingProfiles ? (_jsx("div", { className: "flex h-80 items-center justify-center text-xs text-gray-500", children: "Loading profiles..." })) : profiles && profiles.length > 0 ? (_jsx(AgentProfilesOverview, { profiles: profiles, onSelectProfile: (profileId) => {
|
|
85
|
+
// Switch to agents overview to show both overview and agents panel
|
|
86
|
+
editContext?.switchView("agents-overview");
|
|
87
|
+
editContext?.setShowAgentsPanel?.(true);
|
|
88
|
+
// Longer delay to allow view switch and Agents panel to mount
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
try {
|
|
91
|
+
const selectedProfile = profiles.find((p) => p.id === profileId);
|
|
92
|
+
window.dispatchEvent(new CustomEvent("editor:addNewAgent", {
|
|
93
|
+
detail: {
|
|
94
|
+
metadata: {
|
|
95
|
+
profile: selectedProfile?.name,
|
|
96
|
+
additionalData: {
|
|
97
|
+
profileId: selectedProfile?.id,
|
|
98
|
+
profileName: selectedProfile?.name,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
catch { }
|
|
105
|
+
}, 500);
|
|
106
|
+
} })) : (_jsx("div", { className: "flex h-80 items-center justify-center text-xs text-gray-500", children: "No agent profiles available" })) })] }), _jsx("div", { className: "bg-wizard absolute inset-0" })] }));
|
|
107
|
+
}
|
|
108
|
+
return _jsx(DefaultSplashScreen, {});
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=SplashScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SplashScreen.js","sourceRoot":"","sources":["../src/SplashScreen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,YAAY,IAAI,mBAAmB,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAkB,MAAM,gBAAgB,CAAC;AACzK,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,MAAM,UAAU,YAAY;IAC1B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAC1D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAgB,IAAI,CA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EAAE,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC;oCACxC,8DAA8D;oCAC9D,UAAU,CAAC,GAAG,EAAE;wCACd,IAAI,CAAC;4CACH,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC;4CACjE,MAAM,CAAC,aAAa,CAClB,IAAI,WAAW,CAAC,oBAAoB,EAAE;gDACpC,MAAM,EAAE;oDACN,QAAQ,EAAE;wDACR,OAAO,EAAE,eAAe,EAAE,IAAI;wDAC9B,cAAc,EAAE;4DACd,SAAS,EAAE,eAAe,EAAE,EAAE;4DAC9B,WAAW,EAAE,eAAe,EAAE,IAAI;yDACnC;qDACF;iDACF;6CACF,CAAC,CACH,CAAC;wCACJ,CAAC;wCAAC,MAAM,CAAC,CAAA,CAAC;oCACZ,CAAC,EAAE,GAAG,CAAC,CAAC;gCACV,CAAC,GACD,CACH,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,6DAA6D,4CAAkC,CAC/G,GACI,IACH,EACN,cAAK,SAAS,EAAC,4BAA4B,GAAG,IAC1C,CACP,CAAC;IACJ,CAAC;IAED,OAAO,KAAC,mBAAmB,KAAG,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@parhelia/core";
|
|
3
|
+
export function WizardBoxConnector({ className, direction, }) {
|
|
4
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn("mt-[-3px] mb-[-3px] flex items-center justify-center", className, (!direction || direction === "horizontal") && "md:hidden"), children: _jsx("svg", { width: "40", height: "31", viewBox: "0 0 40 31", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M40 3.04199C33.8405 3.55018 29 8.70936 29 15C29 21.2906 33.8405 26.4498 40 26.958L40 31L-1.35505e-06 31L-1.18021e-06 27C6.62741 27 12 21.6274 12 15C12 8.37258 6.62741 3 -1.31134e-07 3L0 -1.74846e-06L40 0L40 3.04199Z", fill: "white" }) }) }), _jsx("div", { className: cn("mt-6 mr-[-3px] ml-[-3px] hidden", className, (!direction || direction === "horizontal") && "md:block"), children: _jsx("svg", { className: className, width: "31", height: "40", viewBox: "0 0 31 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M3.04199 0C3.55018 6.15949 8.70936 11 15 11C21.2906 11 26.4498 6.1595 26.958 0H31V40H27C27 33.3726 21.6274 28 15 28C8.37258 28 3 33.3726 3 40H0V0H3.04199Z", fill: "white" }) }) })] }));
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=WizardBoxConnector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardBoxConnector.js","sourceRoot":"","sources":["../src/WizardBoxConnector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,MAAM,UAAU,kBAAkB,CAAC,EACjC,SAAS,EACT,SAAS,GAIV;IACC,OAAO,CACL,8BACE,cACE,SAAS,EAAE,EAAE,CACX,sDAAsD,EACtD,SAAS,EACT,CAAC,CAAC,SAAS,IAAI,SAAS,KAAK,YAAY,CAAC,IAAI,WAAW,CAC1D,YAED,cACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,YAElC,eACE,CAAC,EAAC,yNAAyN,EAC3N,IAAI,EAAC,OAAO,GACZ,GACE,GACF,EAEN,cACE,SAAS,EAAE,EAAE,CACX,iCAAiC,EACjC,SAAS,EACT,CAAC,CAAC,SAAS,IAAI,SAAS,KAAK,YAAY,CAAC,IAAI,UAAU,CACzD,YAED,cACE,SAAS,EAAE,SAAS,EACpB,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,YAElC,eACE,CAAC,EAAC,4JAA4J,EAC9J,IAAI,EAAC,OAAO,GACZ,GACE,GACF,IACL,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Wizard } from "./PageWizard";
|
|
2
|
+
import { type ItemDescriptor } from "@parhelia/core";
|
|
3
|
+
interface WizardStepsProps {
|
|
4
|
+
wizard: Wizard;
|
|
5
|
+
parentItem: ItemDescriptor;
|
|
6
|
+
}
|
|
7
|
+
export declare function WizardSteps({ wizard, parentItem }: WizardStepsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { useEditContext, Button, cn } from "@parhelia/core";
|
|
4
|
+
import { ChevronLeft, ChevronRight, X } from "lucide-react";
|
|
5
|
+
import { useRef, useEffect, useState } from "react";
|
|
6
|
+
import { CollectStep } from "./steps/CollectStep";
|
|
7
|
+
import { LayoutStep } from "./steps/LayoutStep";
|
|
8
|
+
import { BuildPageStep } from "./steps/BuildPageStep";
|
|
9
|
+
import { SelectStep } from "./steps/SelectStep";
|
|
10
|
+
import { ImagesStep } from "./steps/ImagesStep";
|
|
11
|
+
import { ContentStep } from "./steps/ContentStep";
|
|
12
|
+
import { MetaDataStep } from "./steps/MetaDataStep";
|
|
13
|
+
import { FindItemsStep } from "./steps/FindItemsStep";
|
|
14
|
+
import { StructureStep } from "./steps/StructureStep";
|
|
15
|
+
import { TranslateStep } from "./steps/TranslateStep";
|
|
16
|
+
const stepComponents = {
|
|
17
|
+
CollectStep,
|
|
18
|
+
LayoutStep,
|
|
19
|
+
BuildPageStep,
|
|
20
|
+
SelectStep,
|
|
21
|
+
ImagesStep,
|
|
22
|
+
ContentStep,
|
|
23
|
+
MetaDataStep,
|
|
24
|
+
FindItemsStep,
|
|
25
|
+
StructureStep,
|
|
26
|
+
TranslateStep,
|
|
27
|
+
};
|
|
28
|
+
function PreviousButton({ currentStepIndex, wizard, onPrevious, }) {
|
|
29
|
+
if (currentStepIndex === 0)
|
|
30
|
+
return null;
|
|
31
|
+
return (_jsxs(Button, { onClick: onPrevious, variant: "outline", children: [_jsx(ChevronLeft, {}), " ", wizard.steps[currentStepIndex - 1]?.name] }));
|
|
32
|
+
}
|
|
33
|
+
function NextButton({ currentStepIndex, wizard, stepCompleted, onNext, onFinish, }) {
|
|
34
|
+
const isLastStep = currentStepIndex === wizard.steps.length - 1;
|
|
35
|
+
const isDisabled = stepCompleted < currentStepIndex;
|
|
36
|
+
if (isLastStep) {
|
|
37
|
+
return (_jsxs(Button, { disabled: isDisabled, onClick: onFinish, children: ["Finish ", _jsx(ChevronRight, {})] }));
|
|
38
|
+
}
|
|
39
|
+
return (_jsxs(Button, { disabled: isDisabled, onClick: onNext, children: [wizard.steps[currentStepIndex + 1]?.name, _jsx(ChevronRight, {})] }));
|
|
40
|
+
}
|
|
41
|
+
function NavigationSteps({ wizard, currentStepIndex, onStepClick, }) {
|
|
42
|
+
const stepRefs = useRef([]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const activeStepElement = stepRefs.current[currentStepIndex];
|
|
45
|
+
if (activeStepElement) {
|
|
46
|
+
activeStepElement.scrollIntoView({
|
|
47
|
+
behavior: "smooth",
|
|
48
|
+
block: "nearest",
|
|
49
|
+
inline: "center",
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}, [currentStepIndex]);
|
|
53
|
+
return (_jsx("div", { className: "min-w-0 flex-1", children: _jsx("div", { className: "p-2.5 text-xs", children: _jsx("div", { className: "flex items-center gap-3 md:justify-center", children: wizard.steps.map((step, index) => (_jsxs(React.Fragment, { children: [_jsxs("div", { ref: (el) => {
|
|
54
|
+
stepRefs.current[index] = el;
|
|
55
|
+
}, className: cn("flex shrink-0 flex-col items-center gap-1 px-1", currentStepIndex > index && "cursor-pointer"), onClick: () => index < currentStepIndex ? onStepClick(index) : undefined, children: [_jsx("span", { className: cn("relative flex h-6 w-6 shrink-0 items-center justify-center rounded-full border-1 p-2 text-xs font-medium", currentStepIndex === index &&
|
|
56
|
+
"border-theme-secondary text-theme-secondary bg-theme-secondary-light", currentStepIndex < index && "border-gray-400 text-gray-400", currentStepIndex > index &&
|
|
57
|
+
"bg-theme-secondary text-gray-200"), children: currentStepIndex > index ? "✓" : index + 1 }), _jsx("div", { className: cn("max-w-[80px] text-center text-[10px] whitespace-nowrap opacity-100 md:max-w-none md:text-xs", currentStepIndex === index
|
|
58
|
+
? "text-theme-secondary font-semibold"
|
|
59
|
+
: currentStepIndex >= index
|
|
60
|
+
? "text-theme-secondary"
|
|
61
|
+
: "text-gray-400"), children: step.name })] }), index < wizard.steps.length - 1 && (_jsx("div", { className: cn(index < currentStepIndex
|
|
62
|
+
? "border-theme-secondary"
|
|
63
|
+
: "border-gray-400", "mt-[-20px] h-0 w-4 shrink-0 border-t-2 bg-gray-300 md:w-8") }))] }, step.id))) }) }) }));
|
|
64
|
+
}
|
|
65
|
+
function WizardHeader({ wizard, currentStepIndex, onStepClick, onPrevious, onNext, onFinish, onClose, stepCompleted, isMobile, }) {
|
|
66
|
+
return (_jsxs("div", { className: "scrollbar-hide flex w-[100vw] items-center gap-3 overflow-x-auto scroll-smooth border-b border-gray-300 bg-white md:w-auto md:px-4", children: [!isMobile && (_jsx("div", { className: "shrink-0", children: _jsx(PreviousButton, { currentStepIndex: currentStepIndex, wizard: wizard, onPrevious: onPrevious }) })), _jsx(NavigationSteps, { wizard: wizard, currentStepIndex: currentStepIndex, onStepClick: onStepClick }), !isMobile && (_jsx("div", { className: "shrink-0", children: _jsx(NextButton, { currentStepIndex: currentStepIndex, wizard: wizard, stepCompleted: stepCompleted, onNext: onNext, onFinish: onFinish }) })), _jsx("div", { className: "shrink-0", children: _jsx(Button, { onClick: onClose, variant: "outline", size: "sm", children: _jsx(X, { className: "h-4 w-4" }) }) })] }));
|
|
67
|
+
}
|
|
68
|
+
function WizardContent({ currentStep, children }) {
|
|
69
|
+
return (_jsx("div", { className: "relative h-full flex-1 bg-neutral-100", children: _jsxs("div", { className: "h-full p-4 md:p-8", children: [_jsx("div", { className: "relative z-10 h-full", children: _jsxs("div", { className: "flex h-full flex-col gap-6 md:gap-10", children: [_jsx("div", { className: "flex gap-4", children: _jsxs("div", { className: "flex-1 text-neutral-800", children: [_jsx("div", { className: "text-lg font-semibold md:text-xl", children: currentStep?.fields?.title ?? currentStep?.name }), currentStep?.fields?.description && (_jsx("div", { className: "mt-1 text-xs font-light md:text-sm", children: currentStep.fields.description }))] }) }), _jsx("div", { className: "relative flex-1", children: _jsx("div", { className: "absolute inset-0 overflow-auto", children: children }) })] }) }), _jsx("div", { className: "bg-wizard absolute inset-0" })] }) }));
|
|
70
|
+
}
|
|
71
|
+
function MobileNavigationButtons({ currentStepIndex, wizard, stepCompleted, onPrevious, onNext, onFinish, onClose, }) {
|
|
72
|
+
const isLastStep = currentStepIndex === wizard.steps.length - 1;
|
|
73
|
+
const isNextDisabled = stepCompleted < currentStepIndex;
|
|
74
|
+
const showPrevious = currentStepIndex > 0;
|
|
75
|
+
return (_jsx("div", { className: "srcollbar-hide w-[100vw] overflow-x-auto border-t border-gray-300 bg-white px-4 py-3", children: _jsxs("div", { className: "flex gap-3", children: [showPrevious && (_jsxs(Button, { onClick: onPrevious, variant: "outline", className: "flex-1", children: [_jsx(ChevronLeft, { className: "h-4 w-4" }), wizard.steps[currentStepIndex - 1]?.name] })), isLastStep ? (_jsxs(Button, { disabled: isNextDisabled, onClick: onFinish, className: cn("flex-1", !showPrevious && "w-full"), children: ["Finish", _jsx(ChevronRight, { className: "h-4 w-4" })] })) : (_jsxs(Button, { disabled: isNextDisabled, onClick: onNext, className: cn("flex-1", !showPrevious && "w-full"), children: [wizard.steps[currentStepIndex + 1]?.name, _jsx(ChevronRight, { className: "h-4 w-4" })] })), _jsx(Button, { onClick: onClose, variant: "outline", size: "sm", children: _jsx(X, { className: "h-4 w-4" }) })] }) }));
|
|
76
|
+
}
|
|
77
|
+
export function WizardSteps({ wizard, parentItem }) {
|
|
78
|
+
// Local state management instead of pageWizard context
|
|
79
|
+
const [currentStepIndex, setCurrentStepIndex] = useState(0);
|
|
80
|
+
const [data, setData] = useState({
|
|
81
|
+
currentItem: parentItem,
|
|
82
|
+
});
|
|
83
|
+
const [pageModel, setPageModel] = useState({
|
|
84
|
+
components: [],
|
|
85
|
+
name: "",
|
|
86
|
+
metaDescription: "",
|
|
87
|
+
metaKeywords: "",
|
|
88
|
+
fields: [],
|
|
89
|
+
});
|
|
90
|
+
const [internalState, setInternalState] = useState({});
|
|
91
|
+
const [stepCompleted, setStepCompleted] = useState(-1);
|
|
92
|
+
const beforeNextCallbackRef = useRef(null);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
const handleBeforeUnload = (e) => {
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
e.returnValue = "";
|
|
97
|
+
};
|
|
98
|
+
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
99
|
+
return () => {
|
|
100
|
+
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
101
|
+
};
|
|
102
|
+
}, []);
|
|
103
|
+
const editContext = useEditContext();
|
|
104
|
+
const isMobile = editContext?.isMobile ?? false;
|
|
105
|
+
const setBeforeNextCallback = (callback) => {
|
|
106
|
+
beforeNextCallbackRef.current = callback;
|
|
107
|
+
};
|
|
108
|
+
const getCurrentStep = () => {
|
|
109
|
+
const step = wizard.steps[currentStepIndex];
|
|
110
|
+
if (!step)
|
|
111
|
+
return null;
|
|
112
|
+
const type = step.type;
|
|
113
|
+
const stepId = step.id;
|
|
114
|
+
if (!type)
|
|
115
|
+
throw new Error("Step type is required");
|
|
116
|
+
// Extract component name by removing "Page Wizard" prefix and spaces
|
|
117
|
+
const componentName = type.replace("Page Wizard ", "").replace(/\s+/g, "");
|
|
118
|
+
// Get the appropriate component based on the extracted name
|
|
119
|
+
const StepComponent = stepComponents[componentName];
|
|
120
|
+
if (StepComponent) {
|
|
121
|
+
return (_jsx(StepComponent, { step: step, data: data, setData: setData, setPageModel: setPageModel, pageModel: pageModel, wizard: wizard, setStepCompleted: (completed) => {
|
|
122
|
+
if (completed) {
|
|
123
|
+
setStepCompleted((prev) => Math.max(prev, currentStepIndex));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
setStepCompleted(currentStepIndex - 1);
|
|
127
|
+
}
|
|
128
|
+
}, internalState: internalState, setInternalState: setInternalState, parentItem: parentItem }, stepId));
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
};
|
|
132
|
+
const switchStep = (index) => {
|
|
133
|
+
beforeNextCallbackRef.current = null; // Clear callback when switching steps
|
|
134
|
+
if (typeof document.startViewTransition === "function") {
|
|
135
|
+
document.startViewTransition(() => {
|
|
136
|
+
setCurrentStepIndex(index);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
setCurrentStepIndex(index);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const handlePrevious = () => {
|
|
144
|
+
switchStep(currentStepIndex - 1);
|
|
145
|
+
};
|
|
146
|
+
const handleNext = async () => {
|
|
147
|
+
// If there's a beforeNext callback, execute it first
|
|
148
|
+
if (beforeNextCallbackRef.current) {
|
|
149
|
+
console.log("Calling beforeNext callback");
|
|
150
|
+
const canProceed = await beforeNextCallbackRef.current();
|
|
151
|
+
if (!canProceed) {
|
|
152
|
+
return; // Don't proceed if callback returns false
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
console.log("Wizard data object: ", data);
|
|
156
|
+
switchStep(currentStepIndex + 1);
|
|
157
|
+
};
|
|
158
|
+
const handleFinish = () => {
|
|
159
|
+
editContext?.setCurrentWizardId(null);
|
|
160
|
+
editContext?.switchView("page-editor", { skipConfirmation: true });
|
|
161
|
+
};
|
|
162
|
+
const handleClose = () => {
|
|
163
|
+
// If wizard was opened from new-page, go to splash screen instead
|
|
164
|
+
const targetView = editContext?.previousViewName === "new-page"
|
|
165
|
+
? "splash-screen"
|
|
166
|
+
: (editContext?.previousViewName || "content-tree");
|
|
167
|
+
editContext?.switchView(targetView);
|
|
168
|
+
};
|
|
169
|
+
const currentStep = wizard.steps[currentStepIndex];
|
|
170
|
+
if (!currentStep)
|
|
171
|
+
return null;
|
|
172
|
+
return (_jsxs("div", { className: "flex h-full flex-col", children: [_jsx(WizardHeader, { wizard: wizard, currentStepIndex: currentStepIndex, onStepClick: switchStep, onPrevious: handlePrevious, onNext: handleNext, onFinish: handleFinish, onClose: handleClose, stepCompleted: stepCompleted, isMobile: isMobile }), _jsx(WizardContent, { currentStep: currentStep, children: getCurrentStep() }), isMobile && (_jsx(MobileNavigationButtons, { currentStepIndex: currentStepIndex, wizard: wizard, stepCompleted: stepCompleted, onPrevious: handlePrevious, onNext: handleNext, onFinish: handleFinish, onClose: handleClose }))] }));
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=WizardSteps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardSteps.js","sourceRoot":"","sources":["../src/WizardSteps.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,EAAuB,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OA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UAAU,CAAC,CAAC;IACtC,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAEnD,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAE9B,OAAO,CACL,eAAK,SAAS,EAAC,sBAAsB,aACnC,KAAC,YAAY,IACX,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,UAAU,EACvB,UAAU,EAAE,cAAc,EAC1B,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,WAAW,EACpB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,QAAQ,GAClB,EAEF,KAAC,aAAa,IAAC,WAAW,EAAE,WAAW,YACpC,cAAc,EAAE,GACH,EACf,QAAQ,IAAI,CACX,KAAC,uBAAuB,IACtB,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,cAAc,EAC1B,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,WAAW,GACpB,CACH,IACG,CACP,CAAC;AACJ,CAAC"}
|
package/dist/config.d.ts
ADDED
package/dist/config.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PageWizard } from "./PageWizard";
|
|
3
|
+
import { CollectStep } from "./steps/CollectStep";
|
|
4
|
+
import { LayoutStep } from "./steps/LayoutStep";
|
|
5
|
+
import { BuildPageStep } from "./steps/BuildPageStep";
|
|
6
|
+
import { SelectStep } from "./steps/SelectStep";
|
|
7
|
+
import { ImagesStep } from "./steps/ImagesStep";
|
|
8
|
+
import { ContentStep } from "./steps/ContentStep";
|
|
9
|
+
import { MetaDataStep } from "./steps/MetaDataStep";
|
|
10
|
+
import { FindItemsStep } from "./steps/FindItemsStep";
|
|
11
|
+
import { StructureStep } from "./steps/StructureStep";
|
|
12
|
+
import { TranslateStep } from "./steps/TranslateStep";
|
|
13
|
+
import { getWizards } from "./service";
|
|
14
|
+
import { startPageWizardCommand } from "./startPageWizardCommand";
|
|
15
|
+
import { PageWizardIcon } from "@parhelia/core";
|
|
16
|
+
export function configurePageWizards(configuration) {
|
|
17
|
+
// Visible logs (not debug) so they appear without Verbose filtering
|
|
18
|
+
try {
|
|
19
|
+
console.log("[PageWizard] before merge - command keys:", Object.keys(configuration?.commands || {}));
|
|
20
|
+
}
|
|
21
|
+
catch { }
|
|
22
|
+
// Mutate in place for robustness (caller might ignore return value)
|
|
23
|
+
const cfg = configuration;
|
|
24
|
+
cfg.commands = {
|
|
25
|
+
...(cfg.commands || {}),
|
|
26
|
+
[startPageWizardCommand.id]: startPageWizardCommand,
|
|
27
|
+
};
|
|
28
|
+
try {
|
|
29
|
+
console.log("[PageWizard] after merge - command keys:", Object.keys(cfg.commands || {}));
|
|
30
|
+
}
|
|
31
|
+
catch { }
|
|
32
|
+
cfg.extensions = {
|
|
33
|
+
...(cfg.extensions || {}),
|
|
34
|
+
"page-wizard": {
|
|
35
|
+
getWizards,
|
|
36
|
+
startWizardCommand: startPageWizardCommand,
|
|
37
|
+
stepComponents: {
|
|
38
|
+
CollectStep,
|
|
39
|
+
LayoutStep,
|
|
40
|
+
BuildPageStep,
|
|
41
|
+
SelectStep,
|
|
42
|
+
ImagesStep,
|
|
43
|
+
ContentStep,
|
|
44
|
+
MetaDataStep,
|
|
45
|
+
FindItemsStep,
|
|
46
|
+
StructureStep,
|
|
47
|
+
TranslateStep,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
// Ensure the view is present; avoid duplicates
|
|
52
|
+
const views = cfg.editor?.views || [];
|
|
53
|
+
const hasWizardView = views.some((v) => v?.name === "page-wizard");
|
|
54
|
+
if (!hasWizardView) {
|
|
55
|
+
cfg.editor = {
|
|
56
|
+
...(cfg.editor || {}),
|
|
57
|
+
views: [
|
|
58
|
+
...views,
|
|
59
|
+
{
|
|
60
|
+
name: "page-wizard",
|
|
61
|
+
title: "Page Wizard",
|
|
62
|
+
icon: _jsx(PageWizardIcon, {}),
|
|
63
|
+
defaultCenterPanelView: _jsx(PageWizard, {}),
|
|
64
|
+
hideViewSelector: true,
|
|
65
|
+
visible: (editContext) => !!editContext.currentWizardId || editContext.viewName === "page-wizard",
|
|
66
|
+
headerTitle: () => "Page Wizard",
|
|
67
|
+
beforeClose: async (editContext) => {
|
|
68
|
+
return new Promise((resolve) => {
|
|
69
|
+
editContext.confirm({
|
|
70
|
+
showCancel: true,
|
|
71
|
+
showAccept: true,
|
|
72
|
+
header: "Close Page Wizard",
|
|
73
|
+
message: "Are you sure you want to close the page wizard?",
|
|
74
|
+
accept: () => resolve(true),
|
|
75
|
+
reject: () => resolve(false),
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
disableAgentsPanel: true,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return configuration;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO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