@rxdrag/website-studio 0.0.43 → 0.0.45
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/ThemeStudio.d.ts +1 -0
- package/dist/WebsiteStudio.d.ts +1 -1
- package/dist/components/StudioRoot/StudioRoot.d.ts +1 -1
- package/dist/components/StudioRoot/contexts.d.ts +2 -0
- package/dist/components/WebsiteDesigner/Toolbar/index.d.ts +3 -1
- package/dist/components/WebsiteDesigner/index.d.ts +1 -0
- package/dist/components/utils/uploadDeploymentFile.d.ts +1 -0
- package/dist/{cssMode-f11274aa.js → cssMode-8a633359.js} +4 -3
- package/dist/{cssMode-f11274aa.js.map → cssMode-8a633359.js.map} +1 -1
- package/dist/{freemarker2-fa37c278.js → freemarker2-160c0ddc.js} +4 -3
- package/dist/{freemarker2-fa37c278.js.map → freemarker2-160c0ddc.js.map} +1 -1
- package/dist/generator/hooks/useGetFrontComponents.d.ts +2 -0
- package/dist/generator/hooks/useGetPages.d.ts +2 -0
- package/dist/{handlebars-fd006403.js → handlebars-b83294de.js} +4 -3
- package/dist/{handlebars-fd006403.js.map → handlebars-b83294de.js.map} +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useTranslateTheme.d.ts +1 -0
- package/dist/{html-3604e3ba.js → html-e465efce.js} +4 -3
- package/dist/{html-3604e3ba.js.map → html-e465efce.js.map} +1 -1
- package/dist/{htmlMode-89afac94.js → htmlMode-fed923b3.js} +4 -3
- package/dist/{htmlMode-89afac94.js.map → htmlMode-fed923b3.js.map} +1 -1
- package/dist/{index-716d5730.js → index-6ddf2099.js} +196 -213
- package/dist/{index-716d5730.js.map → index-6ddf2099.js.map} +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{javascript-318c4e10.js → javascript-a1dcfc76.js} +5 -4
- package/dist/{javascript-318c4e10.js.map → javascript-a1dcfc76.js.map} +1 -1
- package/dist/{jsonMode-45023839.js → jsonMode-92034391.js} +4 -3
- package/dist/{jsonMode-45023839.js.map → jsonMode-92034391.js.map} +1 -1
- package/dist/{liquid-fc2531a6.js → liquid-8e298ea5.js} +4 -3
- package/dist/{liquid-fc2531a6.js.map → liquid-8e298ea5.js.map} +1 -1
- package/dist/{mdx-91f5933a.js → mdx-65c6fe0f.js} +4 -3
- package/dist/{mdx-91f5933a.js.map → mdx-65c6fe0f.js.map} +1 -1
- package/dist/{python-a455e25d.js → python-55e87814.js} +4 -3
- package/dist/{python-a455e25d.js.map → python-55e87814.js.map} +1 -1
- package/dist/{razor-8f4c02a1.js → razor-34386182.js} +4 -3
- package/dist/{razor-8f4c02a1.js.map → razor-34386182.js.map} +1 -1
- package/dist/{tsMode-b18c77cc.js → tsMode-67ddf297.js} +4 -3
- package/dist/{tsMode-b18c77cc.js.map → tsMode-67ddf297.js.map} +1 -1
- package/dist/{typescript-b387ecba.js → typescript-48be5bbc.js} +4 -3
- package/dist/{typescript-b387ecba.js.map → typescript-48be5bbc.js.map} +1 -1
- package/dist/{xml-df668467.js → xml-1520dcee.js} +4 -3
- package/dist/{xml-df668467.js.map → xml-1520dcee.js.map} +1 -1
- package/dist/{yaml-44a8e644.js → yaml-b01c807c.js} +4 -3
- package/dist/{yaml-44a8e644.js.map → yaml-b01c807c.js.map} +1 -1
- package/package.json +19 -18
- package/dist/components/ConfigDrawer/MultiLangPanel/useTranslateThemeTask.d.ts +0 -7
|
@@ -7,7 +7,7 @@ var __publicField = (obj, key2, value) => {
|
|
|
7
7
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$2, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa;
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import React__default, { createContext, useContext, useMemo, memo, useEffect, useCallback, useState, useRef, forwardRef as forwardRef$2, Component, useImperativeHandle, isValidElement, cloneElement } from "react";
|
|
10
|
-
import { ThemeFields, PageQueryOptions, PageFields, FrontComponentQueryOptions, FrontComponentFields, ComponentCategoryFields, SectionTemplateQueryOptions, SectionTemplateFields, ComponentCategoryQueryOptions, TemplateCategoryQueryOptions, TemplateCategoryFields, ThemeQueryOptions, StyleConfigFields, LangFields, ThemeConfigQueryOptions, ThemeConfigFields, PageAssciations, PageType, ProductCategoryEntityName, ProductCategoryQueryOptions, ProductCategoryFields, ProductQueryOptions, ProductFields, PublishableStatus, websiteToInput, LangQueryOptions, WebsiteAssciations, ExtendFieldType, ThemeConfigAssciations, MediaQueryOptions, WebsiteSettingsQueryOptions, WebsiteSettingsFields, themeConfigToInputCascade, ThemeConfigEntityName, MediaType, themeConfigToInput, websiteSettingsToInput, WebsiteSettingsEntityName, WebsiteSettingsAssciations, PageEntityName, ThemeEntityName, themeToInputCascade, ThemeCategoryFields, themeToInput, frontComponentToInput, sectionTemplateToInput, pageToInputCascade, ComponentCategoryEntityName, SectionTemplateEntityName, FrontComponentEntityName, PageMetaFields, pageToInput, PageMetaAssciations, componentCategoryToInput, TemplateCategoryEntityName, templateCategoryToInput } from "@rxdrag/rxcms-models";
|
|
10
|
+
import { ThemeFields, PageQueryOptions, PageFields, FrontComponentQueryOptions, FrontComponentFields, ComponentCategoryFields, SectionTemplateQueryOptions, SectionTemplateFields, ComponentCategoryQueryOptions, TemplateCategoryQueryOptions, TemplateCategoryFields, ThemeQueryOptions, StyleConfigFields, LangFields, ThemeConfigQueryOptions, ThemeConfigFields, PageAssciations, PageType, ProductCategoryEntityName, ProductCategoryQueryOptions, ProductCategoryFields, ProductQueryOptions, ProductFields, PublishableStatus, websiteToInput, TaskOwner, LangQueryOptions, WebsiteAssciations, ExtendFieldType, ThemeConfigAssciations, MediaQueryOptions, WebsiteSettingsQueryOptions, WebsiteSettingsFields, themeConfigToInputCascade, ThemeConfigEntityName, MediaType, themeConfigToInput, websiteSettingsToInput, WebsiteSettingsEntityName, WebsiteSettingsAssciations, PageEntityName, ThemeEntityName, themeToInputCascade, ThemeCategoryFields, themeToInput, frontComponentToInput, sectionTemplateToInput, pageToInputCascade, ComponentCategoryEntityName, SectionTemplateEntityName, FrontComponentEntityName, PageMetaFields, pageToInput, PageMetaAssciations, componentCategoryToInput, TemplateCategoryEntityName, templateCategoryToInput } from "@rxdrag/rxcms-models";
|
|
11
11
|
import { GlobalLoading, EntityForm, SubmitButton, useListData, SearchInput, EntityPagination, useIsLoading, QueryListScope, useRemoveRow, useEditRow, EntityEditModal, useSelectionsState, EntityTable, EntityListScope, NewButton, EntityRowScope, EntitySelectField, useNewRow } from "@rxdrag/rxcms-models-ui";
|
|
12
12
|
import { useOneTheme, usePageList, useTemplateCategoryList, useSectionTemplateList, useComponentCategoryList, useFrontComponentList, useOneThemeById, useUpsertOneWebsite, useDeleteThemeById, useUpsertOneTheme, useLangList, useOneWebsiteSettings, useOneThemeConfig, useUpsertOneThemeConfig, useUpsertOneWebsiteSettings, useUpsertOnePage, useUpsertOneFrontComponent, useUpsertOneSectionTemplate, useDeletePageById } from "@rxdrag/rxcms-model-hooks";
|
|
13
13
|
import { newPageMetaOptions, useWebsite, useCurrentLang, ComponentType, currentLangState, useCurrentLangId, MediaSingleSelectField, FullImageSelectField, useSiteId, usePreviewUrl, LangSelect, TitleAndSlug, TitleViewField, DescriptionViewField, SiteRoot } from "@rxdrag/biz-components";
|
|
@@ -18,9 +18,9 @@ import { NodeMountedEvent, RXID_ATTR_NAME, HistoryableActionType, IFrameCanvasIm
|
|
|
18
18
|
import { useVariables, useExecuteExpression, VariableProvider, expressionAndName, expressionTernaryName, expressionLoopName, useViewKey, createSchema, ENTIFY_SERVER_URL, staticMaterials, ViewKeyProvider, slotContentName, expressionName } from "@rxdrag/website-materials";
|
|
19
19
|
import { isHTMLElement as isHTMLElement$1, isStr } from "@rxdrag/shared";
|
|
20
20
|
import { isFunction as isFunction$2, debounce, keys, uniqueId } from "lodash-es";
|
|
21
|
-
import { useEntifyEndpoint, useEntifyToken, useLazyQueryEntityList, useLazyQueryOneEntity,
|
|
21
|
+
import { useEntifyEndpoint, useEntifyToken, useLazyQueryEntityList, useLazyQueryOneEntity, emitEntityChange, useCreateEntityClient } from "@rxdrag/entify-hooks";
|
|
22
22
|
import dayjs from "dayjs";
|
|
23
|
-
import { ErrorBoundary, ColorPicker, useSave, CheckCircleIcon as CheckCircleIcon$1, CloseIcon, ModalBody, AddIcon as AddIcon$1,
|
|
23
|
+
import { ErrorBoundary, ColorPicker, useSave, CheckCircleIcon as CheckCircleIcon$1, CloseIcon, ModalBody, AddIcon as AddIcon$1, AiStarIcon, ConfirmDialog, SettingsIcon, ModalFooter, FavouriteIcon, LightIcon, DarkIcon, EditIcon, TextInput, Drawer, ModalHeader, ModalClose, SearchIcon, ModalContent as ModalContent$1, Modal as Modal$1, ModalOverlay as ModalOverlay$1, MonacoEditor, getTheFile, MoreIcon, LanguageIcon, SeoIcon, AiIcon, SettingsMinimalisticIcon, CodeSquareIcon, DownloadIcon, UploadIcon, StyledTooltip, PlayIcon, Logo, GlobalIcon, SnsIcon, LightBoltIcon, WarningIcon, PinIcon, PredefinedColorPicker, PagesIcon, WidgetIcon, LeafNode, GroupNode, TreeView, DesignIcon, RemoveIcon, ResetIcon, TaskStopIcon, ImportIcon, AstroIcon, AddFolderIcon, TemplateIcon, AddTemplateIcon } from "@rxdrag/rxcms-common";
|
|
24
24
|
import { PageLoader, PopoverController, ModalController, AnimateController, TabsController, NumberController, FlipController, CollapseController, AosController } from "@rxdrag/website-lib-core";
|
|
25
25
|
import gsap$2 from "gsap";
|
|
26
26
|
import { Input, Textarea, StringArrayInput, ImageSelect, TargetSetter, propSetters, DeviceBreakpoints, DeviceContext } from "@rxdrag/schema-setters";
|
|
@@ -29,8 +29,8 @@ import { useEntifyWrapperStore, useUpsertEntityWithIndicator } from "@rxdrag/rxc
|
|
|
29
29
|
import JSZip from "jszip";
|
|
30
30
|
import { create as create$4 } from "zustand";
|
|
31
31
|
import { Icon } from "@iconify/react";
|
|
32
|
-
import { useInprogressTaskByKey, useUpdateTask, taskPool, TranslateThemeTask, TaskManager, ResetPageTask, ImportPagesTask, ImportComponentsTask } from "@rxdrag/ai-tasks";
|
|
33
32
|
import { useAiUrl, useAiAgent, AiWidget, AiAgentRoot } from "@rxdrag/ai-agent";
|
|
33
|
+
import { createHttpClient } from "@rxdrag/entify-lib";
|
|
34
34
|
import { InputField, TextareaField, toField, ColorField, SwitchField, SelectField, PasswordField, Form } from "@rxdrag/fieldy-heroui";
|
|
35
35
|
import { ObjectField, useFormValue, useForm, VirtualForm } from "@rxdrag/react-fieldy-pro";
|
|
36
36
|
import "react-colorful";
|
|
@@ -38,6 +38,7 @@ import { motion, AnimatePresence, LazyMotion, m } from "framer-motion";
|
|
|
38
38
|
import $4AOtR$reactdom, { createPortal } from "react-dom";
|
|
39
39
|
import { DeployType, useExportWebsite as useExportWebsite$1 } from "@rxdrag/code-generator";
|
|
40
40
|
import { ComponentRender } from "@rxdrag/react-runner-pro";
|
|
41
|
+
import { TaskManager, useInprogressTaskByKey, useUpdateTask, taskPool, ResetPageTask, ImportPagesTask, ImportComponentsTask } from "@rxdrag/ai-tasks";
|
|
41
42
|
import tinycolor from "tinycolor2";
|
|
42
43
|
var jsxRuntime = { exports: {} };
|
|
43
44
|
var reactJsxRuntime_production_min = {};
|
|
@@ -1280,7 +1281,7 @@ function newComponentCategoryQueryOptions(themeId) {
|
|
|
1280
1281
|
}
|
|
1281
1282
|
function StudioRoot(props) {
|
|
1282
1283
|
var _a3, _b3;
|
|
1283
|
-
const { theme,
|
|
1284
|
+
const { theme, deployUrl, children } = props;
|
|
1284
1285
|
const website = useWebsite();
|
|
1285
1286
|
const { data: baseLangThemeData, isLoading: baseLangThemeLoading } = useOneTheme(
|
|
1286
1287
|
new ThemeQueryOptions([ThemeFields.id, ThemeFields.parentThemeId], {
|
|
@@ -1409,20 +1410,9 @@ function StudioRoot(props) {
|
|
|
1409
1410
|
parentTheme,
|
|
1410
1411
|
baseLangThemeId: baseLangThemeData == null ? void 0 : baseLangThemeData.id,
|
|
1411
1412
|
loading,
|
|
1412
|
-
|
|
1413
|
+
deployUrl
|
|
1413
1414
|
};
|
|
1414
|
-
}, [
|
|
1415
|
-
theme,
|
|
1416
|
-
templateCategories,
|
|
1417
|
-
templatesData == null ? void 0 : templatesData.items,
|
|
1418
|
-
componentCategories,
|
|
1419
|
-
componentsData == null ? void 0 : componentsData.items,
|
|
1420
|
-
pagesData == null ? void 0 : pagesData.items,
|
|
1421
|
-
parentTheme,
|
|
1422
|
-
baseLangThemeData == null ? void 0 : baseLangThemeData.id,
|
|
1423
|
-
loading,
|
|
1424
|
-
previewUrl
|
|
1425
|
-
]);
|
|
1415
|
+
}, [theme, templateCategories, templatesData == null ? void 0 : templatesData.items, componentCategories, componentsData == null ? void 0 : componentsData.items, pagesData == null ? void 0 : pagesData.items, parentTheme, baseLangThemeData == null ? void 0 : baseLangThemeData.id, loading, deployUrl]);
|
|
1426
1416
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(StudioContext.Provider, { value: studioData, children: [
|
|
1427
1417
|
children,
|
|
1428
1418
|
/* @__PURE__ */ jsxRuntimeExports.jsx(GlobalLoading, { loading })
|
|
@@ -6592,53 +6582,116 @@ function LangCard(props) {
|
|
|
6592
6582
|
}
|
|
6593
6583
|
);
|
|
6594
6584
|
}
|
|
6595
|
-
const
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
const
|
|
6601
|
-
const
|
|
6602
|
-
const
|
|
6603
|
-
const
|
|
6604
|
-
const
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6585
|
+
const defaultSchema = {
|
|
6586
|
+
componentName: "Root"
|
|
6587
|
+
};
|
|
6588
|
+
const emptyValue = { schema: void 0, config: void 0 };
|
|
6589
|
+
function useSchema(selectedContent) {
|
|
6590
|
+
const [schema, setSchema] = useState(emptyValue);
|
|
6591
|
+
const components = useFrontComponents();
|
|
6592
|
+
const pages = usePages();
|
|
6593
|
+
const componentsRef = useRef(components);
|
|
6594
|
+
const pagesRef = useRef(pages);
|
|
6595
|
+
componentsRef.current = components;
|
|
6596
|
+
pagesRef.current = pages;
|
|
6597
|
+
const templates = useTemplates();
|
|
6598
|
+
const templatesRef = useRef(templates);
|
|
6599
|
+
templatesRef.current = templates;
|
|
6600
|
+
useEffect(() => {
|
|
6601
|
+
var _a3, _b3, _c2, _d2, _e2, _f2, _g2, _h2, _i3, _j2;
|
|
6602
|
+
let code;
|
|
6603
|
+
let hasContent = false;
|
|
6604
|
+
let defaultConfig2;
|
|
6605
|
+
if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.Component) {
|
|
6606
|
+
const component = (_a3 = componentsRef.current) == null ? void 0 : _a3.find(
|
|
6607
|
+
(component2) => component2.id === selectedContent.id
|
|
6608
|
+
);
|
|
6609
|
+
if (component) {
|
|
6610
|
+
code = component.code;
|
|
6611
|
+
hasContent = true;
|
|
6612
|
+
}
|
|
6613
|
+
} else if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.PredefinedPage || (selectedContent == null ? void 0 : selectedContent.type) === ContentType.Page) {
|
|
6614
|
+
const page = (_b3 = pagesRef.current) == null ? void 0 : _b3.find(
|
|
6615
|
+
(item) => item.id === selectedContent.id
|
|
6616
|
+
);
|
|
6617
|
+
defaultConfig2 = {
|
|
6618
|
+
pageMeta: {
|
|
6619
|
+
seoTitle: (_c2 = page == null ? void 0 : page.meta) == null ? void 0 : _c2.seoTitle,
|
|
6620
|
+
seoDescription: (_d2 = page == null ? void 0 : page.meta) == null ? void 0 : _d2.seoDescription,
|
|
6621
|
+
seoKeywords: (_e2 = page == null ? void 0 : page.meta) == null ? void 0 : _e2.seoKeywords,
|
|
6622
|
+
ogTitle: (_f2 = page == null ? void 0 : page.meta) == null ? void 0 : _f2.ogTitle,
|
|
6623
|
+
ogDescription: (_g2 = page == null ? void 0 : page.meta) == null ? void 0 : _g2.ogDescription,
|
|
6624
|
+
ogType: (_h2 = page == null ? void 0 : page.meta) == null ? void 0 : _h2.ogType,
|
|
6625
|
+
ogImage: (_i3 = page == null ? void 0 : page.meta) == null ? void 0 : _i3.ogImage
|
|
6626
|
+
}
|
|
6627
|
+
};
|
|
6628
|
+
if (page) {
|
|
6629
|
+
code = page.code;
|
|
6630
|
+
hasContent = true;
|
|
6631
|
+
}
|
|
6632
|
+
} else if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.Template) {
|
|
6633
|
+
const template = (_j2 = templatesRef.current) == null ? void 0 : _j2.find(
|
|
6634
|
+
(template2) => template2.id === selectedContent.id
|
|
6635
|
+
);
|
|
6636
|
+
if (template) {
|
|
6637
|
+
code = template.code;
|
|
6638
|
+
hasContent = true;
|
|
6639
|
+
}
|
|
6620
6640
|
}
|
|
6621
|
-
if (
|
|
6622
|
-
|
|
6623
|
-
|
|
6641
|
+
if (code) {
|
|
6642
|
+
transformCodeToSchema(code).then((value) => {
|
|
6643
|
+
setSchema({
|
|
6644
|
+
schema: { ...defaultSchema, children: (value == null ? void 0 : value.template) || [] },
|
|
6645
|
+
config: { ...defaultConfig2, ...value.resources }
|
|
6646
|
+
});
|
|
6647
|
+
});
|
|
6648
|
+
} else if (hasContent) {
|
|
6649
|
+
setSchema({
|
|
6650
|
+
schema: { ...defaultSchema, children: [] }
|
|
6651
|
+
});
|
|
6624
6652
|
}
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6653
|
+
}, [selectedContent == null ? void 0 : selectedContent.id, selectedContent == null ? void 0 : selectedContent.type]);
|
|
6654
|
+
console.log("===>schema", schema);
|
|
6655
|
+
return schema;
|
|
6656
|
+
}
|
|
6657
|
+
function useCloseDrawer() {
|
|
6658
|
+
const setDrawerType = useStudioStore((state) => state.setDrawerType);
|
|
6659
|
+
const drawerDocked = useStudioStore((state) => state.drawerDocked);
|
|
6660
|
+
const close = useCallback(() => {
|
|
6661
|
+
if (!drawerDocked) {
|
|
6662
|
+
setDrawerType(void 0);
|
|
6628
6663
|
}
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6664
|
+
}, [drawerDocked, setDrawerType]);
|
|
6665
|
+
return close;
|
|
6666
|
+
}
|
|
6667
|
+
function useIsBaseLangTheme() {
|
|
6668
|
+
var _a3, _b3;
|
|
6669
|
+
const theme = useStudioTheme();
|
|
6670
|
+
const website = useWebsite();
|
|
6671
|
+
return ((_a3 = theme == null ? void 0 : theme.lang) == null ? void 0 : _a3.id) === ((_b3 = website == null ? void 0 : website.baseLang) == null ? void 0 : _b3.id);
|
|
6672
|
+
}
|
|
6673
|
+
function useTranslateTheme() {
|
|
6674
|
+
const baseURL = useAiUrl();
|
|
6675
|
+
const token = useEntifyToken();
|
|
6676
|
+
const website = useWebsite();
|
|
6677
|
+
const translate = useCallback(
|
|
6678
|
+
async (langId, title) => {
|
|
6679
|
+
if (!token || !(website == null ? void 0 : website.id)) {
|
|
6680
|
+
console.error("No token or website id");
|
|
6681
|
+
return;
|
|
6682
|
+
}
|
|
6683
|
+
const http = createHttpClient({ baseURL, token });
|
|
6684
|
+
const response = await http.post("/api/translate-theme", {
|
|
6685
|
+
websiteId: website == null ? void 0 : website.id,
|
|
6686
|
+
langId,
|
|
6687
|
+
title,
|
|
6688
|
+
taskOwnerType: TaskOwner.Studio
|
|
6689
|
+
});
|
|
6690
|
+
console.log("translate response", response);
|
|
6691
|
+
},
|
|
6692
|
+
[baseURL, token, website == null ? void 0 : website.id]
|
|
6693
|
+
);
|
|
6694
|
+
return translate;
|
|
6642
6695
|
}
|
|
6643
6696
|
const linkTypes = [
|
|
6644
6697
|
{
|
|
@@ -6709,7 +6762,7 @@ function MultiLangPanel() {
|
|
|
6709
6762
|
var _a3, _b3, _c2, _d2, _e2, _f2;
|
|
6710
6763
|
const [linkType, setLinkType] = useState("subdomain");
|
|
6711
6764
|
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
6712
|
-
const [
|
|
6765
|
+
const [currentLangId, setCurrentLangId] = useCurrentLangId();
|
|
6713
6766
|
const selectedContent = useStudioStore((state) => state.selectedContent);
|
|
6714
6767
|
const setSelectedContent = useStudioStore(
|
|
6715
6768
|
(state) => state.setSelectedContent
|
|
@@ -6717,13 +6770,13 @@ function MultiLangPanel() {
|
|
|
6717
6770
|
const website = useWebsite();
|
|
6718
6771
|
const isChanginBaseLangRef = useRef(false);
|
|
6719
6772
|
const [upsertTheme, { isMutating: isCreating }] = useUpsertOneTheme();
|
|
6720
|
-
const
|
|
6773
|
+
const translateTheme = useTranslateTheme();
|
|
6721
6774
|
useEffect(() => {
|
|
6722
6775
|
var _a4;
|
|
6723
|
-
if (website && !
|
|
6724
|
-
|
|
6776
|
+
if (website && !currentLangId) {
|
|
6777
|
+
setCurrentLangId((_a4 = website.baseLang) == null ? void 0 : _a4.id);
|
|
6725
6778
|
}
|
|
6726
|
-
}, [
|
|
6779
|
+
}, [currentLangId, setCurrentLangId, website]);
|
|
6727
6780
|
const { data: allLangs, isLoading: allLangsLoading } = useLangList(
|
|
6728
6781
|
new LangQueryOptions([
|
|
6729
6782
|
LangFields.id,
|
|
@@ -6756,12 +6809,12 @@ function MultiLangPanel() {
|
|
|
6756
6809
|
);
|
|
6757
6810
|
const handleLangSelect = useCallback(
|
|
6758
6811
|
(langId) => {
|
|
6759
|
-
|
|
6760
|
-
if ((selectedContent == null ? void 0 : selectedContent.id) && langId !==
|
|
6812
|
+
setCurrentLangId(langId);
|
|
6813
|
+
if ((selectedContent == null ? void 0 : selectedContent.id) && langId !== currentLangId) {
|
|
6761
6814
|
setSelectedContent(void 0);
|
|
6762
6815
|
}
|
|
6763
6816
|
},
|
|
6764
|
-
[selectedContent == null ? void 0 : selectedContent.id,
|
|
6817
|
+
[selectedContent == null ? void 0 : selectedContent.id, setCurrentLangId, setSelectedContent, currentLangId]
|
|
6765
6818
|
);
|
|
6766
6819
|
const leftLangs = useMemo(() => {
|
|
6767
6820
|
var _a4;
|
|
@@ -6804,16 +6857,22 @@ function MultiLangPanel() {
|
|
|
6804
6857
|
const handleTranslate = useCallback(() => {
|
|
6805
6858
|
setConfirmOpen(true);
|
|
6806
6859
|
}, []);
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
}, [task]);
|
|
6860
|
+
useCallback(() => {
|
|
6861
|
+
}, []);
|
|
6810
6862
|
const handleCloseConfirm = useCallback(() => {
|
|
6811
6863
|
setConfirmOpen(false);
|
|
6812
6864
|
}, []);
|
|
6813
6865
|
const handleConfirm = useCallback(() => {
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6866
|
+
var _a4;
|
|
6867
|
+
if (!currentLangId) {
|
|
6868
|
+
console.error("No currentLang");
|
|
6869
|
+
return;
|
|
6870
|
+
}
|
|
6871
|
+
const lang = (_a4 = allLangs == null ? void 0 : allLangs.items) == null ? void 0 : _a4.find((lang2) => lang2.id === currentLangId);
|
|
6872
|
+
const title = `网站代码翻译到:${(lang == null ? void 0 : lang.cnName) || (lang == null ? void 0 : lang.enName) || (lang == null ? void 0 : lang.localName) || (lang == null ? void 0 : lang.abbr) || ""}`;
|
|
6873
|
+
translateTheme(currentLangId, title);
|
|
6874
|
+
}, [translateTheme, currentLangId, allLangs == null ? void 0 : allLangs.items]);
|
|
6875
|
+
const isRunning = false;
|
|
6817
6876
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
6818
6877
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ModalBody, { className: "flex-1 p-4 min-h-0 overflow-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
6819
6878
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { className: "bg-default-50", children: [
|
|
@@ -6873,7 +6932,7 @@ function MultiLangPanel() {
|
|
|
6873
6932
|
LangCard,
|
|
6874
6933
|
{
|
|
6875
6934
|
lang,
|
|
6876
|
-
isSelected:
|
|
6935
|
+
isSelected: currentLangId === lang.id,
|
|
6877
6936
|
isBaseLang: ((_a4 = website == null ? void 0 : website.baseLang) == null ? void 0 : _a4.id) === lang.id,
|
|
6878
6937
|
onSelect: handleLangSelect
|
|
6879
6938
|
},
|
|
@@ -6921,23 +6980,15 @@ function MultiLangPanel() {
|
|
|
6921
6980
|
] })
|
|
6922
6981
|
] }),
|
|
6923
6982
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-6 flex items-center justify-between", children: [
|
|
6924
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-default-500"
|
|
6983
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-default-500" }),
|
|
6925
6984
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-2", children: [
|
|
6926
|
-
isRunning
|
|
6927
|
-
Button$2,
|
|
6928
|
-
{
|
|
6929
|
-
variant: "flat",
|
|
6930
|
-
startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(TaskStopIcon, { className: "size-5" }),
|
|
6931
|
-
onPress: handleStop,
|
|
6932
|
-
children: "停止"
|
|
6933
|
-
}
|
|
6934
|
-
),
|
|
6985
|
+
isRunning,
|
|
6935
6986
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6936
6987
|
Button$2,
|
|
6937
6988
|
{
|
|
6938
6989
|
color: "primary",
|
|
6939
6990
|
startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiStarIcon, { className: "size-5" }),
|
|
6940
|
-
isDisabled:
|
|
6991
|
+
isDisabled: currentLangId === ((_d2 = website == null ? void 0 : website.baseLang) == null ? void 0 : _d2.id),
|
|
6941
6992
|
isLoading: isRunning,
|
|
6942
6993
|
onPress: handleTranslate,
|
|
6943
6994
|
children: "翻译 & 重置"
|
|
@@ -138172,7 +138223,7 @@ registerLanguage({
|
|
|
138172
138223
|
aliases: ["FreeMarker2", "Apache FreeMarker2"],
|
|
138173
138224
|
loader: () => {
|
|
138174
138225
|
{
|
|
138175
|
-
return import("./freemarker2-
|
|
138226
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagAutoInterpolationDollar);
|
|
138176
138227
|
}
|
|
138177
138228
|
}
|
|
138178
138229
|
});
|
|
@@ -138181,7 +138232,7 @@ registerLanguage({
|
|
|
138181
138232
|
aliases: ["FreeMarker2 (Angle/Dollar)", "Apache FreeMarker2 (Angle/Dollar)"],
|
|
138182
138233
|
loader: () => {
|
|
138183
138234
|
{
|
|
138184
|
-
return import("./freemarker2-
|
|
138235
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagAngleInterpolationDollar);
|
|
138185
138236
|
}
|
|
138186
138237
|
}
|
|
138187
138238
|
});
|
|
@@ -138190,7 +138241,7 @@ registerLanguage({
|
|
|
138190
138241
|
aliases: ["FreeMarker2 (Bracket/Dollar)", "Apache FreeMarker2 (Bracket/Dollar)"],
|
|
138191
138242
|
loader: () => {
|
|
138192
138243
|
{
|
|
138193
|
-
return import("./freemarker2-
|
|
138244
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagBracketInterpolationDollar);
|
|
138194
138245
|
}
|
|
138195
138246
|
}
|
|
138196
138247
|
});
|
|
@@ -138199,7 +138250,7 @@ registerLanguage({
|
|
|
138199
138250
|
aliases: ["FreeMarker2 (Angle/Bracket)", "Apache FreeMarker2 (Angle/Bracket)"],
|
|
138200
138251
|
loader: () => {
|
|
138201
138252
|
{
|
|
138202
|
-
return import("./freemarker2-
|
|
138253
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagAngleInterpolationBracket);
|
|
138203
138254
|
}
|
|
138204
138255
|
}
|
|
138205
138256
|
});
|
|
@@ -138208,7 +138259,7 @@ registerLanguage({
|
|
|
138208
138259
|
aliases: ["FreeMarker2 (Bracket/Bracket)", "Apache FreeMarker2 (Bracket/Bracket)"],
|
|
138209
138260
|
loader: () => {
|
|
138210
138261
|
{
|
|
138211
|
-
return import("./freemarker2-
|
|
138262
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagBracketInterpolationBracket);
|
|
138212
138263
|
}
|
|
138213
138264
|
}
|
|
138214
138265
|
});
|
|
@@ -138217,7 +138268,7 @@ registerLanguage({
|
|
|
138217
138268
|
aliases: ["FreeMarker2 (Auto/Dollar)", "Apache FreeMarker2 (Auto/Dollar)"],
|
|
138218
138269
|
loader: () => {
|
|
138219
138270
|
{
|
|
138220
|
-
return import("./freemarker2-
|
|
138271
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagAutoInterpolationDollar);
|
|
138221
138272
|
}
|
|
138222
138273
|
}
|
|
138223
138274
|
});
|
|
@@ -138226,7 +138277,7 @@ registerLanguage({
|
|
|
138226
138277
|
aliases: ["FreeMarker2 (Auto/Bracket)", "Apache FreeMarker2 (Auto/Bracket)"],
|
|
138227
138278
|
loader: () => {
|
|
138228
138279
|
{
|
|
138229
|
-
return import("./freemarker2-
|
|
138280
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagAutoInterpolationBracket);
|
|
138230
138281
|
}
|
|
138231
138282
|
}
|
|
138232
138283
|
});
|
|
@@ -138276,7 +138327,7 @@ registerLanguage({
|
|
|
138276
138327
|
mimetypes: ["text/x-handlebars-template"],
|
|
138277
138328
|
loader: () => {
|
|
138278
138329
|
{
|
|
138279
|
-
return import("./handlebars-
|
|
138330
|
+
return import("./handlebars-b83294de.js");
|
|
138280
138331
|
}
|
|
138281
138332
|
}
|
|
138282
138333
|
});
|
|
@@ -138309,7 +138360,7 @@ registerLanguage({
|
|
|
138309
138360
|
mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
|
|
138310
138361
|
loader: () => {
|
|
138311
138362
|
{
|
|
138312
|
-
return import("./html-
|
|
138363
|
+
return import("./html-e465efce.js");
|
|
138313
138364
|
}
|
|
138314
138365
|
}
|
|
138315
138366
|
});
|
|
@@ -138362,7 +138413,7 @@ registerLanguage({
|
|
|
138362
138413
|
mimetypes: ["text/javascript"],
|
|
138363
138414
|
loader: () => {
|
|
138364
138415
|
{
|
|
138365
|
-
return import("./javascript-
|
|
138416
|
+
return import("./javascript-a1dcfc76.js");
|
|
138366
138417
|
}
|
|
138367
138418
|
}
|
|
138368
138419
|
});
|
|
@@ -138461,7 +138512,7 @@ registerLanguage({
|
|
|
138461
138512
|
mimetypes: ["application/liquid"],
|
|
138462
138513
|
loader: () => {
|
|
138463
138514
|
{
|
|
138464
|
-
return import("./liquid-
|
|
138515
|
+
return import("./liquid-8e298ea5.js");
|
|
138465
138516
|
}
|
|
138466
138517
|
}
|
|
138467
138518
|
});
|
|
@@ -138509,7 +138560,7 @@ registerLanguage({
|
|
|
138509
138560
|
aliases: ["MDX", "mdx"],
|
|
138510
138561
|
loader: () => {
|
|
138511
138562
|
{
|
|
138512
|
-
return import("./mdx-
|
|
138563
|
+
return import("./mdx-65c6fe0f.js");
|
|
138513
138564
|
}
|
|
138514
138565
|
}
|
|
138515
138566
|
});
|
|
@@ -138768,7 +138819,7 @@ registerLanguage({
|
|
|
138768
138819
|
firstLine: "^#!/.*\\bpython[0-9.-]*\\b",
|
|
138769
138820
|
loader: () => {
|
|
138770
138821
|
{
|
|
138771
|
-
return import("./python-
|
|
138822
|
+
return import("./python-55e87814.js");
|
|
138772
138823
|
}
|
|
138773
138824
|
}
|
|
138774
138825
|
});
|
|
@@ -138817,7 +138868,7 @@ registerLanguage({
|
|
|
138817
138868
|
mimetypes: ["text/x-cshtml"],
|
|
138818
138869
|
loader: () => {
|
|
138819
138870
|
{
|
|
138820
|
-
return import("./razor-
|
|
138871
|
+
return import("./razor-34386182.js");
|
|
138821
138872
|
}
|
|
138822
138873
|
}
|
|
138823
138874
|
});
|
|
@@ -139153,7 +139204,7 @@ registerLanguage({
|
|
|
139153
139204
|
mimetypes: ["text/typescript"],
|
|
139154
139205
|
loader: () => {
|
|
139155
139206
|
{
|
|
139156
|
-
return import("./typescript-
|
|
139207
|
+
return import("./typescript-48be5bbc.js");
|
|
139157
139208
|
}
|
|
139158
139209
|
}
|
|
139159
139210
|
});
|
|
@@ -139237,7 +139288,7 @@ registerLanguage({
|
|
|
139237
139288
|
mimetypes: ["text/xml", "application/xml", "application/xaml+xml", "application/xml-dtd"],
|
|
139238
139289
|
loader: () => {
|
|
139239
139290
|
{
|
|
139240
|
-
return import("./xml-
|
|
139291
|
+
return import("./xml-1520dcee.js");
|
|
139241
139292
|
}
|
|
139242
139293
|
}
|
|
139243
139294
|
});
|
|
@@ -139254,7 +139305,7 @@ registerLanguage({
|
|
|
139254
139305
|
mimetypes: ["application/x-yaml", "text/x-yaml"],
|
|
139255
139306
|
loader: () => {
|
|
139256
139307
|
{
|
|
139257
|
-
return import("./yaml-
|
|
139308
|
+
return import("./yaml-b01c807c.js");
|
|
139258
139309
|
}
|
|
139259
139310
|
}
|
|
139260
139311
|
});
|
|
@@ -139378,7 +139429,7 @@ var lessDefaults = new LanguageServiceDefaultsImpl$3(
|
|
|
139378
139429
|
monaco_editor_core_exports$3.languages.css = { cssDefaults, lessDefaults, scssDefaults };
|
|
139379
139430
|
function getMode$3() {
|
|
139380
139431
|
{
|
|
139381
|
-
return import("./cssMode-
|
|
139432
|
+
return import("./cssMode-8a633359.js");
|
|
139382
139433
|
}
|
|
139383
139434
|
}
|
|
139384
139435
|
monaco_editor_core_exports$3.languages.onLanguage("less", () => {
|
|
@@ -139509,7 +139560,7 @@ monaco_editor_core_exports$2.languages.html = {
|
|
|
139509
139560
|
};
|
|
139510
139561
|
function getMode$2() {
|
|
139511
139562
|
{
|
|
139512
|
-
return import("./htmlMode-
|
|
139563
|
+
return import("./htmlMode-fed923b3.js");
|
|
139513
139564
|
}
|
|
139514
139565
|
}
|
|
139515
139566
|
function registerHTMLLanguageService(languageId, options = optionsDefault, modeConfiguration = getConfigurationDefault(languageId)) {
|
|
@@ -139607,7 +139658,7 @@ var getWorker = () => getMode$1().then((mode) => mode.getWorker());
|
|
|
139607
139658
|
monaco_editor_core_exports$1.languages.json = { jsonDefaults, getWorker };
|
|
139608
139659
|
function getMode$1() {
|
|
139609
139660
|
{
|
|
139610
|
-
return import("./jsonMode-
|
|
139661
|
+
return import("./jsonMode-92034391.js");
|
|
139611
139662
|
}
|
|
139612
139663
|
}
|
|
139613
139664
|
monaco_editor_core_exports$1.languages.register({
|
|
@@ -139883,7 +139934,7 @@ monaco_editor_core_exports.languages.typescript = {
|
|
|
139883
139934
|
};
|
|
139884
139935
|
function getMode() {
|
|
139885
139936
|
{
|
|
139886
|
-
return import("./tsMode-
|
|
139937
|
+
return import("./tsMode-67ddf297.js");
|
|
139887
139938
|
}
|
|
139888
139939
|
}
|
|
139889
139940
|
monaco_editor_core_exports.languages.onLanguage("typescript", () => {
|
|
@@ -190756,94 +190807,6 @@ const ThemeIcon = (props) => {
|
|
|
190756
190807
|
}
|
|
190757
190808
|
) });
|
|
190758
190809
|
};
|
|
190759
|
-
const defaultSchema = {
|
|
190760
|
-
componentName: "Root"
|
|
190761
|
-
};
|
|
190762
|
-
const emptyValue = { schema: void 0, config: void 0 };
|
|
190763
|
-
function useSchema(selectedContent) {
|
|
190764
|
-
const [schema, setSchema] = useState(emptyValue);
|
|
190765
|
-
const components = useFrontComponents();
|
|
190766
|
-
const pages = usePages();
|
|
190767
|
-
const componentsRef = useRef(components);
|
|
190768
|
-
const pagesRef = useRef(pages);
|
|
190769
|
-
componentsRef.current = components;
|
|
190770
|
-
pagesRef.current = pages;
|
|
190771
|
-
const templates = useTemplates();
|
|
190772
|
-
const templatesRef = useRef(templates);
|
|
190773
|
-
templatesRef.current = templates;
|
|
190774
|
-
useEffect(() => {
|
|
190775
|
-
var _a3, _b3, _c2, _d2, _e2, _f2, _g2, _h2, _i3, _j2;
|
|
190776
|
-
let code;
|
|
190777
|
-
let hasContent = false;
|
|
190778
|
-
let defaultConfig2;
|
|
190779
|
-
if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.Component) {
|
|
190780
|
-
const component = (_a3 = componentsRef.current) == null ? void 0 : _a3.find(
|
|
190781
|
-
(component2) => component2.id === selectedContent.id
|
|
190782
|
-
);
|
|
190783
|
-
if (component) {
|
|
190784
|
-
code = component.code;
|
|
190785
|
-
hasContent = true;
|
|
190786
|
-
}
|
|
190787
|
-
} else if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.PredefinedPage || (selectedContent == null ? void 0 : selectedContent.type) === ContentType.Page) {
|
|
190788
|
-
const page = (_b3 = pagesRef.current) == null ? void 0 : _b3.find(
|
|
190789
|
-
(item) => item.id === selectedContent.id
|
|
190790
|
-
);
|
|
190791
|
-
defaultConfig2 = {
|
|
190792
|
-
pageMeta: {
|
|
190793
|
-
seoTitle: (_c2 = page == null ? void 0 : page.meta) == null ? void 0 : _c2.seoTitle,
|
|
190794
|
-
seoDescription: (_d2 = page == null ? void 0 : page.meta) == null ? void 0 : _d2.seoDescription,
|
|
190795
|
-
seoKeywords: (_e2 = page == null ? void 0 : page.meta) == null ? void 0 : _e2.seoKeywords,
|
|
190796
|
-
ogTitle: (_f2 = page == null ? void 0 : page.meta) == null ? void 0 : _f2.ogTitle,
|
|
190797
|
-
ogDescription: (_g2 = page == null ? void 0 : page.meta) == null ? void 0 : _g2.ogDescription,
|
|
190798
|
-
ogType: (_h2 = page == null ? void 0 : page.meta) == null ? void 0 : _h2.ogType,
|
|
190799
|
-
ogImage: (_i3 = page == null ? void 0 : page.meta) == null ? void 0 : _i3.ogImage
|
|
190800
|
-
}
|
|
190801
|
-
};
|
|
190802
|
-
if (page) {
|
|
190803
|
-
code = page.code;
|
|
190804
|
-
hasContent = true;
|
|
190805
|
-
}
|
|
190806
|
-
} else if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.Template) {
|
|
190807
|
-
const template = (_j2 = templatesRef.current) == null ? void 0 : _j2.find(
|
|
190808
|
-
(template2) => template2.id === selectedContent.id
|
|
190809
|
-
);
|
|
190810
|
-
if (template) {
|
|
190811
|
-
code = template.code;
|
|
190812
|
-
hasContent = true;
|
|
190813
|
-
}
|
|
190814
|
-
}
|
|
190815
|
-
if (code) {
|
|
190816
|
-
transformCodeToSchema(code).then((value) => {
|
|
190817
|
-
setSchema({
|
|
190818
|
-
schema: { ...defaultSchema, children: (value == null ? void 0 : value.template) || [] },
|
|
190819
|
-
config: { ...defaultConfig2, ...value.resources }
|
|
190820
|
-
});
|
|
190821
|
-
});
|
|
190822
|
-
} else if (hasContent) {
|
|
190823
|
-
setSchema({
|
|
190824
|
-
schema: { ...defaultSchema, children: [] }
|
|
190825
|
-
});
|
|
190826
|
-
}
|
|
190827
|
-
}, [selectedContent == null ? void 0 : selectedContent.id, selectedContent == null ? void 0 : selectedContent.type]);
|
|
190828
|
-
console.log("===>schema", schema);
|
|
190829
|
-
return schema;
|
|
190830
|
-
}
|
|
190831
|
-
function useCloseDrawer() {
|
|
190832
|
-
const setDrawerType = useStudioStore((state) => state.setDrawerType);
|
|
190833
|
-
const drawerDocked = useStudioStore((state) => state.drawerDocked);
|
|
190834
|
-
const close = useCallback(() => {
|
|
190835
|
-
if (!drawerDocked) {
|
|
190836
|
-
setDrawerType(void 0);
|
|
190837
|
-
}
|
|
190838
|
-
}, [drawerDocked, setDrawerType]);
|
|
190839
|
-
return close;
|
|
190840
|
-
}
|
|
190841
|
-
function useIsBaseLangTheme() {
|
|
190842
|
-
var _a3, _b3;
|
|
190843
|
-
const theme = useStudioTheme();
|
|
190844
|
-
const website = useWebsite();
|
|
190845
|
-
return ((_a3 = theme == null ? void 0 : theme.lang) == null ? void 0 : _a3.id) === ((_b3 = website == null ? void 0 : website.baseLang) == null ? void 0 : _b3.id);
|
|
190846
|
-
}
|
|
190847
190810
|
function useImportTheme() {
|
|
190848
190811
|
const [isUploading, setIsUploading] = useState(false);
|
|
190849
190812
|
const [isImporting, setIsImporting] = useState(false);
|
|
@@ -198170,8 +198133,23 @@ function Welcome(props) {
|
|
|
198170
198133
|
] })
|
|
198171
198134
|
] });
|
|
198172
198135
|
}
|
|
198173
|
-
|
|
198136
|
+
async function uploadDeploymentFile(formData, deployURL) {
|
|
198137
|
+
console.log("uploadDeploymentFile to", deployURL);
|
|
198138
|
+
if (!deployURL) {
|
|
198139
|
+
throw new Error("No deploy URL");
|
|
198140
|
+
}
|
|
198141
|
+
const response = await fetch(deployURL, {
|
|
198142
|
+
method: "POST",
|
|
198143
|
+
body: formData
|
|
198144
|
+
});
|
|
198145
|
+
if (!response.ok) {
|
|
198146
|
+
throw new Error("Network response was not ok");
|
|
198147
|
+
}
|
|
198148
|
+
return await Promise.resolve();
|
|
198149
|
+
}
|
|
198150
|
+
const WebsiteToolbar = memo((props) => {
|
|
198174
198151
|
var _a3, _b3;
|
|
198152
|
+
const { deployUrl } = props;
|
|
198175
198153
|
const [isDeploying, setIsDeploying] = useState(false);
|
|
198176
198154
|
const setError = useEntifyWrapperStore((state) => state.setGlobalError);
|
|
198177
198155
|
const website = useWebsite();
|
|
@@ -198186,15 +198164,20 @@ const WebsiteToolbar = memo(() => {
|
|
|
198186
198164
|
const deployWebsite = useCallback(async () => {
|
|
198187
198165
|
try {
|
|
198188
198166
|
setIsDeploying(true);
|
|
198167
|
+
const content = "hello world";
|
|
198168
|
+
const blob = new Blob([content], { type: "text/plain" });
|
|
198169
|
+
const formData = new FormData();
|
|
198170
|
+
formData.append("websiteId", (website == null ? void 0 : website.id) || "");
|
|
198171
|
+
formData.append("file", blob, "test.txt");
|
|
198172
|
+
uploadDeploymentFile(formData, deployUrl).then(() => {
|
|
198173
|
+
setIsDeploying(false);
|
|
198174
|
+
});
|
|
198189
198175
|
} catch (e) {
|
|
198190
198176
|
const typedE = e;
|
|
198191
|
-
console.error(e);
|
|
198192
|
-
setError(typedE instanceof Error ? typedE.message : typedE);
|
|
198193
|
-
} finally {
|
|
198194
198177
|
setIsDeploying(false);
|
|
198178
|
+
setError(typedE instanceof Error ? typedE.message : typedE);
|
|
198195
198179
|
}
|
|
198196
|
-
|
|
198197
|
-
}, [setError]);
|
|
198180
|
+
}, [deployUrl, setError, website == null ? void 0 : website.id]);
|
|
198198
198181
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
198199
198182
|
"div",
|
|
198200
198183
|
{
|
|
@@ -202864,7 +202847,7 @@ function useCapabilities() {
|
|
|
202864
202847
|
useCapabilityTheme();
|
|
202865
202848
|
}
|
|
202866
202849
|
function WebsiteDesigner(props) {
|
|
202867
|
-
const { themeLoading } = props;
|
|
202850
|
+
const { themeLoading, deployUrl } = props;
|
|
202868
202851
|
const aiAgent = useAiAgent();
|
|
202869
202852
|
const [selected, setSelected] = useState("local");
|
|
202870
202853
|
const drawerType = useStudioStore((state) => state.drawerType);
|
|
@@ -202980,7 +202963,7 @@ function WebsiteDesigner(props) {
|
|
|
202980
202963
|
className: `dark flex-1 flex flex-col min-h-screen`,
|
|
202981
202964
|
ref: handleRefChange,
|
|
202982
202965
|
children: [
|
|
202983
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(WebsiteToolbar, {}),
|
|
202966
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(WebsiteToolbar, { deployUrl }),
|
|
202984
202967
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DocumentRoot, { doc, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "website-studio-core flex flex-1 h-full min-h-0 relative", children: [
|
|
202985
202968
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
202986
202969
|
LeftBar,
|
|
@@ -203031,20 +203014,20 @@ function WebsiteDesigner(props) {
|
|
|
203031
203014
|
);
|
|
203032
203015
|
}
|
|
203033
203016
|
const WebsiteStudio = (props) => {
|
|
203034
|
-
const {
|
|
203017
|
+
const { deployUrl, aiUrl, params } = props;
|
|
203035
203018
|
const { websiteId } = params;
|
|
203036
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(SiteRoot, { websiteId, children: /* @__PURE__ */ jsxRuntimeExports.jsx(WebsiteStudioInner, { aiUrl,
|
|
203019
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SiteRoot, { websiteId, children: /* @__PURE__ */ jsxRuntimeExports.jsx(WebsiteStudioInner, { aiUrl, deployUrl }) });
|
|
203037
203020
|
};
|
|
203038
203021
|
function WebsiteStudioInner(props) {
|
|
203039
203022
|
var _a3, _b3;
|
|
203040
|
-
const { aiUrl,
|
|
203023
|
+
const { aiUrl, deployUrl } = props;
|
|
203041
203024
|
const website = useWebsite();
|
|
203042
203025
|
const langId = ((_a3 = useCurrentLang()) == null ? void 0 : _a3.id) || ((_b3 = website == null ? void 0 : website.baseLang) == null ? void 0 : _b3.id);
|
|
203043
203026
|
const { data: theme, isLoading: themeLoading } = useOneTheme(
|
|
203044
203027
|
newThemeQueryOptions(website == null ? void 0 : website.id, langId)
|
|
203045
203028
|
);
|
|
203046
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(StudioRoot, { theme,
|
|
203047
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(EditorScope, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiAgentRoot, { endpoint: aiUrl, globalProvider: WEBSITE_DESIGN_PROMPT, children: /* @__PURE__ */ jsxRuntimeExports.jsx(WebsiteDesigner, { themeLoading }) }) }),
|
|
203029
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(StudioRoot, { theme, deployUrl, children: [
|
|
203030
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(EditorScope, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiAgentRoot, { endpoint: aiUrl, globalProvider: WEBSITE_DESIGN_PROMPT, children: /* @__PURE__ */ jsxRuntimeExports.jsx(WebsiteDesigner, { themeLoading, deployUrl }) }) }),
|
|
203048
203031
|
/* @__PURE__ */ jsxRuntimeExports.jsx(GlobalLoading, { loading: themeLoading })
|
|
203049
203032
|
] });
|
|
203050
203033
|
}
|
|
@@ -203913,12 +203896,12 @@ function ThemeDesigner(props) {
|
|
|
203913
203896
|
] });
|
|
203914
203897
|
}
|
|
203915
203898
|
const ThemeStudio = (props) => {
|
|
203916
|
-
const { aiUrl, themeId } = props;
|
|
203899
|
+
const { aiUrl, deployURL, themeId } = props;
|
|
203917
203900
|
const { data: theme, isLoading: themeLoading } = useOneThemeById(
|
|
203918
203901
|
themeId,
|
|
203919
203902
|
newThemeByIdQueryOptions()
|
|
203920
203903
|
);
|
|
203921
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(StudioRoot, { theme, children: [
|
|
203904
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(StudioRoot, { theme, deployUrl: deployURL, children: [
|
|
203922
203905
|
/* @__PURE__ */ jsxRuntimeExports.jsx(EditorScope, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiAgentRoot, { endpoint: aiUrl, globalProvider: WEBSITE_DESIGN_PROMPT, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeDesigner, {}) }) }),
|
|
203923
203906
|
/* @__PURE__ */ jsxRuntimeExports.jsx(GlobalLoading, { loading: themeLoading })
|
|
203924
203907
|
] });
|
|
@@ -203937,4 +203920,4 @@ export {
|
|
|
203937
203920
|
typescriptDefaults as t,
|
|
203938
203921
|
useCustomizedMaterials as u
|
|
203939
203922
|
};
|
|
203940
|
-
//# sourceMappingURL=index-
|
|
203923
|
+
//# sourceMappingURL=index-6ddf2099.js.map
|